/* =========================================================================
   Arbaz Sayed — Portfolio
   Dark-first editorial. Space Grotesk + Instrument Serif + JetBrains Mono.
   Amber→orange gradient accent, carried over from the deck identity.
   ========================================================================= */

/* -------------------------------------------------------------------------
   1. Tokens — dark is the primary design; light is a full second theme
   ------------------------------------------------------------------------- */

:root {
  --color-background: #0a0a0c;
  --color-surface: #121216;
  --color-elevated: #17171d;
  --color-foreground: #f5f5f7;
  --color-secondary: #9c9ca6;
  --color-border: #26262e;
  --color-accent: #fbbf24;
  --color-accent-2: #f97316;
  --color-ring: #fbbf24;
  --color-on-accent: #0a0a0c;

  --grad: linear-gradient(120deg, #fde047 0%, #fbbf24 45%, #f97316 100%);
  --grad-soft: linear-gradient(
    160deg,
    color-mix(in srgb, var(--color-accent) 10%, transparent),
    transparent 60%
  );

  --font-display: "Space Grotesk", -apple-system, BlinkMacSystemFont, "Segoe UI",
    system-ui, sans-serif;
  --font-body: "Space Grotesk", -apple-system, BlinkMacSystemFont, "Segoe UI",
    system-ui, sans-serif;
  --font-serif: "Instrument Serif", Georgia, "Times New Roman", serif;
  --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;

  --text-display: clamp(2.75rem, 8.5vw, 6.5rem);
  --text-h2: clamp(2rem, 5vw, 3.5rem);
  --text-h3: clamp(1.5rem, 3vw, 2.25rem);
  --text-lead: clamp(1.0625rem, 1.6vw, 1.25rem);
  --text-body: 1.0625rem;
  --text-sm: 0.9375rem;
  --text-xs: 0.8125rem;
  --text-2xs: 0.6875rem;

  --space-3xs: 0.25rem;
  --space-2xs: 0.5rem;
  --space-xs: 0.75rem;
  --space-sm: 1rem;
  --space-md: 1.5rem;
  --space-lg: 2rem;
  --space-xl: 3rem;
  --space-2xl: 4rem;
  --space-3xl: 6rem;
  --space-4xl: 8rem;

  --container: 76rem;
  --measure: 62ch;
  --gutter: clamp(1.25rem, 5vw, 3.5rem);

  --duration-fast: 150ms;
  --duration-base: 250ms;
  --duration-slow: 420ms;
  --ease-out: cubic-bezier(0.22, 0.61, 0.36, 1);

  --radius-sm: 4px;
  --radius-md: 10px;
  --radius-lg: 18px;
  --radius-full: 999px;

  --z-sticky: 40;
  --z-overlay: 100;
  --z-grain: 200;
}

/* This page commits to a single dark identity. There is no light theme and
   no toggle, so every colour above is painted explicitly rather than
   inherited — the page holds regardless of the viewer's system setting. */

/* -------------------------------------------------------------------------
   2. Reset & base
   ------------------------------------------------------------------------- */

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

* {
  margin: 0;
}

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

body {
  position: relative;
  min-height: 100dvh;
  background-color: var(--color-background);
  color: var(--color-foreground);
  font-family: var(--font-body);
  font-size: var(--text-body);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: clip;
  transition: background-color var(--duration-base) var(--ease-out),
    color var(--duration-base) var(--ease-out);
}

/* Film grain — the single biggest thing separating this from a flat
   template. Pure CSS, no image request. */
body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: var(--z-grain);
  pointer-events: none;
  opacity: 0.055;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='200'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='200' height='200' filter='url(%23n)'/%3E%3C/svg%3E");
}

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

svg {
  fill: none;
  stroke: currentColor;
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

button {
  font: inherit;
  color: inherit;
}

h1,
h2,
h3,
h4 {
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.1;
  text-wrap: balance;
}

p {
  text-wrap: pretty;
}

a {
  color: inherit;
}

ul,
ol {
  list-style: none;
  padding: 0;
}

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

/* Gradient text. The solid colour is declared first so a browser without
   background-clip still renders readable, on-brand text. */
.grad {
  color: var(--color-accent);
}

@supports (background-clip: text) or (-webkit-background-clip: text) {
  .grad {
    background-image: var(--grad);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
  }
}

/* -------------------------------------------------------------------------
   3. Layout primitives
   ------------------------------------------------------------------------- */

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

.section {
  padding-block: clamp(var(--space-2xl), 9vw, var(--space-4xl));
}

.section__head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--space-md);
  margin-bottom: var(--space-2xl);
  padding-bottom: var(--space-md);
  border-bottom: 1px solid var(--color-border);
}

.section__title {
  font-size: var(--text-h2);
}

.subhead {
  font-size: 1.125rem;
  font-weight: 600;
  margin-bottom: var(--space-md);
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2xs);
  font-family: var(--font-mono);
  font-size: var(--text-2xs);
  font-weight: 500;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--color-secondary);
}

/* Live dot — MOTION: implemented (slow pulse) */
.dot {
  width: 7px;
  height: 7px;
  border-radius: var(--radius-full);
  background-color: var(--color-accent);
  animation: pulse 2.6s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%      { opacity: 0.45; transform: scale(0.82); }
}

.lead {
  max-width: var(--measure);
  margin-bottom: var(--space-2xl);
  font-size: var(--text-lead);
  color: var(--color-secondary);
}

/* Emphasis inside a lead: same face, carried by the gradient rather than a
   decorative italic serif. */
.lead em {
  font-style: normal;
  font-weight: 700;
  color: var(--color-accent);
}

@supports (background-clip: text) or (-webkit-background-clip: text) {
  .lead em {
    background-image: var(--grad);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
  }
}

/* Pullquotes read as one continuous sentence — the emphasis stays semantic
   for screen readers but takes no visual treatment at all. */
.pullquote em {
  font-style: normal;
  font-weight: inherit;
  color: inherit;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: absolute;
  top: var(--space-sm);
  left: var(--space-sm);
  z-index: var(--z-overlay);
  padding: var(--space-xs) var(--space-md);
  background-color: var(--color-foreground);
  color: var(--color-background);
  font-size: var(--text-sm);
  font-weight: 600;
  text-decoration: none;
  border-radius: var(--radius-md);
  transform: translateY(-200%);
  transition: transform var(--duration-fast) var(--ease-out);
}

.skip-link:focus-visible {
  transform: translateY(0);
}

/* -------------------------------------------------------------------------
   4. Header
   ------------------------------------------------------------------------- */

.header {
  position: sticky;
  top: 0;
  z-index: var(--z-sticky);
  background-color: color-mix(in srgb, var(--color-background) 82%, transparent);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid transparent;
  transition: border-color var(--duration-base) var(--ease-out);
}

.header[data-scrolled="true"] {
  border-bottom-color: var(--color-border);
}

.header__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-sm);
  min-height: 4.5rem;
}

.wordmark {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2xs);
  text-decoration: none;
  white-space: nowrap;
  padding-block: var(--space-2xs);
}

.wordmark__mark {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: var(--radius-md);
  background-image: var(--grad);
  color: var(--color-on-accent);
  font-family: var(--font-display);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.wordmark__full {
  font-family: var(--font-display);
  font-size: 0.9375rem;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.nav {
  display: flex;
  align-items: center;
  gap: clamp(var(--space-2xs), 2vw, var(--space-md));
}

.nav__link {
  position: relative;
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding-inline: var(--space-2xs);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--color-secondary);
  text-decoration: none;
  cursor: pointer;
  transition: color var(--duration-fast) var(--ease-out);
}

.nav__link::after {
  content: "";
  position: absolute;
  left: var(--space-2xs);
  right: var(--space-2xs);
  bottom: 1.05rem;
  height: 1px;
  background-image: var(--grad);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform var(--duration-base) var(--ease-out);
}

.nav__link:hover,
.nav__link[aria-current="true"] {
  color: var(--color-foreground);
}

.nav__link:hover::after,
.nav__link[aria-current="true"]::after {
  transform: scaleX(1);
}

@media (max-width: 34rem) {
  .wordmark__full {
    display: none;
  }

  .nav {
    gap: 2px;
  }

  .nav__link {
    padding-inline: 5px;
  }

  .nav__link::after {
    left: 5px;
    right: 5px;
  }
}

/* -------------------------------------------------------------------------
   5. Hero
   ------------------------------------------------------------------------- */

.hero {
  position: relative;
  overflow: hidden;
  padding-block: clamp(var(--space-2xl), 9vw, var(--space-4xl));
}

/* MOTION 1 — gradient glow, slow drift (implemented) */
.hero__glow {
  position: absolute;
  inset: -30% -20% auto -20%;
  height: 110%;
  pointer-events: none;
  background: radial-gradient(
    45% 50% at 28% 38%,
    color-mix(in srgb, var(--color-accent) 26%, transparent),
    transparent 70%
  );
  filter: blur(50px);
  animation: drift 20s ease-in-out infinite alternate;
}

@keyframes drift {
  from { transform: translate3d(0, 0, 0) scale(1); }
  to   { transform: translate3d(7%, -5%, 0) scale(1.14); }
}

.hero__inner {
  position: relative;
  display: grid;
  gap: var(--space-2xl);
  align-items: center;
}

@media (min-width: 60rem) {
  .hero__inner {
    grid-template-columns: 1.35fr 1fr;
    gap: var(--space-3xl);
  }
}

.hero__title {
  margin-top: var(--space-md);
  font-size: var(--text-display);
  letter-spacing: -0.045em;
  line-height: 0.98;
}

/* Accent word stays in the display face — the gradient carries it, so the
   headline reads as one piece of typography rather than two. */
.hero__title .grad {
  letter-spacing: -0.045em;
}

.hero__lead {
  max-width: 46ch;
  margin-top: var(--space-lg);
  font-size: var(--text-lead);
  color: var(--color-secondary);
}

.hero__meta {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-sm);
  margin-top: var(--space-xl);
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2xs);
  margin-top: var(--space-lg);
}

.chip {
  padding: var(--space-3xs) var(--space-xs);
  font-family: var(--font-mono);
  font-size: var(--text-2xs);
  letter-spacing: 0.04em;
  color: var(--color-secondary);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-full);
  transition: border-color var(--duration-fast) var(--ease-out),
    color var(--duration-fast) var(--ease-out);
}

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

/* -------------------------------------------------------------------------
   6. Image placeholders
   ------------------------------------------------------------------------- */

.ph {
  position: relative;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: var(--space-2xs);
  padding: var(--space-lg);
  text-align: center;
  border: 1px dashed var(--color-border);
  border-radius: var(--radius-lg);
  background-color: var(--color-surface);
  background-image: var(--grad-soft);
  transition: border-color var(--duration-base) var(--ease-out);
}

.ph:hover {
  border-color: color-mix(in srgb, var(--color-accent) 55%, transparent);
}

.ph--portrait { aspect-ratio: 4 / 5; }
.ph--wide     { aspect-ratio: 16 / 9; }
.ph--square   { aspect-ratio: 1 / 1; }

.ph__corner {
  position: absolute;
  top: var(--space-sm);
  left: var(--space-sm);
  font-family: var(--font-mono);
  font-size: var(--text-2xs);
  color: var(--color-accent);
}

.ph__icon {
  width: 26px;
  height: 26px;
  color: var(--color-secondary);
  opacity: 0.65;
}

.ph__label {
  font-family: var(--font-display);
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--color-foreground);
}

.ph__hint {
  font-family: var(--font-mono);
  font-size: var(--text-2xs);
  color: var(--color-secondary);
}

/* -------------------------------------------------------------------------
   7. Marquee — MOTION 3 (implemented)
   ------------------------------------------------------------------------- */

.marquee {
  overflow: hidden;
  padding-block: var(--space-md);
  border-block: 1px solid var(--color-border);
  background-color: var(--color-surface);
  /* fade both edges so items enter and leave instead of popping */
  mask-image: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent);
}

.marquee__track {
  display: flex;
  width: max-content;
  animation: marquee 34s linear infinite;
}

.marquee:hover .marquee__track {
  animation-play-state: paused;
}

.marquee__list {
  display: flex;
  align-items: center;
  gap: var(--space-xl);
  padding-right: var(--space-xl);
  font-family: var(--font-display);
  font-size: clamp(1.125rem, 2.4vw, 1.75rem);
  font-weight: 600;
  letter-spacing: -0.02em;
  white-space: nowrap;
  color: var(--color-secondary);
}

@keyframes marquee {
  to { transform: translateX(-50%); }
}

/* -------------------------------------------------------------------------
   8. Buttons & links
   ------------------------------------------------------------------------- */

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2xs);
  min-height: 50px;
  padding-inline: var(--space-md);
  font-size: var(--text-sm);
  font-weight: 600;
  text-decoration: none;
  border: 1px solid transparent;
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: transform var(--duration-fast) var(--ease-out),
    border-color var(--duration-fast) var(--ease-out),
    color var(--duration-fast) var(--ease-out),
    box-shadow var(--duration-base) var(--ease-out);
}

.button svg {
  width: 16px;
  height: 16px;
  flex: none;
}

.button--primary {
  background-image: var(--grad);
  color: var(--color-on-accent);
}

/* MOTION: implemented — lift + glow on hover */
.button--primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 28px color-mix(in srgb, var(--color-accent) 35%, transparent);
}

.button--ghost {
  border-color: var(--color-border);
  color: var(--color-foreground);
}

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

.button:active {
  transform: translateY(0) scale(0.98);
}

.link {
  color: var(--color-foreground);
  text-decoration: underline;
  text-decoration-color: var(--color-accent);
  text-underline-offset: 0.25em;
  text-decoration-thickness: 1px;
  cursor: pointer;
  transition: text-decoration-thickness var(--duration-fast) var(--ease-out);
}

.link:hover {
  text-decoration-thickness: 2px;
}

/* -------------------------------------------------------------------------
   9. Stats & pullquote
   ------------------------------------------------------------------------- */

.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr));
  gap: var(--space-lg);
}

.stat__value {
  font-family: var(--font-display);
  font-size: clamp(2.5rem, 6vw, 4rem);
  font-weight: 700;
  line-height: 1;
  letter-spacing: -0.05em;
  font-variant-numeric: tabular-nums;
}

.stat__label {
  margin-top: var(--space-2xs);
  font-size: var(--text-sm);
  line-height: 1.4;
  color: var(--color-secondary);
}

.stats--inset {
  margin-top: var(--space-lg);
}

.stats--inset .stat__value {
  font-size: clamp(1.875rem, 4vw, 2.75rem);
}

.pullquote {
  max-width: 30ch;
  margin-top: var(--space-2xl);
  font-family: var(--font-display);
  font-size: var(--text-h3);
  font-weight: 600;
  letter-spacing: -0.03em;
  line-height: 1.2;
  color: var(--color-secondary);
}

.pullquote--end {
  margin-top: var(--space-3xl);
}

/* -------------------------------------------------------------------------
   10. Filters
   ------------------------------------------------------------------------- */

.filters {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2xs);
  margin-bottom: var(--space-lg);
}

.filter {
  min-height: 44px;
  padding-inline: var(--space-sm);
  background: none;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-full);
  color: var(--color-secondary);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  cursor: pointer;
  transition: color var(--duration-fast) var(--ease-out),
    border-color var(--duration-fast) var(--ease-out);
}

.filter:hover {
  color: var(--color-foreground);
  border-color: var(--color-secondary);
}

/* Selected state carries fill + weight, never colour alone */
.filter[aria-pressed="true"] {
  background-image: var(--grad);
  border-color: transparent;
  color: var(--color-on-accent);
  font-weight: 600;
}

/* -------------------------------------------------------------------------
   11. Case studies
   ------------------------------------------------------------------------- */

.case {
  position: relative;
  padding-block: var(--space-3xl);
  border-top: 1px solid var(--color-border);
}

.case[hidden] {
  display: none;
}

/* Oversized index number as a graphic element */
.case__index {
  position: absolute;
  top: var(--space-xl);
  right: 0;
  font-family: var(--font-display);
  font-size: clamp(4rem, 12vw, 9rem);
  font-weight: 700;
  line-height: 1;
  letter-spacing: -0.06em;
  color: var(--color-foreground);
  opacity: 0.05;
  pointer-events: none;
}

.case__visual {
  margin-bottom: var(--space-xl);
}

.case__meta {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3xs);
  margin-bottom: var(--space-sm);
}

.tag {
  padding: 3px var(--space-2xs);
  font-family: var(--font-mono);
  font-size: var(--text-2xs);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--color-accent);
  border: 1px solid color-mix(in srgb, var(--color-accent) 35%, transparent);
  border-radius: var(--radius-sm);
}

.case__title {
  font-size: var(--text-h3);
}

.case__role {
  margin-top: var(--space-2xs);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--color-secondary);
}

.case__grid {
  display: grid;
  gap: var(--space-lg);
  margin-top: var(--space-xl);
}

@media (min-width: 48rem) {
  .case__grid {
    grid-template-columns: 1fr 1fr;
    gap: var(--space-2xl);
    align-items: start;
  }
}

.case__label {
  font-family: var(--font-mono);
  font-size: var(--text-2xs);
  font-weight: 500;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--color-accent);
  margin-bottom: var(--space-2xs);
}

.case__label--wide {
  margin-top: var(--space-2xl);
}

.case__col p {
  max-width: var(--measure);
  color: var(--color-secondary);
}

.case__note {
  max-width: var(--measure);
  margin-top: var(--space-md);
  font-size: var(--text-sm);
  color: var(--color-secondary);
}

/* -------------------------------------------------------------------------
   12. Bar chart — single series
   Each row is a bar and a table row at once, so values never depend on
   reading the bar. Single series, so no legend.
   ------------------------------------------------------------------------- */

.chart {
  margin-top: var(--space-2xl);
  padding-top: var(--space-lg);
  border-top: 1px solid var(--color-border);
}

.chart__caption {
  font-family: var(--font-mono);
  font-size: var(--text-2xs);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--color-secondary);
  margin-bottom: var(--space-md);
}

.bars {
  display: grid;
  gap: var(--space-sm);
}

.bar-row {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: var(--space-2xs) var(--space-sm);
}

.bar-row__name {
  font-size: var(--text-sm);
  color: var(--color-foreground);
}

.bar-row__value {
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--color-foreground);
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.bar-row__track {
  grid-column: 1 / -1;
  block-size: 10px;
  background-color: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.bar-row__fill {
  display: block;
  inline-size: var(--w);
  block-size: 100%;
  background-image: var(--grad);
  border-radius: 2px var(--radius-sm) var(--radius-sm) 2px;
}

@media (min-width: 40rem) {
  .bar-row {
    grid-template-columns: 12rem 1fr 4.5rem;
  }

  .bar-row__track {
    grid-column: auto;
  }
}

/* MOTION 5 — bars grow on scroll. transform only, never inline-size. */
.js .chart .bar-row__fill {
  transform: scaleX(0);
  transform-origin: left center;
  transition: transform 900ms var(--ease-out);
}

.js .chart.is-visible .bar-row__fill {
  transform: scaleX(1);
}

/* Stagger each bar so the set reads as a sequence */
.js .chart.is-visible .bar-row:nth-child(1) .bar-row__fill { transition-delay: 0ms; }
.js .chart.is-visible .bar-row:nth-child(2) .bar-row__fill { transition-delay: 70ms; }
.js .chart.is-visible .bar-row:nth-child(3) .bar-row__fill { transition-delay: 140ms; }
.js .chart.is-visible .bar-row:nth-child(4) .bar-row__fill { transition-delay: 210ms; }
.js .chart.is-visible .bar-row:nth-child(5) .bar-row__fill { transition-delay: 280ms; }

/* -------------------------------------------------------------------------
   12b. Data tables — real GA4 figures, so the numbers are the evidence
   ------------------------------------------------------------------------- */

.table-block {
  margin-top: var(--space-2xl);
}

.table-block__caption {
  font-family: var(--font-mono);
  font-size: var(--text-2xs);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--color-accent);
  margin-bottom: var(--space-2xs);
}

.table-block__note {
  max-width: var(--measure);
  margin-bottom: var(--space-md);
  font-size: var(--text-sm);
  color: var(--color-secondary);
}

/* The table scrolls inside its own box so the page body never does */
.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--text-sm);
  white-space: nowrap;
}

thead th {
  text-align: left;
  padding: var(--space-xs) var(--space-sm);
  font-family: var(--font-mono);
  font-size: var(--text-2xs);
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--color-secondary);
  background-color: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
}

thead th.num,
thead th.chg {
  text-align: right;
}

tbody td,
tbody th {
  padding: var(--space-2xs) var(--space-sm);
  border-bottom: 1px solid var(--color-border);
  font-weight: 400;
  text-align: left;
}

tbody tr:last-child td,
tbody tr:last-child th {
  border-bottom: 0;
}

tbody tr:hover {
  background-color: var(--color-surface);
}

tbody th {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--color-foreground);
}

.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
  color: var(--color-secondary);
}

/* Growth is stated as a number, never colour alone */
.chg {
  text-align: right;
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  color: var(--color-accent);
}

.chg--flat {
  color: var(--color-secondary);
  font-weight: 400;
}

/* -------------------------------------------------------------------------
   13. Before/after, ticks, steps, questions
   ------------------------------------------------------------------------- */

.ba {
  display: grid;
}

.ba__row {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: var(--space-2xs);
  padding-block: var(--space-xs);
  font-size: var(--text-sm);
}

.ba__row + .ba__row {
  border-top: 1px solid var(--color-border);
}

.ba__before {
  color: var(--color-secondary);
  text-decoration: line-through;
  text-decoration-color: color-mix(in srgb, var(--color-secondary) 50%, transparent);
}

.ba__after {
  font-weight: 600;
  color: var(--color-foreground);
}

.ba__arrow {
  width: 16px;
  height: 16px;
  flex: none;
  color: var(--color-accent);
}

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

.ticks--two {
  grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr));
  gap: var(--space-2xs) var(--space-lg);
}

.ticks li {
  position: relative;
  padding-left: var(--space-md);
  font-size: var(--text-sm);
  color: var(--color-secondary);
}

.ticks li::before {
  content: "";
  position: absolute;
  left: 2px;
  top: 0.5em;
  width: 9px;
  height: 5px;
  border-left: 1.5px solid var(--color-accent);
  border-bottom: 1.5px solid var(--color-accent);
  transform: rotate(-45deg);
}

.steps--inline {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2xs);
}

.steps--inline li {
  padding: var(--space-3xs) var(--space-xs);
  font-family: var(--font-mono);
  font-size: var(--text-2xs);
  color: var(--color-secondary);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-full);
}

/* Explicit column counts — auto-fit resolved to 5 and orphaned step six. */
.steps--flow {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-lg);
  counter-reset: step;
  margin-bottom: var(--space-3xl);
}

@media (min-width: 40rem) {
  .steps--flow { grid-template-columns: repeat(3, 1fr); }
}

@media (min-width: 64rem) {
  .steps--flow { grid-template-columns: repeat(6, 1fr); }
}

.step {
  counter-increment: step;
  padding-top: var(--space-sm);
  border-top: 2px solid var(--color-border);
  transition: border-color var(--duration-base) var(--ease-out);
}

.step:hover {
  border-top-color: var(--color-accent);
}

.step::before {
  content: counter(step, decimal-leading-zero);
  display: block;
  margin-bottom: var(--space-2xs);
  font-family: var(--font-mono);
  font-size: var(--text-2xs);
  color: var(--color-accent);
}

.step__name {
  font-family: var(--font-display);
  font-size: 1.0625rem;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.step__desc {
  margin-top: var(--space-3xs);
  font-size: var(--text-sm);
  line-height: 1.4;
  color: var(--color-secondary);
}

.questions li {
  padding-block: var(--space-sm);
  font-size: var(--text-sm);
  color: var(--color-secondary);
  transition: color var(--duration-fast) var(--ease-out),
    padding-left var(--duration-base) var(--ease-out);
}

.questions li + li {
  border-top: 1px solid var(--color-border);
}

.questions li:hover {
  color: var(--color-foreground);
}

.split {
  display: grid;
  gap: var(--space-2xl);
}

@media (min-width: 56rem) {
  .split {
    grid-template-columns: 1fr 1fr;
    gap: var(--space-3xl);
    align-items: start;
  }
}

/* Capabilities — explicit column counts so six items land 3×2 rather than
   whatever auto-fit happens to resolve to at a given width. */
.capabilities {
  margin-bottom: var(--space-3xl);
}

.cap-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-lg) var(--space-xl);
}

@media (min-width: 40rem) {
  .cap-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (min-width: 64rem) {
  .cap-grid { grid-template-columns: repeat(3, 1fr); }
}

@media (min-width: 40rem) {
  .cap-grid--three { grid-template-columns: repeat(3, 1fr); }
}

/* Sub-projects inside a case — the smaller stories that don't need a
   full case of their own but shouldn't be lost either. */
.subcases {
  display: grid;
  gap: var(--space-lg) var(--space-xl);
  margin-top: var(--space-md);
}

@media (min-width: 48rem) {
  .subcases { grid-template-columns: repeat(2, 1fr); }
}

.subcase {
  padding-top: var(--space-sm);
  border-top: 1px solid var(--color-border);
}

.subcase__name {
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  margin-bottom: var(--space-2xs);
}

.subcase p {
  font-size: var(--text-sm);
  line-height: 1.5;
  color: var(--color-secondary);
}

/* Hero with no side visual — single centred-left column */
.hero__inner--solo {
  display: block;
  max-width: 62rem;
}

/* Kicker above a case title, for work that sits outside the main discipline */
.case__kicker {
  display: inline-block;
  margin-bottom: var(--space-md);
  padding-bottom: var(--space-2xs);
  font-family: var(--font-mono);
  font-size: var(--text-2xs);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--color-accent);
  border-bottom: 1px solid color-mix(in srgb, var(--color-accent) 40%, transparent);
}

/* A real screenshot, presented at its native portrait ratio rather than
   stretched into a landscape frame it was never made for. */
.shot {
  display: grid;
  justify-items: center;
  gap: var(--space-md);
  margin-top: var(--space-2xl);
  padding: var(--space-2xl) var(--space-lg);
  background-color: var(--color-surface);
  background-image: var(--grad-soft);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
}

.shot img {
  width: min(20rem, 72vw);
  height: auto;
  /* width/height attrs plus this ratio reserve the space, so nothing shifts */
  aspect-ratio: 348 / 757;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
}

.shot figcaption {
  max-width: 46ch;
  text-align: center;
  font-size: var(--text-sm);
  color: var(--color-secondary);
}

.cap {
  padding-top: var(--space-sm);
  border-top: 1px solid var(--color-border);
  transition: border-top-color var(--duration-base) var(--ease-out);
}

.cap:hover {
  border-top-color: var(--color-accent);
}

.cap__name {
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.cap__desc {
  margin-top: var(--space-2xs);
  font-size: var(--text-sm);
  line-height: 1.45;
  color: var(--color-secondary);
}

/* -------------------------------------------------------------------------
   14. About
   ------------------------------------------------------------------------- */

.about {
  display: grid;
  gap: var(--space-2xl);
}

@media (min-width: 56rem) {
  .about {
    grid-template-columns: 1.5fr 1fr;
    gap: var(--space-3xl);
    align-items: start;
  }
}

.about__photo {
  width: clamp(11rem, 26vw, 15rem);
  margin-bottom: var(--space-xl);
}

.about__body > p + p {
  margin-top: var(--space-md);
}

.about__body p {
  max-width: var(--measure);
  color: var(--color-secondary);
}

.about__body strong {
  color: var(--color-foreground);
  font-weight: 600;
}

.about__aside .subhead + .timeline,
.about__aside .subhead + .deflist {
  margin-bottom: var(--space-xl);
}

.timeline__item {
  position: relative;
  padding-left: var(--space-md);
  padding-bottom: var(--space-md);
  border-left: 1px solid var(--color-border);
}

.timeline__item::before {
  content: "";
  position: absolute;
  left: -4px;
  top: 7px;
  width: 7px;
  height: 7px;
  background-image: var(--grad);
  border-radius: var(--radius-full);
}

.timeline__item:last-child {
  padding-bottom: 0;
  border-left-color: transparent;
}

.timeline__role {
  font-weight: 600;
  font-size: var(--text-sm);
}

.timeline__org {
  font-size: var(--text-sm);
  color: var(--color-secondary);
}

.timeline__date {
  font-family: var(--font-mono);
  font-size: var(--text-2xs);
  color: var(--color-secondary);
}

.deflist dt {
  font-size: var(--text-sm);
  font-weight: 600;
}

.deflist dd {
  margin: 0 0 var(--space-md);
  font-family: var(--font-mono);
  font-size: var(--text-2xs);
  color: var(--color-secondary);
}

/* -------------------------------------------------------------------------
   15. Contact & footer
   ------------------------------------------------------------------------- */

.contact {
  position: relative;
  overflow: hidden;
  border-top: 1px solid var(--color-border);
}

.contact__glow {
  position: absolute;
  inset: auto -20% -60% -20%;
  height: 120%;
  pointer-events: none;
  background: radial-gradient(
    40% 50% at 50% 80%,
    color-mix(in srgb, var(--color-accent) 20%, transparent),
    transparent 70%
  );
  filter: blur(60px);
}

.contact__inner {
  position: relative;
}

.contact__title {
  margin-top: var(--space-md);
  font-size: var(--text-display);
  letter-spacing: -0.045em;
  line-height: 0.98;
  max-width: 14ch;
}

.contact__title .grad {
  letter-spacing: -0.045em;
}

.contact__lead {
  max-width: 44ch;
  margin-top: var(--space-lg);
  font-size: var(--text-lead);
  color: var(--color-secondary);
}

.contact__actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-sm);
  margin-top: var(--space-xl);
}

.footer {
  padding-block: var(--space-xl);
  border-top: 1px solid var(--color-border);
}

.footer__inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-md);
  font-family: var(--font-mono);
  font-size: var(--text-2xs);
  color: var(--color-secondary);
}

.footer__social {
  display: flex;
  gap: var(--space-2xs);
}

.footer__social a {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: var(--radius-full);
  color: var(--color-secondary);
  transition: color var(--duration-fast) var(--ease-out);
}

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

.footer__social svg {
  width: 18px;
  height: 18px;
}

.work-empty {
  padding-block: var(--space-2xl);
  text-align: center;
  color: var(--color-secondary);
}

.work-empty[hidden] {
  display: none;
}

/* -------------------------------------------------------------------------
   15b. The useless feature
   A barely-visible button that opens a dialog after 16 clicks. It is a real
   <button>, so it stays keyboard-reachable — and it turns fully visible on
   focus so nobody tabs onto something they cannot see.
   ------------------------------------------------------------------------- */

.secret {
  display: block;
  width: 26px;
  height: 26px;
  margin: 0 auto var(--space-xl);
  padding: 0;
  background: none;
  border: 1px solid currentColor;
  border-radius: var(--radius-full);
  color: var(--color-secondary);
  opacity: 0.05;
  cursor: pointer;
  transition: opacity var(--duration-base) var(--ease-out),
    transform var(--duration-fast) var(--ease-out);
}

.secret:hover {
  opacity: 0.16;
}

.secret:active {
  transform: scale(0.9);
}

.secret:focus-visible {
  opacity: 1;
  color: var(--color-accent);
}

/* ---- Dialog ---- */

.modal[hidden] {
  display: none;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: var(--z-overlay);
  display: grid;
  place-items: center;
  padding: var(--gutter);
}

.modal__backdrop {
  position: absolute;
  inset: 0;
  /* strong enough to isolate the panel from the page behind it */
  background-color: rgb(0 0 0 / 0.72);
  backdrop-filter: blur(6px);
}

.modal__panel {
  position: relative;
  width: min(34rem, 100%);
  padding: var(--space-2xl) var(--space-xl) var(--space-xl);
  background-color: var(--color-elevated);
  background-image: var(--grad-soft);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: 0 24px 60px rgb(0 0 0 / 0.5);
  animation: pop var(--duration-slow) var(--ease-out);
}

@keyframes pop {
  from { opacity: 0; transform: translateY(10px) scale(0.98); }
}

.modal__close {
  position: absolute;
  top: var(--space-sm);
  right: var(--space-sm);
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  background: none;
  border: 0;
  border-radius: var(--radius-full);
  color: var(--color-secondary);
  cursor: pointer;
  transition: color var(--duration-fast) var(--ease-out);
}

.modal__close:hover {
  color: var(--color-foreground);
}

.modal__close svg {
  width: 18px;
  height: 18px;
}

.modal__eyebrow {
  font-family: var(--font-mono);
  font-size: var(--text-2xs);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--color-accent);
  margin-bottom: var(--space-2xs);
}

.modal__title {
  font-size: 1.5rem;
  line-height: 1.15;
  margin-bottom: var(--space-lg);
}

.lock {
  display: flex;
  align-items: center;
  gap: var(--space-2xs);
  width: 100%;
  min-height: 50px;
  padding: var(--space-xs) var(--space-md);
  text-align: left;
  background: none;
  border: 1px dashed var(--color-border);
  border-radius: var(--radius-md);
  color: var(--color-secondary);
  font-size: var(--text-sm);
  cursor: pointer;
  transition: color var(--duration-fast) var(--ease-out),
    border-color var(--duration-fast) var(--ease-out);
}

.lock:hover {
  color: var(--color-foreground);
  border-color: var(--color-accent);
}

.lock[hidden] {
  display: none;
}

.lock__icon {
  width: 18px;
  height: 18px;
  flex: none;
  color: var(--color-accent);
}

.secret-msg[hidden] {
  display: none;
}

.secret-msg {
  animation: pop var(--duration-slow) var(--ease-out);
}

.secret-msg__line {
  font-family: var(--font-display);
  font-size: 1.375rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.25;
}

.secret-msg__line:first-child {
  color: var(--color-accent);
}

.secret-msg__foot {
  margin-top: var(--space-md);
  padding-top: var(--space-md);
  border-top: 1px solid var(--color-border);
  font-size: var(--text-sm);
  color: var(--color-secondary);
}

/* -------------------------------------------------------------------------
   16. Scroll reveal — gated behind .js so content survives without JS
   ------------------------------------------------------------------------- */

.js .reveal {
  opacity: 0;
  transform: translateY(14px);
  transition: opacity var(--duration-slow) var(--ease-out),
    transform var(--duration-slow) var(--ease-out);
}

.js .reveal.is-visible {
  opacity: 1;
  transform: none;
}

/* -------------------------------------------------------------------------
   17. Reduced motion — every animation above is disabled here
   ------------------------------------------------------------------------- */

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

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

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

  /* Bars appear at full length rather than growing */
  .js .chart .bar-row__fill {
    transform: scaleX(1);
  }

  /* Marquee becomes a static, manually scrollable strip */
  .marquee__track {
    animation: none;
  }

  .marquee {
    overflow-x: auto;
  }

  .hero__glow {
    animation: none;
  }

  .dot {
    animation: none;
  }
}
