/* Wandering Wojo — Field Guide landing page
   Vintage field guide / national park brochure direction.
   Pure CSS conversion of handoff/components/direction-a-fieldguide.jsx
*/

html, body { margin: 0; padding: 0; background: var(--paper); }
body {
  font-family: var(--mono);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
*, *::before, *::after { box-sizing: border-box; }
button { font: inherit; }
img { display: block; max-width: 100%; }

/* ============================================================
   ROOT
   ============================================================ */
.fg-root {
  background: var(--paper);
  color: var(--ink);
  font-family: var(--mono);
  min-height: 100vh;
  position: relative;
  overflow: hidden;
}
.fg-root::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image: radial-gradient(rgba(26, 24, 20, 0.05) 1px, transparent 1px);
  background-size: 4px 4px;
  pointer-events: none;
  z-index: 0;
}
.fg-root > * { position: relative; z-index: 1; }

.fg-edge { border-bottom: 2px solid var(--ink); }
.fg-edge-top { border-top: 2px solid var(--ink); }

.fg-meta {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: .28em;
  text-transform: uppercase;
  color: var(--ink-mute);
}

/* ============================================================
   1. TOP BAR
   ============================================================ */
.fg-topbar {
  display: flex;
  justify-content: space-evenly;
  align-items: center;
  padding: 10px 28px;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: .25em;
  text-transform: uppercase;
  color: var(--ink);
  gap: 12px;
}
.fg-topbar__rec { color: var(--vermillion-2); }

/* ============================================================
   2. MASTHEAD
   ============================================================ */
.fg-masthead {
  padding: 48px 56px 36px;
  position: relative;
}

.fg-masthead__stamp {
  position: absolute;
  top: 24px;
  right: 56px;
  transform: rotate(8deg);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 2.5px solid var(--vermillion-2);
  color: var(--vermillion-2);
  padding: 10px 16px;
  font-family: var(--mono);
  font-weight: 700;
  font-size: 11px;
  letter-spacing: .25em;
  background: rgba(244, 236, 216, 0.6);
  box-shadow:
    inset 0 0 0 4px rgba(244, 236, 216, 0.4),
    inset 0 0 0 5px var(--vermillion-2);
  z-index: 5;
}

.fg-masthead__grid {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 32px;
  align-items: end;
}

.fg-masthead__cat {
  position: relative;
}
.fg-masthead__cat img {
  height: 200px;
  width: auto;
}

.fg-masthead__title {
  text-align: left;
}
.fg-masthead__eyebrow {
  margin-bottom: 6px;
}
.fg-masthead__headline {
  font-family: var(--display);
  font-size: clamp(44px, 9vw, 132px);
  line-height: .82;
  letter-spacing: -.03em;
  color: var(--ink);
}
.fg-masthead__headline > span {
  display: block;
  white-space: nowrap;
}
.fg-masthead__headline br { display: none; }
.fg-masthead__headline--alt { color: var(--vermillion-2); }

.fg-masthead__est {
  text-align: right;
  display: flex;
  flex-direction: column;
  gap: 6px;
  align-items: flex-end;
}
.fg-masthead__est-hand {
  font-family: var(--hand);
  font-size: 36px;
  line-height: 1;
  color: var(--teal);
  transform: rotate(-4deg);
}

.fg-masthead__tagline {
  margin-top: 32px;
  display: flex;
  align-items: center;
  gap: 18px;
}
.fg-masthead__tagline hr {
  flex: 1;
  height: 0;
  border: none;
  border-top: 2px solid var(--ink);
  margin: 0;
}
.fg-masthead__tagline-text {
  font-family: var(--serif);
  font-style: italic;
  font-size: 22px;
  color: var(--ink-soft);
  text-align: center;
}

/* ============================================================
   3. CHAPTERS
   ============================================================ */
.fg-chapters {
  padding: 48px 56px 64px;
  position: relative;
  background: var(--paper);
  border-top: 2px solid var(--ink);
  border-bottom: 2px solid var(--ink);
}

.fg-section-head {
  display: flex;
  align-items: baseline;
  gap: 24px;
  margin-bottom: 36px;
}
.fg-section-head__num {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: .35em;
  color: var(--ink-mute);
}
.fg-section-head__title {
  font-family: var(--display);
  font-size: 42px;
  color: var(--ink);
  line-height: 1;
}
.fg-section-head__rule {
  flex: 1;
  height: 0;
  border: none;
  border-top: 1.5px solid var(--ink);
  align-self: center;
  margin: 0;
}
.fg-section-head__hand {
  font-family: var(--hand);
  font-size: 24px;
  color: var(--teal);
  transform: rotate(-2deg);
  white-space: nowrap;
}

.fg-chapters__grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 80px 56px;
  justify-items: center;
  padding: 20px 0 40px;
  position: relative;
}
.fg-chapters__slot { position: relative; }

/* ----- Notebook ----- */
.notebook {
  position: relative;
  display: block;
  width: 320px;
  height: 420px;
  transition: transform .3s cubic-bezier(0.16, 1, 0.3, 1), box-shadow .3s;
  cursor: pointer;
  text-decoration: none;
  color: inherit;
}
.notebook--upcoming { cursor: default; }

.notebook__shadow {
  position: absolute;
  inset: 0;
  background: var(--paper-deep);
  transform: translate(4px, 5px);
  border-radius: 2px 8px 4px 2px;
  box-shadow: var(--shadow-3);
  border: 1px solid var(--ink);
}
.notebook--upcoming .notebook__shadow {
  box-shadow: none;
  border: 2px dashed var(--ink-mute);
  background: transparent;
}

.notebook__edge {
  position: absolute;
  top: 6px;
  bottom: 6px;
  right: -2px;
  width: 6px;
  background: repeating-linear-gradient(0deg, var(--paper) 0 2px, var(--paper-deep) 2px 4px);
  border-radius: 0 4px 4px 0;
  border: 1px solid var(--ink);
  z-index: 2;
}

.notebook__cover {
  position: absolute;
  inset: 0;
  border-radius: 2px 6px 4px 2px;
  border: 1.5px solid var(--ink);
  padding: 24px 22px;
  display: flex;
  flex-direction: column;
  box-shadow:
    inset 0 0 0 4px rgba(244, 236, 216, 0.06),
    inset 0 0 0 5px rgba(0, 0, 0, 0.4);
  overflow: hidden;
  background: var(--cover-bg);
  color: var(--cover-ink);
}
.notebook--upcoming .notebook__cover {
  background: transparent;
  color: var(--ink-mute);
  border: 2.5px dashed var(--ink-mute);
  box-shadow: none;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

/* color variants — set --cover-bg, --cover-ink, --cover-stamp */
.notebook--vermillion {
  --cover-bg: var(--vermillion-2);
  --cover-ink: #F4ECD8;
  --cover-stamp: var(--mustard);
}
.notebook--teal {
  --cover-bg: var(--teal-2);
  --cover-ink: #F4ECD8;
  --cover-stamp: var(--mustard);
}
.notebook--mustard {
  --cover-bg: var(--mustard-2);
  --cover-ink: #1A1814;
  --cover-stamp: var(--vermillion-2);
}
.notebook--ink {
  --cover-bg: #1A1814;
  --cover-ink: #F4ECD8;
  --cover-stamp: var(--vermillion);
}

.notebook__top-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: .25em;
  opacity: .85;
}

.notebook__binding {
  position: absolute;
  left: 14px;
  top: 24px;
  bottom: 24px;
  width: 2px;
  background: rgba(255, 255, 255, 0.18);
}
.notebook__binding-dot {
  position: absolute;
  left: 13px;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--paper);
}
.notebook__binding-dot--top { top: 36px; }
.notebook__binding-dot--bot { bottom: 36px; }

.notebook__center {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}
.notebook__center svg { width: 80%; height: auto; opacity: .9; }
.notebook__center img { max-height: 200px; width: auto; opacity: .95; }
.notebook--mustard .notebook__center img { filter: invert(1); }

.notebook__abstract {
  width: 170px;
  height: 170px;
  border-radius: 50%;
  border: 3px solid var(--cover-stamp);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--display);
  font-size: 64px;
  color: var(--cover-stamp);
}

.notebook__title-block {
  border-top: 1px solid rgba(0, 0, 0, 0.2);
  padding-top: 14px;
}
.notebook--ink .notebook__title-block,
.notebook--teal .notebook__title-block,
.notebook--vermillion .notebook__title-block {
  border-top-color: rgba(244, 236, 216, 0.2);
}
.notebook__title {
  font-family: var(--display);
  font-size: 28px;
  line-height: 1;
  letter-spacing: -.01em;
  margin-bottom: 6px;
}
.notebook__subtitle {
  font-family: var(--hand);
  font-size: 22px;
  color: var(--cover-stamp);
  margin: 4px 0 8px;
}
.notebook__dates {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: .2em;
  opacity: .85;
}
.notebook__stats {
  display: flex;
  gap: 12px;
  margin-top: 10px;
  font-family: var(--mono);
  font-size: 10px;
  opacity: .75;
  flex-wrap: wrap;
}

.notebook__upcoming-chapter {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: .3em;
}
.notebook__upcoming-untitled {
  font-family: var(--hand);
  font-size: 42px;
  transform: rotate(-2deg);
}
.notebook__upcoming-coming {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: .2em;
  margin-top: 24px;
}

.notebook__active-tab {
  position: absolute;
  top: -8px;
  right: -12px;
  background: var(--mustard);
  color: var(--ink);
  font-family: var(--mono);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: .2em;
  padding: 4px 10px;
  border: 1.5px solid var(--ink);
  transform: rotate(8deg);
  box-shadow: 2px 2px 0 var(--ink);
  z-index: 3;
}

/* ============================================================
   4. ABOUT
   ============================================================ */
.fg-about {
  padding: 56px 56px 48px;
  background: var(--paper-2);
  position: relative;
  border-top: 2px solid var(--ink);
}
.fg-about__grid {
  display: grid;
  grid-template-columns: auto auto;
  gap: 56px;
  align-items: center;
  justify-content: center;
}

.polaroid {
  transform: rotate(-3deg);
  box-shadow: var(--shadow-3);
  position: relative;
}
.polaroid__inner {
  background: #fff;
  padding: 14px 14px 56px;
  border: 1px solid var(--ink);
  width: 300px;
  position: relative;
}
.polaroid__photo {
  width: 100%;
  aspect-ratio: 1 / 1;
  background: var(--paper-deep);
  border: 1px solid var(--ink-mute);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: .2em;
  color: var(--ink-mute);
}
.polaroid__photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.polaroid__caption {
  position: absolute;
  bottom: 14px;
  left: 14px;
  right: 14px;
  font-family: var(--hand);
  font-size: 24px;
  color: var(--ink);
  text-align: center;
}
.polaroid__tape {
  position: absolute;
  top: -12px;
  left: 50%;
  transform: translateX(-50%) rotate(-2deg);
  width: 80px;
  height: 24px;
  background: rgba(232, 178, 58, 0.6);
  border: 1px solid rgba(26, 24, 20, 0.15);
}
.letter {
  background: #FBF6E6;
  border: 1px solid var(--ink-mute);
  padding: 28px 36px 36px 60px;
  background-image: repeating-linear-gradient(transparent 0 33px, rgba(31, 138, 138, 0.22) 33px 34px);
  background-position-y: 14px;
  box-shadow: var(--shadow-2);
  position: relative;
  max-width: 720px;
}
.letter::before,
.letter::after {
  content: '';
  position: absolute;
  top: 0;
  bottom: 0;
  width: 1px;
  background: rgba(229, 66, 26, 0.45);
}
.letter::before { left: 42px; }
.letter::after  { left: 46px; }

.letter__body {
  font-family: var(--hand);
  font-size: 24px;
  line-height: 34px;
  color: var(--ink);
}
.letter__body p { margin: 0 0 34px; }
.letter__body p:last-child { margin-bottom: 0; }
.letter__signoff {
  font-family: var(--display);
  font-size: 24px;
  color: var(--vermillion-2);
  transform: rotate(-3deg);
  margin-top: 14px;
}

/* dark-mode overrides */
/* Letter paper stays warm/white with dark ink regardless of theme */
:root.auto-dark .letter {
  background-color: #FBF6E6;
  background-image: repeating-linear-gradient(transparent 0 33px, rgba(31, 138, 138, 0.22) 33px 34px);
}
:root.auto-dark .letter__body { color: #1A1814; }
:root.auto-dark .letter__signoff { color: var(--vermillion-2); }

/* Polaroid stays warm/white with dark ink */
:root.auto-dark .polaroid__inner { background: #E5DCC2; color: var(--ink); }
:root.auto-dark .polaroid__caption { color: #1A1814; }

/* Wojo cat line drawing (dark strokes on transparent) needs inverting on dark bg */
:root.auto-dark .fg-masthead__cat img { filter: invert(1); }

/* ============================================================
   5. DOCK
   ============================================================ */
.fg-dock {
  padding: 24px 56px;
  background: var(--ink);
  color: var(--paper);
  border-top: 2px solid var(--ink);
}
.fg-dock__grid {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 32px;
  align-items: center;
}
.fg-dock__left {
  display: flex;
  gap: 24px;
  flex-wrap: wrap;
}
.fg-dock__center {
  text-align: center;
  font-family: var(--display);
  font-size: 14px;
  letter-spacing: .04em;
  color: var(--paper);
  border-left: 1px solid var(--paper);
  border-right: 1px solid var(--paper);
  padding: 0 24px;
  white-space: nowrap;
}
.fg-dock__center-caption {
  font-family: var(--mono);
  font-size: 8px;
  letter-spacing: .3em;
  color: var(--mustard);
  margin-top: 2px;
}
.fg-dock__right {
  display: flex;
  gap: 18px;
  justify-content: flex-end;
  align-items: center;
  flex-wrap: wrap;
}

.dock-link {
  text-decoration: none;
  color: var(--paper);
  display: flex;
  flex-direction: column;
  transition: transform .2s ease;
}
.dock-link:hover { transform: translateY(-2px); }
.dock-link__eyebrow {
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: .3em;
  color: var(--accent);
}
.dock-link__name {
  font-family: var(--display);
  font-size: 18px;
  line-height: 1.1;
}

.dock-btn {
  background: transparent;
  border: 1.5px solid var(--paper);
  color: var(--paper);
  border-color: var(--paper);
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: .2em;
  font-weight: 700;
  padding: 8px 12px;
  cursor: pointer;
  transition: background .15s ease, color .15s ease;
}
.dock-btn:hover { background: var(--paper); color: var(--ink); }
.dock-btn--accent {
  color: var(--vermillion);
  border-color: var(--vermillion);
}
.dock-btn--accent:hover { background: var(--vermillion); color: var(--ink); }

/* ============================================================
   RESPONSIVE
   Mobile field-guide design — Direction A on a phone.
   Single-column flow, full-bleed bands with 2px ink edges,
   safe-area padding for notched phones.
   ============================================================ */

/* tablet / small desktop (960px and below) — stack the masthead
   and notebook grid but keep enough horizontal padding to feel
   like a guidebook spread, not a phone. */
@media (max-width: 960px) {
  .fg-masthead { padding: 36px 28px 28px; }
  .fg-masthead__stamp { right: 28px; top: 16px; padding: 8px 12px; font-size: 9px; }
  .fg-masthead__grid {
    grid-template-columns: 1fr;
    gap: 20px;
    align-items: start;
    text-align: center;
  }
  .fg-masthead__cat { justify-self: center; }
  .fg-masthead__cat img { height: 140px; }
  .fg-masthead__title { text-align: center; }
  .fg-masthead__est { align-items: center; text-align: center; }
  .fg-masthead__tagline { flex-direction: column; gap: 12px; }
  .fg-masthead__tagline-text { font-size: 18px; }

  .fg-chapters { padding: 36px 24px 48px; }
  .fg-section-head { flex-wrap: wrap; gap: 12px; }
  .fg-section-head__title { font-size: 32px; }
  .fg-section-head__rule { display: none; }

  .fg-chapters__grid {
    display: flex;
    flex-direction: column-reverse;
    gap: 56px;
    padding: 12px 0 24px;
    align-items: center;
  }

  .fg-about { padding: 40px 24px 36px; }
  .fg-about__grid {
    grid-template-columns: 1fr;
    gap: 36px;
    justify-items: center;
  }
  .letter { padding: 24px 28px 28px 52px; }
  .letter__body { font-size: 20px; line-height: 30px; }

  .fg-dock {
    padding: 20px 24px;
  }
  .fg-dock__grid {
    grid-template-columns: 1fr;
    gap: 18px;
    text-align: center;
    justify-items: center;
  }
  .fg-dock__left { justify-content: center; }
  .fg-dock__right { justify-content: center; }
  .fg-dock__center {
    border-left: none;
    border-right: none;
    padding: 8px 0;
    border-top: 1px solid var(--paper);
    border-bottom: 1px solid var(--paper);
  }

  .fg-topbar {
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px 18px;
    font-size: 9px;
    padding: 8px 16px;
  }
}

/* phone (≤640px) — full mobile field-guide layout */
@media (max-width: 640px) {
  html { -webkit-text-size-adjust: 100%; }
  .fg-root {
    padding: env(safe-area-inset-top) 0 env(safe-area-inset-bottom);
  }

  .fg-topbar {
    padding: 10px 16px;
    font-size: 9px;
    letter-spacing: .22em;
    gap: 6px 12px;
    line-height: 1;
  }

  .fg-masthead {
    padding: 28px 20px 24px;
    text-align: left;
  }
  .fg-masthead__stamp {
    top: 16px;
    right: 14px;
    padding: 6px 10px;
    font-size: 9px;
    border-width: 2px;
  }
  .fg-masthead__grid {
    grid-template-columns: 1fr;
    gap: 0;
    align-items: start;
    text-align: left;
  }
  .fg-masthead__cat {
    justify-self: start;
    margin: 4px 0 12px;
  }
  .fg-masthead__cat img { height: 140px; }
  .fg-masthead__title { text-align: left; }
  .fg-masthead__eyebrow { margin-bottom: 8px; }
  .fg-masthead__headline {
    /* WANDERING (9 chars) must fit on one line; ~6.6x font-size wide at -.035em */
    font-size: clamp(36px, 13vw, 64px);
    line-height: .85;
    letter-spacing: -.035em;
  }
  .fg-masthead__est {
    align-items: flex-start;
    text-align: left;
    margin-top: 14px;
  }
  .fg-masthead__est-hand { font-size: 32px; transform: rotate(-3deg); }
  .fg-masthead__tagline {
    margin-top: 22px;
    flex-direction: column;
    gap: 10px;
    align-items: stretch;
  }
  .fg-masthead__tagline hr { width: 100%; }
  .fg-masthead__tagline-text {
    font-size: 17px;
    line-height: 1.35;
    text-align: left;
  }

  /* sections */
  .fg-chapters,
  .fg-about {
    padding: 32px 20px 36px;
  }
  .fg-section-head {
    margin-bottom: 4px;
    padding-bottom: 10px;
    border-bottom: 1.5px solid var(--ink);
    gap: 12px;
    flex-wrap: wrap;
  }
  .fg-section-head__title { font-size: 28px; letter-spacing: -.01em; }
  .fg-section-head__rule { display: none; }
  .fg-section-head__hand {
    font-size: 22px;
    transform: rotate(-1deg);
    margin-top: 8px;
  }

  /* notebooks — column stack, fluid width, --tilt set inline by JS */
  .fg-chapters__grid {
    display: flex;
    flex-direction: column-reverse;
    gap: 36px;
    align-items: center;
    padding: 16px 0 8px;
  }
  .fg-chapters__slot {
    width: min(100%, 300px);
  }
  /* Hide the upcoming/placeholder notebook on mobile — only live chapters */
  .fg-chapters__slot:has(.notebook--upcoming) {
    display: none;
  }
  .notebook {
    width: 100%;
    height: auto;
    aspect-ratio: 320 / 420;
    padding: 0;
  }
  .notebook__cover {
    padding: 16px 14px;
  }
  .notebook__top-row { font-size: 9px; }
  .notebook__title { font-size: 17px; line-height: 1; text-wrap: balance; }
  .notebook__subtitle { font-size: 19px; margin: 2px 0 6px; }
  .notebook__dates { font-size: 9px; margin-bottom: 8px; }
  .notebook__stats {
    display: grid;
    grid-template-columns: 1fr 1fr;
    row-gap: 3px;
    column-gap: 8px;
    font-size: 9px;
  }
  .notebook__stats span { display: block; }
  .notebook__abstract { width: 130px; height: 130px; font-size: 48px; }
  .notebook__center img { max-height: 150px; }
  .notebook__upcoming-untitled { font-size: 36px; }

  /* about */
  .fg-about__grid {
    gap: 24px;
  }
  .polaroid { transform: rotate(-3deg); }
  .polaroid__inner { width: min(86vw, 240px); padding: 12px 12px 44px; }
  .polaroid__caption { font-size: 22px; bottom: 12px; }
  .letter {
    padding: 20px 20px 24px 40px;
    background-image: repeating-linear-gradient(
      to bottom,
      transparent 0,
      transparent 27px,
      rgba(31, 138, 138, 0.28) 27px,
      rgba(31, 138, 138, 0.28) 28px
    );
    background-position: 0 42px;
  }
  .letter::before { left: 28px; }
  .letter::after  { left: 32px; }
  .letter__body {
    font-size: 21px;
    line-height: 28px;
  }
  .letter__body p { margin: 0 0 28px; }
  .letter__signoff { font-size: 22px; margin-top: 6px; }

  /* dock — stacked vertical with dashed link list, 2-col btn grid */
  .fg-dock {
    padding: 24px 20px max(28px, env(safe-area-inset-bottom));
  }
  .fg-dock__grid {
    grid-template-columns: 1fr;
    gap: 22px;
    text-align: left;
    justify-items: stretch;
  }
  .fg-dock__center {
    order: -1;
    border-left: 0;
    border-right: 0;
    border-top: 1px solid var(--paper);
    border-bottom: 1px solid var(--paper);
    padding: 8px 0 6px;
    font-size: 18px;
  }
  .fg-dock__center-caption { font-size: 8px; }
  .fg-dock__left {
    flex-direction: column;
    gap: 0;
    justify-content: stretch;
    align-items: stretch;
  }
  .dock-link {
    flex-direction: column;
    gap: 2px;
    padding: 6px 0;
    border-bottom: 1px dashed rgba(244, 236, 216, 0.25);
  }
  .dock-link:last-child { border-bottom: 0; }
  .dock-link__name { font-size: 18px; }
  .fg-dock__right {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
    justify-content: stretch;
  }
  .dock-btn {
    min-height: 40px;
    padding: 10px 8px;
    text-align: center;
  }
}

/* extra-small (≤380px) — tighten padding so WANDERING still fits */
@media (max-width: 380px) {
  .fg-masthead { padding: 24px 16px 20px; }
  .fg-chapters,
  .fg-about { padding: 28px 16px 32px; }
  .fg-masthead__headline { font-size: clamp(34px, 12.5vw, 44px); }
  .fg-section-head__title { font-size: 24px; }
}

/* ============================================================
   6. MODAL (poll / message / donate / rss)
   Field-guide popups: paper card, ink border, vermillion stamp.
   ============================================================ */
.fg-modal[hidden] { display: none; }
.fg-modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.fg-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(26, 24, 20, 0.62);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
  cursor: pointer;
  animation: fg-modal-fade .18s ease-out;
}
.fg-modal__card {
  position: relative;
  background-color: #FBF6E6;
  background-image:
    radial-gradient(rgba(26,24,20,0.04) 1px, transparent 1px),
    radial-gradient(rgba(26,24,20,0.025) 1px, transparent 1px);
  background-size: 3px 3px, 7px 7px;
  background-position: 0 0, 1px 2px;
  color: var(--ink);
  border: 2px solid var(--ink);
  box-shadow: var(--shadow-3);
  width: min(560px, 100%);
  max-height: calc(100vh - 60px);
  overflow-y: auto;
  padding: 36px 36px 32px;
  transform: rotate(-.6deg);
  animation: fg-modal-pop .24s cubic-bezier(.2, 1.2, .4, 1);
}
.fg-modal__close {
  position: absolute;
  top: 10px;
  right: 14px;
  background: none;
  border: none;
  color: var(--ink);
  font-size: 30px;
  line-height: 1;
  cursor: pointer;
  padding: 4px 10px;
  font-family: var(--display);
  transition: color .15s, transform .15s;
}
.fg-modal__close:hover { color: var(--vermillion-2); transform: rotate(90deg); }
.fg-modal__stamp {
  display: inline-block;
  border: 2.5px solid var(--vermillion-2);
  color: var(--vermillion-2);
  padding: 6px 14px;
  font-family: var(--mono);
  font-weight: 700;
  font-size: 10px;
  letter-spacing: .3em;
  background: rgba(244, 236, 216, 0.7);
  transform: rotate(-3deg);
  margin-bottom: 14px;
}
.fg-modal__title {
  font-family: var(--display);
  font-size: clamp(28px, 4.4vw, 40px);
  line-height: 1;
  margin: 0 0 18px;
  color: var(--ink);
}
.fg-modal__body { font-family: var(--serif); }
.fg-modal__intro {
  font-family: var(--serif);
  font-size: 17px;
  line-height: 1.45;
  color: var(--ink-soft);
  margin: 0 0 20px;
}
.fg-modal__foot {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: .15em;
  color: var(--ink-mute);
  margin: 16px 0 0;
}
.fg-modal__foot a {
  color: var(--teal-2);
  text-decoration: underline;
  text-underline-offset: 2px;
}

/* --- Poll panel --- */
.fg-poll__options { display: flex; flex-direction: column; gap: 10px; }
.fg-poll__option {
  position: relative;
  text-align: left;
  background: #FBF6E6;
  border: 1.5px solid var(--ink);
  color: var(--ink);
  font-family: var(--hand);
  font-size: 22px;
  line-height: 1.1;
  padding: 12px 18px;
  cursor: pointer;
  overflow: hidden;
  transition: transform .12s ease, background .15s ease;
}
.fg-poll__option:hover:not(.fg-poll__option--voted) {
  transform: translateX(3px);
  background: var(--paper-deep);
}
.fg-poll__option--voted { cursor: default; }
.fg-poll__option-bar {
  position: absolute;
  top: 0; left: 0; bottom: 0;
  background: rgba(229, 66, 26, 0.18);
  z-index: 0;
  transition: width .4s ease;
}
.fg-poll__option--selected .fg-poll__option-bar { background: rgba(229, 66, 26, 0.34); }
.fg-poll__option--selected { border-color: var(--vermillion-2); }
.fg-poll__option-label,
.fg-poll__option-count {
  position: relative;
  z-index: 1;
}
.fg-poll__option-count {
  float: right;
  font-family: var(--mono);
  font-size: 13px;
  letter-spacing: .12em;
  color: var(--ink-mute);
  margin-left: 12px;
}

/* --- Form panel (message) --- */
.fg-form { display: flex; flex-direction: column; gap: 12px; }
.fg-form__input {
  width: 100%;
  background: #FBF6E6;
  border: 1.5px solid var(--ink);
  color: var(--ink);
  padding: 12px 14px;
  font-family: var(--serif);
  font-size: 16px;
  line-height: 1.4;
  resize: vertical;
}
.fg-form__input:focus {
  outline: none;
  border-color: var(--vermillion-2);
  box-shadow: 0 0 0 3px rgba(229, 66, 26, 0.18);
}
.fg-form__file-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: .2em;
  color: var(--ink-mute);
  cursor: pointer;
  padding: 6px 0;
  align-self: flex-start;
}
.fg-form__file-label:hover { color: var(--vermillion-2); }
.fg-form__file-icon { font-size: 16px; }
.fg-form__file-input { display: none; }
.fg-form__file-name {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--ink-soft);
}
.fg-form__btn {
  align-self: flex-start;
  background: var(--vermillion);
  border: 2px solid var(--vermillion-2);
  color: #FBF6E6;
  font-family: var(--mono);
  font-weight: 700;
  font-size: 12px;
  letter-spacing: .25em;
  padding: 12px 22px;
  cursor: pointer;
  transition: background .15s, transform .12s;
}
.fg-form__btn:hover:not(:disabled) { background: var(--vermillion-2); transform: translateY(-1px); }
.fg-form__btn:disabled { opacity: .65; cursor: default; }

/* --- Donate panel --- */
.fg-donate__frame {
  border: 1.5px solid var(--ink);
  background: #FBF6E6;
  padding: 4px;
  overflow: hidden;
}
.fg-donate__frame iframe { display: block; width: 100%; }

/* --- RSS panel --- */
.fg-rss__url {
  display: flex;
  align-items: stretch;
  border: 1.5px solid var(--ink);
  background: #FBF6E6;
  margin-bottom: 14px;
}
.fg-rss__url-text {
  flex: 1;
  padding: 12px 14px;
  font-family: var(--mono);
  font-size: 13px;
  color: var(--ink);
  word-break: break-all;
  user-select: all;
}
.fg-rss__copy {
  background: var(--ink);
  color: #FBF6E6;
  border: none;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: .2em;
  padding: 0 18px;
  cursor: pointer;
  transition: background .15s;
}
.fg-rss__copy:hover { background: var(--vermillion-2); }
.fg-rss__copy--ok { background: var(--moss); }
.fg-rss__open {
  display: inline-block;
  font-family: var(--hand);
  font-size: 22px;
  color: var(--vermillion-2);
  text-decoration: none;
  margin-top: 6px;
}
.fg-rss__open:hover { text-decoration: underline; text-underline-offset: 4px; }

/* Modal stays on warm paper in dark mode (matches polaroid/letter behavior).
   Re-scope ink/paper tokens to their light-mode values so every descendant
   that uses var(--ink*) renders dark text on warm paper, regardless of theme. */
:root.auto-dark .fg-modal__card {
  --paper:      #F4ECD8;
  --paper-2:    #EADFC4;
  --paper-deep: #E0D2B0;
  --ink:        #1A1814;
  --ink-soft:   #3A332A;
  --ink-mute:   #6B5F4F;
  --rule:       #1A1814;
  background-color: #FBF6E6;
  color: var(--ink);
}

@keyframes fg-modal-fade {
  from { opacity: 0; }
  to   { opacity: 1; }
}
@keyframes fg-modal-pop {
  from { opacity: 0; transform: rotate(-.6deg) translateY(14px) scale(.96); }
  to   { opacity: 1; transform: rotate(-.6deg) translateY(0) scale(1); }
}

@media (max-width: 640px) {
  .fg-modal { padding: 12px; }
  .fg-modal__card {
    padding: 28px 22px 24px;
    transform: rotate(0);
    max-height: calc(100vh - 24px);
  }
  .fg-modal__title { font-size: 26px; }
  .fg-modal__intro { font-size: 16px; }
}

/* ===== Toast (used by message form) ===== */
.fg-toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--ink);
  color: #FBF6E6;
  padding: 14px 22px;
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: .15em;
  border: 2px solid var(--vermillion);
  box-shadow: var(--shadow-2);
  z-index: 1100;
  opacity: 0;
  transition: opacity .25s ease, transform .25s ease;
  max-width: 90vw;
  text-align: center;
}
.fg-toast--visible { opacity: 1; transform: translateX(-50%) translateY(0); }
