/* KAMI demo. Направление: «The product performs», палитра «графит и оранжевый».
   Шрифт системный: на сайте нет внешних запросов. Компоненты SL UI лежат в components/, здесь только токены и раскладка. */

:root {
  --bg: #18191b;
  --surface: #222427;
  --surface-2: #2c2e32;
  --ink: #eff0f1;
  --muted: #9c9ea3;
  --accent: #ff4a1f;
  --accent-hover: #ff6340;
  --accent-text: #ff7a58;
  --accent-ink: #18191b;
  --field: #eff0f1;
  --field-ink: #18191b;
  --gutter: clamp(16px, 2.2vw, 32px);
  --radius: 4px;
  --ease: cubic-bezier(.22, .61, .36, 1);
  --step-small: clamp(0.875rem, 0.85rem + 0.1vw, 0.9375rem);
  --step-body: clamp(1.0625rem, 1rem + 0.25vw, 1.1875rem);
  --step-lead: clamp(1.25rem, 1.1rem + 0.7vw, 1.625rem);
  --step-head: clamp(2rem, 1.3rem + 3.2vw, 4rem);
  --font: "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { scroll-behavior: smooth; background: var(--bg); scroll-padding-top: 16px; }
/* демо-стили компонентов центрируют body: возвращаем обычную раскладку страницы */
body { display: block; place-items: normal; place-content: normal; min-height: 0; padding: 0; margin: 0; background: var(--bg); color: var(--ink); font: 400 var(--step-body)/1.5 var(--font); -webkit-font-smoothing: antialiased; }
a { color: inherit; }
img { max-width: 100%; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; }

/* ---------- шапка ---------- */
.bar { height: 8px; background: var(--accent); }
.top { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 0 var(--gutter); height: 64px; }
.mark { font-size: 1.375rem; font-weight: 700; letter-spacing: -0.02em; text-decoration: none; }
.top nav { display: flex; gap: clamp(16px, 3vw, 32px); font-size: var(--step-body); }
.top nav a { text-decoration: none; transition: color .2s var(--ease); }
.top nav a:hover { color: var(--accent); }

/* ---------- первый экран ---------- */
.hero { margin-top: 0; display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); gap: clamp(24px, 4vw, 64px); align-items: center; padding: clamp(24px, 5vh, 56px) var(--gutter) clamp(24px, 4vh, 40px); }
.hero-frame { width: 100%; margin: 0; justify-self: end; max-width: 760px; }
.hero-frame .stagebox .v-lv { object-fit: fill; }
.hero h1 { margin: 0; max-width: 14ch; font-size: clamp(2.5rem, 1.2rem + 5.6vw, 6rem); font-weight: 700; line-height: .95; letter-spacing: -0.03em; text-wrap: balance; }
.hero h1 [data-size] { color: var(--accent); white-space: nowrap; transition: color .4s var(--ease); }
.lead { margin: 28px 0 0; max-width: 40ch; font-size: var(--step-lead); line-height: 1.35; }
.btn { display: inline-flex; align-items: center; margin-top: 32px; padding: 16px 24px; background: var(--accent); color: var(--accent-ink); font: 600 1.0625rem/1 var(--font); border-radius: var(--radius); text-decoration: none; transition: transform .25s var(--ease), background-color .25s var(--ease); }
.btn:hover { background: var(--accent-hover); transform: translateY(-2px); }
.btn:active { transform: translateY(0) scale(.98); }

/* ---------- демонстрация ---------- */
section { margin-top: clamp(96px, 14vh, 200px); }
.demo { margin: 0 var(--gutter); display: grid; grid-template-columns: minmax(0, 1fr) minmax(340px, 440px); gap: 8px; }
.demo { margin-top: 0; }
.viewer-col { background: var(--surface); padding: 8px; display: grid; gap: 8px; align-content: start; }
.side { background: var(--surface); padding: 16px; display: grid; gap: 16px; align-content: start; }

.demo-h { margin: 8px 8px 4px; font-size: var(--step-lead); font-weight: 600; line-height: 1.25; letter-spacing: -0.01em; }
.viewer { position: relative; aspect-ratio: var(--ar, 16/9); background: #101113; overflow: hidden; border-radius: 2px; }
.v-img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; display: block; }
.v-dec { clip-path: inset(0 0 0 var(--pos, 50%)); }
.v-overlay { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.v-tag { position: absolute; top: 12px; padding: 4px 10px; background: rgb(24 25 27 / .82); color: var(--ink); font-size: var(--step-small); font-weight: 500; border-radius: 2px; pointer-events: none; transition: opacity .3s var(--ease); }
.v-tag-l { left: 12px; }
.v-tag-r { right: 12px; background: var(--accent); color: var(--accent-ink); }
.v-cut { position: absolute; top: 0; bottom: 0; left: var(--pos, 50%); width: 0; pointer-events: none; }
.v-cut span { position: absolute; top: 0; bottom: 0; left: -1.5px; width: 3px; background: var(--accent); }
.v-cut span::after { content: ""; position: absolute; top: 50%; left: 50%; width: 40px; height: 40px; margin: -20px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 4px rgb(24 25 27 / .6); }
.v-cut span::before { content: ""; position: absolute; z-index: 1; top: 50%; left: 50%; width: 14px; height: 14px; margin: -7px; background: no-repeat center / contain url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 14 14'%3E%3Cpath d='M4.5 3 1.5 7l3 4M9.5 3l3 4-3 4' fill='none' stroke='%2318191b' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E"); }
.v-range { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: ew-resize; touch-action: pan-y; }
.viewer:has(.v-range:focus-visible) { outline: 3px solid var(--accent); outline-offset: 2px; }
.viewer.sweep { --pos: 100%; }
.viewer.sweeping .v-dec { transition: clip-path 1.6s var(--ease); }
.viewer.sweeping .v-cut { transition: left 1.6s var(--ease); }
.v-busy, .v-empty { position: absolute; inset: 0; display: grid; place-items: center; padding: 24px; text-align: center; background: rgb(16 17 19 / .8); font-size: var(--step-lead); }
.v-busy span::after { content: ""; display: inline-block; width: .9em; height: .9em; margin-left: .6em; vertical-align: -.1em; border-radius: 50%; background: var(--accent); animation: pulse 1s var(--ease) infinite alternate; }
@keyframes pulse { from { transform: scale(.5); opacity: .5; } to { transform: scale(1); opacity: 1; } }

/* компоненты SL UI: подгоняем токены и ширину под страницу, разметку и поведение не трогаем */
.nav-demo, .sl-slider, .pb, .sl-component, .sl-download { font-family: "Instrument Sans", var(--font); }
.demo .nav-demo { width: 100%; font-size: 14px; }
.demo .nav-surface { background: var(--surface-2); border-color: transparent; box-shadow: none; }
.demo .nav-track button { min-height: 52px; padding-inline: 2px; gap: 6px; font-size: 14px; }
.demo .nav-content { padding: 0; min-height: 0; }
.demo .nav-content p.note, .mode-note p, .sample-note p { max-width: none; margin: 0; padding: 12px 16px 14px; font-size: 15px; line-height: 1.45; color: #d4d5d7; }
.sample-note p + .pb { margin: 4px 16px 0; }
.upload-msg { min-height: 20px; margin: 0; padding: 8px 16px 14px; font-size: 14px !important; color: var(--muted) !important; }
.upload-msg.err { color: var(--accent-text) !important; }
.upload-msg { display: flex; align-items: center; gap: 8px; }
.upload-msg .msg-ic { width: 20px; height: 20px; color: var(--ink); }
.demo .pb { --pb-accent: var(--accent); --pb-accent-hover: var(--accent-hover); --pb-on-accent: var(--accent-ink); --pb-ink: var(--accent); --pb-field: var(--surface); --pb-field-text: var(--ink); --pb-hint: var(--muted); --pb-line: rgb(255 255 255 / .12); --pb-success: #7bd88f; --pb-danger: var(--accent); --pb-on-state: var(--accent-ink); }
.demo .sl-slider { --slider-ink: var(--surface-2); --slider-light: var(--ink); width: 100%; padding: 16px 18px 12px; border-color: transparent; box-shadow: none; }
.demo .slider-step-labels { font-size: 13px; }
.demo .sl-slider .slider-fill, .how-control .sl-slider .slider-fill { background: var(--ink); }

.metrics { margin: 0; display: grid; gap: 4px; }
.metrics > div { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; padding: 11px 14px; background: var(--surface-2); }
.metrics dt { color: var(--muted); font-size: 14px; }
.metrics dd { margin: 0; font-size: 1.0625rem; font-weight: 600; font-variant-numeric: tabular-nums; text-align: right; }
.metrics .m-main { background: var(--accent); color: var(--accent-ink); flex-wrap: wrap; align-items: center; }
.metrics .m-main dt { color: inherit; font-weight: 500; }
.metrics .m-main dd:first-of-type { font-size: 2.125rem; line-height: 1.1; letter-spacing: -0.02em; font-weight: 700; }
.metrics .m-main .m-sub { flex-basis: 100%; text-align: left; font-size: 14px; font-weight: 500; }
.m-foot { margin: 0; font-size: 14px; line-height: 1.45; color: var(--muted); }
.demo .sl-download { --download-ink: var(--ink); --download-hover: #fff; --download-active: #d6d7d9; --download-text: var(--accent-ink); --download-focus: var(--accent); }
.dl-feedback { margin: 0; min-height: 20px; font-size: 14px; color: var(--muted); }
.viewer-foot { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 8px 20px; align-items: center; padding: 8px 8px 12px; }
.viewer-foot .m-foot { grid-column: 2; grid-row: 1 / span 2; max-width: 62ch; }
.viewer-foot .sl-download { grid-column: 1; }
.viewer-foot .dl-feedback { grid-column: 1; }
@media (max-width: 960px) {
  .hero { grid-template-columns: 1fr; }
  .hero-frame { display: none; }
  .band-pair { grid-template-columns: 1fr; } .viewer-foot { grid-template-columns: 1fr; } .viewer-foot .m-foot { grid-column: 1; grid-row: auto; } }

/* ---------- как это работает ---------- */
.how { display: grid; grid-template-columns: 1fr 1fr; grid-template-areas: "head stage" "text stage" "control control"; grid-template-rows: auto 1fr auto; min-height: 88svh; }
.how-h { grid-area: head; align-self: end; padding: clamp(32px, 6vw, 88px) var(--gutter) 0; }
.how-text { grid-area: text; padding: 8px var(--gutter) clamp(32px, 6vw, 88px); align-self: start; }
.how h2, .results h2, .faq h2 { margin: 0; font-size: var(--step-lead); font-weight: 600; letter-spacing: -0.01em; line-height: 1.2; }
.clause { margin: 24px 0 0; max-width: 14ch; font-size: var(--step-head); font-weight: 700; line-height: 1; letter-spacing: -0.03em; text-wrap: balance; transition: opacity .2s var(--ease); }
.clause-note { margin: 24px 0 0; max-width: 46ch; font-size: var(--step-body); color: #d4d5d7; transition: opacity .2s var(--ease); }
.swapping { opacity: 0; }
.how-stage { grid-area: stage; background: var(--field); color: var(--field-ink); display: grid; place-items: center; padding: clamp(24px, 4vw, 56px); }
.stage-frame { width: min(600px, 100%); background: var(--surface); color: var(--ink); padding: 8px; }
.stagebox { position: relative; aspect-ratio: var(--ar, 16/9); background: #101113; overflow: hidden; }
.stagebox .v-lv { opacity: 0; transition: opacity 1.4s var(--ease); image-rendering: pixelated; }
.stagebox .v-lv.on { opacity: 1; }
.stagebox > img:first-child { transition: opacity 1.4s var(--ease); }
.v-img.fadein { animation: fadein .7s var(--ease); }
@keyframes fadein { from { opacity: 0; } to { opacity: 1; } }
.stage-meta { min-height: 84px; padding: 12px 8px 6px; font-size: 14px; line-height: 1.45; color: #d4d5d7; }
.stage-meta b { color: var(--ink); font-weight: 600; }
.stage-meta .lv-row { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 8px; }
.stage-meta .lv-row span { padding: 4px 8px; background: var(--surface-2); font-size: 14px; font-variant-numeric: tabular-nums; transition: background-color .3s var(--ease), color .3s var(--ease); }
.stage-meta .lv-row span.on { background: var(--accent); color: var(--accent-ink); }
.how-control { grid-area: control; background: var(--surface); padding: 20px var(--gutter) 24px; }
.how-control .sl-slider { --slider-ink: var(--surface); --slider-light: var(--ink); width: 100%; padding: 0; border: 0; background: transparent; box-shadow: none; font-size: 15px; }
.how-control .slider-step-labels { font-size: 16px; }

/* ---------- результаты ---------- */
.results { padding: 0 var(--gutter); }
.res-table { margin-top: 28px; background: var(--surface); padding: 8px; overflow-x: auto; }
.res-table table { width: 100%; min-width: 720px; border-collapse: separate; border-spacing: 0 6px; }
.res-table th { text-align: left; padding: 8px 16px; font-weight: 500; font-size: 14px; color: var(--muted); }
.res-table td { padding: 10px 16px; background: var(--surface-2); font-size: 1rem; font-variant-numeric: tabular-nums; vertical-align: middle; }
.res-table td:first-child { display: flex; align-items: center; gap: 14px; font-weight: 600; }
.res-table td img { display: block; width: 88px; height: 50px; object-fit: cover; }
.res-table .win { color: var(--accent-text); font-weight: 600; }
.band { margin: 40px 0 0; }
.band-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.band-pair img { display: block; width: 100%; height: auto; }
.band figcaption { margin-top: 12px; max-width: 68ch; font-size: var(--step-body); color: #d4d5d7; }
.res-text { margin: 32px 0 0; max-width: 68ch; font-size: var(--step-body); color: #d4d5d7; }

/* ---------- вопросы ---------- */
.faq { padding: 0 var(--gutter); display: grid; grid-template-columns: minmax(0, 4fr) minmax(0, 8fr); gap: 8px 32px; align-items: start; }
.faq h2 { position: sticky; top: 24px; font-size: var(--step-head); letter-spacing: -0.02em; }
.faq-list { display: grid; gap: 8px; }
.faq-item.sl-component { --action-surface: var(--surface); --action-hover: var(--surface-2); --action-text: var(--ink); --action-muted: var(--muted); --action-stage: transparent; --action-edge: transparent; --action-focus: var(--accent); width: 100%; min-height: 0; padding: 0; gap: 0; align-items: stretch; justify-content: flex-start; background: transparent; border: 0; border-radius: var(--radius); box-shadow: none; font-size: 17px; }
.faq-item .motion-button { width: 100%; height: auto; min-height: 72px; font-size: 1.25rem; font-weight: 500; text-align: left; }
.faq-item .button-surface { position: relative; inset: auto; min-height: 72px; flex-direction: row-reverse; justify-content: space-between; padding: 14px 24px; gap: 16px; border-radius: var(--radius); box-shadow: none; text-align: left; }
.faq-item .button-label { flex: 1; text-align: left; font-family: var(--font); letter-spacing: -0.005em; }
.faq-item[data-active="true"] .button-surface { background: var(--accent); color: var(--accent-ink); }
.faq-item .details-panel { width: 100%; background: var(--surface); }
.faq-item .details-panel p { margin: 0; padding: 18px 24px 24px; max-width: 62ch; font-size: 1.0625rem; line-height: 1.5; color: var(--ink); text-align: left; }
.faq-item .button-label { white-space: normal; min-width: 0; overflow-wrap: break-word; }
.faq-item .button-label, .faq-item .button-icon { transform: none !important; translate: none !important; margin: 0 !important; }
.faq-item .component-status { position: absolute; width: 1px; height: 1px; margin: 0; min-height: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.faq-item { position: relative; }

/* ---------- низ ---------- */
.foot { display: grid; grid-template-columns: 1fr auto 1fr; gap: 24px; align-items: baseline; padding: 0 var(--gutter) 30px; margin-top: 30svh; font-size: var(--step-small); color: var(--muted); }
.foot nav { display: flex; gap: 24px; }
.foot nav a { color: var(--ink); text-decoration: none; }
.foot nav a:hover { color: var(--accent); }
.foot-r { text-align: right; }

/* ---------- появление ---------- */
.js .reveal { opacity: 0; transform: translateY(24px); transition: opacity .8s var(--ease) var(--d, 0s), transform .8s var(--ease) var(--d, 0s); }
.js .reveal.in { opacity: 1; transform: none; }

@media (max-width: 960px) {
  .demo { grid-template-columns: minmax(0, 1fr); }
  .how { grid-template-columns: 1fr; grid-template-areas: "head" "stage" "control" "text"; grid-template-rows: auto; min-height: 0; }
  .how-stage { padding: 20px var(--gutter); }
  .how-text { padding-top: 40px; }
  .faq { grid-template-columns: 1fr; }
  .faq h2 { position: static; margin-bottom: 16px; }
  .foot { grid-template-columns: 1fr; gap: 8px; margin-top: 20svh; }
  .foot-r { text-align: left; }
}
@media (max-width: 520px) {
  .demo .nav-track button { font-size: 12px; gap: 3px; }
  .demo .nav-track .menu-glyph { width: 20px; height: 20px; }
  .top nav a:nth-child(1) { display: none; }
  .hero h1 { font-size: clamp(2.25rem, 11vw, 3rem); }
  .v-tag { top: 8px; font-size: 13px; padding: 3px 8px; }
  .faq-item .motion-button, .faq-item .button-surface { min-height: 64px; font-size: 1.125rem; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .js .reveal { opacity: 1; transform: none; transition: none; }
  .viewer.sweeping .v-dec, .viewer.sweeping .v-cut, .stagebox .v-lv, .stagebox .v-base, .clause, .clause-note, .btn, .v-busy span::after { transition: none; animation: none; }
}
