/* ═══════════════════════════════════════
   UPGRADE — Shared Design System
   Extracted from inline styles across pages.
   Used by: index, book, pricing, blog, article
   NOT used by: miniapp (Telegram WebView)
   ═══════════════════════════════════════ */

/* ═══════════════════════════════════════
   1. CSS CUSTOM PROPERTIES
   ═══════════════════════════════════════ */
:root {
  --teal:        #2BB5B8;
  --teal-light:  #5DD3D5;
  --teal-dark:   #1E8E90;
  --teal-subtle: #E8F7F7;

  --font-display: 'Cormorant Garamond', Georgia, serif;
  --font-body:    'Manrope', system-ui, sans-serif;
}

[data-theme="light"] {
  --bg-primary:    #FFFFFF;
  --bg-secondary:  #F8FBFB;
  --bg-card:       #FFFFFF;
  --text-primary:  #1A2B2B;
  --text-secondary:#5A7070;
  --text-muted:    #8FA5A5;
  --border:        #E0EDED;
  --border-light:  #F0F5F5;
  --shadow-sm:     0 1px 3px rgba(43,181,184,0.06);
  --shadow-md:     0 8px 32px rgba(43,181,184,0.08);
  --shadow-lg:     0 16px 48px rgba(43,181,184,0.12);
  --nav-bg:        rgba(255,255,255,0.85);
  --badge-bg:      rgba(43,181,184,0.08);
  --badge-border:  rgba(43,181,184,0.15);
}

[data-theme="dark"] {
  --bg-primary:    #0F1A1A;
  --bg-secondary:  #162222;
  --bg-card:       #1A2D2D;
  --text-primary:  #E8F0F0;
  --text-secondary:#9BB5B5;
  --text-muted:    #6A8585;
  --border:        #253838;
  --border-light:  #1E3030;
  --shadow-sm:     0 1px 3px rgba(0,0,0,0.2);
  --shadow-md:     0 8px 32px rgba(0,0,0,0.3);
  --shadow-lg:     0 16px 48px rgba(0,0,0,0.4);
  --nav-bg:        rgba(15,26,26,0.9);
  --badge-bg:      rgba(43,181,184,0.12);
  --badge-border:  rgba(43,181,184,0.25);
}

/* ═══════════════════════════════════════
   2. RESET & BASE
   ═══════════════════════════════════════ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; font-size: 16px; }

body {
  font-family: var(--font-body);
  font-weight: 400;
  color: var(--text-primary);
  background: var(--bg-primary);
  line-height: 1.6;
  overflow-x: hidden;
}

/* Theme-switch animation — activated by JS after load to avoid FCP delay */
body.theme-ready {
  transition: background 0.4s ease, color 0.4s ease;
}

/* ═══════════════════════════════════════
   3. NAVIGATION — core
   ═══════════════════════════════════════ */
.nav {
  position: fixed; top: 0; left: 0; right: 0; z-index: 100;
  padding: 0 2rem; height: 72px;
  display: flex; align-items: center; justify-content: space-between;
  background: var(--nav-bg);
  backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border-light);
  transition: all 0.3s ease;
}
.nav.scrolled { height: 60px; box-shadow: var(--shadow-sm); }
.nav-logo { display: flex; align-items: center; gap: 10px; text-decoration: none; line-height: 1; }
.nav-logo-icon { height: 44px; width: auto; transition: height 0.3s ease; object-fit: contain; }
.nav-logo-text { height: 19px; width: auto; transition: height 0.3s ease; object-fit: contain; }
.nav.scrolled .nav-logo-icon { height: 36px; }
.nav.scrolled .nav-logo-text { height: 16px; }
.nav-links { display: flex; align-items: center; gap: 2rem; list-style: none; }
.nav-links a {
  font-size: 0.85rem; font-weight: 500; color: var(--text-secondary);
  text-decoration: none; letter-spacing: 0.03em; text-transform: uppercase;
  transition: color 0.3s ease; position: relative;
}
.nav-links a:hover { color: var(--teal); }
.nav-links a[aria-current="page"] { color: var(--teal); }
.nav-right { display: flex; align-items: center; gap: 1rem; }

/* ═══════════════════════════════════════
   3a. NAV — underline variant (book, blog, article)
   ═══════════════════════════════════════ */
.nav-links a::after {
  content: ''; position: absolute; bottom: -4px; left: 0; width: 0; height: 1.5px;
  background: var(--teal); transition: width 0.3s ease;
}
.nav-links a:hover::after { width: 100%; }

/* ═══════════════════════════════════════
   4a. THEME TOGGLE — slider variant (index, pricing)
   ═══════════════════════════════════════ */
.theme-toggle-slider {
  width: 44px; height: 24px; border-radius: 12px;
  background: var(--border); border: none; cursor: pointer;
  position: relative; transition: background 0.3s;
}
.theme-toggle-slider::after {
  content: ''; position: absolute; top: 3px; left: 3px;
  width: 18px; height: 18px; border-radius: 50%;
  background: var(--teal); transition: transform 0.3s ease;
}
[data-theme="dark"] .theme-toggle-slider::after { transform: translateX(20px); }
.theme-toggle-icon {
  position: absolute; top: 50%; transform: translateY(-50%);
  font-size: 11px; line-height: 1; pointer-events: none;
}
.theme-toggle-icon.sun { left: 5px; }
.theme-toggle-icon.moon { right: 5px; }

/* ═══════════════════════════════════════
   4b. THEME TOGGLE — circle variant (book, blog, article)
   ═══════════════════════════════════════ */
.theme-toggle {
  background: none; border: 1px solid var(--border); border-radius: 50%;
  width: 36px; height: 36px; cursor: pointer; display: flex;
  align-items: center; justify-content: center; font-size: 1rem;
  color: var(--text-secondary); transition: all 0.3s ease;
}
.theme-toggle:hover { border-color: var(--teal); color: var(--teal); }

/* ═══════════════════════════════════════
   5a. BURGER — index/pricing variant
   ═══════════════════════════════════════ */
.nav-burger {
  display: none; flex-direction: column; gap: 5px;
  background: none; border: none; cursor: pointer; padding: 4px;
}
.nav-burger span {
  width: 22px; height: 2px; background: var(--text-primary);
  border-radius: 1px; transition: all 0.3s;
}

/* ═══════════════════════════════════════
   5b. BURGER — book/blog/article variant
   ═══════════════════════════════════════ */
.mobile-toggle {
  display: none; background: none; border: none; cursor: pointer;
  width: 36px; height: 36px; position: relative;
}
.mobile-toggle span {
  display: block; width: 20px; height: 1.5px; background: var(--text-primary);
  position: absolute; left: 8px; transition: all 0.3s ease;
}
.mobile-toggle span:nth-child(1) { top: 12px; }
.mobile-toggle span:nth-child(2) { top: 17px; }
.mobile-toggle span:nth-child(3) { top: 22px; }

/* ═══════════════════════════════════════
   6a. MOBILE MENU — fullscreen overlay (index, pricing)
   ═══════════════════════════════════════ */
.mobile-menu {
  display: none; position: fixed; inset: 0; z-index: 99;
  background: var(--bg-primary); flex-direction: column;
  align-items: center; justify-content: center; gap: 2rem;
}
.mobile-menu.active { display: flex; }
.mobile-menu a {
  font-family: var(--font-display); font-size: 1.8rem;
  color: var(--text-primary); text-decoration: none; transition: color 0.2s;
}
.mobile-menu a:hover { color: var(--teal); }
.mobile-close {
  position: absolute; top: 1.5rem; right: 1.5rem;
  background: none; border: none; font-size: 1.5rem;
  color: var(--text-primary); cursor: pointer;
}

/* ═══════════════════════════════════════
   6b. MOBILE NAV — slide-down (book, blog, article)
   ═══════════════════════════════════════ */
@media (max-width: 768px) {
  .nav { padding: 0 1rem; }
  .mobile-toggle { display: block; }
  .nav-links {
    position: fixed; top: 72px; left: 0; right: 0;
    background: var(--bg-primary); flex-direction: column;
    padding: 1.5rem; gap: 1.25rem; border-bottom: 1px solid var(--border);
    transform: translateY(calc(-100% - 72px)); visibility: hidden;
    transition: transform 0.4s ease, visibility 0.4s;
  }
  .nav-links.open { transform: translateY(0); visibility: visible; }
}

/* ═══════════════════════════════════════
   7. BUTTONS
   ═══════════════════════════════════════ */
.btn {
  display: inline-flex; align-items: center; gap: 0.5rem;
  padding: 14px 32px; font-family: var(--font-body);
  font-size: 0.85rem; font-weight: 600; letter-spacing: 0.06em;
  text-transform: uppercase; text-decoration: none;
  border-radius: 100px; border: none; cursor: pointer;
  transition: all 0.3s ease;
}
.btn-primary {
  background: var(--teal); color: #fff;
  box-shadow: 0 4px 20px rgba(43,181,184,0.3);
}
.btn-primary:hover {
  background: var(--teal-dark);
  box-shadow: 0 6px 28px rgba(43,181,184,0.4);
  transform: translateY(-2px);
}
.btn-sm { padding: 10px 24px; font-size: 0.78rem; }
.btn-outline {
  background: transparent; color: var(--text-primary);
  border: 1.5px solid var(--border);
}
.btn-outline:hover { border-color: var(--teal); color: var(--teal); }

/* ═══════════════════════════════════════
   8a. FOOTER — full variant (index, pricing)
   ═══════════════════════════════════════ */
.site-footer {
  background: var(--bg-secondary);
  border-top: 1px solid var(--border);
  padding: 2.5rem 2rem 0;
}
.site-footer .footer-inner {
  max-width: 1120px;
  margin: 0 auto;
}
.footer-top {
  display: grid;
  grid-template-columns: 1fr 1.5fr;
  gap: 2.5rem;
  padding-bottom: 2rem;
  align-items: start;
}
.site-footer .footer-logo {
  display: flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  margin-bottom: 0.5rem;
}
.site-footer .footer-logo img:first-child { height: 32px; width: auto; }
.site-footer .footer-logo img:last-child { height: 14px; width: auto; }
.footer-tagline {
  font-size: 0.82rem;
  color: var(--text-secondary);
  font-weight: 300;
}
.footer-content {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}
.footer-row { font-style: normal; }
.footer-row a {
  font-size: 0.85rem;
  color: var(--text-secondary);
  text-decoration: none;
  transition: color 0.2s;
}
.footer-row a:hover { color: var(--teal); }
.footer-nav-row {
  display: flex;
  gap: 4.5rem;
  padding-bottom: 0.6rem;
  border-bottom: 1px solid var(--border-light);
}
.footer-nav-row a {
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}
.footer-contacts-row {
  display: flex;
  gap: 0.75rem;
  font-style: normal;
}
.footer-contacts-row a {
  font-size: 0.68rem;
  font-weight: 500;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--text-secondary);
}
.footer-contacts-row a:hover { color: var(--teal); }
.site-footer .footer-bottom {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 0.4rem 0;
  border-top: 1px solid var(--border-light);
  text-align: center;
  width: 100%;
}
.site-footer .footer-copy {
  margin-top: 0;
  padding-top: 0;
  border-top: none;
}
.footer-bottom .footer-copy {
  font-size: 0.78rem;
  color: var(--text-secondary);
}

/* ═══════════════════════════════════════
   8b. FOOTER — compact variant (book, blog, article)
   ═══════════════════════════════════════ */
.footer {
  background: var(--bg-secondary);
  border-top: 1px solid var(--border-light);
  padding: 1.5rem 2rem;
  margin-top: auto;
}
.footer .footer-inner {
  max-width: 1200px; margin: 0 auto;
  display: flex; justify-content: space-between;
  align-items: center; flex-wrap: wrap; gap: 1rem;
}
.footer .footer-copy {
  font-size: 0.75rem; color: var(--text-secondary);
  width: 100%; text-align: center; margin-top: 0.75rem;
}

/* ═══════════════════════════════════════
   8c. FOOTER — shared parts
   ═══════════════════════════════════════ */
.footer-logo { display: flex; align-items: center; line-height: 1; }
.footer-logo img { height: 36px; width: auto; }
.footer-links { display: flex; gap: 2rem; list-style: none; }
.footer-links a {
  font-size: 0.82rem; color: var(--text-muted);
  text-decoration: none; transition: color 0.2s;
}
.footer-links a:hover { color: var(--teal); }

/* ═══════════════════════════════════════
   9. RESPONSIVE — shared nav/footer
   ═══════════════════════════════════════ */
@media (max-width: 768px) {
  .nav-burger { display: flex; }
  .nav-logo-icon { height: 38px; }
  .nav-logo-text { height: 17px; }
  .nav.scrolled .nav-logo-icon { height: 32px; }
  .nav.scrolled .nav-logo-text { height: 14px; }
  .footer-inner { justify-content: center; text-align: center; }
  .footer-links { justify-content: center; }
  .footer { padding: 1.25rem 1rem; }

  /* site-footer mobile */
  .site-footer { padding: 1.5rem 1.25rem 0; }
  .footer-top {
    grid-template-columns: 1fr;
    gap: 0.75rem;
    text-align: center;
  }
  .site-footer .footer-logo { justify-content: center; }
  .footer-tagline { text-align: center; }
  .footer-content { align-items: center; }
  .footer-nav-row {
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.5rem 0.75rem;
  }
  .footer-contacts-row {
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.35rem 0.6rem;
  }
  .footer-bottom { padding: 0.75rem 0 1rem; }
  .footer-bottom .footer-copy { font-size: 0.7rem; }
}

/* ═══════════════════════════════════════
   9a. PROMO CARDS
   SSG: section rendered from promotions table.
   Grid auto-adapts via :has() — no JS classes needed.
   0 active promos → section omitted from HTML entirely.
   ═══════════════════════════════════════ */
.promos {
  background: var(--bg-secondary);
  border-top: 1px solid var(--border-light);
  border-bottom: 1px solid var(--border-light);
}

.promos-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.25rem;
}

/* Auto-adapt: 2 cards → 2 columns, left-aligned */
.promos-grid:has(> :last-child:nth-child(2)) {
  grid-template-columns: repeat(2, 1fr);
  max-width: 760px;
}

/* Auto-adapt: 1 card → single column, left-aligned */
.promos-grid:has(> :last-child:nth-child(1)) {
  grid-template-columns: 1fr;
  max-width: 480px;
}

.promo-card {
  position: relative;
  border-radius: 16px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  padding: 1.75rem;
  display: flex;
  flex-direction: column;
  transition: all 0.3s ease;
  overflow: hidden;
}
.promo-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--teal), var(--teal-light));
  border-radius: 16px 16px 0 0;
}
.promo-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-md);
  border-color: rgba(43,181,184,0.25);
}

.promo-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.3rem 0.75rem;
  border-radius: 100px;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  width: fit-content;
  margin-bottom: 1rem;
}
.promo-badge.sale {
  background: rgba(239,68,68,0.08);
  color: #DC2626;
  border: 1px solid rgba(239,68,68,0.15);
}
.promo-badge.gift {
  background: rgba(43,181,184,0.08);
  color: var(--teal-dark);
  border: 1px solid rgba(43,181,184,0.15);
}
.promo-badge.new {
  background: rgba(168,85,247,0.08);
  color: #7C3AED;
  border: 1px solid rgba(168,85,247,0.15);
}

[data-theme="dark"] .promo-badge.sale {
  background: rgba(239,68,68,0.12);
  color: #F87171;
}
[data-theme="dark"] .promo-badge.gift {
  background: rgba(43,181,184,0.12);
  color: var(--teal-light);
}
[data-theme="dark"] .promo-badge.new {
  background: rgba(168,85,247,0.12);
  color: #A78BFA;
}

.promo-card h3 {
  font-family: var(--font-display);
  font-size: 1.35rem;
  font-weight: 500;
  line-height: 1.25;
  margin-bottom: 0.5rem;
  color: var(--text-primary);
}
.promo-card-desc {
  font-size: 0.88rem;
  color: var(--text-secondary);
  line-height: 1.6;
  margin-bottom: 0.75rem;
  flex: 1;
}

.promo-price {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
  margin-bottom: 1rem;
}
.promo-price-new {
  font-family: var(--font-display);
  font-size: 1.8rem;
  font-weight: 600;
  color: var(--teal);
}
.promo-price-old {
  font-size: 0.95rem;
  color: var(--text-muted);
  text-decoration: line-through;
}

.promo-deadline {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-bottom: 1.25rem;
}
.promo-deadline strong {
  color: var(--text-secondary);
}

.promo-cta {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.7rem 1.5rem;
  border-radius: 100px;
  background: var(--teal);
  color: #fff;
  font-family: var(--font-body);
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-decoration: none;
  transition: all 0.25s ease;
  width: fit-content;
  box-shadow: 0 2px 12px rgba(43,181,184,0.2);
}
.promo-cta:hover {
  background: var(--teal-dark);
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(43,181,184,0.3);
}

/* 9b. PROMO — mobile: horizontal swipe + text adaptation */
@media (max-width: 768px) {
  .promos { padding: 60px 0; }
  .promos .section-inner { padding: 0 1.25rem; }

  .promos-grid,
  .promos-grid:has(> :last-child:nth-child(2)),
  .promos-grid:has(> :last-child:nth-child(1)) {
    display: flex;
    max-width: none;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    gap: 0.75rem;
    padding-bottom: 0.25rem;
    scrollbar-width: none;
  }
  .promos-grid::-webkit-scrollbar { display: none; }
  .promo-card {
    min-width: 78vw;
    max-width: 300px;
    scroll-snap-align: center;
    flex-shrink: 0;
    padding: 1.25rem;
  }

  /* Text adaptation */
  .promo-badge { font-size: 0.62rem; margin-bottom: 0.75rem; padding: 0.25rem 0.6rem; }
  .promo-card h3 { font-size: 1.15rem; margin-bottom: 0.35rem; }
  .promo-card-desc { font-size: 0.8rem; line-height: 1.5; margin-bottom: 0.5rem; }
  .promo-price { margin-bottom: 0.75rem; }
  .promo-price-new { font-size: 1.5rem; }
  .promo-price-old { font-size: 0.85rem; }
  .promo-deadline { font-size: 0.7rem; margin-bottom: 0.85rem; }
  .promo-cta { font-size: 0.78rem; padding: 0.6rem 1.25rem; }

  /* Promo scroll dots */
  .promo-dots {
    display: flex;
    justify-content: center;
    gap: 6px;
    padding: 0.85rem 0 0;
  }
  .promo-dot {
    width: 6px; height: 6px;
    border-radius: 50%;
    background: var(--border);
    transition: all 0.25s ease;
    cursor: pointer;
  }
  .promo-dot.active {
    width: 18px;
    border-radius: 3px;
    background: var(--teal);
  }
}

/* Hide promo dots on desktop */
@media (min-width: 769px) {
  .promo-dots { display: none; }
}

@media (min-width: 769px) and (max-width: 1024px) {
  .promos-grid { grid-template-columns: repeat(2, 1fr); }
}

/* ═══════════════════════════════════════
   10. REDUCED MOTION
   ═══════════════════════════════════════ */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.15s !important;
  }
}
