/* ---------- Tokens ---------- */
:root {
  --bg: #f4f4f1;
  --surface: #ffffff;
  --ink: #121311;
  --ink-soft: #5c5e58;
  --line: #dcddd5;
  --accent: #4e7a2c;
  --accent-bright: #9cc27a;
  --accent-soft: #e2ebd6;
  --orange: #c8650f;

  --font-display: "Big Shoulders Display", "Arial Narrow", sans-serif;
  --font-body: "Figtree", system-ui, -apple-system, sans-serif;
  --font-mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace; /* terminal only */

  --container: 1240px;
  --gutter: clamp(16px, 4vw, 40px);
  --section: clamp(80px, 12vw, 160px);
  --ease: cubic-bezier(.22, 1, .36, 1);
}

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

html { scroll-behavior: smooth; scroll-padding-top: 72px; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 400 17px/1.6 var(--font-body);
  -webkit-font-smoothing: antialiased;
}

img { display: block; max-width: 100%; height: auto; }
a { color: inherit; }
h1, h2, h3 { margin: 0; font-weight: 600; line-height: 1.1; }
p { margin: 0 0 1em; }
::selection { background: var(--accent); color: #fff; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 4px; }

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

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

.skip-link {
  position: absolute; left: 16px; top: -48px; z-index: 100;
  background: var(--ink); color: var(--bg); padding: 8px 14px; border-radius: 8px;
}
.skip-link:focus { top: 12px; }

.eyebrow {
  font: 600 0.95rem/1.3 var(--font-display); text-transform: uppercase; letter-spacing: .08em;
  color: var(--ink-soft); margin: 0 0 16px;
}


.btn {
  display: inline-flex; align-items: center; padding: 16px 30px; border-radius: 999px;
  background: var(--ink); color: var(--bg); text-decoration: none; font-weight: 500; font-size: 1.05rem;
  transition: background .25s var(--ease), transform .25s var(--ease);
}
.btn:hover { background: var(--accent); transform: translateY(-2px); }

/* ---------- Header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 20;
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter: blur(12px);
}
.header-inner { display: flex; align-items: center; justify-content: space-between; height: 64px; gap: 16px; }
.wordmark {
  display: inline-flex; align-items: center;
  font: 800 1.45rem/1 var(--font-display); text-transform: uppercase; letter-spacing: .02em; text-decoration: none;
}
.wordmark-logo { width: 28px; height: 28px; border-radius: 7px; margin-right: 10px; }
.wordmark span { color: var(--accent); }
.nav-list { display: flex; gap: clamp(14px, 3vw, 32px); list-style: none; margin: 0; padding: 0; align-items: center; }
.nav-list a { text-decoration: none; font-size: 0.92rem; color: var(--ink-soft); transition: color .2s; }
.nav-list a:hover { color: var(--ink); }
.nav-list .nav-cta { color: var(--ink); border: 1px solid var(--line); padding: 7px 16px; border-radius: 999px; background: var(--surface); }
.nav-list .nav-cta:hover { border-color: var(--ink); }
@media (max-width: 560px) { .nav-list li:not(:last-child) { display: none; } }

/* ---------- Hero ---------- */
.hero { position: relative; overflow: hidden; }
.contours {
  position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none;
  opacity: 0; transition: opacity 2s ease;
  -webkit-mask-image: linear-gradient(to bottom, #000 55%, transparent);
          mask-image: linear-gradient(to bottom, #000 55%, transparent);
}
.contours.is-ready { opacity: 1; }

.hero-inner {
  position: relative; text-align: center;
  min-height: calc(100svh - 64px); display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding-top: clamp(32px, 6vw, 72px); padding-bottom: clamp(48px, 8vw, 96px);
}

.hero-name {
  position: relative; margin: clamp(20px, 3vw, 36px) 0 clamp(20px, 3vw, 32px);
  font: 900 clamp(6rem, 22vw, 17.5rem)/0.86 var(--font-display);
  text-transform: uppercase; letter-spacing: -0.005em;
}
.hero-line { display: block; }
.hero-line-accent { color: var(--accent); }
.hero-portrait {
  position: absolute; left: 50%; top: 50%; width: 0.5em; height: 0.82em;
  transform: translate(-46%, -50%) rotate(-4deg);
  object-fit: cover; object-position: 50% 30%; border-radius: 999px;
  border: 0.04em solid var(--bg); box-shadow: 0 18px 40px -18px rgb(0 0 0 / .45);
  transition: transform .5s var(--ease);
}
.hero-name:hover .hero-portrait { transform: translate(-46%, -52%) rotate(2deg); }

.hero-build { font: 500 clamp(1.25rem, 2.6vw, 1.9rem)/1.3 var(--font-body); margin: 0 0 14px; letter-spacing: -0.01em; }
/* A fixed-width blank, as wide as the longest word, with each word centred on its underline. */
.ticker {
  display: inline-block; height: 1.4em; overflow: hidden; vertical-align: bottom;
  padding: 0 0.4em; margin-left: 0.15em; border-bottom: 2px solid var(--ink);
  color: var(--accent); text-align: center;
}
.ticker-track { display: block; transition: transform .6s var(--ease); }
.ticker-track > span { display: block; height: 1.4em; line-height: 1.4; white-space: nowrap; }
.ticker-track > .ticker-highlight { color: var(--orange); }

.lede { max-width: 34em; color: var(--ink-soft); font-size: 1.05rem; }
.hero-links { display: flex; gap: 24px; list-style: none; padding: 0; margin: 8px 0 0; font: 500 0.92rem var(--font-body); }
.hero-links a { text-decoration: none; color: var(--ink-soft); border-bottom: 1px solid var(--line); padding-bottom: 2px; transition: color .2s, border-color .2s; }
.hero-links a:hover { color: var(--accent); border-color: var(--accent); }

/* ---------- Sections ---------- */
.section { padding: var(--section) 0; }
.section-head { display: flex; justify-content: space-between; align-items: end; gap: 24px; flex-wrap: wrap; margin-bottom: clamp(36px, 5vw, 64px); }
.section-head h2 {
  font: 900 clamp(3.2rem, 8vw, 6.5rem)/0.85 var(--font-display); text-transform: uppercase;
}
.section-head p { max-width: 26em; margin: 0; color: var(--ink-soft); }

/* ---------- Work (dark block) ---------- */
.work { background: var(--ink); color: #ecece6; border-radius: clamp(20px, 3vw, 36px) clamp(20px, 3vw, 36px) 0 0; }
.work .section-head p { color: #9c9d96; }
.projects { list-style: none; margin: 0; padding: 0; border-top: 1px solid rgb(255 255 255 / .14); }
.project { border-bottom: 1px solid rgb(255 255 255 / .14); }
.project-link {
  display: grid; grid-template-columns: 3.5rem 1fr minmax(180px, 16rem) 2rem; gap: 24px; align-items: center;
  padding: clamp(24px, 3vw, 36px) 0; text-decoration: none;
  transition: opacity .3s var(--ease);
}
@media (hover: hover) { .projects:hover .project-link:not(:hover) { opacity: .35; } }
.project-index { font: 600 1.05rem var(--font-display); letter-spacing: .06em; color: #9c9d96; align-self: start; padding-top: .7em; }
.project h3 {
  font: 800 clamp(2.4rem, 5.5vw, 4.5rem)/0.95 var(--font-display); text-transform: uppercase;
  transition: color .3s var(--ease), transform .4s var(--ease);
}
.project-link:hover h3 { color: var(--accent-bright); transform: translateX(10px); }
.project-summary { margin: 10px 0 0; color: #b4b5ad; max-width: 40em; }
.project-meta { font: 500 0.9rem/1.55 var(--font-body); color: #ecece6; }
.project-meta span { color: #9c9d96; }
.project-arrow { font-size: 1.6rem; color: #9c9d96; transition: transform .3s var(--ease), color .3s; justify-self: end; }
.project-link:hover .project-arrow { color: var(--accent-bright); transform: translate(3px, -3px); }
.project-thumb { grid-column: 2 / -1; border-radius: 12px; margin-top: 4px; }
.work-more {
  display: inline-block; margin-top: 36px; color: #ecece6; text-decoration: none; font-weight: 500;
  border-bottom: 1px solid rgb(255 255 255 / .3); padding-bottom: 3px; transition: color .2s, border-color .2s;
}
.work-more:hover { color: var(--accent-bright); border-color: var(--accent-bright); }

@media (max-width: 820px) {
  .project-link { grid-template-columns: 2.5rem 1fr 1.5rem; gap: 14px 16px; }
  .project-meta { grid-column: 2; grid-row: 2; }
  .project-arrow { grid-column: 3; grid-row: 1; align-self: start; padding-top: .3em; }
  .project-thumb { grid-column: 1 / -1; }
}

/* Desktop with a mouse: thumbnails become a floating preview that follows the cursor. */
@media (hover: hover) and (pointer: fine) and (min-width: 821px) {
  .project-thumb { display: none; }
}
.project-preview {
  position: fixed; top: 0; left: 0; z-index: 30; width: 380px; aspect-ratio: 3 / 2;
  border-radius: 14px; overflow: hidden; pointer-events: none;
  box-shadow: 0 30px 60px -20px rgb(0 0 0 / .6);
  opacity: 0; scale: .85; transition: opacity .3s var(--ease), scale .4s var(--ease);
}
.project-preview.is-visible { opacity: 1; scale: 1; }
.project-preview img { width: 100%; height: 100%; object-fit: cover; }

/* ---------- About ---------- */
.about-inner { max-width: 1040px; }
.about-statement {
  font: 500 clamp(1.6rem, 3.6vw, 2.9rem)/1.22 var(--font-body); letter-spacing: -0.02em; margin-bottom: clamp(48px, 7vw, 88px);
}
.reveal-words .word { opacity: .16; transition: opacity .35s ease; }
.reveal-words .word.is-lit { opacity: 1; }
.about-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 32px; padding-top: 32px; border-top: 1px solid var(--line); }
.about-grid p { margin: 0; }
.timeline { list-style: none; padding: 0; margin: 0; }
.timeline li { display: grid; grid-template-columns: 5.5em 1fr; padding: 2px 0; }
.timeline span { font: 600 0.95rem var(--font-display); letter-spacing: .05em; color: var(--ink-soft); padding-top: 2px; }
@media (max-width: 820px) { .about-grid { grid-template-columns: 1fr; } }

/* ---------- About extras ---------- */
.about-grid a { color: var(--accent); text-underline-offset: 3px; }
.focus-list { list-style: none; padding: 0; margin: 0; }
.focus-list li { padding: 1px 0; }
.focus-list li::before { content: "→ "; color: var(--accent); }

/* ---------- Worked with ---------- */
.clients-section { padding-top: 0; }
.clients { list-style: none; padding: 0; margin: 0; border-top: 1px solid var(--line); }
.clients a {
  display: grid; grid-template-columns: 56px minmax(180px, 20rem) 1fr 2rem; gap: 16px 28px; align-items: center;
  padding: 22px 0; border-bottom: 1px solid var(--line); text-decoration: none;
}
.client-logo {
  width: 56px; height: 56px; border-radius: 14px; overflow: hidden;
  background: #fff; border: 1px solid var(--line); padding: 10px;
  transition: transform .35s var(--ease);
}
.client-logo.is-full { padding: 0; border: 0; }
.client-logo img { width: 100%; height: 100%; object-fit: contain; }
.client-logo.is-full img { object-fit: cover; }
.clients a:hover .client-logo { transform: rotate(-4deg) scale(1.05); }
.client-name {
  font: 800 clamp(1.8rem, 3.4vw, 2.6rem)/1 var(--font-display); text-transform: uppercase;
  transition: color .25s var(--ease), transform .35s var(--ease);
}
.client-work { color: var(--ink-soft); }
.client-arrow { color: var(--ink-soft); justify-self: end; transition: transform .3s var(--ease), color .3s; }
.clients a:hover .client-name { color: var(--accent); transform: translateX(8px); }
.clients a:hover .client-arrow { color: var(--accent); transform: translate(3px, -3px); }
@media (max-width: 640px) {
  .clients a { grid-template-columns: 48px 1fr 1.5rem; gap: 4px 16px; }
  .client-logo { width: 48px; height: 48px; border-radius: 12px; padding: 8px; grid-row: 1 / 3; align-self: start; }
  .client-work { grid-column: 2; grid-row: 2; }
  .client-arrow { grid-column: 3; grid-row: 1; }
}

/* ---------- Expertise ---------- */
.expertise { background: var(--surface); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.skills {
  list-style: none; padding: 0; margin: 0;
  display: grid; grid-template-columns: repeat(3, 1fr); border-top: 1px solid var(--line);
}
.skills > li { display: flex; flex-direction: column; padding: 28px 28px 28px 0; border-bottom: 1px solid var(--line); }
.skills > li:not(:nth-child(3n + 1)) { padding-left: 28px; border-left: 1px solid var(--line); }
.skills h3 { font: 800 clamp(1.6rem, 2.6vw, 2.1rem)/1 var(--font-display); text-transform: uppercase; margin-bottom: 10px; }
.skills p { margin: 0; color: var(--ink-soft); }
/* Pinned to the bottom so the tool rows line up across each row of cards */
.card-tools { list-style: none; padding: 20px 0 0; margin: auto 0 0; display: flex; flex-wrap: wrap; gap: 8px 18px; }
.card-tools li { display: flex; align-items: center; gap: 7px; font-size: 0.88rem; white-space: nowrap; }
.card-tools img { width: 18px; height: 18px; flex: none; }
@media (max-width: 900px) {
  .skills { grid-template-columns: 1fr 1fr; }
  .skills > li, .skills > li:not(:nth-child(3n + 1)) { padding: 24px 20px 24px 0; border-left: 0; }
  .skills > li:nth-child(even) { padding-left: 20px; border-left: 1px solid var(--line); }
}
@media (max-width: 560px) {
  .skills { grid-template-columns: 1fr; }
  .skills > li:nth-child(even) { padding-left: 0; border-left: 0; }
}

/* ---------- Contact ---------- */
.contact { text-align: center; border-top: 1px solid var(--line); }
.contact-title {
  font: 900 clamp(3.4rem, 11vw, 10rem)/0.88 var(--font-display); text-transform: uppercase;
  margin: 28px 0 28px;
}
.contact-title span { display: block; color: var(--accent); }
.contact-copy { max-width: 32em; margin: 0 auto 36px; color: var(--ink-soft); }

/* ---------- Footer ---------- */
.site-footer { padding: 28px 0 36px; font: 400 0.88rem var(--font-body); color: var(--ink-soft); border-top: 1px solid var(--line); }
.footer-inner { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 16px 32px; }
.footer-inner p { margin: 0; }
.footer-inner ul { display: flex; gap: 20px; list-style: none; margin: 0; padding: 0; }
.footer-inner a { text-decoration: none; }
.footer-inner a:hover { color: var(--ink); }

/* ---------- Case study ---------- */
.cs-head { padding-top: clamp(40px, 7vw, 88px); }
.cs-back { display: inline-block; margin-bottom: clamp(28px, 4vw, 48px); font: 500 0.92rem var(--font-body); color: var(--ink-soft); text-decoration: none; }
.cs-back:hover { color: var(--accent); }
.cs-title { font: 900 clamp(4rem, 13vw, 11rem)/0.86 var(--font-display); text-transform: uppercase; margin-bottom: 28px; }
.cs-title span { display: block; color: var(--accent); }
.cs-lede { font: 500 clamp(1.2rem, 2.2vw, 1.6rem)/1.35 var(--font-body); letter-spacing: -0.01em; max-width: 36em; }
.cs-facts { display: grid; grid-template-columns: repeat(4, 1fr); gap: 24px; margin: clamp(36px, 5vw, 56px) 0 0; padding-top: 24px; border-top: 1px solid var(--line); }
.cs-facts dt { font: 600 0.95rem/1.3 var(--font-display); text-transform: uppercase; letter-spacing: .08em; color: var(--ink-soft); margin-bottom: 6px; }
.cs-facts dd { margin: 0; }
@media (max-width: 760px) { .cs-facts { grid-template-columns: 1fr 1fr; } }

.cs-figure { margin: clamp(40px, 6vw, 72px) auto; }
.cs-figure img { border-radius: clamp(12px, 2vw, 20px); border: 1px solid var(--line); }
.cs-figure figcaption { margin-top: 10px; font: 400 0.85rem var(--font-body); color: var(--ink-soft); }

.cs-body { max-width: 780px; }
.cs-body section { margin-bottom: clamp(48px, 7vw, 80px); }
.cs-body h2 { font: 800 clamp(2rem, 4vw, 3rem)/0.95 var(--font-display); text-transform: uppercase; margin-bottom: 20px; }
.cs-body p { font-size: 1.08rem; line-height: 1.7; color: #33352f; }
.cs-diagram { margin: 32px 0; padding: 12px; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; }
@media (min-width: 1000px) {
  .cs-wide .cs-diagram { margin-left: -120px; margin-right: -120px; }
}
.cs-modules { list-style: none; padding: 0; margin: 0; counter-reset: mod; display: grid; grid-template-columns: 1fr 1fr; gap: 0 32px; }
.cs-modules li { counter-increment: mod; padding: 16px 0; border-top: 1px solid var(--line); }
.cs-modules li::before { content: counter(mod, decimal); font: 600 1rem var(--font-display); letter-spacing: .06em; color: var(--accent); }
.cs-modules h3 { font: 600 1.05rem var(--font-body); margin: 4px 0 4px; }
.cs-modules p { margin: 0; font-size: 0.98rem; color: var(--ink-soft); }
@media (max-width: 640px) { .cs-modules { grid-template-columns: 1fr; } }
.cs-tech { list-style: none; padding: 0; margin: 0; }
.cs-tech li { padding: 12px 0; border-top: 1px solid var(--line); color: var(--ink-soft); }
.cs-tech strong { color: var(--ink); font-weight: 600; }

.cs-next { padding-bottom: var(--section); }
.cs-next a { display: block; padding: 40px 0; border-top: 1px solid var(--line); text-decoration: none; }
.cs-next-title { display: block; font: 900 clamp(2.4rem, 7vw, 5.5rem)/0.9 var(--font-display); text-transform: uppercase; transition: color .25s var(--ease); }
.cs-next a:hover .cs-next-title { color: var(--accent); }

/* ---------- Terminal easter egg ---------- */
.term-hint { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
.term-hint:hover { color: var(--ink); }
kbd {
  font-family: var(--font-mono); font-size: 0.75rem; padding: 1px 6px; margin-left: 4px;
  border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 5px;
}
.term {
  position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; padding: 16px;
  background: rgb(10 11 10 / .5); backdrop-filter: blur(6px);
}
.term[hidden] { display: none; }
.term-window {
  width: min(760px, 100%); height: min(70vh, 520px); display: flex; flex-direction: column;
  background: #151613; color: #e6e5de; border-radius: 12px; overflow: hidden;
  border: 1px solid #2b2c28; box-shadow: 0 30px 80px -20px rgb(0 0 0 / .6);
  font: 400 14px/1.6 var(--font-mono);
  animation: term-in .22s ease-out;
}
@keyframes term-in { from { opacity: 0; transform: translateY(12px) scale(.98); } }
.term-bar { display: flex; align-items: center; gap: 8px; padding: 10px 14px; background: #1d1e1a; border-bottom: 1px solid #2b2c28; }
.term-bar i { width: 12px; height: 12px; border-radius: 50%; background: #ff5f57; }
.term-bar i:nth-child(2) { background: #febc2e; }
.term-bar i:nth-child(3) { background: #28c840; }
.term-title { flex: 1; text-align: center; color: #8d8c86; font-size: 12px; }
.term-close { background: none; border: 0; color: #8d8c86; font-size: 18px; line-height: 1; cursor: pointer; padding: 0 4px; }
.term-close:hover { color: #fff; }
.term-out { flex: 1; overflow-y: auto; padding: 14px 16px 4px; white-space: pre-wrap; word-break: break-word; }
.term-out a { color: var(--accent-bright); }
.term-line { display: flex; gap: 10px; padding: 4px 16px 14px; }
.term-prompt, .t-accent { color: var(--accent-bright); }
.t-dim { color: #8d8c86; }
.t-warn { color: #e0b25a; }
.t-blue { color: #7aa7d6; }
.term-line input { flex: 1; min-width: 0; background: none; border: 0; outline: none; color: inherit; font: inherit; caret-color: var(--accent-bright); }
.confetti { position: fixed; top: -12px; z-index: 60; width: 8px; height: 14px; border-radius: 2px; pointer-events: none; }

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition: none !important; animation: none !important; }
}
