/* ─────────────────────────────────────────────
   Tokens: deep navy in dark mode, soft blue-grey in light
   ───────────────────────────────────────────── */
:root {
  --bg: #f3f5fa;
  --surface: #ffffff;
  --surface-2: #f6f8fc;
  --text: #121a2c;
  --text-2: #43506a;
  --muted: #7a859c;
  --line: rgba(18, 26, 44, 0.1);
  --line-strong: rgba(18, 26, 44, 0.2);
  --chip: rgba(18, 26, 44, 0.05);
  --shadow: 0 1px 2px rgba(18, 26, 44, 0.05), 0 12px 32px -16px rgba(18, 26, 44, 0.18);
  --accent: #3b5bdb;

  --sans: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, monospace;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f1526; --surface: #161e35; --surface-2: #1b2440;
    --text: #edf1fa; --text-2: #b4bed4; --muted: #7e8aa6;
    --line: rgba(170, 190, 235, 0.12); --line-strong: rgba(170, 190, 235, 0.22); --chip: rgba(170, 190, 235, 0.07);
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.25), 0 18px 40px -20px rgba(0, 0, 0, 0.6);
    --accent: #7d9bff;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0f1526; --surface: #161e35; --surface-2: #1b2440;
  --text: #edf1fa; --text-2: #b4bed4; --muted: #7e8aa6;
  --line: rgba(170, 190, 235, 0.12); --line-strong: rgba(170, 190, 235, 0.22); --chip: rgba(170, 190, 235, 0.07);
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.25), 0 18px 40px -20px rgba(0, 0, 0, 0.6);
  --accent: #7d9bff;
  color-scheme: dark;
}

/* ─────────────────────────────────────────────
   Base
   ───────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font-family: var(--sans); font-size: 16px; line-height: 1.65;
  font-feature-settings: "cv11", "ss01", "ss03";
  -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale;
  transition: background-color 0.4s var(--ease), color 0.4s var(--ease);
}
::selection { background: var(--accent); color: #fff; }
a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; height: auto; }
h1, h2, h3 { margin: 0; font-weight: 600; letter-spacing: -0.015em; }
p { margin: 0; }
ul, ol, dl, dd { margin: 0; padding: 0; list-style: none; }
strong { font-weight: 560; color: var(--text); }
.mono { font-family: var(--mono); font-feature-settings: "zero" 0, "calt" 0; }
.muted { color: var(--muted); }
.print-only { display: none; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 4px; }
.skip {
  position: fixed; top: 12px; left: 12px; z-index: 50; padding: 8px 14px; border-radius: 8px;
  background: var(--text); color: var(--bg); font-size: 14px; transform: translateY(-200%); transition: transform 0.2s var(--ease);
}
.skip:focus { transform: none; }

/* ─────────────────────────────────────────────
   Top bar
   ───────────────────────────────────────────── */
.top {
  position: sticky; top: 0; z-index: 20;
  background: color-mix(in srgb, var(--bg) 85%, transparent);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid transparent; transition: border-color 0.3s;
}
.top.is-scrolled { border-bottom-color: var(--line); }
.top-in { display: flex; align-items: center; justify-content: space-between; gap: 16px; max-width: 880px; margin: 0 auto; padding: 14px 20px; }
.brand { font-weight: 600; letter-spacing: -0.01em; }
.top nav { display: flex; align-items: center; gap: 22px; font-size: 14px; }
.top nav a { color: var(--muted); transition: color 0.2s; }
.top nav a:hover, .top nav a.is-on { color: var(--text); }
@media (max-width: 680px) { .top nav a:not(.keep) { display: none; } }
.theme-toggle {
  display: grid; place-items: center; width: 32px; height: 32px; margin: 0 -6px 0 -4px;
  border: 0; border-radius: 50%; background: transparent; color: var(--muted); cursor: pointer; transition: color 0.2s, background-color 0.2s;
}
.theme-toggle:hover { color: var(--text); background: var(--chip); }
.theme-toggle svg { width: 16px; height: 16px; grid-area: 1 / 1; transition: transform 0.5s var(--ease), opacity 0.3s; }
.i-moon { opacity: 0; transform: rotate(-90deg) scale(0.6); }
:root[data-theme="dark"] .i-sun { opacity: 0; transform: rotate(90deg) scale(0.6); }
:root[data-theme="dark"] .i-moon { opacity: 1; transform: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .i-sun { opacity: 0; transform: rotate(90deg) scale(0.6); }
  :root:not([data-theme="light"]) .i-moon { opacity: 1; transform: none; }
}

/* ─────────────────────────────────────────────
   Page: one column, every section the same shape
   ───────────────────────────────────────────── */
.page { max-width: 880px; margin: 0 auto; padding: 0 20px; }

.intro { padding: clamp(56px, 12vh, 112px) 0 56px; }
.eyebrow { font-size: 13px; color: var(--accent); letter-spacing: 0.02em; }
.intro h1 { margin-top: 14px; font-size: clamp(40px, 7vw, 64px); line-height: 1.05; letter-spacing: -0.035em; font-weight: 650; }
.summary { margin-top: 20px; max-width: 60ch; font-size: clamp(17px, 2vw, 19px); line-height: 1.6; color: var(--text-2); }
.actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 30px; }
.btn {
  display: inline-flex; align-items: center; height: 42px; padding: 0 18px; border-radius: 10px;
  font-size: 14.5px; font-weight: 550; border: 1px solid var(--line-strong); color: var(--text);
  transition: border-color 0.2s, background-color 0.2s;
}
.btn:hover { border-color: var(--accent); }
.btn-primary { border-color: var(--accent); background: var(--accent); color: #fff; }
.btn-primary:hover { filter: brightness(1.08); }

/* A section: label on the left, content on the right */
.row { display: grid; gap: 16px; padding: 40px 0; border-top: 1px solid var(--line); scroll-margin-top: 56px; }
@media (min-width: 720px) { .row { grid-template-columns: 180px 1fr; gap: 32px; } }
.row-h { font-size: 12px; font-weight: 500; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); padding-top: 4px; }

.prose p { color: var(--text-2); font-size: 16.5px; line-height: 1.75; }
.prose p + p { margin-top: 14px; }

.facts { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; margin-top: 28px; padding-top: 22px; border-top: 1px dashed var(--line); }
@media (min-width: 560px) { .facts { grid-template-columns: repeat(4, 1fr); } }
.facts dt, .skills dt { font-size: 12px; color: var(--muted); }
.facts dd { margin-top: 4px; font-weight: 560; }

/* Experience, education and notes share one list layout */
.list { display: grid; gap: 0; }
.item { display: grid; gap: 4px 24px; padding: 14px 0; }
.item + .item { border-top: 1px solid var(--line); }
@media (min-width: 560px) { .item { grid-template-columns: 120px 1fr; } }
.item .when { font-size: 13px; color: var(--muted); padding-top: 2px; }
.item h3 { font-size: 16.5px; }
.item .at { color: var(--muted); font-weight: 500; }
.item .meta { margin-top: 2px; font-size: 14.5px; color: var(--text-2); }
.grade { margin-left: 8px; font-size: 12.5px; font-weight: 500; color: var(--accent); }
.item a h3 { transition: color 0.2s; }
.item a:hover h3 { color: var(--accent); }

.skills { display: grid; gap: 12px; }
.skills > div { display: grid; gap: 2px 24px; }
@media (min-width: 560px) { .skills > div { grid-template-columns: 160px 1fr; } }
.skills dt { padding-top: 2px; }
.skills dd { color: var(--text-2); }

.more { display: inline-block; margin-top: 14px; font-size: 14px; color: var(--accent); }
.contact-line { color: var(--text-2); }
.contact-line a, .prose a { color: var(--text); text-decoration: underline; text-decoration-color: var(--accent); text-underline-offset: 3px; }

.foot { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px 24px; padding: 28px 0 48px; border-top: 1px solid var(--line); font-size: 12px; color: var(--muted); }

/* ─────────────────────────────────────────────
   Print: the same structure on A4
   ───────────────────────────────────────────── */
@media print {
  @page { size: A4; margin: 14mm 15mm 12mm; }
  :root, :root[data-theme="dark"] {
    --bg: #fff; --surface: #fff; --text: #111; --text-2: #333; --muted: #666;
    --line: #ddd; --line-strong: #bbb; --accent: #2f4ac0; color-scheme: light;
  }
  html { font-size: 10pt; }
  body { background: #fff; font-size: 9.6pt; line-height: 1.45; }
  .top, .skip, .actions, .facts, .notes-sec, #contact, .foot { display: none !important; }
  .print-only { display: block !important; margin-top: 4pt; font-size: 8.6pt; color: #333; }
  .page { max-width: none; padding: 0; }
  .intro { padding: 0 0 8pt; }
  .eyebrow { font-size: 9pt; }
  .intro h1 { margin-top: 2pt; font-size: 24pt; line-height: 1.2; letter-spacing: -0.02em; }
  .summary { margin-top: 4pt; max-width: none; font-size: 9.6pt; color: #333; }
  .row { grid-template-columns: 30mm 1fr; gap: 12pt; padding: 8pt 0; break-inside: avoid; }
  .row-h { font-size: 8pt; padding-top: 1pt; color: #2f4ac0; }
  .prose p { font-size: 9.4pt; line-height: 1.5; }
  .prose p + p { margin-top: 4pt; }
  .item { grid-template-columns: 24mm 1fr; padding: 4pt 0; gap: 0 10pt; break-inside: avoid; }
  .item .when { font-size: 8.4pt; }
  .item h3 { font-size: 10.2pt; }
  .item .meta { font-size: 8.8pt; }
  .skills { gap: 3pt; }
  .skills > div { grid-template-columns: 34mm 1fr; }
  .skills dt, .skills dd { font-size: 9pt; }
}
