/* Layout idea: quiet editorial grid. Serif statement, ruled timeline, 2-up project tiles drawn as terminal output, case studies with a sticky section index. */
:root {
  --paper: #ffffff;
  --ink: #2c3335;
  --muted: #636c6f;
  --rule: #e6e9ea;
  --accent: #cf431c;
  --on-accent: #ffffff;
  --term: #171c1e;
  --term-ink: #d9e0e2;
  --term-dim: #7f8b8f;
  --term-key: #8fb8ff;
  --term-chrome: #3a4447;
  --ok: #4fae7a;
  --warn: #e0a43a;
  --bad: #e5603e;
  /* page-level status ink: the terminal greens and ambers fail 4.5:1 on paper */
  --ok-ink: #1b7a4b;
  --warn-ink: #8a5a09;
  --display: "Playfair Display", Georgia, "Times New Roman", serif;
  --body: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;
  --gutter: clamp(16px, 4vw, 48px);
  --header-h: 80px;
  color-scheme: light;
}
/* One switching mechanism: data-theme, resolved from storage or the OS preference
   by the inline script in index.html before first paint. */
:root[data-theme="dark"] {
  --paper: #121516; --ink: #e4e8e9; --muted: #8e989b; --rule: #262c2e;
  --accent: #f0683f; --on-accent: #1b0f0a;
  --term: #0b0e0f; --term-ink: #d9e0e2; --term-dim: #727e82;
  --ok-ink: #5fc48c; --warn-ink: #e0a43a;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html {
  scroll-behavior: smooth;
  /* anchored targets clear the sticky header instead of landing under it */
  scroll-padding-block-start: var(--header-h);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
body { margin: 0; background: var(--paper); color: var(--ink); font: 400 1rem/1.65 var(--body); }
a { color: inherit; }
a:focus-visible, button:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 2px; }
h1, h2, h3 { font-family: var(--display); font-weight: 400; letter-spacing: -.015em; text-wrap: balance; margin: 0; }
p, li, dd { text-wrap: pretty; }
em { font-style: italic; }
.wrap { max-width: 1280px; margin: 0 auto; padding: 0 var(--gutter); }
.eyebrow { font: 500 12px/1.4 var(--body); letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }

/* Skip link */
.skip { position: fixed; inset-inline-start: var(--gutter); top: -100px; z-index: 20; background: var(--paper); color: var(--ink); border: 1px solid var(--rule); padding: 10px 14px; font-size: 14px; text-decoration: none; }
.skip:focus-visible { top: 12px; }

/* Header */
header.site { position: sticky; top: 0; z-index: 10; background: color-mix(in srgb, var(--paper) 92%, transparent); backdrop-filter: blur(8px); border-bottom: 1px solid var(--rule); }
header.site .wrap { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 64px; flex-wrap: wrap; }
.brand { text-decoration: none; display: flex; flex-direction: column; line-height: 1.25; }
.brand b { font: 600 13px/1.3 var(--body); letter-spacing: .12em; text-transform: uppercase; }
.brand span { font-size: 12px; color: var(--muted); }
.nav-end { display: flex; align-items: center; gap: 24px; }
nav.main { display: flex; gap: 28px; }
nav.main a { text-decoration: none; font-size: 14px; color: var(--muted); padding: 4px 0; border-bottom: 1px solid transparent; transition-property: color, border-bottom-color; transition-duration: 150ms; transition-timing-function: ease-out; }
nav.main a[aria-current="page"] { color: var(--ink); border-bottom-color: var(--ink); }
@media (hover: hover) { nav.main a:hover { color: var(--ink); border-bottom-color: var(--ink); } }

/* Theme toggle */
.theme { -webkit-tap-highlight-color: transparent; appearance: none; background: none; color: var(--muted); border: 1px solid var(--rule); border-radius: 999px; min-width: 40px; min-height: 40px; display: inline-grid; place-items: center; cursor: pointer; transition-property: color, border-color; transition-duration: 150ms; transition-timing-function: ease-out; }
@media (hover: hover) { .theme:hover { color: var(--ink); border-color: var(--muted); } }
.theme .icons { display: grid; place-items: center; width: 18px; height: 18px; }
.theme .icons svg { grid-area: 1 / 1; width: 18px; height: 18px; display: block; transition-property: opacity, scale, filter; transition-duration: 300ms; transition-timing-function: cubic-bezier(0.2, 0, 0, 1); }
/* the visible icon is the theme the button switches to */
.theme .icons .moon { opacity: 1; scale: 1; filter: blur(0px); }
.theme .icons .sun { opacity: 0; scale: .25; filter: blur(4px); }
:root[data-theme="dark"] .theme .icons .moon { opacity: 0; scale: .25; filter: blur(4px); }
:root[data-theme="dark"] .theme .icons .sun { opacity: 1; scale: 1; filter: blur(0px); }
@media (prefers-reduced-motion: reduce) {
  /* Only the opacity cross-fade runs. The hidden icon keeps its scale and blur
     from the state rules below, which outrank this selector — and at opacity 0
     neither is ever seen, so nothing animates and nothing is lost. */
  .theme .icons svg { transition-property: opacity; }
}

/* Views */
.view { display: none; }
.view.on { display: block; }

/* Hero */
.hero { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: 48px 64px; padding: clamp(48px, 8vw, 104px) 0 clamp(40px, 6vw, 72px); align-items: start; }
.hero h1 { font-size: clamp(32px, 4.4vw, 54px); line-height: 1.15; }
.hero h1 em { color: var(--accent); }
.hero p.lede { margin: 24px 0 0; max-width: 46ch; color: var(--muted); font-size: 17px; }
.timeline { list-style: none; margin: 8px 0 0; padding: 0; font-size: 14px; }
.timeline li { display: grid; grid-template-columns: 92px minmax(0, 1fr) minmax(0, 1fr); gap: 16px; padding: 11px 0; border-bottom: 1px solid var(--rule); }
.timeline li:first-child { border-top: 1px solid var(--rule); }
.timeline .yr { white-space: nowrap; color: var(--muted); font-variant-numeric: tabular-nums; }
.timeline .co { font-weight: 500; }
.timeline .role { color: var(--muted); }

/* Work grid */
.section-head { display: flex; justify-content: space-between; align-items: baseline; gap: 16px; padding: 0 0 20px; flex-wrap: wrap; }
.section-head h2 { font-size: 26px; }
.grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 40px 24px; padding-bottom: 96px; }
/* The panel's height follows its text. A fixed aspect ratio used to cut the
   output off between ~640px and ~1100px, with nothing to scroll or expand.
   The column keeps row-mates the same height without constraining content. */
.tile { display: flex; flex-direction: column; text-decoration: none; -webkit-tap-highlight-color: transparent; }
.tile .shot { position: relative; flex-grow: 1; background: var(--term); color: var(--term-ink); border-radius: 3px; padding: 22px 24px; font: 400 13px/1.7 var(--mono); }
.shot .bar { display: flex; gap: 6px; margin-bottom: 16px; }
.shot .bar i { width: 9px; height: 9px; border-radius: 50%; background: var(--term-chrome); }
.shot .bar small { margin-inline-start: 10px; color: var(--term-dim); font-size: 12px; font-style: normal; }
.shot pre { margin: 0; white-space: pre-wrap; font: inherit; }
.shot .d { color: var(--term-dim); } .shot .g { color: var(--ok); } .shot .y { color: var(--warn); } .shot .r { color: var(--bad); } .shot .k { color: var(--term-key); }
.shot .cta { position: absolute; inset-inline-start: 50%; top: 50%; translate: -50% -50%; opacity: 0; background: var(--accent); color: var(--on-accent); font: 500 12px/1 var(--body); letter-spacing: .14em; text-transform: uppercase; padding: 12px 16px; border-radius: 2px; white-space: nowrap; transition-property: opacity; transition-duration: 200ms; transition-timing-function: ease-out; }
.tile:focus-visible .cta { opacity: 1; }
@media (hover: hover) { .tile:hover .cta { opacity: 1; } }
@media (prefers-reduced-motion: no-preference) {
  .shot .cta { scale: .96; transition-property: opacity, scale; }
  .tile:focus-visible .cta { scale: 1; }
  .tile { transition-property: scale; transition-duration: 150ms; transition-timing-function: ease-out; }
  .tile:active { scale: .96; }
  .theme { transition-property: color, border-color, scale; }
  .theme:not(:disabled):active { scale: .96; }
}
@media (hover: hover) and (prefers-reduced-motion: no-preference) { .tile:hover .cta { scale: 1; } }
.tile .meta { display: flex; justify-content: space-between; gap: 12px; padding-top: 14px; font-size: 14px; flex-wrap: wrap; }
.tile .meta b { font-weight: 500; }
.tile .meta span { color: var(--muted); font-size: 12px; letter-spacing: .1em; text-transform: uppercase; }
.tile p { margin: 6px 0 0; color: var(--muted); font-size: 14px; max-width: 52ch; }

/* Capabilities */
.caps { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 2fr); gap: 40px 64px; padding: 72px 0 96px; border-top: 1px solid var(--rule); }
.caps h2 { font-size: 26px; }
.caps p { color: var(--muted); max-width: 36ch; margin: 16px 0 0; }
.caps ul { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 32px; }
.caps li { padding: 14px 0; border-bottom: 1px solid var(--rule); font-size: 15px; }
.caps li small { display: block; color: var(--muted); font-size: 13px; line-height: 1.5; margin-top: 2px; }

/* Footer */
footer.site { border-top: 1px solid var(--rule); padding: 32px 0 48px; font-size: 14px; color: var(--muted); }
footer.site .wrap { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
footer.site nav { display: flex; gap: 24px; flex-wrap: wrap; }
/* Footer links keep their underline: they sit beside static text of the same
   size and colour, so colour alone would not mark them as controls. */
footer.site a { text-underline-offset: 3px; text-decoration-thickness: from-font; transition-property: color; transition-duration: 150ms; transition-timing-function: ease-out; }
@media (hover: hover) { footer.site a:hover { color: var(--ink); } }

/* About */
.about-hero { padding: clamp(48px, 8vw, 104px) 0 56px; border-bottom: 1px solid var(--rule); }
.about-hero h1 { font-size: clamp(32px, 4.4vw, 54px); line-height: 1.15; max-width: 20ch; }
.about-hero h1 em { color: var(--accent); }
.row { display: grid; grid-template-columns: 200px minmax(0, 1fr); gap: 24px 64px; padding: 56px 0; border-bottom: 1px solid var(--rule); }
.row:last-of-type { border-bottom: 0; padding-bottom: 96px; }
.row .body { max-width: 66ch; }
.row .body p { margin: 0 0 16px; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 24px; }
.body > .stats { margin-top: 16px; }
.stats div b { display: block; font: 400 36px/1.1 var(--display); font-variant-numeric: tabular-nums; letter-spacing: -.015em; }
.stats div span { font-size: 13px; line-height: 1.5; color: var(--muted); }
.list2 { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 32px; }
.list2 li { padding: 12px 0; border-bottom: 1px solid var(--rule); }
.list2 li small { display: block; color: var(--muted); font-size: 13px; line-height: 1.5; }
.contact-big { display: inline-block; font: 400 clamp(24px, 3vw, 34px)/1.3 var(--display); letter-spacing: -.015em; text-decoration: none; border-bottom: 1px solid var(--accent); }
.contact-links { display: flex; gap: 24px; flex-wrap: wrap; margin-top: 20px; font-size: 14px; }
.contact-links a { text-underline-offset: 3px; text-decoration-thickness: from-font; transition-property: color; transition-duration: 150ms; transition-timing-function: ease-out; }
@media (hover: hover) { .contact-links a:hover { color: var(--accent); } }

/* Case study */
/* .case shares its element with .wrap, so it must keep .wrap's inline gutter. */
.case { display: grid; grid-template-columns: 180px minmax(0, 1fr); gap: 48px; padding-block: 56px 96px; padding-inline: var(--gutter); }
.case .index { position: sticky; top: calc(var(--header-h) + 16px); align-self: start; }
/* These share the .eyebrow treatment with the non-interactive .facts labels, so
   they carry an underline to read as controls rather than headings. */
.case .index a { display: block; font-size: 12px; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); padding: 5px 0; text-underline-offset: 4px; text-decoration-thickness: 1px; text-decoration-color: color-mix(in srgb, currentColor 45%, transparent); transition-property: color, text-decoration-color; transition-duration: 150ms; transition-timing-function: ease-out; }
@media (hover: hover) { .case .index a:hover { color: var(--accent); text-decoration-color: currentColor; } }
.case .index .back { margin-bottom: 24px; color: var(--ink); }
.case h1 { font-size: clamp(30px, 4vw, 48px); line-height: 1.15; margin: 8px 0 32px; }
.case .shot { aspect-ratio: auto; min-height: 280px; border-radius: 3px; background: var(--term); color: var(--term-ink); padding: 26px 28px; font: 400 13.5px/1.75 var(--mono); overflow-x: auto; overscroll-behavior-inline: contain; }
.facts { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 24px; padding: 28px 0; margin: 32px 0 8px; border-top: 1px solid var(--rule); border-bottom: 1px solid var(--rule); font-size: 14px; }
.facts dt { margin-bottom: 4px; }
.facts dd { margin: 0; line-height: 1.5; }
.case section { padding-top: 40px; max-width: 68ch; }
.case section p { margin: 12px 0 0; }
.case section ul { margin: 12px 0 0; padding-inline-start: 20px; }
.case section li { margin: 6px 0; }
.case code { font: 400 .9em var(--mono); background: color-mix(in srgb, var(--ink) 7%, transparent); padding: 1px 5px; border-radius: 3px; overflow-wrap: break-word; }
.status { display: inline-block; font: 500 12px/1 var(--body); letter-spacing: .1em; text-transform: uppercase; padding: 5px 8px; border-radius: 2px; border: 1px solid currentColor; }
.status.live { color: var(--ok-ink); } .status.wip { color: var(--warn-ink); }
.next { margin-top: 56px; padding-top: 24px; border-top: 1px solid var(--rule); display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; font-size: 14px; }
.next a { text-decoration: none; } .next a b { font: 400 22px/1.3 var(--display); letter-spacing: -.015em; display: block; }

@media (max-width: 900px) {
  .hero, .caps, .row, .case { grid-template-columns: minmax(0, 1fr); }
  .case .index { position: static; display: flex; flex-wrap: wrap; gap: 4px 16px; }
  .case .index .back { width: 100%; margin-bottom: 8px; }
  .facts, .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 640px) {
  .tile .shot { font-size: 12px; padding: 18px; }
  .grid, .caps ul, .list2 { grid-template-columns: minmax(0, 1fr); }
  .timeline li { grid-template-columns: 84px minmax(0, 1fr); }
  .timeline .role { grid-column: 2; margin-top: -10px; }
  nav.main { gap: 20px; }
  .nav-end { gap: 16px; }
}
