/* Garden page: a full-bleed sticky 3D stage with chapter cards scrolling over it, then the plant list and journal.
   Square corners and plain text controls throughout. */
.garden-head { padding-bottom: 32px; }

/* ---------- story ---------- */
.story { position: relative; }
.stage-sticky { position: sticky; top: 0; height: 100svh; z-index: 0; }
.stage {
  position: absolute; inset: 0; overflow: hidden;
  background: linear-gradient(180deg, #1d2440 0%, #6b5a6a 55%, #c9a07e 100%);
}
.stage::before, .stage::after { content: ""; position: absolute; left: 0; right: 0; z-index: 2; pointer-events: none; }
.stage::before { top: 0; height: 120px; background: linear-gradient(var(--night), transparent); }
.stage::after { bottom: 0; height: 140px; background: linear-gradient(transparent, var(--night)); }
.stage canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: pan-y; }
.stage.exploring canvas { cursor: grab; }
.stage.exploring canvas:active { cursor: grabbing; }
.fallback { position: absolute; inset: 0; }
.fallback[hidden] { display: none; }
.fallback img { width: 100%; height: 100%; object-fit: cover; opacity: 0.55; filter: saturate(0.9); }

/* date readout: serif month + a plain month ruler */
.readout {
  position: absolute; z-index: 3; right: max(24px, env(safe-area-inset-right, 0px)); top: max(92px, calc(env(safe-area-inset-top, 0px) + 80px));
  width: min(320px, 46vw); display: grid; gap: 10px; justify-items: end; pointer-events: none;
}
.when { font-family: var(--display); font-weight: 300; font-size: clamp(2rem, 4vw, 3.2rem); line-height: 1; color: #fff8ef; text-shadow: 0 2px 18px rgba(0, 0, 0, 0.35); font-variant-numeric: tabular-nums; }
.ruler { position: relative; width: 100%; height: 22px; border-bottom: 1px solid rgba(255, 248, 239, 0.45); }
.ruler span { position: absolute; bottom: 0; width: 1px; height: 6px; background: rgba(255, 248, 239, 0.45); }
.ruler span.yr { height: 12px; background: rgba(255, 248, 239, 0.8); }
.ruler span b { position: absolute; bottom: 14px; left: 4px; font: 400 0.62rem/1 var(--mono); letter-spacing: 0.08em; color: rgba(255, 248, 239, 0.8); }
.ruler .now { position: absolute; bottom: -4px; width: 2px; height: 26px; margin-left: -1px; background: var(--sun); box-shadow: 0 0 10px rgba(255, 178, 96, 0.8); }

.tip { position: absolute; z-index: 4; pointer-events: none; transform: translate(14px, -50%); padding: 6px 9px; background: rgba(10, 12, 20, 0.82); border-left: 2px solid var(--sun); font: 400 0.74rem/1.2 var(--mono); letter-spacing: 0.04em; color: #fff; white-space: nowrap; }
.tip[hidden], .stage-hint[hidden] { display: none; }
.stage-hint { position: absolute; z-index: 3; left: 50%; bottom: 34px; transform: translateX(-50%); margin: 0; font: 400 0.7rem/1 var(--mono); letter-spacing: 0.12em; text-transform: uppercase; color: rgba(255, 248, 239, 0.85); pointer-events: none; white-space: nowrap; }

/* chapter cards */
.chapters { position: relative; z-index: 1; margin-top: -100svh; pointer-events: none; }
.chap { min-height: 150svh; display: flex; align-items: center; padding-left: max(24px, env(safe-area-inset-left, 0px)); padding-right: max(24px, env(safe-area-inset-right, 0px)); }
.chap:first-child { min-height: 120svh; }
.chap.last { min-height: 170svh; align-items: flex-start; padding-top: 30svh; }
.chap-card {
  pointer-events: auto; width: min(420px, 100%); margin-left: max(0px, calc((100vw - 1120px) / 2));
  display: grid; gap: 14px; padding: 26px 26px 24px;
  background: rgba(7, 9, 18, 0.78); border-left: 2px solid var(--sun);
  backdrop-filter: blur(10px) saturate(130%); -webkit-backdrop-filter: blur(10px) saturate(130%);
  opacity: 0.35; transform: translateY(18px); transition: opacity .6s var(--ease), transform .8s var(--ease);
}
.chap.on .chap-card { opacity: 1; transform: none; }
.chap-when { margin: -6px 0 0; font: 400 0.76rem/1 var(--mono); letter-spacing: 0.06em; color: var(--sun); }
.chap-card h2 { font-size: clamp(2rem, 3.6vw, 2.8rem); line-height: 1; }
.chap-card p { margin: 0; color: #d3d8e6; font-size: 1rem; line-height: 1.7; }
.chap-links a { color: var(--ink); text-decoration: none; border-bottom: 1px solid var(--sun); }
.chap-links a:hover { color: var(--sun); }
.chap-media { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; margin-top: 4px; }

/* media buttons (chapters, card, journal) */
.m { position: relative; padding: 0; border: 0; background: #0b0f1c; overflow: hidden; cursor: zoom-in; aspect-ratio: 4 / 5; display: block; width: 100%; }
.m img, .m video { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .6s var(--ease); }
.m:hover img, .m:hover video { transform: scale(1.04); }
.m:focus-visible { outline: 1px solid var(--sun); outline-offset: 2px; }
.m .vid { position: absolute; left: 0; bottom: 0; padding: 3px 6px; background: rgba(0, 0, 0, 0.65); font: 400 0.58rem/1 var(--mono); letter-spacing: 0.1em; text-transform: uppercase; color: #fff; }

/* ---------- plant card ---------- */
.card {
  position: fixed; z-index: 20; right: max(16px, env(safe-area-inset-right, 0px)); top: 84px; bottom: 16px; width: min(380px, calc(100vw - 32px));
  overflow: auto; padding: 22px 22px 26px; display: grid; gap: 14px; align-content: start;
  background: rgba(7, 9, 18, 0.92); border: 1px solid var(--line); border-top: 2px solid var(--sun);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
}
.card[hidden] { display: none; }
.card-close { justify-self: end; background: none; border: 0; padding: 4px 0; font: 400 0.72rem/1 var(--mono); letter-spacing: 0.12em; text-transform: uppercase; color: var(--dim); cursor: pointer; border-bottom: 1px solid var(--line); }
.card-close:hover { color: var(--sun); border-color: var(--sun); }
#cardBody { display: grid; gap: 14px; }
.card h2 { font-size: 2.1rem; line-height: 1.02; }
.card p { margin: 0; color: #c9cfe0; font-size: 0.95rem; line-height: 1.6; }
.card .card-later { font-size: 0.82rem; color: var(--dim); font-style: italic; }
.card .card-since { font: 400 0.7rem/1.4 var(--mono); letter-spacing: 0.08em; text-transform: uppercase; color: var(--dim); }
.moments { list-style: none; margin: 0; padding: 0; display: grid; border-top: 1px solid var(--line); }
.moments li { border-bottom: 1px solid var(--line); }
.moments button { width: 100%; text-align: left; background: none; border: 0; color: inherit; padding: 10px 0; display: grid; grid-template-columns: 92px minmax(0, 1fr); gap: 2px 12px; cursor: pointer; font: inherit; }
.moments time { grid-row: span 2; font: 400 0.68rem/1.5 var(--mono); color: var(--dim); }
.moments .mo-type { font: 400 0.6rem/1.4 var(--mono); letter-spacing: 0.12em; text-transform: uppercase; color: var(--sun); }
.moments .mo-text { font-size: 0.9rem; color: #dfe3ee; line-height: 1.4; }
.moments button:hover .mo-text { color: var(--sun); }
.card-media { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }

/* ---------- lower sections ---------- */
.lower { display: grid; gap: 80px; padding-top: 40px; position: relative; z-index: 1; }
.plants > h2, .journal > h2 { font-size: clamp(2.2rem, 5vw, 3.4rem); line-height: 1; }
.plants, .journal { display: grid; gap: 16px; }
.plants-intro, .journal-intro { color: var(--dim); max-width: 60ch; margin: 0; }
.plant-groups { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 32px; margin-top: 10px; }
.pg h3 { font-size: 1.5rem; padding-bottom: 10px; border-bottom: 1px solid var(--line); }
.pg ul { list-style: none; margin: 0; padding: 0; }
.pg li { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; padding: 9px 0; border-bottom: 1px solid var(--line); }
.pg button { background: none; border: 0; padding: 0; font: inherit; font-size: 1rem; color: var(--ink); cursor: pointer; text-align: left; text-decoration: underline; text-decoration-color: rgba(255, 178, 96, 0.45); text-underline-offset: 4px; }
.pg button:hover, .pg button[aria-current="true"] { color: var(--sun); text-decoration-color: var(--sun); }
.pg li span { font: 400 0.68rem/1 var(--mono); color: var(--faint); white-space: nowrap; }

.season { display: grid; gap: 14px; padding-top: 26px; }
.season h3 { font-size: 1.7rem; display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 14px; }
.season h3 small { font: 400 0.72rem/1 var(--mono); letter-spacing: 0.1em; text-transform: uppercase; color: var(--dim); }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 10px; }
.grid figure { margin: 0; display: grid; gap: 6px; min-width: 0; }
.grid .m { aspect-ratio: 9 / 16; }
.grid figcaption { font: 400 0.64rem/1.3 var(--mono); color: var(--faint); letter-spacing: 0.04em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- lightbox ---------- */
.lightbox { border: 1px solid var(--line); border-radius: 0; padding: 14px; background: #070a14; color: var(--ink); max-width: min(94vw, 540px); width: 100%; }
.lightbox::backdrop { background: rgba(2, 3, 8, 0.85); backdrop-filter: blur(4px); }
.lightbox figure { margin: 0; display: grid; gap: 10px; }
.lb-media img, .lb-media video { width: 100%; max-height: 74svh; object-fit: contain; background: #0b0f1c; display: block; }
.lightbox figcaption { font: 400 0.8rem/1.5 var(--mono); color: var(--dim); }
.lb-controls { display: flex; align-items: center; gap: 18px; margin-top: 12px; }
.lb-controls button { font: 400 0.74rem/1 var(--mono); letter-spacing: 0.08em; text-transform: uppercase; padding: 6px 0; border: 0; border-bottom: 1px solid var(--line); background: transparent; color: var(--ink); cursor: pointer; }
.lb-controls button:hover { color: var(--sun); border-color: var(--sun); }
.lb-controls .close { margin-left: auto; }
.lb-controls span { font: 400 0.72rem/1 var(--mono); color: var(--faint); }

@media (max-width: 900px) {
  .plant-groups { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .readout { top: 74px; width: calc(100vw - 48px); }
  .when { font-size: 1.9rem; }
  .chap { align-items: flex-end; padding-bottom: 8svh; }
  .chap.last { align-items: flex-end; padding-top: 0; }
  .chap-card { width: 100%; padding: 18px; gap: 10px; }
  .chap-card p { font-size: 0.94rem; line-height: 1.6; }
  .chap-media { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .card { top: auto; left: 0; right: 0; bottom: 0; width: auto; max-height: 72svh; border-left: 0; border-right: 0; border-bottom: 0; }
  .grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (prefers-reduced-motion: reduce) {
  .chap-card { transition: none; transform: none; opacity: 1; }
}
