/* ==========================================================================
   tokens.css — дизайн-токени oczyfrovka.top
   ДЖЕРЕЛО: /home/user/uploaded_files/DESIGN-TOKENS.md
   Значення палітри й правила — НЕ змінювати без дозволу власника проєкту.
   ========================================================================== */

/* --- 1. Палітра (DESIGN-TOKENS.md §1) --- */
:root {
  --bg: #14110F;
  --surface: #1E1A17;
  --surface-2: #2A2421;
  --line: #3A322D;
  --text: #F5EFE7;
  --text-muted: #A99F94;

  --brand: #E0A458;
  --brand-hover: #EFB871;
  --brand-soft: rgba(224, 164, 88, .10);

  --cta: #1FB89B;
  --cta-hover: #2ED3B3;
  --cta-active: #189C84;
  --cta-on-light: #158B76;
  --on-cta: #0B1512;

  --cream: #F7F2EA;
  --on-cream: #1A1613;

  --ok: #4FB477;
  --warn: #E3B341;
  --err: #E4664F;

  /* --- 6. Радіуси і тіні (DESIGN-TOKENS.md §6) --- */
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 22px;
  --radius-pill: 999px;
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, .35);
  --shadow-md: 0 8px 30px rgba(0, 0, 0, .45);
  --shadow-glow: 0 0 0 1px var(--brand-soft);

  /* --- 5. Сітка (DESIGN-TOKENS.md §5) --- */
  --container-max: 1200px;
  --grid-gutter: 24px;
  --section-pad: clamp(56px, 8vw, 120px);

  /* --- анімації (DESIGN-TOKENS.md §8) --- */
  --ease-ui: ease-out;
  --dur-ui: 200ms;
  --ease-reveal: cubic-bezier(.22, .61, .36, 1);
  --dur-reveal: 500ms;

  /* службові розміри каркасу (Milestone 1) */
  --header-h: 72px;
  --sticky-h: 64px;
}

/* ==========================================================================
   2. Типографіка (DESIGN-TOKENS.md §4)
   Самохостинг /static/fonts, WOFF2, subset cyrillic+cyrillic-ext+latin.
   Preload лише Unbounded 700 і Manrope 400 (див. renderer.tsx) — інші ваги
   довантажуються фоново через font-display:swap.
   ========================================================================== */
@font-face {
  font-family: 'Unbounded';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url('/static/fonts/unbounded-700.woff2') format('woff2');
}
@font-face {
  font-family: 'Unbounded';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url('/static/fonts/unbounded-600.woff2') format('woff2');
}
@font-face {
  font-family: 'Manrope';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('/static/fonts/manrope-400.woff2') format('woff2');
}
@font-face {
  font-family: 'Manrope';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url('/static/fonts/manrope-500.woff2') format('woff2');
}
@font-face {
  font-family: 'Manrope';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url('/static/fonts/manrope-700.woff2') format('woff2');
}
@font-face {
  font-family: 'JetBrains Mono';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('/static/fonts/jetbrainsmono-400.woff2') format('woff2');
}

:root {
  --font-heading: 'Unbounded', ui-sans-serif, system-ui, sans-serif;
  --font-body: 'Manrope', ui-sans-serif, system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, monospace;
}

/* ==========================================================================
   3. Reset / базові стилі
   ========================================================================== */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-weight: 400;
  font-size: 1.0625rem;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  /* Захист від випадкового горизонтального скролу на вузьких екранах —
     страхує від будь-яких елементів, що можуть «вилізти» за ширину. */
  overflow-x: hidden;
}
img, svg { display: block; max-width: 100%; }
a { color: var(--brand); text-decoration: none; }
a:hover { color: var(--brand-hover); }
ul { margin: 0; padding: 0; }

h1, h2, h3, h4 {
  font-family: var(--font-heading);
  font-weight: 700;
  margin: 0;
  color: var(--text);
  /* На вузьких екранах (320px) довгі слова («Оцифрування» тощо) при
     мінімальному clamp()-розмірі можуть бути ширші за колонку — без
     цього правила вони «вилазять» за межі екрана замість перенесення. */
  overflow-wrap: break-word;
  word-break: break-word;
}
h1 { font-size: clamp(2.1rem, 6vw, 4rem); line-height: 1.05; letter-spacing: -0.02em; }
/* margin-bottom у h2 — щоб заголовок секції не «прилипав» до наступного
   контенту (картки/таблиці/CTA йдуть відразу після h2 без обгортки-абзацу,
   тож без явного відступу тут вони візуально налазять один на одного —
   баг «заголовок налазить на блоки»). .section-cta h2 лишається без
   відступу (margin:0 у content.css) — там заголовок сам всередині картки.
   h3 навмисно НЕ отримує тут відступ: у .tariff-card/.format-card/.card
   заголовок вже всередині flex-контейнера з gap — власний margin-bottom
   дав би подвійний відступ. */
h2 { font-size: clamp(1.6rem, 3.6vw, 2.6rem); line-height: 1.15; margin-bottom: 20px; }
h3 { font-size: clamp(1.25rem, 2.2vw, 1.6rem); line-height: 1.25; font-weight: 600; }
.lead { font-size: 1.25rem; line-height: 1.55; color: var(--text-muted); }
small, .text-small { font-size: .875rem; }
.prose { max-width: 68ch; }
.price, .tabular { font-variant-numeric: tabular-nums; font-family: var(--font-mono); }

.container {
  width: 100%;
  max-width: var(--container-max);
  margin: 0 auto;
  padding-inline: var(--grid-gutter);
}
.section { padding-block: var(--section-pad); }

/* Focus ring — DESIGN-TOKENS.md §2: усі інтерактивні елементи */
a:focus-visible,
button:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible,
[tabindex]:focus-visible {
  outline: 2px solid var(--cta);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

/* Ховаємо елементи без js без миготіння шапки (progressive enhancement) */
.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}
.skip-link {
  position: absolute;
  left: 8px;
  top: -48px;
  z-index: 300;
  background: var(--cta);
  color: var(--on-cta);
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  font-weight: 700;
  transition: top var(--dur-ui) var(--ease-ui);
}
.skip-link:focus { top: 8px; }

/* ==========================================================================
   4. Кнопки трьох рівнів (DESIGN-TOKENS.md §7, §2)
   ========================================================================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 10px 20px;
  border-radius: var(--radius-sm);
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 1rem;
  line-height: 1.2;
  border: 1px solid transparent;
  cursor: pointer;
  transition: background var(--dur-ui) var(--ease-ui), color var(--dur-ui) var(--ease-ui), border-color var(--dur-ui) var(--ease-ui);
  text-decoration: none;
}
/* Первинна — лише для головної дії, --cta */
.btn-primary {
  background: var(--cta);
  color: var(--on-cta);
}
.btn-primary:hover { background: var(--cta-hover); color: var(--on-cta); }
.btn-primary:active { background: var(--cta-active); }
.btn-primary:disabled { opacity: .5; cursor: not-allowed; }
/* На --cream секціях teal замінюється на --cta-on-light */
.on-cream .btn-primary,
.btn-primary.on-cream {
  background: var(--cta-on-light);
  color: #fff;
}
/* Вторинна — прозорий фон + border --brand */
.btn-secondary {
  background: transparent;
  border-color: var(--brand);
  color: var(--brand);
}
.btn-secondary:hover { color: var(--brand-hover); border-color: var(--brand-hover); }
/* Третинна — текстове посилання з підкресленням */
.btn-tertiary {
  background: transparent;
  color: var(--brand);
  text-decoration: underline;
  padding: 10px 4px;
  min-height: auto;
}
.btn-tertiary:hover { color: var(--brand-hover); }

/* ==========================================================================
   5. Шапка (Header)
   ========================================================================== */
.site-header {
  position: sticky;
  top: 0;
  z-index: 200;
  height: var(--header-h);
  display: flex;
  align-items: center;
  background: rgba(20, 17, 15, .92);
  backdrop-filter: saturate(140%) blur(8px);
  border-bottom: 1px solid var(--line);
}
.site-header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  height: 100%;
}
.brand-mark {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}
.brand-mark svg { width: 36px; height: 36px; }
.brand-mark span {
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 1.15rem;
  color: var(--text);
  white-space: nowrap;
}
.main-nav { display: none; }
.main-nav ul {
  display: flex;
  align-items: center;
  gap: 4px;
  list-style: none;
}
.main-nav a, .main-nav button.nav-link {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 12px;
  color: var(--text);
  font-weight: 500;
  font-size: .95rem;
  border-radius: var(--radius-sm);
  background: none;
  border: none;
  cursor: pointer;
  font-family: var(--font-body);
}
.main-nav a:hover, .main-nav button.nav-link:hover { color: var(--brand); background: var(--brand-soft); }

.nav-dropdown { position: relative; }
.nav-dropdown-panel {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  min-width: 220px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
  padding: 8px;
  display: none;
  flex-direction: column;
  gap: 2px;
}
.nav-dropdown:hover .nav-dropdown-panel,
.nav-dropdown:focus-within .nav-dropdown-panel {
  display: flex;
}
.nav-dropdown-panel a {
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  font-size: .9rem;
}
.nav-dropdown-panel a:hover { background: var(--brand-soft); color: var(--brand); }

.header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* Перемикач мови UA|RU (DESIGN-TOKENS.md §7) */
.lang-switch {
  display: flex;
  border: 1px solid var(--line);
  border-radius: var(--radius-pill);
  overflow: hidden;
}
.lang-switch a, .lang-switch span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 40px;
  min-height: 32px;
  font-size: .8rem;
  font-weight: 700;
  color: var(--text-muted);
  padding: 0 10px;
}
.lang-switch a:hover { color: var(--brand); background: var(--brand-soft); }
.lang-switch [aria-current="true"] { color: var(--on-cta); background: var(--cta); }
.lang-switch .lang-disabled {
  color: var(--text-muted);
  opacity: .4;
  cursor: not-allowed;
}

.burger-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  background: transparent;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  cursor: pointer;
  flex-direction: column;
  gap: 4px;
}
.burger-btn span {
  display: block;
  width: 20px;
  height: 2px;
  background: var(--text);
  border-radius: 2px;
  transition: transform var(--dur-ui) var(--ease-ui), opacity var(--dur-ui) var(--ease-ui);
}

@media (min-width: 1024px) {
  .main-nav { display: block; }
  .burger-btn { display: none; }
}
@media (max-width: 1023px) {
  .header-actions .lang-switch { display: none; }
  /* Кнопка «Замовити» в шапці ховається на мобільних — інакше вона +
     бургер разом не вміщаються в 375px і шапка горизонтально
     переповнюється (бургер «зʼїжджає» за межі екрана). Кнопка вже
     дублюється в mobile-menu-footer і в sticky-actions знизу. */
  .header-actions .btn-primary { display: none; }
}

/* ==========================================================================
   6. Мобільне меню — бургер (DESIGN-TOKENS.md §7, §9)
   ========================================================================== */
.mobile-menu {
  position: fixed;
  inset: 0;
  z-index: 500;
  background: var(--bg);
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform var(--dur-reveal) var(--ease-reveal);
  visibility: hidden;
}
.mobile-menu[data-open="true"] {
  transform: translateX(0);
  visibility: visible;
}
.mobile-menu-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: var(--header-h);
  padding-inline: var(--grid-gutter);
  border-bottom: 1px solid var(--line);
  flex-shrink: 0;
}
.mobile-menu-body {
  flex: 1;
  overflow-y: auto;
  padding: 24px var(--grid-gutter) 32px;
}
.mobile-menu-body ul { list-style: none; }
.mobile-menu-body > ul > li + li { margin-top: 4px; }
.mobile-menu-body a, .mobile-menu-body .nav-link {
  display: flex;
  align-items: center;
  min-height: 44px;
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text);
  font-family: var(--font-heading);
  padding: 8px 4px;
  background: none;
  border: none;
  width: 100%;
  text-align: left;
  cursor: pointer;
}
.mobile-menu-body a:hover { color: var(--brand); }
.mobile-submenu {
  list-style: none;
  padding-left: 16px;
  border-left: 1px solid var(--line);
  margin: 4px 0 8px 4px;
}
.mobile-submenu a { font-size: .95rem; font-weight: 500; font-family: var(--font-body); min-height: 40px; }

.mobile-menu-contacts {
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.mobile-menu-contacts .phone-row {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-mono);
  font-size: 1rem;
  color: var(--text);
}
.mobile-menu-messengers {
  display: flex;
  gap: 10px;
  margin-top: 4px;
}
.mobile-menu-messengers a {
  width: 44px; height: 44px;
  display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
}
.mobile-menu-footer {
  padding: 16px var(--grid-gutter) 24px;
  border-top: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-shrink: 0;
}

body.menu-open { overflow: hidden; }

@media (min-width: 1024px) {
  .mobile-menu { display: none; }
}

/* ==========================================================================
   7. Sticky-панель мобільних дій (DESIGN-TOKENS.md §7, §9)
   Подзвонити | Telegram | Замовити (Замовити = --cta)
   ========================================================================== */
.sticky-actions {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 150;
  height: var(--sticky-h);
  background: var(--surface);
  border-top: 1px solid var(--line);
  display: grid;
  grid-template-columns: 1fr 1fr 1.3fr;
  box-shadow: var(--shadow-md);
}
.sticky-actions a {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  font-size: .72rem;
  font-weight: 700;
  color: var(--text);
  border-right: 1px solid var(--line);
}
.sticky-actions a:last-child { border-right: none; }
.sticky-actions a i { font-size: 1.05rem; }
.sticky-actions .sticky-order {
  background: var(--cta);
  color: var(--on-cta);
}
.sticky-actions .sticky-order:hover { background: var(--cta-hover); }

@media (min-width: 1024px) {
  .sticky-actions { display: none; }
}
@media (max-width: 1023px) {
  body { padding-bottom: var(--sticky-h); }
}

/* ==========================================================================
   8. Підвал (Footer)
   ========================================================================== */
.site-footer {
  background: var(--surface);
  border-top: 1px solid var(--line);
  padding-block: var(--section-pad);
}
.footer-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 40px;
}
.footer-col h4 {
  font-family: var(--font-body);
  font-size: .8rem;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 14px;
}
.footer-col ul { list-style: none; display: flex; flex-direction: column; gap: 10px; }
.footer-col a { color: var(--text); font-size: .95rem; }
.footer-col a:hover { color: var(--brand); }
.footer-office { margin-bottom: 18px; }
.footer-office .office-name { font-weight: 700; color: var(--text); display: block; margin-bottom: 4px; }
.footer-office .office-meta { color: var(--text-muted); font-size: .875rem; display: block; }
.footer-shipping-item {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid var(--line);
}
.footer-shipping-item:last-child { border-bottom: none; }
.copy-btn {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--brand);
  font-size: .75rem;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  cursor: pointer;
  flex-shrink: 0;
}
.copy-btn:hover { border-color: var(--brand); background: var(--brand-soft); }
.copy-btn[data-copied="true"]::after { content: ' ✓'; }
.footer-dev-credit i.fa-heart { color: var(--cta); margin: 0 2px; }
.footer-bottom {
  margin-top: 32px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: space-between;
  color: var(--text-muted);
  font-size: .8rem;
}
.footer-bottom a { color: var(--text-muted); }
.footer-bottom a:hover { color: var(--brand); }

@media (min-width: 768px) {
  .footer-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (min-width: 1024px) {
  .footer-grid { grid-template-columns: repeat(3, 1fr); }
}

/* ==========================================================================
   9. Сторінки 404 / 500
   ========================================================================== */
.error-page {
  min-height: calc(100vh - var(--header-h));
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: var(--section-pad) var(--grid-gutter);
}
.error-page .error-code {
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: clamp(4rem, 16vw, 9rem);
  line-height: 1;
  color: var(--brand);
  margin-bottom: 8px;
}
.error-page h1 { margin-bottom: 16px; }
.error-page p {
  max-width: 46ch;
  margin: 0 auto 28px;
  color: var(--text-muted);
}

/* ==========================================================================
   10. prefers-reduced-motion — ОБОВ'ЯЗКОВО (DESIGN-TOKENS.md §8)
   ========================================================================== */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
    scroll-behavior: auto !important;
  }
}
