/* ---------- tokens ---------- */
:root {
  --bg:        #0a0908;
  --deep:      #050403;
  --fg:        #f3ebde;
  --muted:     #8a8278;
  --line:      rgba(243, 235, 222, 0.12);
  --accent:    #ff5b1f;
  --sage:      #7c9a6b;

  --serif:  "Bricolage Grotesque", ui-serif, Georgia, serif;
  --sans:   "Geist", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono:   "Geist Mono", ui-monospace, "JetBrains Mono", Menlo, Consolas, monospace;

  --t-fast:  140ms;
  --t-med:   320ms;
  --t-slow:  640ms;
  --ease:    cubic-bezier(0.65, 0, 0.35, 1);

  --gutter:  clamp(20px, 4vw, 56px);
  --rail:    clamp(64px, 9vw, 120px);

  --grid: clamp(13px, 1.05vw, 16px);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html {
  background: var(--bg);
  color: var(--fg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  font-size: var(--grid);
  -webkit-tap-highlight-color: transparent;
  /* On touch devices: never let the browser interpret drags as scroll,
     pull-to-refresh, two-finger pan, or pinch-zoom. Every drag should
     reach our pointer handlers so the fluid sim is in charge. */
  touch-action: none;
  overscroll-behavior: none;
  -webkit-touch-callout: none;
  -webkit-user-select: none;
          user-select: none;
}
/* Note: NO touch-action override on text/link elements. Under
   touch-action:none on body, taps still fire and links still navigate
   (it only suppresses gestures: scroll, pinch, swipe, double-tap-zoom).
   Carving out 'manipulation' on text elements would let the browser
   eat drag streams over the headline, breaking the fluid sim on phones. */
body {
  font-family: var(--sans);
  font-feature-settings: "ss01", "cv11";
  font-weight: 400;
  line-height: 1.5;
  min-height: 100svh;
  overflow-x: hidden;
  background:
    /* warm vermillion bloom, top-right */
    radial-gradient(60% 50% at 82% 12%, rgba(255, 91, 31, 0.20), transparent 65%),
    /* amber bloom, mid-right */
    radial-gradient(48% 48% at 88% 58%, rgba(255, 145, 60, 0.10), transparent 70%),
    /* sage bloom, bottom-left, much subtler */
    radial-gradient(50% 50% at 8% 95%, rgba(124, 154, 107, 0.08), transparent 70%),
    /* deep paper grain via two stacked noise gradients */
    linear-gradient(180deg, #100d0a 0%, #0a0908 60%, #050403 100%);
}
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: -1;
  background-image:
    radial-gradient(rgba(243, 235, 222, 0.025) 1px, transparent 1px);
  background-size: 3px 3px;
  mix-blend-mode: overlay;
}

/* Mobile-only bottom scrim: covers links + footer + the strip between
   them in one continuous fade, so the bottom of the screen reads as one
   dark panel instead of "links → bright dye band → footer". */
body::after {
  content: "";
  position: fixed;
  left: 0; right: 0; bottom: 0;
  height: 0;
  pointer-events: none;
  z-index: 1;
  background: linear-gradient(180deg,
    rgba(10, 9, 8, 0)    0%,
    rgba(10, 9, 8, 0.55) 35%,
    rgba(10, 9, 8, 0.9)  100%);
}
@media (max-width: 720px) {
  body::after { height: 38svh; }
}

html { isolation: isolate; }

a { color: inherit; text-decoration: none; }
::selection { background: var(--accent); color: var(--bg); }

.vh {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}
.skip {
  position: absolute; left: -9999px; top: 0;
  background: var(--accent); color: var(--bg);
  padding: 10px 14px; font-family: var(--mono); font-size: 12px;
}
.skip:focus { left: 12px; top: 12px; z-index: 100; }

/* ---------- canvas ---------- */
#fluid {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  display: block;
  pointer-events: none;
}

/* desktop cursor halo: a soft, lagging vermillion glow that follows
   the pointer. Gives a sense of presence between dye splats. */
#halo {
  position: fixed;
  top: 0; left: 0;
  width: 320px; height: 320px;
  border-radius: 50%;
  pointer-events: none;
  z-index: 1;
  background: radial-gradient(circle, rgba(255, 91, 31, 0.18), rgba(255, 91, 31, 0) 60%);
  filter: blur(8px);
  transform: translate3d(-9999px, -9999px, 0);
  mix-blend-mode: screen;
  opacity: 0;
  transition: opacity 600ms var(--ease);
}
@media (hover: hover) and (pointer: fine) {
  #halo.on { opacity: 1; }
}

/* ---------- topbar ---------- */
.topbar {
  position: fixed;
  top: 0; left: 0; right: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: clamp(16px, 2.4vw, 28px) var(--gutter);
  z-index: 10;
  pointer-events: none;
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  mix-blend-mode: normal;
}
@media (prefers-reduced-motion: no-preference) {
  .topbar  { animation: topbar-in  700ms var(--ease) 200ms backwards; }
  .footbar { animation: footbar-in 700ms var(--ease) 400ms backwards; }
}
@keyframes topbar-in  { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: translateY(0); } }
@keyframes footbar-in { from { opacity: 0; transform: translateY(8px);  } to { opacity: 1; transform: translateY(0); } }
.topbar > * { pointer-events: auto; }

.mark {
  font-family: var(--serif);
  font-weight: 600;
  font-size: 18px;
  letter-spacing: -0.01em;
  text-transform: none;
  color: var(--fg);
  font-variation-settings: "wdth" 110, "opsz" 24;
}

.meta {
  display: flex;
  align-items: center;
  gap: clamp(14px, 2vw, 26px);
}
.status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.status .dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--sage);
  box-shadow: 0 0 0 0 rgba(124,154,107, 0.6);
}
@media (prefers-reduced-motion: no-preference) {
  .status .dot {
    animation: pulse 2.4s ease-out infinite;
  }
}
@keyframes pulse {
  0%   { box-shadow: 0 0 0 0   rgba(124,154,107, 0.6); }
  70%  { box-shadow: 0 0 0 10px rgba(124,154,107, 0);  }
  100% { box-shadow: 0 0 0 0    rgba(124,154,107, 0);  }
}
.clock { font-variant-numeric: tabular-nums; }

@media (max-width: 720px) {
  /* On mobile: trim status to just the dot, keep the clock — it gives the
     topbar two anchors (SR, time) without the long sentence overlapping. */
  .status span:not(.dot) { display: none; }
  .meta { gap: 14px; }
  .clock { font-size: 11px; }
}

/* ---------- main stage ---------- */
main {
  position: relative;
  z-index: 2;
  min-height: 100svh;
  display: grid;
  align-content: center;
  padding: clamp(90px, 12vh, 160px) var(--gutter) clamp(90px, 11vh, 160px);
}

@media (max-width: 720px) {
  /* On mobile: pin to one viewport, content flows top-down. No scroll
     into emptiness. Headline starts near the top, links sit just above
     the footer. Everything fits in 100svh. */
  html, body { height: 100%; overflow: hidden; }
  main {
    height: 100svh;
    min-height: 0;
    align-content: stretch;
    padding-top: clamp(70px, 11svh, 100px);
    padding-bottom: clamp(64px, 9svh, 88px);
    display: flex;
    flex-direction: column;
  }
  .stage { gap: clamp(14px, 2.6svh, 22px); }
}

.stage {
  position: relative;
  display: grid;
  gap: clamp(20px, 3vh, 36px);
  max-width: 1320px;
  width: 100%;
  margin: 0 auto;
}

@media (max-width: 720px) {
  /* Mobile composition: title block at top, links pushed to bottom of
     stage. The flex spacer between text and links absorbs leftover height
     so the layout breathes instead of clumping. */
  .stage {
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    gap: 0;
    min-height: 0;
  }
  .stage > .display { flex: 0 0 auto; margin: 0; }
  .stage > .lede   { flex: 0 0 auto; margin-top: clamp(14px, 2.6svh, 22px); }
  .stage > .sub    { flex: 0 0 auto; margin-top: clamp(8px, 1.6svh, 14px); }
  .stage > .links  {
    flex: 0 0 auto;
    margin-top: auto;       /* push to the bottom */
    padding-top: clamp(20px, 4svh, 32px);
    margin-left: calc(-1 * var(--gutter));
    margin-right: calc(-1 * var(--gutter));
    padding-left: var(--gutter);
    padding-right: var(--gutter);
    padding-bottom: 8px;
  }
}

/* ---------- display headline ---------- */
.display {
  font-family: var(--serif);
  font-weight: 500;
  font-variation-settings: "wdth" 105, "opsz" 96;
  font-size: clamp(64px, 14vw, 168px);
  line-height: 0.92;
  letter-spacing: -0.035em;
  margin: 0;
  padding-bottom: 0.18em;     /* room for descenders so 'y' doesn't get clipped */
  color: var(--fg);
  display: grid;
  gap: clamp(2px, 0.4vw, 8px);
  text-wrap: balance;
  text-shadow: 0 2px 30px rgba(10, 9, 8, 0.55);
  overflow: visible;
  -webkit-tap-highlight-color: transparent;
  -webkit-user-select: none;
          user-select: none;
}
@media (max-width: 720px) {
  /* Single-line first name, stacked layout, tighter scale on phones */
  .display { font-size: clamp(58px, 16vw, 88px); }
  .display .word.small { font-size: 0.72em; }
}
.display .word {
  display: block;
  position: relative;
  will-change: transform, font-variation-settings;
}

/* one-time entrance: the words rise from below and reveal via clip-path.
   Bottom inset stays generous (-30%) so descenders aren't clipped. */
@keyframes word-rise {
  from {
    clip-path: inset(0 0 100% 0);
    opacity: 0;
    transform: translateY(28px);
  }
  to {
    clip-path: inset(-10% 0 -30% 0);
    opacity: 1;
    transform: translateY(0);
  }
}

/* subtle width-axis breath: barely noticeable, 12s loop, only after entrance.
   This is one of those things font nerds spot, and nobody else does. */
@media (prefers-reduced-motion: no-preference) {
  .display .word:nth-child(1) {
    animation: word-rise 900ms cubic-bezier(0.2, 0.7, 0.1, 1) 120ms backwards,
               width-breath 14s ease-in-out 1500ms infinite;
  }
  .display .word:nth-child(2) {
    animation: word-rise 900ms cubic-bezier(0.2, 0.7, 0.1, 1) 280ms backwards,
               width-breath 14s ease-in-out 2200ms infinite;
  }
  .display .word.small {
    animation: word-rise 900ms cubic-bezier(0.2, 0.7, 0.1, 1) 460ms backwards,
               width-breath-italic 14s ease-in-out 2900ms infinite;
  }
}
@keyframes width-breath {
  0%, 100% { font-variation-settings: "wdth" 105, "opsz" 96; }
  50%      { font-variation-settings: "wdth" 112, "opsz" 96; }
}
@keyframes width-breath-italic {
  0%, 100% { font-variation-settings: "wdth" 95,  "opsz" 72; }
  50%      { font-variation-settings: "wdth" 100, "opsz" 72; }
}
.display .word.small {
  font-size: 0.78em;
  font-variation-settings: "wdth" 95, "opsz" 72;
  font-style: italic;
  color: var(--fg);
  opacity: 0.92;
}

/* the cut-through-shader effect: each word has a duplicate that
   uses background-clip:text so the canvas (positioned behind, not used as
   an actual background) still reads through subtly. We add an inset
   highlight that picks up shader luminance via a thin layered overlay. */
.display .word::after {
  content: attr(data-text);
  position: absolute;
  inset: 0;
  background:
    radial-gradient(120% 220% at 50% 50%, rgba(255, 91, 31, 0.35), transparent 55%);
  -webkit-background-clip: text;
          background-clip: text;
  -webkit-text-fill-color: transparent;
          color: transparent;
  pointer-events: none;
  opacity: 0;
  transition: opacity var(--t-med) var(--ease);
}
.stage:hover .display .word::after { opacity: 0.7; }

/* ---------- lede / sub ---------- */
.lede {
  font-family: var(--serif);
  font-weight: 400;
  font-variation-settings: "wdth" 100, "opsz" 24;
  font-size: clamp(19px, 4.6vw, 30px);
  line-height: 1.35;
  letter-spacing: -0.012em;
  margin: 0;
  max-width: 28ch;
  color: var(--fg);
}
@media (prefers-reduced-motion: no-preference) {
  .lede  { animation: fade-rise 700ms var(--ease) 700ms backwards; }
  .sub   { animation: fade-rise 700ms var(--ease) 850ms backwards; }
  .links { animation: fade-rise 700ms var(--ease) 1000ms backwards; }
}
@keyframes fade-rise {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}
.lede a {
  position: relative;
  border-bottom: 1px solid var(--accent);
  padding-bottom: 1px;
  transition: color var(--t-fast) var(--ease);
}
.lede a:hover { color: var(--accent); }
.lede .prev {
  font-style: italic;
  color: var(--muted);
}

.sub {
  font-family: var(--sans);
  font-size: clamp(13px, 3.4vw, 15px);
  color: var(--muted);
  margin: 0;
  max-width: 40ch;
  line-height: 1.55;
}

/* ---------- links ---------- */
.links {
  list-style: none;
  margin: clamp(10px, 2vh, 20px) 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0;
  font-family: var(--mono);
  font-size: 14px;
  letter-spacing: 0.02em;
  border-top: 1px solid var(--line);
  max-width: 520px;
}
.links li { display: block; }
.links a {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 16px 0;
  border-bottom: 1px solid var(--line);
  color: var(--fg);
  font-size: 15px;
  letter-spacing: 0.01em;
  transition: color var(--t-fast) var(--ease),
              padding var(--t-med) var(--ease);
  position: relative;
}
.links a::before {
  content: "";
  position: absolute;
  left: 0; top: 50%;
  width: 0; height: 1px;
  background: var(--accent);
  transition: width var(--t-med) var(--ease);
}
.links a:hover {
  color: var(--accent);
  padding-left: 18px;
}
.links a:hover::before { width: 12px; }
.links a:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 4px;
  border-radius: 2px;
}
.links a span {
  font-size: 1em;
  opacity: 0.5;
  transition: opacity var(--t-fast) var(--ease), transform var(--t-fast) var(--ease);
}
.links a:hover span { opacity: 1; transform: translate(2px, -2px); }

/* desktop: keep a horizontal row for the larger viewport */
@media (min-width: 720px) {
  .links {
    flex-direction: row;
    flex-wrap: wrap;
    border-top: 0;
    gap: clamp(10px, 1.2vw, 18px) clamp(14px, 2vw, 28px);
  }
  .links a {
    padding: 10px 14px;
    border: 1px solid var(--line);
    border-bottom: 1px solid var(--line);
    border-radius: 999px;
    background: rgba(243, 235, 222, 0.02);
    font-size: 13px;
    justify-content: flex-start;
  }
  .links a::before { display: none; }
  .links a:hover {
    border-color: var(--accent);
    background: rgba(255, 91, 31, 0.06);
    padding-left: 14px;
  }
}

/* ---------- footbar ---------- */
.footbar {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  padding: clamp(14px, 2vw, 22px) var(--gutter);
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  z-index: 5;
  pointer-events: none;
}
.footbar > * { pointer-events: auto; }
.dot-sep { opacity: 0.5; }

@media (max-width: 600px) {
  .footbar { font-size: 10px; gap: 8px; padding-bottom: max(14px, env(safe-area-inset-bottom)); }
}

/* ---------- discoverable hint chip ---------- */
.kbd {
  display: inline-block;
  padding: 3px 8px;
  border: 1px solid var(--line);
  border-radius: 4px;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--fg);
  background: rgba(243, 235, 222, 0.04);
  letter-spacing: 0.04em;
}

.hint {
  position: fixed;
  bottom: clamp(14px, 2vw, 22px);
  right: var(--gutter);
  display: flex;
  gap: 6px;
  z-index: 6;
  pointer-events: none;
  opacity: 0;
  transform: translateY(6px);
  transition: opacity var(--t-slow) var(--ease), transform var(--t-slow) var(--ease);
}
.hint.show { opacity: 0.85; transform: translateY(0); }
.hint.hide { opacity: 0; }

@media (max-width: 600px) {
  .hint { bottom: max(60px, calc(env(safe-area-inset-bottom) + 56px)); right: 16px; }
}

/* ---------- SEO bio (visually hidden, fully indexable) ---------- */
/* Crawlers and screen readers read this; sighted users don't see it.
   We deliberately do NOT use display:none — Google can devalue or ignore
   display:none content. clip+absolute keeps it indexable but layout-free. */
.bio-seo {
  position: absolute;
  left: 0; top: 0;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
  pointer-events: none;
}

/* ---------- reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  * {
    animation: none !important;
    transition: none !important;
  }
}
