/* ============================================
   Своя школа · main.css  (v10 — clean refactor)
   Базовые стили, переменные, типографика, сетка
   ============================================ */

:root {
  /* Палитра */
  --bg:        #5547B3;
  --bg-dark:   #231B5C;
  --bg-light:  #FFF7E0;
  --bg-section:#FFFBE8;
  --accent:    #F5C518;
  --accent-dk: #D4A017;
  --accent-sf: #EEDC82;
  --text:      #231B5C;
  --text-m:    #52527A;
  --text-w:    #FFFFFF;
  --success:   #43D97C;
  --danger:    #E94B4B;
  --border:    #E8E2C8;
  --shadow:    0 8px 24px rgba(var(--brand-dark-rgb),.08);
  --shadow-lg: 0 16px 48px rgba(var(--brand-dark-rgb),.16);
  --radius:    18px;
  --radius-sm: 10px;
  --radius-lg: 28px;
  --max-w:     1200px;
  --gap:       24px;

  /* Палитра Aschool (см. docs/DESIGN_SYSTEM.md §3) — добавлена параллельно
     старой палитре выше, компоненты пока на неё не переключены (ROADMAP этап 5+) */
  --brand-red:    #EC3B4F;
  --brand-orange: #FF790E;
  --brand-blue:   #006CB5;
  --brand-cyan:   #00A0E3;
  --brand-white:  #FEFEFE;
  --brand-dark:   #2B2A29;

  /* RGB-компаньоны для rgba() без повторной правки этого файла на этапе 7/13 */
  --brand-red-rgb:    236, 59, 79;
  --brand-orange-rgb: 255, 121, 14;
  --brand-blue-rgb:   0, 108, 181;
  --brand-cyan-rgb:   0, 160, 227;
  --brand-dark-rgb:   43, 42, 41;
}

/* ── Reset ─────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: 'Tilda Sans', 'Inter', 'Helvetica Neue', Arial, sans-serif;
  font-size: 17px;
  line-height: 1.55;
  color: var(--text);
  background: #fff;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

/* ── index.html — единая фоновая канва (Aschool light-glow) ──────────
   Scoped to body.page-canvas only, index.html exclusively. Header→Hero→
   Sprint2→Видео→Тарифы→Оплата→Отзывы all sit transparent above this one
   fixed layer instead of each painting its own background — Hero is no
   longer a separate "picture", it's the same canvas as everything else.
   .lk-promo/.dark-section/.site-footer were originally out of scope for
   this canvas (still old-purple) — extended to them in a follow-up pass,
   see docs/DECISIONS.md. */
body.page-canvas {
  background:
    radial-gradient(1020px 780px at 6% -8%, rgba(var(--brand-blue-rgb), .20), transparent 62%),
    radial-gradient(1100px 830px at 96% 6%, rgba(var(--brand-red-rgb), .18) 0%, rgba(var(--brand-red-rgb), .18) 22%, transparent 70%),
    radial-gradient(900px 700px at 50% 88%, rgba(var(--brand-orange-rgb), .15) 0%, rgba(var(--brand-orange-rgb), .15) 16%, transparent 68%),
    radial-gradient(1100px 900px at 50% 42%, rgba(var(--brand-blue-rgb), .06), transparent 65%),
    var(--brand-white);
  background-repeat: no-repeat;
  background-attachment: fixed;
}
/* Fallback for mobile/touch — background-attachment:fixed has historical
   quirks on older iOS Safari; below 768px the canvas scrolls with content
   instead (still identical gradient recipe, just not viewport-pinned). */
@media (max-width: 768px) {
  body.page-canvas { background-attachment: scroll; }
}

/* Eyebrow badges still on old cream (var(--bg-light) #FFF7E0) in sections
   without their own scoped eyebrow rule (.hero/.section-why already have
   one). Deliberately NOT a blanket "body.page-canvas .eyebrow": that selector
   (0,2,1 specificity) would outrank .section-why .eyebrow (0,2,0) and
   .hero:not(.hero-sub) .eyebrow, silently reflowing already-approved
   Sprint 2/Hero badges. Targeted per-section instead — zero collision risk,
   same visual result (docs/DECISIONS.md). */
body.page-canvas #video .eyebrow,
body.page-canvas #tarify .eyebrow,
body.page-canvas #payment .eyebrow,
body.page-canvas #reviews .eyebrow {
  background: transparent;
  border: 1px solid rgba(var(--brand-dark-rgb), .12);
  color: var(--brand-dark);
}

img, svg { max-width: 100%; display: block; }
a { color: var(--bg); text-decoration: none; transition: opacity .2s; }
a:hover { opacity: .75; }
button { font-family: inherit; cursor: pointer; border: none; background: none; }

/* ── Typography ─────────────────────────────── */
h1, h2, h3, h4 {
  font-family: 'Tilda Sans', 'Inter', Arial, sans-serif;
  font-weight: 800;
  line-height: 1.15;
  color: var(--text);
  margin: 0 0 16px;
}
h1 { font-size: clamp(26px, 5vw, 52px); letter-spacing: -.02em; }
h2 { font-size: clamp(22px, 3.6vw, 40px); letter-spacing: -.01em; }
h3 { font-size: clamp(17px, 2.4vw, 24px); }
h4 { font-size: 18px; }
p  { margin: 0 0 14px; }
p:last-child { margin-bottom: 0; }
.lead {
  font-size: clamp(16px, 1.6vw, 20px);
  color: var(--text-m);
  max-width: 780px;
}

/* ── Container ──────────────────────────────── */
.container {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 24px;
}
.container.narrow, .narrow { max-width: 840px; }

/* ── Sections ───────────────────────────────── */
section, .section { padding: 72px 0; }
section.tight, .section.tight { padding: 48px 0; }
.section-light   { background: transparent; }
.section-cta     { background: transparent; }
.cream-section   { background: transparent; } /* index.html only — was var(--bg-light) old cream, now shows body.page-canvas canvas (see docs/DECISIONS.md) */
/* index.html only (class exclusive to this page) — was solid old-purple
   var(--bg), now transparent to show the body.page-canvas canvas underneath,
   see docs/DECISIONS.md */
.dark-section    { background: transparent; color: var(--brand-dark); }
.dark-section h1,
.dark-section h2,
.dark-section h3,
.dark-section h4 { color: var(--brand-dark); }
.dark-section .lead  { color: rgba(var(--brand-dark-rgb), .72); }
.dark-section .muted { color: rgba(var(--brand-dark-rgb), .62); }

@media (max-width: 768px) {
  section, .section { padding: 48px 0; }
}

/* ── Section headings ───────────────────────── */
.section-title {
  text-align: center;
  margin-bottom: 14px;
  color: var(--brand-dark);
}
.section-sub {
  text-align: center;
  color: #666;
  max-width: 680px;
  margin: 0 auto 36px;
  font-size: 16px;
  line-height: 1.6;
}

/* ── Grid ───────────────────────────────────── */
/* minmax(0, 1fr) rather than bare 1fr: a bare 1fr column is really
   minmax(auto, 1fr), so a child with intrinsic min-content wider than its
   equal share (e.g. a .btn with white-space:nowrap and long label) forces
   the whole grid wider than its container ("grid blowout" -> horizontal
   page overflow). minmax(0, 1fr) keeps the same equal-share sizing whenever
   content fits, and only lets a track shrink below its content's natural
   width instead of blowing out the container when it doesn't. Found via
   scripts/qa/overflow.js: index.html @1024px, .grid-3 tariff cards. */
.grid { display: grid; gap: var(--gap); }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }

@media (max-width: 900px) {
  .grid-3, .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 600px) {
  .grid-2, .grid-3, .grid-4 { grid-template-columns: minmax(0, 1fr); }
}

/* ── Utilities ──────────────────────────────── */
.text-center { text-align: center; }
.muted { color: var(--text-m); }

.eyebrow {
  display: inline-block;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--accent-dk);
  background: var(--bg-light);
  padding: 6px 14px;
  border-radius: 999px;
  margin-bottom: 14px;
}
.badge {
  display: inline-block;
  background: var(--success);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 999px;
  letter-spacing: .04em;
}
.badge-yellow { background: var(--accent); color: var(--bg-dark); }
.badge-purple { background: var(--bg); color: #fff; }
.tag {
  display: inline-block;
  padding: 5px 14px;
  border-radius: 20px;
  background: rgba(var(--brand-red-rgb), .1);
  color: var(--brand-red);
  font-size: 12px;
  font-weight: 600;
  margin-bottom: 18px;
  text-transform: uppercase;
  letter-spacing: .5px;
}
