/* ============================================================================
   Cruscy demo kit — общая дизайн-система показательных сайтов.
   © Cruscy, 2026. Код витрины: смотреть можно, забирать нельзя.

   Зачем один файл на все демо: у каждого демо теперь 3-4 страницы, и раньше
   один и тот же CSS уехал бы к посетителю четыре раза. Здесь он приезжает
   ОДИН раз, кладётся в кеш и обслуживает все страницы всех демо — переход
   между страницами стоит только вес самого HTML (4-7 КБ).

   Палитра строится как у клиники: белая поверхность, почти белый холст,
   волосяная граница, один акцент на проект. Акцент задаётся на <html>
   атрибутом data-p, всё остальное считается от него через color-mix.
   ========================================================================== */

*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; -webkit-tap-highlight-color: transparent; }

:root {
  /* нейтральная основа — одна на все проекты */
  --canvas: #f7f7f9;
  --surface: #ffffff;
  --surface-2: #fbfbfc;
  --hairline: #e8e7ec;
  --ink: #16151a;
  --ink-2: #4a4854;
  --muted: #6b6875;
  --ok: #1e7f5c;
  --warn: #a8710f;
  --bad: #b3261e;

  /* акцент по умолчанию, каждое демо переопределяет */
  --a: #4c3f91;

  --r-card: 16px;
  --r-ctl: 12px;
  --r-pill: 999px;

  /* Тени почти нет: «колхоз» на витрине начинался именно с жирных теней.
     Глубину даёт волосяная граница, а не размытое пятно. */
  --lift: 0 1px 2px rgba(22, 21, 26, .05);
  --lift-2: 0 6px 20px rgba(22, 21, 26, .07);

  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans Thai",
    Roboto, "Helvetica Neue", Arial, sans-serif;
  --disp: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;

  /* производные от акцента — не хардкодим оттенки руками */
  --a-d: color-mix(in oklab, var(--a) 82%, #000);
  --a-soft: color-mix(in oklab, var(--a) 12%, #fff);
  --a-line: color-mix(in oklab, var(--a) 26%, #fff);
  --a-ink: color-mix(in oklab, var(--a) 72%, #000);
}

/* ── палитры проектов ────────────────────────────────────────────────────── */
[data-p="linen"]  { --a: #9a6b45; --canvas: #faf7f3; }
[data-p="orchid"] { --a: #b8496a; --canvas: #fdf6f8; }
[data-p="soi7"]   { --a: #2f7d57; --canvas: #f5f9f6; }
[data-p="baan"]   { --a: #1d6fa5; --canvas: #f4f8fb; }
[data-p="siam"]   { --a: #a5720c; --canvas: #faf8f2; }
[data-p="studio"] { --a: #5b57c4; --canvas: #f7f7fc; }
[data-p="visa"]   { --a: #23706c; --canvas: #f3f9f8; }
[data-p="tour"]   { --a: #0e6f8e; --canvas: #f2f8fb; }
[data-p="panel"]  { --a: #37506e; --canvas: #f6f7f9; }
[data-p="frames"] { --a: #6d4aa8; --canvas: #f8f6fc; }
[data-p="tunes"]  { --a: #a8438b; --canvas: #fbf5fa; }
[data-p="reels"]  { --a: #b8402f; --canvas: #fdf6f4; }

html { -webkit-text-size-adjust: 100%; }

body {
  background: var(--canvas);
  color: var(--ink);
  font: 400 16px/1.55 var(--sans);
  -webkit-font-smoothing: antialiased;
  min-height: 100svh;
  /* Приложение ставится на домашний экран: «чёлка» и жест-бар не должны
     съедать содержимое. */
  padding-bottom: calc(64px + env(safe-area-inset-bottom));
}
body.no-nav { padding-bottom: env(safe-area-inset-bottom); }

img, svg { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }

h1, h2, h3 { line-height: 1.18; text-wrap: balance; font-weight: 620; }
h1 { font-size: clamp(26px, 5vw, 36px); letter-spacing: -.02em; }
h2 { font-size: clamp(19px, 3vw, 23px); letter-spacing: -.01em; }
h3 { font-size: 16px; }
p  { text-wrap: pretty; }

.wrap { width: 100%; max-width: 1080px; margin-inline: auto; padding-inline: 18px; }
.narrow { max-width: 720px; }
.stack > * + * { margin-top: var(--gap, 14px); }
.row { display: flex; align-items: center; gap: 12px; }
.row.wrap-row { flex-wrap: wrap; }
.spread { justify-content: space-between; }
.grow { flex: 1; min-width: 0; }
.mut { color: var(--muted); }
.sm { font-size: 13.5px; }
.num { font-variant-numeric: tabular-nums; }

.grid { display: grid; gap: 14px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 860px) { .g3, .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 540px) { .g2, .g3, .g4 { grid-template-columns: minmax(0, 1fr); } }

/* ── шапка ───────────────────────────────────────────────────────────────── */
.top {
  position: sticky; top: 0; z-index: 30;
  background: color-mix(in oklab, var(--surface) 88%, transparent);
  backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--hairline);
  padding-top: env(safe-area-inset-top);
}
.top .in { display: flex; align-items: center; gap: 16px; height: 58px; }
.brand { display: flex; align-items: center; gap: 9px; font-weight: 700; letter-spacing: .01em; }
.brand .mk { width: 26px; height: 26px; border-radius: 8px; background: var(--a); flex: none; }
.top nav { display: flex; gap: 4px; margin-left: auto; }
.top nav a {
  display: inline-flex; align-items: center; min-height: 40px; padding: 0 12px;
  border-radius: var(--r-pill); font-size: 14.5px; color: var(--muted);
}
.top nav a[aria-current="page"] { color: var(--a-ink); background: var(--a-soft); font-weight: 600; }
@media (max-width: 700px) { .top nav { display: none; } }

/* ── нижняя навигация: на телефоне и планшете это главный способ ходить ──── */
.tabs {
  position: fixed; inset-inline: 0; bottom: 0; z-index: 40;
  background: color-mix(in oklab, var(--surface) 94%, transparent);
  backdrop-filter: saturate(180%) blur(12px);
  border-top: 1px solid var(--hairline);
  padding-bottom: env(safe-area-inset-bottom);
}
.tabs ul { display: flex; max-width: 560px; margin-inline: auto; list-style: none; padding: 0; }
.tabs li { flex: 1; }
.tabs a {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 3px; min-height: 56px; font-size: 11px; color: var(--muted); letter-spacing: .01em;
}
.tabs a[aria-current="page"] { color: var(--a-ink); font-weight: 650; }
.tabs svg { width: 21px; height: 21px; stroke: currentColor; fill: none; stroke-width: 1.7; }
@media (min-width: 701px) { .tabs { display: none; } body { padding-bottom: 40px; } }

/* ── поверхности ─────────────────────────────────────────────────────────── */
.card {
  background: var(--surface); border: 1px solid var(--hairline);
  border-radius: var(--r-card); padding: 18px;
}
.card.pad-0 { padding: 0; overflow: hidden; }
/* Наведение меняет только границу: карточка не прыгает и не отбрасывает тень. */
a.card, button.card, .card.hit { transition: border-color .16s ease, background-color .16s ease; }
a.card:hover, button.card:hover, .card.hit:hover { border-color: var(--a-line); background: var(--surface-2); }

.tag {
  display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px;
  border-radius: var(--r-pill); background: var(--a-soft); color: var(--a-ink);
  font: 600 11.5px/1.4 var(--sans); letter-spacing: .04em; text-transform: uppercase;
}
.tag.grey { background: color-mix(in oklab, var(--ink) 6%, #fff); color: var(--muted); }

.price { font: 700 21px/1 var(--sans); font-variant-numeric: tabular-nums; letter-spacing: -.01em; }
.price s { font-size: 14px; font-weight: 500; color: var(--muted); margin-left: 8px; }

/* ── управление ──────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 46px; padding: 0 20px; border: 1px solid transparent;
  border-radius: var(--r-ctl); background: var(--a); color: #fff;
  font: 600 15px/1 var(--sans); cursor: pointer;
  transition: background-color .16s ease, border-color .16s ease;
}
.btn:hover { background: var(--a-d); }
.btn.gh { background: transparent; border-color: var(--hairline); color: var(--ink); }
.btn.gh:hover { border-color: var(--a-line); background: var(--a-soft); }
.btn.wide { width: 100%; }
.btn[disabled] { opacity: .45; cursor: not-allowed; }
.btn.done { background: var(--ok); }

.chip {
  display: inline-flex; align-items: center; min-height: 40px; padding: 0 15px;
  border: 1px solid var(--hairline); border-radius: var(--r-pill);
  background: var(--surface); color: var(--ink-2); font-size: 14px; cursor: pointer;
  white-space: nowrap; transition: border-color .16s ease, background-color .16s ease;
}
.chip:hover { border-color: var(--a-line); }
.chip[aria-pressed="true"], .chip.on { background: var(--a); border-color: var(--a); color: #fff; font-weight: 600; }

.field { display: block; }
.field > span { display: block; font-size: 13px; color: var(--muted); margin-bottom: 6px; }
.inp {
  width: 100%; min-height: 46px; padding: 11px 14px; background: var(--surface);
  border: 1px solid var(--hairline); border-radius: var(--r-ctl); font-size: 15.5px;
  transition: border-color .16s ease;
}
/* Раньше здесь стоял outline:none, и клавиатурный фокус на поле было видно
   только по рамке в один пиксель — то есть почти никак. Рамку оставляем,
   кольцо возвращаем. */
.inp:focus-visible { border-color: var(--a); outline: 2px solid var(--a); outline-offset: 2px; }
.inp:focus { border-color: var(--a); }
textarea.inp { min-height: 108px; resize: vertical; }
select.inp { appearance: none; padding-right: 38px;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%),
                    linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 19px) 21px, calc(100% - 14px) 21px;
  background-size: 5px 5px, 5px 5px; background-repeat: no-repeat; }

/* Ползунок: тонкая дорожка мышью, толстая пальцем — иначе на планшете
   его невозможно поймать. */
input[type=range] { width: 100%; height: 34px; appearance: none; background: transparent; }
input[type=range]::-webkit-slider-runnable-track { height: 5px; border-radius: 3px;
  background: color-mix(in oklab, var(--ink) 10%, #fff); }
input[type=range]::-webkit-slider-thumb { appearance: none; width: 22px; height: 22px;
  margin-top: -8.5px; border-radius: 50%; background: var(--a); border: 3px solid #fff;
  box-shadow: 0 0 0 1px var(--a-line); cursor: pointer; }
input[type=range]::-moz-range-track { height: 5px; border-radius: 3px;
  background: color-mix(in oklab, var(--ink) 10%, #fff); }
input[type=range]::-moz-range-thumb { width: 22px; height: 22px; border-radius: 50%;
  background: var(--a); border: 3px solid #fff; cursor: pointer; }

/* ── состояния ───────────────────────────────────────────────────────────── */
.empty {
  display: flex; flex-direction: column; align-items: center; gap: 10px;
  padding: 56px 24px; text-align: center; border: 1px dashed var(--hairline);
  border-radius: var(--r-card); background: var(--surface);
}
.empty b { font-size: 16.5px; }
/* Подсветка совпадения в поиске — одна на все демо. */
mark { background: var(--a-soft); color: var(--a-ink); border-radius: 3px;
  padding: 0 1px; }

.note { padding: 13px 15px; border-radius: var(--r-ctl); background: var(--a-soft);
  color: var(--a-ink); font-size: 14px; }
.note.warn { background: color-mix(in oklab, var(--warn) 11%, #fff); color: var(--warn); }

/* Длинные списки не считаем, пока их не видно. */
.lazy { content-visibility: auto; contain-intrinsic-size: auto 320px; }

/* ── изометрия: украшение без единой картинки ───────────────────────────── */
.iso { display: grid; place-items: center; padding: 26px 0; }
.iso-box {
  --s: 108px;
  width: var(--s); height: var(--s);
  transform: rotateX(56deg) rotateZ(45deg);
  transform-style: preserve-3d;
  position: relative;
}
.iso-box i {
  position: absolute; inset: 0; display: block;
  border: 1.5px solid color-mix(in oklab, var(--a) 45%, #fff); border-radius: 6px;
  background: color-mix(in oklab, var(--a) 12%, #fff);
  box-shadow: 0 2px 0 color-mix(in oklab, var(--a) 18%, #fff);
}
.iso-box i:nth-child(1) { transform: translateZ(0px); }
.iso-box i:nth-child(2) { transform: translateZ(18px); opacity: .86; }
.iso-box i:nth-child(3) { transform: translateZ(36px); opacity: .66; }
.iso-box i:nth-child(4) { transform: translateZ(54px); opacity: .44; }
/* Фактура вместо фотографий: плитка товара не должна читаться пустым
   прямоугольником, а картинки утяжелили бы демо в разы. */
.tex { position: relative; overflow: hidden; }
.tex::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background:
    repeating-linear-gradient(90deg, rgba(255,255,255,.5) 0 1px, transparent 1px 4px),
    repeating-linear-gradient(0deg,  rgba(0,0,0,.035)   0 1px, transparent 1px 4px);
  mix-blend-mode: multiply; opacity: .55;
}
.tex.soft::after {
  background: repeating-linear-gradient(135deg,
    rgba(0,0,0,.028) 0 1px, transparent 1px 9px);
  opacity: .9;
}
.mark {
  position: absolute; inset: 0; display: grid; place-items: center;
  color: color-mix(in oklab, var(--ink) 16%, transparent); pointer-events: none;
}
.mark svg { width: 44%; max-width: 130px; height: auto; stroke: currentColor;
  fill: none; stroke-width: 1.1; }

.iso-grid {
  height: 132px; border-radius: var(--r-card); overflow: hidden;
  background:
    repeating-linear-gradient(60deg,  var(--a-line) 0 1px, transparent 1px 26px),
    repeating-linear-gradient(-60deg, var(--a-line) 0 1px, transparent 1px 26px),
    var(--surface);
  mask-image: radial-gradient(120% 90% at 50% 0%, #000 40%, transparent 100%);
}

/* ── маркировка машинного контента ───────────────────────────────────────
   Со 2 августа 2026 статья 50 EU AI Act требует, чтобы сгенерированный
   материал был помечен видимо И машиночитаемо. Поэтому метка тут не
   украшение: она обязана стоять на КАЖДОМ показанном результате, а разметка
   вокруг него — нести data-ai-generated. Значок рисуем контуром, без картинок. */
.ai {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 8px 3px 6px; border-radius: var(--r-pill);
  background: color-mix(in oklab, var(--ink) 72%, transparent); color: #fff;
  font: 600 10.5px/1 var(--sans); letter-spacing: .06em; text-transform: uppercase;
  backdrop-filter: blur(4px); white-space: nowrap;
}
.ai svg { width: 12px; height: 12px; stroke: currentColor; fill: none; stroke-width: 1.8; }
.ai.plain { background: color-mix(in oklab, var(--ink) 7%, #fff); color: var(--ink-2); }
.shot .ai, .feat .ai, .art .ai { position: absolute; right: 9px; bottom: 9px; }

.ai-note {
  display: flex; gap: 11px; align-items: flex-start;
  padding: 13px 15px; border-radius: var(--r-ctl);
  background: color-mix(in oklab, var(--ink) 4%, #fff);
  border: 1px solid var(--hairline); font-size: 13.5px; color: var(--ink-2);
}
.ai-note svg { width: 18px; height: 18px; flex: none; margin-top: 1px;
  stroke: var(--ink-2); fill: none; stroke-width: 1.6; }
.ai-note b { color: var(--ink); }

/* ── лента «это демо» ────────────────────────────────────────────────────── */
.ribbon {
  background: var(--ink); color: #fff; font-size: 13px;
  padding: calc(9px + env(safe-area-inset-top)) 18px 9px;
}
.ribbon .in { max-width: 1080px; margin-inline: auto;
  display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.ribbon a { color: #fff; text-decoration: underline; text-underline-offset: 3px; white-space: nowrap; }
.ribbon b { font-weight: 650; }
.ribbon + .top { top: 0; }

/* ── подсказка установки и связь ─────────────────────────────────────────── */
.pwa {
  position: fixed; left: 12px; right: 12px; z-index: 60;
  bottom: calc(70px + env(safe-area-inset-bottom));
  display: none; gap: 12px; align-items: center;
  background: var(--surface); border: 1px solid var(--hairline);
  border-radius: 14px; padding: 12px 14px; box-shadow: var(--lift-2);
}
.pwa.on { display: flex; }
.pwa .ic { width: 34px; height: 34px; border-radius: 9px; flex: none; }
.pwa small { display: block; color: var(--muted); font-size: 12.5px; }
.pwa button { min-width: 44px; min-height: 44px; border: 0; background: transparent;
  color: var(--muted); font-size: 20px; cursor: pointer; }
@media (min-width: 701px) { .pwa { max-width: 380px; left: auto; right: 18px; bottom: 18px; } }

.offline {
  position: fixed; inset-inline: 0; top: 0; z-index: 70; display: none;
  padding: calc(7px + env(safe-area-inset-top)) 14px 7px;
  background: var(--warn); color: #fff; font-size: 13px; text-align: center;
}
.offline.on { display: block; }

/* ── пальцем ─────────────────────────────────────────────────────────────── */
@media (pointer: coarse) {
  .btn, .chip, .inp { min-height: 46px; }
  /* Ссылка в ленте и логотип — тоже ссылки, и пальцем по ним промахивались:
     20 и 26 пикселей высоты. */
  .ribbon a, .brand { display: inline-flex; align-items: center; min-height: 44px; }
  .ribbon .in { row-gap: 0; }
  .top nav a { min-height: 44px; }
  input[type=range] { height: 44px; }
  input[type=range]::-webkit-slider-thumb { width: 26px; height: 26px; margin-top: -10.5px; }
  input[type=range]::-moz-range-thumb { width: 26px; height: 26px; }
}

/* ── доступность и движение ──────────────────────────────────────────────── */
:focus-visible { outline: 2px solid var(--a); outline-offset: 2px; border-radius: 6px; }
.skip {
  position: absolute; left: -9999px; top: 8px; z-index: 100;
  background: var(--surface); border: 1px solid var(--a); border-radius: 10px; padding: 10px 16px;
}
.skip:focus { left: 12px; }

/* Кросс-документного перехода здесь намеренно НЕТ. Он давал кроссфейд в
   0,16 с, но браузер отклоняет его промис каждый раз, когда переход пропущен,
   и в консоли оставалась ошибка «Transition was skipped» на ровном месте —
   поймать её из страницы нельзя, промис создан до любого нашего кода.
   Мгновенность перехода и так обеспечена предзагрузкой соседних страниц. */

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important; animation-iteration-count: 1 !important;
    transition-duration: .01ms !important; scroll-behavior: auto !important;
  }
}

@media print { .top, .tabs, .pwa, .ribbon, .offline { display: none !important; } }
