/* ---------------------------------------------------------------
   Design tokens.
   Every colour is defined here, in the light palette, so that no
   token exists only inside a media query. The dark block below
   redefines values only — never introduces new names.
   --------------------------------------------------------------- */

:root {
  --bg:            #fbfbfa;
  --bg-raised:     #ffffff;
  --text:          #16181d;
  --text-muted:    #565d6b;
  --accent:        #0b6e63;
  --accent-strong: #084f47;
  --border:        #e2e2dd;
  --shadow:        0 1px 2px rgb(16 24 32 / 4%), 0 8px 24px rgb(16 24 32 / 5%);

  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto,
               "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas,
               "Liberation Mono", monospace;

  --measure: 68ch;
  --gutter: clamp(1.25rem, 5vw, 3rem);
  --rhythm: clamp(3rem, 8vw, 5.5rem);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg:            #0e1013;
    --bg-raised:     #15181d;
    --text:          #e7e9ed;
    --text-muted:    #9aa2ae;
    --accent:        #5ecfc0;
    --accent-strong: #8ee0d4;
    --border:        #242830;
    --shadow:        none;
  }
}

/* --------------------------------------------------------------- */

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

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

body {
  margin: 0;
  padding: 0 var(--gutter);
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: clamp(1rem, 0.96rem + 0.2vw, 1.0625rem);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

main, .footer {
  max-width: 62rem;
  margin-inline: auto;
}

p { margin: 0 0 1.15em; }
p:last-child { margin-bottom: 0; }

a {
  color: var(--accent);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.2em;
}
a:hover { color: var(--accent-strong); }

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

.mono {
  font-family: var(--font-mono);
  font-size: 0.92em;
}

/* --- Hero ------------------------------------------------------ */

.hero {
  padding: clamp(4rem, 14vh, 8rem) 0 var(--rhythm);
}

.eyebrow {
  margin: 0 0 1.1rem;
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-muted);
}

h1 {
  margin: 0;
  /* Lower bound is set by "Spatio-Temporal" as a single unbreakable token:
     it must still fit a 320px viewport. break-word is the last-resort guard
     for anything narrower. */
  font-size: clamp(2.25rem, 1.4rem + 4.4vw, 4.75rem);
  line-height: 1.04;
  letter-spacing: -0.032em;
  font-weight: 600;
  text-wrap: balance;
  overflow-wrap: break-word;
}

.lede {
  margin: 2rem 0 0;
  max-width: var(--measure);
  font-size: clamp(1.0625rem, 1rem + 0.35vw, 1.25rem);
  color: var(--text-muted);
  text-wrap: pretty;
}

/* Accent rule sitting under the hero. */
.hero::after {
  content: "";
  display: block;
  width: 3.5rem;
  height: 2px;
  margin-top: 2.75rem;
  background: var(--accent);
}

/* --- Sections -------------------------------------------------- */

.section {
  padding-bottom: var(--rhythm);
}

.section > h2 {
  margin: 0 0 1.75rem;
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-muted);
}

h3 {
  margin: 0 0 0.6rem;
  font-size: 1.0625rem;
  font-weight: 600;
  letter-spacing: -0.008em;
}

.prose {
  max-width: var(--measure);
  font-size: clamp(1rem, 0.97rem + 0.22vw, 1.125rem);
}

/* --- Cards ----------------------------------------------------- */

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 17rem), 1fr));
  gap: 1rem;
}

/* Four focus cards read best as a balanced 2x2 rather than 3-plus-orphan.
   Explicit breakpoint instead of auto-fit, so the pairing is predictable. */
.grid--pairs { grid-template-columns: 1fr; }

@media (min-width: 46rem) {
  .grid--pairs { grid-template-columns: 1fr 1fr; }

  /* Five cards would otherwise leave a ragged orphan. The four domains sit as a
     2x2; the cross-cutting engineering card spans beneath them, so the layout
     states the structure rather than just filling the row. */
  .grid--pairs .card--span { grid-column: 1 / -1; }
}

.section-lede {
  max-width: var(--measure);
  margin: -0.5rem 0 1.75rem;
  color: var(--text-muted);
}

.card {
  padding: 1.5rem;
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: var(--shadow);
}

.card p {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.9375rem;
}

.card-project {
  transition: border-color 140ms ease, transform 140ms ease;
}
.card-project:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
}
.card-project h3 a { text-decoration: none; }
.card-project h3 a:hover { text-decoration: underline; }

/* --- Stack ----------------------------------------------------- */

.stack-groups {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 15rem), 1fr));
  gap: 2rem 2.5rem;
}

.stack-group h3 {
  margin-bottom: 0.9rem;
  font-size: 0.9375rem;
  color: var(--text-muted);
  font-weight: 500;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.chips li {
  padding: 0.3rem 0.65rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg-raised);
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  line-height: 1.45;
  color: var(--text);
  white-space: nowrap;
}

/* --- Footer ---------------------------------------------------- */

.footer {
  padding: 2.25rem 0 3.5rem;
  border-top: 1px solid var(--border);
  display: flex;
  flex-wrap: wrap;
  gap: 1rem 2rem;
  align-items: baseline;
  justify-content: space-between;
}

.links {
  display: flex;
  flex-wrap: wrap;
  gap: 1.5rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.links a {
  font-size: 0.9375rem;
  text-decoration: none;
  border-bottom: 1px solid transparent;
  padding-bottom: 1px;
}
.links a:hover { border-bottom-color: currentColor; }

.colophon {
  margin: 0;
  font-size: 0.8125rem;
  color: var(--text-muted);
}

/* --------------------------------------------------------------- */

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

@media print {
  body { background: #fff; color: #000; }
  .card, .chips li { box-shadow: none; }
}
