/* andriinosov.com — спільні стилі. Кольори лише через токени. */
:root {
  /* одна світла тема в тон студії на першому екрані */
  --paper: #e9ecef;
  --paper-2: #e0e4e9;
  --ink: #15181c;
  --ink-2: #3d454f;
  --muted: #5d6671;
  --rule: rgba(21, 24, 28, .14);
  --film-black: #000;
  --on-film: #f4f6f8;
  --on-film-2: rgba(244, 246, 248, .72);
  --focus: #2b6cf0;
  --display: 'Unbounded', 'Arial Black', system-ui, sans-serif;
  --text: 'Onest', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --max: 1240px;
  --gut: max(20px, env(safe-area-inset-left, 0px));
  --gut-r: max(20px, env(safe-area-inset-right, 0px));
  color-scheme: light;
}

*, *::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(--paper); color: var(--ink); font: 400 17px/1.6 var(--text); font-feature-settings: 'tnum' 0; }
img { max-width: 100%; display: block; }
a { color: inherit; text-decoration-thickness: 1px; text-underline-offset: .22em; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 3px; border-radius: 4px; }
.wrap { max-width: var(--max); margin: 0 auto; padding-left: var(--gut); padding-right: var(--gut-r); }
.skip { position: absolute; left: -999px; top: 8px; z-index: 50; background: var(--ink); color: var(--paper); padding: 8px 14px; border-radius: 6px; }
.skip:focus { left: 12px; }

/* ---------- шапка ---------- */
.top { position: fixed; inset: 0 0 auto; z-index: 20; padding-top: env(safe-area-inset-top, 0px); transition: background-color .3s, color .3s, box-shadow .3s; color: var(--ink); }
.top .wrap { display: flex; align-items: center; gap: 24px; height: 64px; }
.top.solid { background: rgba(233, 236, 239, .88); color: var(--ink); -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px); box-shadow: 0 1px 0 var(--rule); }
.mark { font: 600 15px/1 var(--display); letter-spacing: -.01em; text-decoration: none; white-space: nowrap; }
.nav { margin-left: auto; display: flex; gap: 22px; align-items: center; }
.nav a { text-decoration: none; font-size: 15px; opacity: .86; }
.nav a:hover, .nav a[aria-current="page"] { opacity: 1; text-decoration: underline; }
.lang { font: 500 14px/1 var(--text); background: none; color: inherit; border: 1px solid currentColor; border-radius: 999px; padding: 7px 12px; cursor: pointer; opacity: .9; }
.lang:hover { opacity: 1; }
.menu { display: none; margin-left: auto; background: none; border: 0; color: inherit; width: 44px; height: 44px; cursor: pointer; }
.menu svg { width: 22px; height: 22px; }
@media (max-width: 760px) {
  .menu { display: block; }
  .nav { position: fixed; inset: calc(64px + env(safe-area-inset-top, 0px)) 0 auto; flex-direction: column; align-items: flex-start; gap: 4px; padding: 12px var(--gut-r) 20px var(--gut); background: var(--paper); color: var(--ink); box-shadow: 0 1px 0 var(--rule); display: none; }
  .nav.open { display: flex; }
  .nav a { font-size: 20px; padding: 8px 0; }
  .lang { margin-top: 8px; }
}

/* ---------- розбиральний стенд (перший екран, світла студія) ---------- */
.hero { --studio: #e9ecef; --s-ink: #15181c; --s-ink2: #4a525c; --s-muted: #6b737d; --s-rule: rgba(21, 24, 28, .14); --s-card: rgba(255, 255, 255, .78); --accent: #e4572e;
  position: relative; height: 100svh; min-height: 680px; background: var(--studio); color: var(--s-ink); overflow: hidden; isolation: isolate; display: flex; }
#lab { position: absolute; inset: 0; width: 100%; height: 100%; z-index: -1; display: block; touch-action: pan-y; cursor: grab; }
#lab:active { cursor: grabbing; }
.hero.nogl #lab { background: url(/img/plai3d-follow.webp) 70% 40% / cover no-repeat; }
.hero-text { width: 100%; display: flex; flex-direction: column; justify-content: flex-start; padding-top: calc(112px + env(safe-area-inset-top, 0px)); padding-bottom: 140px; pointer-events: none; }
.hero-text > * { pointer-events: auto; max-width: min(30vw, 440px); }
.name { font: 600 clamp(44px, 5.8vw, 88px)/.92 var(--display); letter-spacing: -.045em; margin: 0; text-wrap: balance; }
.name span { display: block; }
.lede { margin: 24px 0 0; font-size: clamp(16px, 1.3vw, 19px); line-height: 1.5; color: var(--s-ink2); }
.film-note { margin: 14px 0 0; font-size: 14px; color: var(--s-muted); max-width: 30em; }
@media (prefers-reduced-motion: no-preference) {
  .name span, .lede, .film-note { animation: rise .9s cubic-bezier(.16, 1, .3, 1) both; }
  .name span:nth-child(2) { animation-delay: .08s; }
  .lede { animation-delay: .25s; } .film-note { animation-delay: .4s; }
}
@keyframes rise { from { opacity: 0; transform: translateY(18px); } to { opacity: 1; transform: none; } }
.top.scrolled { background: rgba(233, 236, 239, .88); -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px); box-shadow: 0 1px 0 rgba(21, 24, 28, .1); }

.lab-planfig { margin: 12px 0 0; }
.lab-planfig canvas { width: 100%; height: auto; display: block; border-top: 1px solid var(--s-rule); padding-top: 10px; }
.lab-planfig figcaption { font-size: 12px; color: var(--s-muted); margin-top: 6px; }
.lab-panel { position: absolute; right: max(20px, env(safe-area-inset-right, 0px)); top: calc(96px + env(safe-area-inset-top, 0px)); width: min(320px, 26vw); background: var(--s-card); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); border: 1px solid var(--s-rule); border-radius: 12px; padding: 16px 18px 14px; font-size: 13px; color: var(--s-ink2); }
.lab-k { margin: 0 0 2px; font-size: 12px; color: var(--s-muted); }
.lab-title { margin: 0 0 10px; font: 600 22px/1.15 var(--display); letter-spacing: -.02em; color: var(--s-ink); }
.lab-list { list-style: none; margin: 0; padding: 0; }
.lab-list li { display: flex; justify-content: space-between; gap: 14px; padding: 7px 0; border-top: 1px solid var(--s-rule); }
.lab-list b { color: var(--s-ink); font-weight: 600; font-variant-numeric: tabular-nums; }
.lab-note { margin: 10px 0 0; line-height: 1.45; }
.lab-count { margin: 10px 0 0; font-size: 12px; color: var(--s-muted); font-variant-numeric: tabular-nums; }
.lab-subs { position: absolute; left: 0; right: 0; margin: 0 auto; width: fit-content; bottom: calc(26px + env(safe-area-inset-bottom, 0px)); display: flex; gap: 6px; padding: 6px; background: var(--s-card); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); border: 1px solid var(--s-rule); border-radius: 999px; max-width: calc(100% - 40px); overflow-x: auto; scrollbar-width: none; }
.lab-subs::-webkit-scrollbar { display: none; }
.lab-subs button { flex: none; font: 500 14px/1 var(--text); color: var(--s-ink); background: transparent; border: 0; border-radius: 999px; padding: 0 14px; height: 36px; cursor: pointer; }
.lab-subs button:hover { background: rgba(21, 24, 28, .06); }
.lab-subs button[aria-pressed="true"] { background: var(--s-ink); color: #fff; }
.lab-subs button.all[aria-pressed="true"] { background: var(--accent); }
.lab-subs button:focus-visible { outline: 2px solid var(--focus); outline-offset: 1px; }
.lab-leaders { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 1; }
.lab-leaders path { fill: none; stroke: var(--accent); stroke-width: 1.2; }
.lab-callout { position: absolute; left: 0; top: 0; z-index: 2; pointer-events: none; font: 500 13px/1.2 var(--text); color: var(--s-ink); background: #fff; border: 1px solid var(--accent); padding: 6px 10px; border-radius: 6px; white-space: nowrap; opacity: 0; transition: opacity .3s; }
.lab-callout.l { translate: -100% 0; }
.lab-callout.on { opacity: 1; }
@media (max-width: 900px), (max-aspect-ratio: 1/1) {
  .hero { flex-direction: column; height: auto; min-height: auto; }
  .hero-text { order: 1; padding-top: calc(88px + env(safe-area-inset-top, 0px)); padding-bottom: 8px; }
  .hero-text > * { max-width: none; }
  #lab { order: 2; position: relative; inset: auto; height: 58svh; z-index: 0; }
  .lab-subs { order: 3; position: relative; left: auto; right: auto; bottom: auto; width: auto; margin: 8px max(16px, env(safe-area-inset-left, 0px)) 0; max-width: none; border-radius: 14px; }
  .lab-panel { order: 4; position: relative; right: auto; top: auto; width: auto; margin: 12px max(16px, env(safe-area-inset-right, 0px)) 28px max(16px, env(safe-area-inset-left, 0px)); }
  .lab-callout, .lab-leaders { display: none; }
}

/* ---------- розділи ---------- */
section { padding: clamp(72px, 10vw, 140px) 0 0; }
.h2 { font: 600 clamp(30px, 4.4vw, 56px)/1.04 var(--display); letter-spacing: -.035em; margin: 0 0 clamp(28px, 4vw, 48px); text-wrap: balance; }
.h3 { font: 600 clamp(22px, 2.2vw, 28px)/1.15 var(--display); letter-spacing: -.02em; margin: 0 0 14px; }
p { margin: 0 0 1em; }
.prose { max-width: 38em; color: var(--ink-2); }
.muted { color: var(--muted); }

/* що я роблю: рядки з прев'ю під курсором */
.ways { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--rule); position: relative; }
.ways li { border-bottom: 1px solid var(--rule); }
.ways a { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); gap: 8px 40px; align-items: center; padding: clamp(22px, 3vw, 34px) 0; text-decoration: none; }
.ways .t { font: 600 clamp(28px, 4.6vw, 64px)/1 var(--display); letter-spacing: -.04em; transition: transform .35s cubic-bezier(.2, .7, .1, 1); }
.ways .d { color: var(--ink-2); max-width: 30em; }
.ways .d em { font-style: normal; color: var(--muted); display: block; margin-top: 6px; font-size: 15px; }
.ways a:hover .t, .ways a:focus-visible .t { transform: translateX(14px); }
@media (max-width: 760px) { .ways a { grid-template-columns: 1fr; } }
.peek { position: fixed; left: 0; top: 0; width: 320px; aspect-ratio: 4 / 3; border-radius: 10px; overflow: hidden; pointer-events: none; z-index: 15; opacity: 0; transform: translate(-50%, -50%) scale(.92); transition: opacity .25s, transform .25s; background: var(--paper-2); box-shadow: 0 0 0 1px var(--rule); }
.peek.on { opacity: 1; transform: translate(-50%, -50%) scale(1); }
.peek > * { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: 0; }
.peek > .on { opacity: 1; }
@media (pointer: coarse), (max-width: 760px) { .peek { display: none; } }

/* PLAI 3D */
.feature { display: grid; grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); gap: clamp(28px, 4vw, 56px); align-items: start; }
.shot { margin: 0; }
.shot img { border-radius: 12px; }
.shot img { width: 100%; height: auto; }
.shot figcaption { font-size: 14px; color: var(--muted); padding: 12px 2px 0; background: var(--paper); }
.facts { margin: 26px 0 30px; padding: 0; display: grid; gap: 16px; }
.facts div { display: grid; grid-template-columns: 7.2ch minmax(0, 1fr); gap: 14px; align-items: baseline; border-top: 1px solid var(--rule); padding-top: 14px; }
.facts dt { font: 600 22px/1 var(--display); letter-spacing: -.03em; font-variant-numeric: tabular-nums; white-space: nowrap; }
.facts dd { margin: 0; color: var(--ink-2); font-size: 16px; }
@media (max-width: 900px) { .feature { grid-template-columns: 1fr; } }
.btn { display: inline-flex; align-items: center; gap: 10px; min-height: 48px; padding: 0 22px; border-radius: 999px; background: var(--ink); color: var(--paper); text-decoration: none; font-weight: 500; border: 1px solid var(--ink); }
.btn:hover { text-decoration: none; background: transparent; color: var(--ink); }
.btn.ghost { background: transparent; color: var(--ink); }
.btn.ghost:hover { background: var(--ink); color: var(--paper); }
.btns { display: flex; flex-wrap: wrap; gap: 12px; }
.small { font-size: 14px; color: var(--muted); margin-top: 12px; }

.pubs { list-style: none; margin: clamp(48px, 6vw, 72px) 0 0; padding: 0; border-top: 1px solid var(--rule); }
.pubs li { padding: 20px 0; border-bottom: 1px solid var(--rule); display: grid; grid-template-columns: 5ch minmax(0, 1fr); gap: 20px; }
.pubs .y { font: 600 16px/1.5 var(--display); font-variant-numeric: tabular-nums; }
.pubs .ti { font-weight: 500; }
.pubs .src { color: var(--muted); font-size: 15px; }

/* дві колонки: текст і код */
.split { display: grid; grid-template-columns: minmax(0, 6fr) minmax(0, 5fr); gap: clamp(28px, 5vw, 72px); align-items: start; }
@media (max-width: 900px) { .split { grid-template-columns: 1fr; } }
.craft { list-style: none; margin: 8px 0 28px; padding: 0; }
.craft li { padding: 12px 0; border-top: 1px solid var(--rule); display: grid; grid-template-columns: minmax(0, 11em) minmax(0, 1fr); gap: 16px; }
.craft li:last-child { border-bottom: 1px solid var(--rule); }
.craft b { font-weight: 600; }
.craft span { color: var(--ink-2); }
@media (max-width: 520px) { .craft li { grid-template-columns: 1fr; gap: 2px; } }
.codepanel { margin: 0; min-width: 0; }
.codepanel pre { margin: 0; padding: 22px 24px; border-radius: 12px; background: var(--paper-2); box-shadow: inset 0 0 0 1px var(--rule); overflow-x: auto; font: 400 13.5px/1.7 ui-monospace, 'SF Mono', Menlo, Consolas, monospace; color: var(--ink-2); tab-size: 4; }
.codepanel figcaption { font-size: 14px; color: var(--muted); margin-top: 12px; max-width: 36em; }

/* студентам і блог */
.pair { display: grid; grid-template-columns: 1fr 1fr; gap: clamp(28px, 4vw, 56px); }
@media (max-width: 760px) { .pair { grid-template-columns: 1fr; } }
.pair > div { border-top: 1px solid var(--rule); padding-top: 24px; }

/* контакти */
.contact { padding-bottom: clamp(72px, 10vw, 140px); }
.mail { font: 600 clamp(18px, 5.4vw, 72px)/1.05 var(--display); letter-spacing: -.04em; text-decoration: none; word-break: break-word; }
.mail:hover { text-decoration: underline; text-decoration-thickness: 3px; }
.copy { font: 500 14px/1 var(--text); background: none; border: 1px solid var(--rule); color: var(--ink); border-radius: 999px; padding: 9px 14px; cursor: pointer; }
.links { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 28px; margin-top: 28px; }
.links a { font-weight: 500; }

footer { border-top: 1px solid var(--rule); padding: 26px 0 calc(26px + env(safe-area-inset-bottom, 0px)); font-size: 14px; color: var(--muted); }
footer .wrap { display: flex; flex-wrap: wrap; gap: 8px 24px; justify-content: space-between; }

/* сторінки без плівки */
.page-head { padding-top: calc(140px + env(safe-area-inset-top, 0px)); }
.page-head .h1 { font: 600 clamp(44px, 8vw, 112px)/.95 var(--display); letter-spacing: -.045em; margin: 0 0 24px; }
.empty { border: 1px dashed var(--rule); border-radius: 12px; padding: clamp(24px, 4vw, 40px); max-width: 40em; margin-top: 32px; }
