/* ==========================================================================
   site.css. The page shell for kamal-mehta.com, version 7.
   Every color, size and curve comes from tokens.css. Nothing here names a
   color of its own; translucent shades are mixed from the tokens.
   ========================================================================== */

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

html {
  background: var(--bg);
  color-scheme: dark;
  scroll-behavior: smooth;
  scroll-padding-top: 84px;
  scrollbar-gutter: stable;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}
html.locked { overflow: hidden; }

body {
  margin: 0;
  min-width: 320px;
  color: var(--text);
  font-family: var(--font-body);
  font-size: var(--fs-body);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
  overflow-x: clip;
}

/* A fine grid that fades at the edges, and two faint lights. Fixed, so it
   is painted once and the page scrolls over it. */
body::before,
body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
}
body::before {
  background-image:
    linear-gradient(var(--line) 1px, transparent 1px),
    linear-gradient(90deg, var(--line) 1px, transparent 1px);
  background-size: 64px 64px;
  opacity: 0.4;
  -webkit-mask-image: radial-gradient(ellipse 80% 70% at 50% 40%, #000 0%, transparent 80%);
  mask-image: radial-gradient(ellipse 80% 70% at 50% 40%, #000 0%, transparent 80%);
}
body::after {
  background: var(--grad-soft);
  opacity: 0.35;
  -webkit-mask-image:
    radial-gradient(ellipse 50% 40% at 88% 0%, #000 0%, transparent 70%),
    radial-gradient(ellipse 45% 40% at 0% 100%, #000 0%, transparent 70%);
  mask-image:
    radial-gradient(ellipse 50% 40% at 88% 0%, #000 0%, transparent 70%),
    radial-gradient(ellipse 45% 40% at 0% 100%, #000 0%, transparent 70%);
}

h1, h2, h3, h4 { font-family: var(--font-display); font-weight: 700; margin: 0; color: var(--text); }
p { margin: 0; }
ul, ol { margin: 0; padding: 0; list-style: none; }
a { color: var(--accent); text-underline-offset: 3px; }
img, svg, canvas { display: block; max-width: 100%; }
img { height: auto; }
button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }

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

::selection { background: var(--accent); color: var(--text-on-accent); }

/* ------------------------------ helpers ------------------------------ */
.wrap {
  width: 100%;
  max-width: calc(var(--wrap) + 2 * var(--gutter));
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.label {
  font-family: var(--font-mono);
  font-size: var(--fs-micro);
  font-weight: 400;
  letter-spacing: var(--track-wide);
  text-transform: uppercase;
  color: var(--text-3);
  line-height: 1.5;
}

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

.skip {
  position: fixed;
  top: 10px; left: 10px;
  z-index: 200;
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 18px;
  background: var(--panel-solid);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-s);
  color: var(--text);
  text-decoration: none;
}
/* Standard skip link: visually hidden until focused (moved off-screen by a transform, it showed over the header on phones). */
.skip:not(:focus) {
  width: 1px; height: 1px; min-height: 0;
  margin: -1px; padding: 0; border: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
}

/* Sections that are drawn by the scripts stay out of the way until the
   scripts have run. With scripts off, the no-script list stands in. */
html:not(.js) .needs-js { display: none; }

/* --------------------------- the framed panel --------------------------- */
/* Dark glass, a thin luminous edge, one corner cut. The edge lives on a layer
   of its own so the cut corner gets a line too. */
.panel {
  --c: var(--cut);
  position: relative;
  background: var(--panel);
  border-radius: var(--r-s) 0 var(--r-s) var(--r-s);
  -webkit-clip-path: polygon(0 0, calc(100% - var(--c)) 0, 100% var(--c), 100% 100%, 0 100%);
  clip-path: polygon(0 0, calc(100% - var(--c)) 0, 100% var(--c), 100% 100%, 0 100%);
}
.panel::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 4;
  pointer-events: none;
  border: 1px solid var(--line);
  border-radius: inherit;
  background:
    linear-gradient(to top right,
      transparent calc(50% - 1.3px),
      var(--line-strong) calc(50% - 1.3px),
      var(--line-strong) 50%,
      transparent 50%)
    top right / var(--c) var(--c) no-repeat;
  transition: border-color var(--t-fast) var(--ease);
}

/* ------------------------------- buttons ------------------------------- */
.btn {
  --c: 10px;
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 48px;
  padding: 0 22px;
  border: 0;
  background: var(--panel-hi);
  color: var(--text);
  font-family: var(--font-display);
  font-size: 0.95rem;
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: 0.01em;
  text-decoration: none;
  text-align: center;
  -webkit-clip-path: polygon(0 0, calc(100% - var(--c)) 0, 100% var(--c), 100% 100%, 0 100%);
  clip-path: polygon(0 0, calc(100% - var(--c)) 0, 100% var(--c), 100% 100%, 0 100%);
  transition: transform var(--t-fast) var(--ease), background var(--t-fast) var(--ease), filter var(--t-fast) var(--ease);
}
.btn::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  border: 1px solid var(--line-strong);
  background:
    linear-gradient(to top right,
      transparent calc(50% - 1.3px),
      var(--line-strong) calc(50% - 1.3px),
      var(--line-strong) 50%,
      transparent 50%)
    top right / var(--c) var(--c) no-repeat;
}
.btn:hover { transform: translateY(-2px); background: var(--bg-3); filter: brightness(1.2); }
.btn:active { transform: none; }
.btn:focus-visible { outline: 2px solid var(--accent); outline-offset: -5px; }

.btn-primary { background: var(--grad); color: var(--text-on-accent); }
.btn-primary::after { display: none; }
.btn-primary:hover { background: var(--grad); filter: brightness(1.1) saturate(1.1); }
.btn-primary:focus-visible { outline-color: var(--text-on-accent); }

.btn-arrow { transition: transform var(--t-fast) var(--ease); }
.btn:hover .btn-arrow { transform: translateX(3px); }

.btn[disabled] { opacity: 0.6; cursor: default; transform: none; }

/* -------------------------------- tags -------------------------------- */
.tags { display: flex; flex-wrap: wrap; gap: 6px; }
.tag {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 9px;
  border: 1px solid var(--line);
  border-radius: 4px;
  font-family: var(--font-mono);
  font-size: 0.66rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-2);
  white-space: nowrap;
}

/* --------------------------- progress and header --------------------------- */
.progress {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 60;
  height: 2px;
  pointer-events: none;
}
.progress span {
  display: block;
  height: 100%;
  background: var(--grad);
  transform: scaleX(0);
  transform-origin: 0 50%;
}

.site-header {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 50;
  height: 64px;
  border-bottom: 1px solid transparent;
  transition: background var(--t-med) var(--ease), border-color var(--t-med) var(--ease);
}
.site-header.is-solid,
.site-header.is-open {
  background: var(--panel-solid);
  background: color-mix(in srgb, var(--bg-2) 82%, transparent);
  -webkit-backdrop-filter: blur(14px) saturate(1.3);
  backdrop-filter: blur(14px) saturate(1.3);
  border-bottom-color: var(--line);
}
.nav { display: flex; align-items: center; justify-content: space-between; height: 100%; gap: 16px; }

.brand {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  min-width: 44px;
  font-family: var(--font-display);
  font-size: 1.2rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--text);
  text-decoration: none;
}
.brand span { color: var(--accent); }

.nav-menu ul { display: flex; align-items: center; gap: 2px; }
.nav-menu a {
  position: relative;
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 11px;
  font-family: var(--font-mono);
  font-size: var(--fs-micro);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  text-decoration: none;
  color: var(--text-2);
  white-space: nowrap;
  transition: color var(--t-fast) var(--ease);
}
.nav-menu a:hover,
.nav-menu a.is-active { color: var(--text); }
.nav-menu a.is-active::after {
  content: "";
  position: absolute;
  left: 11px; right: 11px; bottom: 8px;
  height: 1px;
  background: var(--accent);
}
.nav-menu .nav-cta {
  margin-left: 8px;
  padding: 0 16px;
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  color: var(--text);
}
.nav-menu .nav-cta:hover { background: var(--grad-soft); }
.nav-menu .nav-cta.is-active::after { display: none; }

.nav-toggle {
  display: none;
  place-items: center;
  width: 44px; height: 44px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: var(--r-s);
  background: var(--panel);
}
.nav-toggle-bars { display: grid; gap: 5px; width: 18px; }
.nav-toggle-bars i {
  display: block;
  height: 1.5px;
  background: var(--text);
  transition: transform var(--t-fast) var(--ease), opacity var(--t-fast) var(--ease);
}
.nav-toggle[aria-expanded="true"] .nav-toggle-bars i:nth-child(1) { transform: translateY(6.5px) rotate(45deg); }
.nav-toggle[aria-expanded="true"] .nav-toggle-bars i:nth-child(2) { opacity: 0; }
.nav-toggle[aria-expanded="true"] .nav-toggle-bars i:nth-child(3) { transform: translateY(-6.5px) rotate(-45deg); }

/* Eleven links on one line, Learning, Notes and Beyond work included, need
   about 1,200px. Below 1,260px the menu folds behind the button. */
@media (max-width: 1260px) {
  .nav-toggle { display: inline-grid; }
  .nav-menu {
    position: absolute;
    top: 64px; left: 0; right: 0;
    display: none;
    max-height: calc(100vh - 64px);
    max-height: calc(100dvh - 64px);
    overflow-y: auto;
    padding: 8px var(--gutter) 24px;
    background: var(--panel-solid);
    border-bottom: 1px solid var(--line);
  }
  .nav-menu.is-open { display: block; }
  .nav-menu ul { flex-direction: column; align-items: stretch; gap: 0; }
  .nav-menu a {
    display: flex;
    min-height: 52px;
    padding: 0 4px;
    font-size: 0.8rem;
    border-bottom: 1px solid var(--line);
  }
  .nav-menu a.is-active::after { display: none; }
  .nav-menu a.is-active { color: var(--accent); }
  .nav-menu .nav-cta { margin: 16px 0 0; justify-content: center; border-bottom: 1px solid var(--line-strong); }
}

/* -------------------------------- hero -------------------------------- */
.hero {
  position: relative;
  isolation: isolate;
  display: flex;
  align-items: center;
  min-height: 100vh;
  min-height: 100svh;
  padding: 112px 0 104px;
  overflow: hidden;
}
.hero-canvas {
  position: absolute;
  inset: 0;
  z-index: -2;
  width: 100%;
  height: 100%;
  pointer-events: none;
  color: var(--accent);
}
/* A soft shade behind the text, and a fade into the page at the bottom. */
.hero-shade {
  position: absolute;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background: linear-gradient(90deg, var(--bg) 0%, transparent 72%);
  background:
    radial-gradient(ellipse 58% 72% at 20% 52%,
      color-mix(in srgb, var(--bg) 90%, transparent) 0%,
      color-mix(in srgb, var(--bg) 62%, transparent) 46%,
      transparent 78%),
    linear-gradient(to bottom,
      color-mix(in srgb, var(--bg) 66%, transparent) 0%,
      transparent 20%,
      transparent 74%,
      var(--bg) 100%);
}

.hero-inner { position: relative; }
/* The hero starts nearly visible rather than at zero opacity, so the first paint
   already holds the name and the role line (it is what a slow phone shows first). */
.hero-inner > * { animation: rise-hero var(--t-slow) var(--ease) both; }
.hero-inner > :nth-child(2) { animation-delay: 70ms; }
.hero-inner > :nth-child(3) { animation-delay: 140ms; }
.hero-inner > :nth-child(4) { animation-delay: 210ms; }
.hero-inner > :nth-child(5) { animation-delay: 280ms; }
.hero-inner > :nth-child(6) { animation-delay: 350ms; }
@keyframes rise {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: none; }
}
@keyframes rise-hero {
  from { opacity: 0.08; transform: translateY(12px); }
  to { opacity: 1; transform: none; }
}

.status {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 32px;
  padding: 0 14px 0 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--panel);
  font-family: var(--font-mono);
  font-size: var(--fs-micro);
  letter-spacing: var(--track-wide);
  text-transform: uppercase;
  color: var(--text);
}
.status-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--accent-3);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent-3) 18%, transparent), 0 0 14px var(--accent-3);
}

.hero-name {
  margin-top: 22px;
  font-size: var(--fs-hero);
  line-height: 1;
  letter-spacing: -0.035em;
}
.hero-role {
  margin-top: 18px;
  font-family: var(--font-display);
  font-size: var(--fs-h2);
  font-weight: 600;
  line-height: 1.2;
  color: var(--text);
}
.role-stack { display: grid; }
.role {
  grid-area: 1 / 1;
  opacity: 0;
  transition: opacity var(--t-slow) var(--ease-in-out);
}
.role.is-on { opacity: 1; }

.hero-lede {
  margin-top: 16px;
  max-width: 46ch;
  font-size: 1.08rem;
  color: var(--text-2);
}
.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 32px; }

.hero-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: clamp(16px, 3vw, 40px);
  max-width: 780px;
  margin: clamp(36px, 6vh, 64px) 0 0;
}
.stat {
  position: relative;
  display: flex;
  flex-direction: column-reverse;
  justify-content: flex-end;
  gap: 6px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}
.stat::before {
  content: "";
  position: absolute;
  top: -1px; left: 0;
  width: 28px; height: 1px;
  background: var(--accent);
}
.stat dt {
  font-family: var(--font-mono);
  font-size: var(--fs-micro);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  line-height: 1.5;
  color: var(--text-2);
}
.stat dd {
  margin: 0;
  font-family: var(--font-mono);
  font-size: clamp(1.9rem, 3.6vw, 2.8rem);
  font-weight: 600;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  color: var(--accent);
}
@supports ((-webkit-background-clip: text) or (background-clip: text)) {
  .stat dd {
    display: inline-block;
    align-self: flex-start;
    background: var(--grad);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    color: transparent;
  }
}

.hero-readout {
  position: absolute;
  right: var(--gutter);
  bottom: 34px;
  margin: 0;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

/* corner ticks */
.tick {
  position: absolute;
  width: 14px; height: 14px;
  pointer-events: none;
  border: 0 solid var(--line-strong);
}
.tick-tl { top: 84px; left: calc(var(--gutter) / 2); border-top-width: 1px; border-left-width: 1px; }
.tick-tr { top: 84px; right: calc(var(--gutter) / 2); border-top-width: 1px; border-right-width: 1px; }
.tick-bl { bottom: 24px; left: calc(var(--gutter) / 2); border-bottom-width: 1px; border-left-width: 1px; }
.tick-br { bottom: 24px; right: calc(var(--gutter) / 2); border-bottom-width: 1px; border-right-width: 1px; }

@media (max-width: 720px) {
  .hero { padding: 96px 0 88px; }
  .hero-shade {
    background: linear-gradient(to bottom, var(--bg), transparent 30%, transparent 70%, var(--bg));
    background:
      radial-gradient(ellipse 130% 62% at 50% 46%,
        color-mix(in srgb, var(--bg) 88%, transparent) 0%,
        color-mix(in srgb, var(--bg) 60%, transparent) 55%,
        transparent 90%),
      linear-gradient(to bottom,
        color-mix(in srgb, var(--bg) 66%, transparent) 0%,
        transparent 18%,
        transparent 76%,
        var(--bg) 100%);
  }
  .hero-actions .btn { flex: 1 1 auto; }
  .hero-actions .btn-primary { flex-basis: 100%; }
  .hero-stats { grid-template-columns: 1fr; gap: 0; }
  .stat {
    flex-direction: row-reverse;
    justify-content: flex-end;
    align-items: center;
    gap: 16px;
    padding: 14px 0;
  }
  .stat dd { flex: none; min-width: 3.4ch; font-size: 1.7rem; align-self: center; }
  .hero-readout { left: var(--gutter); right: auto; bottom: 28px; }
  .tick-tl, .tick-tr { top: 76px; }
}

/* ------------------------------ sections ------------------------------ */
main { counter-reset: sec; }

.section {
  position: relative;
  padding: var(--section) 0;
}
.section::before {
  content: "";
  position: absolute;
  top: 0;
  left: var(--gutter); right: var(--gutter);
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--line) 14%, var(--line) 86%, transparent);
}

.sec-head { max-width: 780px; margin-bottom: clamp(28px, 4vw, 52px); }
.sec-kicker {
  display: flex;
  align-items: center;
  gap: 12px;
  font-family: var(--font-mono);
  font-size: var(--fs-micro);
  letter-spacing: var(--track-wide);
  text-transform: uppercase;
  color: var(--accent);
}
.sec-idx {
  padding-right: 12px;
  border-right: 1px solid var(--line-strong);
  color: var(--text-2);
}
.sec-idx::before { counter-increment: sec; content: counter(sec, decimal-leading-zero); }
.sec-head h2 {
  margin-top: 14px;
  font-size: var(--fs-h1);
  line-height: 1.08;
  letter-spacing: -0.025em;
  text-wrap: balance;
}
.sec-sub { margin-top: 16px; max-width: 64ch; color: var(--text-2); }
.sec-sub.label { color: var(--text-3); }

/* ------------------------------ tour band ------------------------------ */
.tour-band {
  --c: 22px;
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
  gap: clamp(24px, 4vw, 56px);
  align-items: center;
  padding: clamp(24px, 4vw, 52px);
  background:
    radial-gradient(ellipse 70% 120% at 100% 0%, color-mix(in srgb, var(--accent-2) 14%, transparent), transparent 60%),
    var(--panel);
}
.tour-copy .sec-head { margin-bottom: 0; }
.tour-copy .sec-head h2 { font-size: var(--fs-h2); font-size: clamp(1.6rem, 2.8vw, 2.4rem); }
.tour-copy .btn { margin-top: 28px; }

.tour-tiles {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}
.tile {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 8px;
  height: 100%;
  min-height: 118px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--r-s);
  background: var(--bg-2);
  color: var(--text);
  text-decoration: none;
  transition: transform var(--t-fast) var(--ease), border-color var(--t-fast) var(--ease), background var(--t-fast) var(--ease);
}
.tile:hover { transform: translateY(-2px); border-color: var(--line-strong); background: var(--bg-3); }
.tile-name { font-size: 0.86rem; line-height: 1.35; color: var(--text); }
.tile-metric {
  margin-top: auto;
  font-family: var(--font-mono);
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--accent-3);
}

/* A stop that is not a project: career, education, and so on. */
.tile.is-stop {
  border-style: dashed;
  border-color: var(--line-strong);
  border-color: color-mix(in srgb, var(--accent-2) 45%, transparent);
  background: var(--bg-2);
  background: color-mix(in srgb, var(--accent-2) 7%, var(--bg-2));
}
.tile-tag {
  align-self: flex-start;
  margin-top: auto;
  padding: 2px 8px;
  border: 1px solid var(--accent-2);
  border-radius: 999px;
  font-family: var(--font-mono);
  font-size: var(--fs-micro);
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent-2);
}

/* Fifteen stops: the copy goes on top and the tiles take the full width. */
.tour-band.is-many { grid-template-columns: 1fr; align-items: start; }
.tour-band.is-many .tour-copy {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0 clamp(24px, 4vw, 56px);
  align-items: end;
}
.tour-band.is-many .tour-copy .sec-head,
.tour-band.is-many .tour-copy .sec-sub { grid-column: 1; }
.tour-band.is-many .tour-copy .btn { grid-column: 2; grid-row: 1 / span 2; align-self: end; margin-top: 0; }
.tour-tiles.is-many { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.tour-tiles.is-many .tile { min-height: 104px; }

@media (max-width: 1100px) {
  .tour-tiles.is-many { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 980px) {
  .tour-band { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
  .tour-band.is-many .tour-copy { grid-template-columns: 1fr; }
  .tour-band.is-many .tour-copy .btn { grid-column: 1; grid-row: auto; margin-top: 24px; justify-self: start; }
}
@media (max-width: 620px) {
  .tour-tiles,
  .tour-tiles.is-many { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .tour-copy .btn,
  .tour-band.is-many .tour-copy .btn { width: 100%; }
  .tour-tiles.is-many .tile { min-height: 92px; padding: 12px; }
}

/* --------------------------- filters and grids --------------------------- */
.filters { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--panel);
  font-family: var(--font-mono);
  font-size: var(--fs-micro);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-2);
  transition: color var(--t-fast) var(--ease), border-color var(--t-fast) var(--ease), background var(--t-fast) var(--ease);
}
.chip:hover { color: var(--text); border-color: var(--line-strong); }
.chip[aria-pressed="true"] {
  color: var(--text);
  border-color: var(--line-strong);
  background: var(--grad-soft);
}
.chip-n { color: var(--text-3); font-variant-numeric: tabular-nums; }
.chip[aria-pressed="true"] .chip-n { color: var(--accent); }

.filter-status {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 12px;
  min-height: 44px;
  margin: 10px 0 14px;
  font-size: var(--fs-small);
  color: var(--text-2);
}
.filter-status strong { color: var(--text); font-weight: 600; }
.filter-clear {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 10px;
  border: 0;
  background: none;
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: var(--fs-micro);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.grid { display: grid; gap: clamp(14px, 1.6vw, 22px); }
.grid-featured { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-more { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-label {
  display: flex;
  align-items: center;
  gap: 16px;
  margin: clamp(32px, 4vw, 56px) 0 18px;
}
.grid-label::after { content: ""; flex: 1; height: 1px; background: var(--line); }

@media (max-width: 1180px) { .grid-more { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 980px) {
  .grid-featured, .grid-more { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 620px) {
  .grid-featured, .grid-more { grid-template-columns: 1fr; }
}

/* -------------------------------- cards -------------------------------- */
.slot { display: flex; min-width: 0; }
.card {
  display: flex;
  flex-direction: column;
  width: 100%;
  min-width: 0;
  transition: transform var(--t-med) var(--ease), background var(--t-med) var(--ease);
}
.card:hover,
.card:focus-within { transform: translateY(-4px); background: var(--panel-hi); }
.card:hover::after,
.card:focus-within::after { border-color: var(--line-strong); }

.card-still {
  position: relative;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  border-bottom: 1px solid var(--line);
  background:
    radial-gradient(ellipse 90% 90% at 85% 0%, color-mix(in srgb, var(--accent) 20%, transparent), transparent 62%),
    radial-gradient(ellipse 80% 90% at 0% 100%, color-mix(in srgb, var(--accent-2) 20%, transparent), transparent 62%),
    var(--bg-3);
}
.card-still::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(var(--line) 1px, transparent 1px),
    linear-gradient(90deg, var(--line) 1px, transparent 1px);
  background-size: 28px 28px;
  -webkit-mask-image: linear-gradient(to bottom, #000, transparent);
  mask-image: linear-gradient(to bottom, #000, transparent);
}
.card-still.has-still::before { display: none; }
.card-still > svg,
.card-still > canvas,
.card-still > img { width: 100%; height: 100%; }
.card-mark {
  position: absolute;
  left: 16px; bottom: 12px;
  font-family: var(--font-mono);
  font-size: 2.4rem;
  font-weight: 600;
  line-height: 1;
  color: var(--muted-mark);
}
.card-still.has-still .card-mark { display: none; }
.grid-more .card-still { aspect-ratio: 16 / 8; }
.grid-more .card-mark { font-size: 1.8rem; }

.card-body {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 12px;
  padding: clamp(16px, 1.6vw, 22px);
}
.card-title { font-size: 1.12rem; line-height: 1.3; letter-spacing: -0.01em; font-weight: 600; }
.card-title a { color: var(--text); text-decoration: none; }
.card-title a::after { content: ""; position: absolute; inset: 0; z-index: 3; }
.card-title a:focus-visible { outline: none; }
.card:focus-within { outline: 2px solid var(--accent); outline-offset: -4px; }
.grid-more .card-title { font-size: 1rem; }

.metric { display: flex; flex-direction: column; gap: 4px; }
.metric-v {
  font-family: var(--font-mono);
  font-size: clamp(1.7rem, 2.4vw, 2.2rem);
  font-weight: 600;
  line-height: 1.05;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
  color: var(--accent-3);
}
.metric-v.is-text { font-size: 1.25rem; letter-spacing: 0; color: var(--text); }
.metric-l { font-size: var(--fs-small); line-height: 1.4; color: var(--text-2); }
.grid-more .metric-v { font-size: 1.5rem; }
.grid-more .metric-v.is-text { font-size: 1.1rem; }

.card-sum {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
  line-clamp: 3;
  overflow: hidden;
  font-size: var(--fs-small);
  color: var(--text-2);
}
.card .tags { margin-top: auto; padding-top: 4px; }

/* ------------------------------ how I work ------------------------------ */
.how {
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
  gap: clamp(28px, 5vw, 80px);
  align-items: start;
}
.how-side .sec-head { margin-bottom: 24px; }
.how-about { display: grid; gap: 26px; color: var(--text-2); }

/* what I built: three tiles */
.how-built { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.how-tile {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
  padding: 13px 14px 15px;
  border: 1px solid var(--line);
  border-top: 2px solid var(--tc);
  border-radius: 10px;
  background: var(--bg-2);
  background: color-mix(in srgb, var(--tc) 7%, var(--bg-2));
}
.how-tile-tag {
  font-family: var(--font-mono);
  font-size: var(--fs-micro);
  font-weight: 600;
  letter-spacing: var(--track-wide);
  text-transform: uppercase;
  color: var(--tt);
}
.how-tile-t { font-family: var(--font-display); font-size: 1rem; font-weight: 600; line-height: 1.3; color: var(--text); }
.how-tile-s { font-size: 0.82rem; line-height: 1.45; color: var(--text-2); }

/* the numbered steps, joined by a line like a study note's lab map */
.how-list { display: grid; counter-reset: none; }
.how-item {
  position: relative;
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr);
  gap: 8px;
  padding: 0 0 26px;
}
.how-item:last-child { padding-bottom: 0; }
.how-item::before {
  content: "";
  position: absolute;
  top: 38px; bottom: 4px; left: 17px;
  width: 2px;
  background: linear-gradient(to bottom, var(--line-strong), var(--line));
}
.how-item:last-child::before { display: none; }
.how-num {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border: 1.5px solid var(--accent);
  border-radius: 50%;
  background: var(--bg-2);
  font-family: var(--font-mono);
  font-size: var(--fs-small);
  font-weight: 600;
  color: var(--accent);
  box-shadow: 0 0 12px color-mix(in srgb, var(--accent) 30%, transparent);
}
.how-item h3 { padding-top: 6px; font-size: var(--fs-h3); line-height: 1.35; font-weight: 600; }
.how-item p { margin-top: 4px; font-size: var(--fs-small); color: var(--text-2); }

@media (max-width: 980px) { .how { grid-template-columns: 1fr; } }
@media (max-width: 560px) {
  .how-built { grid-template-columns: 1fr; }
  .how-tile { display: grid; grid-template-columns: 5.5rem minmax(0, 1fr); gap: 2px 12px; align-items: baseline; }
  .how-tile-tag { grid-row: 1 / span 2; }
}
@media (max-width: 480px) { .how-item { grid-template-columns: 46px minmax(0, 1fr); } }

/* ------------------------------- timeline ------------------------------- */
.timeline { position: relative; display: grid; gap: clamp(28px, 4vw, 48px); padding-left: 28px; }
.timeline::before {
  content: "";
  position: absolute;
  top: 8px; bottom: 8px; left: 4px;
  width: 1px;
  background: linear-gradient(to bottom, var(--accent), var(--accent-2), transparent);
  opacity: 0.6;
}
.job {
  position: relative;
  display: grid;
  grid-template-columns: 250px minmax(0, 1fr);
  gap: 8px clamp(20px, 3vw, 48px);
}
.job::before {
  content: "";
  position: absolute;
  top: 6px; left: -28px;
  width: 9px; height: 9px;
  border: 1px solid var(--tc, var(--accent));
  border-radius: 50%;
  background: var(--bg);
  box-shadow: 0 0 12px var(--tc, var(--accent));
}
.job-when { display: grid; gap: 4px; align-content: start; }
.job-when .label { color: var(--text-2); }
.job-dur { color: var(--text-3); }
.job-count { margin-top: 10px; font-size: var(--fs-small); line-height: 1.3; color: var(--text-2); }
.job-count-n {
  display: block;
  font-family: var(--font-mono);
  font-size: 1.6rem;
  font-weight: 600;
  line-height: 1.1;
  color: var(--tt, var(--accent-3));
}
.job h3 { font-size: var(--fs-h3); line-height: 1.3; font-weight: 600; }
.job-org { margin-top: 4px; color: var(--accent); font-size: var(--fs-small); }
.job-org span { color: var(--text-3); }
.job-sum { margin-top: 10px; max-width: 70ch; color: var(--text); }
.job-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.job-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 36px;
  padding: 6px 12px;
  border: 1px solid var(--line-strong);
  border-color: color-mix(in srgb, var(--tc, var(--accent)) 45%, transparent);
  border-radius: 8px;
  background: var(--bg-2);
  background: color-mix(in srgb, var(--tc, var(--accent)) 8%, var(--bg-2));
  font-size: 0.86rem;
  line-height: 1.35;
  color: var(--text);
  text-decoration: none;
}
/* A plain chip is a label, not a button: no border, a flatter fill, and the
   softer text color, so only the linked chips (with the arrow) look clickable. */
span.job-chip {
  border-color: transparent;
  background: transparent;
  background: color-mix(in srgb, var(--text) 5%, transparent);
  color: var(--text-2);
}
a.job-chip { transition: border-color var(--t-fast) var(--ease), background var(--t-fast) var(--ease); }
a.job-chip:hover { border-color: var(--tc, var(--accent)); background: var(--grad-soft); }
a.job-chip:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.job-chip-go { font-family: var(--font-mono); color: var(--tt, var(--accent)); }

/* the career bar: one segment per role, as long as the role lasted */
.career-wrap { margin-bottom: clamp(32px, 4.4vw, 56px); }
.career-wrap:empty { display: none; }
.vk.career { gap: 14px; }
.career-bar {
  display: flex;
  gap: 4px;
  height: 14px;
  border-radius: 4px;
  overflow: hidden;
}
.career-seg {
  flex: 1 1 0;
  min-width: 8px;
  background: var(--tc);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--text) 10%, transparent);
}
.career-seg:first-child { border-radius: 4px 0 0 4px; }
.career-seg:last-child { border-radius: 0 4px 4px 0; }
.career-legend { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr)); gap: 10px 22px; }
.career-legend li {
  display: grid;
  grid-template-columns: 12px minmax(0, 1fr);
  gap: 2px 10px;
  align-items: center;
}
.career-legend i { width: 12px; height: 12px; border-radius: 3px; background: var(--tc); }
.career-name { font-size: var(--fs-small); font-weight: 600; color: var(--text); }
.career-legend .label { grid-column: 2; color: var(--text-2); }

@media (max-width: 820px) { .job { grid-template-columns: 1fr; } }

/* -------------------------------- skills -------------------------------- */
.skills {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: clamp(14px, 1.6vw, 22px);
}
.skill-group { padding: clamp(18px, 1.8vw, 24px); }
.skill-group h3 {
  margin-bottom: 8px;
  font-family: var(--font-mono);
  font-size: var(--fs-micro);
  font-weight: 600;
  letter-spacing: var(--track-wide);
  text-transform: uppercase;
  color: var(--text);
}
.skill-list { display: flex; flex-wrap: wrap; gap: 0 8px; }
/* The button is 44px tall for the finger; the face inside is the chip. */
.skill {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0;
  border: 0;
  background: none;
}
.skill-face {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 30px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 4px;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.06em;
  color: var(--text-2);
  transition: color var(--t-fast) var(--ease), border-color var(--t-fast) var(--ease), background var(--t-fast) var(--ease);
}

button.skill:hover .skill-face,
button.skill:focus-visible .skill-face {
  color: var(--text);
  border-color: var(--line-strong);
  background: var(--grad-soft);
}
button.skill:focus-visible { outline: none; }
button.skill:focus-visible .skill-face { outline: 2px solid var(--accent); outline-offset: 2px; }

@media (max-width: 1100px) { .skills { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 700px) { .skills { grid-template-columns: 1fr; } }

/* ----------------------------- learning now ----------------------------- */
.learning {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr));
  gap: clamp(14px, 1.6vw, 22px);
  align-items: start;
}
.learn-block { padding: clamp(18px, 1.8vw, 24px); }
.learn-block h3 {
  margin-bottom: 16px;
  font-family: var(--font-mono);
  font-size: var(--fs-micro);
  font-weight: 600;
  letter-spacing: var(--track-wide);
  text-transform: uppercase;
}
.learn-list { display: grid; gap: 16px; }
.learn-row { display: grid; gap: 8px; }
.learn-top { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.learn-name { font-size: var(--fs-small); color: var(--text); }
.learn-name .label { display: block; margin-top: 2px; }
.learn-note { flex: none; color: var(--text-3); }

.meter { display: flex; gap: 4px; }
.meter i {
  flex: 1;
  height: 8px;
  border-radius: 2px;
  background: var(--muted-mark);
}
.meter i.is-on { background: var(--accent); box-shadow: 0 0 10px color-mix(in srgb, var(--accent) 50%, transparent); }

.bar {
  height: 4px;
  border-radius: 2px;
  background: var(--muted-mark);
  overflow: hidden;
}
.bar span {
  display: block;
  height: 100%;
  width: 100%;
  background: var(--grad);
  transform: scaleX(var(--p, 0));
  transform-origin: 0 50%;
  transition: transform var(--t-slow) var(--ease);
}

.learn-certs { display: grid; gap: 12px; }
.learn-cert {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr);
  gap: 14px;
  align-items: center;
  min-height: 72px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: var(--r-s);
  background: var(--bg-2);
  color: var(--text);
  text-decoration: none;
}
a.learn-cert:hover { border-color: var(--line-strong); }
.learn-cert img,
.learn-cert-blank {
  width: 72px; height: 54px;
  border-radius: 4px;
  object-fit: cover;
  background: var(--grad-soft);
  filter: brightness(0.82);
}
.learn-cert-title { font-size: var(--fs-small); line-height: 1.35; }

/* --------------------------- free study notes --------------------------- */
/* A card per note: the home page's section (main.js) and the list page at
   /notes/ (written by the board) draw the same card. The note pages
   themselves are styled by notes.css. */
.notes-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 340px), 1fr));
  gap: clamp(14px, 1.6vw, 22px);
}
.note-slot { display: flex; min-width: 0; }
.note-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100%;
  min-width: 0;
  padding: clamp(18px, 1.8vw, 24px);
  transition: transform var(--t-med) var(--ease), background var(--t-med) var(--ease);
}
.note-card:hover,
.note-card:focus-within { transform: translateY(-4px); background: var(--panel-hi); }
.note-card:hover::after,
.note-card:focus-within::after { border-color: var(--line-strong); }
.note-card:focus-within { outline: 2px solid var(--accent); outline-offset: -4px; }
.note-card-meta { color: var(--text-2); }
.note-card-title { font-size: 1.12rem; line-height: 1.3; letter-spacing: -0.01em; font-weight: 600; }
.note-card-title a { color: var(--text); text-decoration: none; }
.note-card-title a::after { content: ""; position: absolute; inset: 0; z-index: 3; }
.note-card-title a:focus-visible { outline: none; }
.note-card-sum {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
  line-clamp: 3;
  overflow: hidden;
  font-size: var(--fs-small);
  color: var(--text-2);
}
.note-card .tags { margin-top: auto; padding-top: 4px; }
.notes-more { margin-top: clamp(20px, 2.4vw, 32px); }
.notes-empty { max-width: 64ch; color: var(--text-2); }
@media (prefers-reduced-motion: reduce) {
  .note-card:hover, .note-card:focus-within { transform: none; }
}

/* ----------------------------- certificates ----------------------------- */
.certs {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: clamp(14px, 1.6vw, 22px);
}
.cert-slot { display: flex; min-width: 0; }
.cert {
  display: flex;
  flex-direction: column;
  width: 100%;
  padding: 0;
  border: 0;
  text-align: left;
  color: var(--text);
  transition: transform var(--t-med) var(--ease), background var(--t-med) var(--ease);
}
button.cert:hover,
button.cert:focus-visible { transform: translateY(-4px); background: var(--panel-hi); }
button.cert:hover::after,
button.cert:focus-visible::after { border-color: var(--line-strong); }
button.cert:focus-visible { outline: 2px solid var(--accent); outline-offset: -4px; }

.cert-thumb {
  position: relative;
  aspect-ratio: 4 / 3;
  width: 100%;
  overflow: hidden;
  border-bottom: 1px solid var(--line);
  background: var(--bg-3);
}
/* Scans are white paper. Dimmed on the card so the page stays dark; shown
   as they are in the lightbox. */
.cert-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 50% 0;
  filter: brightness(0.62) saturate(0.85);
  transition: filter var(--t-med) var(--ease);
}
button.cert:hover .cert-thumb img,
button.cert:focus-visible .cert-thumb img { filter: brightness(0.86) saturate(1); }
.cert-thumb.is-blank {
  display: grid;
  place-items: center;
  background:
    radial-gradient(ellipse 90% 90% at 85% 0%, color-mix(in srgb, var(--accent) 18%, transparent), transparent 62%),
    var(--bg-3);
}
.cert-thumb.is-blank span {
  font-family: var(--font-mono);
  font-size: 1.6rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  color: var(--muted-mark);
}
.cert-open {
  position: absolute;
  right: 10px; bottom: 10px;
  padding: 4px 8px;
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  background: var(--panel-solid);
  color: var(--text);
}
.cert-body { display: grid; gap: 6px; padding: 16px; }
.cert-title { font-family: var(--font-display); font-size: 0.98rem; font-weight: 600; line-height: 1.35; }
.cert-meta { color: var(--text-2); }

@media (max-width: 1100px) { .certs { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 820px) { .certs { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 480px) { .certs { grid-template-columns: 1fr; } }

/* ----------------------- education and publications ----------------------- */
.edu {
  display: grid;
  grid-template-columns: minmax(0, 4fr) minmax(0, 7fr);
  gap: clamp(14px, 1.6vw, 22px);
  align-items: start;
}
.edu-list { display: grid; gap: clamp(14px, 1.6vw, 22px); }
@media (min-width: 981px) { .edu-list { position: sticky; top: 96px; } }
.edu-item { padding: clamp(18px, 1.8vw, 26px); }
.edu-item h3 { margin-top: 10px; font-size: var(--fs-h3); line-height: 1.3; font-weight: 600; }
.edu-school { margin-top: 6px; color: var(--accent); font-size: var(--fs-small); }
.edu-detail { margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--line); color: var(--text-2); font-size: var(--fs-small); }
.edu-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; }
.edu-grade {
  flex: none;
  display: grid;
  justify-items: end;
  gap: 2px;
  padding: 8px 12px;
  border: 1px solid var(--line-strong);
  border-color: color-mix(in srgb, var(--accent-3) 45%, transparent);
  border-radius: 10px;
  background: var(--bg-2);
  background: color-mix(in srgb, var(--accent-3) 7%, var(--bg-2));
}
.edu-grade-v {
  font-family: var(--font-mono);
  font-size: 1.15rem;
  font-weight: 600;
  line-height: 1.15;
  white-space: nowrap;
  color: var(--accent-3);
}
.edu-grade .label { color: var(--text-2); }
@media (max-width: 420px) {
  .edu-top { flex-direction: column; }
  .edu-grade { justify-items: start; }
}

.pub { padding: clamp(20px, 2.4vw, 34px); }
.pub + .pub { margin-top: clamp(14px, 1.6vw, 22px); }
.pub-badge { color: var(--accent-2); }
.pub h3 { margin-top: 10px; font-size: clamp(1.1rem, 1.6vw, 1.35rem); line-height: 1.35; font-weight: 600; text-wrap: balance; }
.pub-meta { margin-top: 10px; color: var(--text-2); font-size: var(--fs-small); }
.pub-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-top: 22px;
}
.tile-stat {
  display: flex;
  flex-direction: column-reverse;
  justify-content: flex-end;
  gap: 6px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--r-s);
  background: var(--bg-2);
}
.tile-stat dt { font-size: 0.8rem; line-height: 1.4; color: var(--text-2); }
.tile-stat dd {
  margin: 0;
  font-family: var(--font-mono);
  font-size: 1.25rem;
  font-weight: 600;
  line-height: 1.15;
  font-variant-numeric: tabular-nums;
  color: var(--accent-3);
  overflow-wrap: anywhere;
}
.pub-reach { margin-top: 14px; font-size: var(--fs-small); color: var(--text-2); }
.pub-reach strong { color: var(--text); font-weight: 600; }
/* Pictures from the visual kit, two to a row where there is room. */
.vk-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr));
  gap: 22px clamp(16px, 2vw, 26px);
  align-items: start;
}
.vk-grid > .is-wide { grid-column: 1 / -1; }
.pub-pic { margin-top: 22px; padding: 16px; border: 1px solid var(--line); border-radius: var(--r-s); background: var(--bg-2); }
.pub-nums { margin-top: 26px; padding-top: 22px; border-top: 1px solid var(--line); }
@media (max-width: 480px) {
  .pub { padding: 18px 14px; }
  .pub-pic { padding: 12px 0 4px; border-width: 1px 0 0; border-radius: 0; background: none; }
}
.pub-foot { display: grid; gap: 16px; margin-top: 24px; justify-items: start; }
.pub-cite-box { justify-self: stretch; border-top: 1px solid var(--line); padding-top: 12px; }
.pub-cite-box summary {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 32px;
  cursor: pointer;
  color: var(--text-2);
}
.pub-cite-box summary:hover { color: var(--text); }
.pub-cite-box summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.pub-cite {
  margin-top: 8px;
  font-family: var(--font-mono);
  font-size: 0.74rem;
  line-height: 1.6;
  color: var(--text-3);
  overflow-wrap: anywhere;
}

@media (max-width: 980px) { .edu { grid-template-columns: 1fr; } }
@media (max-width: 620px) { .pub-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* ------------------------------ beyond work ------------------------------ */
/* Small, quiet cards. A card with a picture puts it on the left; a card
   without one has no frame waiting for it. */
.beyond {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: clamp(14px, 1.6vw, 22px);
}
.beyond-item { padding: clamp(18px, 1.8vw, 24px); }
.beyond-item.has-pic {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}
.beyond-pic {
  width: 72px;
  height: 72px;
  border: 1px solid var(--line);
  border-radius: var(--r-s);
  object-fit: cover;
  background: var(--bg-3);
}
.beyond-item.has-icon {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr);
  gap: 14px;
  align-items: start;
}
.beyond-icon {
  width: 44px;
  height: 44px;
  padding: 7px;
  border: 1px solid var(--line-strong);
  border-color: color-mix(in srgb, var(--accent) 40%, transparent);
  border-radius: 12px;
  background: var(--bg-2);
  background: color-mix(in srgb, var(--accent) 8%, var(--bg-2));
  color: var(--accent);
}
.beyond-item h3 { font-size: 0.98rem; font-weight: 600; line-height: 1.35; overflow-wrap: anywhere; }
.beyond-item p { margin-top: 6px; color: var(--text-2); font-size: var(--fs-small); }

@media (max-width: 980px) { .beyond { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 560px) { .beyond { grid-template-columns: 1fr; } }

/* ----------------------------- what I believe ----------------------------- */
/* Quiet on purpose: the same width as the heading, the kit's callouts for the
   lines, and the dedication in small type under a hairline. */
.beliefs { max-width: 780px; }
/* The kicker keeps only its number here (no words of the site's own above
   the approved heading), so the divider after the number goes too. */
.sec-kicker-bare .sec-idx { padding-right: 0; border-right: 0; }
.beliefs-lines { display: grid; gap: 10px; }
.beliefs-lines .vk-callout { padding: 12px 18px; }
.beliefs-lines .vk-callout p { font-family: var(--font-display); font-size: 1.02rem; line-height: 1.45; overflow-wrap: anywhere; }
.beliefs-lines .vt-muted p { color: var(--text-2); }
.beliefs-motto { margin-top: 22px; color: var(--text-2); }
.beliefs-ded {
  margin-top: clamp(24px, 3vw, 34px);
  padding-top: 16px;
  max-width: 64ch;
  border-top: 1px solid var(--line);
  font-size: var(--fs-small);
  line-height: 1.55;
  color: var(--text-3);
}

/* ------------------------------- contact ------------------------------- */
.contact {
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 6fr);
  gap: clamp(24px, 4vw, 64px);
  align-items: start;
}
.contact-links { border-top: 1px solid var(--line); }
.contact-link {
  position: relative;
  display: grid;
  grid-template-columns: 110px minmax(0, 1fr) 24px;
  align-items: center;
  gap: 12px;
  min-height: 68px;
  padding: 8px 4px;
  border-bottom: 1px solid var(--line);
  color: var(--text);
  text-decoration: none;
  transition: background var(--t-fast) var(--ease), padding var(--t-fast) var(--ease);
}
.contact-link::after {
  content: "\2197";
  justify-self: end;
  color: var(--text-3);
  transition: color var(--t-fast) var(--ease), transform var(--t-fast) var(--ease);
}
.contact-link:hover { background: var(--grad-soft); padding-left: 12px; }
.contact-link:hover::after { color: var(--accent); transform: translate(2px, -2px); }
.contact-value { font-size: 1.02rem; overflow-wrap: anywhere; }

.contact-form { display: grid; gap: 18px; padding: clamp(20px, 2.6vw, 36px); }
.field { display: grid; gap: 8px; }
.field label {
  font-family: var(--font-mono);
  font-size: var(--fs-micro);
  letter-spacing: var(--track-wide);
  text-transform: uppercase;
  color: var(--text-2);
}
.field input,
.field textarea {
  width: 100%;
  min-height: 48px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: var(--r-s);
  background: var(--bg-2);
  color: var(--text);
  font-size: 1rem;
  line-height: 1.5;
  transition: border-color var(--t-fast) var(--ease), background var(--t-fast) var(--ease);
}
.field textarea { min-height: 140px; resize: vertical; }
.field input:hover,
.field textarea:hover { border-color: var(--line-strong); }
.field input:focus-visible,
.field textarea:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
  border-color: var(--line-strong);
  background: var(--bg-3);
}
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.contact-form .btn { justify-self: start; }
.form-note { min-height: 1.6em; font-size: var(--fs-small); color: var(--text-2); }
.form-note.is-ok { color: var(--accent-3); }
.form-note.is-bad { color: var(--warn); }

@media (max-width: 900px) { .contact { grid-template-columns: 1fr; } }
@media (max-width: 480px) {
  .contact-link { grid-template-columns: minmax(0, 1fr) 24px; gap: 2px 12px; padding: 12px 4px; }
  .contact-link .label { grid-column: 1; }
  .contact-link .contact-value { grid-column: 1; }
  .contact-link::after { grid-column: 2; grid-row: 1 / span 2; }
  .contact-form .btn { width: 100%; }
}

/* -------------------------------- footer -------------------------------- */
.site-footer {
  position: relative;
  padding: 40px 0 48px;
  border-top: 1px solid var(--line);
  background: var(--bg-2);
}
.footer-inner { display: grid; gap: 20px; }
.footer-privacy { max-width: 72ch; font-size: var(--fs-small); color: var(--text-2); }
.footer-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 24px;
}
.footer-links { display: flex; flex-wrap: wrap; gap: 4px 8px; }
.footer-links a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 10px;
  font-family: var(--font-mono);
  font-size: var(--fs-micro);
  letter-spacing: var(--track-wide);
  text-transform: uppercase;
  color: var(--text-2);
  text-decoration: none;
}
.footer-links a:hover { color: var(--accent); }

/* ------------------------------- overlays ------------------------------- */
.overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  animation: overlay-in var(--t-med) var(--ease) both;
}
.overlay::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(var(--line) 1px, transparent 1px),
    linear-gradient(90deg, var(--line) 1px, transparent 1px);
  background-size: 64px 64px;
  opacity: 0.3;
  -webkit-mask-image: radial-gradient(ellipse 80% 60% at 50% 0%, #000 0%, transparent 80%);
  mask-image: radial-gradient(ellipse 80% 60% at 50% 0%, #000 0%, transparent 80%);
}
@keyframes overlay-in {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: none; }
}

.overlay-bar {
  position: relative;
  z-index: 2;
  flex: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  height: 64px;
  padding: 0 var(--gutter);
  border-bottom: 1px solid var(--line);
  background: var(--bg-2);
}
.overlay-crumb { color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.overlay-close {
  flex: none;
  display: inline-grid;
  place-items: center;
  width: 44px; height: 44px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: var(--r-s);
  background: var(--panel-solid);
  color: var(--text);
  transition: border-color var(--t-fast) var(--ease), color var(--t-fast) var(--ease);
}
.overlay-close:hover { border-color: var(--line-strong); color: var(--accent); }

.overlay-scroll {
  position: relative;
  z-index: 1;
  flex: 1;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}

/* project */
.po { max-width: calc(1080px + 2 * var(--gutter)); padding-top: clamp(28px, 5vw, 64px); padding-bottom: 96px; }
.po-head { max-width: 860px; }
.po-head .label { color: var(--accent); }
.po-head h2 {
  margin-top: 14px;
  font-size: var(--fs-h1);
  line-height: 1.08;
  letter-spacing: -0.025em;
  text-wrap: balance;
}
.po-head h2:focus-visible { outline: none; }
.po-metric { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 18px; margin-top: 26px; }
.po-metric .metric-v { font-size: clamp(2.4rem, 6vw, 4.2rem); }
.po-metric .metric-v.is-text { font-size: clamp(1.5rem, 3vw, 2.2rem); }
.po-metric .metric-l { font-size: 1rem; max-width: 36ch; }
.po-head .tags { margin-top: 22px; }

.po-story { margin-top: clamp(28px, 4vw, 56px); }
.po-story:empty { display: none; }
.po-lede { max-width: 72ch; font-size: 1.08rem; color: var(--text-2); }

.po-writeup { margin-top: clamp(28px, 4vw, 56px); }
.writeup-toggle {
  --c: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  width: 100%;
  min-height: 60px;
  padding: 0 clamp(16px, 2vw, 24px);
  border: 0;
  text-align: left;
  font-family: var(--font-display);
  font-size: 1.02rem;
  font-weight: 600;
  color: var(--text);
  transition: background var(--t-fast) var(--ease);
}
.writeup-toggle:hover { background: var(--panel-hi); }
.writeup-toggle:hover::after { border-color: var(--line-strong); }
.writeup-toggle:focus-visible { outline: 2px solid var(--accent); outline-offset: -5px; }
.writeup-chev {
  flex: none;
  width: 10px; height: 10px;
  border-right: 1.5px solid var(--accent);
  border-bottom: 1.5px solid var(--accent);
  transform: translateY(-3px) rotate(45deg);
  transition: transform var(--t-fast) var(--ease);
}
.writeup-toggle[aria-expanded="true"] .writeup-chev { transform: translateY(2px) rotate(-135deg); }

.writeup {
  display: grid;
  gap: clamp(26px, 3vw, 40px);
  padding: clamp(24px, 3vw, 40px) 0 0;
  animation: rise var(--t-med) var(--ease) both;
}
.wu-block { max-width: 78ch; }
.wu-block.is-wide { max-width: none; }
.wu-block > h3 {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 14px;
  font-family: var(--font-mono);
  font-size: var(--fs-micro);
  font-weight: 600;
  letter-spacing: var(--track-wide);
  text-transform: uppercase;
  color: var(--accent);
}
.wu-block > h3::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.wu-block p { color: var(--text-2); }

.figs {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr));
  gap: 14px;
}
.fig { margin: 0; display: grid; gap: 8px; align-content: start; }
.fig img {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--r-s);
  filter: brightness(0.84);
}
.fig figcaption { font-size: var(--fs-small); color: var(--text-3); }

.po-pager {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: clamp(14px, 1.6vw, 22px);
  margin-top: clamp(40px, 6vw, 80px);
}
.pager {
  --c: 12px;
  display: grid;
  gap: 8px;
  align-content: start;
  min-height: 96px;
  padding: 18px 20px;
  color: var(--text);
  text-decoration: none;
  transition: transform var(--t-fast) var(--ease), background var(--t-fast) var(--ease);
}
.pager:hover { transform: translateY(-3px); background: var(--panel-hi); }
.pager:hover::after { border-color: var(--line-strong); }
.pager:focus-visible { outline: 2px solid var(--accent); outline-offset: -5px; }
.pager .label { color: var(--accent); }
.pager-next { text-align: right; }
.pager-name { font-family: var(--font-display); font-weight: 600; line-height: 1.35; }

@media (max-width: 620px) {
  .po-pager { grid-template-columns: 1fr; }
  .pager-next { text-align: left; }
}

.writeup-text { display: grid; gap: 4px; }
.writeup-hint {
  font-family: var(--font-mono);
  font-size: var(--fs-micro);
  font-weight: 400;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-2);
}

/* ----------------------------- project sheet ----------------------------- */
/* Laid out like the study notes on the board: numbered section bars, a
   picture first, then the numbers, a role chain and a cheat sheet. */
.sheet { display: grid; gap: clamp(14px, 1.6vw, 20px); }
.sheet-sec {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: var(--r-m);
  background: var(--panel);
  overflow: hidden;
}
.sheet-bar {
  display: flex;
  align-items: baseline;
  gap: 12px;
  padding: 11px clamp(14px, 2vw, 22px);
  border-bottom: 1px solid var(--line);
  background: var(--bg-3);
  background: color-mix(in srgb, var(--accent) 11%, var(--bg-2));
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 600;
  line-height: 1.3;
  color: var(--text);
}
.sheet-n { font-family: var(--font-mono); font-size: var(--fs-small); font-weight: 600; color: var(--accent); }
.sheet-body {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 400px), 1fr));
  gap: 22px clamp(18px, 2.4vw, 32px);
  align-items: start;
  padding: clamp(14px, 2vw, 22px);
}
.sheet-body > .is-wide,
.sheet-line { grid-column: 1 / -1; }
.sheet-line { max-width: 64ch; font-size: 1.06rem; line-height: 1.5; color: var(--text); }

@media (min-width: 900px) {
  .sheet { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .sheet-sec { grid-column: 1 / -1; }
  .sheet-sec.is-half { grid-column: auto; }
  .sheet-sec.is-half .sheet-body { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 480px) {
  .sheet-body { padding: 14px 10px; }
  .sheet-body > .vk--flow { margin-inline: -6px; }
}

/* ------------------------------- visual kit ------------------------------- */
/* The pieces drawn by the visual kit in main.js (vkBlock). A tone class sets
   two colors: --tc for lines and fills, --tt for text in that tone. */
.vt-accent { --tc: var(--accent); --tt: var(--accent); }
.vt-model { --tc: var(--accent-2); --tt: var(--accent-2); }
.vt-result { --tc: var(--accent-3); --tt: var(--accent-3); }
.vt-warn { --tc: var(--warn); --tt: var(--warn); }
.vt-bad { --tc: var(--bad); --tt: var(--bad); }
.vt-muted { --tc: var(--text-3); --tt: var(--text-2); }

.vk { display: grid; gap: 10px; align-content: start; min-width: 0; margin: 0; }
.vk-title {
  font-family: var(--font-mono);
  font-size: var(--fs-micro);
  font-weight: 600;
  letter-spacing: var(--track-wide);
  text-transform: uppercase;
  line-height: 1.5;
  color: var(--text-2);
}
.vk-cap { font-size: 0.82rem; line-height: 1.45; color: var(--text-2); }

/* chain: chips joined by arrows */
.vk-chain { display: flex; flex-wrap: wrap; align-items: stretch; gap: 10px 0; }
.vk-step {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 2px;
  min-width: 0;
  max-width: 15.5rem;
  padding: 9px 13px;
  border: 1px solid var(--line-strong);
  border-color: color-mix(in srgb, var(--tc) 55%, transparent);
  border-radius: 9px;
  background: var(--bg-2);
  background: color-mix(in srgb, var(--tc) 10%, var(--bg-2));
}
.vk-step + .vk-step { margin-left: 34px; }
.vk-step + .vk-step::before {
  content: "";
  position: absolute;
  top: 50%;
  left: -29px;
  width: 24px;
  height: 12px;
  margin-top: -6px;
  background: var(--text-2);
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 12'%3E%3Cpath d='M1 6h20M16 1.5l5.5 4.5-5.5 4.5' fill='none' stroke='%23000' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%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 12'%3E%3Cpath d='M1 6h20M16 1.5l5.5 4.5-5.5 4.5' fill='none' stroke='%23000' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / contain no-repeat;
}
.vk-step-n { font-family: var(--font-mono); font-size: var(--fs-micro); font-weight: 600; color: var(--tt); }
.vk-step-t { font-size: var(--fs-small); font-weight: 600; line-height: 1.35; color: var(--text); }
.vk-step-s { font-size: 0.8rem; line-height: 1.4; color: var(--text-2); }
.vk-step-tag {
  font-family: var(--font-mono);
  font-size: 0.66rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--tt);
}
.vk-chain.is-small .vk-step { padding: 7px 11px; }
.vk-chain.is-small .vk-step-t { font-weight: 400; }

@media (max-width: 600px) {
  .vk-chain { flex-direction: column; gap: 0; }
  .vk-step { max-width: none; }
  .vk-step + .vk-step { margin: 30px 0 0; }
  .vk-step + .vk-step::before { top: -27px; left: 50%; margin: 0 0 0 -12px; transform: rotate(90deg); }
}

/* flow: the SVG flowchart */
.vk--flow { justify-items: center; }
.vk--flow > .vk-title,
.vk--flow > .vk-cap { justify-self: stretch; }
.vk-svg { height: auto; overflow: visible; }
.vk-svg text { font-family: var(--font-body); }
.vk-n rect,
.vk-n polygon {
  fill: var(--bg-2);
  fill: color-mix(in srgb, var(--tc) 13%, var(--bg-2));
  stroke: var(--tc);
  stroke-width: 1.4;
}
.vk-n .vk-tt { fill: var(--text); }
.vk-n .vk-ts { fill: var(--text-2); }
.vk-n.is-ghost rect,
.vk-n.is-ghost polygon { fill: var(--bg); stroke-dasharray: 5 4; }
.vk-n.is-ghost .vk-tt { fill: var(--text-2); }
.vk-e { fill: none; stroke: var(--text-3); stroke-width: 1.5; stroke-linejoin: round; }
.vk-ah { fill: var(--text-3); }
.vk-e.is-yes { stroke: var(--accent-3); }
.vk-ah.is-yes { fill: var(--accent-3); }
.vk-e.is-no { stroke: var(--warn); }
.vk-ah.is-no { fill: var(--warn); }
.vk-e.is-loop { stroke: var(--accent-2); stroke-dasharray: 6 4; }
.vk-ah.is-loop { fill: var(--accent-2); }
.vk-e.is-x { stroke: var(--bad); stroke-dasharray: 4 4; }
.vk-ah.is-x { fill: var(--bad); }
.vk-xm { fill: none; stroke: var(--bad); stroke-width: 2; stroke-linecap: round; }
.vk-el {
  font-family: var(--font-mono);
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  fill: var(--text-2);
  stroke: var(--panel-solid);
  stroke-width: 4px;
  stroke-linejoin: round;
  paint-order: stroke;
}
.vk-el.is-yes { fill: var(--accent-3); }
.vk-el.is-no { fill: var(--warn); }

/* formula and number boxes */
.vk-formula,
.vk-nums {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 190px), 1fr));
  gap: 10px;
  margin: 0;
}
.vk-f,
.vk-num {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
  padding: 11px 14px;
  border: 1.5px solid var(--line-strong);
  border-color: color-mix(in srgb, var(--tc) 50%, transparent);
  border-radius: 10px;
  background: var(--bg-2);
  background: color-mix(in srgb, var(--tc) 8%, var(--bg-2));
}
.vk-f dt {
  font-family: var(--font-mono);
  font-size: var(--fs-micro);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  line-height: 1.45;
  color: var(--text-2);
}
.vk-f-x {
  margin: 0;
  font-family: var(--font-mono);
  font-size: 0.98rem;
  font-weight: 600;
  line-height: 1.4;
  color: var(--text);
  overflow-wrap: anywhere;
}
.vk-f-m,
.vk-num-m { margin: 0; font-size: 0.8rem; line-height: 1.4; color: var(--text-2); }
.vk-num dt { order: 2; font-size: 0.86rem; line-height: 1.4; color: var(--text); }
.vk-num-v {
  order: 1;
  margin: 0;
  font-family: var(--font-mono);
  font-size: clamp(1.25rem, 2vw, 1.55rem);
  font-weight: 600;
  line-height: 1.12;
  letter-spacing: -0.01em;
  font-variant-numeric: tabular-nums;
  color: var(--tt);
  overflow-wrap: anywhere;
}
.vk-num-m { order: 3; }

/* bars */
.vk-bars { display: grid; gap: 12px; max-width: 760px; }
.vk-bar {
  display: grid;
  grid-template-columns: minmax(0, 9.5rem) minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
}
.vk-bar-l { font-size: var(--fs-small); line-height: 1.35; color: var(--text); }
.vk-bar-track {
  height: 10px;
  border-radius: 3px;
  background: var(--muted-mark);
  background: color-mix(in srgb, var(--text-3) 26%, transparent);
  overflow: hidden;
}
.vk-bar-fill {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: 3px;
  background: var(--tc);
  transform: scaleX(var(--f, 0));
  transform-origin: 0 50%;
  transition: transform var(--t-slow) var(--ease);
}
.vk-bar-v {
  font-family: var(--font-mono);
  font-size: var(--fs-small);
  font-weight: 600;
  white-space: nowrap;
  color: var(--tt);
}
@media (max-width: 480px) {
  .vk-bar { grid-template-columns: minmax(0, 1fr) auto; gap: 6px 12px; }
  .vk-bar-l { grid-column: 1 / -1; }
}

/* shift: before, arrow, after */
.vk-shift {
  display: grid;
  max-width: 680px;
  grid-template-columns: minmax(0, 1fr) 30px minmax(0, 1fr);
  align-items: stretch;
  gap: 8px;
}
.vk-shift-side {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 4px;
  min-width: 0;
  padding: 12px 14px;
  border: 1px solid var(--line-strong);
  border-color: color-mix(in srgb, var(--tc) 50%, transparent);
  border-radius: 10px;
  background: var(--bg-2);
  background: color-mix(in srgb, var(--tc) 9%, var(--bg-2));
}
.vk-shift-v {
  font-family: var(--font-mono);
  font-size: clamp(1.1rem, 1.8vw, 1.35rem);
  font-weight: 600;
  line-height: 1.15;
  color: var(--tt);
  overflow-wrap: anywhere;
}
.vk-shift-l { font-size: 0.82rem; line-height: 1.4; color: var(--text-2); }
.vk-shift-arrow {
  align-self: center;
  justify-self: center;
  width: 26px;
  height: 13px;
  background: var(--text-2);
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 12'%3E%3Cpath d='M1 6h20M16 1.5l5.5 4.5-5.5 4.5' fill='none' stroke='%23000' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%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 12'%3E%3Cpath d='M1 6h20M16 1.5l5.5 4.5-5.5 4.5' fill='none' stroke='%23000' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / contain no-repeat;
}

/* timeline: milestones on a line */
.vk-time-span {
  display: flex;
  align-items: center;
  gap: 12px;
  font-family: var(--font-mono);
  font-size: var(--fs-micro);
  font-weight: 600;
  letter-spacing: var(--track-wide);
  text-transform: uppercase;
  color: var(--accent);
}
.vk-time-span::before,
.vk-time-span::after { content: ""; flex: 1; height: 1px; background: var(--line-strong); }
.vk-time { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 12px; }
.vk-ms { position: relative; display: flex; flex-direction: column; gap: 3px; min-width: 0; padding-top: 24px; }
.vk-ms::before {
  content: "";
  position: absolute;
  top: 7px;
  left: 6px;
  right: -12px;
  height: 2px;
  background: var(--line-strong);
}
.vk-ms:last-child::before { display: none; }
.vk-ms::after {
  content: "";
  position: absolute;
  top: 1px;
  left: 0;
  width: 14px;
  height: 14px;
  border: 2px solid var(--tc);
  border-radius: 50%;
  background: var(--bg);
  box-shadow: 0 0 10px color-mix(in srgb, var(--tc) 40%, transparent);
}
.vk-ms-t { font-size: var(--fs-small); font-weight: 600; line-height: 1.35; color: var(--text); }
.vk-ms-s { font-size: 0.8rem; line-height: 1.4; color: var(--text-2); }
@media (max-width: 640px) {
  .vk-time { grid-auto-flow: row; gap: 16px; padding-left: 26px; }
  .vk-ms { padding-top: 0; }
  .vk-ms::before { top: 16px; bottom: -16px; left: -20px; right: auto; width: 2px; height: auto; }
  .vk-ms::after { top: 2px; left: -26px; }
}

/* cards */
.vk-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr));
  gap: 10px;
}
.vk-card {
  min-width: 0;
  padding: 13px 16px 15px;
  border: 1px solid var(--line);
  border-top: 2px solid var(--tc);
  border-radius: 10px;
  background: var(--bg-2);
  background: color-mix(in srgb, var(--tc) 6%, var(--bg-2));
}
.vk-card-tag {
  font-family: var(--font-mono);
  font-size: var(--fs-micro);
  letter-spacing: var(--track-wide);
  text-transform: uppercase;
  color: var(--tt);
}
.vk-card-h { margin-top: 4px; font-size: 0.98rem; font-weight: 600; line-height: 1.35; }
.vk-card-pts { display: grid; gap: 7px; margin-top: 10px; }
.vk-card-pts li {
  position: relative;
  padding-left: 16px;
  font-size: var(--fs-small);
  line-height: 1.45;
  color: var(--text-2);
}
.vk-card-pts li::before {
  content: "";
  position: absolute;
  top: 0.55em;
  left: 0;
  width: 7px;
  height: 7px;
  border-radius: 2px;
  background: var(--tc);
}

/* chips */
.vk-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.vk-chip {
  padding: 7px 12px;
  border: 1px solid var(--line-strong);
  border-color: color-mix(in srgb, var(--tc) 45%, transparent);
  border-radius: 8px;
  background: var(--bg-2);
  background: color-mix(in srgb, var(--tc) 8%, var(--bg-2));
  font-size: 0.86rem;
  line-height: 1.4;
  color: var(--text);
}
.vk-chip-s { color: var(--text-2); }

/* stack: layers */
.vk-stack { display: grid; gap: 4px; }
.vk-stack.is-flow { gap: 24px; }
.vk-layer {
  position: relative;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 2px 12px;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-left: 3px solid var(--tc);
  border-radius: 6px;
  background: var(--bg-2);
  background: color-mix(in srgb, var(--tc) 8%, var(--bg-2));
}
.vk-layer-t { font-size: var(--fs-small); font-weight: 600; color: var(--text); }
.vk-layer-s { font-size: 0.8rem; color: var(--text-2); }
.vk-stack.is-flow .vk-layer + .vk-layer::before {
  content: "";
  position: absolute;
  top: -20px;
  left: 50%;
  width: 24px;
  height: 12px;
  margin-left: -12px;
  background: var(--text-2);
  transform: rotate(90deg);
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 12'%3E%3Cpath d='M1 6h20M16 1.5l5.5 4.5-5.5 4.5' fill='none' stroke='%23000' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%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 12'%3E%3Cpath d='M1 6h20M16 1.5l5.5 4.5-5.5 4.5' fill='none' stroke='%23000' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / contain no-repeat;
}

/* dots */
.vk-dots { display: grid; grid-template-columns: repeat(20, 12px); gap: 5px; }
.vk-dots i,
.vk-legend i {
  display: block;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--muted-mark);
}
.vk-dots i.is-on,
.vk-legend i.is-on { background: var(--tc); }
.vk-dots i.is-maybe,
.vk-legend i.is-maybe { background: transparent; border: 2px solid var(--tc); }
.vk-legend { display: grid; gap: 6px; }
.vk-legend li { display: flex; align-items: center; gap: 10px; font-size: var(--fs-small); color: var(--text-2); }
.vk-legend i { flex: none; }
@media (max-width: 520px) { .vk-dots { grid-template-columns: repeat(10, 12px); } }

/* table */
.vk-table-wrap { min-width: 0; overflow-x: auto; }
.vk-table { width: 100%; border-collapse: collapse; font-size: var(--fs-small); }
.vk-table th,
.vk-table td {
  padding: 9px 14px 9px 0;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
  line-height: 1.45;
}
.vk-table tr:last-child th,
.vk-table tr:last-child td { border-bottom: 0; }
.vk-table thead th {
  font-family: var(--font-mono);
  font-size: var(--fs-micro);
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-2);
  border-bottom-color: var(--line-strong);
}
.vk-table tbody th { width: 36%; font-weight: 600; color: var(--text); }
.vk-table td { color: var(--text-2); }
.vk-table td[class*="vt-"] { color: var(--text); }
.vk-mark {
  display: inline-block;
  width: 8px;
  height: 8px;
  margin-right: 8px;
  border-radius: 50%;
  background: var(--tc);
  vertical-align: 1px;
}

/* callout and badge */
.vk-callout {
  padding: 14px 18px;
  border-left: 2px solid var(--tc);
  border-radius: 0 var(--r-s) var(--r-s) 0;
  background: var(--grad-soft);
}
.vk-callout .vk-callout-l { display: block; margin-bottom: 4px; color: var(--tt); }
.vk-callout p { color: var(--text); }
.vk-badge {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  justify-self: start;
  padding: 6px 13px;
  border: 1px solid var(--tc);
  border-radius: 999px;
  font-family: var(--font-mono);
  font-size: var(--fs-micro);
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  line-height: 1.5;
  color: var(--tt);
}
.vk-badge::before { content: ""; flex: none; width: 7px; height: 7px; border-radius: 50%; background: var(--tc); }

/* tour */
.tour-stage { min-height: 100%; }
.tour-plain { padding-top: clamp(28px, 5vw, 64px); padding-bottom: 96px; max-width: calc(980px + 2 * var(--gutter)); }
.tour-plain h2 { font-size: var(--fs-h1); line-height: 1.08; letter-spacing: -0.025em; }
.tour-plain > p { margin-top: 14px; color: var(--text-2); max-width: 60ch; }
.tour-end { margin-top: clamp(24px, 3vw, 40px); }
.tour-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 28px; }

/* ------------------------------- lightbox ------------------------------- */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 120;
  display: grid;
  place-items: center;
  padding: 72px var(--gutter) 24px;
  animation: overlay-in var(--t-med) var(--ease) both;
}
.lightbox-backdrop {
  position: absolute;
  inset: 0;
  background: var(--bg);
  opacity: 0.94;
}
.lightbox-panel {
  position: relative;
  display: grid;
  gap: 14px;
  justify-items: center;
  margin: 0;
  max-width: 100%;
  pointer-events: none;
}
.lightbox-panel > * { pointer-events: auto; }
.lightbox-image img {
  width: auto;
  max-width: min(100%, 1100px);
  max-height: calc(100vh - 190px);
  max-height: calc(100dvh - 190px);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-s);
  box-shadow: var(--shadow);
}
.lightbox-panel figcaption { display: grid; gap: 4px; text-align: center; }
.lightbox-title { font-family: var(--font-display); font-weight: 600; }
.lightbox-close { position: absolute; top: 14px; right: var(--gutter); }

/* ------------------------------- no script ------------------------------- */
.ns { display: grid; gap: 20px; }
.ns-note { color: var(--text-2); max-width: 70ch; }
.ns-list { display: grid; gap: 0; border-top: 1px solid var(--line); counter-reset: ns; }
.ns-list li {
  display: grid;
  gap: 6px;
  padding: 18px 0;
  border-bottom: 1px solid var(--line);
}
.ns-list h3 { font-size: var(--fs-h3); line-height: 1.3; font-weight: 600; }
.ns-list p { color: var(--text-2); max-width: 80ch; }

/* ------------------------------ page not found ------------------------------ */
.nf {
  display: grid;
  place-items: center;
  min-height: 100vh;
  min-height: 100svh;
  padding: 48px 0;
}
.nf-panel { --c: 22px; max-width: 640px; padding: clamp(24px, 5vw, 52px); }
.nf h1 {
  margin-top: 22px;
  font-size: var(--fs-h1);
  line-height: 1.08;
  letter-spacing: -0.025em;
}
.nf p { margin-top: 14px; color: var(--text-2); }
.nf .hero-actions { margin-top: 28px; }
.nf-foot {
  margin-top: 32px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
  font-size: var(--fs-small);
}

/* -------------------------------- motion -------------------------------- */
/* Sections come in once as they enter: 12px and a fade. */
.js .reveal {
  opacity: 0;
  transform: translateY(12px);
  transition: opacity var(--t-med) var(--ease), transform var(--t-med) var(--ease);
}
.js .reveal.in { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .js .reveal { opacity: 1; transform: none; transition: none; }
  .hero-inner > *, .overlay, .lightbox, .writeup { animation: none; }
  .btn:hover, .card:hover, .card:focus-within, .tile:hover, .pager:hover,
  button.cert:hover, button.cert:focus-visible { transform: none; }
  .role { transition: none; }
}

/* ------------------------------ wide screens ------------------------------ */
@media (min-width: 1800px) {
  html { font-size: 106.25%; }
  .wrap { max-width: calc(var(--wrap) * 1.16 + 2 * var(--gutter)); }
}
@media (min-width: 2300px) {
  html { font-size: 118.75%; }
  .wrap { max-width: calc(var(--wrap) * 1.34 + 2 * var(--gutter)); }
}

/* -------------------------------- print -------------------------------- */
@media print {
  .site-header, .progress, .hero-canvas, .hero-shade, .tick, .hero-readout,
  .overlay, .lightbox, .filters, .contact-form { display: none !important; }
  body::before, body::after { display: none; }
  .js .reveal { opacity: 1; transform: none; }
  .hero { min-height: 0; padding: 24px 0; }
}
