/* ============================================================
   Root System — memory-layer site
   Warm cream page, near-black prose. One bold lead phrase per section.
   ============================================================ */

/* ============================================================
   COLOR / PALETTE — start a reskin here.
   Every brand color is a CSS custom property in :root below:
     --ink     page background (warm cream)
     --paper   text (warm near-black)   + --paper-dim / --paper-faint
     --living  accent (clay / terracotta) + --rule (hairlines)
   These same tokens are duplicated in the <style> blocks of
   privacy.html and terms.html — update all three together.
   Palette carried over from the original template; a distinct
   Root System palette is a separate task.
   ============================================================ */
:root {
  /* roles, not literal color names: --ink is the canvas, --paper the text. */
  --ink: #F5F0E9;          /* background (warm cream) */
  --paper: #221C16;        /* text (warm near-black) */
  --paper-dim: #6F675B;    /* secondary text: deck, body "quiet", closing beats, labels */
  /* faint is footer/return utility text at 11px — a quieter tier than
     --paper-dim, kept on-palette by deriving it from the ink. */
  --paper-faint: rgba(34, 28, 22, 0.55);
  --living: #7A3A24;       /* accent: clay / terracotta (links, rules, mark) */
  --rule: rgba(122, 58, 36, 0.45);       /* resting underline + left rules (accent) */

  --ease-zoom: cubic-bezier(0.22, 1, 0.36, 1);
  --dur: 850ms;            /* one zoom speed, in and out */
}

/* minimal reset */
* { margin: 0; padding: 0; box-sizing: border-box; }

html, body {
  background: var(--ink);
  color: var(--paper);
  height: 100%;
  overflow: hidden;
  font-family: 'Hanken Grotesk', sans-serif;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

::selection { background: rgba(122, 58, 36, 0.18); }

/* ---------- layers / the camera ---------- */

.layer {
  position: fixed;
  inset: 0;
  overflow-y: auto;
  overflow-x: hidden;
  will-change: transform, opacity, filter;
  transition:
    transform var(--dur) var(--ease-zoom),
    opacity calc(var(--dur) * 0.8) ease,
    filter var(--dur) var(--ease-zoom);
}
.layer.no-anim { transition: none !important; }

/* home at rest */
#home { transform: scale(1); opacity: 1; z-index: 2; }
/* home flown past */
#home.passed {
  transform: scale(5.5);
  opacity: 0;
  filter: blur(6px);
  pointer-events: none;
}

/* detail at rest: sitting deeper than the viewport, hidden */
#detail {
  transform: scale(0.22);
  opacity: 0;
  filter: blur(10px);
  pointer-events: none;
  z-index: 1;
}
/* detail arrived */
#detail.arrived {
  transform: scale(1);
  opacity: 1;
  filter: blur(0);
  pointer-events: auto;
  z-index: 3;
}

/* reduced motion: no camera, just crossfades */
@media (prefers-reduced-motion: reduce) {
  .layer { transition: opacity 300ms ease; }
  #home, #home.passed { transform: none; filter: none; }
  #detail, #detail.arrived { transform: none; filter: none; }
}

/* ---------- home composition ---------- */

.frame {
  position: relative;
  min-height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 6vh 24px 5vh;
}

/* wordmark + prose, centered as one group in the space above the footer.
   flex-grow fills tall viewports so the title stays a fixed (capped)
   distance from the copy; flex-shrink 0 means on short viewports it keeps
   its height and the footer flows below instead of overlapping the prose. */
.lead {
  flex: 1 0 auto;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.wordmark {
  font-family: 'Hanken Grotesk', sans-serif;
  font-optical-sizing: auto;
  font-weight: 300;   /* Hanken Grotesk Light */
  font-size: clamp(22px, 2.7vw, 27px);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--paper);
  user-select: none;
  /* the one, capped gap between title and copy */
  margin-bottom: clamp(2.4rem, 7vh, 4.5rem);
}

.prose {
  display: flex;
  flex-direction: column;
  max-width: 620px;
  gap: 2.1em;
}

.prose p {
  font-size: clamp(16px, 1.85vw, 19px);
  line-height: 1.6;
  font-weight: 300;
  color: var(--paper);
  text-wrap: pretty;
}

/* inline accent links in the prose: the mailto CTA ("tell us") and the
   lead phrases that open into a spoke. One shared treatment - clay text a
   hair heavier than the 300 copy, with a thin accent underline that deepens
   on hover. text-decoration (not a border) so it follows the text across
   wrapped lines. */
.cta,
.portal {
  cursor: pointer;
  color: var(--living);
  font-family: inherit;
  font-size: inherit;
  line-height: inherit;
  letter-spacing: inherit;
  font-weight: 400;
  text-decoration-line: underline;
  text-decoration-color: var(--rule);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.16em;
  transition: color 240ms ease, text-decoration-color 240ms ease;
}
.cta:hover,
.cta:focus-visible,
.portal:hover,
.portal:focus-visible {
  text-decoration-color: var(--living);
}
.cta:focus-visible,
.portal:focus-visible {
  outline: 2px solid var(--living);
  outline-offset: 3px;
  border-radius: 2px;
}

/* touch devices: suppress the default tap-highlight rectangle on the
   inline links; the tap deepens the accent underline. */
@media (hover: none) {
  .cta, .portal {
    -webkit-tap-highlight-color: transparent;
  }
  .cta:active, .portal:active {
    text-decoration-color: var(--living);
  }
}

.foot {
  flex: 0 0 auto;
  margin-top: clamp(2.5rem, 6vh, 4rem);   /* guaranteed gap above the footer */
  display: flex;
  gap: 2.9em;
}
.foot a {
  font-family: 'Spline Sans Mono', monospace;
  font-weight: 400;
  font-size: 13px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--paper-faint);
  text-decoration: none;
  transition: color 240ms ease;
}
.foot a:hover { color: var(--paper); }
.foot a:focus-visible {
  outline: 2px solid var(--living);
  outline-offset: 4px;
  color: var(--paper);
}

/* ---------- detail composition ---------- */

.detail-frame {
  min-height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 5vh 24px 6vh;
}

/* the shared footer, anchored to the bottom of a detail view with a
   guaranteed gap so it separates from the article's closing line */
.detail-frame .foot {
  margin-top: auto;
  padding-top: clamp(2.5rem, 8vh, 4rem);
}

.return {
  align-self: flex-start;
  position: sticky;
  top: 5vh;
  margin-left: max(24px, 6vw);
  font-family: 'Spline Sans Mono', monospace;
  font-weight: 300;
  font-size: 11px;
  letter-spacing: 0.26em;
  text-transform: uppercase;
  color: var(--paper-faint);
  background: none;
  border: none;
  cursor: pointer;
  padding: 6px 0;
  transition: color 240ms ease;
}
.return:hover,
.return:focus-visible { color: var(--living); }
.return:focus-visible {
  outline: 2px solid var(--living);
  outline-offset: 4px;
  border-radius: 2px;
}

.detail-body {
  max-width: 600px;
  margin-top: 9vh;
}

.detail-body .eyebrow {
  font-family: 'Spline Sans Mono', monospace;
  font-weight: 400;
  font-size: 11px;
  letter-spacing: 0.34em;
  text-transform: uppercase;
  color: var(--living);
  margin-bottom: 2.2em;
}

.detail-body h1 {
  font-family: 'Hanken Grotesk', sans-serif;
  font-optical-sizing: auto;
  font-weight: 300;
  font-size: clamp(30px, 4.6vw, 46px);
  line-height: 1.18;
  letter-spacing: -0.01em;
  margin-bottom: 0.9em;
  text-wrap: balance;
}

.detail-body .deck {
  font-family: 'Hanken Grotesk', sans-serif;
  font-style: italic;
  font-weight: 300;
  font-size: clamp(18px, 2.1vw, 22px);
  line-height: 1.5;
  color: var(--paper-dim);
  margin-bottom: 2em;
  text-wrap: pretty;
}

.detail-body p {
  font-size: clamp(16px, 1.85vw, 19px);
  line-height: 1.6;
  font-weight: 300;
  color: var(--paper);
  margin-bottom: 2.1em;
  text-wrap: pretty;
}

.detail-body p.quiet { color: var(--paper-dim); }
.detail-body strong { font-weight: 600; color: var(--paper); }
.detail-body em { font-style: italic; }

/* figures: large display numerals, mono-caps labels, left-ruled */
.detail-body .figure {
  border-left: 1px solid var(--rule);
  padding: 0.2em 0 0.2em 1.6em;
  margin: 2.6em 0;
}
.detail-body .figure .big {
  font-family: 'Hanken Grotesk', sans-serif;
  font-weight: 300;
  font-size: clamp(26px, 3.4vw, 36px);
  color: var(--living);
  line-height: 1.2;
  margin-bottom: 0.35em;
}
.detail-body .figure .label {
  font-family: 'Spline Sans Mono', monospace;
  font-weight: 300;
  font-size: 11px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--paper-dim);
  margin: 0;
  line-height: 1.7;
}

/* economics: the single visual. Two hairline proportional bars,
   accent green, no axis, no legend. */
.figure-bars { border-left: none; padding-left: 0; }
.figure-bars .big { margin-bottom: 0.9em; }
.bars {
  display: flex;
  flex-direction: column;
  gap: 1.1em;
  margin: 0.4em 0 1.1em;
}
.bar-row {
  display: flex;
  align-items: center;
  gap: 1em;
}
.bar-track { flex: 1; min-width: 0; }
.bar {
  display: block;
  height: 2px;
  background: var(--living);
  width: var(--w);
  transform-origin: left center;
}
.bar-val {
  font-family: 'Spline Sans Mono', monospace;
  font-weight: 300;
  font-size: 12px;
  letter-spacing: 0.18em;
  color: var(--paper-dim);
  white-space: nowrap;
  flex: 0 0 auto;
}
.bar-row.is-primary .bar { height: 3px; }
.bar-row.is-primary .bar-val { color: var(--living); }

/* ---------- responsive ---------- */

/* tablet */
@media (max-width: 768px) {
  .detail-body { margin-top: 7vh; }
}

/* phone (test target: 375px) */
@media (max-width: 480px) {
  .frame { padding: 5vh 22px 4vh; }
  .prose {
    gap: 1.85em;
    max-width: 100%;
  }
  .prose p { font-size: 16px; line-height: 1.6; }

  .foot { gap: 2.2em; }
  .foot a { font-size: 12px; letter-spacing: 0.16em; }

  .detail-frame { padding: 4vh 22px 6vh; }
  .return { margin-left: 0; top: 3vh; }
  .detail-body { margin-top: 5vh; max-width: 100%; }
  .detail-body h1 { font-size: clamp(27px, 8vw, 34px); }
  .detail-body .eyebrow { margin-bottom: 1.8em; }
  .detail-body p { font-size: 16px; }
  .bar-val { font-size: 11px; letter-spacing: 0.12em; }
}

/* ---------- mailto fallback hint ---------- */
/* a quiet cream pill that surfaces the email as selectable text when a
   mailto click can't open a mail client. Lives outside the transformed
   layers so position:fixed resolves against the viewport. */
.mail-hint {
  position: fixed;
  left: 50%;
  bottom: 26px;
  transform: translate(-50%, 12px);
  z-index: 10;
  display: flex;
  align-items: baseline;
  gap: 0.8em;
  max-width: calc(100vw - 32px);
  padding: 10px 18px;
  background: var(--ink);
  border: 1px solid var(--rule);
  border-radius: 999px;
  box-shadow: 0 8px 30px rgba(34, 28, 22, 0.12);
  font-family: 'Spline Sans Mono', monospace;
  font-weight: 300;
  font-size: 12px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 240ms ease, transform 360ms var(--ease-zoom);
}
.mail-hint.show {
  opacity: 1;
  transform: translate(-50%, 0);
  pointer-events: auto;   /* so the address can be selected */
}
.mail-hint .addr {
  color: var(--paper);
  letter-spacing: 0.02em;
  -webkit-user-select: all;
  user-select: all;       /* one tap/click selects the whole address */
}
.mail-hint .note {
  color: var(--paper-faint);
  letter-spacing: 0.2em;
  text-transform: uppercase;
  font-size: 10px;
}
@media (prefers-reduced-motion: reduce) {
  .mail-hint { transition: opacity 240ms ease; transform: translate(-50%, 0); }
}
