/* ============================================================
 * Star Path · Obsidian design system (v2)
 * Reference: redesign/styles.css (designer pack)
 * ============================================================ */

/* Кириллицы в Instrument Serif нет — см. styles.css. */
@import url('https://fonts.googleapis.com/css2?family=Inter:ital,opsz,wght@0,14..32,300..700;1,14..32,300..700&family=Source+Serif+4:ital,opsz,wght@0,8..60,300..700;1,8..60,300..700&display=swap');

:root {
  /* OBSIDIAN — Default theme */
  --bg-base: #0a0816;
  --bg-raised: #14102a;
  --bg-elevated: #1c1736;
  --bg-glass: rgba(20, 16, 42, 0.65);

  --line: #2a2342;
  --line-soft: #1f1a36;
  --line-strong: #3d3458;

  --ink-primary: #f4ede0;
  --ink-secondary: #c2b8a8;
  --ink-muted: #8b82a8;
  --ink-faint: #5a5478;

  --gold: #c9a961;
  --gold-dim: #937a3f;
  --gold-glow: rgba(201, 169, 97, 0.18);

  --rose: #c47a8a;
  --celest: #7a8fc4;
  --sage: #8aa896;
  --signal: #d97757;
  --success: #8aa896;
  --danger: #c47a8a;

  --shadow-soft: 0 1px 0 rgba(255,255,255,0.04) inset, 0 20px 60px -20px rgba(0,0,0,0.6);
  --shadow-card: 0 1px 0 rgba(255,255,255,0.03) inset, 0 30px 80px -30px rgba(0,0,0,0.8);

  --noise-opacity: 0.06;
  --header-h: 64px;
  --tap: 44px;

  /* Два семейства на весь продукт: сайт, PDF, письма, карточки.
     Source Serif 4 — заголовки и длинная проза, Inter — всё остальное,
     включая надстрочники и метки, которые раньше набирались моноширинным.

     До этого семейств было шесть: Playfair Display, Literata, Geist,
     JetBrains Mono, Cormorant Garamond и системный стек в письмах. Два из
     них не использовались нигде, а кодовый моношрифт работал акцентом в
     полутора сотнях мест и спорил со всем остальным набором. */
  --font-display: 'Source Serif 4', Georgia, 'Times New Roman', serif;
  --font-body: 'Source Serif 4', Georgia, 'Times New Roman', serif;
  --font-ui: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  /* Моноширинный остался ровно для одного: логов и JSON в админке, где
     колонки держит сам шрифт. Это системный стек, а не пятое загружаемое
     семейство, — на вес страницы он не влияет и в дизайн-систему не лезет. */
  --font-code: ui-monospace, SFMono-Regular, 'SF Mono', Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

body {
  background: var(--bg-base);
  color: var(--ink-primary);
  font-family: var(--font-ui);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  min-height: 100vh;
  overflow-x: hidden;
  letter-spacing: -0.005em;
}

a { color: var(--gold); text-decoration: none; }
a:hover { color: var(--ink-primary); }
img, svg { max-width: 100%; height: auto; display: block; }
::selection { background: var(--gold-glow); color: var(--gold); }

/* Subtle film grain */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 9999;
  /* Тайл вместо feTurbulence: SVG-фильтр заставляет браузер растеризовать слой
     заново на каждое изменение размера. Генерится scripts/gen_paper_noise.py. */
  background-image: url("/film-grain.png");
  background-repeat: repeat;
  background-size: 200px 200px;
  opacity: var(--noise-opacity);
  mix-blend-mode: overlay;
}

/* ——— TYPOGRAPHY ——— */
.display, .display-xl, .display-lg, .display-md {
  font-family: var(--font-display);
  font-weight: 400;
  letter-spacing: -0.02em;
  line-height: 0.95;
  color: var(--ink-primary);
}
.display-xl { font-size: clamp(64px, 10vw, 144px); }
.display-lg { font-size: clamp(48px, 6vw, 92px); }
.display-md { font-size: clamp(32px, 4vw, 56px); }

.italic { font-style: italic; }
.mono { font-family: var(--font-ui); font-feature-settings: 'tnum', 'zero'; }

/* Надстрочники и метки. Раньше набирались JetBrains Mono: моноширинный
   шрифт ради разрядки в заглавных — это лишнее семейство на всём сайте.
   Inter делает ту же работу, но кегль и насыщенность приходится добирать:
   у моно буквы шире и оптически крупнее при том же размере. */
.eyebrow {
  font-family: var(--font-ui);
  font-size: 12px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-muted);
  font-weight: 500;
}
.label {
  font-family: var(--font-ui);
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-muted);
  font-weight: 500;
}

h1,h2,h3,h4 { font-weight: 400; margin: 0; font-family: var(--font-display); color: var(--ink-primary); }
h1 { font-size: clamp(44px, 6vw, 88px); letter-spacing: -0.02em; line-height: 1; }
h2 { font-size: clamp(32px, 4vw, 56px); letter-spacing: -0.015em; line-height: 1.05; }
h3 { font-size: 28px; letter-spacing: -0.01em; }
h4 { font-size: 18px; }
p  { margin: 0; text-wrap: pretty; }

.gold    { color: var(--gold); }
.rose    { color: var(--rose); }
.sage    { color: var(--sage); }
.celest  { color: var(--celest); }
.muted   { color: var(--ink-muted); }
.secondary { color: var(--ink-secondary); }

/* ——— LAYOUT ——— */
.wrap, .narrow { width: 100%; padding: 0 28px; margin: 0 auto; max-width: 1280px; }
.narrow { max-width: 520px; }
.section { padding: 96px 56px; position: relative; }
.section-sm { padding: 56px 56px; }
.section-lg { padding: 140px 56px; }
.row { display: flex; }
.col { display: flex; flex-direction: column; }
.gap-2 { gap: 8px; } .gap-3 { gap: 12px; } .gap-4 { gap: 16px; } .gap-5 { gap: 20px; }
.gap-6 { gap: 24px; } .gap-8 { gap: 32px; } .gap-10 { gap: 40px; } .gap-12 { gap: 48px; }
.center  { display: flex; align-items: center; justify-content: center; }
.between { display: flex; align-items: center; justify-content: space-between; }
.grid { display: grid; }
.relative { position: relative; }
.absolute { position: absolute; }
.full { width: 100%; }
.divider { height: 1px; background: var(--line); width: 100%; }
.divider-v { width: 1px; background: var(--line); height: 100%; align-self: stretch; }
.hairline { border-top: 1px solid var(--line); }

/* ——— HEADER ———
   Шапка переехала в /site-nav.css: она общая со SPA, и держать её правила
   здесь значило показывать их только статическим страницам. Разметка —
   web/landing/partials/nav.html. */

/* ——— BUTTONS ——— */
.btn {
  font-family: var(--font-ui);
  font-size: 14px;
  font-weight: 500;
  letter-spacing: -0.005em;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 13px 20px;
  min-height: var(--tap);
  border-radius: 999px;
  border: 1px solid var(--ink-primary);
  cursor: pointer;
  background: var(--ink-primary);
  color: var(--bg-base);
  transition: all 160ms ease;
  text-decoration: none;
  white-space: nowrap;
  font-family: inherit;
  -webkit-tap-highlight-color: transparent;
}
.btn:hover { background: var(--gold); border-color: var(--gold); color: var(--bg-base); }
.btn:active { transform: scale(0.98); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-primary { background: var(--ink-primary); color: var(--bg-base); border-color: var(--ink-primary); }
.btn-primary:hover { background: var(--gold); border-color: var(--gold); }

.btn-ghost, .btn.ghost {
  background: transparent;
  color: var(--ink-primary);
  border-color: var(--line);
}
.btn-ghost:hover, .btn.ghost:hover {
  border-color: var(--ink-primary); background: transparent; color: var(--ink-primary);
}

.btn-gold { background: var(--gold); color: var(--bg-base); border-color: var(--gold); }
.btn-gold:hover { filter: brightness(1.08); background: var(--gold); color: var(--bg-base); }

.btn-danger { background: var(--danger); color: var(--bg-base); border-color: var(--danger); }
.btn-danger:hover { filter: brightness(1.06); }

.btn-sm { padding: 8px 14px; font-size: 13px; min-height: 36px; }
.btn-lg { padding: 16px 28px; font-size: 15px; }
.btn.block, .btn-block { width: 100%; }
.btn-icon {
  width: 36px; height: 36px;
  padding: 0; min-height: 36px;
  justify-content: center;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: transparent; color: var(--ink-primary);
}
.btn-icon:hover { border-color: var(--ink-primary); background: transparent; color: var(--ink-primary); }

/* ——— CARDS / SURFACES ——— */
.card {
  background: var(--bg-raised);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 24px;
}
.card-glass {
  background: var(--bg-glass);
  backdrop-filter: blur(20px) saturate(140%);
  -webkit-backdrop-filter: blur(20px) saturate(140%);
  border: 1px solid var(--line);
  border-radius: 18px;
}
.card h1, .card h2, .card h3 { margin-top: 0; }

/* ——— ЗВЁЗДНАЯ РОССЫПЬ НА КАРТОЧКАХ ——— */
/* Та же атмосфера, что даёт CardStars (natal-chart.jsx) карточкам кабинета.
   На статичных страницах SVG вешает astro.initCardStars() — сюда вынесена
   только оболочка, чтобы яркость и слой не жили в inline-стилях.

   z-index: -1 плюс isolation: isolate — вместо того чтобы поднимать всё
   содержимое карточки в position: relative: у карточек лендинга есть свои
   абсолютные украшения (.corner-orn), которым такой подъём сломал бы вёрстку.
   Отрицательный слой рисуется поверх фона карточки, но под её текстом. */
.stars-host { position: relative; isolation: isolate; }
.card-stars {
  position: absolute; inset: 0; width: 100%; height: 100%;
  z-index: -1; pointer-events: none;
  /* SVG режет содержимое по своему вьюпорту сам, поэтому overflow: hidden
     карточке не нужен — иначе он обрезал бы выпадающие подсказки в формах.
     Скругление наследуем, чтобы звезда не вылезла за угол карточки. */
  border-radius: inherit;
  opacity: var(--stars-opacity, 0.28);
  transition: opacity 240ms;
}
.stars-host:hover { --stars-opacity: 0.5; }
@media (prefers-reduced-motion: reduce) {
  .card-stars circle { animation: none !important; }
}

/* ——— INPUTS ——— */
.input, .textarea, .select,
.field input, .field select, .field textarea {
  width: 100%;
  min-height: var(--tap);
  background: var(--bg-base);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px 14px;
  font-family: var(--font-ui);
  font-size: 15px;
  color: var(--ink-primary);
  transition: border-color 160ms ease, box-shadow 160ms ease;
  appearance: none; -webkit-appearance: none;
}
.input:focus, .textarea:focus, .select:focus,
.field input:focus, .field select:focus, .field textarea:focus {
  outline: none;
  border-color: var(--gold);
  box-shadow: 0 0 0 4px var(--gold-glow);
}
.input-bare {
  background: transparent;
  border: none;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  padding: 10px 0;
}
.input-bare:focus { outline: none; border-bottom-color: var(--gold); box-shadow: none; }

.field { margin-bottom: 14px; }
.field label, label.field > .label {
  display: block;
  font-family: var(--font-ui);
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-muted);
  font-weight: 400;
  margin-bottom: 6px;
}
.field-checkbox {
  display: flex; gap: 12px; align-items: flex-start;
  font-size: 13px; color: var(--ink-secondary); line-height: 1.5;
}
.field-checkbox input {
  width: 18px; height: 18px; margin-top: 2px; flex-shrink: 0;
  accent-color: var(--gold);
}
.field-checkbox a { color: var(--gold); }

.grid-2 { display: grid; grid-template-columns: 1fr; gap: 10px; }
@media (min-width: 640px) { .grid-2 { grid-template-columns: 1fr 1fr; } }

/* ——— CHIPS / BADGES ——— */
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  font-family: var(--font-ui);
  font-size: 11px;
  letter-spacing: 0.06em;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--bg-elevated);
  border: 1px solid var(--line);
  color: var(--ink-secondary);
}
.chip-gold {
  background: var(--gold-glow);
  border-color: var(--gold-dim);
  color: var(--gold);
}
.chip-rose { color: var(--rose); border-color: color-mix(in oklab, var(--rose) 50%, transparent); background: color-mix(in oklab, var(--rose) 10%, transparent); }
.chip-sage { color: var(--sage); border-color: color-mix(in oklab, var(--sage) 50%, transparent); background: color-mix(in oklab, var(--sage) 10%, transparent); }
.chip-celest { color: var(--celest); border-color: color-mix(in oklab, var(--celest) 50%, transparent); background: color-mix(in oklab, var(--celest) 10%, transparent); }

.dot { width: 6px; height: 6px; border-radius: 50%; background: var(--ink-muted); display: inline-block; }
.dot-gold { background: var(--gold); box-shadow: 0 0 8px var(--gold); }
.dot-rose { background: var(--rose); }
.dot-sage { background: var(--sage); }

/* ——— STATUS FEEDBACK (compat with existing forms) ——— */
.status, .status-line {
  margin-top: 14px; padding: 12px 14px;
  border-radius: 12px; font-size: 14px;
  display: none;
}
.status.loading { display: block; background: var(--gold-glow); color: var(--gold); border: 1px solid color-mix(in oklab, var(--gold) 30%, transparent); }
.status.error   { display: block; background: color-mix(in oklab, var(--danger) 12%, transparent); color: var(--danger); border: 1px solid color-mix(in oklab, var(--danger) 40%, transparent); }
.status.success { display: block; background: color-mix(in oklab, var(--success) 12%, transparent); color: var(--success); border: 1px solid color-mix(in oklab, var(--success) 40%, transparent); }
.spinner {
  display: inline-block; width: 14px; height: 14px;
  border: 2.5px solid currentColor; border-top-color: transparent;
  border-radius: 50%; animation: spin 0.8s linear infinite;
  margin-right: 8px; vertical-align: -2px;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ——— DIVIDER ("или") ——— */
.divider-or, .divider.text {
  display: flex; align-items: center; gap: 12px;
  color: var(--ink-faint); font-size: 12px; margin: 18px 0;
  text-transform: uppercase; letter-spacing: 1px;
  font-family: var(--font-ui); font-weight: 400;
}
.divider-or::before, .divider-or::after,
.divider.text::before, .divider.text::after {
  content: ""; flex: 1; height: 1px; background: var(--line);
}

/* ——— OAUTH BUTTONS ——— */
.oauth { display: grid; gap: 10px; }
.oauth-btn {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  padding: 12px 16px; min-height: var(--tap);
  border-radius: 999px; border: 1px solid var(--line);
  background: var(--bg-raised); color: var(--ink-primary);
  text-decoration: none; font-weight: 500;
  font-size: 14px; cursor: pointer; font-family: inherit;
  -webkit-tap-highlight-color: transparent;
  transition: border-color 160ms, background 160ms;
}
.oauth-btn:hover:not(:disabled) { border-color: var(--gold); color: var(--gold); }
.oauth-btn:disabled, .oauth-btn[aria-disabled="true"] { opacity: 0.5; cursor: not-allowed; }
.oauth-btn svg { width: 18px; height: 18px; flex-shrink: 0; }

/* ——— SCROLLBARS ——— */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--line); border-radius: 999px; }
::-webkit-scrollbar-thumb:hover { background: var(--line-strong); }

/* ——— ZODIAC MARQUEE ——— */
.marquee {
  border-top: 1px solid var(--line-soft);
  border-bottom: 1px solid var(--line-soft);
  overflow: hidden;
  padding: 20px 0;
}
.marquee-track {
  display: flex; gap: 64px; align-items: center; white-space: nowrap;
  animation: marquee-scroll 80s linear infinite;
  width: max-content;
}
.marquee-item {
  display: inline-flex; align-items: center; gap: 12px;
  color: var(--ink-secondary);
}
.marquee-item .mono {
  font-size: 12px; letter-spacing: 0.16em; text-transform: uppercase;
}
@keyframes marquee-scroll {
  from { transform: translateX(0); }
  to { transform: translateX(-50%); }
}

/* ——— PRODUCT CARDS ——— */
.product-card {
  position: relative;
  padding: 32px 28px 28px;
  min-height: 440px;
  display: flex; flex-direction: column; justify-content: space-between;
  overflow: hidden;
  background: var(--bg-raised);
  border: 1px solid var(--line);
  border-radius: 18px;
}
.product-card .corner-orn {
  position: absolute; top: -40px; right: -40px; opacity: 0.35; pointer-events: none;
}
.product-card .planets {
  display: flex; gap: 12px; margin-bottom: 20px;
}
.product-card .planet-pill {
  width: 36px; height: 36px; border-radius: 50%;
  border: 1px solid var(--line);
  display: flex; align-items: center; justify-content: center;
  color: var(--gold);
}

/* ——— PROCESS STEPS ——— */
.process {
  display: grid; grid-template-columns: repeat(3, 1fr);
  gap: 0;
  border-top: 1px solid var(--line); border-bottom: 1px solid var(--line);
}
.process .step {
  padding: 40px 32px;
  border-right: 1px solid var(--line);
}
.process .step:last-child { border-right: none; }
.process .step .num {
  font-family: var(--font-display);
  font-size: 52px; color: var(--gold); line-height: 1;
}
@media (max-width: 900px) {
  .process { grid-template-columns: 1fr; }
  .process .step { border-right: none; border-bottom: 1px solid var(--line); }
  .process .step:last-child { border-bottom: none; }
}

/* ——— TESTIMONIAL ——— */
.testi {
  padding: 32px;
  display: flex; flex-direction: column; justify-content: space-between;
  min-height: 280px;
}
.testi .quote {
  font-family: var(--font-display);
  font-size: 21px; line-height: 1.4; margin-bottom: 24px;
}
.testi .quote .q { color: var(--gold); }
.testi .who {
  display: flex; align-items: center; gap: 12px;
}
.testi .ava {
  width: 40px; height: 40px; border-radius: 50%;
  border: 1px solid var(--gold);
  display: flex; align-items: center; justify-content: center;
  color: var(--gold);
}

/* ——— FAQ ——— */
.faq-item { border-bottom: 1px solid var(--line); }
.faq-item summary {
  list-style: none;
  width: 100%; cursor: pointer;
  padding: 24px 0;
  display: flex; align-items: center; justify-content: space-between;
  color: var(--ink-primary);
  font-family: var(--font-display); font-size: 22px;
  text-align: left;
}
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary .icon {
  color: var(--gold); transition: transform 200ms;
  width: 18px; height: 18px;
}
.faq-item[open] summary .icon { transform: rotate(45deg); }
.faq-item .answer {
  padding: 0 0 24px;
  color: var(--ink-secondary); font-size: 15px; line-height: 1.6;
  max-width: 680px;
}

/* ——— СПИСКИ КАБИНЕТА (персоны и заказы) ——— */
/* Разметку этих строк рисует JS кабинета (account.html, person.html), а стилей
   к ней в проекте не было вовсе: строки сыпались вертикальным столбиком голого
   текста — аватар, имя, дата и кнопки каждый со своей строки. Отсюда и ощущение
   перегруженной страницы: контента мало, а места он занимал на весь экран. */
.person-row, .order-row {
  display: flex; align-items: center; gap: 14px;
  padding: 14px 18px;
  border: 1px solid var(--line); border-radius: 12px;
  background: var(--bg-raised);
  margin-bottom: 10px;
}
.person-row:hover { border-color: var(--line-strong); }
.order-row { justify-content: space-between; }
.person-avatar {
  flex: none;
  width: 40px; height: 40px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: var(--bg-elevated); border: 1px solid var(--line-strong);
  color: var(--gold); font-family: var(--font-display); font-size: 17px;
}
.person-row .meta, .order-row .meta {
  color: var(--ink-muted); font-size: 13px; margin-top: 3px;
}
.person-row .actions {
  flex: none; display: flex; align-items: center; gap: 6px;
}
/* Звёздочка «персона по умолчанию» стоит внутри строки с именем, а глобальное
   правило (img, svg { display: block }) выбрасывало её на отдельную строку —
   вместе с плашкой роли следом. Здесь она снова часть строки. */
.person-row .star { display: inline-block; height: 14px; vertical-align: -2px; }
/* Иконки-действия: то же касание, что у кнопок, но без веса рамки. */
.icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 36px; height: 36px; padding: 0;
  border: 1px solid var(--line); border-radius: 9px;
  background: none; color: var(--ink-muted); cursor: pointer;
  transition: color 160ms, border-color 160ms;
}
.icon-btn:hover { color: var(--ink-primary); border-color: var(--line-strong); }
.icon-btn.danger:hover { color: var(--rose); border-color: var(--rose); }

/* Статус заказа и роль персоны. Цвет несёт смысл только вместе с подписью:
   «Ошибка» читается словом, а не одним лишь оттенком рамки. */
.pill {
  display: inline-block; white-space: nowrap;
  padding: 4px 10px; border-radius: 999px;
  border: 1px solid var(--line-strong);
  font-size: 11px; letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--ink-muted);
}
.pill.ready { color: var(--gold); border-color: color-mix(in oklab, var(--gold) 45%, var(--line)); }
.pill.paid, .pill.generating { color: var(--ink-secondary); }
.pill.failed, .pill.cancelled { color: var(--rose); border-color: color-mix(in oklab, var(--rose) 40%, var(--line)); }
.pill.relation { text-transform: none; letter-spacing: 0.01em; font-size: 11px; padding: 3px 8px; }

@media (max-width: 560px) {
  /* Кнопки под текстом, а не в притык справа: на 360px строка иначе рвётся —
     цена заказа переносится по слогам, чтобы дать место статусу и кнопке. */
  .person-row, .order-row { flex-wrap: wrap; }
  .person-row .actions { width: 100%; justify-content: flex-end; }
  .order-row > div:last-child { width: 100%; justify-content: flex-end; }
}

/* ——— НАСТРОЙКИ АККАУНТА (свёрнутый блок в кабинете) ——— */
/* Тише секций с контентом: это не то, зачем приходят в кабинет. Отсюда
   отбивка сверху, приглушённый заголовок и никакой рамки в закрытом виде. */
.acct-settings { margin-top: 48px; border-top: 1px solid var(--line); }
.acct-settings summary {
  list-style: none;
  cursor: pointer;
  padding: 18px 0;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  color: var(--ink-muted);
  font-size: 14px; letter-spacing: 0.01em;
}
.acct-settings summary::-webkit-details-marker { display: none; }
.acct-settings summary:hover { color: var(--ink-secondary); }
.acct-settings summary .icon { color: var(--ink-faint); transition: transform 200ms; }
.acct-settings[open] summary .icon { transform: rotate(45deg); }
.acct-settings-body {
  display: flex; flex-wrap: wrap; gap: 8px;
  padding: 0 0 22px;
}

/* ——— STAT (trust strip) ——— */
.stat {
  display: flex; flex-direction: column; gap: 4px;
}
.stat .num {
  display: flex; align-items: baseline; gap: 3px;
}
.stat .num .big {
  font-family: var(--font-display); font-size: 36px; color: var(--ink-primary); line-height: 1;
}
.stat .num .unit {
  font-family: var(--font-ui); font-size: 12px; color: var(--ink-muted);
}
/* Табличные цифры: моно выравнивал их сам, Inter — только по просьбе.
   (.mono своё уже просит через font-feature-settings выше.) */
.stat .num { font-variant-numeric: tabular-nums; }
.stat .lbl {
  font-family: var(--font-ui); font-size: 11px;
  color: var(--ink-muted); letter-spacing: 0.05em;
}

/* ——— PDF preview mockup on landing ——— */
.pdf-mock {
  padding: 40px 36px;
  background: var(--bg-elevated);
  border: 1px solid var(--line);
  border-radius: 4px;
  aspect-ratio: 0.75 / 1;
  max-width: 480px;
  margin: 0 auto;
  position: relative;
  box-shadow: 0 40px 100px -30px rgba(0,0,0,0.8);
}
.pdf-peek {
  position: absolute; top: 20px; left: 20%; right: 20%; bottom: -10px;
  background: var(--bg-raised); border-radius: 4px;
  border: 1px solid var(--line);
  z-index: -1; opacity: 0.4;
}

/* ——— KEYFRAMES ——— */
@keyframes orbit { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }
@keyframes twinkle { 0%, 100% { opacity: 0.3; } 50% { opacity: 1; } }
@keyframes pulse-glow { 0%, 100% { filter: drop-shadow(0 0 4px var(--gold-glow)); } 50% { filter: drop-shadow(0 0 16px var(--gold)); } }
@keyframes drift { 0% { transform: translateY(0); } 50% { transform: translateY(-6px); } 100% { transform: translateY(0); } }
@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
.fade-in { animation: fadeIn 600ms ease both; }

/* ——— ORDER PAGE topbar (back-link wrapper, replaces former inline style) ——— */
.order-topbar { max-width: 1280px; margin: 0 auto; padding: 18px 28px 0; }

/* ——— RESPONSIVE ——— */
@media (max-width: 900px) {
  .section, .section-lg { padding: 56px 24px; }
  .section-sm { padding: 32px 24px; }
  .wrap, .narrow { padding: 0 20px; }
  .order-topbar { padding: 14px 20px 0; }
  .display-xl { font-size: 56px; }
  .display-lg { font-size: 40px; }

  /* Order reader: keep the aside-on-top / reader-below single column even if
     order-v2.css's own 980px rule is ever absent. body.order-page boosts
     specificity so we win over order-v2.css (loaded after app.css). */
  body.order-page .order-v2 { grid-template-columns: 1fr; gap: 28px; }
  body.order-page .reader { min-height: 0; }
  body.order-page .side { position: static; max-height: none; overflow: visible; padding-right: 0; }
}

@media (max-width: 640px) {
  .display-xl { font-size: 44px; }
  .display-lg { font-size: 34px; }
}

@media (max-width: 560px) {
  /* Sitewide: shrink large horizontal paddings so /app.css pages stop
     overflowing on phones (~360–414px). */
  .section, .section-lg { padding: 48px 16px; }
  .section-sm { padding: 28px 16px; }
  .wrap, .narrow { padding: 0 16px; }
  .order-topbar { padding: 12px 16px 0; }
  .card { padding: 20px 16px; }

  /* Order layout: full-width single column with tight gutters. */
  body.order-page .order-v2 { padding: 14px 12px 48px; gap: 20px; }

  /* PDF page viewer scales to fit width instead of overflowing. The reader is
     a flex column inside the grid cell; the "paper" pages inherit width but
     their generous 32px frame + 48px paper gutters blow past a 360px viewport.
     Cut the frame/gutters and let the paper be fluid (max-width: 100%). */
  body.order-page .pages { padding: 16px 12px; gap: 18px; }
  body.order-page .paper {
    width: 100%;
    max-width: 100%;
    padding: 28px 20px 26px;
  }
  body.order-page .paper .p-title { font-size: 27px; }
  body.order-page .paper .body-serif { font-size: 16px; }

  /* Reading controls (they live in the sidebar card now) wrap instead of
     overflowing on narrow screens. */
  body.order-page .nav-row { flex-wrap: wrap; row-gap: 8px; }
  body.order-page .nav-row .chip { margin-left: 0; }

  /* Sidebar cards: trim inner padding so meta rows fit narrow screens. */
  body.order-page .side .meta-card { padding: 18px 16px; }
}

/* ——— LEGACY COMPAT (старые pages, используют классы с предыдущей дизайн-системы) ——— */
.hero-light, .hero-eyebrow, .hero-headline { /* placeholders */ }
.subtitle { color: var(--ink-secondary); font-size: 16px; margin-top: 8px; }
.btn.gradient { background: linear-gradient(135deg, var(--gold), var(--rose)); border-color: transparent; }

/* Margin utilities */
.mt-1 { margin-top: 4px; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 16px; }
.mt-4 { margin-top: 24px; }
.mt-5 { margin-top: 32px; }
.mt-6 { margin-top: 48px; }

/* Flex shortcut (used by account/order legacy) */
.flex { display: flex; gap: 8px; }

/* Legacy --muted/--danger fallback (старые места использовали var(--muted)) */
:root {
  --muted: var(--ink-muted);
  --text: var(--ink-primary);
  --bg: var(--bg-base);
  --bg-card: var(--bg-raised);
  --accent: var(--gold);
}

/* ——— MODAL (used by /account, /order pages) ——— */
.modal-bg {
  display: none;
  position: fixed; inset: 0;
  background: rgba(10, 8, 22, 0.72);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 1000;
  align-items: flex-start;
  justify-content: center;
  padding: 48px 16px;
  overflow-y: auto;
}
.modal-bg.open, .modal-bg.shown { display: flex; }
.modal {
  background: var(--bg-raised);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 28px;
  max-width: 520px;
  width: 100%;
  box-shadow: var(--shadow-card);
}
.modal h2 {
  font-family: var(--font-display);
  font-size: 26px;
  letter-spacing: -0.01em;
  margin: 0 0 6px;
}
.modal .subtitle { margin-top: 0; margin-bottom: 18px; }

/* Cookie banner — старый класс */
/* Плашку показывает JS, добавляя .shown, и он же снимает класс по кнопке «ОК».
   Раньше в этом правиле стояли два display подряд — none и ниже flex, — и
   выигрывал второй: плашка висела у всех, включая тех, кто уже согласился,
   и кнопка её не убирала, потому что убирала класс, ничего не значивший. */
#cookie-banner {
  display: none;
  position: fixed; bottom: 16px; left: 16px; right: 16px;
  max-width: 480px; margin: 0 auto;
  padding: 14px 16px;
  background: var(--bg-glass);
  backdrop-filter: blur(20px);
  border: 1px solid var(--line);
  border-radius: 14px;
  z-index: 200;
  font-size: 13px;
  color: var(--ink-secondary);
  align-items: center; gap: 12px;
  box-shadow: var(--shadow-card);
}
#cookie-banner.shown { display: flex; }
#cookie-banner a { color: var(--gold); }
#cookie-banner .btn { padding: 8px 14px; font-size: 13px; min-height: 36px; }

/* Hero title legacy alias */
.hero-title, .hero {
  font-family: var(--font-display);
  font-weight: 400;
  letter-spacing: -0.02em;
  line-height: 1.05;
  color: var(--ink-primary);
}

/* Toast (used by astro.toast) */
.toast {
  position: fixed; bottom: 24px; right: 24px;
  padding: 12px 18px;
  background: var(--bg-elevated);
  border: 1px solid var(--line);
  border-radius: 12px;
  color: var(--ink-primary);
  font-size: 14px;
  z-index: 2000;
  box-shadow: var(--shadow-card);
  animation: fadeIn 240ms ease both;
}
.toast.success { border-color: color-mix(in oklab, var(--sage) 50%, transparent); color: var(--sage); }
.toast.error   { border-color: color-mix(in oklab, var(--rose) 50%, transparent); color: var(--rose); }
.toast.info    { border-color: var(--gold-dim); color: var(--gold); }

/* ——— SELECT (свой, вместо системного) ———
   Нативный <select> рисует список средствами ОС: на тёмной теме он выпадает
   светлым системным меню и игнорирует наши переменные. Здесь список — обычная
   разметка, поэтому выглядит как остальные поля формы. */
.ui-select { position: relative; width: 100%; }

.ui-select-trigger {
  width: 100%;
  min-height: var(--tap);
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  background: var(--bg-base);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px 14px;
  font-family: var(--font-ui);
  font-size: 15px;
  color: var(--ink-primary);
  text-align: left;
  cursor: pointer;
  transition: border-color 160ms ease, box-shadow 160ms ease;
}
.ui-select-trigger:focus-visible,
.ui-select.open .ui-select-trigger {
  outline: none;
  border-color: var(--gold);
  box-shadow: 0 0 0 4px var(--gold-glow);
}
.ui-select.disabled .ui-select-trigger { opacity: 0.5; cursor: not-allowed; }

.ui-select-value { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ui-select-value.placeholder { color: var(--ink-faint); }

.ui-select-chev { flex: none; color: var(--ink-muted); transition: transform 160ms ease; }
.ui-select.open .ui-select-chev { transform: rotate(180deg); }

.ui-select-menu {
  position: absolute; z-index: 60; top: calc(100% + 6px); left: 0; right: 0;
  background: var(--bg-elevated);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.55);
  overflow: hidden;
}

.ui-select-search {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  color: var(--ink-muted);
}
 /* Селектор с .ui-select-search обязателен: глобальное правило
    `.field input` перебивает одиночное `input` — компонент почти всегда
    стоит внутри <label class="field">, и поиск получал бы рамку поля. */
.ui-select-search input,
.field .ui-select-search input {
  flex: 1; min-width: 0; width: auto;
  min-height: 0;
  background: transparent;
  border: none;
  border-radius: 0;
  padding: 0;
  font-family: var(--font-ui); font-size: 14px; color: var(--ink-primary);
}
.ui-select-search input:focus,
.field .ui-select-search input:focus {
  outline: none; border: none; box-shadow: none;
}
.ui-select-search input::placeholder { color: var(--ink-faint); }

/* Ограничение по высоте — в списке часовых поясов больше 40 пунктов. */
.ui-select-list { max-height: 264px; overflow-y: auto; padding: 6px; }

.ui-select-option {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px;
  border-radius: 9px;
  font-size: 14px;
  color: var(--ink-secondary);
  cursor: pointer;
}
.ui-select-option.active { background: var(--bg-raised); color: var(--ink-primary); }
.ui-select-option.selected { color: var(--gold); }
.ui-select-option-label { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ui-select-option-hint {
  flex: none;
  font-family: var(--font-ui);
  font-size: 11px;
  color: var(--ink-faint);
}
.ui-select-tick { flex: none; color: var(--gold); }

.ui-select-empty {
  padding: 14px 12px;
  font-size: 13px;
  color: var(--ink-faint);
  text-align: center;
}

/* ——— наверх ——— */

.to-top {
  position: fixed; right: 24px; bottom: 24px; z-index: 150;
  width: 44px; height: 44px; border-radius: 999px;
  display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid var(--line); background: var(--bg-glass);
  backdrop-filter: blur(20px);
  color: var(--ink-secondary); cursor: pointer;
  opacity: 0; pointer-events: none; transform: translateY(8px);
  transition: opacity 200ms ease, transform 200ms ease, color 200ms ease, border-color 200ms ease;
}
.to-top.is-shown { opacity: 1; pointer-events: auto; transform: none; }
.to-top:hover { color: var(--gold); border-color: var(--gold); }
/* Плашка про куки стоит там же и на узком экране закрывает кнопку. */
body:has(#cookie-banner.shown) .to-top { bottom: 96px; }
@media (max-width: 640px) {
  .to-top { right: 16px; bottom: 16px; width: 40px; height: 40px; }
  body:has(#cookie-banner.shown) .to-top { bottom: 120px; }
}
@media (prefers-reduced-motion: reduce) {
  .to-top { transition: opacity 200ms ease; transform: none; }
}
