/* ─────────────────────────────────────────────────────────────────────
   grove.school v3  |  styles.css  |  "the living course catalog"

   light paper ground, near-black ink, one deep green. set like a print
   course catalog: oversized index numbers, huge Fraunces display,
   asymmetric text blocks, marginalia in the margins. no buttons, no
   cards, no rounded corners, no box-shadow, no horizontal navbar.
   hairline rules and whitespace only. a left margin rail is reserved
   for the root thread that grows down the page.
   ───────────────────────────────────────────────────────────────────── */

@font-face {
  font-family: "Fraunces";
  src: url("fonts/fraunces-latin.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

:root {
  /* light is law: warm paper ground */
  --paper: #f4efe4;
  --paper-alt: #efe9db;
  /* near-black ink */
  --ink: #211f1b;
  --ink-soft: #454036;   /* AA on paper */
  --ink-faint: #5c564a;  /* AA on paper, for marginalia */
  /* one deep green */
  --green: #2f5741;
  --green-deep: #244433;

  --rail: 120px;              /* left margin rail reserved for the thread spine */
  --gutter: 70px;            /* the gutter branches reach across, toward text */
  --measure: 34rem;          /* body text column */

  --serif: "Fraunces", Georgia, "Times New Roman", serif;
  --sans: ui-monospace, "SF Mono", "Cascadia Mono", "Roboto Mono", Menlo,
          Consolas, monospace;
}

* { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--serif);
  font-size: 18px;
  line-height: 1.62;
  font-weight: 380;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* the paper has a faint tooth: a barely-there vertical seam where the
   rail meets the text block, drawn as a hairline, not a box */
body::before {
  content: "";
  position: fixed;
  top: 0;
  left: var(--rail);
  width: 1px;
  height: 100%;
  background: rgba(33, 31, 27, 0.08);
  pointer-events: none;
  z-index: 1;
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--paper);
  color: var(--ink);
  padding: 0.6rem 1rem;
  z-index: 100;
  font-family: var(--sans);
  font-size: 0.8rem;
}
.skip-link:focus { left: 1rem; top: 1rem; }

/* ══ the root thread canvas ══ spans the full document, fixed to the
   viewport. the spine lives in the far-left rail; its branches reach
   rightward into the gutter between the rail and the text column (never
   under the body text). the canvas is therefore rail + gutter wide.
   pointer-events off; z above the paper seam, below the text. */
.thread {
  position: fixed;
  top: 0;
  left: 0;
  width: calc(var(--rail) + var(--gutter));
  height: 100vh;
  pointer-events: none;
  z-index: 2;
}

/* ══ the index rail: numbers hugging the thread, vertical, not a navbar ══ */
.index-rail {
  position: fixed;
  top: 0;
  left: 0;
  width: var(--rail);
  height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 1.5rem;
  padding-left: 1.4rem;
  z-index: 5;
  font-family: var(--sans);
  pointer-events: none;
}
.index-rail a {
  pointer-events: auto;
  display: block;
  text-decoration: none;
  color: var(--ink-faint);
  line-height: 1.1;
  transition: color 160ms ease;
}
.index-rail a:hover,
.index-rail a:focus,
.index-rail a.active { color: var(--green); }
.index-rail .ix-n {
  display: block;
  font-size: 0.82rem;
  letter-spacing: 0.06em;
  font-weight: 600;
}
.index-rail .ix-l {
  display: block;
  font-size: 0.6rem;
  letter-spacing: 0.14em;
  text-transform: lowercase;
  opacity: 0.7;
  max-width: 5.5rem;
}
.index-rail a:focus-visible { outline: 2px solid var(--green); outline-offset: 3px; }

/* ══ document column: everything sits to the right of the rail ══ */
main {
  position: relative;
  z-index: 3;
  margin-left: var(--rail);
  padding: 0 clamp(1.4rem, 6vw, 7rem) 0 clamp(1.6rem, 5vw, 5rem);
  max-width: 78rem;
}

/* ── MASTHEAD ── the one moment of theater: wordmark huge, definition,
   the thread's seed begins just to its left in the rail ── */
.masthead {
  position: relative;
  box-sizing: border-box;
  padding-top: clamp(2rem, 7vh, 5rem);
  padding-bottom: clamp(2rem, 7vh, 5rem);
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.kicker {
  font-family: var(--sans);
  font-size: 0.82rem;
  letter-spacing: 0.16em;
  text-transform: lowercase;
  color: var(--ink-soft);
  margin: 0 0 0.4rem;
}
.kicker .kd { color: var(--green); padding: 0 0.35em; }

.wordmark {
  font-family: var(--serif);
  font-weight: 340;
  /* responsive: scale with viewport width but cap by viewport height so the
     whole hero (kicker + wordmark + definition + sub) fits one screen */
  font-size: min(clamp(5rem, 24vw, 22rem), 34vh);
  line-height: 0.82;
  letter-spacing: -0.02em;
  /* em-based bottom margin clears the g descender at any size */
  margin: 0 -8vw 0.3em 0;
  color: var(--ink);
  font-optical-sizing: auto;
}

.definition {
  position: relative;
  z-index: 1;
  font-family: var(--serif);
  font-style: italic;
  font-size: clamp(1.15rem, 2.6vw, 1.9rem);
  line-height: 1.32;
  font-weight: 340;
  max-width: 30rem;
  margin: 0 0 2rem;
  color: var(--ink);
}
.definition .def-word { font-style: normal; font-weight: 460; }
.definition .def-pos {
  font-family: var(--sans);
  font-style: normal;
  font-size: 0.7em;
  color: var(--green);
  letter-spacing: 0.04em;
}

.masthead-sub {
  max-width: var(--measure);
  font-size: 1.02rem;
  color: var(--ink-soft);
  margin: 0;
}

/* ══ ENTRY (a numbered catalog section) ══ */
.entry {
  position: relative;
  padding: clamp(3.5rem, 9vh, 7rem) 0;
  border-top: 1px solid rgba(33, 31, 27, 0.16);
}

.entry-head {
  display: flex;
  align-items: baseline;
  gap: clamp(1rem, 3vw, 2.4rem);
  margin-bottom: clamp(1.6rem, 4vh, 3rem);
}
/* oversized index folio numbers */
.folio {
  font-family: var(--serif);
  font-weight: 300;
  font-size: clamp(3.5rem, 11vw, 9rem);
  line-height: 0.8;
  color: var(--green);
  letter-spacing: -0.03em;
  flex: 0 0 auto;
}
.entry-title {
  font-family: var(--serif);
  font-weight: 360;
  font-size: clamp(2rem, 6vw, 4.4rem);
  line-height: 0.98;
  letter-spacing: -0.01em;
  margin: 0;
  color: var(--ink);
}

.entry-body { max-width: var(--measure); }
.entry-intro,
.entry-note {
  max-width: var(--measure);
  color: var(--ink-soft);
}
.entry-intro { font-size: 1.08rem; margin: 0 0 2.6rem; }
.entry-note {
  font-size: 0.94rem;
  margin: 2.8rem 0 0;
  font-style: italic;
}

.lead {
  font-family: var(--serif);
  font-size: clamp(1.35rem, 3vw, 2rem);
  line-height: 1.28;
  font-weight: 360;
  color: var(--ink);
  margin: 0 0 1.4rem;
}
.entry-body p { margin: 0 0 1.2rem; }
.thesis {
  border-left: 2px solid var(--green);
  padding-left: 1.2rem;
  margin-top: 1.8rem;
  color: var(--ink-soft);
}

/* ── 01 idea: text block pushed off the left edge of the measure ── */
.idea-body { margin-left: clamp(0rem, 6vw, 6rem); }

/* ══ 02 areas: a numbered table-of-contents list, single column ══ */
.areas {
  list-style: none;
  margin: 0;
  padding: 0;
  max-width: 46rem;
}
.area {
  display: grid;
  grid-template-columns: 3.4rem 1fr;
  gap: clamp(1rem, 3vw, 2.2rem);
  align-items: baseline;
  padding: 1.5rem 0;
  border-top: 1px solid rgba(33, 31, 27, 0.14);
}
.area:last-child { border-bottom: 1px solid rgba(33, 31, 27, 0.14); }
.area-n {
  font-family: var(--serif);
  font-style: italic;
  font-size: 1.4rem;
  color: var(--ink-faint);
  text-align: right;
  transition: color 160ms ease;
}
.area-name {
  font-family: var(--serif);
  font-weight: 380;
  font-size: clamp(1.5rem, 3.6vw, 2.6rem);
  line-height: 1.05;
  letter-spacing: -0.01em;
  margin: 0 0 0.4rem;
  color: var(--ink);
  transition: color 160ms ease;
}
.area-desc {
  font-size: 0.98rem;
  color: var(--ink-soft);
  margin: 0;
  max-width: 30rem;
}
/* one subtle hover effect: the entry's number and name fill green */
@media (hover: hover) {
  .area:hover .area-n,
  .area:hover .area-name { color: var(--green); }
}

/* ══ 03 building: asymmetric two-track grid, prose + room glossary ══ */
.building-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr);
  gap: clamp(2rem, 6vw, 6rem);
  align-items: start;
}
.building-prose { max-width: 34rem; }
.rooms {
  margin: 0.4rem 0 0;
  padding: 0;
}
.room {
  padding: 0.9rem 0;
  border-top: 1px solid rgba(33, 31, 27, 0.14);
}
.room:last-child { border-bottom: 1px solid rgba(33, 31, 27, 0.14); }
.room-name {
  font-family: var(--serif);
  font-weight: 440;
  font-size: 1.25rem;
  color: var(--ink);
  margin: 0 0 0.15rem;
}
.room-desc {
  margin: 0;
  font-size: 0.9rem;
  color: var(--ink-soft);
  font-family: var(--sans);
  letter-spacing: 0.01em;
}
/* the oversized fact, set like a catalog dimension line */
.bigfact {
  margin: clamp(2.5rem, 7vh, 5rem) 0 0;
  display: flex;
  align-items: baseline;
  gap: 1rem;
  color: var(--green);
}
.bigfact-n {
  font-family: var(--serif);
  font-weight: 300;
  font-size: clamp(4rem, 16vw, 13rem);
  line-height: 0.8;
  letter-spacing: -0.03em;
}
.bigfact-u {
  font-family: var(--sans);
  font-size: clamp(0.8rem, 2vw, 1.1rem);
  letter-spacing: 0.16em;
  text-transform: lowercase;
  color: var(--ink-soft);
}

/* ══ 04 community: text pushed to the right track ══ */
.community-body {
  margin-left: auto;
  margin-right: clamp(0rem, 8vw, 8rem);
}

/* ══ 05 join: links as underlined arrow-prefixed lines, no buttons ══ */
.join-body { max-width: 40rem; }
.teach {
  color: var(--ink-soft);
  border-left: 2px solid rgba(33, 31, 27, 0.16);
  padding-left: 1.2rem;
  margin: 1.8rem 0 2.6rem;
}
.join-line { margin: 0 0 0.8rem; }
.write-link {
  font-family: var(--serif);
  font-size: clamp(1.4rem, 3.4vw, 2.4rem);
  color: var(--green);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 5px;
  text-decoration-color: rgba(47, 87, 65, 0.4);
  line-height: 1.2;
}
.write-link::before {
  content: "\2192\00a0"; /* right arrow, then nbsp */
  text-decoration: none;
  display: inline-block;
}
.write-link:hover,
.write-link:focus { text-decoration-color: var(--green); color: var(--green-deep); }
.join-line-sub .write-link {
  font-size: clamp(1rem, 2.2vw, 1.35rem);
  color: var(--ink-soft);
  text-decoration-color: rgba(69, 64, 54, 0.4);
}
.join-line-sub .write-link:hover { color: var(--ink); }

/* ══ marginalia: small italic annotations in the margins ══ */
.marginalia {
  position: absolute;
  font-family: var(--serif);
  font-style: italic;
  font-size: 0.82rem;
  line-height: 1.3;
  color: var(--ink-faint);
  max-width: 9rem;
  right: clamp(-1rem, -2vw, 0rem);
  text-align: left;
}
.mg-masthead { bottom: 8%; top: auto; right: clamp(0rem, 3vw, 3rem); left: auto; }
.mg-idea-1 { top: 22%; }
.mg-idea-2 { top: 62%; }
.mg-areas-1 { top: 16%; }
.mg-areas-2 { top: 70%; }
.mg-building-1 { top: 12%; }
.mg-building-2 { bottom: 9%; top: auto; }
.mg-community-1 { top: 30%; right: auto; left: clamp(0rem, 3vw, 3rem); }
.mg-community-2 { top: 66%; right: auto; left: clamp(0rem, 3vw, 3rem); }
.mg-join-1 { top: 26%; }

/* the annotation tick: a small green dagger before the note */
.marginalia {
  border-top: 1px solid var(--green);
  padding-top: 0.4rem;
}

/* ══ colophon ══ */
.colophon {
  position: relative;
  z-index: 3;
  margin-left: var(--rail);
  padding: clamp(2.5rem, 7vh, 4.5rem) clamp(1.4rem, 6vw, 7rem)
           clamp(3rem, 8vh, 5rem) clamp(1.6rem, 5vw, 5rem);
  border-top: 1px solid rgba(33, 31, 27, 0.16);
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: baseline;
  gap: 0.6rem clamp(1.5rem, 4vw, 3rem);
  font-family: var(--sans);
  font-size: 0.84rem;
  letter-spacing: 0.06em;
  color: var(--ink-soft);
}
.colophon-brand {
  font-family: var(--serif);
  font-size: clamp(1.8rem, 4vw, 2.6rem);
  font-weight: 340;
  letter-spacing: -0.01em;
  color: var(--ink);
}
.colophon-addr { justify-self: start; align-self: center; }
.colophon-mail {
  color: var(--green);
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-color: rgba(47, 87, 65, 0.4);
  justify-self: end;
  align-self: center;
}
.colophon-mail:hover { text-decoration-color: var(--green); }
@media (max-width: 620px) {
  .colophon {
    grid-template-columns: 1fr;
    gap: 0.5rem;
  }
  .colophon-mail, .colophon-addr { justify-self: start; }
}

/* ══ RESPONSIVE ══ */
@media (max-width: 900px) {
  :root { --rail: 40px; --gutter: 34px; }
  body { font-size: 17px; }
  /* the index rail collapses to just the numbers, tight to the edge */
  .index-rail {
    justify-content: flex-start;
    padding-top: 1rem;
    padding-left: 0.35rem;
    gap: 0.7rem;
    height: auto;
    top: 0;
    background: linear-gradient(var(--paper), rgba(244, 239, 228, 0));
    padding-bottom: 2rem;
  }
  .index-rail .ix-n { font-size: 0.6rem; }
  .index-rail .ix-l { display: none; }
  /* marginalia drop inline under their blocks, not floated in a margin */
  .marginalia {
    position: static;
    display: inline-block;
    max-width: none;
    margin: 0.6rem 0 0;
    left: auto;
    right: auto;
  }
  .idea-body { margin-left: 0; }
  .community-body { margin-right: 0; }
  .building-grid { grid-template-columns: 1fr; gap: 2.5rem; }
  .area { grid-template-columns: 2.2rem 1fr; gap: 1rem; }
  .wordmark { margin-right: -4vw; }
  .masthead { min-height: 100svh; }
}

@media (max-width: 560px) {
  .masthead { min-height: 100svh; padding-top: 4.5rem; }
  .wordmark { font-size: min(clamp(4.2rem, 23vw, 8rem), 22vh); }
  .definition { font-size: clamp(1.05rem, 4.6vw, 1.3rem); }
  .entry-head { flex-direction: column; gap: 0.4rem; }
  .folio { font-size: 3rem; }
}

/* ══ the motion pass (v3.1) ══ initial states for the Motion+ entrance
   live HERE, gated behind html[data-motion], which the head script sets
   only when motion is allowed. so: no flash of hidden content, no layout
   shift (opacity + transform only), and the no-js / reduced-motion /
   module-failure page is fully visible without any of these rules. */
html[data-motion] .kicker,
html[data-motion] .wordmark,
html[data-motion] .definition,
html[data-motion] .masthead-sub,
html[data-motion] .mg-masthead,
html[data-motion] .entry .folio,
html[data-motion] .entry .entry-title,
html[data-motion] .entry .entry-intro,
html[data-motion] .entry .entry-body > p,
html[data-motion] .entry .building-prose > p,
html[data-motion] .entry .area,
html[data-motion] .entry .room,
html[data-motion] .entry .bigfact,
html[data-motion] .entry .entry-note,
html[data-motion] .entry .join-line,
html[data-motion] .entry .marginalia {
  opacity: 0;
}
/* split-text spans must not clip descenders while they rise */
html[data-motion] .wordmark .split-char,
html[data-motion] .entry-title .split-word {
  will-change: transform, opacity;
}

/* index-rail micro: the label draws a hairline underline on hover/active */
.index-rail .ix-l {
  position: relative;
  padding-bottom: 2px;
  background-image: linear-gradient(var(--green), var(--green));
  background-repeat: no-repeat;
  background-size: 0% 1px;
  background-position: left bottom;
  transition: background-size 260ms cubic-bezier(0.22, 1, 0.36, 1);
}
.index-rail a:hover .ix-l,
.index-rail a:focus .ix-l,
.index-rail a.active .ix-l {
  background-size: 100% 1px;
}

/* write-links get transform transitions handled by motion's spring; keep
   them display inline-block so translateX applies */
.write-link, .colophon-mail { display: inline-block; }

/* ══ reduced motion: thread renders fully grown + static, no smooth scroll ══ */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .index-rail a { transition: none; }
  .index-rail .ix-l { transition: none; }
  .area-n, .area-name { transition: none; }
  /* belt and braces: even if the gate attribute leaked, nothing hides */
  html[data-motion] .kicker,
  html[data-motion] .wordmark,
  html[data-motion] .definition,
  html[data-motion] .masthead-sub,
  html[data-motion] .mg-masthead,
  html[data-motion] .entry .folio,
  html[data-motion] .entry .entry-title,
  html[data-motion] .entry .entry-intro,
  html[data-motion] .entry .entry-body > p,
  html[data-motion] .entry .building-prose > p,
  html[data-motion] .entry .area,
  html[data-motion] .entry .room,
  html[data-motion] .entry .bigfact,
  html[data-motion] .entry .entry-note,
  html[data-motion] .entry .join-line,
  html[data-motion] .entry .marginalia { opacity: 1; }
}
