/* ===========================================================================
   Sophia · Girlfriend's Day
   ---------------------------------------------------------------------------
   Colours live in :root below. --green is the accent and is swapped at runtime
   when she wins the colour game in Sophia's section (her real colour, #194a44).
   =========================================================================== */

:root {
  /* palette */
  --green: #2f7a55;          /* driven by the slider */
  --green-soft: #2f7a5522;
  --green-line: #2f7a5533;

  /* the page is a soft pink; --line is every card border */
  --bg:      #fdf3f2;
  --bg-alt:  #f9e7e5;
  --paper:   #fffbfa;
  --line:    #f1dcd9;
  --ink:     #2b2321;
  --ink-2:   #64564f;
  --ink-3:   #9a8781;
  --blush:   #e8a9a0;
  --gold:    #d8a24a;

  /* type */
  --serif: "Fraunces", "Iowan Old Style", Georgia, "Times New Roman", serif;
  --sans:  "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;

  /* layout */
  --wrap: 1120px;
  --wrap-narrow: 720px;
  --pad: clamp(1.15rem, 4vw, 2.5rem);
  --radius: 18px;
  --radius-sm: 12px;

  --shadow-sm: 0 1px 2px rgba(84, 45, 42, .05), 0 4px 12px rgba(84, 45, 42, .05);
  --shadow-md: 0 2px 6px rgba(84, 45, 42, .06), 0 18px 40px rgba(84, 45, 42, .09);

  --ease: cubic-bezier(.22, .61, .36, 1);
}

* { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: 76px;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: clamp(1rem, .97rem + .18vw, 1.075rem);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

img { max-width: 100%; display: block; }
button { font: inherit; color: inherit; }

h1, h2, h3 {
  font-family: var(--serif);
  font-weight: 600;
  line-height: 1.1;
  margin: 0;
  letter-spacing: -.01em;
}

a { color: var(--green); }

::selection { background: var(--blush); color: var(--ink); }

:focus-visible {
  outline: 2px solid var(--green);
  outline-offset: 3px;
  border-radius: 4px;
}

.skip {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--paper);
  padding: .75rem 1rem;
  z-index: 200;
}
.skip:focus { left: .5rem; top: .5rem; }

/* --------------------------------------------------------------- layout -- */
.wrap {
  width: 100%;
  max-width: var(--wrap);
  margin-inline: auto;
  padding-inline: var(--pad);
}
.wrap--narrow { max-width: var(--wrap-narrow); }

/* z-index keeps content above the falling petals */
.section { padding-block: clamp(3.5rem, 9vw, 7rem); position: relative; z-index: 2; }
.section--alt { background: var(--bg-alt); }

.section__head { max-width: 46rem; margin-bottom: clamp(2rem, 5vw, 3.25rem); }
.section__kicker {
  font-size: .74rem;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--green);
  margin: 0 0 .7rem;
  font-weight: 600;
}
.section__title { font-size: clamp(2rem, 1.4rem + 3vw, 3.35rem); }
.section__intro { color: var(--ink-2); margin-top: 1rem; }

/* placeholder highlight — anything in [[ brackets ]] in content.js */
.ph {
  background: linear-gradient(transparent 58%, #ffe9a8 58%);
  box-shadow: inset 0 0 0 1px #f0d08a55;
  border-radius: 3px;
  padding: 0 .2em;
  color: #6b5518;
  font-style: italic;
}

/* rich text */
.prose p { margin: 0 0 1em; }
.prose p:last-child { margin-bottom: 0; }
.prose strong { font-weight: 600; }
.prose em { font-style: italic; }

/* reveal on scroll */
.reveal {
  opacity: 0;
  transform: translateY(18px);
  transition: opacity .7s var(--ease), transform .7s var(--ease);
}
.reveal.is-in { opacity: 1; transform: none; }

/* ------------------------------------------------------------- petals -- */
#petal-canvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 1;
}

/* ---------------------------------------------------------------- nav -- */
.nav {
  position: sticky;
  top: 0;
  z-index: 60;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  border-bottom: 1px solid transparent;
  transition: border-color .3s var(--ease), background .3s var(--ease);
}
.nav.is-stuck { border-bottom-color: var(--green-line); }

.nav__inner {
  max-width: var(--wrap);
  margin-inline: auto;
  padding: .7rem var(--pad);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.nav__mark {
  font-family: var(--serif);
  font-size: 1.05rem;
  letter-spacing: .04em;
  text-decoration: none;
  color: var(--ink);
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: .45rem;
}
.nav__bloom { font-size: .95em; }

.nav__links {
  display: flex;
  gap: clamp(.5rem, 2vw, 1.6rem);
  overflow-x: auto;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
  margin-right: calc(var(--pad) * -1);
  padding-right: var(--pad);
}
.nav__links::-webkit-scrollbar { display: none; }

.nav__links a {
  color: var(--ink-2);
  text-decoration: none;
  font-size: .85rem;
  font-weight: 500;
  white-space: nowrap;
  padding: .35rem 0;
  border-bottom: 1.5px solid transparent;
  transition: color .25s var(--ease), border-color .25s var(--ease);
}
.nav__links a:hover { color: var(--green); }
.nav__links a.is-active { color: var(--green); border-bottom-color: var(--green); }

/* --------------------------------------------------------------- hero -- */
.hero {
  position: relative;
  z-index: 2;
  min-height: min(92svh, 900px);
  display: grid;
  place-items: center;
  text-align: center;
  padding: clamp(3rem, 10vw, 6rem) var(--pad) 5rem;
  background:
    radial-gradient(100% 70% at 50% -10%, #fffdfdee 0%, transparent 58%),
    radial-gradient(85% 55% at 10% 108%, #f8ccc6cc 0%, transparent 62%),
    radial-gradient(85% 55% at 90% 102%, #fbdfd2cc 0%, transparent 60%);
}

.hero__inner { max-width: 56rem; }

.hero__badge {
  display: inline-block;
  font-size: .72rem;
  letter-spacing: .2em;
  text-transform: uppercase;
  font-weight: 600;
  color: var(--green);
  border: 1px solid var(--green-line);
  background: color-mix(in srgb, var(--paper) 70%, transparent);
  border-radius: 999px;
  padding: .4rem .9rem;
  margin: 0 0 1.4rem;
}

.hero__occasion {
  font-family: var(--serif);
  font-style: italic;
  color: var(--ink-3);
  margin: 0 0 .4rem;
  font-size: clamp(1rem, .9rem + .5vw, 1.25rem);
}

.hero__title {
  font-size: clamp(2.6rem, 1.4rem + 7vw, 5.6rem);
  letter-spacing: -.025em;
  margin-bottom: 1.1rem;
  background: linear-gradient(170deg, var(--ink) 45%, var(--green));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.hero__subtitle {
  color: var(--ink-2);
  font-size: clamp(1rem, .95rem + .35vw, 1.2rem);
  max-width: 38rem;
  margin: 0 auto;
}

.hero__actions { margin-top: 2.25rem; min-height: 4.5rem; }

.btn {
  border: 0;
  cursor: pointer;
  background: var(--green);
  color: #fff;
  font-weight: 600;
  font-size: .95rem;
  padding: .85rem 1.7rem;
  border-radius: 999px;
  box-shadow: var(--shadow-sm);
  transition: transform .25s var(--ease), box-shadow .25s var(--ease), filter .25s var(--ease);
}
.btn:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); filter: brightness(1.06); }
.btn:active { transform: translateY(0) scale(.98); }

.hero__reply {
  margin: .9rem 0 0;
  font-family: var(--serif);
  font-style: italic;
  color: var(--ink-3);
  font-size: .95rem;
  animation: fadeUp .6s var(--ease) both;
}

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: none; }
}

.hero__cue {
  position: absolute;
  bottom: clamp(1.5rem, 4vw, 2.5rem);
  left: 50%;
  transform: translateX(-50%);
  color: var(--ink-3);
  text-decoration: none;
  font-size: .74rem;
  letter-spacing: .16em;
  text-transform: uppercase;
  display: grid;
  justify-items: center;
  gap: .6rem;
}
.hero__arrow {
  width: 1px;
  height: 34px;
  background: linear-gradient(var(--green), transparent);
  animation: cue 2.2s var(--ease) infinite;
}
@keyframes cue {
  0%, 100% { opacity: .3; transform: scaleY(.7); }
  50%      { opacity: 1;  transform: scaleY(1); }
}

/* ----------------------------------------------------------- timeline -- */
.section--timeline { z-index: 2; }

.timeline { position: relative; }

/* the vertical line */
.timeline::before {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: 11px;
  width: 2px;
  background: linear-gradient(var(--green-line), var(--green-line) 92%, transparent);
}

.chapter { position: relative; padding-left: 2.75rem; }
.chapter + .chapter { margin-top: clamp(2.5rem, 6vw, 4rem); }

/* the chapter heading is a solid box so the timeline never runs through the
   words — it sits on top of the line and interrupts it */
.chapter__head {
  position: relative;
  width: fit-content;
  max-width: 100%;
  margin: 0 0 1.75rem;
  padding: .7rem 1.3rem;
  background: var(--paper);
  border: 1px solid var(--green-line);
  border-radius: 14px;
  box-shadow: var(--shadow-sm);
}
.chapter__head::before {
  content: "";
  position: absolute;
  left: calc(-2.75rem - 1px);
  top: 50%;
  width: 22px;
  height: 22px;
  margin-top: -11px;
  border-radius: 50%;
  background: var(--bg);
  border: 2px solid var(--green);
  box-shadow: 0 0 0 5px var(--bg);
}
.section--alt .chapter__head::before { background: var(--bg-alt); box-shadow: 0 0 0 5px var(--bg-alt); }

.chapter__title {
  font-size: clamp(1.3rem, 1.1rem + 1vw, 1.85rem);
  color: var(--green);
}
.chapter__blurb { color: var(--ink-3); margin: .35rem 0 0; font-size: .92rem; }

.entry { position: relative; padding-bottom: clamp(1.75rem, 4vw, 2.75rem); }

.entry::before {
  content: "";
  position: absolute;
  left: calc(-2.75rem + 6px);
  top: 1.9rem;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--blush);
  box-shadow: 0 0 0 4px var(--bg);
  z-index: 1;
}
.section--alt .entry::before { box-shadow: 0 0 0 4px var(--bg-alt); }

.card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: clamp(1.15rem, 3vw, 1.8rem);
  box-shadow: var(--shadow-sm);
  transition: transform .4s var(--ease), box-shadow .4s var(--ease);
}
.card:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); }

.card__top {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: .6rem 1rem;
  margin-bottom: .75rem;
}

.card__date {
  font-size: .74rem;
  letter-spacing: .13em;
  text-transform: uppercase;
  font-weight: 600;
  color: var(--green);
  background: var(--green-soft);
  padding: .3rem .7rem;
  border-radius: 999px;
}

.card__tag {
  margin-left: auto;
  font-family: var(--serif);
  font-style: italic;
  font-size: .85rem;
  color: var(--ink-3);
}

.card__title {
  font-size: clamp(1.25rem, 1.05rem + .8vw, 1.7rem);
  width: 100%;
}

.card__body { color: var(--ink-2); }
.card__body p { margin: 0 0 .85em; }
.card__body p:last-child { margin-bottom: 0; }

/* photos inside a card */
.shots {
  display: grid;
  gap: .75rem;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 230px), 1fr));
  margin-top: 1.25rem;
}

figure { margin: 0; }

.shot { position: relative; }

.shot__img {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border-radius: var(--radius-sm);
  background: var(--bg-alt);
  cursor: zoom-in;
  transition: filter .3s var(--ease);
}
.shot__img:hover { filter: brightness(1.04) saturate(1.05); }

.shot figcaption,
.shot__cap {
  margin-top: .5rem;
  font-family: var(--serif);
  font-style: italic;
  font-size: .84rem;
  color: var(--ink-3);
}

/* the "drop your photo here" box shown until an image exists */
.shot--missing {
  display: grid;
  place-content: center;
  gap: .35rem;
  text-align: center;
  aspect-ratio: 4 / 3;
  border: 1.5px dashed var(--green-line);
  border-radius: var(--radius-sm);
  background: repeating-linear-gradient(45deg, transparent, transparent 9px, #00000005 9px, #00000005 18px);
  padding: 1rem;
  color: var(--ink-3);
}
.shot--missing b {
  font-weight: 600;
  color: var(--green);
  font-size: .8rem;
  letter-spacing: .04em;
}
.shot--missing code {
  font-size: .72rem;
  word-break: break-all;
  color: var(--ink-2);
  background: #0000000a;
  padding: .18rem .4rem;
  border-radius: 5px;
}

/* also boxed, so the line stops cleanly instead of striking through it */
.timeline__outro {
  position: relative;
  width: fit-content;
  margin: clamp(2.5rem, 6vw, 4rem) 0 0 2.75rem;
  padding: 1rem 1.4rem;
  background: var(--paper);
  border: 1px solid var(--green-line);
  border-radius: 14px;
  box-shadow: var(--shadow-sm);
  font-family: var(--serif);
  font-style: italic;
  font-size: clamp(1.02rem, .98rem + .4vw, 1.25rem);
  color: var(--ink-2);
}

/* desktop: alternate the cards left / right of a centre line */
@media (min-width: 900px) {
  .timeline::before { left: 50%; transform: translateX(-50%); }

  .chapter { padding-left: 0; }

  /* centred on the line — the box itself breaks the line, so no dot needed */
  .chapter__head {
    text-align: center;
    margin: 0 auto 2.5rem;
    padding: .85rem 2rem;
  }
  .chapter__head::before { display: none; }
  .chapter__title { font-size: clamp(1.5rem, 1.15rem + 1.2vw, 2rem); }

  .entry { width: calc(50% - 2.5rem); }
  .entry--right { margin-left: auto; }

  .entry::before {
    left: auto;
    right: calc(-2.5rem - 6px);
    top: 2.1rem;
  }
  .entry--right::before { right: auto; left: calc(-2.5rem - 6px); }

  /* cards on the left mirror their heading so the date sits nearest the line —
     but the story itself stays left-aligned, because ragged-left paragraphs
     are miserable to read */
  .entry--left { text-align: right; }
  .entry--left .card__top { flex-direction: row-reverse; }
  .entry--left .card__tag { margin-left: 0; margin-right: auto; }
  .entry--left .card__body,
  .entry--left .shot figcaption { text-align: left; }

  .timeline__outro { text-align: center; max-width: 36rem; margin-inline: auto; }
}

/* ---------------------------------------------------------------- bio -- */
.bio {
  display: grid;
  gap: clamp(1.5rem, 4vw, 3rem);
  align-items: center;
}

@media (min-width: 820px) {
  .bio { grid-template-columns: 5fr 6fr; }
  .bio--flip .bio__photo { order: 2; }
}

.bio__photo .shot__img,
.bio__photo .shot--missing {
  aspect-ratio: 4 / 5;
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
}

.bio__text .prose {
  font-family: var(--serif);
  font-size: clamp(1.1rem, 1rem + .6vw, 1.45rem);
  line-height: 1.5;
  color: var(--ink);
}

.bio__wide { margin-top: clamp(2rem, 5vw, 3rem); }
.bio__wide .shot__img,
.bio__wide .shot--missing {
  aspect-ratio: 16 / 9;
  border-radius: var(--radius);
}

/* fact cards */
.facts {
  list-style: none;
  margin: clamp(2rem, 5vw, 3rem) 0 0;
  padding: 0;
  display: grid;
  gap: .85rem;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 240px), 1fr));
}

.fact {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 1.05rem 1.15rem;
  box-shadow: var(--shadow-sm);
  transition: transform .35s var(--ease), border-color .35s var(--ease);
}
.fact:hover { transform: translateY(-3px); border-color: var(--green-line); }

.fact__icon { font-size: 1.4rem; line-height: 1; display: block; margin-bottom: .55rem; }
.fact__label { font-family: var(--serif); font-size: 1.05rem; margin: 0 0 .2rem; }
.fact__text { margin: 0; font-size: .9rem; color: var(--ink-2); }

/* -------------------------------------------------- the colour game -- */
.game {
  margin-top: clamp(2.5rem, 6vw, 4rem);
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: clamp(1.35rem, 4vw, 2.25rem);
  box-shadow: var(--shadow-sm);
}

.game__head { margin-bottom: 1.5rem; }
.game__title { font-size: clamp(1.25rem, 1.1rem + .6vw, 1.55rem); }
.game__text { margin-top: .5rem; color: var(--ink-2); font-size: .95rem; }

.game__body {
  display: grid;
  gap: clamp(1.1rem, 3vw, 1.75rem);
  align-items: stretch;
}
@media (min-width: 700px) {
  .game__body { grid-template-columns: minmax(140px, 210px) 1fr; }
}

.game__swatch {
  border-radius: var(--radius-sm);
  background: #8c7882;
  min-height: 128px;
  display: flex;
  align-items: flex-end;
  padding: .8rem .9rem;
  transition: background .25s var(--ease);
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .06);
}

.game__hex {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: .82rem;
  letter-spacing: .08em;
  color: #fff;
  background: rgba(0, 0, 0, .3);
  padding: .25rem .55rem;
  border-radius: 999px;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

.game__sliders { display: grid; gap: .95rem; align-content: center; }

.game__row {
  display: grid;
  grid-template-columns: 3.6rem 1fr auto;
  grid-template-areas: "label slider nudge" ". note note";
  align-items: center;
  gap: .3rem .7rem;
}

.game__label {
  grid-area: label;
  font-size: .78rem;
  font-weight: 600;
  letter-spacing: .05em;
  text-transform: uppercase;
  color: var(--ink-2);
}

/* the -/+ pair, so an exact number is reachable without fighting the slider */
.game__nudge {
  grid-area: nudge;
  display: inline-flex;
  align-items: center;
  gap: .1rem;
}

.game__step {
  width: 34px;
  height: 34px;
  padding: 0;
  border: 1px solid var(--line);
  background: var(--bg);
  color: var(--ink-2);
  border-radius: 8px;
  font-size: .95rem;
  line-height: 1;
  cursor: pointer;
  transition: border-color .2s var(--ease), color .2s var(--ease), background .2s var(--ease);
}
.game__step:hover { border-color: var(--green); color: var(--green); }
.game__step:active { background: var(--green-soft); }
/* fingers need more room than cursors */
@media (pointer: coarse) {
  .game__step { width: 40px; height: 40px; font-size: 1.05rem; }
}

.game__value {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: .78rem;
  color: var(--ink-2);
  width: 2.4rem;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.game__note {
  grid-area: note;
  font-family: var(--serif);
  font-style: italic;
  font-size: .8rem;
  color: var(--ink-3);
  min-height: 1.1em;
}
.game__note.is-ok { color: var(--green); font-style: normal; font-weight: 600; }
.game__note.is-ok::before { content: "✓ "; }
.game__note.is-high::before { content: "↓ "; }
.game__note.is-low::before  { content: "↑ "; }

/* the three sliders */
.game__slider {
  grid-area: slider;
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 24px;
  background: transparent;
  cursor: pointer;
  margin: 0;
}
.game__slider::-webkit-slider-runnable-track { height: 8px; border-radius: 999px; }
.game__slider::-moz-range-track { height: 8px; border-radius: 999px; }

.game__row--r .game__slider::-webkit-slider-runnable-track { background: linear-gradient(90deg, #1a1a1a, #ff2d2d); }
.game__row--g .game__slider::-webkit-slider-runnable-track { background: linear-gradient(90deg, #1a1a1a, #23d16b); }
.game__row--b .game__slider::-webkit-slider-runnable-track { background: linear-gradient(90deg, #1a1a1a, #2d7bff); }
.game__row--r .game__slider::-moz-range-track { background: linear-gradient(90deg, #1a1a1a, #ff2d2d); }
.game__row--g .game__slider::-moz-range-track { background: linear-gradient(90deg, #1a1a1a, #23d16b); }
.game__row--b .game__slider::-moz-range-track { background: linear-gradient(90deg, #1a1a1a, #2d7bff); }

.game__slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 24px;
  height: 24px;
  margin-top: -8px;
  border-radius: 50%;
  background: #fff;
  border: 3px solid var(--ink-2);
  box-shadow: var(--shadow-sm);
  transition: transform .18s var(--ease), border-color .18s var(--ease);
}
.game__slider::-webkit-slider-thumb:active { transform: scale(1.15); }
.game__slider::-moz-range-thumb {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fff;
  border: 3px solid var(--ink-2);
  box-shadow: var(--shadow-sm);
}
.game__slider:disabled { cursor: default; opacity: .75; }

/* how close she is */
.game__meter {
  display: block;
  height: 6px;
  margin-top: 1.5rem;
  border-radius: 999px;
  background: var(--bg-alt);
  overflow: hidden;
}
.game__meter-fill {
  display: block;
  height: 100%;
  width: 0;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--blush), var(--green));
  transition: width .3s var(--ease);
}

.game__status {
  margin: .7rem 0 0;
  text-align: center;
  font-family: var(--serif);
  font-style: italic;
  color: var(--ink-3);
  min-height: 1.5em;
}

.game__win {
  margin-top: 1.4rem;
  padding-top: 1.4rem;
  border-top: 1px solid var(--line);
  text-align: center;
  animation: fadeUp .6s var(--ease) both;
}
.game__win-title { font-size: clamp(1.3rem, 1.1rem + .9vw, 1.75rem); color: var(--green); }
.game__win-text { margin: .5rem 0 0; color: var(--ink-2); }
.game__win-hex {
  margin: .7rem 0 0;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: .8rem;
  letter-spacing: .06em;
  color: var(--ink-3);
}
.game__reset {
  margin-top: 1.1rem;
  background: none;
  border: 1px solid var(--green-line);
  color: var(--ink-3);
  border-radius: 999px;
  padding: .4rem .95rem;
  font-size: .78rem;
  cursor: pointer;
  transition: color .25s var(--ease), border-color .25s var(--ease);
}
.game__reset:hover { color: var(--green); border-color: var(--green); }

.game.is-solved .game__swatch { box-shadow: 0 0 0 3px var(--green-soft), inset 0 0 0 1px rgba(0,0,0,.06); }


/* ------------------------------------------------------------- garden -- */
.section--garden { background: var(--bg-alt); }

.garden {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: clamp(1rem, 3vw, 1.5rem);
  box-shadow: var(--shadow-sm);
}

.garden__bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: .9rem;
  flex-wrap: wrap;
}

.garden__count {
  margin: 0;
  font-family: var(--serif);
  font-size: 1.05rem;
  color: var(--green);
}

.garden__reset {
  background: none;
  border: 1px solid var(--green-line);
  color: var(--ink-3);
  border-radius: 999px;
  padding: .35rem .85rem;
  font-size: .78rem;
  cursor: pointer;
  transition: color .25s var(--ease), border-color .25s var(--ease);
}
.garden__reset:hover { color: var(--green); border-color: var(--green); }

.garden__plot {
  position: relative;
  height: clamp(300px, 45vw, 420px);
  border-radius: var(--radius-sm);
  overflow: hidden;
  cursor: crosshair;
  background:
    linear-gradient(180deg, #eaf4ee 0%, #f4f7f0 55%, #eef2e4 100%);
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.garden__soil {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 26px;
  background: linear-gradient(180deg, color-mix(in srgb, var(--green) 55%, #6b5136) 0%, #4a3826 100%);
  opacity: .9;
}

.garden__hint {
  position: absolute;
  inset: auto 0 45% 0;
  text-align: center;
  margin: 0;
  color: var(--ink-3);
  font-family: var(--serif);
  font-style: italic;
  pointer-events: none;
  transition: opacity .5s var(--ease);
}
.garden__hint.is-hidden { opacity: 0; }

.bloom {
  --depth: 1;
  position: absolute;
  bottom: 14px;
  transform: translateX(-50%) scale(var(--depth));
  transform-origin: bottom center;
  pointer-events: none;
  animation: grow .8s var(--ease) both;
}
@keyframes grow {
  from { transform: translateX(-50%) scale(calc(var(--depth) * .05)) rotate(-6deg); opacity: 0; }
  60%  { transform: translateX(-50%) scale(calc(var(--depth) * 1.08)) rotate(2deg); opacity: 1; }
  to   { transform: translateX(-50%) scale(var(--depth)) rotate(0deg); opacity: 1; }
}
.bloom__sway { display: block; transform-origin: bottom center; animation: sway 4.5s ease-in-out infinite; }
@keyframes sway {
  0%, 100% { transform: rotate(-2.2deg); }
  50%      { transform: rotate(2.2deg); }
}

.garden__milestone {
  margin: .9rem 0 0;
  min-height: 1.5rem;
  font-family: var(--serif);
  font-style: italic;
  color: var(--green);
  text-align: center;
}
.garden__milestone.is-new { animation: fadeUp .6s var(--ease) both; }

/* ------------------------------------------------------------- letter -- */
.section--letter { text-align: center; }
.section--letter .section__head { margin-inline: auto; }

/* the password gate in front of the letter */
.lock {
  max-width: 30rem;
  margin-inline: auto;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: clamp(1.5rem, 5vw, 2.5rem);
  box-shadow: var(--shadow-sm);
}

.lock__icon { font-size: 1.6rem; display: block; margin-bottom: .7rem; }
.lock__title { font-size: clamp(1.3rem, 1.15rem + .8vw, 1.7rem); }
.lock__text { color: var(--ink-2); margin: .6rem 0 0; font-size: .95rem; }

.lock__form {
  display: flex;
  gap: .55rem;
  margin-top: 1.4rem;
  flex-wrap: wrap;
  justify-content: center;
}

.lock__srlabel {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.lock__input {
  flex: 1 1 11rem;
  min-width: 0;
  font: inherit;
  font-size: 1rem;                 /* 16px+ stops iOS zooming on focus */
  color: var(--ink);
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: .8rem 1.1rem;
  text-align: center;
  letter-spacing: .06em;
  transition: border-color .25s var(--ease), background .25s var(--ease);
}
.lock__input:focus { outline: none; border-color: var(--green); background: var(--paper); }
.lock__input::placeholder { color: var(--ink-3); }

.lock__btn { flex: 0 0 auto; }

.lock__hint {
  margin: 1.1rem 0 0;
  font-family: var(--serif);
  font-style: italic;
  font-size: .88rem;
  color: var(--ink-3);
}
.lock__hint::before { content: "clue — "; font-style: normal; letter-spacing: .04em; }

.lock__error {
  margin: .8rem 0 0;
  min-height: 1.3em;
  font-size: .88rem;
  color: #b4544a;
}

.lock.is-wrong { animation: shake .4s var(--ease); }
@keyframes shake {
  10%, 90% { transform: translateX(-3px); }
  20%, 80% { transform: translateX(5px); }
  30%, 50%, 70% { transform: translateX(-7px); }
  40%, 60% { transform: translateX(7px); }
}

.lock.is-open { animation: unlocked .45s var(--ease) both; }
@keyframes unlocked {
  to { opacity: 0; transform: scale(.97); }
}

.envelope { display: grid; place-items: center; }
/* must beat `display: grid`, or the locked envelope still shows */
.envelope[hidden] { display: none; }

.envelope__btn {
  position: relative;
  width: min(100%, 420px);
  aspect-ratio: 3 / 2;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: linear-gradient(160deg, #fffbfa, #fbeceb);
  box-shadow: var(--shadow-md);
  cursor: pointer;
  display: grid;
  place-content: center;
  gap: .35rem;
  overflow: hidden;
  transition: transform .4s var(--ease), box-shadow .4s var(--ease);
}
.envelope__btn:hover { transform: translateY(-4px) rotate(-.6deg); }

.envelope__flap {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 58%;
  background: linear-gradient(170deg, #fae4e1, #f5d8d4);
  clip-path: polygon(0 0, 100% 0, 50% 100%);
  border-bottom: 1px solid #eecfca;
  transition: transform .6s var(--ease), opacity .6s var(--ease);
  transform-origin: top center;
}

.envelope__seal {
  position: absolute;
  top: 52%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--blush);
  box-shadow: 0 2px 8px rgba(36,31,28,.18);
  font-size: 1.2rem;
  transition: transform .5s var(--ease), opacity .4s var(--ease);
}

.envelope__label {
  position: relative;
  margin-top: 3.2rem;
  font-family: var(--serif);
  font-size: 1.35rem;
}
.envelope__hint {
  position: relative;
  font-size: .74rem;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--ink-3);
}

.envelope.is-open .envelope__btn { pointer-events: none; }
.envelope.is-open .envelope__flap { transform: rotateX(-180deg); opacity: 0; }
.envelope.is-open .envelope__seal { transform: translate(-50%, -50%) scale(2.4); opacity: 0; }
.envelope.is-open { animation: envelopeAway .6s var(--ease) .25s both; }
@keyframes envelopeAway {
  to { opacity: 0; transform: translateY(-14px) scale(.96); height: 0; margin: 0; }
}

.note {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: clamp(1.5rem, 5vw, 3.25rem);
  box-shadow: var(--shadow-md);
  text-align: left;
  animation: fadeUp .8s var(--ease) both;
}

.note__greeting {
  font-family: var(--serif);
  font-size: clamp(1.4rem, 1.2rem + 1vw, 2rem);
  margin: 0 0 1.2rem;
  color: var(--green);
}

.note .prose {
  font-family: var(--serif);
  font-size: clamp(1.05rem, 1rem + .35vw, 1.25rem);
  line-height: 2.05em;
  color: var(--ink);
}

.note__signoff { margin: 1.8rem 0 .2rem; font-family: var(--serif); font-style: italic; color: var(--ink-2); }
.note__signature {
  margin: 0;
  font-family: var(--serif);
  font-size: clamp(1.6rem, 1.3rem + 1.6vw, 2.4rem);
  color: var(--green);
  transform: rotate(-2.5deg);
  display: inline-block;
}

/* ------------------------------------------------------------- finale -- */
.finale {
  position: relative;
  z-index: 2;
  text-align: center;
  padding-block: clamp(3.5rem, 9vw, 7rem);
  background:
    radial-gradient(85% 60% at 50% 100%, color-mix(in srgb, var(--green) 14%, transparent), transparent 70%),
    var(--bg);
}

.finale__photo { margin-bottom: 2rem; }
.finale__photo .shot__img,
.finale__photo .shot--missing {
  aspect-ratio: 3 / 2;
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
}

.finale__line {
  font-size: clamp(2.4rem, 1.4rem + 6vw, 5rem);
  color: var(--green);
  font-style: italic;
}
.finale__sub { color: var(--ink-2); margin-top: .9rem; }

.footer {
  padding: 2rem var(--pad) calc(2rem + env(safe-area-inset-bottom));
  text-align: center;
  font-size: .78rem;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--ink-3);
  border-top: 1px solid var(--green-line);
  background: var(--bg);
  position: relative;
  z-index: 2;
}
.footer p { margin: 0; }

/* ---------------------------------------------------------- lightbox -- */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 120;
  background: rgba(28, 24, 21, .92);
  display: grid;
  place-items: center;
  padding: clamp(1rem, 5vw, 3rem);
  animation: fadeUp .3s var(--ease) both;
}
/* must beat `display: grid` above, or the hidden overlay eats every click */
.lightbox[hidden] { display: none; }

.lightbox__figure { max-width: min(1100px, 100%); text-align: center; }
.lightbox img {
  max-width: 100%;
  max-height: 78svh;
  width: auto;
  margin-inline: auto;
  border-radius: var(--radius-sm);
  object-fit: contain;
}
.lightbox figcaption {
  color: #f4ece2;
  font-family: var(--serif);
  font-style: italic;
  margin-top: 1rem;
  font-size: .95rem;
}
.lightbox__close {
  position: absolute;
  top: max(1rem, env(safe-area-inset-top));
  right: 1rem;
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: 50%;
  background: rgba(255,255,255,.12);
  color: #fff;
  font-size: 1.6rem;
  line-height: 1;
  cursor: pointer;
}
.lightbox__close:hover { background: rgba(255,255,255,.22); }

/* ------------------------------------------------------- todo overlay -- */
.todo {
  position: fixed;
  right: 0;
  bottom: 0;
  z-index: 150;
  width: min(380px, 100%);
  max-height: 60svh;
  overflow: auto;
  background: #1c1815;
  color: #f0e8de;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: .74rem;
  line-height: 1.55;
  padding: 1rem 1.1rem calc(1rem + env(safe-area-inset-bottom));
  border-top-left-radius: 14px;
  box-shadow: 0 -8px 40px rgba(0,0,0,.35);
}
.todo h4 { margin: 0 0 .6rem; font-family: inherit; font-size: .78rem; color: #ffe9a8; }
.todo ul { margin: 0 0 .9rem; padding-left: 1.1rem; }
.todo li { margin-bottom: .3rem; word-break: break-word; }
.todo .todo__close { position: absolute; top: .5rem; right: .6rem; background: none; border: 0; color: #f0e8de; font-size: 1.2rem; cursor: pointer; }

/* -------------------------------------------------------- reduced motion */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
  }
  .reveal { opacity: 1; transform: none; }
  #petal-canvas { display: none; }
}

/* ----------------------------------------------------------- printing -- */
@media print {
  .nav, #petal-canvas, .hero__cue, .garden, .envelope, .footer, .todo { display: none !important; }
  .reveal { opacity: 1 !important; transform: none !important; }
  body { background: #fff; }
}
