/* ==========================================================================
   Roman Breytenbikher
   Paper and ink, with red for the route. The page scrolls normally; the
   3D scene sits behind it and follows the scroll position.
   Type: Schibsted Grotesk (news grotesk) for display and interface,
         PT Serif (ParaType's public Russian typeface) for reading text.
   ========================================================================== */

:root {
  color-scheme: light;
  --paper: #eceeea;
  --paper-deep: #e1e4de;
  --card: #f6f7f3;
  --ink: #1c1f27;
  --ink-soft: #3b404c;
  --graphite: #606671;
  --rule: rgba(28, 31, 39, 0.14);
  --rule-strong: rgba(28, 31, 39, 0.3);
  --red: #c42a1f;
  --red-text: #ae2218;
  --red-on-dark: #f2574c;
  --ok: #2f7a4d;
  --board: #1c1f27;

  --f-sans: "Schibsted Grotesk", "Helvetica Neue", Arial, sans-serif;
  --f-serif: "PT Serif", "Iowan Old Style", Georgia, serif;

  --gutter: max(clamp(16px, 3.6vw, 56px), calc((100vw - 1440px) / 2 + 56px));
  --col: min(560px, 42vw);
  --head-h: 68px;
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
}

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

html {
  -webkit-text-size-adjust: 100%;
  scrollbar-gutter: stable;
}
html.modal-open { overflow: hidden; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--f-serif);
  font-size: 17px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

img { max-width: 100%; display: block; }
a { color: inherit; }
button { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--red); outline-offset: 3px; border-radius: 4px; }
.panel:focus { outline: none; }
::selection { background: var(--ink); color: var(--paper); }

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

.skip-link {
  position: fixed; left: var(--gutter); top: 12px; z-index: 100;
  padding: 10px 14px; border-radius: 6px;
  background: var(--ink); color: var(--paper);
  font: 600 14px/1 var(--f-sans); text-decoration: none;
  transform: translateY(-160%);
  transition: transform 0.2s var(--ease-out);
}
.skip-link:focus-visible { transform: none; }

/* ---------- Canvas ---------- */

#gl {
  position: fixed; inset: 0;
  width: 100%; height: 100%;
  z-index: 1;
  display: block;
  pointer-events: none;
}

.city-label {
  position: fixed; left: 0; top: 0; z-index: 5;
  display: flex; align-items: center; gap: 8px;
  pointer-events: none;
  font: 600 14px/1 var(--f-sans);
  color: var(--ink);
  opacity: 0; transition: opacity 0.4s;
  will-change: transform;
}
.city-label.is-visible { opacity: 1; }
.city-label__dot { width: 9px; height: 9px; border-radius: 50%; background: var(--red); }
.city-label__text {
  padding: 6px 10px; border-radius: 4px;
  background: var(--card); border: 1px solid var(--rule-strong);
  white-space: nowrap;
}

/* ---------- Header ---------- */

.site-head {
  position: fixed; top: 0; left: 0; right: 0; z-index: 30;
  height: calc(var(--head-h) + env(safe-area-inset-top, 0px));
  padding: env(safe-area-inset-top, 0px) var(--gutter) 0;
  display: flex; align-items: center; gap: 20px;
  background: rgba(236, 238, 234, 0.9);
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
  border-bottom: 1px solid transparent;
  transition: border-color 0.3s;
  font-family: var(--f-sans);
}
.site-head.is-scrolled { border-bottom-color: var(--rule); }

.brand { display: inline-flex; align-items: center; gap: 12px; text-decoration: none; flex: none; }
.brand__mark {
  display: grid; place-items: center;
  width: 38px; height: 38px; border-radius: 50%;
  background: var(--ink); color: var(--paper);
  font: 800 13px/1 var(--f-sans); letter-spacing: -0.02em;
  transition: background 0.25s;
}
.brand:hover .brand__mark { background: var(--red); }
.brand__name { font: 600 15px/1.2 var(--f-sans); letter-spacing: -0.01em; white-space: nowrap; }

.site-nav { margin-left: auto; }
.site-nav ul { display: flex; gap: 2px; margin: 0; padding: 0; list-style: none; }
.site-nav a {
  display: inline-flex; align-items: center;
  height: 36px; padding: 0 12px; border-radius: 999px;
  font: 500 14.5px/1 var(--f-sans);
  color: var(--ink-soft); text-decoration: none; white-space: nowrap;
  transition: color 0.2s, background 0.2s;
}
.site-nav a:hover { color: var(--ink); background: rgba(28, 31, 39, 0.06); }
.site-nav a[aria-current] { color: var(--ink); font-weight: 600; background: rgba(28, 31, 39, 0.08); }
.site-nav__extra { display: none; }

.site-head__actions { display: flex; gap: 8px; flex: none; }
.chip {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 38px; padding: 0 16px;
  border: 1px solid var(--rule-strong); border-radius: 999px;
  background: transparent;
  font: 600 14px/1 var(--f-sans);
  color: var(--ink); text-decoration: none; white-space: nowrap;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s, color 0.2s;
}
.chip:hover { border-color: var(--ink); }
.chip--solid { background: var(--ink); border-color: var(--ink); color: var(--paper); }
.chip--solid:hover,
.chip--solid[aria-current] { background: var(--red); border-color: var(--red); }
.nav-toggle { display: none; }

/* ---------- Shared type ---------- */

.kicker {
  margin: 0 0 14px;
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px;
  font: 500 14px/1.4 var(--f-sans);
  color: var(--graphite);
}
.kicker > span:first-child { margin-right: 4px; }

.title {
  margin: 0 0 18px;
  font: 700 clamp(34px, 3.6vw, 54px)/1.04 var(--f-sans);
  letter-spacing: -0.03em;
  text-wrap: balance;
}

.lede {
  margin: 0 0 24px;
  max-width: 46ch;
  font-size: clamp(17px, 1.2vw, 19px);
  line-height: 1.6;
  color: var(--ink-soft);
  text-wrap: pretty;
}

.note { margin: 0 0 14px; max-width: 50ch; font-size: 15px; line-height: 1.55; color: var(--graphite); text-wrap: pretty; }

.text-link {
  font: 600 15px/1.4 var(--f-sans);
  color: var(--ink);
  text-decoration: underline;
  text-decoration-thickness: 1.5px;
  text-underline-offset: 4px;
  text-decoration-color: var(--red);
}
.text-link:hover { color: var(--red-text); }

.tag {
  display: inline-flex; align-items: center;
  height: 24px; padding: 0 10px;
  border: 1px solid var(--rule-strong); border-radius: 999px;
  font: 600 12.5px/1 var(--f-sans);
  color: var(--ink-soft);
}
.tag--remote { border-color: var(--red); color: var(--red-text); }

.status {
  display: inline-flex; align-items: center; gap: 9px;
  height: 32px; padding: 0 14px 0 12px; margin: 0 0 22px;
  border: 1px solid var(--rule-strong); border-radius: 999px;
  background: rgba(246, 247, 243, 0.7);
  font: 600 14px/1 var(--f-sans);
  color: var(--ink);
}
.status__dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--ok);
  animation: pulse 2.4s ease-out infinite;
}
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(47, 122, 77, 0.45); }
  70%, 100% { box-shadow: 0 0 0 7px rgba(47, 122, 77, 0); }
}

.btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 46px; padding: 0 20px;
  border: 1.5px solid var(--ink); border-radius: 999px;
  background: transparent;
  font: 600 15px/1 var(--f-sans);
  color: var(--ink); text-decoration: none;
  cursor: pointer;
  transition: background 0.2s, color 0.2s, border-color 0.2s;
}
.btn:hover { background: var(--ink); color: var(--paper); }
.btn--primary { background: var(--ink); color: var(--paper); }
.btn--primary:hover { background: var(--red); border-color: var(--red); }
.cta { display: flex; flex-wrap: wrap; gap: 10px; }

/* ---------- Split-flap tiles ---------- */

.flaps {
  --tile-top: #2e3340;
  --tile-bot: #252a35;
  --tile-leaf-top: #343a48;
  --tile-leaf-bot: #20242e;
  --tile-ink: #eceeea;
  --tile-hinge: rgba(0, 0, 0, 0.7);
  display: inline-flex; gap: 0.06em; vertical-align: top;
}
.flaps--light {
  --tile-top: #e4e6e1;
  --tile-bot: #dcdfd9;
  --tile-leaf-top: #eaece7;
  --tile-leaf-bot: #d6d9d3;
  --tile-ink: #1c1f27;
  --tile-hinge: rgba(28, 31, 39, 0.28);
}
/* Tiles are sized for the widest glyph (W is 1.01em in Schibsted Grotesk):
   letters are condensed to 82%, as on real split-flap boards. */
.flap {
  position: relative;
  display: inline-block;
  width: 0.84em; height: 1.3em;
  line-height: 1.3em;
  font-family: var(--f-sans);
  font-weight: 800;
  text-align: center;
  color: var(--tile-ink);
  perspective: 6em;
  flex: none;
}
.flap > span {
  position: absolute; left: 0; right: 0; height: 50%;
  overflow: hidden;
  background: linear-gradient(180deg, var(--tile-top), var(--tile-bot));
  backface-visibility: hidden;
}
.flap > span > i {
  position: absolute; left: 0; right: 0; height: 200%;
  font-style: normal; line-height: 1.3em;
  transform: scaleX(0.82);
}
.flap__t, .flap__lt { top: 0; border-radius: 0.09em 0.09em 0 0; transform-origin: 50% 100%; }
.flap__b, .flap__lb { bottom: 0; border-radius: 0 0 0.09em 0.09em; transform-origin: 50% 0; }
.flap__t > i, .flap__lt > i { top: 0; }
.flap__b > i, .flap__lb > i { top: -100%; }
.flap__lt, .flap__lb { visibility: hidden; z-index: 2; }
.flap__lt { background: linear-gradient(180deg, var(--tile-leaf-top), var(--tile-top)); }
.flap__lb { background: linear-gradient(180deg, var(--tile-bot), var(--tile-leaf-bot)); }
.flap::after {
  content: ""; position: absolute; left: 0; right: 0; top: calc(50% - 0.5px); height: 1px;
  background: var(--tile-hinge); z-index: 3;
}

/* ---------- Sections ---------- */

.story { position: relative; z-index: 10; }

/* Each step is a screen-tall section; the text sits in the left column and
   the 3D object fills the right. */
.panel {
  position: relative;
  min-height: 100vh; min-height: 100svh;
  display: flex; align-items: center;
  padding: calc(var(--head-h) + 40px) var(--gutter) 64px;
}
.panel__body { position: relative; width: var(--col); }

/* About */
.panel--hero .panel__body { width: min(800px, 56vw); }
.js:not(.ready) .hero { opacity: 0; }
.hero { transition: opacity 0.5s ease; }
.hero__name {
  margin: 0 0 24px;
  font: 800 clamp(54px, 6.8vw, 98px)/0.92 var(--f-sans);
  letter-spacing: -0.045em;
}
.hero__name span { display: block; }
.hero__name span + span { margin-left: 0.04em; }
.facts {
  display: flex; flex-wrap: wrap; gap: 14px clamp(22px, 2.6vw, 40px);
  max-width: 560px;
  margin: 0 0 28px; padding-top: 16px;
  border-top: 1px solid var(--rule-strong);
  font-family: var(--f-sans);
}
.facts dt { font-size: 13.5px; color: var(--graphite); }
.facts dd { margin: 2px 0 0; font-size: 16px; font-weight: 600; }

/* The photo: a backdrop plate with the subject on top, nudged apart by the
   pointer for a little depth. It scrolls with the page. */
.portrait { margin: 0; }
.portrait__frame {
  position: relative;
  height: 100%;
  aspect-ratio: 4 / 5;
  overflow: hidden;
  border-radius: 6px;
  background: #e4e4e2;
}
.portrait__frame img {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  object-fit: cover;
}
.portrait__plate {
  transform: translate3d(calc(var(--px, 0) * -3px), calc(var(--py, 0) * 2px), 0) scale(1.03);
}
.portrait__subject {
  transform-origin: 50% 60%;
  transform: translate3d(calc(var(--px, 0) * 7px), calc(var(--py, 0) * -5px), 0) scale(1.04);
}
.panel--hero .portrait {
  --h: min(62vh, 600px, 44vw);
  position: absolute; z-index: 1;
  right: max(var(--gutter), 5vw);
  top: calc(50% + var(--head-h) / 2);
  height: var(--h); width: calc(var(--h) * 0.8);
  transform: translateY(-50%);
}
.js .portrait { opacity: 0; visibility: hidden; }
.js.returning .portrait { opacity: 1; visibility: visible; }

/* Places: the departures board */
.board {
  --size: min(19px, calc((var(--col) - 44px) / 25.4));
  padding: 18px 22px 20px;
  border-radius: 10px;
  background: var(--board);
  color: var(--paper);
  box-shadow: 0 24px 60px rgba(28, 31, 39, 0.2);
  font-family: var(--f-sans);
}
.board__head {
  display: flex; justify-content: space-between; align-items: baseline;
  padding-bottom: 10px; margin-bottom: 10px;
  border-bottom: 1px solid rgba(236, 238, 234, 0.16);
}
.board__title { font-weight: 800; font-size: 20px; letter-spacing: -0.02em; }
.board__meta { font-size: 13.5px; color: rgba(236, 238, 234, 0.62); }
.board__meta time { color: var(--paper); margin-left: 6px; font-variant-numeric: tabular-nums; }
.board__cols,
.board__row {
  display: grid;
  grid-template-columns: 3.6em 8.1em 3.6em 7.2em;
  justify-content: space-between;
  gap: 0.9em;
  align-items: center;
  font-size: var(--size);
}
.board__cols { margin-bottom: 6px; }
.board__cols span { font-size: 12.5px; color: rgba(236, 238, 234, 0.55); white-space: nowrap; }
.board__rows { display: grid; gap: 5px; }
.board__row > span { font-weight: 800; line-height: 1.3; white-space: nowrap; }
.board__row--next .flap,
.board__row--next > span { color: var(--red-on-dark); }

/* Entries: Young Pioneers Forum and the seven stops share one layout */
.entry { margin-top: 22px; padding-top: 20px; border-top: 1px solid var(--rule-strong); }
.entry__head { display: flex; align-items: flex-start; gap: 14px; margin-bottom: 14px; }
.entry__org { margin: 0; font: 700 clamp(19px, 1.5vw, 22px)/1.2 var(--f-sans); letter-spacing: -0.015em; }
.entry__role { margin: 3px 0 0; font: 500 15px/1.4 var(--f-sans); color: var(--ink-soft); }
.entry__date { margin: 2px 0 0; font: 500 14px/1.4 var(--f-sans); color: var(--graphite); font-variant-numeric: tabular-nums; }
.entry__head--lead { align-items: center; margin-bottom: 20px; }
.entry__head--lead .logo { width: 64px; height: 64px; border-radius: 12px; }
.entry__title { margin: 0; }
.entry__points { margin: 0; padding: 0; list-style: none; display: grid; gap: 9px; }
.entry__points li {
  position: relative; padding-left: 16px;
  font-size: 15px; line-height: 1.55; color: var(--ink-soft);
  text-wrap: pretty;
}
.entry__points li::before {
  content: ""; position: absolute; left: 0; top: 0.66em;
  width: 6px; height: 6px; border-radius: 50%; background: var(--ink);
}

.logo {
  width: 52px; height: 52px; flex: none;
  border-radius: 10px;
  border: 1px solid var(--rule);
  background: #fff;
  object-fit: cover;
}

/* Young Pioneers Forum */
.figures {
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px 22px; margin: 0 0 22px;
  font-family: var(--f-sans);
}
.figures div { display: flex; flex-direction: column-reverse; justify-content: flex-end; gap: 6px; }
.figures dt { font-size: 13.5px; line-height: 1.35; color: var(--graphite); }
.figures dd { margin: 0; font-size: clamp(22px, 2vw, 30px); font-weight: 800; letter-spacing: -0.02em; }

/* Stops */
.stop__city {
  margin: 0 0 12px;
  font: 700 clamp(30px, 3.9vw, 58px)/1 var(--f-sans);
  text-transform: uppercase;
}
.stop__meta {
  display: flex; flex-wrap: wrap; gap: 4px 18px;
  margin: 0;
  font: 500 14px/1.5 var(--f-sans); color: var(--graphite);
}
.stop__meta span:first-child { color: var(--ink); font-weight: 600; }
.stop__meta time { color: var(--ink); font-variant-numeric: tabular-nums; }

/* Results */
.stats {
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px clamp(18px, 2.4vw, 34px);
  margin: 0;
  font-family: var(--f-sans);
}
.stat { display: flex; flex-direction: column-reverse; justify-content: flex-end; gap: 8px; padding-top: 14px; border-top: 1px solid var(--rule-strong); }
.stat dt { font-size: 14px; line-height: 1.4; color: var(--ink-soft); max-width: 30ch; }
.stat dd { margin: 0; font-size: clamp(24px, 2.2vw, 34px); font-weight: 800; }

/* Skills: pick one and the globe shows where it was used */
.skills { display: grid; gap: 12px; margin: 0 0 22px; font-family: var(--f-sans); }
.skills__row { display: grid; grid-template-columns: 84px minmax(0, 1fr); gap: 6px 12px; align-items: start; }
.skills__label { margin: 0; padding-top: 8px; font: 500 13.5px/1.3 var(--f-sans); color: var(--graphite); }
.skills__chips { display: flex; flex-wrap: wrap; gap: 6px; }
.skill {
  position: relative; overflow: hidden;
  display: inline-flex; align-items: center;
  height: 32px; padding: 0 12px;
  border: 1px solid var(--rule-strong); border-radius: 999px;
  background: transparent;
  font: 600 13.5px/1 var(--f-sans); color: var(--ink);
  white-space: nowrap;
  cursor: pointer;
  transition: background 0.2s, color 0.2s, border-color 0.2s;
}
.skill:hover { border-color: var(--ink); }
.skill[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: var(--paper); }
/* While the skills advance on their own, the current one fills with red. */
.skill::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 2px;
  background: var(--red-on-dark);
  transform-origin: 0 50%; transform: scaleX(var(--t, 0));
  opacity: 0;
}
.skill[aria-pressed="true"]::after { opacity: 1; }
.skills__plain { display: inline-flex; align-items: center; min-height: 32px; font: 500 14px/1.35 var(--f-sans); color: var(--ink-soft); }

.skill-uses { min-height: 196px; padding-top: 14px; border-top: 1px solid var(--rule-strong); }
.js .skill-use:not(.is-on) { display: none; }
html:not(.js) .skill-use + .skill-use { margin-top: 16px; }
.skill-use__name { margin: 0 0 8px; font: 700 17px/1.3 var(--f-sans); letter-spacing: -0.01em; }
.skill-use ul { margin: 0; padding: 0; list-style: none; display: grid; gap: 9px; }
.skill-use li { display: grid; gap: 1px; }
.skill-use__where { font: 600 13.5px/1.4 var(--f-sans); color: var(--red-text); }
.skill-use__what { font-size: 15px; line-height: 1.5; color: var(--ink-soft); text-wrap: pretty; }

/* Interests: a two-by-two. Outdoors or indoors; things to practice or to discover. */
.matrix {
  display: grid;
  grid-template-columns: 26px minmax(0, 1fr) minmax(0, 1fr);
  grid-template-areas: ". x1 x2" "y1 a b" "y2 c d";
  margin: 0 0 18px;
  font-family: var(--f-sans);
}
.matrix__axis { font: 500 13px/1 var(--f-sans); color: var(--graphite); }
.matrix__axis--x1 { grid-area: x1; padding: 0 0 9px 16px; }
.matrix__axis--x2 { grid-area: x2; padding: 0 0 9px 16px; }
.matrix__axis--y1,
.matrix__axis--y2 { align-self: center; justify-self: start; writing-mode: vertical-rl; transform: rotate(180deg); }
.matrix__axis--y1 { grid-area: y1; }
.matrix__axis--y2 { grid-area: y2; }
.cell {
  position: relative;
  display: grid; align-content: start; gap: 5px;
  min-height: 116px; padding: 15px 16px 18px;
  border: 0; border-right: 1px solid var(--rule-strong); border-bottom: 1px solid var(--rule-strong);
  background: transparent;
  text-align: left;
  cursor: pointer;
  transition: background 0.25s;
}
.cell--a { grid-area: a; border-top: 1px solid var(--rule-strong); border-left: 1px solid var(--rule-strong); }
.cell--b { grid-area: b; border-top: 1px solid var(--rule-strong); }
.cell--c { grid-area: c; border-left: 1px solid var(--rule-strong); }
.cell--d { grid-area: d; }
.cell:hover { background: rgba(246, 247, 243, 0.55); }
.cell[aria-pressed="true"] { background: var(--card); }
/* The current quadrant: a red dot, and a line that fills until the next object. */
.cell::before {
  content: ""; position: absolute; right: 14px; top: 17px;
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--red);
  opacity: 0; transition: opacity 0.25s;
}
.cell::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 2px;
  background: var(--ink);
  transform-origin: 0 50%; transform: scaleX(var(--t, 0));
  opacity: 0;
}
.cell[aria-pressed="true"]::before,
.cell[aria-pressed="true"]::after { opacity: 1; }
.cell__name { font: 700 18px/1.25 var(--f-sans); letter-spacing: -0.01em; color: var(--ink); }
.cell__items { font-family: var(--f-serif); font-size: 15px; line-height: 1.5; color: var(--ink-soft); text-wrap: pretty; }

/* Contact */
.contact { margin: 0 0 26px; border-top: 1px solid var(--rule-strong); font-family: var(--f-sans); }
.contact > div {
  display: grid; grid-template-columns: 96px minmax(0, 1fr); gap: 4px 12px;
  padding: 12px 0; border-bottom: 1px solid var(--rule);
  align-items: baseline;
}
.contact dt { font-size: 14px; color: var(--graphite); }
.contact dd { margin: 0; font-size: 16px; font-weight: 600; overflow-wrap: anywhere; }
.contact dd a { text-decoration: underline; text-decoration-color: var(--red); text-decoration-thickness: 1.5px; text-underline-offset: 4px; }
.contact dd a:hover { color: var(--red-text); }
.contact__time { margin-left: 10px; font-weight: 500; color: var(--graphite); white-space: nowrap; }
.contact__time time { color: var(--ink); font-variant-numeric: tabular-nums; }
.link-btn {
  margin-left: 12px; padding: 0;
  border: 0; background: none;
  font: 600 14px/1 var(--f-sans); color: var(--graphite);
  text-decoration: underline; text-underline-offset: 3px;
  cursor: pointer;
}
.link-btn:hover { color: var(--ink); }
.link-btn--strong {
  margin-left: 0; font-size: 16px; color: var(--ink);
  text-decoration-color: var(--red); text-decoration-thickness: 1.5px; text-underline-offset: 4px;
}
.foot {
  display: flex; justify-content: space-between; gap: 16px;
  margin-top: 44px; padding-top: 14px;
  border-top: 1px solid var(--rule);
  font: 500 13.5px/1.4 var(--f-sans); color: var(--graphite);
}
.foot a { color: var(--ink); text-underline-offset: 3px; }

/* ---------- Résumé dialog ---------- */

.cv {
  width: min(860px, calc(100vw - 2 * var(--gutter)));
  max-height: calc(100dvh - 48px);
  margin: auto; padding: 0;
  border: 1px solid var(--rule-strong);
  border-radius: 14px;
  background: var(--card);
  color: var(--ink);
  overflow: hidden;
  box-shadow: 0 30px 80px rgba(28, 31, 39, 0.25);
}
.cv::backdrop { background: rgba(28, 31, 39, 0.35); -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px); }
.cv[open] { animation: cv-in 0.4s var(--ease-out); }
@keyframes cv-in { from { opacity: 0; transform: translateY(14px); } }
.cv__inner { max-height: calc(100dvh - 50px); overflow-y: auto; padding: clamp(20px, 4vw, 44px); overscroll-behavior: contain; }
.cv__head {
  display: flex; justify-content: space-between; align-items: flex-start; gap: 16px;
  padding-bottom: 20px; margin-bottom: 6px; border-bottom: 1px solid var(--rule-strong);
}
.cv__name { margin: 0 0 10px; font: 800 clamp(34px, 5vw, 56px)/0.95 var(--f-sans); letter-spacing: -0.04em; }
.cv__contact { margin: 0; font: 500 15px/1.6 var(--f-sans); color: var(--ink-soft); }
.cv__contact a { color: var(--ink); text-underline-offset: 3px; text-decoration-color: var(--red); }
.cv__close { flex: none; }
.cv__sec { padding-block: 20px; border-bottom: 1px solid var(--rule); }
.cv__sec:last-child { border-bottom: 0; }
.cv__sec > h3 { margin: 0 0 12px; font: 700 20px/1.2 var(--f-sans); letter-spacing: -0.015em; }
.cv__item + .cv__item { margin-top: 18px; }
.cv__line { display: flex; justify-content: space-between; gap: 4px 16px; flex-wrap: wrap; font-family: var(--f-sans); }
.cv__line strong { font-size: 16px; }
.cv__line span { font-size: 14px; color: var(--graphite); }
.cv__sub em { font-style: italic; font-family: var(--f-serif); font-size: 15.5px; color: var(--ink-soft); }
.cv p, .cv li { font-size: 15px; line-height: 1.6; color: var(--ink-soft); }
.cv p { margin: 6px 0 0; }
.cv p strong { color: var(--ink); }
.cv ul { margin: 8px 0 0; padding-left: 18px; }
.cv li + li { margin-top: 4px; }

/* ---------- Responsive ---------- */

@media (max-width: 1200px) {
  .brand__name { display: none; }
}

@media (max-width: 1040px) {
  .nav-toggle { display: inline-flex; }
  .site-head__actions { margin-left: auto; }
  .site-nav {
    position: fixed; z-index: 31;
    top: calc(var(--head-h) + env(safe-area-inset-top, 0px) + 4px);
    left: var(--gutter); right: var(--gutter);
    margin: 0; padding: 8px;
    border: 1px solid var(--rule-strong); border-radius: 14px;
    background: var(--card);
    box-shadow: 0 18px 44px rgba(28, 31, 39, 0.16);
    display: none;
  }
  .site-nav.is-open { display: block; }
  .site-nav ul { flex-direction: column; gap: 2px; }
  .site-nav a { width: 100%; height: 46px; padding: 0 14px; border-radius: 10px; font-size: 16px; }
}

@media (max-height: 820px) and (min-width: 821px) {
  .panel { padding-top: calc(var(--head-h) + 24px); padding-bottom: 40px; }
  .skills { gap: 8px; }
  .skill-uses { min-height: 170px; }
  .entry__points li { font-size: 14.5px; }
  .hero__name { font-size: clamp(52px, 6.2vw, 92px); }
}

/* Phones and small tablets: the object owns the top of the screen and the
   text follows below it on paper, so copy never sits on the dots. */
@media (max-width: 820px) {
  :root { --head-h: 58px; --col: auto; }
  .site-nav__extra { display: block; }
  .chip--cv { display: none; }
  .chip { height: 36px; padding: 0 14px; }
  .brand__mark { width: 36px; height: 36px; }

  .panel { display: block; min-height: 0; padding: 0; }
  .panel::before { content: ""; display: block; height: 54vh; height: 54svh; }
  .panel__body { width: auto; padding: 22px var(--gutter) 64px; background: var(--paper); }
  .panel__body::before {
    content: ""; position: absolute; left: 0; right: 0; bottom: 100%; height: 40px;
    background: linear-gradient(rgba(236, 238, 234, 0), var(--paper));
    pointer-events: none;
  }

  .panel--hero { padding-top: calc(var(--head-h) + env(safe-area-inset-top, 0px) + 14px); }
  .panel--hero::before,
  .panel--hero .panel__body::before { display: none; }
  .panel--hero .panel__body { width: auto; padding-top: 22px; background: none; }
  .panel--hero .portrait {
    --h: min(44svh, 380px);
    position: relative; right: auto; top: auto;
    margin: 0 auto;
    transform: none;
  }

  .hero__name { font-size: clamp(40px, 11.6vw, 84px); margin-bottom: 18px; }
  .lede { font-size: 16.5px; margin-bottom: 20px; }
  .facts { gap: 10px 22px; padding-top: 12px; margin-bottom: 22px; }
  .facts dd { font-size: 15px; }
  .title { font-size: clamp(30px, 8.4vw, 44px); }
  .stop__city { font-size: clamp(30px, 10.6vw, 48px); }

  .board { --size: min(18px, calc((100vw - 2 * var(--gutter) - 28px) / 21.2)); padding: 14px 14px 16px; }
  .board__cols,
  .board__row { grid-template-columns: 8.1em 3.6em 7.2em; gap: 0.7em; }
  .board__cols > :first-child,
  .board__row > :first-child { display: none; }

  .figures { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stats { grid-template-columns: 1fr 1fr; gap: 16px; }
  .skills__row { grid-template-columns: 1fr; }
  .skills__label { padding-top: 0; }
  .skill-uses { min-height: 250px; }
  .matrix { grid-template-columns: 20px minmax(0, 1fr) minmax(0, 1fr); }
  .matrix__axis--x1,
  .matrix__axis--x2 { padding-left: 12px; }
  .cell { min-height: 104px; padding: 12px 12px 14px; }
  .cell::before { right: 10px; top: 14px; }
  .cell__name { font-size: 16px; }
  .cell__items { font-size: 14px; }
  .contact > div { grid-template-columns: 1fr; }
  .contact__time { display: block; margin: 2px 0 0; }
  .city-label { font-size: 13px; }
}

@media (max-width: 420px) {
  .stat dt { font-size: 13px; }
  .entry__points li { font-size: 14.5px; }
}

/* ---------- No JavaScript: a plain, readable page ---------- */

html:not(.js) #gl,
html:not(.js) .city-label,
html:not(.js) .nav-toggle,
html:not(.js) [data-open-cv],
html:not(.js) .cv__close,
html:not(.js) .link-btn { display: none; }
html:not(.js) .cv {
  display: block; position: static;
  margin: 0 auto 64px; max-height: none;
  box-shadow: none;
}
html:not(.js) .cv__inner { max-height: none; }

@media (prefers-reduced-motion: reduce) {
  .status__dot { animation: none; }
  .hero, .cv[open] { transition: none; animation: none; }
}
