/* ==========================================================================
   Federico Tessarin — site styles
   One file, no framework. Tokens first, then layout, components, pages.
   ========================================================================== */

/* ---------- Tokens ---------- */
:root {
  --bg: #f6f5f1;
  --bg-2: #efede7;
  --surface: #ffffff;
  --ink: #121214;
  --ink-2: #2a2a2e;
  --muted: #5c5c64;
  --subtle: #8b8b93;
  --line: #e3e1da;
  --line-2: #d3d0c7;
  --accent: #2f4bff;
  --accent-ink: #ffffff;
  --accent-soft: #e8ebff;
  --good: #1f7a4d;
  --shadow: 0 1px 2px rgba(18, 18, 20, .04), 0 12px 40px -12px rgba(18, 18, 20, .12);

  --font: "Geist", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "Geist Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;

  --max: 1280px;
  --gutter: clamp(16px, 4vw, 40px);
  --radius: 16px;
  --radius-lg: 24px;
  --ease: cubic-bezier(.2, .7, .2, 1);

  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0c0c0e; --bg-2: #121215; --surface: #17171b; --ink: #ededef; --ink-2: #d4d4d8;
    --muted: #a1a1aa; --subtle: #71717a; --line: #26262c; --line-2: #34343b;
    --accent: #8293ff; --accent-ink: #0c0c0e; --accent-soft: #1b1f3a; --good: #4ade80;
    --shadow: 0 1px 2px rgba(0,0,0,.3), 0 16px 48px -16px rgba(0,0,0,.6);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0c0c0e; --bg-2: #121215; --surface: #17171b; --ink: #ededef; --ink-2: #d4d4d8;
  --muted: #a1a1aa; --subtle: #71717a; --line: #26262c; --line-2: #34343b;
  --accent: #8293ff; --accent-ink: #0c0c0e; --accent-soft: #1b1f3a; --good: #4ade80;
  --shadow: 0 1px 2px rgba(0,0,0,.3), 0 16px 48px -16px rgba(0,0,0,.6);
  color-scheme: dark;
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 400 17px/1.6 var(--font); letter-spacing: -0.006em;
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
  overflow-x: hidden;
}
img { max-width: 100%; height: auto; display: block; }
a { color: inherit; text-decoration: none; }
p { margin: 0; }
h1, h2, h3, h4 { margin: 0; font-weight: 600; letter-spacing: -0.03em; line-height: 1.08; }
ul, ol { margin: 0; padding: 0; list-style: none; }
::selection { background: var(--accent); color: var(--accent-ink); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 6px; }

.shell { width: 100%; max-width: var(--max); margin: 0 auto; padding: 0 var(--gutter); }
.mono { font-family: var(--mono); letter-spacing: 0; }
.muted { color: var(--muted); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: 16px; top: -60px; z-index: 100; background: var(--ink); color: var(--bg); padding: 10px 14px; border-radius: 10px; }
.skip:focus { top: 12px; }

.eyebrow {
  font: 500 12.5px/1 var(--mono); letter-spacing: .04em; text-transform: uppercase; color: var(--muted);
  display: inline-flex; align-items: center; gap: 10px;
}
.eyebrow::before { content: ""; width: 18px; height: 1px; background: currentColor; opacity: .6; }
.eyebrow--plain::before { display: none; }

/* ---------- Header ---------- */
.header {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: saturate(1.4) blur(14px); -webkit-backdrop-filter: saturate(1.4) blur(14px);
  border-bottom: 1px solid transparent; transition: border-color .3s var(--ease);
}
.header.is-scrolled { border-bottom-color: var(--line); }
.header__inner { height: 68px; display: flex; align-items: center; gap: 24px; }
.brand { display: inline-flex; align-items: center; gap: 12px; font-weight: 600; letter-spacing: -0.02em; }
.brand__mark {
  width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center;
  background: var(--ink); color: var(--bg); font: 600 13px/1 var(--mono); letter-spacing: -.02em;
}
.brand__name { font-size: 15.5px; }
.brand__role { display: block; font: 400 12px/1.2 var(--font); color: var(--muted); letter-spacing: 0; }
.nav { margin-left: auto; display: flex; align-items: center; gap: 4px; }
.nav a { padding: 8px 12px; border-radius: 10px; font-size: 14.5px; color: var(--muted); transition: color .2s, background .2s; }
.nav a:hover, .nav a[aria-current="page"] { color: var(--ink); background: var(--bg-2); }
.header__actions { display: flex; align-items: center; gap: 8px; }
.nav .nav__cta { display: none; }
.icon-btn {
  width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center;
  background: transparent; border: 1px solid var(--line); color: var(--ink); cursor: pointer;
}
.icon-btn:hover { background: var(--bg-2); }
.icon-btn svg { width: 17px; height: 17px; }
.theme-sun { display: none; }
:root[data-theme="dark"] .theme-sun { display: block; }
:root[data-theme="dark"] .theme-moon { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-sun { display: block; }
  :root:not([data-theme="light"]) .theme-moon { display: none; }
}
.menu-btn { display: none; }

@media (max-width: 860px) {
  .nav {
    position: fixed; inset: 68px 0 auto 0; flex-direction: column; align-items: stretch; gap: 0;
    background: var(--bg); border-bottom: 1px solid var(--line); padding: 8px var(--gutter) 20px;
    transform: translateY(-8px); opacity: 0; pointer-events: none; transition: .25s var(--ease);
  }
  .nav a { padding: 14px 4px; font-size: 18px; color: var(--ink); border-bottom: 1px solid var(--line); border-radius: 0; }
  .nav a:hover { background: none; }
  .header.is-open .nav { transform: none; opacity: 1; pointer-events: auto; }
  .menu-btn { display: grid; }
  .header__actions { margin-left: auto; }
  .nav .nav__cta { display: flex; justify-content: center; margin-top: 16px; padding: 14px; border: 0; border-radius: 12px; background: var(--ink); color: var(--bg); font-size: 16px; font-weight: 500; }
  .nav .nav__cta:hover { background: var(--ink-2); }
  .header__actions .btn { display: none; }
  .brand__role { display: none; }
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 44px; padding: 0 18px; border-radius: 12px; border: 1px solid transparent;
  font: 500 15px/1 var(--font); letter-spacing: -0.01em; cursor: pointer; white-space: nowrap;
  transition: transform .2s var(--ease), background .2s, border-color .2s, color .2s;
}
.btn svg { width: 16px; height: 16px; transition: transform .25s var(--ease); }
.btn:hover svg { transform: translateX(2px); }
.btn--primary { background: var(--ink); color: var(--bg); }
.btn--primary:hover { background: var(--ink-2); }
.btn--ghost { border-color: var(--line-2); color: var(--ink); background: transparent; }
.btn--ghost:hover { background: var(--surface); border-color: var(--ink); }
.btn--sm { height: 38px; padding: 0 14px; font-size: 14px; border-radius: 10px; }
.link-arrow { display: inline-flex; align-items: center; gap: 6px; font-weight: 500; border-bottom: 1px solid var(--line-2); padding-bottom: 2px; transition: border-color .2s; }
.link-arrow:hover { border-color: var(--ink); }
.link-arrow svg { width: 15px; height: 15px; }

/* ---------- Sections ---------- */
.section { padding: clamp(72px, 10vw, 140px) 0; }
.section--tight { padding: clamp(48px, 7vw, 96px) 0; }
.section + .section { border-top: 1px solid var(--line); }
.section__head { display: grid; grid-template-columns: 1fr auto; gap: 24px 48px; align-items: end; margin-bottom: clamp(36px, 5vw, 64px); }
.section__head h2 { font-size: clamp(34px, 4.6vw, 60px); letter-spacing: -0.045em; max-width: 16ch; margin-top: 18px; }
.section__head p { color: var(--muted); max-width: 46ch; font-size: 17px; }
@media (max-width: 760px) { .section__head { grid-template-columns: 1fr; } }

/* ---------- Hero ---------- */
.hero { padding: clamp(56px, 9vw, 120px) 0 clamp(40px, 6vw, 72px); }
.hero h1 {
  font-size: clamp(44px, 7.4vw, 108px); letter-spacing: -0.055em; line-height: .98;
  max-width: 13.5ch; margin-top: 28px; text-wrap: balance;
}
.hero h1 em { font-style: normal; color: var(--muted); }
.hero__foot { margin-top: clamp(32px, 4vw, 48px); display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 32px; align-items: end; }
.hero__lead { font-size: clamp(18px, 1.6vw, 21px); line-height: 1.55; color: var(--muted); max-width: 52ch; }
.hero__lead strong { color: var(--ink); font-weight: 500; }
.hero__ctas { display: flex; gap: 10px; flex-wrap: wrap; }
.status { display: inline-flex; align-items: flex-start; gap: 10px; font-size: 14px; line-height: 1.5; color: var(--muted); margin-top: 22px; }
.status__dot { flex: none; margin-top: 6px; width: 8px; height: 8px; border-radius: 50%; background: var(--good); box-shadow: 0 0 0 4px color-mix(in srgb, var(--good) 20%, transparent); }
@media (max-width: 760px) { .hero__foot { grid-template-columns: 1fr; } }

.showcase {
  margin-top: clamp(40px, 6vw, 72px); display: grid; gap: 16px;
  grid-template-columns: 1.55fr 1fr; grid-template-rows: auto auto;
}
.showcase figure { margin: 0; border-radius: var(--radius-lg); overflow: hidden; background: var(--bg-2); border: 1px solid var(--line); position: relative; }
.showcase figure:first-child { grid-row: span 2; }
.showcase img { width: 100%; height: 100%; object-fit: cover; object-position: left top; }
.showcase figcaption {
  position: absolute; left: 14px; bottom: 14px; padding: 6px 10px; border-radius: 8px;
  background: color-mix(in srgb, var(--surface) 88%, transparent); backdrop-filter: blur(8px);
  font: 500 12px/1.2 var(--mono); color: var(--ink); border: 1px solid var(--line);
}
@media (max-width: 760px) { .showcase { grid-template-columns: 1fr; } .showcase figure:first-child { grid-row: auto; } }

/* ---------- Proof strip ---------- */
.proof { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 40px; padding: 28px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.proof__label { font: 500 12.5px/1 var(--mono); text-transform: uppercase; letter-spacing: .04em; color: var(--subtle); }
.proof__item { font-weight: 600; font-size: 19px; letter-spacing: -0.03em; color: var(--muted); }

/* ---------- Work cards ---------- */
.work-grid { display: grid; grid-template-columns: repeat(12, 1fr); gap: 20px; }
.card {
  grid-column: span 6; display: flex; flex-direction: column; gap: 18px; color: inherit;
  border-radius: var(--radius-lg); transition: transform .45s var(--ease);
}
.card--wide { grid-column: span 12; }
.card__media {
  border-radius: var(--radius-lg); overflow: hidden; background: var(--bg-2); border: 1px solid var(--line);
  aspect-ratio: 16 / 10; position: relative;
}
.card--wide .card__media { aspect-ratio: 21 / 9; }
.card__media img { width: 100%; height: 100%; object-fit: cover; object-position: left top; transition: transform .8s var(--ease); }
.card__media--contain img { object-fit: contain; object-position: center; padding: 6%; }
a.card:hover .card__media img { transform: scale(1.025); }
.card__tag {
  position: absolute; top: 14px; left: 14px; padding: 5px 9px; border-radius: 8px;
  font: 500 11.5px/1.2 var(--mono); background: color-mix(in srgb, var(--surface) 90%, transparent); border: 1px solid var(--line);
  backdrop-filter: blur(8px);
}
.card__body { display: grid; grid-template-columns: 1fr auto; gap: 8px 24px; align-items: start; }
.card__title { font-size: clamp(22px, 2vw, 28px); letter-spacing: -0.035em; }
.card__desc { color: var(--muted); font-size: 16px; max-width: 58ch; grid-column: 1; }
.card__meta { font: 400 13px/1.5 var(--mono); color: var(--subtle); grid-column: 1; }
.card__cta { grid-row: 1 / span 2; grid-column: 2; width: 42px; height: 42px; border-radius: 50%; border: 1px solid var(--line-2); display: grid; place-items: center; transition: .3s var(--ease); }
.card__cta svg { width: 17px; height: 17px; }
a.card:hover .card__cta { background: var(--ink); color: var(--bg); border-color: var(--ink); transform: rotate(-45deg); }
.card__stats { display: flex; gap: 28px; margin-top: 4px; grid-column: 1 / -1; flex-wrap: wrap; }
.card__stat b { display: block; font-size: 22px; font-weight: 600; letter-spacing: -0.03em; }
.card__stat span { font-size: 13px; color: var(--muted); }
.work-grid--thirds .card:not(.card--wide) { grid-column: span 4; }
.work-grid--thirds .card:not(.card--wide) .card__media { aspect-ratio: 4 / 3; }
.work-grid--thirds .card:not(.card--wide) .card__title { font-size: 22px; }
@media (max-width: 1100px) { .work-grid--thirds .card:not(.card--wide) { grid-column: span 6; } .work-grid--thirds .card:not(.card--wide):last-child { grid-column: span 12; } .work-grid--thirds .card:not(.card--wide):last-child .card__media { aspect-ratio: 21 / 9; } }
@media (max-width: 860px) { .card, .work-grid--thirds .card:not(.card--wide) { grid-column: span 12; } .card--wide .card__media, .work-grid--thirds .card:not(.card--wide):last-child .card__media { aspect-ratio: 16/10; } }

.group-label { display: flex; align-items: baseline; gap: 16px; margin: 72px 0 28px; padding-top: 28px; border-top: 1px solid var(--line); }
.group-label h3 { font-size: 22px; letter-spacing: -0.03em; }
.group-label p { color: var(--muted); font-size: 15.5px; max-width: 60ch; }
@media (max-width: 760px) { .group-label { flex-direction: column; gap: 6px; } }

/* ---------- Approach ---------- */
.principles { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0; border-top: 1px solid var(--line); }
.principle { padding: 28px 28px 8px 0; border-right: 1px solid var(--line); margin-right: 28px; }
.principle:last-child { border-right: 0; margin-right: 0; }
.principle__n { font: 500 13px/1 var(--mono); color: var(--accent); }
.principle h3 { font-size: 21px; margin: 18px 0 12px; letter-spacing: -0.03em; line-height: 1.2; }
.principle p { color: var(--muted); font-size: 15.5px; }
@media (max-width: 960px) {
  .principles { grid-template-columns: 1fr 1fr; }
  .principle { border-right: 0; margin-right: 0; border-bottom: 1px solid var(--line); padding-bottom: 28px; }
}
@media (max-width: 560px) { .principles { grid-template-columns: 1fr; } }

/* ---------- Experience ---------- */
.timeline { border-top: 1px solid var(--line); }
.timeline li { display: grid; grid-template-columns: 160px 1fr 1fr; gap: 24px; padding: 22px 0; border-bottom: 1px solid var(--line); align-items: baseline; }
.timeline__when { font: 400 14px/1.4 var(--mono); color: var(--subtle); }
.timeline__role { font-weight: 600; font-size: 18px; letter-spacing: -0.02em; }
.timeline__org { color: var(--muted); }
.timeline__note { color: var(--muted); font-size: 15.5px; }
@media (max-width: 760px) { .timeline li { grid-template-columns: 1fr; gap: 4px; } }

/* ---------- Web work list ---------- */
.sites { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0 32px; border-top: 1px solid var(--line); }
.site { display: flex; align-items: center; gap: 14px; padding: 16px 0; border-bottom: 1px solid var(--line); }
.site img { width: 56px; height: 40px; border-radius: 8px; object-fit: cover; object-position: left top; border: 1px solid var(--line); flex: none; }
.site__name { font-weight: 500; font-size: 15.5px; letter-spacing: -0.015em; }
.site__kind { font-size: 13px; color: var(--muted); }
.site svg { margin-left: auto; width: 15px; height: 15px; color: var(--subtle); transition: transform .25s var(--ease), color .2s; flex: none; }
a.site:hover svg { transform: translate(2px, -2px); color: var(--ink); }
@media (max-width: 960px) { .sites { grid-template-columns: 1fr 1fr; } }
@media (max-width: 600px) { .sites { grid-template-columns: 1fr; } }

/* ---------- About ---------- */
.about { display: grid; grid-template-columns: 1.1fr 1fr; gap: clamp(32px, 6vw, 96px); }
.about__text p { font-size: clamp(19px, 1.7vw, 23px); line-height: 1.5; letter-spacing: -0.015em; }
.about__text p + p { margin-top: 20px; color: var(--muted); }
.facts { display: grid; grid-template-columns: 1fr 1fr; gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; align-self: start; }
.fact { background: var(--bg); padding: 22px; }
.fact b { display: block; font-size: 30px; font-weight: 600; letter-spacing: -0.04em; }
.fact span { font-size: 14px; color: var(--muted); }
@media (max-width: 860px) { .about { grid-template-columns: 1fr; } }

/* ---------- Contact ---------- */
.contact { background: var(--ink); color: var(--bg); border-radius: var(--radius-lg); padding: clamp(36px, 6vw, 80px); display: grid; gap: 32px; }
.contact h2 { font-size: clamp(36px, 5.4vw, 76px); letter-spacing: -0.05em; max-width: 14ch; line-height: 1; }
.contact p { color: color-mix(in srgb, var(--bg) 70%, transparent); max-width: 50ch; font-size: 18px; }
.contact__row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.contact .btn--primary { background: var(--bg); color: var(--ink); }
.contact .btn--ghost { color: var(--bg); border-color: color-mix(in srgb, var(--bg) 30%, transparent); }
.contact .btn--ghost:hover { background: color-mix(in srgb, var(--bg) 10%, transparent); border-color: var(--bg); }
.contact__mail { font: 500 clamp(18px, 2vw, 24px)/1 var(--mono); letter-spacing: -0.02em; border-bottom: 1px solid color-mix(in srgb, var(--bg) 35%, transparent); padding-bottom: 4px; }

/* ---------- Footer ---------- */
.footer { padding: 40px 0 56px; color: var(--muted); font-size: 14px; }
.footer__inner { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.footer a:hover { color: var(--ink); }
.footer nav { display: flex; gap: 20px; }

/* ---------- Case study ---------- */
.cs-hero { padding: clamp(40px, 7vw, 96px) 0 0; }
.back { display: inline-flex; align-items: center; gap: 8px; color: var(--muted); font-size: 14.5px; margin-bottom: 40px; }
.back:hover { color: var(--ink); }
.back svg { width: 15px; height: 15px; }
.cs-hero h1 { font-size: clamp(42px, 6.6vw, 96px); letter-spacing: -0.055em; line-height: 1; margin-top: 22px; max-width: 15ch; text-wrap: balance; }
.cs-hero__lead { font-size: clamp(19px, 1.8vw, 24px); color: var(--muted); max-width: 54ch; margin-top: 24px; line-height: 1.5; }
.cs-meta { display: grid; grid-template-columns: repeat(4, 1fr); gap: 24px; margin-top: 48px; padding-top: 28px; border-top: 1px solid var(--line); }
.cs-meta dt { font: 500 12px/1 var(--mono); text-transform: uppercase; letter-spacing: .04em; color: var(--subtle); margin-bottom: 10px; }
.cs-meta dd { margin: 0; font-size: 15.5px; }
@media (max-width: 760px) { .cs-meta { grid-template-columns: 1fr 1fr; } }
.notice {
  display: flex; gap: 12px; align-items: flex-start; margin-top: 28px; padding: 14px 16px; border-radius: 12px;
  background: var(--accent-soft); color: var(--ink); font-size: 14.5px; max-width: 760px;
}
.notice svg { width: 18px; height: 18px; flex: none; color: var(--accent); margin-top: 2px; }
.cs-cover { margin-top: clamp(40px, 6vw, 72px); border-radius: var(--radius-lg); overflow: hidden; border: 1px solid var(--line); background: var(--bg-2); padding: clamp(16px, 4vw, 56px); }
.cs-cover img { border-radius: 12px; box-shadow: var(--shadow); margin: 0 auto; }
.cs-cover--bare { padding: 0; }
.cs-cover--bare img { border-radius: 0; box-shadow: none; }

.cs-block { padding: clamp(64px, 9vw, 120px) 0 0; }
.cs-grid { display: grid; grid-template-columns: 280px 1fr; gap: clamp(24px, 5vw, 80px); }
.cs-grid > .label { position: sticky; top: 100px; align-self: start; }
.cs-grid h2 { font-size: clamp(28px, 3.2vw, 42px); letter-spacing: -0.04em; margin-top: 14px; }
@media (max-width: 860px) { .cs-grid { grid-template-columns: 1fr; } .cs-grid > .label { position: static; } }
.prose p { font-size: 18.5px; line-height: 1.65; color: var(--ink-2); max-width: 64ch; }
.prose p + p { margin-top: 18px; }
.prose h3 { font: 500 12.5px/1 var(--mono); letter-spacing: .04em; text-transform: uppercase; color: var(--subtle); margin: 36px 0 12px; }
.prose h3:first-child { margin-top: 0; }

.persona { margin-top: 36px; border: 1px solid var(--line); border-radius: var(--radius); padding: 26px; background: var(--surface); display: grid; grid-template-columns: 1fr 1fr; gap: 22px 32px; }
.persona__head { grid-column: 1 / -1; display: flex; gap: 14px; align-items: center; }
.persona__avatar { width: 46px; height: 46px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); display: grid; place-items: center; font: 600 14px/1 var(--mono); flex: none; overflow: hidden; }
.persona__avatar img { width: 100%; height: 100%; object-fit: cover; }
.persona__name { font-weight: 600; font-size: 17px; }
.persona__note { font-size: 13px; color: var(--subtle); }
.persona h4 { font: 500 12px/1 var(--mono); text-transform: uppercase; letter-spacing: .04em; color: var(--subtle); margin-bottom: 10px; }
.persona li { font-size: 15.5px; padding-left: 16px; position: relative; margin-bottom: 6px; }
.persona li::before { content: ""; position: absolute; left: 0; top: 10px; width: 6px; height: 6px; border-radius: 50%; background: var(--accent); }
.persona .is-pain li::before { background: #d14a3a; }
.persona blockquote { grid-column: 1 / -1; margin: 0; font-size: 16px; color: var(--muted); border-left: 2px solid var(--line-2); padding-left: 14px; }
@media (max-width: 640px) { .persona { grid-template-columns: 1fr; } }

.flow { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 8px; }
.flow__step { display: inline-flex; align-items: center; gap: 8px; padding: 9px 13px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); font-size: 14.5px; font-weight: 500; }
.flow__step b { font: 500 11px/1 var(--mono); color: var(--accent); background: var(--accent-soft); padding: 4px 6px; border-radius: 6px; }
.flow__arrow { color: var(--subtle); font-size: 14px; }

.chapter { padding-top: clamp(72px, 10vw, 140px); }
.chapter__head { display: grid; grid-template-columns: 280px 1fr; gap: clamp(24px, 5vw, 80px); align-items: end; }
.chapter__num { font: 500 13px/1 var(--mono); color: var(--accent); }
.chapter__head h2 { font-size: clamp(32px, 4vw, 54px); letter-spacing: -0.045em; margin-top: 14px; }
.chapter__goal { font-size: 19px; color: var(--muted); max-width: 52ch; }
@media (max-width: 860px) { .chapter__head { grid-template-columns: 1fr; gap: 14px; } }
.chapter__media { margin-top: 36px; border-radius: var(--radius-lg); background: var(--bg-2); border: 1px solid var(--line); padding: clamp(12px, 3vw, 40px); overflow: hidden; }
.chapter__media img { margin: 0 auto; width: 100%; max-width: 1180px; }
.chapter__media--dark { background: #0b0c0e; border-color: #1d1f24; }
.notes { margin-top: 28px; display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 16px; }
.note { padding: 22px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--line); display: flex; flex-direction: column; gap: 10px; }
.note__n { width: 26px; height: 26px; border-radius: 50%; background: var(--accent); color: var(--accent-ink); display: grid; place-items: center; font: 600 12px/1 var(--mono); }
.note h3 { font-size: 17.5px; letter-spacing: -0.02em; line-height: 1.3; }
.note p { color: var(--muted); font-size: 15px; line-height: 1.55; }
.note__alt { margin-top: auto; padding-top: 12px; border-top: 1px dashed var(--line-2); font-size: 13.5px; color: var(--muted); }
.note__alt b { font: 500 11px/1 var(--mono); text-transform: uppercase; letter-spacing: .05em; color: var(--subtle); display: block; margin-bottom: 6px; }

.rules { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-top: 36px; }
.rule { padding: 24px; border-radius: var(--radius); border: 1px solid var(--line); background: var(--surface); }
.rule h3 { font-size: 18px; letter-spacing: -0.02em; margin-bottom: 10px; line-height: 1.25; }
.rule p { color: var(--muted); font-size: 15px; }
.rule code { display: inline-block; margin-top: 14px; font: 13px/1.5 var(--mono); background: var(--bg-2); padding: 6px 9px; border-radius: 8px; }
@media (max-width: 860px) { .rules { grid-template-columns: 1fr; } }

.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; margin-top: 36px; }
.stat { background: var(--bg); padding: 28px; }
.stat b { display: block; font-size: clamp(40px, 4.4vw, 60px); letter-spacing: -0.05em; font-weight: 600; line-height: 1; }
.stat h3 { font-size: 16px; margin: 14px 0 6px; letter-spacing: -0.015em; }
.stat p { color: var(--muted); font-size: 14.5px; }
@media (max-width: 760px) { .stats { grid-template-columns: 1fr; } }

.lists { display: grid; grid-template-columns: 1fr 1fr; gap: 48px; margin-top: 32px; }
.lists h3 { font: 500 12.5px/1 var(--mono); text-transform: uppercase; letter-spacing: .04em; color: var(--subtle); margin-bottom: 16px; }
.lists li { padding: 14px 0; border-top: 1px solid var(--line); font-size: 16.5px; }
@media (max-width: 760px) { .lists { grid-template-columns: 1fr; gap: 24px; } }

.features { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-top: 36px; }
.feature { padding: 24px; border-radius: var(--radius); border: 1px solid var(--line); background: var(--surface); }
.feature h3 { font-size: 18px; margin-bottom: 8px; letter-spacing: -0.02em; }
.feature p { color: var(--muted); font-size: 15px; }
@media (max-width: 860px) { .features { grid-template-columns: 1fr; } }
.pair { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 36px; }
.pair figure { margin: 0; border-radius: var(--radius); overflow: hidden; border: 1px solid var(--line); background: var(--bg-2); }
.pair figure img { width: 100%; }
.pair figcaption { padding: 14px 16px; font-size: 14px; color: var(--muted); background: var(--surface); border-top: 1px solid var(--line); }
.pair figcaption b { color: var(--ink); font-weight: 600; margin-right: 6px; }
@media (max-width: 760px) { .pair { grid-template-columns: 1fr; } }

.next { margin-top: clamp(80px, 10vw, 140px); border-top: 1px solid var(--line); padding: 40px 0 0; }
.next a { display: grid; grid-template-columns: 1fr auto; gap: 8px 24px; align-items: center; }
.next span { font: 500 12.5px/1 var(--mono); text-transform: uppercase; letter-spacing: .04em; color: var(--subtle); }
.next h2 { font-size: clamp(32px, 5vw, 64px); letter-spacing: -0.05em; transition: color .2s; }
.next a:hover h2 { color: var(--accent); }
.next .card__cta { grid-row: 1 / span 2; grid-column: 2; width: 56px; height: 56px; }
.next a:hover .card__cta { background: var(--ink); color: var(--bg); border-color: var(--ink); transform: rotate(-45deg); }

/* ---------- CV page ---------- */
.cv-layout { display: grid; grid-template-columns: 1fr 340px; gap: clamp(32px, 6vw, 96px); }
.cv-job { padding: 28px 0; border-top: 1px solid var(--line); display: grid; grid-template-columns: 150px 1fr; gap: 24px; }
.cv-job__when { font: 400 14px/1.5 var(--mono); color: var(--subtle); }
.cv-job h3 { font-size: 20px; letter-spacing: -0.025em; }
.cv-job__org { color: var(--muted); margin: 4px 0 14px; }
.cv-job li { position: relative; padding-left: 16px; color: var(--ink-2); font-size: 16px; margin-bottom: 8px; }
.cv-job li::before { content: ""; position: absolute; left: 0; top: 11px; width: 5px; height: 5px; border-radius: 50%; background: var(--subtle); }
.cv-side section { padding: 24px 0; border-top: 1px solid var(--line); }
.cv-side h2 { font: 500 12.5px/1 var(--mono); text-transform: uppercase; letter-spacing: .04em; color: var(--subtle); margin-bottom: 16px; }
.cv-side li { font-size: 15.5px; margin-bottom: 10px; }
.cv-side li span { display: block; font-size: 13.5px; color: var(--muted); }
.pills { display: flex; flex-wrap: wrap; gap: 6px; }
.pills li { margin: 0; font-size: 13.5px; padding: 6px 10px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); }
.lang { display: grid; grid-template-columns: 90px 1fr auto; gap: 12px; align-items: center; }
.lang i { height: 4px; border-radius: 999px; background: var(--line); position: relative; overflow: hidden; }
.lang i::after { content: ""; position: absolute; inset: 0; width: var(--v); background: var(--ink); border-radius: inherit; }
@media (max-width: 960px) { .cv-layout { grid-template-columns: 1fr; } }
@media (max-width: 600px) { .cv-job { grid-template-columns: 1fr; gap: 6px; } }

/* ---------- Dialog (CV download) ---------- */
.overlay { position: fixed; inset: 0; z-index: 80; display: grid; place-items: center; padding: 16px; background: rgba(10, 10, 12, .55); backdrop-filter: blur(6px); opacity: 0; pointer-events: none; transition: opacity .25s var(--ease); }
.overlay.is-open { opacity: 1; pointer-events: auto; }
.overlay__content { width: min(520px, 100%); max-height: calc(100vh - 32px); overflow: auto; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 28px; position: relative; box-shadow: var(--shadow); }
.overlay__close { position: absolute; top: 14px; right: 14px; width: 36px; height: 36px; border-radius: 10px; border: 1px solid var(--line); background: transparent; color: var(--ink); font-size: 20px; cursor: pointer; }
.overlay h3 { font-size: 24px; letter-spacing: -0.03em; margin-bottom: 8px; }
.form { display: grid; gap: 14px; margin-top: 20px; }
.form__label { display: block; font-size: 13.5px; font-weight: 500; margin-bottom: 6px; }
.form__input { width: 100%; height: 46px; border-radius: 10px; border: 1px solid var(--line-2); background: var(--bg); color: var(--ink); padding: 0 14px; font: 16px var(--font); }
.form__input:focus { outline: 2px solid var(--accent); outline-offset: 0; border-color: transparent; }
.form__checklabel { display: flex; gap: 10px; font-size: 14px; color: var(--muted); align-items: flex-start; }
.form__checklabel input { margin-top: 3px; accent-color: var(--accent); }
.linklike { background: none; border: 0; padding: 0; color: var(--ink); text-decoration: underline; font: inherit; cursor: pointer; }
.form__policy { font-size: 13px; color: var(--muted); border: 1px solid var(--line); border-radius: 10px; padding: 10px 14px; }
.form__policy summary { cursor: pointer; color: var(--ink); font-weight: 500; }
.form__policybody p { margin-top: 8px; }
.form__actions { display: flex; gap: 8px; margin-top: 6px; }
.form__error { color: #d14a3a; font-size: 14px; }
.form__hint { font-size: 13px; color: var(--subtle); }

/* ---------- Motion ---------- */
.reveal { opacity: 0; transform: translateY(18px); transition: opacity .8s var(--ease), transform .8s var(--ease); }
.reveal.is-in { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) { .reveal { opacity: 1; transform: none; transition: none; } }
.no-js .reveal { opacity: 1; transform: none; }

/* ---------- AI-native panel ---------- */
.ai { margin-top: clamp(56px, 7vw, 96px); background: var(--ink); color: var(--bg); border-radius: var(--radius-lg); padding: clamp(28px, 5vw, 64px); display: grid; grid-template-columns: minmax(0, .9fr) minmax(0, 1.4fr); gap: clamp(28px, 5vw, 72px); }
.ai .eyebrow { color: color-mix(in srgb, var(--bg) 60%, transparent); }
.ai__head h3 { font-size: clamp(30px, 3.6vw, 48px); letter-spacing: -0.045em; line-height: 1.04; margin: 18px 0 18px; }
.ai__head p { color: color-mix(in srgb, var(--bg) 72%, transparent); font-size: 17px; max-width: 42ch; }
.ai__grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1px; background: color-mix(in srgb, var(--bg) 14%, transparent); border-radius: var(--radius); overflow: hidden; }
.ai__item { background: var(--ink); padding: 24px; display: flex; flex-direction: column; gap: 10px; }
.ai__n { font: 500 12px/1 var(--mono); color: var(--accent); }
:root:not([data-theme="dark"]) .ai__n { color: #8293ff; }
.ai__item h4 { margin: 0; font-size: 18px; letter-spacing: -0.02em; line-height: 1.25; font-weight: 600; }
.ai__item p { color: color-mix(in srgb, var(--bg) 70%, transparent); font-size: 15px; line-height: 1.55; }
.ai__item code { margin-top: auto; align-self: flex-start; font: 12.5px/1.4 var(--mono); padding: 5px 9px; border-radius: 7px; background: color-mix(in srgb, var(--bg) 10%, transparent); color: var(--bg); }
@media (max-width: 960px) { .ai { grid-template-columns: 1fr; } }
@media (max-width: 600px) { .ai__grid { grid-template-columns: 1fr; } }
