/* Design tokens: Structure/projects/Portfolio/spec/13-ui-design-system.md (direction A, D-012). */

@font-face {
  font-family: "Manrope";
  src: url("../fonts/manrope-latin-700-normal.woff2") format("woff2");
  font-weight: 700;
  font-display: swap;
}
@font-face {
  font-family: "Manrope";
  src: url("../fonts/manrope-latin-800-normal.woff2") format("woff2");
  font-weight: 800;
  font-display: swap;
}
@font-face {
  font-family: "Source Sans 3";
  src: url("../fonts/source-sans-3-latin-400-normal.woff2") format("woff2");
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: "Source Sans 3";
  src: url("../fonts/source-sans-3-latin-600-normal.woff2") format("woff2");
  font-weight: 600;
  font-display: swap;
}

:root {
  color-scheme: light;
  --paper: #faf7f2;
  --surface: #ffffff;
  --ink: #1b2a2f;
  --ink-muted: #56666b;
  --primary: #1f5f5b;
  --on-primary: #ffffff;
  --primary-hover: #174a47;
  --accent: #b4462f;
  --border: #d9d3c8;
  --border-strong: #857e73;
  --danger: #b3261e;
  --shadow-rest: 0 1px 2px rgb(0 0 0 / 0.06);
  --shadow-raised: 0 8px 20px rgb(0 0 0 / 0.08);

  --font-head: "Manrope", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-body: "Source Sans 3", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;

  --s-1: 0.25rem;
  --s-2: 0.5rem;
  --s-3: 0.75rem;
  --s-4: 1rem;
  --s-5: 1.5rem;
  --s-6: 2rem;
  --s-7: 3rem;
  --s-8: 4.5rem;

  --r-control: 8px;
  --r-card: 14px;
  --max: 860px;
  --gutter: 1.5rem;
  --nav-h: 3.75rem;
  --tabbar-h: 0px;
  /* Phone tab bar: lifted off the page so it reads as app chrome. */
  --chrome: #ffffff;
  --chrome-shadow: 0 -6px 18px rgb(0 0 0 / 0.12);
  /* Phone icon colours: one hue per icon, each at least 3:1 against the bars. */
  --c-work: #b26a00;
  --c-experience: #2f63d1;
  --c-projects: #12806f;
  --c-ai-a: #7c3aed;
  --c-ai-b: #d6336c;
  --c-certs: #c2412d;
  --c-play: #c2255c;
  --c-contact: #16855a;
  --c-moon: #4c51bf;
  --c-sun: #d99a00;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --paper: #111a1c;
    --surface: #18242a;
    --ink: #ede8e0;
    --ink-muted: #a7b2b4;
    --primary: #6fc2b8;
    --on-primary: #0b1719;
    --primary-hover: #8ad3ca;
    --accent: #f08a6e;
    --border: #2f3d42;
    --border-strong: #6b7a7f;
    --danger: #f2877e;
    --shadow-rest: none;
    --shadow-raised: none;
    --chrome: #22343b;
    --chrome-shadow: 0 -8px 22px rgb(0 0 0 / 0.55);
    --c-work: #f2b84b;
    --c-experience: #8fb0ff;
    --c-projects: #5fd0c2;
    --c-ai-a: #b79cff;
    --c-ai-b: #ff8fb8;
    --c-certs: #ff8c6e;
    --c-play: #ff85ad;
    --c-contact: #5ad08f;
    --c-moon: #a5a9ff;
    --c-sun: #f6c453;
  }
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --paper: #111a1c;
  --surface: #18242a;
  --ink: #ede8e0;
  --ink-muted: #a7b2b4;
  --primary: #6fc2b8;
  --on-primary: #0b1719;
  --primary-hover: #8ad3ca;
  --accent: #f08a6e;
  --border: #2f3d42;
  --border-strong: #6b7a7f;
  --danger: #f2877e;
  --shadow-rest: none;
  --shadow-raised: none;
  --chrome: #22343b;
  --chrome-shadow: 0 -8px 22px rgb(0 0 0 / 0.55);
  --c-work: #f2b84b;
  --c-experience: #8fb0ff;
  --c-projects: #5fd0c2;
  --c-ai-a: #b79cff;
  --c-ai-b: #ff8fb8;
  --c-certs: #ff8c6e;
  --c-play: #ff85ad;
  --c-contact: #5ad08f;
  --c-moon: #a5a9ff;
  --c-sun: #f6c453;
}

/* Base */

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

html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--nav-h) + var(--s-4));
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 1.0625rem;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 {
  font-family: var(--font-head);
  line-height: 1.2;
  margin: 0;
  text-wrap: balance;
}

p { margin: 0 0 var(--s-4); }
p:last-child { margin-bottom: 0; }

a { color: var(--primary); text-underline-offset: 0.18em; }
a:hover { color: var(--primary-hover); }

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

.visually-hidden {
  position: absolute !important;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.skip-link {
  position: absolute;
  left: var(--s-4);
  top: -3rem;
  z-index: 100;
  padding: var(--s-2) var(--s-4);
  background: var(--primary);
  color: var(--on-primary);
  border-radius: var(--r-control);
  font-weight: 600;
  text-decoration: none;
}
.skip-link:focus { top: var(--s-2); color: var(--on-primary); }

/* Placeholder content (D-018): visible on purpose, removed before Gate 6. */
.placeholder {
  background: repeating-linear-gradient(-45deg, transparent 0 6px, color-mix(in srgb, var(--accent) 10%, transparent) 6px 12px);
  outline: 1px dashed var(--accent);
  outline-offset: 1px;
  border-radius: 3px;
}

/* Nav */

.nav {
  position: sticky;
  top: 0;
  z-index: 10;
  background: color-mix(in srgb, var(--paper) 88%, transparent);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
}

.nav-inner {
  position: relative;
  max-width: var(--max);
  min-height: var(--nav-h);
  margin: 0 auto;
  padding: 0 var(--gutter);
  display: flex;
  align-items: center;
  gap: var(--s-4);
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  margin-right: auto;
  color: var(--ink);
  font-family: var(--font-head);
  font-weight: 800;
  text-decoration: none;
}
.nav-brand img { display: block; width: 40px; height: 32px; }
.nav-brand .nav-avatar { display: none; }
.nav-title { display: none; }

.nav-links {
  display: flex;
  gap: var(--s-5);
  margin: 0;
  padding: 0;
  list-style: none;
}

.nav-links a {
  display: inline-block;
  padding: var(--s-1) 0;
  color: var(--ink-muted);
  font-size: 0.95rem;
  font-weight: 600;
  text-decoration: none;
  border-bottom: 2px solid transparent;
}
.nav-links a:hover { color: var(--ink); }
.nav-links a[aria-current="true"] { color: var(--ink); border-bottom-color: var(--primary); }

.icon-button {
  display: inline-grid;
  place-items: center;
  width: 44px;
  height: 44px;
  padding: 0;
  background: none;
  border: 1px solid transparent;
  border-radius: var(--r-control);
  color: var(--ink);
  cursor: pointer;
}
.icon-button:hover { border-color: var(--border-strong); }
.icon-button svg { width: 20px; height: 20px; }

.theme-toggle .icon-sun { display: none; }
:root[data-theme="dark"] .theme-toggle .icon-sun { display: block; }
:root[data-theme="dark"] .theme-toggle .icon-moon { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-toggle .icon-sun { display: block; }
  :root:not([data-theme="light"]) .theme-toggle .icon-moon { display: none; }
}

/* Play and Contact shortcuts: phones only; wider screens have them in the section links. */
.nav-quick { display: none; }

/* App-style tab bar: phones only (see the 760px breakpoint). */
.tabbar { display: none; }

/* Layout */

main {
  max-width: var(--max);
  margin: 0 auto;
  padding: 0 var(--gutter);
}

.section {
  padding: var(--s-8) 0 0;
}
.section:last-child { padding-bottom: var(--s-8); }

.section-head {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  margin-bottom: var(--s-5);
  font-size: 1.6rem;
  font-weight: 800;
  letter-spacing: -0.01em;
}
.section-head svg {
  flex: none;
  width: 1.35rem;
  height: 1.35rem;
  color: var(--primary);
}

.lede { color: var(--ink-muted); max-width: 40rem; }

.next-link {
  display: inline-block;
  margin-top: var(--s-5);
  font-weight: 600;
}

/* Hero */

.hero {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: var(--s-6);
  padding: var(--s-8) 0 var(--s-6);
}
.hero-photo {
  grid-column: 2;
  grid-row: 1;
  width: 220px;
  height: 220px;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid var(--primary);
}

.eyebrow {
  margin: 0 0 var(--s-3);
  color: var(--primary);
  font-size: 0.875rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.hero h1 {
  font-size: 3rem;
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: -0.02em;
}

.hero-position {
  margin: var(--s-2) 0 var(--s-4);
  font-family: var(--font-head);
  font-size: 1.3rem;
  font-weight: 700;
  line-height: 1.35;
}

.hero-meta {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  margin: 0 0 var(--s-4);
  color: var(--ink-muted);
  font-size: 0.95rem;
}
.hero-meta svg { width: 1rem; height: 1rem; }

.hero-sub { max-width: 38rem; color: var(--ink-muted); margin-bottom: var(--s-5); }

.actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--s-3);
}

/* Buttons */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--s-2);
  min-height: 44px;
  padding: 0.55rem 1.15rem;
  border: 1px solid transparent;
  border-radius: var(--r-control);
  font-family: var(--font-body);
  font-size: 0.95rem;
  font-weight: 600;
  line-height: 1.2;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  transition: transform 120ms ease, background-color 120ms ease, border-color 120ms ease;
}
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: none; }

.btn-primary { background: var(--primary); color: var(--on-primary); }
.btn-primary:hover { background: var(--primary-hover); color: var(--on-primary); }

.btn-secondary { background: transparent; color: var(--ink); border-color: var(--border-strong); }
.btn-secondary:hover { background: var(--surface); color: var(--ink); }

.btn[disabled] { opacity: 0.5; cursor: not-allowed; transform: none; }

.text-link { font-weight: 600; }

/* Outcomes */

.outcomes {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--s-5);
  margin: 0;
  padding: var(--s-6) 0 0;
  list-style: none;
  border-top: 1px solid var(--border);
}

.outcome-num {
  display: block;
  color: var(--accent);
  font-family: var(--font-head);
  font-size: 2.2rem;
  font-weight: 800;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}
.outcome-label { display: block; margin-top: var(--s-2); font-weight: 600; line-height: 1.35; }
.outcome-org { display: block; color: var(--ink-muted); font-size: 0.9rem; }

/* Case studies */

.cases { display: grid; gap: var(--s-4); }

.case {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-card);
  box-shadow: var(--shadow-rest);
}

.case > summary {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: var(--s-1) var(--s-4);
  padding: var(--s-5);
  cursor: pointer;
  list-style: none;
  border-radius: var(--r-card);
}
.case > summary::-webkit-details-marker { display: none; }

.case-title { font-size: 1.15rem; font-weight: 700; }
.case-meta { grid-column: 1; color: var(--ink-muted); font-size: 0.9rem; }
.case-outcome { grid-column: 1; margin-top: var(--s-2); font-weight: 600; }

.case-chevron {
  grid-column: 2;
  grid-row: 1 / span 3;
  align-self: center;
  width: 1.25rem;
  height: 1.25rem;
  color: var(--primary);
  transition: transform 150ms ease;
}
.case[open] .case-chevron { transform: rotate(180deg); }

.case-body {
  padding: 0 var(--s-5) var(--s-5);
  border-top: 1px solid var(--border);
}
.case-body dl { margin: var(--s-4) 0 0; }
.case-body dt {
  margin-top: var(--s-4);
  color: var(--primary);
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.case-body dd { margin: var(--s-1) 0 0; }
.case-body ul { margin: 0; padding-left: 1.2rem; }
.case-body li + li { margin-top: var(--s-1); }

/* Timeline */

.timeline { display: grid; gap: var(--s-5); margin: 0; padding: 0; list-style: none; }

.timeline-item {
  position: relative;
  padding-left: var(--s-5);
  border-left: 2px solid var(--border);
}
.timeline-item::before {
  content: "";
  position: absolute;
  left: -7px;
  top: 0.45rem;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--primary);
}
.timeline-item.condensed::before { background: var(--border-strong); }

.timeline-head {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0 var(--s-4);
}
.timeline-role { font-family: var(--font-head); font-size: 1.05rem; font-weight: 700; }
.timeline-date { color: var(--ink-muted); font-size: 0.9rem; white-space: nowrap; }
.timeline-org { margin: 0 0 var(--s-2); color: var(--ink-muted); font-size: 0.95rem; }

/* Cards */

.cards {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--s-4);
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-card);
  padding: var(--s-5);
  box-shadow: var(--shadow-rest);
}
.card h3 { font-size: 1.15rem; font-weight: 700; margin-bottom: var(--s-2); }
.card-featured { grid-column: 1 / -1; }
/* Project pictures: a cover across the top of a card; beside the text in the wide featured card.
   The picture repeats the card's first link, so it is hidden from screen readers and the tab order. */
.card-media {
  display: block;
  overflow: hidden;
  margin: calc(-1 * var(--s-5)) calc(-1 * var(--s-5)) var(--s-5);
  border-radius: var(--r-card) var(--r-card) 0 0;
  border-bottom: 1px solid var(--border);
}
.card-media img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 2 / 1;
  object-fit: cover;
  transition: transform 0.6s ease;
}
.card-media:hover img { transform: scale(1.03); }
@media (min-width: 761px) {
  /* Featured card: two columns that each flow on their own — picture with "Where the AI
     fits" on the left; title, story, stack and actions on the right. */
  .card-featured.has-media {
    display: grid;
    grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr);
    column-gap: var(--s-6, 2rem);
    align-items: start;
  }
  .card-featured.has-media .card-media {
    margin: 0 0 var(--s-5);
    border-radius: calc(var(--r-card) - 4px);
    border: 1px solid var(--border);
  }
  #trip-planner .card-media img,
  #pnotes .card-media img { aspect-ratio: 1200 / 630; }
  /* The title column comes first in reading order; the picture column is shown on the left. */
  .card-featured.has-media .card-side { grid-column: 1; grid-row: 1; }
  .card-featured.has-media .card-main { grid-column: 2; grid-row: 1; }
}
@media (max-width: 760px) {
  /* Phones: one column in reading order — picture, title, story, AI, stack, actions. */
  .card-featured.has-media { display: flex; flex-direction: column; }
  .card-featured.has-media .card-side,
  .card-featured.has-media .card-main { display: contents; }
  .card-featured.has-media .card-media { order: 0; }
  .card-featured.has-media h3 { order: 1; }
  .card-featured.has-media .card-main > p:not(.card-note) { order: 2; }
  .card-featured.has-media .card-ai { order: 3; }
  .card-featured.has-media .tags { order: 4; }
  .card-featured.has-media .actions { order: 5; }
  .card-featured.has-media .card-note { order: 6; }
}
@media (prefers-reduced-motion: reduce) {
  .card-media img { transition: none; }
  .card-media:hover img { transform: none; }
}
.card-note { margin-top: var(--s-3); color: var(--ink-muted); font-size: 0.9rem; }
.card-badge { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-2) var(--s-3); }
.card-badge img { height: 28px; width: auto; max-width: 100%; }
.card .actions { margin-top: var(--s-5); }

/* Certificates: one row of tiles, three in view, that slides along (site.js). The thumbnail
   repeats the title link, so it is hidden from screen readers and the tab order. */
.certs {
  display: flex;
  gap: var(--s-3);
  margin: 0;
  padding: 0 0 var(--s-2);
  list-style: none;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scroll-snap-type: x mandatory;
  scroll-behavior: smooth;
  scrollbar-width: none;
}
.certs::-webkit-scrollbar { display: none; }
.cert-controls { margin: var(--s-2) 0 var(--s-5); }
@media (prefers-reduced-motion: reduce) { .certs { scroll-behavior: auto; } }
.cert {
  /* position: relative keeps each tile's visually hidden text inside the row, not off the page. */
  position: relative;
  flex: 0 0 calc((100% - 2 * var(--s-3)) / 3);
  scroll-snap-align: start;
  display: flex;
  flex-direction: column;
  padding: var(--s-3);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-card);
  box-shadow: var(--shadow-rest);
}
.cert-thumb { display: block; overflow: hidden; margin-bottom: var(--s-3); border: 1px solid var(--border); border-radius: calc(var(--r-card) - 4px); }
.cert-thumb img { display: block; width: 100%; height: auto; aspect-ratio: 600 / 464; object-fit: cover; transition: transform 0.6s ease; }
.cert-thumb:hover img { transform: scale(1.04); }
/* A portrait certificate is shown whole inside the same landscape box. */
.cert-thumb-portrait img { object-fit: contain; background: var(--paper); }
.cert h3 { font-size: 0.95rem; font-weight: 700; line-height: 1.3; margin-bottom: var(--s-1); }
.cert h3 a { color: inherit; text-decoration: none; }
.cert h3 a:hover { text-decoration: underline; }
.cert-meta { margin: 0; color: var(--ink-muted); font-size: 0.85rem; }
.cert-verify { margin-top: auto; padding-top: var(--s-2); font-size: 0.85rem; font-weight: 600; }
@media (prefers-reduced-motion: reduce) {
  .cert-thumb img { transition: none; }
  .cert-thumb:hover img { transform: none; }
}

/* Projects carousel (site.js adds .is-carousel): one project at a time, sliding every 4 seconds.
   Without JavaScript the cards stay a stacked list. */
.carousel.is-carousel .carousel-track {
  position: relative; /* keeps visually hidden text in off-screen slides inside the scroll box */
  display: flex;
  gap: var(--s-4);
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scroll-behavior: smooth;
  overscroll-behavior-x: contain;
  scrollbar-width: none;
  padding-bottom: 2px; /* room for the card border */
}
.carousel.is-carousel .carousel-track::-webkit-scrollbar { display: none; }
.carousel.is-carousel .carousel-track > .card {
  flex: 0 0 100%;
  scroll-snap-align: start;
  scroll-snap-stop: always;
}
.carousel-controls {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  margin-top: var(--s-4);
}
.carousel-controls[hidden] { display: none; }
.carousel-dots { display: flex; gap: var(--s-1); min-width: 0; margin-right: auto; }
/* Dots shrink towards 24px (WCAG's minimum target size) when there are too many for a narrow screen. */
.carousel-dots button {
  flex: 0 1 32px;
  min-width: 24px;
  height: 32px;
  padding: 0;
  background: none;
  border: 0;
  cursor: pointer;
}
.carousel-dots button::before {
  content: "";
  display: block;
  width: 10px;
  height: 10px;
  margin: auto;
  border-radius: 50%;
  border: 1px solid var(--border-strong);
  transition: width 0.3s ease, background-color 0.3s ease;
}
.carousel-dots button[aria-current="true"]::before {
  width: min(26px, 100%);
  border-radius: 5px;
  background: var(--primary);
  border-color: var(--primary);
}
.carousel-pause .icon-play { display: none; }
.carousel.is-paused .carousel-pause .icon-play { display: block; }
.carousel.is-paused .carousel-pause .icon-pause { display: none; }
@media (prefers-reduced-motion: reduce) {
  .carousel.is-carousel .carousel-track { scroll-behavior: auto; }
  .carousel-dots button::before { transition: none; }
}

.meta-label {
  margin: var(--s-4) 0 var(--s-1);
  color: var(--primary);
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

/* Principles */

.principles { display: grid; gap: var(--s-5); margin: 0; padding: 0; list-style: none; counter-reset: p; }
.principles li { position: relative; padding-left: 2.75rem; counter-increment: p; }
.principles li::before {
  content: counter(p);
  position: absolute;
  left: 0;
  top: 0;
  display: grid;
  place-items: center;
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  background: color-mix(in srgb, var(--primary) 14%, transparent);
  color: var(--primary);
  font-family: var(--font-head);
  font-weight: 800;
}
.principles h3 { font-size: 1.1rem; font-weight: 700; margin-bottom: var(--s-1); }

/* Tags */

.tags { display: flex; flex-wrap: wrap; gap: var(--s-2); margin: 0 0 var(--s-4); padding: 0; list-style: none; }
.tag {
  display: inline-block;
  padding: 0.3rem 0.8rem;
  border-radius: 999px;
  background: color-mix(in srgb, var(--primary) 12%, transparent);
  color: var(--ink);
  font-size: 0.875rem;
  font-weight: 600;
}
.tag-outline { background: transparent; border: 1px solid var(--border-strong); color: var(--ink-muted); font-weight: 400; }

/* Game */

.js .no-js-only { display: none; }
html:not(.js) .game-card { display: none; }

.game-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-card);
  padding: var(--s-5);
}
.game-hud {
  display: flex;
  justify-content: space-between;
  margin-bottom: var(--s-3);
  font-family: var(--font-head);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.game-canvas {
  display: block;
  width: 100%;
  height: 220px;
  background: var(--paper);
  border-radius: var(--r-control);
  cursor: pointer;
  touch-action: manipulation;
}
.game-footer { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-4); margin-top: var(--s-4); }
.game-result { margin: 0; font-weight: 600; }
.game-hint { margin: var(--s-2) 0 0; color: var(--ink-muted); font-size: 0.9rem; }
.game-best { margin: var(--s-2) 0 0; color: var(--ink-muted); font-size: 0.9rem; }
.game-best:empty { display: none; }

/* Assistant panel (14) */

html:not(.js) .ask-panel { display: none; }

.ai-badge {
  padding: 0.1rem 0.5rem;
  border: 1px solid var(--accent);
  border-radius: 999px;
  color: var(--accent);
  font-family: var(--font-body);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.06em;
}

.ask-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-card);
  padding: var(--s-5);
  box-shadow: var(--shadow-rest);
}

.ask-suggestions { display: flex; flex-wrap: wrap; gap: var(--s-2); margin-bottom: var(--s-4); }

.chip {
  min-height: 44px;
  padding: 0.45rem 0.9rem;
  background: transparent;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  color: var(--ink);
  font: 600 0.9rem/1.2 var(--font-body);
  cursor: pointer;
}
.chip:hover { border-color: var(--primary); color: var(--primary); }
.chip[disabled] { opacity: 0.5; cursor: not-allowed; }

.ask-label { display: block; margin-bottom: var(--s-1); font-weight: 600; font-size: 0.95rem; }
.ask-row { display: flex; gap: var(--s-3); align-items: flex-start; }
.ask-row textarea {
  flex: 1;
  min-height: 3.25rem;
  padding: 0.65rem 0.8rem;
  background: var(--paper);
  border: 1px solid var(--border-strong);
  border-radius: var(--r-control);
  color: var(--ink);
  font: 1rem/1.5 var(--font-body);
  resize: vertical;
}
.ask-row textarea:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.ask-row textarea[disabled] { opacity: 0.6; }
.ask-count { margin: var(--s-1) 0 0; color: var(--ink-muted); font-size: 0.85rem; text-align: right; }
.turnstile-slot:empty { display: none; }

.ask-answer:empty { display: none; }
.ask-answer {
  margin-top: var(--s-4);
  padding: var(--s-4);
  background: var(--paper);
  border-left: 3px solid var(--primary);
  border-radius: var(--r-control);
  white-space: pre-line;
}
.ask-answer .btn { margin-top: var(--s-3); }
.ask-refused, .ask-limit, .ask-resting { border-left-color: var(--border-strong); }
.ask-error { border-left-color: var(--danger); }
.ask-error > p:first-child { color: var(--danger); font-weight: 600; }
.ask-sources { margin-top: var(--s-3); color: var(--ink-muted); font-size: 0.9rem; white-space: normal; }
.ask-resting .ask-answer, .ask-resting > .ask-answer { margin-top: 0; }

.ask-remaining { margin: var(--s-3) 0 0; color: var(--ink-muted); font-size: 0.9rem; }
.ask-remaining:empty { display: none; }
.ask-note { margin: var(--s-2) 0 0; color: var(--ink-muted); font-size: 0.85rem; }

.dots { display: inline-flex; gap: 4px; vertical-align: middle; }
.dots span { width: 6px; height: 6px; border-radius: 50%; background: var(--primary); animation: dot 1.2s infinite ease-in-out; }
.dots span:nth-child(2) { animation-delay: 0.15s; }
.dots span:nth-child(3) { animation-delay: 0.3s; }
@keyframes dot { 0%, 80%, 100% { opacity: 0.25; } 40% { opacity: 1; } }

.nav-links a.nav-ask {
  padding: var(--s-1) var(--s-3);
  border: 1px solid var(--primary);
  border-radius: 999px;
  color: var(--primary);
}
.nav-links a.nav-ask:hover, .nav-links a.nav-ask[aria-current="true"] { background: var(--primary); color: var(--on-primary); }

.hero-ask { margin: var(--s-4) 0 0; font-size: 0.95rem; font-weight: 600; }

/* Contact */

.contact-address { margin-top: var(--s-4); color: var(--ink-muted); font-size: 0.95rem; }
.contact-address span { color: var(--ink); user-select: all; }

/* Footer */

.footer {
  max-width: var(--max);
  margin: 0 auto;
  padding: var(--s-6) var(--gutter) var(--s-7);
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: var(--s-2) var(--s-4);
  color: var(--ink-muted);
  font-size: 0.9rem;
  border-top: 1px solid var(--border);
}
.footer p { margin: 0; }

/* Credits page */

.prose { max-width: 40rem; }
.prose h2 { font-size: 1.35rem; margin: var(--s-7) 0 var(--s-3); }
.prose ul { padding-left: 1.2rem; }
.prose li + li { margin-top: var(--s-2); }

/* Reveal on scroll (script adds .reveal-armed only when motion is allowed) */

.reveal-armed { opacity: 0; transform: translateY(12px); transition: opacity 400ms ease-out, transform 400ms ease-out; }
.reveal-armed.visible { opacity: 1; transform: none; }

/* Responsive: 12 §4 */

@media (max-width: 1023px) {
  .nav-links { gap: var(--s-4); }
}

/* Phones: LinkedIn-style app layout. The header carries the photo, name and the Play and Contact
   shortcuts; the section links move to a tab bar fixed at the bottom. The footer (disclaimer,
   credits & privacy) gets extra bottom padding the height of the bar, so it always ends above it. */
@media (max-width: 760px) {
  :root { --tabbar-h: calc(3.75rem + env(safe-area-inset-bottom, 0px)); }
  /* App feel: no rubber-band pull at the page edges, so the header and tab bar never get dragged
     away from the screen edges (this also turns off pull-to-refresh; Safari's reload still works). */
  html, body { overscroll-behavior-y: none; }
  .tabbar ~ .footer { padding-bottom: calc(var(--s-6) + var(--tabbar-h)); }
  html { scroll-padding-bottom: var(--tabbar-h); }

  .nav-inner { gap: var(--s-1); }
  .nav-links { display: none; }
  .nav-brand { gap: var(--s-3); min-width: 0; }
  .nav-avatar + picture { display: none; }
  .nav-brand .nav-avatar {
    display: block;
    flex: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--primary);
  }
  .nav-id { display: flex; flex-direction: column; min-width: 0; line-height: 1.2; }
  .nav-title {
    display: block;
    overflow: hidden;
    color: var(--ink-muted);
    font-family: var(--font-body);
    font-size: 0.8rem;
    font-weight: 600;
    white-space: nowrap;
    text-overflow: ellipsis;
  }
  .nav-quick { display: inline-grid; }
  .nav-quick svg, .theme-toggle svg { width: 24px; height: 24px; }

  .tabbar {
    display: block;
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 10;
    padding-bottom: env(safe-area-inset-bottom, 0px);
    /* A solid surface, a firm top edge and a shadow: the bar reads as app chrome, not page content. */
    background: var(--chrome);
    border-top: 1px solid var(--border-strong);
    box-shadow: var(--chrome-shadow);
  }
  .tabbar ul {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    max-width: var(--max);
    margin: 0 auto;
    padding: 0;
    list-style: none;
  }
  .tabbar a {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    min-height: 3.75rem;
    color: var(--ink);
    font-size: 0.75rem;
    font-weight: 600;
    text-decoration: none;
  }
  .tabbar svg { width: 24px; height: 24px; padding: 3px 12px; box-sizing: content-box; border-radius: 999px; color: var(--tab-c); }
  .tabbar .t-work { --tab-c: var(--c-work); }
  .tabbar .t-experience { --tab-c: var(--c-experience); }
  .tabbar .t-projects { --tab-c: var(--c-projects); }
  .tabbar .t-ai { --tab-c: var(--c-ai-a); }
  .tabbar .t-certs { --tab-c: var(--c-certs); }

  /* Two-tone icons: a soft tint of the icon's colour, a crisp outline and one solid detail. */
  .ico .duo { fill: color-mix(in srgb, currentColor 20%, transparent); }
  .ico .solid { fill: currentColor; stroke: none; }
  .ico .grad { fill: url(#tabAiGrad); stroke: url(#tabAiGrad); }
  .ico .ai-a { stop-color: var(--c-ai-a); }
  .ico .ai-b { stop-color: var(--c-ai-b); }
  .q-play { color: var(--c-play); }
  .q-contact { color: var(--c-contact); }
  .theme-toggle .icon-moon { color: var(--c-moon); }
  .theme-toggle .icon-sun { color: var(--c-sun); }
  .theme-toggle .duo { fill: color-mix(in srgb, currentColor 22%, transparent); }
  @media (hover: hover) { .tabbar a:hover { color: var(--ink); } }
  .tabbar a[aria-current="true"] { font-weight: 800; }
  .tabbar a[aria-current="true"] svg { background: color-mix(in srgb, var(--tab-c) 16%, transparent); }
  .tabbar a[aria-current="true"]::before {
    content: "";
    position: absolute;
    top: 0;
    left: 18%;
    right: 18%;
    height: 3px;
    border-radius: 0 0 3px 3px;
    background: var(--tab-c);
  }
}

/* Phones: project cards. Slimmer padding for more text width; "Where the AI fits" as a tinted
   callout with the AI sparkle; compact stack chips; any small note, then an equal-width button
   pair kept at the bottom of every slide, so the buttons don't jump as the carousel moves (they stack on very narrow
   phones). */
@media (max-width: 760px) {
  .card-featured.has-media { padding: var(--s-4); }
  .card-featured.has-media .card-media { margin: calc(-1 * var(--s-4)) calc(-1 * var(--s-4)) var(--s-4); }
  .card-featured.has-media h3 { font-size: 1.25rem; line-height: 1.25; margin-bottom: var(--s-2); }
  .card-featured.has-media .card-main > p:not(.card-note) { margin-bottom: var(--s-4); }
  .card-ai {
    margin-bottom: var(--s-4);
    padding: var(--s-3);
    background: color-mix(in srgb, var(--c-ai-a) 8%, transparent);
    border-left: 3px solid var(--c-ai-a);
    border-radius: 0 var(--r-control) var(--r-control) 0;
    font-size: 0.95rem;
    line-height: 1.5;
  }
  .card-ai .meta-label {
    display: flex;
    align-items: center;
    gap: var(--s-2);
    margin: 0 0 var(--s-1);
    color: var(--c-ai-a);
    font-weight: 700;
  }
  .card-ai .meta-label::before {
    content: "";
    width: 1rem;
    height: 1rem;
    background: linear-gradient(135deg, var(--c-ai-a), var(--c-ai-b));
    -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M10.5 2.5l2 5.4a2 2 0 0 0 1.2 1.2l5.4 2-5.4 2a2 2 0 0 0-1.2 1.2l-2 5.4-2-5.4a2 2 0 0 0-1.2-1.2l-5.4-2 5.4-2a2 2 0 0 0 1.2-1.2Z'/%3E%3Cpath d='M19 2l.8 1.9 1.9.8-1.9.8L19 7.4l-.8-1.9-1.9-.8 1.9-.8Z'/%3E%3C/svg%3E") center / contain no-repeat;
    mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M10.5 2.5l2 5.4a2 2 0 0 0 1.2 1.2l5.4 2-5.4 2a2 2 0 0 0-1.2 1.2l-2 5.4-2-5.4a2 2 0 0 0-1.2-1.2l-5.4-2 5.4-2a2 2 0 0 0 1.2-1.2Z'/%3E%3Cpath d='M19 2l.8 1.9 1.9.8-1.9.8L19 7.4l-.8-1.9-1.9-.8 1.9-.8Z'/%3E%3C/svg%3E") center / contain no-repeat;
  }
  .card-featured.has-media .tags { gap: var(--s-1) var(--s-2); margin-bottom: var(--s-4); }
  .card-featured.has-media .tag { padding: 0.15rem 0.6rem; font-size: 0.8rem; }
  .card-featured.has-media .actions {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(9.5rem, 1fr));
    margin-top: auto;
  }
  /* The note moves above the buttons, so the buttons end every card at the same height. */
  .card-featured.has-media .card-note { order: 5; margin: auto 0 var(--s-3); font-size: 0.85rem; }
  .card-featured.has-media .actions { order: 6; }
  .card-featured.has-media:has(.card-note) .actions { margin-top: 0; }
}

/* Phones: the certificate row runs to the screen edges with one tile in view and the next peeking
   in, which shows there is more; each tile snaps to the left margin. */
@media (max-width: 760px) {
  .certs {
    margin-inline: calc(-1 * var(--gutter));
    padding-inline: var(--gutter);
    scroll-padding-inline: var(--gutter);
  }
  .cert { flex: 0 0 min(72%, 260px); }
}

/* Phones: case-study cards read top to bottom — company and years as a small label, the title,
   the role, the result as a tinted callout, then a clear "Read the case study" row with the
   chevron. The meta line's parts become grid items of the summary; the separator is hidden. */
@media (max-width: 760px) {
  .case > summary {
    grid-template-columns: 1fr auto;
    gap: var(--s-2) var(--s-3);
  }
  .case-meta { display: contents; }
  .case-sep { display: none; }
  .case-org {
    grid-column: 1 / -1;
    grid-row: 1;
    color: var(--primary);
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
  }
  .case-title { grid-column: 1 / -1; grid-row: 2; font-size: 1.2rem; line-height: 1.25; }
  .case-role { grid-column: 1 / -1; grid-row: 3; color: var(--ink-muted); font-size: 0.92rem; line-height: 1.4; }
  .case-outcome {
    grid-column: 1 / -1;
    grid-row: 4;
    display: flex;
    align-items: flex-start;
    gap: var(--s-2);
    margin-top: var(--s-1);
    padding: var(--s-2) var(--s-3);
    background: color-mix(in srgb, var(--accent) 10%, transparent);
    border-radius: var(--r-control);
    line-height: 1.35;
  }
  .case-outcome::before {
    content: "";
    flex: none;
    width: 1.1rem;
    height: 1.1rem;
    margin-top: 0.1rem;
    background: var(--accent);
    -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3 17l6-6 4 4 8-8'/%3E%3Cpath d='M14 7h7v7'/%3E%3C/svg%3E") center / contain no-repeat;
    mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3 17l6-6 4 4 8-8'/%3E%3Cpath d='M14 7h7v7'/%3E%3C/svg%3E") center / contain no-repeat;
  }
  /* The tap row: a label (decorative to screen readers, which already announce expanded or
     collapsed) sharing the last row with the chevron. */
  .case > summary::after {
    content: "Read the case study";
    content: "Read the case study" / "";
    grid-column: 1 / -1;
    grid-row: 5;
    margin-top: var(--s-2);
    padding-top: var(--s-3);
    border-top: 1px solid var(--border);
    color: var(--primary);
    font-size: 0.92rem;
    font-weight: 700;
  }
  .case[open] > summary::after { content: "Hide details"; content: "Hide details" / ""; }
  .case-chevron { grid-column: 2; grid-row: 5; align-self: end; margin-bottom: 0.15rem; }
  .case[open] { border-color: var(--border-strong); box-shadow: var(--shadow-raised); }
}

@media (max-width: 359px) {
  .nav-title { display: none; }
  .tabbar a { font-size: 0.7rem; }
}

@media (max-width: 639px) {
  :root { --gutter: 1rem; }
  body { font-size: 1rem; }
  .section { padding-top: var(--s-7); }
  .section:last-child { padding-bottom: var(--s-7); }
  /* The whole hero fits the first screen above the tab bar: the photo and the eyebrow already
     show in the header, and the two main actions sit side by side. */
  .hero { grid-template-columns: 1fr; gap: var(--s-4); padding: var(--s-5) 0 var(--s-5); }
  .hero .eyebrow { display: none; }
  .hero-photo { display: none; }
  .hero h1 { font-size: 2.25rem; }
  .hero-position { font-size: 1.15rem; }
  .section-head { font-size: 1.4rem; }
  .hero .actions { display: grid; grid-template-columns: 1fr 1fr; }
  .hero .actions .btn { padding-inline: var(--s-3); white-space: nowrap; }
  .hero .actions .text-link { grid-column: 1 / -1; justify-self: start; }
  /* A tab lands its section's heading just below the header, not after the section's top gap. */
  .section { scroll-margin-top: calc(var(--s-4) - var(--s-7)); }
  .outcomes { grid-template-columns: repeat(2, 1fr); gap: var(--s-5) var(--s-4); }
  .cards { grid-template-columns: 1fr; }
  .outcome-num { font-size: 1.8rem; }
  .case > summary { padding: var(--s-4); }
  .case-body { padding: 0 var(--s-4) var(--s-4); }
  .game-canvas { height: 200px; }
  .keyboard-hint { display: none; }
  .ask-row { flex-direction: column; align-items: stretch; }
  .ask-suggestions { flex-wrap: nowrap; overflow-x: auto; padding-bottom: var(--s-1); }
  .chip { flex: none; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .btn, .case-chevron { transition: none; }
  .dots span { animation: none; opacity: 1; }
  .btn:hover { transform: none; }
}
