/* ============================================================
   zeinzulaziz.github.io — style.css
   Night observatory: one deep ground, one warm light source,
   one copper accent, display type at viewport scale, mono labels
   doing the bookkeeping. Dark default, light toggle. No frameworks.
   See DESIGN.md for the direction behind every choice.
   ============================================================ */

/* Self-hosted fonts (latin subset, SIL OFL):
   Space Grotesk — variable 300–700, the display voice.
   IBM Plex Sans — variable 100–700, body and long-form prose.
   IBM Plex Mono — static 400/500, labels and numbers. */
@font-face {
  font-family: "Space Grotesk";
  font-style: normal;
  font-weight: 300 700;
  font-display: swap;
  src: url("../fonts/space-grotesk.woff2") format("woff2");
}

@font-face {
  font-family: "IBM Plex Sans";
  font-style: normal;
  font-weight: 100 700;
  font-display: swap;
  src: url("../fonts/ibm-plex-sans.woff2") format("woff2");
}

@font-face {
  font-family: "IBM Plex Mono";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("../fonts/ibm-plex-mono-400.woff2") format("woff2");
}

@font-face {
  font-family: "IBM Plex Mono";
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url("../fonts/ibm-plex-mono-500.woff2") format("woff2");
}

/* A registered number the scroll-spy animations can drive — see the spy block.
   It lets the label colour follow the chapter without taking the colour
   property hostage, which would kill :hover and .is-active. */
@property --lit {
  syntax: "<number>";
  inherits: false;
  initial-value: 0;
}

/* ---------- tokens: night (default) ---------- */
:root {
  --paper: #080d16;
  --surface: #0d131f;
  --surface-2: #141c2a;
  --ink: #ede6d9;
  --ink-soft: #b9b9af;
  --ink-faint: #8f978f;
  --line: rgba(209, 194, 170, 0.18);
  --line-strong: #8f978f;
  --accent: #d8a579;
  --accent-ink: #080d16;
  color-scheme: dark;
  /* Ambient smoke embers derive from --accent at the use site, so both
     themes adapt for free. */

  --radius: 2px;

  --font-display: "Space Grotesk", "IBM Plex Sans", system-ui, sans-serif;
  --font-sans: "IBM Plex Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  --ease: cubic-bezier(0.16, 1, 0.3, 1);
  --header-h: 64px;

  /* Display scale: the loudest thing in the system. */
  --display: clamp(2.6rem, 8.6vw, 7rem);
}

/* ---------- tokens: day ---------- */
[data-theme="light"] {
  --paper: #ede6d9;
  --surface: #f6f1e6;
  --surface-2: #e2dac9;
  --ink: #0d131f;
  --ink-soft: #3b4450;
  --ink-faint: #4f5964;
  --line: rgba(13, 19, 31, 0.16);
  --line-strong: #4f5964;
  /* Deeper than the dark theme's copper: on paper, small accent labels need
     the margin, and the same value reads as the same hue. */
  --accent: #6f4218;
  --accent-ink: #ede6d9;
  color-scheme: light;
}

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

html {
  background: var(--paper);
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-h) + 1.5rem);
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font-sans);
  font-size: 1rem;
  background: var(--paper);
  color: var(--ink);
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
  transition: background-color 0.4s var(--ease), color 0.4s var(--ease);
}

/* Vignette + grain, one layer: the tooth (1px dots of the current ink) drawn
   on top of the radial that settles the edges into the ground. Merged so the
   other pseudo can carry the second smoke layer. */
body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  background:
    radial-gradient(color-mix(in srgb, var(--ink) 4%, transparent) 0.5px, transparent 0.5px),
    radial-gradient(
      118% 86% at 50% 42%,
      transparent 34%,
      color-mix(in srgb, var(--paper) 82%, transparent) 100%
    );
  background-size: 3px 3px, 100% 100%;
}

/* Ambient smoke, layer A (upper half, drifts down-right) and layer B on
   body::before (lower half, drifts up-left). Two layers at different speeds
   and directions are what make the mist read as smoke rather than a sliding
   gradient. Every blob fades to transparent, so there is no blur pass; both
   layers are transform-only and stop under reduced motion. */
html::before {
  content: "";
  position: fixed;
  inset: -25%;
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(40% 30% at 66% 18%, color-mix(in srgb, var(--ink) 12%, transparent), transparent 68%),
    radial-gradient(48% 36% at 88% 34%, color-mix(in srgb, var(--accent) 15%, transparent), transparent 70%),
    radial-gradient(30% 26% at 40% 30%, color-mix(in srgb, var(--ink) 9%, transparent), transparent 70%);
  animation: smoke-a 22s ease-in-out infinite alternate;
  will-change: transform;
}

body::before {
  content: "";
  position: fixed;
  inset: -25%;
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(46% 36% at 18% 74%, color-mix(in srgb, var(--ink) 12%, transparent), transparent 68%),
    radial-gradient(50% 42% at 72% 82%, color-mix(in srgb, var(--accent) 22%, transparent), transparent 70%),
    radial-gradient(32% 28% at 46% 66%, color-mix(in srgb, var(--accent) 13%, transparent), transparent 72%);
  animation: smoke-b 32s ease-in-out infinite alternate;
  will-change: transform;
}

@keyframes smoke-a {
  from { transform: translate3d(-7.5%, -5.5%, 0) scale(1); }
  to { transform: translate3d(8%, 5.5%, 0) scale(1.12); }
}

@keyframes smoke-b {
  from { transform: translate3d(8%, 6%, 0) scale(1.09); }
  to { transform: translate3d(-9%, -7%, 0) scale(1); }
}

/* Loading veil: a pure-CSS intro, no JS to know when load finishes, so it
   plays one short timed sequence and leaves. Copper dot with a halo, a 180px
   copper line sweeping across a hairline track, then the veil clears. The
   whole overlay is pointer-events: none, and ends visibility: hidden, so it
   can never trap a click or a screen reader. */
html::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 1000;
  pointer-events: none;
  background-color: var(--paper);
  background-image:
    radial-gradient(circle, var(--accent) 0 4px, transparent 5px),
    radial-gradient(circle, color-mix(in srgb, var(--accent) 38%, transparent) 0 12px, transparent 13px),
    linear-gradient(90deg, var(--accent), var(--accent)),
    linear-gradient(90deg, var(--line), var(--line));
  background-position:
    50% 44%, 50% 44%, 50% 57%, 50% 57%;
  background-repeat: no-repeat;
  background-size:
    13px 13px, 42px 42px, 0 2px, 180px 2px;
  animation: loader-done 1.05s var(--ease) forwards;
}

@keyframes loader-done {
  0% {
    background-size: 13px 13px, 42px 42px, 0 2px, 180px 2px;
    opacity: 1;
    visibility: visible;
  }
  40% {
    background-size: 13px 13px, 42px 42px, 180px 2px, 180px 2px;
    opacity: 1;
    visibility: visible;
  }
  60% { opacity: 1; }
  100% {
    background-size: 13px 13px, 42px 42px, 180px 2px, 180px 2px;
    opacity: 0;
    visibility: hidden;
  }
}

h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 600;
  line-height: 1.05;
  letter-spacing: -0.02em;
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

a {
  color: inherit;
}

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

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

/* Content sits above the grain and the vignette. */
.site-header,
main,
.site-footer {
  position: relative;
  z-index: 3;
}

.container {
  width: 100%;
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 clamp(1.15rem, 5vw, 3rem);
}

.skip-link {
  position: absolute;
  left: 1rem;
  top: -4rem;
  z-index: 100;
  background: var(--accent);
  color: var(--accent-ink);
  padding: 0.7rem 1rem;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  text-decoration: none;
  transition: top 0.2s var(--ease);
}

.skip-link:focus {
  top: 0.75rem;
}

/* ---------- header ---------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: color-mix(in srgb, var(--paper) 88%, transparent);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}

/* The bar thickens its own paper as the page moves. The scroll timeline owns
   this, so there is no class to toggle and nothing to re-sync when async
   content makes the page taller. */
@supports (animation-timeline: scroll()) {
  .site-header {
    animation: header-set linear both;
    animation-duration: 1ms;
    animation-timeline: scroll(root block);
    animation-range: 0 96px;
  }
}

@keyframes header-set {
  from { background-color: color-mix(in srgb, var(--paper) 88%, transparent); }
  to { background-color: color-mix(in srgb, var(--paper) 95%, transparent); }
}

.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-height: var(--header-h);
}

.nav-brand {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  min-height: 44px;
  font-family: var(--font-display);
  font-size: 0.98rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  text-transform: uppercase;
  text-decoration: none;
  color: var(--ink);
  white-space: nowrap;
}

.nav-brand .mark {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 12px color-mix(in srgb, var(--accent) 70%, transparent);
  flex: none;
}

.nav-brand:hover {
  color: var(--ink-soft);
}

.nav-right {
  display: flex;
  align-items: center;
  gap: 1.1rem;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 1.4rem;
}

.nav-links a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  color: var(--ink-soft);
  text-decoration: none;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  transition: color 0.18s;
}

.nav-links a:hover {
  color: var(--ink);
}

.nav-links a.is-active {
  color: var(--accent);
}

.nav-toggle {
  display: none;
  align-items: center;
  gap: 0.5rem;
  min-height: 44px;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink);
  background: none;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  padding: 0.45rem 0.75rem;
  cursor: pointer;
}

.control {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  min-height: 44px;
  min-width: 44px;
  padding: 0 0.6rem;
  color: var(--ink-soft);
  background: none;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
  transition: color 0.18s, border-color 0.18s, background-color 0.18s;
}

.control:hover {
  color: var(--ink);
  border-color: var(--ink);
}

.control svg,
.nav-toggle svg {
  width: 16px;
  height: 16px;
  display: block;
}

.theme-toggle .icon-sun { display: none; }
.theme-toggle .icon-moon { display: block; }
[data-theme="light"] .theme-toggle .icon-sun { display: block; }
[data-theme="light"] .theme-toggle .icon-moon { display: none; }

/* Scroll progress: the one place copper moves. */
.progress {
  position: absolute;
  left: 0;
  right: 0;
  bottom: -1px;
  height: 1px;
  background: var(--line);
  overflow: hidden;
}

.progress span {
  display: block;
  height: 100%;
  width: 100%;
  background: var(--accent);
  box-shadow: 0 0 10px color-mix(in srgb, var(--accent) 80%, transparent);
  transform: scaleX(0);
  transform-origin: 0 50%;
}

/* Reading progress, straight from the document's own scroll position. The bar
   is a scale, not a width, so the paint never reflows the header. */
@supports (animation-timeline: scroll()) {
  .progress span {
    animation: progress-grow linear both;
    animation-duration: 1ms;
    animation-timeline: scroll(root block);
  }
}

@keyframes progress-grow {
  from { transform: scaleX(0); }
  to { transform: scaleX(1); }
}

/* ---------- buttons and links ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  min-height: 48px;
  padding: 0.85rem 1.6rem;
  border-radius: var(--radius);
  font-family: var(--font-mono);
  font-size: 0.78rem;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  text-decoration: none;
  border: 1px solid transparent;
  cursor: pointer;
  transition: transform 0.2s var(--ease), background-color 0.18s, color 0.18s, border-color 0.18s;
}

.btn-primary {
  background: var(--accent);
  color: var(--accent-ink);
}

.btn-primary:hover {
  transform: translateY(-2px);
}

.btn-primary:active {
  transform: translateY(0);
}

.btn-ghost {
  border-color: var(--line-strong);
  color: var(--ink);
}

.btn-ghost:hover {
  border-color: var(--ink);
  transform: translateY(-2px);
}

.text-link {
  display: inline-flex;
  align-items: center;
  min-height: 48px;
  color: var(--ink);
  font-family: var(--font-mono);
  font-size: 0.78rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  text-decoration: none;
  border-bottom: 1px solid var(--line-strong);
  transition: color 0.18s, border-color 0.18s;
}

.text-link:hover {
  color: var(--accent);
  border-color: var(--accent);
}

/* ---------- mono label voice ---------- */

.eyebrow {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.7rem;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-faint);
  margin-bottom: 1.4rem;
}

.eyebrow .index {
  color: var(--accent);
}

/* The narrowest phones put the eclipse right where this line ends. The rule is
   decoration — forty pixels of it are the difference between a clear corner and
   a label under the limb — so it goes rather than the line wrapping. */
@media (max-width: 400px) {
  .eyebrow .bar {
    display: none;
  }
}

.eyebrow .bar {
  flex: none;
  width: 2.5rem;
  height: 1px;
  background: var(--line-strong);
}

.display {
  font-size: var(--display);
  font-weight: 600;
  line-height: 0.9;
  letter-spacing: -0.035em;
  text-transform: uppercase;
  text-wrap: balance;
}

.lede {
  color: var(--ink-soft);
  font-size: clamp(1rem, 1.9vw, 1.12rem);
  line-height: 1.65;
  max-width: 40rem;
}

/* ---------- chapters (home) ---------- */

.chapter {
  position: relative;
  padding: clamp(4rem, 11vw, 8rem) 0;
  scroll-margin-top: var(--header-h);
}

/* The two chapters whose copy fits a screen fill one viewport. The section is
   exactly as tall as its pin, so there is no sticky hold: the page moves on the
   first scroll instead of freezing until a pin releases. */
.chapter-full {
  padding: 0;
  scroll-margin-top: 0;
}

.chapter-full .pin {
  /* The header is sticky and in flow above this, so the pin fills what is left
     of the first screen, not the whole of it. The extra pixel is the header's
     bottom rule, which is outside its --header-h box. */
  min-height: calc(100svh - var(--header-h) - 1px);
  display: grid;
  align-content: center;
  /* Viewport-relative, so a short window does not push the hero past the fold. */
  padding: clamp(1.6rem, 3.4vh, 3.6rem) 0;
}

.chapter-head {
  margin-bottom: clamp(1.8rem, 4vw, 3rem);
}

/* services sit inside the work chapter so the page keeps its four-act structure */
.services {
  margin-top: clamp(2rem, 5vw, 3.5rem);
  border-top: 1px solid var(--line);
  padding-top: 1.6rem;
}

.service-list { display: grid; }

.service-row {
  display: grid;
  gap: 0.35rem;
  padding: 1rem 0;
  border-top: 1px solid var(--line);
}

.service-row:first-child { border-top: 0; padding-top: 0.2rem; }

.service-row h4 {
  font-size: 1rem;
  font-weight: 600;
  line-height: 1.2;
  color: var(--ink);
  letter-spacing: -0.01em;
}

.service-row p {
  color: var(--ink-soft);
  font-size: 0.94rem;
  line-height: 1.55;
  max-width: 34rem;
}

.service-cta { min-height: 40px; }

/* Facts panel: real data, ruled like an instrument readout. */
.spec {
  border-top: 1px solid var(--line);
  margin-top: clamp(1.7rem, 3.6vw, 2.6rem);
}

.spec-item {
  display: grid;
  grid-template-columns: 6rem minmax(0, 1fr);
  gap: 1rem;
  align-items: baseline;
  padding: 0.8rem 0;
  border-bottom: 1px solid var(--line);
}

.spec-item dt {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-faint);
}

.spec-item dd {
  color: var(--ink-soft);
  font-size: 0.93rem;
  line-height: 1.55;
}

.spec-item dd a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  margin: -10px 0.5rem -10px 0;
  color: var(--ink);
  text-decoration: none;
  border-bottom: 1px solid var(--line-strong);
}

.spec-item dd a:last-child { margin-right: 0; }

.spec-item dd a:hover {
  color: var(--accent);
  border-color: var(--accent);
}

/* Two facts per row once there is room: the readout stays compact, and the
   headline keeps the vertical space it needs. */
@media (min-width: 860px) {
  .spec {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    column-gap: 2.5rem;
  }
}

/* ---------- projects ---------- */

.project-row {
  display: flex;
  gap: 1.4rem;
  padding: 1.3rem 0;
  min-width: 0;
}

.project-row + .project-row {
  border-top: 1px solid var(--line);
}


.project-media {
  position: relative;
  flex: none;
  width: 104px;
  overflow: hidden;
}


.project-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  aspect-ratio: 16 / 10;
  filter: saturate(0.85);
  transition: filter 0.3s var(--ease);
}

.project-row:hover .project-media img {
  filter: saturate(1);
}




.project-main {
  flex: 1;
  min-width: 0;
}


.project-title {
  font-size: clamp(1.15rem, 2.2vw, 1.4rem);
  font-weight: 600;
  line-height: 1.2;
  margin-bottom: 0.5rem;
}


.project-title a {
  color: var(--ink);
  text-decoration: none;
  /* Hit area reaches 44px without moving the heading: the box grows by the
     padding and gives it back with the negative margin. */
  display: inline-block;
  padding-block: 0.55rem;
  margin-block: -0.55rem;
}

.project-title a:hover {
  color: var(--accent);
}

.project-desc {
  color: var(--ink-soft);
  font-size: 0.93rem;
  max-width: 42rem;
}


.project-side {
  flex: none;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.6rem;
  text-align: right;
}


.project-meta {
  display: flex;
  align-items: center;
  gap: 1rem;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-faint);
}

.project-lang { color: var(--ink-soft); }

.project-links {
  display: flex;
  gap: 1.1rem;
}

.project-links a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  margin: -11px 0;
  color: var(--ink);
  text-decoration: none;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  border-bottom: 1px solid var(--line-strong);
  transition: color 0.18s, border-color 0.18s;
}

.project-links a:hover {
  color: var(--accent);
  border-color: var(--accent);
}

@media (max-width: 640px) {
  .project-row { flex-wrap: wrap; }

  .project-side {
    flex-basis: 100%;
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
    text-align: left;
    padding-top: 0.8rem;
    border-top: 1px solid var(--line);
  }
}

/* ---------- about ---------- */

.about-top {
  display: grid;
  gap: 2rem;
}

@media (min-width: 920px) {
  .about-top {
    grid-template-columns: minmax(0, 1fr) 15rem;
    gap: 3.5rem;
    align-items: start;
  }
}

.about-copy p {
  color: var(--ink-soft);
  font-size: 1.04rem;
  max-width: 42rem;
}

.about-copy p + p { margin-top: 1.1rem; }

.about-photo {
  width: 100%;
  max-width: 15rem;
  aspect-ratio: 1;
  object-fit: cover;
  border: 1px solid var(--line-strong);
  filter: saturate(0.9);
}

@media (min-width: 920px) {
  .about-photo { max-width: none; }
}

.stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-top: 2.4rem;
  border-top: 1px solid var(--line);
  padding-top: 1.4rem;
}

.stat + .stat {
  border-left: 1px solid var(--line);
  padding-left: 1.25rem;
}

.stat-num {
  display: block;
  font-family: var(--font-display);
  font-size: clamp(1.8rem, 4vw, 2.3rem);
  font-weight: 600;
  color: var(--ink);
  line-height: 1.05;
}

.stat-label {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-faint);
  margin-top: 0.4rem;
}

.about-records {
  margin-top: 2.6rem;
  display: grid;
  gap: 2.6rem;
}

@media (min-width: 920px) {
  .about-records {
    grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr);
    gap: 3.5rem;
    align-items: start;
  }
}

.mini-title {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-faint);
  margin-bottom: 0.9rem;
}

.xp { display: grid; }

.xp-item {
  display: grid;
  gap: 0.25rem;
  padding: 1rem 0;
  border-top: 1px solid var(--line);
}

@media (min-width: 560px) {
  .xp-item {
    grid-template-columns: 9rem minmax(0, 1fr);
    gap: 1.25rem;
  }
}

.xp-when {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-faint);
  padding-top: 0.25rem;
  line-height: 1.5;
}

.xp-role {
  font-weight: 600;
  color: var(--ink);
}

.xp-org {
  color: var(--ink-soft);
  font-size: 0.92rem;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.chip {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.04em;
  color: var(--ink-soft);
  border: 1px solid var(--line-strong);
  padding: 0.35rem 0.7rem;
  border-radius: var(--radius);
}

/* ---------- contact ---------- */

.contact-title {
  font-size: var(--display);
  font-weight: 600;
  line-height: 0.9;
  letter-spacing: -0.035em;
  text-transform: uppercase;
  margin-bottom: 1.4rem;
}

.action-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 1.6rem;
  margin-top: 2.2rem;
}

.process {
  display: grid;
  list-style: none;
  max-width: 44rem;
  margin-top: 1.8rem;
  border-top: 1px solid var(--line);
}

.process li {
  display: grid;
  grid-template-columns: 2.5rem 5.5rem minmax(0, 1fr);
  gap: 1rem;
  align-items: start;
  padding: 0.8rem 0;
  border-bottom: 1px solid var(--line);
}

@media (max-width: 620px) {
  .process li { grid-template-columns: 2.5rem minmax(0, 1fr); }
  .process-copy { grid-column: 2; }
}

.process-num {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  line-height: 1.5;
  color: var(--ink-faint);
}

.process-title {
  font-weight: 600;
  color: var(--ink);
  line-height: 1.4;
}

.process-copy {
  color: var(--ink-soft);
  font-size: 0.92rem;
  line-height: 1.55;
}

/* ---------- scroll-spy (CSS only) ---------- */
/* Each chapter carries a named view timeline (declared with the reveal block).
   timeline-scope lifts those names to the document so the nav and the scroll
   cue, which sit outside the chapters, can read them. A chapter is current
   across the stretch where its centre is the nearest one to the middle of the
   viewport.

   That stretch needs no per-chapter tuning, because it is a fixed distance in
   pixels, not a share of the chapter: a chapter becomes current half a viewport
   after its box starts entering, and stops being current half a viewport before
   it finishes leaving. So the range below is written in viewport units, and a
   chapter of any height gets the right window. The shoulders are short: they
   only take the edge off the switch, which is why the fade is a couple of
   percent wide rather than a long ramp. */
@supports (animation-timeline: view()) and (timeline-scope: --chapter-opening) {
  html {
    timeline-scope: --chapter-opening, --chapter-projects, --chapter-about,
      --chapter-contact;
  }

  body.home .nav-links a[href^="#"] {
    animation: spy-lit linear 1ms both;
    animation-range: cover 48dvh cover calc(100% - 48dvh);
    color: color-mix(in srgb, var(--accent) calc(var(--lit) * 100%), var(--ink-soft));
  }

  /* Hover has to be re-stated: the mix above outranks the base hover rule. */
  body.home .nav-links a:hover {
    color: var(--ink);
  }

  /* One chapter per link, read by name. Every selector here has to outrank the
     `animation` shorthand above: that shorthand resets animation-timeline to
     auto, and specificity decides which wins. */
  body.home .nav-links a[href$="#opening"] { animation-timeline: --chapter-opening; }
  body.home .nav-links a[href$="#projects"] { animation-timeline: --chapter-projects; }
  body.home .nav-links a[href$="#about"] { animation-timeline: --chapter-about; }
  body.home .nav-links a[href$="#contact"] { animation-timeline: --chapter-contact; }

}

/* Positions are a share of the window, so the plateau runs between the
   shoulders and the fade takes the first and last couple of percent. */
@keyframes spy-lit {
  0% { --lit: 0; }
  3%, 97% { --lit: 1; }
  100% { --lit: 0; }
}

/* ---------- reading pages ---------- */

.page-head {
  padding: clamp(3.5rem, 10vw, 7rem) 0 clamp(2rem, 4vw, 3rem);
}

.page-title {
  font-size: var(--display);
  font-weight: 600;
  line-height: 0.9;
  letter-spacing: -0.035em;
  text-transform: uppercase;
}

.page-lede {
  color: var(--ink-soft);
  font-size: clamp(1rem, 1.9vw, 1.12rem);
  max-width: 42rem;
  margin-top: 1.4rem;
}

.page-count {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-faint);
  margin-top: 1.6rem;
}

.section {
  padding: clamp(2rem, 5vw, 3.5rem) 0 clamp(4rem, 9vw, 7rem);
}

.blog-list {
  display: grid;
  max-width: 48rem;
  min-height: 50vh;
}

.blog-empty {
  color: var(--ink-faint);
  padding: 2.5rem 0;
}

.post-card {
  padding: 1.8rem 0;
  border-top: 1px solid var(--line);
}

.post-card:first-child {
  border-top: 0;
  padding-top: 0;
}

.post-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.75rem;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-faint);
  margin-bottom: 0.7rem;
}

.post-meta span + span::before {
  content: "/";
  margin-right: 0.75rem;
  color: var(--line-strong);
}

.post-card-title {
  font-size: clamp(1.3rem, 3vw, 1.7rem);
  font-weight: 600;
  margin-bottom: 0.5rem;
}

.post-card-title a {
  color: var(--ink);
  text-decoration: none;
  transition: color 0.18s;
  /* 44px hit area on a heading link, text centred, layout unchanged. */
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  margin-block: -11px;
}

.post-card-title a:hover {
  color: var(--accent);
}

.post-card-desc {
  color: var(--ink-soft);
  font-size: 0.96rem;
  max-width: 40rem;
}

.post-card.is-note .post-card-title::before {
  content: "Note";
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
  border: 1px solid var(--accent);
  padding: 0.1rem 0.4rem;
  margin-right: 0.6rem;
  vertical-align: middle;
}

.post-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-top: 0.9rem;
}

.post-tags span {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.06em;
  color: var(--ink-faint);
  border: 1px solid var(--line);
  padding: 0.15rem 0.5rem;
  border-radius: var(--radius);
}

/* ---------- single post ---------- */

.post-page {
  padding: clamp(2.5rem, 6vw, 4rem) 0 clamp(4rem, 9vw, 6rem);
  min-height: 100vh;
}

.post-container {
  max-width: 58rem;
}

.post-back {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  color: var(--ink-faint);
  text-decoration: none;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  margin-bottom: 1.4rem;
  transition: color 0.18s;
}

.post-back:hover { color: var(--accent); }

.post-title {
  font-size: clamp(1.9rem, 6vw, 3.4rem);
  font-weight: 600;
  line-height: 0.98;
  letter-spacing: -0.03em;
  margin-bottom: 1.2rem;
}

/* ---------- project detail ---------- */

.project-page .page-lede {
  margin-bottom: 1.8rem;
}

.project-shot {
  margin: 2.4rem 0 0;
  border: 1px solid var(--line);
  background: var(--surface);
}

.project-shot img {
  display: block;
  width: 100%;
  height: auto;
}

.project-page .prose {
  margin-top: 2.6rem;
}

/* ---------- prose ---------- */

.prose {
  margin-top: 2.25rem;
  font-size: 1.07rem;
  color: var(--ink-soft);
}

.prose > * + * {
  margin-top: 1.3rem;
}

.prose h2,
.prose h3,
.prose h4 {
  color: var(--ink);
  margin-top: 2.8rem;
  scroll-margin-top: calc(var(--header-h) + 1.5rem);
  text-transform: none;
  letter-spacing: -0.015em;
}

.prose h2 { font-size: 1.75rem; }
.prose h3 { font-size: 1.34rem; }
.prose h4 { font-size: 1.1rem; }

.md-anchor {
  color: var(--ink-faint);
  text-decoration: none;
  opacity: 0;
  margin-left: -1.1em;
  padding-right: 0.35em;
  font-weight: 400;
}

.prose h2:hover .md-anchor,
.prose h3:hover .md-anchor,
.prose h4:hover .md-anchor,
.prose h2:focus-within .md-anchor,
.prose h3:focus-within .md-anchor,
.prose h4:focus-within .md-anchor {
  opacity: 1;
}

.prose a {
  color: var(--ink);
  text-decoration: underline;
  text-decoration-color: var(--line-strong);
  text-underline-offset: 0.18em;
  padding-block: 3px;
}

.prose a:hover { color: var(--accent); }

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

.prose ul,
.prose ol { padding-left: 1.4rem; }

.prose li + li { margin-top: 0.45rem; }

.prose ul ul,
.prose ol ol,
.prose ul ol,
.prose ol ul { margin-top: 0.45rem; }

.prose ul { list-style: disc; }
.prose ol { list-style: decimal; }

.md-task {
  display: inline-block;
  width: 0.85em;
  height: 0.85em;
  margin-right: 0.5em;
  border: 1px solid var(--line-strong);
  vertical-align: -0.05em;
  position: relative;
  top: 0.05em;
}

.md-task.is-done {
  background: var(--accent);
  border-color: var(--accent);
}

.md-task.is-done::after {
  content: "";
  position: absolute;
  left: 0.28em;
  top: 0.08em;
  width: 0.22em;
  height: 0.45em;
  border: solid var(--accent-ink);
  border-width: 0 2px 2px 0;
  transform: rotate(42deg);
}

.prose blockquote {
  border-left: 2px solid var(--accent);
  padding: 0.2rem 0 0.2rem 1.1rem;
  color: var(--ink-soft);
  font-style: italic;
}

.prose blockquote > * + * { margin-top: 0.8rem; }

.prose code {
  font-family: var(--font-mono);
  font-size: 0.86em;
  background: var(--surface-2);
  border: 1px solid var(--line);
  padding: 0.1em 0.36em;
}

.prose pre {
  background: var(--surface);
  border: 1px solid var(--line);
  padding: 1rem 1.15rem;
  overflow-x: auto;
  position: relative;
}

.prose pre code {
  background: none;
  border: 0;
  padding: 0;
  font-size: 0.86rem;
  line-height: 1.65;
  color: var(--ink-soft);
}

.prose pre[data-lang]::before {
  content: attr(data-lang);
  position: absolute;
  top: 0;
  right: 0;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-faint);
  background: var(--surface-2);
  border-left: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  padding: 0.15rem 0.5rem;
}

.prose img {
  border: 1px solid var(--line);
}

.prose hr {
  border: 0;
  border-top: 1px solid var(--line);
  margin: 2.5rem 0;
}

.md-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
}

.prose table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92rem;
}

.prose th,
.prose td {
  text-align: left;
  padding: 0.6rem 0.9rem;
  border-bottom: 1px solid var(--line);
}

.prose th {
  background: var(--surface-2);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

.prose tr:last-child td { border-bottom: 0; }

/* ---------- footer ---------- */

.site-footer {
  border-top: 1px solid var(--line);
  padding: 2.6rem 0;
  background: color-mix(in srgb, var(--paper) 70%, transparent);
}

.footer-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  color: var(--ink-faint);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.footer-inner a {
  color: var(--ink-soft);
  text-decoration: none;
  border-bottom: 1px solid var(--line-strong);
  transition: color 0.18s, border-color 0.18s;
}

.footer-inner a:hover {
  color: var(--accent);
  border-color: var(--accent);
}

/* ---------- reveal ---------- */

/* Default: visible. Nothing is hidden unless a scroll timeline exists to bring
   it back, so the page reads even where scroll-driven animation is missing. */
.reveal {
  opacity: 1;
}

@supports (animation-timeline: view()) {
  @media (prefers-reduced-motion: no-preference) {
    .reveal {
      animation: reveal-scroll linear both;
      animation-duration: 1ms;
      animation-timeline: view();
      animation-range: entry 0% cover 32%;
    }

    /* Each chapter carries its own named timeline so the nav, which sits
       outside the chapters, can read it — see the scroll-spy block. inset 0
       keeps the timeline in step with the chapter box rather than the scroll
       padding. Reveals themselves use view() like everywhere else. */
    #opening  { view-timeline: --chapter-opening  block; }
    #projects { view-timeline: --chapter-projects block; }
    #about    { view-timeline: --chapter-about    block; }
    #contact  { view-timeline: --chapter-contact  block; }

    #opening, #projects, #about, #contact {
      view-timeline-inset: 0;
    }
  }
}

/* ---------- display type: masked word rise ---------- */

/* Each word sits in its own mask and rises out of it as the chapter arrives.
   The mask clips, the chapter carries the timeline (a view() on the inner
   element would resolve against the mask itself and go degenerate). --i
   staggers the words: later words start later, everything lands together. */
.rise {
  display: inline-block;
  overflow: hidden;
  vertical-align: bottom;
  padding: 0.08em 0.02em 0.14em 0;
  margin: -0.08em -0.02em -0.14em 0;
}

.rise-in {
  display: inline-block;
  transform: none;
}

@supports (animation-timeline: view()) {
  @media (prefers-reduced-motion: no-preference) {
    /* Each mask carries its own timeline, so the animation runs while the
       WORD itself crosses the fold — not while its chapter does. A view() on
       the inner element would resolve against the mask and go degenerate;
       the named timeline resolves against the mask's parent chain instead. */
    .rise {
      view-timeline: --rise block;
    }

    .rise-in {
      animation: rise linear both;
      animation-duration: 1ms;
      animation-timeline: --rise;
      /* The rise runs the whole visible band: from the fold to when the
         heading reaches the reading zone, one word behind another. */
      animation-range: cover calc(var(--i, 0) * 5%) cover 60%;
    }
  }
}

/* The opening heading is on screen at load, where a view() timeline is already
   spent. It enters on load like the rest of the hero. */
@media (prefers-reduced-motion: no-preference) {
  #opening .rise-in {
    animation: rise 0.85s var(--ease) both;
    animation-delay: calc(80ms + var(--i, 0) * 90ms);
  }
}

@keyframes rise {
  from { transform: translateY(1.25em); }
  60%, to { transform: none; }
}

/* The opening chapter is on screen at load, where a view() timeline is already
   spent. It enters on load instead, staggered by --d. A plain animation, so it
   does not depend on scroll timelines existing. */
@media (prefers-reduced-motion: no-preference) {
  #opening .reveal {
    animation: reveal-in 0.7s var(--ease) both;
    animation-delay: var(--d, 0ms);
  }
}

@keyframes reveal-in {
  from { opacity: 0; transform: translateY(18px); }
  to { opacity: 1; transform: none; }
}

/* Full opacity at 65% of the range: an element parked at the bottom of a page
   can run out of scroll while it is still fading in. */
@keyframes reveal-scroll {
  from { opacity: 0; transform: translateY(18px); }
  65%, to { opacity: 1; transform: none; }
}

/* ---------- mobile ---------- */

@media (max-width: 760px) {
  :root {
    --header-h: 58px;
  }

  .nav-toggle { display: inline-flex; }

  .nav-right { gap: 0.7rem; }

  .control-label { display: none; }

  .nav-links {
    position: absolute;
    left: 0;
    right: 0;
    top: var(--header-h);
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    background: var(--paper);
    border-bottom: 1px solid var(--line);
    padding: 0.5rem clamp(1.15rem, 5vw, 3rem) 1.2rem;
    display: none;
  }

  .site-header[data-menu="open"] .nav-links { display: flex; }

  .nav-links a {
    padding: 0.95rem 0;
    border-bottom: 1px solid var(--line);
    font-size: 0.82rem;
  }

  .nav-links a:last-child { border-bottom: 0; }

  .about-photo { max-width: 13rem; }

  .spec-item { grid-template-columns: 1fr; gap: 0.2rem; }

  .stats {
    grid-template-columns: 1fr;
    border-top: 0;
    padding-top: 0;
  }

  .stat {
    display: flex;
    align-items: baseline;
    gap: 0.8rem;
    padding: 0.75rem 0;
    border-top: 1px solid var(--line);
  }

  .stat + .stat { border-left: 0; padding-left: 0; }

  .stat-num { font-size: 1.5rem; }

  .footer-inner { flex-direction: column; align-items: flex-start; gap: 0.6rem; }
}

@media (max-width: 420px) {
  .btn { width: 100%; }
  .action-row { gap: 1rem; }
}

/* ---------- reduced motion ---------- */

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

  .reveal {
    animation: none;
    opacity: 1;
    transform: none;
  }

  .rise-in {
    animation: none;
    transform: none;
  }

  /* No pinning: the chapters read as ordinary sections. */
  .chapter-full {
    min-height: 0;
  }

  .chapter-full .pin {
    min-height: 0;
  }

  /* The smoke holds still; the veil clears immediately rather than
     sweeping. The blanket rule above also squashes durations — this makes the
     intent explicit. */
  html::before,
  body::before {
    animation: none;
  }

  html::after {
    animation: none;
    opacity: 0;
    visibility: hidden;
  }

  *,
  *::before,
  *::after {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
}


/* Work reads as a set of filled panels rather than ruled lines. */
body.home #projects .projects-list {
  display: grid;
  gap: 0.75rem;
}
body.home #projects .project-row {
  align-items: center;
  gap: 1.5rem;
  padding: 1.4rem 1.5rem;
  background: var(--surface-2);
  border-radius: 4px;
}
body.home #projects .project-row + .project-row {
  border-top: 0;
}
body.home #projects .project-title {
  font-size: clamp(1.35rem, 2.4vw, 1.9rem);
}
body.home #projects .project-desc {
  font-size: 1rem;
}
body.home #projects .project-media {
  width: 160px;
}
body.home #projects .project-media img {
  aspect-ratio: 16 / 10;
}
@media (max-width: 640px) {
  body.home #projects .project-media { width: 120px; }
}

/* The published numbers carry the one accent. */
body.home #about .stat-num {
  color: var(--accent);
}
