/* template.css — CSS-переменные для Dark/Light + базовые стили.
 * Полная палитра по спеке: docs/superpowers/specs/2026-05-12-excloud-redesign-design.md
 * Tailwind-классы ссылаются на эти переменные через bg-bg, text-text-strong и т.д.
 */

:root {
  /* Default = Dark Side */
  --bg: #0A0E1A;
  --bg-card: #13182A;
  --text-strong: #F2F4F8;
  --text-muted: #8B92A8;
  --accent: #E15B5B;
  --saber: #FF3030;
  --border: rgba(225, 91, 91, 0.12);
  --blob-from: rgba(225, 91, 91, 0.25);
  --blob-to: rgba(255, 100, 60, 0.0);
}

:root[data-theme="light"] {
  --bg: #F7F8FB;
  --bg-card: #FFFFFF;
  --text-strong: #0F1320;
  --text-muted: #566175;
  --accent: #E15B5B;
  --saber: #2E89FF;
  --border: rgba(15, 19, 32, 0.08);
  --blob-from: rgba(46, 137, 255, 0.18);
  --blob-to: rgba(255, 255, 255, 0.0);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; min-height: 100vh; }
body {
  background: var(--bg);
  color: var(--text-strong);
  transition: background 250ms, color 250ms;
}

/* Фоновые organic blob'ы */
.blob {
  position: absolute;
  border-radius: 50%;
  background: radial-gradient(circle, var(--blob-from), var(--blob-to));
  filter: blur(60px);
  pointer-events: none;
  z-index: 0;
}

/* Online-точка статуса (header) */
.status-dot {
  display: inline-block;
  position: relative;
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 0 var(--saber);
  animation: pulse 2s infinite;
  cursor: help;
}
.status-dot::after {
  content: attr(data-tooltip-dark);
  position: absolute;
  top: 100%; left: 50%;
  transform: translate(-50%, 8px);
  background: var(--bg-card);
  color: var(--text-muted);
  padding: 6px 10px;
  border-radius: 6px;
  font-size: 12px;
  white-space: nowrap;
  opacity: 0; pointer-events: none;
  transition: opacity 200ms;
  border: 1px solid var(--border);
}
:root[data-theme="light"] .status-dot::after { content: attr(data-tooltip-light); }
.status-dot:hover::after { opacity: 1; }
@keyframes pulse {
  0%   { box-shadow: 0 0 0 0 var(--saber); }
  70%  { box-shadow: 0 0 0 8px transparent; }
  100% { box-shadow: 0 0 0 0 transparent; }
}

/* Слоганы footer по теме (SW-пасхалка) */
.footer-slogan::before { content: "Join the Empire of cloud"; }
:root[data-theme="light"] .footer-slogan::before { content: "May the Cloud be with you"; }

/* Лайтсэйбер-тогглер */
.lightsaber-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 4px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 12px;
  color: var(--text-muted);
  cursor: pointer;
  transition: border-color 200ms;
}
.lightsaber-btn:hover { border-color: var(--saber); }

.saber-blade {
  fill: var(--saber);
  filter: drop-shadow(0 0 4px var(--saber));
  transform-origin: 19px 8px;
  transform: scaleX(0.1);
  opacity: 0.3;
  transition: transform 350ms cubic-bezier(0.22, 1, 0.36, 1), opacity 200ms;
}
.lightsaber-btn:hover .saber-blade,
.lightsaber-btn.active .saber-blade {
  transform: scaleX(1);
  opacity: 1;
}

/* Mobile menu drawer */
.mobile-menu-popup {
  position: fixed;
  top: 0; right: 0; bottom: 0;
  width: 88%; max-width: 360px;
  background: var(--bg);
  border-left: 1px solid var(--border);
  padding: 24px;
  z-index: 100;
  transform: translateX(100%);
  visibility: hidden;
  transition: transform 280ms cubic-bezier(0.22, 1, 0.36, 1), visibility 0s linear 280ms;
  overflow-y: auto;
}
.mobile-menu-popup.open {
  transform: translateX(0);
  visibility: visible;
  transition: transform 280ms cubic-bezier(0.22, 1, 0.36, 1), visibility 0s linear 0s;
}
/* На десктопе скрываем drawer окончательно — даже если кто-то open-нул через DevTools */
@media (min-width: 768px) {
  .mobile-menu-popup { display: none !important; }
}
.mobile-menu-popup .mobile-menu-close {
  background: none; border: none;
  color: var(--text-muted);
  font-size: 24px;
  cursor: pointer;
  padding: 8px;
  margin-bottom: 16px;
}
.mobile-menu-popup .mobile-menu-logo { display: inline-block; margin-bottom: 24px; }
.mobile-menu-popup .mobile-menu-nav ul { list-style: none; padding: 0; margin: 0; }
.mobile-menu-popup .mobile-menu-nav li { padding: 8px 0; border-bottom: 1px solid var(--border); }
.mobile-menu-popup .mobile-menu-nav a {
  display: block;
  font-size: 18px; font-weight: 600;
  color: var(--text-strong);
  text-decoration: none;
  padding: 12px 0;
}
.mobile-menu-popup .mobile-menu-toggle-wrap {
  display: flex; justify-content: center;
  margin: 24px 0;
  padding: 16px 0;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

/* Overlay при открытом меню */
.mobile-menu-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 99;
  opacity: 0; pointer-events: none;
  transition: opacity 200ms;
}
.mobile-menu-overlay.open { opacity: 1; pointer-events: auto; }

/* Inline-SVG логотип. Использует currentColor для wordmark — позволяет менять цвет по теме.
 * Размеры задаются классами модификаторов; SVG масштабируется по width:auto/height. */
.site-logo-inline {
  display: inline-flex;
  align-items: center;
  color: var(--text-strong);
}
.site-logo-inline svg {
  display: block;
  height: 28px;        /* h-7 эквивалент в header */
  width: auto;
}
.site-logo-inline--lg svg { height: 32px; }   /* mobile menu */
.site-logo-inline--xl svg { height: 128px; }  /* 404 */
.site-logo-link:hover .site-logo-inline { color: var(--accent); transition: color 200ms; }

/* 404: крутящийся Death Star */
.ds-rotate {
  animation: ds-spin 18s linear infinite;
}
/* Если ds-rotate применён к контейнеру с inline-SVG — крутим внутри */
.ds-rotate.site-logo-inline { transform-origin: center; }
.ds-rotate.site-logo-inline svg { height: 128px; }
@keyframes ds-spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

/* Заголовки 404 по теме */
.page-404-title::before { content: "I find your lack of pages disturbing."; }
:root[data-theme="light"] .page-404-title::before { content: "These aren't the pages you're looking for."; }

/* ===== Book-like прозовые стили для /dogovor/ (и других длинных текстов) ===== */
/* Tailwind по умолчанию prose-классов не имеет — описываем здесь напрямую. */
.prose h2 {
  font-size: 1.5rem;
  font-weight: 700;
  margin-top: 2.5rem;
  margin-bottom: 1rem;
  color: var(--text-strong);
  scroll-margin-top: 6rem; /* sticky header offset для якорей */
}
.prose h3 {
  font-size: 1.25rem;
  font-weight: 600;
  margin-top: 2rem;
  margin-bottom: 0.75rem;
  color: var(--text-strong);
}
.prose p,
.prose li {
  color: var(--text-muted);
  line-height: 1.75;
  margin-bottom: 1rem;
}
.prose ol,
.prose ul {
  padding-left: 1.5rem;
  margin-bottom: 1rem;
}
.prose ol { list-style: decimal; }
.prose ul { list-style: disc; }
.prose strong { color: var(--text-strong); font-weight: 600; }
.prose a { color: var(--accent); text-decoration: underline; text-underline-offset: 2px; }
.prose a:hover { text-decoration: none; }
.prose hr { border: 0; border-top: 1px solid var(--border); margin: 2.5rem 0; }

/* ===== dl/dt/dd — реквизиты (для /contacts/ и /dogovor/) ===== */
dl dt { font-size: 0.875rem; color: var(--text-muted); margin-bottom: 0.125rem; }
dl dd { color: var(--text-strong); margin: 0 0 0.875rem 0; }
.prose dl { margin: 1.25rem 0 1.75rem; padding: 1.25rem 1.5rem; background: var(--bg-card); border: 1px solid var(--border); border-radius: 12px; }

/* ===== /dogovor/ — раскладка, sticky TOC, типографика ===== */
.dogovor-page { position: relative; }

.dogovor-aside {
  font-size: 0.95rem;
}
.dogovor-edition time { color: var(--text-strong); font-weight: 500; }

.dogovor-toc-title {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin: 0 0 0.75rem;
}
.dogovor-toc ol {
  list-style: none;
  padding: 0;
  margin: 0;
  counter-reset: toc-counter;
  border-left: 1px solid var(--border);
}
.dogovor-toc li {
  counter-increment: toc-counter;
  margin: 0;
}
.dogovor-toc a {
  position: relative;
  display: block;
  padding: 0.5rem 0 0.5rem 1.125rem;
  margin-left: -1px;
  color: var(--text-muted);
  text-decoration: none;
  border-left: 2px solid transparent;
  transition: color 180ms, border-color 180ms;
  font-size: 0.9rem;
  line-height: 1.4;
}
.dogovor-toc a::before {
  content: counter(toc-counter) ". ";
  color: var(--text-muted);
  opacity: 0.7;
}
.dogovor-toc a:hover { color: var(--text-strong); }
.dogovor-toc a.active {
  color: var(--accent);
  border-left-color: var(--accent);
  font-weight: 600;
}
.dogovor-toc a.active::before { color: var(--accent); opacity: 1; }

.dogovor-article-header {
  margin-bottom: 2rem;
  padding-bottom: 1.25rem;
  border-bottom: 1px solid var(--border);
}
.dogovor-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 0.75rem;
  color: var(--text-muted);
  font-size: 0.875rem;
  margin: 0;
}
.dogovor-meta-sep { opacity: 0.4; }

.dogovor-article p,
.dogovor-article li {
  font-size: 1rem;
  line-height: 1.78;
}
.dogovor-article p strong:first-child {
  /* Нумерация подпунктов «1.1.», «2.3.» — слегка ярче */
  color: var(--accent);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.dogovor-article h2 {
  position: relative;
  padding-top: 0.5rem;
  scroll-margin-top: 96px;
}
.dogovor-article h2::before {
  content: "";
  position: absolute;
  left: -1.25rem;
  top: 1.4rem;
  width: 4px;
  height: 1.6rem;
  background: var(--accent);
  border-radius: 2px;
  opacity: 0.6;
}
@media (max-width: 768px) {
  .dogovor-article h2::before { display: none; }
}

.dogovor-bottom-note { font-style: italic; opacity: 0.7; }

/* ===== Print-friendly стили (Ctrl+P договора) ===== */
@media print {
  :root, :root[data-theme="dark"], :root[data-theme="light"] {
    --bg: #FFFFFF;
    --bg-card: #FFFFFF;
    --text-strong: #000000;
    --text-muted: #333333;
    --accent: #000000;
    --border: #CCCCCC;
  }
  body { background: #FFFFFF !important; color: #000000 !important; }
  .site-header, .site-footer, .order-modal, .order-toast,
  .no-print, .blob, .ds-rotate, .mobile-menu-popup { display: none !important; }
  main.site-main { padding: 0 !important; }
  .dogovor-page { padding: 0; }
  .dogovor-page > div {
    display: block !important;
    max-width: none !important;
    padding: 0 !important;
  }
  .dogovor-aside { position: static !important; margin-bottom: 1.5rem; }
  .dogovor-toc, .dogovor-aside-foot { display: none !important; }
  .dogovor-article { max-width: 100% !important; }
  .dogovor-article h2 {
    page-break-after: avoid;
    margin-top: 1.5rem;
    color: #000 !important;
  }
  .dogovor-article h2::before { display: none; }
  .dogovor-article p, .dogovor-article li {
    color: #000 !important;
    page-break-inside: avoid;
    font-size: 11pt;
    line-height: 1.55;
  }
  .dogovor-article p strong:first-child { color: #000 !important; }
  .dogovor-article a { color: #000 !important; text-decoration: underline; }
  .dogovor-article dl {
    background: transparent !important;
    border: 1px solid #999 !important;
    border-radius: 0 !important;
  }
}

/* ===== Order modal + toast (Phase 8, Task 25) ===== */
.order-modal {
  position: fixed; inset: 0;
  display: none;
  align-items: center; justify-content: center;
  z-index: 200;
}
.order-modal.open { display: flex; }
.order-modal-backdrop {
  position: absolute; inset: 0;
  background: rgba(0,0,0,0.7);
  backdrop-filter: blur(8px);
}
.order-modal-content {
  position: relative; z-index: 1;
  width: calc(100% - 32px);
  max-height: 90vh; overflow-y: auto;
}
.order-modal-close {
  position: absolute; top: 16px; right: 16px;
  background: transparent; border: none;
  color: var(--text-muted);
  font-size: 22px; cursor: pointer;
}

/* Toast */
.order-toast {
  position: fixed; bottom: 24px; right: 24px;
  background: var(--bg-card);
  border: 1px solid var(--saber);
  color: var(--text-strong);
  padding: 16px 20px;
  border-radius: 12px;
  font-style: italic;
  box-shadow: 0 8px 24px rgba(0,0,0,0.3);
  opacity: 0; transform: translateY(20px);
  transition: opacity 250ms, transform 250ms;
  pointer-events: none;
  z-index: 300;
  max-width: 360px;
}
.order-toast.open { opacity: 1; transform: translateY(0); }

/* Hyperspace-streaks при отправке (анимированные точки) */
.order-form-dots {
  animation: hyperspace-dots 1.2s linear infinite;
  letter-spacing: 4px;
  color: var(--saber);
}
@keyframes hyperspace-dots {
  0%   { opacity: 0.3; letter-spacing: 4px; }
  50%  { opacity: 1;   letter-spacing: 10px; }
  100% { opacity: 0.3; letter-spacing: 4px; }
}

/* ===== Period selector (Битрикс-хостинг: 1/6/12/24 мес) ===== */
.period-selector {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 4px;
  padding: 4px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 14px;
}
.period-pill {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: 10px;
  color: var(--text-muted);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: background 180ms, color 180ms;
  user-select: none;
  white-space: nowrap;
}
.period-pill input[type="radio"] {
  position: absolute;
  opacity: 0;
  pointer-events: none;
  inset: 0;
  width: 100%; height: 100%;
}
.period-pill:hover { color: var(--text-strong); }
.period-pill:has(input:checked) {
  background: var(--accent);
  color: #fff;
}
.period-pill:has(input:checked) .period-discount {
  color: rgba(255,255,255,0.85);
}
.period-discount {
  font-size: 12px;
  color: var(--saber);
  font-weight: 600;
}
.period-pill:focus-within {
  outline: 2px solid var(--saber);
  outline-offset: 2px;
}

/* Sub-line under price (period-savings) */
.price-sub {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
  min-height: 16px;
}

/* ============================================================
 * /bitrix-hosting/ — vertical scroll-page with 3 tariff groups
 * 9 cards total. Period selector один глобальный сверху.
 * ============================================================ */

.tariffs-group {
  padding: 2.5rem 0 3rem;
}
.tariffs-group + .tariffs-group {
  border-top: 1px solid var(--border);
}
.tariffs-group-header {
  margin-bottom: 1.75rem;
}
.tariffs-group-title {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--text-strong);
  margin: 0 0 0.5rem;
  letter-spacing: -0.02em;
}
@media (min-width: 768px) {
  .tariffs-group-title { font-size: 2rem; }
}
.tariffs-group-subtitle {
  color: var(--text-muted);
  font-size: 1rem;
  margin: 0;
  max-width: 56ch;
}

/* Карточка тарифа — на базе bento-card, но с полностью кастомным наполнением. */
.tariff-card {
  display: flex;
  flex-direction: column;
  border-radius: 16px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  padding: 1.5rem;
  transition: transform 200ms, border-color 200ms, box-shadow 200ms;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}
.tariff-card:hover {
  transform: translateY(-4px);
  border-color: var(--saber);
  box-shadow: 0 12px 32px -8px var(--saber);
}

/* Tier-бейдж (basic/standard/business/premium) — мелкий текст сверху */
.tariff-tier {
  font-size: 0.6875rem;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  font-weight: 600;
  margin: 0 0 0.75rem;
  opacity: 0.85;
}

/* Имя тарифа — uppercase, акцент при hover карточки */
.tariff-name {
  font-family: var(--font-display);
  font-size: 1.125rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-strong);
  margin: 0 0 0.5rem;
  transition: color 180ms;
}
.tariff-card:hover .tariff-name { color: var(--accent); }

.tariff-subtitle {
  color: var(--text-muted);
  font-size: 0.9rem;
  line-height: 1.5;
  margin: 0;
  min-height: 2.7em; /* выравнивает карточки по высоте subtitle */
}

.tariff-divider {
  border-top: 1px solid var(--border);
  margin: 1.25rem 0;
}

/* Большая цена */
.tariff-price-wrap { margin: 0; }
.tariff-price-line {
  display: flex;
  align-items: baseline;
  gap: 0.4rem;
  margin: 0;
  flex-wrap: wrap;
}
.tariff-price-from {
  font-size: 0.875rem;
  color: var(--text-muted);
  text-transform: lowercase;
}
.tariff-price {
  font-size: 2.25rem;
  font-weight: 700;
  color: var(--text-strong);
  line-height: 1;
}
@media (min-width: 768px) {
  .tariff-price { font-size: 2.5rem; }
}
.tariff-price-unit {
  font-size: 0.95rem;
  color: var(--text-muted);
  font-weight: 500;
}
.tariff-sub {
  font-size: 0.8125rem;
  color: var(--text-muted);
  margin: 0.35rem 0 0;
  min-height: 1.25em;
}

/* Per-card period selector — компактнее главного (1/6/12/24 мес внутри карточки) */
.card-period-selector {
  display: flex;
  gap: 4px;
  padding: 4px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  margin-bottom: 0.75rem;
}
.card-period-pill {
  position: relative;
  flex: 1;
  text-align: center;
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--text-muted);
  padding: 6px 4px;
  border-radius: 7px;
  cursor: pointer;
  transition: background 150ms, color 150ms;
  user-select: none;
  white-space: nowrap;
}
.card-period-pill input[type="radio"] {
  position: absolute;
  opacity: 0;
  pointer-events: none;
  inset: 0;
  width: 100%;
  height: 100%;
}
.card-period-pill:has(input:checked) {
  background: var(--accent);
  color: #fff;
}
.card-period-pill:hover:not(:has(input:checked)) {
  background: var(--bg-card);
  color: var(--text-strong);
}
.card-period-pill:focus-within {
  outline: 2px solid var(--saber);
  outline-offset: 2px;
}

/* Savings line — под ценой, появляется при period > 1 */
.tariff-savings {
  font-size: 0.8125rem;
  color: var(--saber);
  margin: 0.25rem 0 0;
  min-height: 1.3em;
  font-weight: 500;
}
.tariff-savings--zero {
  color: var(--text-muted);
  opacity: 0.5;
  font-weight: 400;
}

/* ===== VPS-калькулятор: дополнительные опции ===== */
.vps-opt-card {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  cursor: pointer;
  background: var(--bg);
  transition: border-color 150ms, background 150ms;
}
.vps-opt-card:hover { border-color: var(--saber); }
.vps-opt-card:has(input:checked) {
  border-color: var(--accent);
  background: var(--bg-card);
}
.vps-opt-card input[type="checkbox"] {
  margin-top: 3px;
  accent-color: var(--accent);
}

/* Маленький tag со скидкой на pill-кнопке (1 мес / 6 мес −6% и т.п.) */
.period-discount-tag {
  font-size: 0.6875rem;
  opacity: 0.75;
  margin-left: 4px;
}
.card-period-pill:has(input:checked) .period-discount-tag {
  opacity: 1;
}

/* Состав — список с дивайдерами, без буллетов */
.tariff-specs {
  list-style: none;
  margin: 0 0 1.5rem;
  padding: 0;
  flex: 1;
}
.tariff-specs li {
  padding: 0.5rem 0;
  border-top: 1px solid var(--border);
  color: var(--text-strong);
  font-size: 0.9rem;
  line-height: 1.4;
}
.tariff-specs li:first-child { border-top: none; padding-top: 0; }
.tariff-specs-common {
  color: var(--text-muted);
  opacity: 0.8;
}

.tariff-cta {
  margin-top: auto;
}

/* Final CTA — отдельная карточка с тёплым акцентом */
.tariffs-cta {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  padding: 2rem;
  border-radius: 20px;
  background: var(--bg-card);
  border: 1px solid var(--accent);
  align-items: flex-start;
}
@media (min-width: 768px) {
  .tariffs-cta {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    padding: 2.5rem 3rem;
    gap: 2rem;
  }
}
.tariffs-cta-text { flex: 1; }
.tariffs-cta-title {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-strong);
  margin: 0 0 0.5rem;
  letter-spacing: -0.01em;
}
@media (min-width: 768px) {
  .tariffs-cta-title { font-size: 1.75rem; }
}
.tariffs-cta-subtitle {
  color: var(--text-muted);
  font-size: 1rem;
  margin: 0;
  max-width: 52ch;
}
.tariffs-cta-btn { white-space: nowrap; }
