/* ==========================================================================
   Ghareeb Thiab — CV
   One instrument, seen once: a warm grey housing, an off-white control face,
   a speaker-grille field, a tuning scale, and one orange "on" key.
   Spacing scale (px): 4 8 12 16 24 32 48 64 96 128
   ========================================================================== */

@font-face {
  font-family: "Inter";
  src: url("/fonts/inter-var-latin.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

/* ---------- Tokens ---------- */
:root {
  color-scheme: light;

  /* Housing and face: SK4 / T3 light grey */
  --housing: #E4E2DD;
  --face: #F4F3EF;
  --well: #EBE9E4;
  --ink: #1D1D1B;
  --text: #3A3936;
  --muted: #625F5A;
  --line: #CFCBC4;
  --hole: #A39E94;
  --key: #F7F6F2;
  --key-edge: #C9C5BD;
  --seg: #807B72;
  --accent: #E8590C;        /* lamps, needle, focus */
  --accent-text: #A3410A;   /* AA on housing and face */
  --key-on: #C24C08;        /* the orange key; white legend passes AA */
  --key-on-hover: #A9420A;
  --on-accent: #FFFFFF;
  --shade: 40, 34, 24;      /* rgb for shadows */

  --s1: 4px;  --s2: 8px;  --s3: 12px; --s4: 16px;  --s5: 24px;
  --s6: 32px; --s7: 48px; --s8: 64px; --s9: 96px;  --s10: 128px;

  --r-face: 28px;
  --r-well: 20px;
  --r-key: 12px;
  --maxw: 1120px;
  --gutter: 16px;
  --nav-h: 60px;

  --font: "Inter", -apple-system, BlinkMacSystemFont, "SF Pro Text", "Helvetica Neue", Helvetica, Arial, sans-serif;
  --ease: cubic-bezier(.16, 1, .3, 1);
}

/* Dark: the black ET66 */
:root[data-theme="dark"] {
  color-scheme: dark;
  --housing: #1A1918;
  --face: #242220;
  --well: #1E1D1B;
  --ink: #EEECE7;
  --text: #CBC8C1;
  --muted: #A29E95;
  --line: #3A3733;
  --hole: #0E0D0C;
  --key: #34312E;
  --key-edge: #121110;
  --seg: #6E6961;
  --accent: #FF7A2E;
  --accent-text: #FF9150;
  --key-on: #FF7A2E;
  --key-on-hover: #FF9150;
  --on-accent: #1A1918;
  --shade: 0, 0, 0;
}

/* No-JS fallback: follow the OS when no explicit theme is set */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) {
    color-scheme: dark;
    --housing: #1A1918; --face: #242220; --well: #1E1D1B; --ink: #EEECE7; --text: #CBC8C1;
    --muted: #A29E95; --line: #3A3733; --hole: #0E0D0C; --key: #34312E; --key-edge: #121110; --seg: #6E6961;
    --accent: #FF7A2E; --accent-text: #FF9150; --key-on: #FF7A2E; --key-on-hover: #FF9150;
    --on-accent: #1A1918; --shade: 0, 0, 0;
  }
}

@media (min-width: 720px) { :root { --gutter: 32px; --nav-h: 64px; } }

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--nav-h) + var(--s5));
  -webkit-text-size-adjust: 100%;
  scrollbar-color: var(--line) var(--housing);
}
body {
  margin: 0;
  font-family: var(--font);
  font-size: 16px;
  line-height: 26px;
  font-weight: 400;
  color: var(--text);
  background: var(--housing);
  caret-color: var(--accent);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-feature-settings: "cv11", "ss01", "tnum" 0;
  transition: background-color .5s var(--ease), color .5s var(--ease);
}
::selection { background: var(--accent); color: var(--on-accent); }
h1, h2, h3, h4 { color: var(--ink); font-weight: 600; margin: 0; text-wrap: balance; }
p, li { margin: 0; text-wrap: pretty; }
ul { margin: 0; padding: 0; list-style: none; }
img { display: block; max-width: 100%; height: auto; }
a { color: inherit; text-decoration-thickness: 1px; text-underline-offset: 4px; text-decoration-color: var(--line); }
a:hover { color: var(--accent-text); text-decoration-color: currentColor; }

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

.sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

.skip-link {
  position: absolute; inset-inline-start: var(--s4); top: -64px; z-index: 200;
  background: var(--ink); color: var(--housing);
  padding: var(--s2) var(--s4); border-radius: var(--r-key);
  text-decoration: none; transition: top .2s var(--ease);
}
.skip-link:focus { top: var(--s4); color: var(--housing); }

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

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

/* Group legends: small set text, like the printing beside a control */
.label {
  font-size: 13px; line-height: 20px; font-weight: 600; letter-spacing: .01em; color: var(--ink);
}

/* ---------- Keys ---------- */
.key {
  position: relative;
  display: inline-flex; align-items: center; justify-content: center; gap: var(--s2);
  min-height: 48px; padding: 0 var(--s5);
  font: inherit; font-size: 15px; font-weight: 500; line-height: 1; letter-spacing: -.005em;
  color: var(--ink); background: var(--key);
  border: 0; border-radius: var(--r-key);
  text-decoration: none; cursor: pointer; white-space: nowrap;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, .55),
    inset 0 -1px 0 rgba(var(--shade), .06),
    0 0 0 1px var(--key-edge),
    0 1px 2px rgba(var(--shade), .10),
    0 4px 10px -4px rgba(var(--shade), .18);
  transition: transform .18s var(--ease), box-shadow .18s var(--ease), background-color .25s var(--ease), color .25s var(--ease);
}
:root[data-theme="dark"] .key { box-shadow: inset 0 1px 0 rgba(255, 255, 255, .07), 0 0 0 1px var(--key-edge), 0 1px 2px rgba(0, 0, 0, .5), 0 6px 14px -6px rgba(0, 0, 0, .7); }
.key:hover { color: var(--ink); background: var(--face); }
:root[data-theme="dark"] .key:hover { background: #3C3935; }
.key:active {
  transform: translateY(1px);
  box-shadow: inset 0 1px 2px rgba(var(--shade), .14), 0 0 0 1px var(--key-edge);
}
.key-on { background: var(--key-on); color: var(--on-accent); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .22), 0 0 0 1px rgba(var(--shade), .18), 0 1px 2px rgba(var(--shade), .14), 0 6px 14px -6px rgba(194, 76, 8, .55); }
:root[data-theme="dark"] .key-on { box-shadow: inset 0 1px 0 rgba(255, 255, 255, .25), 0 0 0 1px rgba(0, 0, 0, .6), 0 1px 2px rgba(0, 0, 0, .5), 0 6px 14px -6px rgba(0, 0, 0, .7); }
.key-on:hover { background: var(--key-on-hover); color: var(--on-accent); }
:root[data-theme="dark"] .key-on:hover { background: var(--key-on-hover); }
.key-xs { min-height: 32px; padding: 0 10px; gap: 6px; font-size: 12px; font-weight: 500; border-radius: 8px; }
.key-xs .lamp { width: 6px; height: 6px; background: var(--line); box-shadow: none; transition: background-color .25s var(--ease); }
.copy-key.copied .lamp { background: var(--accent); }
.key-sm { min-height: 36px; padding: 0 var(--s3); font-size: 14px; border-radius: 10px; }

/* ---------- Theme switch: a Braun slide switch ---------- */
.switch {
  display: inline-flex; align-items: center; justify-content: center;
  width: 52px; height: 36px; padding: 0; margin: 0;
  background: transparent; border: 0; border-radius: 10px; cursor: pointer; color: var(--ink);
}
.switch-track {
  position: relative; display: block; width: 40px; height: 22px; border-radius: 11px;
  background: var(--well);
  box-shadow: inset 0 1px 3px rgba(var(--shade), .22), 0 0 0 1px var(--line);
}
/* Printed legends at each end: sun for light, moon for dark. The knob covers
   the current mode, so the visible one names where the switch goes. */
.switch-track::before, .switch-track::after {
  content: ""; position: absolute; top: 6px; width: 10px; height: 10px; background: var(--muted);
  -webkit-mask: var(--glyph) center / contain no-repeat; mask: var(--glyph) center / contain no-repeat;
}
.switch-track::before {
  inset-inline-start: 6px;
  --glyph: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10 10'%3E%3Ccircle cx='5' cy='5' r='2.2'/%3E%3Cg stroke='%23000' stroke-width='1.1' stroke-linecap='round'%3E%3Cpath d='M5 .6v1.1M5 8.3v1.1M.6 5h1.1M8.3 5h1.1M1.9 1.9l.8.8M7.3 7.3l.8.8M1.9 8.1l.8-.8M7.3 2.7l.8-.8'/%3E%3C/g%3E%3C/svg%3E");
}
.switch-track::after {
  inset-inline-end: 6px;
  --glyph: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10 10'%3E%3Cpath d='M8.6 6.3A4 4 0 1 1 3.7 1.4a3.2 3.2 0 0 0 4.9 4.9Z'/%3E%3C/svg%3E");
}
.switch-knob {
  z-index: 1;
  position: absolute; top: 3px; inset-inline-start: 3px; width: 16px; height: 16px; border-radius: 50%;
  background: var(--key);
  box-shadow: 0 0 0 1px var(--key-edge), 0 1px 2px rgba(var(--shade), .25);
  transition: inset-inline-start .35s var(--ease), background-color .35s var(--ease);
}
.switch-knob::after {
  content: ""; position: absolute; inset: 6px; border-radius: 50%; background: var(--accent);
  opacity: 0; transition: opacity .35s var(--ease);
}
.switch[aria-pressed="true"] .switch-knob { inset-inline-start: 21px; }
.switch[aria-pressed="true"] .switch-knob::after { opacity: 1; }

/* ---------- Navigation ---------- */
.nav {
  position: sticky; top: 0; z-index: 100;
  background: var(--housing);
  border-bottom: 1px solid transparent;
  transition: border-color .3s var(--ease), background-color .5s var(--ease);
}
.nav.scrolled { border-bottom-color: var(--line); }
.nav-inner {
  display: flex; align-items: center; justify-content: space-between; gap: var(--s4);
  height: var(--nav-h);
}
.brand {
  font-weight: 600; font-size: 15px; letter-spacing: -.01em;
  color: var(--ink); text-decoration: none; white-space: nowrap;
}
.brand:hover { color: var(--ink); }
.nav-right { display: flex; align-items: center; gap: var(--s2); }
.nav-links { display: flex; gap: 2px; }
.nav-links a {
  position: relative;
  font-size: 14px; color: var(--muted); text-decoration: none; white-space: nowrap;
  padding: var(--s2) var(--s3);
  transition: color .2s var(--ease);
}
.nav-links a:hover, .nav-links a.active { color: var(--ink); }
/* Indicator lamp under the active section */
.nav-links a::after {
  content: ""; position: absolute; left: 50%; bottom: 0; width: 4px; height: 4px; margin-left: -2px;
  border-radius: 50%; background: var(--accent); opacity: 0; transform: scale(.4);
  transition: opacity .3s var(--ease), transform .3s var(--ease);
}
.nav-links a.active::after { opacity: 1; transform: none; }
.nav-toggle { display: none; }
@media (min-width: 1240px) {
  .nav-links a { padding-inline: 8px; }
  .nav-cv .txt { display: none; }
  .nav-cv { padding-inline: 10px; }
}

@media (max-width: 1239px) {
  .nav-toggle { display: inline-flex; }
  .nav-links {
    position: absolute; left: 0; right: 0; top: var(--nav-h);
    flex-direction: column; gap: 0;
    padding: var(--s2) var(--gutter) var(--s5);
    background: var(--housing); border-bottom: 1px solid var(--line);
    box-shadow: 0 16px 24px -16px rgba(var(--shade), .2);
    display: none;
  }
  .nav-links.open { display: flex; }
  .nav-links a { font-size: 17px; padding: var(--s3) 0; color: var(--ink); border-bottom: 1px solid var(--line); }
  .nav-links a:last-child { border-bottom: 0; }
  .nav-links a::after { left: auto; inset-inline-end: 0; bottom: 50%; margin: 0 0 -2px; }
}
.nav-links .menu-only { display: none; }
@media (max-width: 1239px) {
  .nav-links .menu-only { display: block; }
  .nav-links .menu-only:first-of-type { color: var(--accent-text); font-weight: 500; }
}
/* The nav copy of Brief / Full appears once the hero selector scrolls away */
.mode-sm { transition: opacity .3s var(--ease), visibility .3s; }
.nav:not(.show-mode) .mode-sm { opacity: 0; visibility: hidden; }
@media (max-width: 599px) {
  .nav-cv { display: none; }
  .brand { font-size: 14px; }
}

/* ---------- Hero: the device face ---------- */
.hero { padding-block: var(--s5) var(--s8); }
.face {
  display: grid; gap: var(--s6);
  padding: var(--s4) var(--s4) 0;
  background: var(--face);
  border-radius: var(--r-face);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, .7),
    0 0 0 1px rgba(var(--shade), .10),
    0 1px 2px rgba(var(--shade), .08);
}
:root[data-theme="dark"] .grille { background-color: #262422; --hole: #0B0A09; }
:root[data-theme="dark"] .face { box-shadow: inset 0 1px 0 rgba(255, 255, 255, .05), 0 0 0 1px rgba(0, 0, 0, .6), 0 1px 2px rgba(0, 0, 0, .5); }

/* Perforated speaker grille with the portrait set into it */
.grille {
  display: grid; place-items: center;
  min-height: 200px;
  border-radius: var(--r-well);
  background-color: var(--well);
  background-image: radial-gradient(circle at center, var(--hole) 0 2px, transparent 2.6px);
  background-size: 11px 11px;
  background-repeat: space;
  background-origin: content-box;
  background-clip: padding-box;
  padding: 14px;
  box-shadow: inset 0 1px 3px rgba(var(--shade), .14);
}
/* Mounted flush in the plate: a recessed bezel, no lift */
.portrait {
  padding: 6px; border-radius: 26px; background: var(--well);
  box-shadow: inset 0 1px 3px rgba(var(--shade), .22), 0 0 0 1px var(--line);
}
.portrait img { box-shadow: 0 0 0 1px rgba(var(--shade), .12); }
.portrait img {
  width: 128px; height: 128px; border-radius: 20px; object-fit: cover; background: var(--well);
}

.face-main { padding-inline: var(--s2); }
@media (max-width: 959px) {
  .grille { min-height: 0; padding: 12px; }
  .portrait { padding: 5px; border-radius: 22px; }
  .portrait img { width: 88px; height: 88px; border-radius: 17px; }
  .face { gap: var(--s5); }
  .face-main { display: flex; flex-direction: column; align-items: flex-start; }
  .face-main > .mode { order: 9; margin: var(--s5) 0 0; }
  .hero h1 { font-size: 40px; line-height: 42px; }
}
.hero h1 {
  font-size: 44px; line-height: 46px; letter-spacing: -.035em; font-weight: 600;
  margin-bottom: var(--s3);
}
.hero .title { font-size: 17px; line-height: 26px; color: var(--ink); font-weight: 500; margin-bottom: var(--s4); }
.hero .headline { font-size: 17px; line-height: 28px; color: var(--text); max-width: 54ch; margin-bottom: var(--s5); }

.hero-meta { display: flex; flex-wrap: wrap; gap: var(--s2) var(--s5); margin-bottom: var(--s4); font-size: 14px; color: var(--muted); }
.hero-meta .mi { display: inline-flex; align-items: center; gap: var(--s2); text-decoration: none; }
.hero-meta a.mi { color: var(--ink); }
.hero-meta a.mi:hover { color: var(--accent-text); }

.keys { display: flex; flex-wrap: wrap; gap: var(--s3); }
@media (max-width: 479px) {
  .keys { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s2); }
  .keys .key { padding-inline: var(--s3); }
}
.key-legend { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s2) var(--s3); margin-top: var(--s3); font-size: 13px; line-height: 20px; color: var(--muted); }

/* Availability: a lit lamp, the one thing every visitor should see */
.status { display: flex; align-items: baseline; gap: 10px; margin-bottom: var(--s5); font-size: 14px; line-height: 22px; color: var(--ink); max-width: 52ch; }
.lamp {
  flex: none; display: inline-block; width: 8px; height: 8px; border-radius: 50%;
  background: var(--accent); box-shadow: inset 0 1px 1px rgba(255, 255, 255, .45);
}
.status .lamp { transform: translateY(-1px); }

/* Brief / Full: a band selector. Two keys in a recess; the pressed one
   rises, lights its lamp, and says which CV you are reading. */
.mode {
  display: inline-grid; grid-template-columns: 1fr 1fr; gap: 4px;
  padding: 4px; margin-bottom: var(--s5);
  background: var(--well); border-radius: 14px;
  box-shadow: inset 0 1px 3px rgba(var(--shade), .18), 0 0 0 1px var(--line);
}
.mode-key {
  display: grid; grid-template-columns: auto 1fr; align-items: center; column-gap: 8px;
  min-height: 48px; padding: 6px 16px 6px 12px; text-align: start;
  font: inherit; color: var(--muted); background: transparent;
  border: 0; border-radius: 10px; cursor: pointer;
  transition: background-color .25s var(--ease), color .25s var(--ease), box-shadow .25s var(--ease);
}
.mode-key .lamp { grid-row: 1 / span 2; background: var(--line); box-shadow: none; transition: background-color .25s var(--ease); }
.mode-name { font-size: 15px; line-height: 20px; font-weight: 600; white-space: nowrap; }
.mode-sub { grid-column: 2; font-size: 12px; line-height: 16px; }
.mode-key:hover { color: var(--ink); }
.mode-key[aria-pressed="true"] {
  color: var(--ink); background: var(--key);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .55), 0 0 0 1px var(--key-edge), 0 1px 2px rgba(var(--shade), .12), 0 3px 8px -4px rgba(var(--shade), .2);
}
:root[data-theme="dark"] .mode-key[aria-pressed="true"] { box-shadow: inset 0 1px 0 rgba(255, 255, 255, .07), 0 0 0 1px var(--key-edge), 0 1px 2px rgba(0, 0, 0, .5); }
.mode-key[aria-pressed="true"] .lamp { background: var(--accent); }
.mode-key[aria-pressed="true"] .mode-sub { color: var(--muted); }

/* Compact copy in the nav, so the current view is always on screen */
.mode-sm { margin: 0; padding: 3px; gap: 2px; border-radius: 11px; }
.mode-sm .mode-key { min-height: 30px; padding: 0 10px; border-radius: 8px; column-gap: 6px; }
.mode-sm .mode-key .lamp { grid-row: auto; width: 6px; height: 6px; }
.mode-sm .mode-name { font-size: 13px; font-weight: 500; }
.mode-sm { display: none; }
@media (min-width: 720px) { .mode-sm { display: inline-grid; } }
@media (max-width: 479px) {
  .mode:not(.mode-sm) { display: grid; width: 100%; }
}
html:not(.js) .mode, html:not(.js) .copy-key { display: none !important; }

/* Readout along the base of the face */
.readout {
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-inline: calc(var(--s4) * -1);
  border-top: 1px solid var(--line);
}
.readout li { padding: var(--s5) var(--s5) var(--s5); border-inline-start: 1px solid var(--line); }
.readout li:nth-child(odd) { border-inline-start: 0; }
.readout li:nth-child(n+3) { border-top: 1px solid var(--line); }
.readout-num {
  display: block; font-size: 32px; line-height: 36px; font-weight: 500; letter-spacing: -.03em;
  color: var(--ink); font-variant-numeric: tabular-nums;
}
.readout-label { display: block; margin-top: var(--s1); font-size: 13px; line-height: 20px; color: var(--muted); max-width: 24ch; }

/* Model text printed on the housing below the face */
.cred-strip {
  display: flex; flex-wrap: wrap; gap: var(--s1) var(--s5);
  margin-top: var(--s5); padding-inline: var(--s5);
}
.cred-strip li { font-size: 13px; line-height: 20px; font-weight: 500; color: var(--muted); }

@media (min-width: 720px) {
  .face { padding: var(--s5) var(--s5) 0; }
  .readout { grid-template-columns: repeat(4, minmax(0, 1fr)); margin-inline: calc(var(--s5) * -1); }
  .readout li, .readout li:nth-child(odd) { border-inline-start: 1px solid var(--line); }
  .readout li:first-child { border-inline-start: 0; }
  .readout li:nth-child(n+3) { border-top: 0; }
}

@media (min-width: 960px) {
  .hero { padding-block: var(--s6) var(--s9); }
  .face {
    grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
    column-gap: var(--s7); row-gap: var(--s6);
    padding: var(--s5) var(--s5) 0;
  }
  .grille { min-height: 100%; aspect-ratio: auto; }
  .portrait { border-radius: 32px; padding: 8px; }
  .portrait img { width: 208px; height: 208px; border-radius: 24px; }
  .face-main { padding: var(--s7) var(--s5) var(--s5) 0; align-self: center; }
  .hero h1 { font-size: 64px; line-height: 64px; margin-bottom: var(--s4); }
  .hero .title { font-size: 19px; line-height: 28px; }
  .hero .headline { font-size: 18px; line-height: 30px; }
  .readout { grid-column: 1 / -1; }
  .readout li { padding: var(--s5) var(--s6) var(--s6); }
  .readout-num { font-size: 40px; line-height: 44px; }
  .cred-strip { padding-inline: var(--s6); }
}

/* ---------- Sections: legend column + body ---------- */
.sec { padding-block: var(--s8); }
.sec + .sec { border-top: 1px solid var(--line); }
.sec-grid { display: grid; gap: var(--s5); }
.sec-title { font-size: 22px; line-height: 30px; letter-spacing: -.02em; }
.sec-body { min-width: 0; }
.sec-body > .lead { color: var(--muted); max-width: 62ch; margin-bottom: var(--s6); }

@media (min-width: 960px) {
  .sec { padding-block: var(--s9); }
  .sec-grid { grid-template-columns: repeat(12, minmax(0, 1fr)); column-gap: var(--s5); }
  .sec-title {
    grid-column: 1 / span 3; position: sticky; top: calc(var(--nav-h) + var(--s6)); align-self: start;
    font-size: 20px; line-height: 28px; padding-inline-end: var(--s5);
  }
  .sec-body { grid-column: 4 / span 9; }
  .sec-body > .lead { font-size: 17px; line-height: 28px; }
}

/* ---------- Summary ---------- */
.summary-text { font-size: 18px; line-height: 30px; color: var(--text); max-width: 64ch; }
.summary-text:first-child { color: var(--ink); }
.summary-text + .summary-text { margin-top: var(--s4); }

/* ---------- Career dial: one band per track, one needle ---------- */
.career .role, .career .cert-list > li { scroll-margin-top: calc(var(--nav-h) + 150px); }
.dial-wrap {
  position: sticky; top: var(--nav-h); z-index: 5;
  pointer-events: none;
}
.dial-wrap .dial { pointer-events: auto; }
.dial {
  position: relative;
  padding-block: var(--s6) 30px;
  background: var(--housing);
  transition: background-color .5s var(--ease), padding .35s var(--ease);
}
.dial::after {
  content: ""; position: absolute; left: 0; right: 0; top: 100%; height: 20px; pointer-events: none;
  background: linear-gradient(var(--housing), transparent);
}
/* Once it sticks, the dial tightens */
.dial-wrap.stuck .dial { padding-block: var(--s2) 26px; }
html:not(.js) .dial-wrap { display: none; }
.dial {
  --name-w: 0px; --row: 12px; --gap: 5px; --years: 18px;
  --a: 0;
  display: grid; grid-template-columns: var(--name-w) minmax(0, 1fr);
}
.dial-names { display: none; }
.dial-field {
  grid-column: 2;
  position: relative;
  display: grid; grid-template-rows: var(--years) repeat(4, var(--row)); row-gap: var(--gap);
  padding-bottom: 6px;
  border-bottom: 1px solid var(--ink);
  /* Year rules through every band, quarter ticks on the base line */
  background-image:
    linear-gradient(to right, var(--line) 1px, transparent 1px),
    linear-gradient(to right, var(--muted) 1px, transparent 1px);
  background-size: calc(100% / 9) calc(100% - var(--years)), calc(100% / 36) 5px;
  background-position: 0 100%, 0 100%;
  background-repeat: repeat-x;
}
.dial-years { display: flex; }
.dial-years span {
  flex: 1 1 0; padding-inline-start: 4px;
  font-size: 12px; line-height: 16px; color: var(--muted); font-variant-numeric: tabular-nums;
}
.dial-track { position: relative; }
.dial-track::before {
  content: ""; position: absolute; left: 0; right: 0; top: 50%; height: 1px; background: var(--line);
}
.dial-seg, .dial-mark {
  position: absolute; top: 50%;
  padding: 0; margin: 0; border: 0; cursor: pointer;
  inset-inline-start: calc(var(--s) * 100%);
  transition: background-color .12s linear, transform .35s var(--ease);
}
.dial-seg {
  height: 8px; margin-top: -4px; border-radius: 4px;
  width: calc((var(--e) - var(--s)) * 100%); min-width: 8px;
  background: var(--seg);
}
.dial-mark {
  width: 8px; height: 8px; margin: -4px 0 0 -4px; border-radius: 50%;
  background: var(--face); box-shadow: inset 0 0 0 1.5px var(--muted);
}
/* Generous hit area around thin parts */
.dial-seg::before, .dial-mark::before { content: ""; position: absolute; inset: -8px -2px; }
.dial-seg:hover { background: var(--muted); }
.dial-mark:hover { box-shadow: inset 0 0 0 1.5px var(--ink); }
.dial-seg.on { background: var(--accent); }
.dial-mark.on { background: var(--accent); box-shadow: none; transform: scale(1.25); }
.dial-needle {
  position: absolute; top: calc(var(--years) - 2px); bottom: -10px; width: 2px; margin-inline-start: -1px;
  inset-inline-start: calc(var(--a) * 100%);
  background: var(--accent); border-radius: 1px; pointer-events: none;
  transition: inset-inline-start .45s var(--ease);
}
.dial-tag {
  position: absolute; top: calc(100% + 2px); inset-inline-start: 8px;
  font-size: 12px; line-height: 16px; font-weight: 600; color: var(--accent-text); white-space: nowrap;
}
.dial.flip .dial-tag { inset-inline-start: auto; inset-inline-end: 8px; }
.dial-tag-band { font-weight: 500; color: var(--muted); }
.dial-tag-band::after { content: " · "; }
@media (max-width: 719px) {
  .dial { --row: 16px; }
  .dial-field { grid-template-rows: var(--years) var(--row); }
  .dial-track:not(.on) { display: none; }
  .dial-seg { height: 10px; margin-top: -5px; border-radius: 5px; }
}
@media (max-width: 479px) {
  .dial-years span:nth-child(even) { visibility: hidden; }
}
@media (min-width: 720px) {
  .dial { --name-w: 136px; --row: 16px; --gap: 6px; --years: 20px; }
  .dial-names {
    display: grid; grid-template-rows: repeat(4, var(--row)); row-gap: var(--gap);
    padding-top: calc(var(--years) + var(--gap));
  }
  .dial-names li { font-size: 12px; line-height: var(--row); color: var(--muted); white-space: nowrap; }
  .dial-tag-band { display: none; }
  .dial-wrap.stuck .dial { --row: 12px; --gap: 4px; }
  .dial-seg { height: 10px; margin-top: -5px; border-radius: 5px; }
}
@media (min-width: 960px) {
  .dial { grid-column: 4 / span 9; }
  .career > .sec:first-of-type { padding-top: var(--s7); }
}

/* ---------- Roles (experience / teaching) ---------- */
.roles > .role { padding-block: var(--s6); border-top: 1px solid var(--line); }
.roles > .role:first-child { padding-top: 0; border-top: 0; }
.roles > .role:last-child { padding-bottom: 0; }
.role-head { display: grid; gap: var(--s1) var(--s5); }
.role-head h3 { font-size: 18px; line-height: 28px; letter-spacing: -.012em; }
.role-org { font-weight: 400; color: var(--muted); }
.role-dates { font-size: 14px; line-height: 22px; color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; transition: color .4s var(--ease); }
.role.tuned .role-head > .role-dates { color: var(--accent-text); }
.dial-names li.on { color: var(--ink); }
.role-loc { font-size: 14px; line-height: 22px; color: var(--muted); margin-top: var(--s1); }
.role-loc a { color: var(--muted); }
.role-loc a:hover { color: var(--accent-text); }
@media (min-width: 720px) {
  .role-head { grid-template-columns: minmax(0, 1fr) auto; align-items: baseline; }
}

.tag {
  display: inline-flex; align-items: center; gap: 6px; vertical-align: 2px; margin-inline-start: var(--s2);
  font-size: 12px; line-height: 16px; font-weight: 500; letter-spacing: .02em; color: var(--muted);
}
.tag::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--line); }
.tag-live::before { background: var(--accent); }

.subroles { margin-top: var(--s4); border-inline-start: 1px solid var(--line); padding-inline-start: var(--s4); display: grid; gap: var(--s2); }
.subrole-row { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 0 var(--s4); font-size: 15px; }
.subrole-row .t { color: var(--ink); font-weight: 500; }

.bullets { margin-top: var(--s4); display: grid; gap: var(--s2); max-width: 68ch; }
.bullets li { position: relative; padding-inline-start: var(--s5); }
.bullets li::before {
  content: ""; position: absolute; inset-inline-start: 2px; top: 12px;
  width: 8px; height: 1px; background: var(--muted);
}

/* ---------- Courses ---------- */
.courses-title { font-size: 18px; line-height: 28px; margin: var(--s8) 0 var(--s4); }
.courses { display: grid; gap: 0 var(--s6); grid-template-columns: minmax(0, 1fr); }
.course { padding-block: var(--s5); border-top: 1px solid var(--line); }
.course h4 { font-size: 16px; line-height: 24px; font-weight: 600; }
.course .meta { font-size: 14px; line-height: 22px; color: var(--muted); margin: var(--s1) 0 var(--s3); }
.course ul { display: grid; gap: var(--s1); }
.course li { font-size: 15px; line-height: 24px; position: relative; padding-inline-start: var(--s4); }
.course li::before { content: ""; position: absolute; inset-inline-start: 0; top: 11px; width: 6px; height: 1px; background: var(--muted); }
@media (min-width: 720px) { .courses { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* ---------- Certifications: a spec table ---------- */
.cert-group + .cert-group { margin-top: var(--s7); }
.cert-group > h3 { margin-bottom: var(--s3); }
.cert-list > li {
  display: grid; gap: 2px var(--s5); padding-block: var(--s4);
  border-top: 1px solid var(--line);
}
.cert-list > li:last-child { border-bottom: 1px solid var(--line); }
.cert .name { color: var(--ink); font-weight: 500; }
.cert .abbr { font-weight: 600; }
.cert .issuer { font-size: 14px; line-height: 22px; color: var(--muted); }
.cert .date { font-size: 14px; line-height: 22px; color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
@media (min-width: 720px) {
  .cert-list > li { grid-template-columns: minmax(0, 1fr) auto; align-items: baseline; }
  .cert .date { grid-column: 2; grid-row: 1; text-align: end; }
}

/* ---------- Education ---------- */
.edu-row { display: grid; gap: var(--s1) var(--s5); }
.edu-row .degree { font-size: 18px; line-height: 28px; }
.edu-row .school { color: var(--text); margin-top: var(--s1); }
.edu-row .ach { font-size: 14px; line-height: 22px; color: var(--muted); margin-top: var(--s1); }
@media (min-width: 720px) { .edu-row { grid-template-columns: minmax(0, 1fr) auto; align-items: baseline; } }

/* ---------- Skills: flat key caps ---------- */
.skills-grid { display: grid; gap: var(--s6) var(--s6); }
.skill-cat h3 { margin-bottom: var(--s3); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chips li {
  font-size: 14px; line-height: 20px; color: var(--ink);
  padding: 6px 10px; border-radius: 8px;
  background: var(--face);
  box-shadow: 0 0 0 1px rgba(var(--shade), .07), 0 1px 1px rgba(var(--shade), .06);
}
:root[data-theme="dark"] .chips li { box-shadow: 0 0 0 1px rgba(0, 0, 0, .5); }
@media (min-width: 720px) { .skills-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* ---------- Credential plate ---------- */
.plates { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s3); }
.plate { display: flex; }
.plate-link {
  flex: 1; display: flex; flex-direction: column; gap: var(--s1);
  min-height: 148px; padding: var(--s4);
  color: inherit; text-decoration: none; border-radius: 16px;
  box-shadow: inset 0 0 0 1px var(--line);
  transition: box-shadow .2s var(--ease);
}
.plate-link:hover { color: inherit; box-shadow: inset 0 0 0 1px var(--ink); }
.plate-link:hover .plate-verify { color: var(--accent-text); }
.plate-link:focus-visible { border-radius: 16px; }
.plate-code { font-size: 26px; line-height: 30px; font-weight: 600; letter-spacing: -.025em; color: var(--ink); }
.plate-name { font-size: 13px; line-height: 18px; color: var(--muted); }
.plate-meta {
  margin-top: auto; padding-top: var(--s2); border-top: 1px solid var(--line);
  display: flex; flex-wrap: wrap; justify-content: space-between; gap: 0 var(--s2);
  font-size: 12px; line-height: 16px; font-weight: 500; color: var(--ink); font-variant-numeric: tabular-nums;
}
.plate-verify { display: inline-flex; align-items: center; gap: 3px; color: var(--muted); transition: color .2s var(--ease); }
.ico-ext { width: 9px; height: 9px; flex: none; }
.plates-note { margin-top: var(--s3); font-size: 13px; line-height: 20px; color: var(--muted); }
.plates-note a { color: var(--ink); text-decoration-color: var(--muted); }
.verify { display: inline-flex; align-items: center; gap: 3px; color: var(--ink); text-decoration-color: var(--muted); white-space: nowrap; }
.chip-link { padding: 0 !important; }
.chip-link a { display: inline-flex; align-items: center; gap: 5px; padding: 6px 10px; border-radius: 8px; color: inherit; text-decoration: none; }
.chip-link a:hover { color: var(--accent-text); }
.cert-all-title { font-size: 18px; line-height: 28px; margin: var(--s8) 0 var(--s2); }
.cert-all > .lead { color: var(--muted); max-width: 62ch; margin-bottom: var(--s6); }
@media (min-width: 720px) { .plates { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (min-width: 1100px) { .plates { grid-template-columns: repeat(5, minmax(0, 1fr)); } .plate { min-height: 168px; } }

/* ---------- Brief view: the same CV, reduced to the scan ---------- */
[data-view="brief"] .bullets > li:not(.key-point),
[data-view="brief"] .subroles,
[data-view="brief"] .courses-title,
[data-view="brief"] .courses,
[data-view="brief"] #teaching .cert-group,
[data-view="brief"] .cert-all,
[data-view="brief"] .faq-more { display: none; }
[data-view="brief"] .bullets { margin-top: var(--s2); }
[data-view="brief"] .roles > .role { padding-block: var(--s4); }
[data-view="brief"] .roles > .role:first-child { padding-top: 0; }
[data-view="brief"] .sec { padding-block: var(--s7); }
@media (min-width: 960px) { [data-view="brief"] .sec { padding-block: var(--s8); } }

/* ---------- FAQ ---------- */
.faq-list { border-top: 1px solid var(--line); max-width: 760px; }
.faq-item { border-bottom: 1px solid var(--line); }
.faq-item summary {
  display: flex; justify-content: space-between; align-items: center; gap: var(--s4);
  padding-block: var(--s3); cursor: pointer; list-style: none;
  font-size: 15px; color: var(--text); font-weight: 400;
}
.faq-item[open] summary { color: var(--ink); font-weight: 500; }
.faq-item summary::-webkit-details-marker { display: none; }
/* A small round key with a plus that turns to a minus */
.faq-item summary::after {
  content: ""; flex: none; width: 24px; height: 24px; border-radius: 50%;
  background:
    linear-gradient(var(--ink), var(--ink)) center / 9px 1.5px no-repeat,
    linear-gradient(var(--ink), var(--ink)) center / 1.5px 9px no-repeat,
    var(--key);
  box-shadow: 0 0 0 1px var(--key-edge), 0 1px 2px rgba(var(--shade), .12);
  transition: transform .4s var(--ease);
}
.faq-item[open] summary::after {
  background:
    linear-gradient(var(--on-accent), var(--on-accent)) center / 9px 1.5px no-repeat,
    var(--key-on);
  box-shadow: 0 0 0 1px rgba(var(--shade), .18);
  transform: rotate(180deg);
}
.faq-item summary:hover::after { background-color: var(--face); }
.faq-item p { padding-bottom: var(--s5); color: var(--muted); max-width: 66ch; }
.faq-item p a { color: var(--ink); text-decoration-color: var(--muted); }
.faq-more { margin-top: var(--s5); max-width: 760px; }
.faq-more > summary {
  display: inline-flex; align-items: center; gap: var(--s2);
  min-height: 40px; padding: 0 var(--s4); cursor: pointer; list-style: none;
  font-size: 14px; font-weight: 500; color: var(--ink);
  background: var(--key); border-radius: var(--r-key);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .55), 0 0 0 1px var(--key-edge), 0 1px 2px rgba(var(--shade), .10);
}
.faq-more > summary::-webkit-details-marker { display: none; }
.faq-more > summary:hover { background: var(--face); }
.faq-count { font-weight: 400; color: var(--muted); }
.faq-more[open] > summary { margin-bottom: var(--s4); }
.faq-more[open] .faq-count { display: none; }

/* ---------- Contact ---------- */
.contact-box { display: grid; gap: var(--s6); }
.contact-list { display: grid; gap: var(--s3); }
.contact-list li { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s2) var(--s4); }
.contact-list .ci { display: inline-flex; align-items: center; gap: var(--s3); color: var(--ink); text-decoration: none; font-size: 17px; }
.contact-list li:first-child .ci { font-size: clamp(20px, 3.4vw, 32px); line-height: 1.2; font-weight: 500; letter-spacing: -.02em; }
.contact-list li:first-child .ico { width: 22px; height: 22px; }
.contact-list a.ci:hover { color: var(--accent-text); }
.contact-list span.ci { color: var(--muted); }
.contact-actions { display: flex; flex-wrap: wrap; gap: var(--s3); }

/* ---------- Footer ---------- */
footer { border-top: 1px solid var(--line); padding-block: var(--s6) var(--s7); font-size: 14px; line-height: 22px; color: var(--muted); }
footer .wrap { display: flex; flex-wrap: wrap; justify-content: space-between; gap: var(--s2) var(--s5); }
footer a { color: var(--muted); }
footer a:hover { color: var(--accent-text); }

/* ---------- Motion ---------- */
/* The dial tunes in: on first view its bars draw in career order and the
   needle sweeps from 2018 to the station in view. JS adds .pre before the
   dial is seen, so without JS everything is simply drawn. */
.dial-seg { transform-origin: left center; }
[dir="rtl"] .dial-seg { transform-origin: right center; }
.dial.pre .dial-seg { transform: scaleX(0); }
.dial.pre .dial-mark { opacity: 0; transform: scale(.4); }
.dial.pre .dial-needle { inset-inline-start: 0; opacity: 0; }
.dial.pre .dial-tag { opacity: 0; }
.dial.intro .dial-seg,
.dial.intro .dial-mark {
  transition:
    transform .55s var(--ease) calc(var(--s) * 700ms),
    opacity .3s linear calc(var(--s) * 700ms),
    background-color .12s linear;
}
.dial.intro .dial-needle { transition: inset-inline-start 1.1s var(--ease) .15s, opacity .2s linear .1s; }
.dial.intro .dial-tag { transition: opacity .3s linear 1.05s; }

/* Lamps power on rather than appear */
@keyframes lamp-on { from { opacity: .15; transform: scale(.6); } to { opacity: 1; transform: none; } }
.status .lamp { animation: lamp-on .7s var(--ease) .3s both; }
.copy-key.copied .lamp, .mode-key[aria-pressed="true"] .lamp { animation: lamp-on .22s var(--ease); }

/* FAQ answers ease open */
@keyframes answer-in { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }
.faq-item[open] > p, .faq-more[open] > .faq-list { animation: answer-in .24s var(--ease); }

/* Brief / Full and theme changes crossfade as one surface */
::view-transition-old(root), ::view-transition-new(root) { animation-duration: .32s; animation-timing-function: var(--ease); }
html.vt *, html.vt *::before, html.vt *::after { transition: none !important; }

/* Reduced motion: keep state, colour and opacity; drop travel */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .key:active { transform: none; }
  .dial-needle, .switch-knob { transition: none; }
  .dial-mark.on { transform: none; }
  .status .lamp, .copy-key.copied .lamp, .mode-key[aria-pressed="true"] .lamp { animation: none; }
  @keyframes answer-in { from { opacity: 0; } to { opacity: 1; } }
}

/* ---------- Print ---------- */
@media print {
  :root, :root[data-theme="dark"] {
    --housing: #fff; --face: #fff; --well: #fff; --ink: #000; --text: #111; --muted: #444; --line: #ccc;
  }
  body { font-size: 10.5pt; line-height: 1.45; background: #fff; }
  .nav, .skip-link, .keys, .key-legend, .contact-actions, .grille, .dial-wrap, .mode, .copy-key, .status .lamp { display: none !important; }
  .bullets, .bullets > li, .subroles, .courses-title, .courses, #teaching .cert-group, .cert-all, .faq-more { display: revert !important; }
  .face { display: block; box-shadow: none; padding: 0; }
  .face-main { padding: 0; }
  .readout { margin: 12pt 0 0; }
  .hero, .sec { padding-block: 12pt; }
  .sec-title { position: static; }
  .role, .cert-list > li, .course, .highlight, .faq-item { break-inside: avoid; }
  .faq-item p { display: block; }
  .chips li { box-shadow: none; border: 1px solid #ccc; }
  a { text-decoration: none; }
  .hero-meta a[href^="http"]::after, .contact-list a[href^="http"]::after { content: " (" attr(href) ")"; font-size: .85em; }
}
