/* Hallmark · pre-emit critique: P5 H5 E5 S4 R5 V5
 * Hallmark · genre: atmospheric · theme: Midnight · nav: N5 floating pill · footer: Ft5 statement
 * Hallmark · macrostructure: Marquee Hero (home) · Index-First (portal) · Long Document (post)
 * Hallmark · tone: atmospheric · audience: prospective clients + employers · use: explore the work
 * Hallmark · anchor hue: warm 45–58 · enrichment: none (typography + two fixed blooms)
 * Hallmark · type: Geist (display + body) + Geist Mono (outlier role: machine-set text —
 *            wordmark, metadata, hostnames, index labels, code). 2 families.
 * Hallmark · contrast: pass (40–41) · honest: pass (46) · chrome: pass (47)
 * Hallmark · tokens: pass (48) · responsive: pass (49) · icons: pass (30)
 * Hallmark · mobile: pass (34, 49, 50–57) · nav: N5 · footer: Ft5 · slop: pass (42–45)
 * Note on 40: hairline rules (--color-rule / --color-rule-soft) sit below 3:1. They are
 * decorative row separators, not control boundaries — every row and card is identified by
 * its own text and surface fill, so WCAG 1.4.11 does not bind. All text pairs clear 4.5:1.
 */

@import url("tokens.css");

/* ------------------------------------------------------------------ base */

*,
*::before,
*::after { box-sizing: border-box; }

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

body {
  overflow-x: clip;
  margin: 0;
  min-height: 100%;
  font-family: var(--font-body);
  font-size: var(--text-md);
  font-weight: 350;
  line-height: 1.65;
  color: var(--color-ink);
  background-color: var(--color-paper);
  /* Two fixed blooms. No animation — the canvas is the design. */
  background-image:
    radial-gradient(58rem 42rem at 12% -6%,  var(--bloom-1), var(--bloom-0) 70%),
    radial-gradient(48rem 38rem at 96% 18%, var(--bloom-2), var(--bloom-0) 70%);
  background-attachment: fixed;
  background-repeat: no-repeat;
  -webkit-font-smoothing: antialiased;
  padding-inline: max(0px, env(safe-area-inset-left));
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}

h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-style: normal;
  font-weight: 600;
  letter-spacing: -0.025em;
  line-height: 1.14;
  overflow-wrap: anywhere;
  min-width: 0;
  margin: 0;
}

p { margin: 0; }

a { color: inherit; }

img, svg, iframe { max-width: 100%; }

::selection {
  background: var(--color-accent-dim);
  color: var(--color-paper);
}

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

.skip {
  position: absolute;
  inset-block-start: var(--space-xs);
  inset-inline-start: var(--space-xs);
  z-index: var(--z-tooltip);
  padding: var(--space-xs) var(--space-md);
  font-size: var(--text-sm);
  color: var(--color-paper);
  background: var(--color-accent);
  border-radius: var(--radius-pill);
  white-space: nowrap;
  transform: translateY(-250%);
}
.skip:focus-visible { transform: none; }

.page {
  width: 100%;
  max-width: 82rem;
  margin-inline: auto;
  padding-inline: var(--page-gutter);
}

.muted  { color: var(--color-neutral); }
.tnum   { font-variant-numeric: tabular-nums; }

.meta {
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  font-weight: 400;
  letter-spacing: 0.02em;
  color: var(--color-neutral);
  font-variant-numeric: tabular-nums;
}

/* ------------------------------------------------- N5 · floating pill nav */

.nav-pill {
  position: fixed;
  inset: var(--space-md) auto auto 50%;
  transform: translateX(-50%);
  z-index: var(--z-sticky);
  display: inline-flex;
  align-items: center;
  gap: var(--space-sm);
  max-width: calc(100% - var(--space-lg));
  padding: 0.4rem 0.4rem 0.4rem 0.95rem;
  background: color-mix(in oklch, var(--color-paper-2) 72%, transparent);
  backdrop-filter: blur(16px) saturate(130%);
  -webkit-backdrop-filter: blur(16px) saturate(130%);
  border: var(--rule-hair) solid var(--color-rule);
  border-radius: var(--radius-pill);
}

.nav-pill__mark {
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  font-weight: 500;
  letter-spacing: 0.01em;
  color: var(--color-ink);
  text-decoration: none;
  white-space: nowrap;
}

.nav-pill__links {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  margin: 0;
  padding: 0;
  list-style: none;
}

.nav-pill__link {
  font-size: var(--text-sm);
  font-weight: 400;
  color: var(--color-muted);
  text-decoration: none;
  white-space: nowrap;
  transition: color var(--dur-micro) var(--ease-out);
}
.nav-pill__link[aria-current="page"] { color: var(--color-ink); }

.nav-pill__cta {
  padding: 0.4rem 0.85rem;
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--color-paper);
  text-decoration: none;
  white-space: nowrap;
  background: var(--color-accent);
  border-radius: var(--radius-pill);
  transition: transform var(--dur-micro) var(--ease-out),
              background-color var(--dur-micro) var(--ease-out);
}

@media (hover: hover) and (pointer: fine) {
  .nav-pill__link:hover { color: var(--color-ink); }
  .nav-pill__cta:hover  { transform: translateY(-1px); }
}
.nav-pill__cta:active { transform: translateY(0); background: var(--color-accent-dim); }

/* 44 px floor on narrow viewports and on any coarse pointer. */
@media (pointer: coarse), (max-width: 48rem) {
  .nav-pill__cta { min-height: 44px; display: inline-flex; align-items: center; }
}

/* N5 mobile collapse — drop the link list, keep wordmark + CTA. */
@media (max-width: 30rem) {
  .nav-pill__links { display: none; }
}

/* ------------------------------------------- H1 · marquee hero (home only) */

.marquee {
  display: grid;
  align-content: end;
  min-height: 78svh;
  padding-block: var(--space-2xl) var(--space-3xl);
}

.marquee__display {
  max-width: 15ch;
  font-size: var(--text-display);
  font-weight: 600;
  line-height: 1.02;
  letter-spacing: -0.04em;
}

.rule-thick {
  height: var(--rule-thick);
  margin: 0;
  border: 0;
  background: var(--color-ink);
}

/* ------------------------------------------------------ S2 · hanging head */

.head-hang {
  padding-block: var(--space-3xl) var(--space-lg);
  display: grid;
  gap: var(--space-sm);
}

.head-hang h2 {
  font-size: var(--text-2xl);
  max-width: 20ch;
}

.head-hang p {
  max-width: 52ch;
  color: var(--color-neutral);
  font-size: var(--text-base);
}

/* ----------------------------------------------- featured · asymmetric 2-up */

.featured {
  display: grid;
  gap: var(--space-lg);
  grid-template-columns: minmax(0, 1fr);
  padding-block-end: var(--space-2xl);
}

@media (min-width: 60rem) {
  .featured { grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.85fr); gap: var(--space-xl); }
}

.card {
  display: grid;
  align-content: start;
  gap: var(--space-sm);
  padding: var(--space-lg);
  text-decoration: none;
  background: var(--color-paper-2);
  border: var(--rule-hair) solid var(--color-rule-soft);
  border-radius: var(--radius-md);
  transition: transform var(--dur-short) var(--ease-out),
              background-color var(--dur-short) var(--ease-out),
              border-color var(--dur-short) var(--ease-out);
}

.card__name {
  font-family: var(--font-display);
  font-size: var(--text-xl);
  font-weight: 600;
  letter-spacing: -0.03em;
  line-height: 1.1;
}

.card__desc {
  font-size: var(--text-base);
  color: var(--color-muted);
  max-width: 46ch;
}

.card__host {
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  color: var(--color-accent);
  padding-block-start: var(--space-2xs);
}

/* Elevation by lightness, not by glow — dark surfaces get brighter, not haloed. */
@media (hover: hover) and (pointer: fine) {
  .card:hover {
    transform: translateY(-2px);
    background: var(--color-paper-3);
  }
}
.card:active { transform: translateY(0); }

/* ------------------------------------------- F3 · tabular index (rows) */

.rows {
  border-block-start: var(--rule-hair) solid var(--color-rule-soft);
}

/* The writing index sits well clear of the featured block above it. */
#writing { padding-block-start: var(--space-3xl); }

.row {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--space-3xs) var(--space-lg);
  align-items: baseline;
  padding-block: var(--space-md);
  border-block-end: var(--rule-hair) solid var(--color-rule-soft);
  text-decoration: none;
  transition: background-color var(--dur-micro) var(--ease-out);
}

@media (min-width: 48rem) {
  .row {
    grid-template-columns: 8.5rem minmax(0, 1fr) auto;
    padding-block: var(--space-lg);
  }
}

.row__title {
  font-family: var(--font-display);
  font-size: var(--text-md);
  font-weight: 500;
  letter-spacing: -0.015em;
  line-height: 1.35;
  color: var(--color-ink);
  text-decoration: none;
  text-decoration-color: var(--color-accent);
  text-underline-offset: 0.22em;
}

.row__aside {
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  color: var(--color-neutral);
  white-space: nowrap;
}

@media (hover: hover) and (pointer: fine) {
  .row:hover { background: var(--tint-hover); }
  .row:hover .row__title { text-decoration: underline; }
}

/* ----------------------------------------------- S5 · bottom-anchored head */

.head-bottom {
  padding-block: var(--space-lg) var(--space-3xl);
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--space-2xs);
  justify-items: start;
}

.head-bottom h2 {
  font-size: var(--text-lg);
  font-weight: 500;
  letter-spacing: -0.02em;
  color: var(--color-neutral);
}

/* --------------------------------------------- C3 · typographic link */

.link {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2xs);
  font-size: var(--text-base);
  font-weight: 500;
  color: var(--color-accent);
  text-decoration: none;
  white-space: nowrap;
  border-block-end: var(--rule-hair) solid var(--color-accent-dim);
  padding-block-end: var(--space-3xs);
  transition: border-color var(--dur-micro) var(--ease-out),
              color var(--dur-micro) var(--ease-out);
}
@media (hover: hover) and (pointer: fine) {
  .link:hover { border-color: var(--color-accent); color: var(--color-focus); }
}
.link:active { color: var(--color-accent-dim); }
@media (pointer: coarse), (max-width: 48rem) { .link { min-height: 44px; } }

/* ------------------------------------------------ 13 · Index-First (portal) */

.index-intro {
  padding-block: var(--space-4xl) var(--space-xl);
  display: grid;
  gap: var(--space-md);
}

.index-intro__lede {
  max-width: var(--measure);
  font-size: var(--text-lg);
  line-height: 1.45;
  letter-spacing: -0.012em;
  color: var(--color-ink);
}

.index-group { padding-block-end: var(--space-xl); }

.index-group__label {
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--color-accent);
  padding-block-end: var(--space-sm);
}

.entry {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--space-2xs) var(--space-lg);
  padding-block: var(--space-md);
  border-block-end: var(--rule-hair) solid var(--color-rule-soft);
  transition: background-color var(--dur-micro) var(--ease-out);
}

@media (min-width: 48rem) {
  .entry {
    grid-template-columns: minmax(0, 16rem) minmax(0, 1fr);
    padding-block: var(--space-lg);
  }
}

.entry__name {
  font-family: var(--font-display);
  font-size: var(--text-md);
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--color-ink);
  text-decoration: none;
  text-underline-offset: 0.22em;
}

.entry__body { display: grid; gap: var(--space-2xs); }

.entry__desc {
  font-size: var(--text-base);
  color: var(--color-muted);
  max-width: 62ch;
}

.entry__host {
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  color: var(--color-neutral);
  overflow-wrap: anywhere;
}

.entry__extra {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-sm);
  font-family: var(--font-mono);
  font-size: var(--text-sm);
}
.entry__extra a { color: var(--color-accent); text-underline-offset: 0.22em; }

@media (hover: hover) and (pointer: fine) {
  .entry:hover { background: var(--tint-hover); }
  .entry:hover .entry__name { text-decoration: underline; text-decoration-color: var(--color-accent); }
}

/* ------------------------------------------ 02 · Long Document (post page) */

.doc { padding-block: var(--space-4xl) var(--space-2xl); }

.doc__head { display: grid; gap: var(--space-md); padding-block-end: var(--space-xl); }

.doc__title {
  max-width: 22ch;
  font-size: var(--text-display-s);
  font-weight: 600;
  line-height: 1.06;
  letter-spacing: -0.035em;
}

.prose {
  max-width: var(--measure);
  font-size: var(--text-md);
  line-height: 1.68;
  color: var(--color-muted);
}

.prose > * + * { margin-block-start: var(--space-lg); }

.prose h2 {
  font-size: var(--text-xl);
  color: var(--color-ink);
  margin-block-start: var(--space-2xl);
}
.prose h3 {
  font-size: var(--text-lg);
  color: var(--color-ink);
  margin-block-start: var(--space-xl);
}
.prose h4 {
  font-size: var(--text-md);
  font-weight: 600;
  color: var(--color-ink);
  margin-block-start: var(--space-lg);
}

.prose strong { color: var(--color-ink); font-weight: 600; }

.prose a {
  color: var(--color-accent);
  text-underline-offset: 0.2em;
  text-decoration-thickness: 1px;
  overflow-wrap: anywhere;
}
@media (hover: hover) and (pointer: fine) {
  .prose a:hover { color: var(--color-focus); }
}

.prose ul, .prose ol {
  padding-inline-start: var(--space-lg);
  display: grid;
  gap: var(--space-xs);
}

.prose blockquote {
  margin: 0;
  padding-inline-start: var(--space-lg);
  border-inline-start: var(--rule-hair) solid var(--color-accent-dim);
  color: var(--color-neutral);
}

.prose code {
  font-family: var(--font-mono);
  font-size: 0.86em;
  color: var(--color-ink);
  background: var(--color-paper-2);
  padding: 0.12em 0.36em;
  border-radius: var(--radius-sm);
}

/* A surface, not fake window chrome — no title bar, no traffic lights. */
.codeblock {
  margin: 0;
  background: var(--color-paper-2);
  border: var(--rule-hair) solid var(--color-rule-soft);
  border-radius: var(--radius-md);
}

.codeblock pre {
  margin: 0;
  padding: var(--space-md);
  overflow-x: auto;
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  line-height: 1.6;
  color: var(--color-ink);
  background: none;
}
.codeblock pre code { background: none; padding: 0; font-size: inherit; }

.prose table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--text-base);
  font-variant-numeric: tabular-nums;
}
.prose figure.table-wrap { margin: 0; overflow-x: auto; }
.prose th, .prose td {
  text-align: start;
  padding: var(--space-sm) var(--space-md) var(--space-sm) 0;
  border-block-end: var(--rule-hair) solid var(--color-rule-soft);
  vertical-align: top;
}
.prose th { color: var(--color-ink); font-weight: 600; white-space: nowrap; }

.embed {
  margin: 0;
  aspect-ratio: 16 / 9;
  border: var(--rule-hair) solid var(--color-rule-soft);
  border-radius: var(--radius-md);
  overflow: hidden;
  background: var(--color-paper-2);
}
.embed iframe { width: 100%; height: 100%; border: 0; display: block; }

.doc__foot {
  max-width: var(--measure);
  display: grid;
  gap: var(--space-lg);
  padding-block-start: var(--space-3xl);
  margin-block-start: var(--space-2xl);
  border-block-start: var(--rule-hair) solid var(--color-rule);
}

.doc__nav {
  display: grid;
  gap: var(--space-md);
}
@media (min-width: 48rem) {
  .doc__nav { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: var(--space-xl); }
}

.doc__nav a {
  display: grid;
  gap: var(--space-3xs);
  text-decoration: none;
}
.doc__nav .row__title { font-size: var(--text-base); }
@media (hover: hover) and (pointer: fine) {
  .doc__nav a:hover .row__title { text-decoration: underline; text-decoration-color: var(--color-accent); }
}

/* --------------------------------------------------- Ft5 · statement footer */

.foot-stmt {
  display: grid;
  gap: var(--space-xl);
  padding-block: var(--space-3xl) var(--space-xl);
  padding-block-end: max(var(--space-xl), env(safe-area-inset-bottom));
  margin-block-start: var(--space-2xl);
  border-block-start: var(--rule-hair) solid var(--color-rule);
}

.foot-stmt__line {
  max-width: 24ch;
  font-family: var(--font-display);
  font-size: clamp(1.75rem, 4.5vw, 3rem);
  font-weight: 600;
  line-height: 1.05;
  letter-spacing: -0.035em;
  color: var(--color-ink);
  overflow-wrap: anywhere;
}

.foot-stmt__meta {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-sm) var(--space-lg);
  align-items: baseline;
  justify-content: space-between;
  padding-block-start: var(--space-md);
  border-block-start: var(--rule-hair) solid var(--color-rule-soft);
}

.foot-stmt__links {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-lg);
  margin: 0;
  padding: 0;
  list-style: none;
}

.foot-stmt__links a {
  font-size: var(--text-sm);
  color: var(--color-neutral);
  text-decoration: none;
  white-space: nowrap;
  text-underline-offset: 0.22em;
}
@media (hover: hover) and (pointer: fine) {
  .foot-stmt__links a:hover { color: var(--color-accent); text-decoration: underline; }
}

/* -------------------------------------------------------------- 404 page */

.notfound {
  display: grid;
  align-content: center;
  gap: var(--space-lg);
  min-height: 70svh;
  padding-block: var(--space-4xl);
}
.notfound h1 { font-size: var(--text-display-s); max-width: 16ch; }

/* ------------------------------------------------- motion · one entrance */

.reveal {
  opacity: 0;
  transform: translateY(10px);
  animation: reveal var(--dur-long) var(--ease-out) forwards;
  animation-delay: calc(var(--i, 0) * 70ms);
}

@keyframes reveal {
  to { opacity: 1; transform: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 150ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 150ms !important;
  }
  .reveal {
    transform: none;
    animation: reveal-reduced 150ms linear forwards;
  }
  @keyframes reveal-reduced { to { opacity: 1; } }
}
