/* =========================================================================
   SHARED PAGE PATTERNS — extracted from the map page's polish
   Used by archive, plan, glossary, about, contact, taxonomy pages.
   ========================================================================= */

/* ---- Page shell — paper-aged background ---------------------------- */
.page-shell {
  position: relative;
  background:
    radial-gradient(ellipse at 20% 10%, rgba(228, 174, 36, 0.18), transparent 55%),
    radial-gradient(ellipse at 85% 80%, rgba(13, 93, 77, 0.12), transparent 55%),
    radial-gradient(ellipse at 50% 100%, rgba(176, 36, 36, 0.08), transparent 55%),
    var(--paper-aged);
  overflow: hidden;
}
.page-shell::before {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  opacity: 0.5;
  mix-blend-mode: multiply;
  background:
    radial-gradient(circle at 12% 22%, rgba(150,100,30,0.1), transparent 35%),
    radial-gradient(circle at 88% 72%, rgba(120,80,20,0.08), transparent 35%),
    repeating-linear-gradient(0deg, transparent 0 14px, rgba(120,80,20,0.025) 14px 15px);
}

/* ---- Theatrical hero ----------------------------------------------- */
.page-hero {
  position: relative;
  padding: clamp(120px, 14vw, 180px) 0 clamp(70px, 8vw, 110px);
  overflow: hidden;
  text-align: center;
}
.page-hero .lantern-string { top: -10px; z-index: 4; }
.page-hero .petals { z-index: 1; }
.page-hero__inner {
  position: relative;
  z-index: 5;
  max-width: var(--container-wide);
  margin: 0 auto;
  padding: 0 var(--s-5);
}
.page-hero__eyebrow {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--temple-red);
}
.page-hero__eyebrow::before {
  content: ""; display: inline-block; width: 32px; height: 1px;
  background: currentColor; vertical-align: middle; margin-right: 14px;
  transform: translateY(-2px);
}
.page-hero h1 {
  font-family: "Charm", "Mali", serif;
  font-size: clamp(3rem, 8vw, 6.5rem);
  line-height: 0.95;
  margin: var(--s-4) 0 var(--s-5);
  letter-spacing: -0.025em;
  color: var(--ink);
}
.page-hero h1 em {
  color: var(--saffron);
  font-style: italic;
  font-family: var(--font-display);
  font-variation-settings: "SOFT" 100, "WONK" 1;
  text-shadow: 0 0 24px rgba(224, 116, 16, 0.4);
}
.page-hero h1 em.glow-emerald {
  color: var(--emerald-deep);
  text-shadow: 0 0 24px rgba(13, 93, 77, 0.4);
}
.page-hero h1 em.glow-crimson {
  color: var(--temple-red);
  text-shadow: 0 0 24px rgba(176, 36, 36, 0.4);
}
.page-hero__lede {
  font-family: var(--font-display);
  font-style: italic;
  font-variation-settings: "SOFT" 100, "WONK" 1;
  font-size: clamp(1.2rem, 1.6vw, 1.5rem);
  color: var(--ink-soft);
  max-width: 60ch;
  margin: var(--s-4) auto 0;
  line-height: 1.45;
}

/* ---- Stats counter strip ------------------------------------------- */
.page-hero__stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0;
  max-width: 880px;
  margin: var(--s-7) auto 0;
  border-top: 1px solid var(--ink);
  border-bottom: 1px solid var(--ink);
  background: rgba(250, 246, 239, 0.6);
}
.page-hero__stat {
  padding: var(--s-4) var(--s-3);
  border-right: 1px solid var(--line);
  text-align: center;
}
.page-hero__stat:last-child { border-right: none; }
.page-hero__stat strong {
  font-family: var(--font-display);
  font-size: clamp(2.2rem, 3.5vw, 3rem);
  display: block;
  line-height: 1;
  color: var(--temple-red);
  font-weight: 400;
}
.page-hero__stat span.label {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--ink-soft);
  display: block;
  margin-top: 6px;
}
.page-hero__stat .thai {
  font-family: "Bai Jamjuree", sans-serif;
  font-size: 0.85rem;
  color: var(--emerald);
  letter-spacing: 0.02em;
  text-transform: none;
  margin-top: 2px;
  display: block;
}
@media (max-width: 720px) {
  .page-hero__stats { grid-template-columns: repeat(2, 1fr); }
  .page-hero__stat:nth-child(2n) { border-right: none; }
  .page-hero__stat:nth-child(-n+2) { border-bottom: 1px solid var(--line); }
}

/* ---- Compass corner ornament --------------------------------------- */
.page-hero__compass {
  position: absolute;
  top: var(--s-5);
  right: var(--s-5);
  width: 86px; height: 86px;
  z-index: 6; opacity: 0.7;
}
.page-hero__compass svg {
  width: 100%; height: 100%;
  animation: page-compass-bob 8s ease-in-out infinite;
  transform-origin: center;
}
@keyframes page-compass-bob {
  0%, 100% { transform: rotate(-2deg); }
  50%      { transform: rotate(2deg); }
}
@media (max-width: 720px) { .page-hero__compass { display: none; } }

/* ---- Decorative frame (paper card with kanok corners) -------------- */
.page-frame {
  position: relative;
  background: linear-gradient(180deg, #f7e9c4 0%, #ead2a0 100%);
  border: 1px solid rgba(120, 80, 20, 0.4);
  border-radius: var(--radius);
  padding: var(--s-6) var(--s-5) var(--s-6);
  box-shadow:
    inset 0 0 80px rgba(120, 80, 20, 0.22),
    0 30px 60px -36px rgba(26, 22, 18, 0.5);
}
.page-frame::before, .page-frame::after {
  content: ""; position: absolute; width: 56px; height: 56px;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 80 80' fill='%238a6038'><path d='M40 4 C 45 14, 56 22, 70 24 C 58 26, 52 32, 50 42 C 48 32, 44 28, 40 28 C 36 28, 32 32, 30 42 C 28 32, 22 26, 10 24 C 24 22, 35 14, 40 4 Z'/></svg>") center / contain no-repeat;
  opacity: 0.5;
  pointer-events: none;
}
.page-frame::before { top: -8px; left: -8px; transform: rotate(-15deg); }
.page-frame::after  { bottom: -8px; right: -8px; transform: rotate(165deg); }

.page-frame__paperfold {
  position: absolute; inset: 0; pointer-events: none;
  background:
    linear-gradient(180deg, transparent 33%, rgba(120,80,20,0.05) 33%, rgba(120,80,20,0.05) 33.5%, transparent 33.5%, transparent 66%, rgba(120,80,20,0.05) 66%, rgba(120,80,20,0.05) 66.5%, transparent 66.5%),
    linear-gradient(90deg, transparent 33%, rgba(120,80,20,0.05) 33%, rgba(120,80,20,0.05) 33.5%, transparent 33.5%, transparent 66%, rgba(120,80,20,0.05) 66%, rgba(120,80,20,0.05) 66.5%, transparent 66.5%);
  border-radius: var(--radius);
}
.page-frame__inner {
  position: relative;
  z-index: 1;
  background: rgba(250, 246, 239, 0.7);
  padding: var(--s-6);
  border-radius: calc(var(--radius) - 4px);
}

/* ---- Chip-style filter bar (matches map page) ---------------------- */
.page-filters {
  position: sticky;
  top: 64px;
  z-index: 30;
  background: rgba(250, 246, 239, 0.92);
  backdrop-filter: blur(14px) saturate(140%);
  -webkit-backdrop-filter: blur(14px) saturate(140%);
  border-block: 1px solid var(--line);
}
.page-filters__inner {
  max-width: var(--container-wide);
  margin: 0 auto;
  padding: var(--s-4) var(--s-5);
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: var(--s-5);
  align-items: center;
}
@media (max-width: 1100px) { .page-filters__inner { grid-template-columns: 1fr; } }

.page-filters .search-wrap {
  position: relative;
}
.page-filters .search-wrap::before {
  content: ""; position: absolute; left: 18px; top: 50%;
  width: 14px; height: 14px;
  transform: translateY(-50%);
  background: var(--ink);
  -webkit-mask: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><circle cx='11' cy='11' r='7' fill='none' stroke='%23000' stroke-width='2'/><line x1='17' y1='17' x2='22' y2='22' stroke='%23000' stroke-width='2' stroke-linecap='round'/></svg>") no-repeat center / contain;
  mask: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><circle cx='11' cy='11' r='7' fill='none' stroke='%23000' stroke-width='2'/><line x1='17' y1='17' x2='22' y2='22' stroke='%23000' stroke-width='2' stroke-linecap='round'/></svg>") no-repeat center / contain;
}
.page-filters .search-input {
  width: 100%;
  padding: 12px 18px 12px 42px;
  font-family: var(--font-display);
  font-size: 1rem;
  border: 1px solid var(--ink);
  background: var(--paper);
  border-radius: 999px;
  color: var(--ink);
  letter-spacing: -0.005em;
}
.page-filters .search-input:focus { outline: 2px solid var(--saffron); outline-offset: 4px; }

.page-filters .filter-groups {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}
.page-filters .chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 999px;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink);
  cursor: pointer;
  transition: all 0.2s ease;
}
.page-filters .chip small {
  font-family: "Bai Jamjuree", sans-serif;
  font-size: 10px;
  letter-spacing: 0.02em;
  color: var(--emerald);
  text-transform: none;
  margin-left: 2px;
  opacity: 0.7;
}
.page-filters .chip:hover { border-color: var(--ink); transform: translateY(-1px); }
.page-filters .chip.is-active {
  background: var(--ink);
  color: var(--paper);
  border-color: var(--ink);
}
.page-filters .chip.is-active small { color: var(--saffron-light); opacity: 1; }
.page-filters .chip__dot {
  width: 10px; height: 10px;
  border-radius: 50%;
  border: 1.5px solid rgba(255, 255, 255, 0.6);
  box-shadow: 0 0 0 1px rgba(0,0,0,0.15);
}
.page-filters .chip--region { border-style: dashed; }
.page-filters .chip--toggle {
  background: var(--saffron);
  color: var(--paper);
  border-color: var(--saffron);
}
.page-filters .chip--toggle.is-active {
  background: var(--ink);
  border-color: var(--ink);
}
.page-filters .chip-divider {
  width: 1px; height: 28px; background: var(--line); margin: 0 4px;
}
.page-filters .filter-meta {
  margin-left: auto;
  display: flex; align-items: center; gap: var(--s-4);
}
.page-filters .filter-meta__count {
  font-family: var(--font-display);
  font-style: italic;
  font-size: 1.05rem;
  color: var(--temple-red);
  font-variation-settings: "SOFT" 100, "WONK" 1;
}
.page-filters .filter-meta select {
  padding: 8px 32px 8px 14px;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  border: 1px solid var(--line);
  background: var(--paper);
  border-radius: 999px;
  color: var(--ink);
  cursor: pointer;
}
.page-filters .filter-meta .btn-reset {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  padding: 6px 12px;
  border: 1px solid var(--ink);
  background: transparent;
  border-radius: 999px;
  cursor: pointer;
  color: var(--ink-soft);
}
.page-filters .filter-meta .btn-reset:hover { background: var(--ink); color: var(--paper); }

/* ---- Stats strip below content ------------------------------------- */
.page-stats {
  padding-block: var(--s-8);
  background: linear-gradient(180deg, var(--paper-warm) 0%, var(--paper-cream) 100%);
  border-block: 1px solid var(--line);
}
.page-stats__grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0;
  border-block: 1px solid var(--ink);
}
.page-stats__cell {
  padding: var(--s-5) var(--s-4);
  border-right: 1px solid var(--line);
  background: var(--paper);
  text-align: center;
}
.page-stats__cell:last-child { border-right: none; }
.page-stats__label {
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--ink-soft);
  margin-bottom: 8px;
}
.page-stats__value {
  font-family: "Charm", "Mali", serif;
  font-size: clamp(1.6rem, 2.5vw, 2.2rem);
  color: var(--temple-red);
  line-height: 1;
}
.page-stats__sub {
  font-family: var(--font-display);
  font-style: italic;
  font-size: 0.9rem;
  color: var(--ink-soft);
  margin-top: 6px;
  font-variation-settings: "SOFT" 80;
}
@media (max-width: 900px) {
  .page-stats__grid { grid-template-columns: repeat(2, 1fr); }
  .page-stats__cell:nth-child(2n) { border-right: none; }
  .page-stats__cell { border-bottom: 1px solid var(--line); }
}

/* ---- Universal hidden state for filters ---------------------------- */
.is-hidden { display: none !important; }

/* ---- Section header with brush divider above ----------------------- */
.page-section-head {
  text-align: center;
  margin-bottom: var(--s-6);
}
.page-section-head h2 {
  font-family: "Charm", "Mali", serif;
  font-size: clamp(2rem, 4vw, 3.2rem);
  color: var(--ink);
  line-height: 0.95;
}
.page-section-head h2 em {
  color: var(--saffron-deep);
  font-family: var(--font-display);
  font-style: italic;
  font-variation-settings: "SOFT" 100, "WONK" 1;
}
.page-section-head .eyebrow {
  display: inline-block;
}

/* ---- Card-grid (consistent across pages) — hover effect upgrade --- */
.page-grid .card {
  border: 1px solid rgba(120,80,20,0.18);
}
.page-grid .card:hover {
  border-color: var(--ink);
  transform: translateY(-6px);
  box-shadow: 0 32px 60px -30px rgba(26, 22, 18, 0.4);
}

/* ---- Reusable compass SVG inline class ----------------------------- */
.compass-default {
  width: 86px; height: 86px;
}
