/* base.css — V4: typography scale, header, buttons, footer. Warm light-first. */
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
/* Smooth in-page scrolling only for users who opt into motion (a11y). */
@media (prefers-reduced-motion: no-preference) {
  html { scroll-behavior: smooth; }
}
/* Keyboard focus ring, everywhere (a11y P0): primary outline, 2px offset. */
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}
.skip-link {
  position: fixed; left: 12px; top: 8px; z-index: 1000; padding: 8px 12px;
  background: var(--surface); color: var(--ink); border: 1px solid var(--brand);
  border-radius: 8px; transform: translateY(-150%);
}
.skip-link:focus { transform: translateY(0); }
body {
  font-family: var(--font-body);
  font-size: 17px;
  line-height: 1.55;
  font-weight: 400;
  margin: 0;
  color: var(--ink);
  background: var(--canvas);
  -webkit-font-smoothing: antialiased;
}
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
.price-aff-link, .gp-price-link, .asin-aff-link { color: inherit; text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 2px; }
.price-aff-link:hover, .gp-price-link:hover, .asin-aff-link:hover { color: var(--brand); }
.affiliate-note, .paid-inline {
  font-family: var(--font-mono); font-size: 12px; line-height: 1.25;
  font-weight: 500; color: var(--ink-soft);
}
.paid-inline { margin-left: 5px; white-space: nowrap; }
img { max-width: 100%; height: auto; display: block; }
.wrap { max-width: var(--wrap-max); margin: 0 auto; padding: 0 var(--wrap-pad); }
/* Long-form/legal text must not inherit the commerce width. */
body.reading main > .wrap { max-width: var(--reading-max); }

/* Cyrillic locales (ru): Instrument Sans ships no Cyrillic subset, so
   display headings would mix it with ad-hoc system fallbacks glyph by
   glyph. Inter -- already loaded from Google Fonts with its
   cyrillic/cyrillic-ext unicode-ranges -- takes over as the display face;
   same scale, one token swap. html:lang(ru) out-specifies tokens.css's
   :root default, and the custom property inherits to every heading. */
html:lang(ru) { --font-display: "Inter", ui-sans-serif, system-ui, sans-serif; }

/* Typography scale: hero 64, h2 34-40, h3 22-26, body 17, small 13-14.
   Weight levels 400/500/600/700 (the Google Fonts link loads exactly
   these -- heavier values would silently round to 700 anyway). */
h1, h2, h3 { font-family: var(--font-display); font-weight: 700; line-height: 1.04; margin: 0; }
h1 { font-size: 56px; letter-spacing: -0.045em; }
h2 { font-size: 38px; font-weight: 700; letter-spacing: -0.03em; margin: 0; }
h3 { font-size: 24px; font-weight: 600; letter-spacing: -0.015em; margin: 0 0 10px; }
p { margin: 0 0 16px; }
ul { margin: 0 0 16px 20px; padding: 0; }
li { margin: 6px 0; }
.eyebrow {
  font-size: 12.5px; font-weight: 600; letter-spacing: 0.1em;
  text-transform: uppercase; color: var(--brand); margin: 0 0 14px;
}
.meta-line, .byline { font-size: 13.5px; color: var(--muted); margin: 0; }
.byline strong { color: var(--ink); font-weight: 600; }
.dek { font-size: 19px; line-height: 1.55; color: var(--ink-soft); max-width: 580px; margin: 0; }

/* ---- Buttons: 46-50px premium, not pills ---- */
a.cta, button.cta {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  min-height: 48px; padding: 0 30px;
  background: var(--brand); color: var(--brand-ink);
  font-family: var(--font-body); font-size: 15.5px; font-weight: 600;
  border: 1px solid var(--brand); border-radius: 12px;
  cursor: pointer; text-decoration: none;
  transition: background var(--t-fast) ease-out, border-color var(--t-fast) ease-out, box-shadow var(--t-fast) ease-out;
}
a.cta:hover, button.cta:hover { background: var(--brand-deep); border-color: var(--brand-deep); text-decoration: none; box-shadow: 0 10px 28px rgba(11,107,73,.18); }
a.cta.cta-secondary { background: transparent; color: var(--secondary-cta-ink, var(--brand-deep)); border: 1px solid var(--hairline); box-shadow: none; }
a.cta.cta-secondary:hover { background: var(--surface); border-color: rgba(20,32,25,.22); box-shadow: none; }

/* ---- Header: one light row ---- */
header.site-header {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  box-shadow: 0 1px 0 var(--hairline);
}
.site-header .wrap { position: relative; display: flex; align-items: center; gap: 20px; height: 64px; }
.site-logo {
  font-family: var(--font-display); font-size: 21px; font-weight: 700;
  letter-spacing: -0.03em; color: var(--ink); white-space: nowrap;
}
.site-logo:hover { text-decoration: none; }
.logo-dot { color: var(--brand); }
.main-nav { display: flex; align-items: center; gap: 2px; flex: 1; }
.main-nav > a, .main-nav > details > summary {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 14px; font-size: 14.5px; font-weight: 500; color: var(--ink-soft);
  border-radius: 10px; cursor: pointer; list-style: none; white-space: nowrap;
  transition: background var(--t-fast) ease-out, color var(--t-fast) ease-out;
}
.main-nav > a:hover, .main-nav > details > summary:hover { background: var(--surface-soft); color: var(--ink); text-decoration: none; }
.main-nav > details[open] > summary { background: var(--surface-soft); color: var(--ink); }
.main-nav details { position: relative; }
.main-nav details.cat-mega { position: static; }
.nav-burger { display: contents; }
.nav-burger summary { display: none; }
.main-nav summary::-webkit-details-marker { display: none; }
.main-nav summary::after {
  content: ""; width: 7px; height: 7px; border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor; transform: rotate(45deg) translateY(-2px); opacity: 0.55;
}
.mega-panel {
  position: absolute; left: var(--wrap-pad); right: var(--wrap-pad); top: calc(100% + 10px);
  width: auto; background: var(--surface);
  border: 1px solid var(--hairline); border-radius: var(--r-card);
  box-shadow: var(--shadow-pop); padding: 26px;
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 22px 30px;
  max-height: min(620px, 80vh); overflow-x: hidden; overflow-y: auto;
}
.mega-heading {
  font-size: 11.5px; font-weight: 600; letter-spacing: 0.09em;
  text-transform: uppercase; color: var(--muted); margin: 0 0 10px;
}
.mega-col a {
  display: flex; justify-content: space-between; align-items: baseline; gap: 8px;
  padding: 6px 8px; margin: 0 -8px; font-size: 14.5px; color: var(--ink-soft);
  border-radius: var(--r-line); white-space: normal; min-width: 0;
}
.mega-col a:hover { background: var(--surface-soft); color: var(--ink); text-decoration: none; }
.mega-count { flex: none; font-family: var(--font-mono); font-size: 11.5px; color: var(--muted); }
.header-right { display: flex; align-items: center; gap: 12px; margin-left: auto; }
.hdr-search { position: relative; display: flex; align-items: center; }
.hdr-search input {
  width: 210px; padding: 8px 14px; font-size: 14px; font-family: var(--font-body);
  color: var(--ink); background: var(--surface-soft);
  border: 1px solid transparent; border-radius: 10px; outline: none;
  transition: border-color var(--t-fast) ease-out, background var(--t-fast) ease-out;
}
.hdr-search input:focus { border-color: var(--brand); background: var(--surface); }
.search-results {
  position: absolute; top: calc(100% + 6px); right: 0; width: min(400px, 88vw);
  background: var(--surface); border: 1px solid var(--hairline);
  border-radius: var(--r-card); box-shadow: var(--shadow-pop); overflow: hidden; z-index: 70;
}
.search-results a { display: block; padding: 10px 14px; color: var(--ink); border-bottom: 1px solid var(--hairline); }
.search-results a:last-child { border-bottom: none; }
.search-results a:hover { background: var(--surface-soft); text-decoration: none; }
.search-results .sr-title { display: block; font-weight: 600; font-size: 14px; }
.search-results .sr-meta { display: block; font-size: 12px; color: var(--muted); margin-top: 2px; }
.search-results .sr-none { display: block; padding: 10px 14px; font-size: 13px; color: var(--muted); }
.lang-switch { font-size: 13.5px; color: var(--muted); white-space: nowrap; }
.lang-switch a { color: var(--muted); }
.lang-switch strong { color: var(--ink); font-weight: 600; }
.footer-lang-switch { margin: 0 0 8px; }
.theme-toggle {
  display: inline-flex; align-items: center; justify-content: center;
  width: 36px; height: 36px; background: var(--surface-soft); color: var(--ink-soft);
  border: none; border-radius: 50%; cursor: pointer;
}
.theme-toggle:hover { color: var(--ink); }
.theme-toggle .icon-moon { display: none; }
:root[data-theme="dark"] .theme-toggle .icon-sun { display: none; }
:root[data-theme="dark"] .theme-toggle .icon-moon { display: block; }
.icon-sun, .icon-moon { fill: none; stroke: currentColor; stroke-width: 1.8; }
.disclosure-strip {
  font-family: var(--font-mono); font-variant-numeric: tabular-nums;
  font-size: 12px; line-height: 1.35; letter-spacing: 0; color: var(--ink-soft);
  padding: 4px 0 2px; margin-bottom: 6px;
}

/* ---- Breadcrumb (all inner pages) ---- */
.breadcrumb { font-size: 13px; color: var(--muted); margin: 4px 0 22px; }
.breadcrumb a { color: var(--muted); }
.breadcrumb a:hover { color: var(--brand); }

/* ---- Footer: near-black, minimal ---- */
footer.site-footer {
  margin-top: 0; background: #0A0E0B; color: var(--dark-ink); font-size: 14px;
}
footer.site-footer .wrap { display: grid; grid-template-columns: 1.6fr 1fr; gap: 40px; padding: 48px var(--wrap-pad) 36px; }
.footer-brand { font-family: var(--font-display); font-size: 20px; font-weight: 700; letter-spacing: -0.03em; margin: 0 0 10px; color: #fff; }
.footer-col p { color: var(--dark-muted); margin: 0 0 8px; }
.footer-links { display: flex; flex-direction: column; gap: 8px; margin: 0; }
.footer-links a { color: var(--dark-ink); }
.footer-links a:hover { color: #fff; text-decoration: underline; }
.footer-copyright { color: var(--dark-muted); margin: 0; }
.footer-copyright a { color: inherit; }
.footer-copyright a:hover { color: #fff; }
/* Legal/disclosure rows: no extra top padding (they follow .footer-col). */
footer.site-footer .wrap.footer-legal { padding-top: 0; display: block; }
.footer-disclosure {
  font-family: var(--font-mono); font-size: 11.5px; letter-spacing: 0.01em;
  color: var(--dark-muted); border-top: 1px solid rgba(232, 236, 231, 0.12);
  padding-top: 14px; margin: 0 0 8px;
}
.footer-copyright { color: var(--dark-muted); margin: 0; }

/* ---- Reading defaults ---- */
main details {
  margin: 12px 0; border: 1px solid var(--hairline);
  border-radius: var(--r-line); padding: 10px 16px; background: var(--surface);
}
main details summary { cursor: pointer; font-weight: 600; }
main details[open] summary { margin-bottom: 8px; }

/* ---- Mobile nav (hamburger via <details>) ---- */
@media (max-width: 768px) {
  :root { --wrap-pad: 16px; }
  body { font-size: 16px; }
  h1 { font-size: clamp(34px, 9vw, 38px); overflow-wrap: anywhere; }
  h2 { font-size: 27px; overflow-wrap: anywhere; }
  .site-header .wrap { height: 56px; gap: 8px; min-width: 0; }
  .site-logo { font-size: 18px; flex: none; }
  .header-right { gap: 6px; min-width: 0; flex: 1 1 auto; }
  .main-nav {
    display: none; position: absolute; left: 0; right: 0; top: 100%; z-index: 60;
    flex-direction: column; align-items: stretch;
    background: var(--surface); border-bottom: 1px solid var(--hairline);
    box-shadow: var(--shadow-pop); padding: 14px; gap: 2px;
  }
  .main-nav > a, .main-nav > details > summary { padding: 12px 14px; font-size: 16px; border-radius: 10px; }
  .mega-panel { position: static; width: auto; grid-template-columns: 1fr; box-shadow: none; border: none; padding: 0 0 0 16px; max-height: none; overflow: visible; }
  .nav-burger { display: block; position: static; }
  .nav-burger summary {
    display: flex; align-items: center; justify-content: center;
    width: 40px; height: 40px; border-radius: 10px;
    background: var(--surface-soft); cursor: pointer; list-style: none;
  }
  .nav-burger summary::-webkit-details-marker { display: none; }
  .nav-burger summary svg { width: 18px; height: 18px; stroke: var(--ink); stroke-width: 2; fill: none; }
  .nav-burger[open] .main-nav { display: flex; }
  .hdr-search { flex: 1 1 auto; min-width: 0; }
  .hdr-search input { width: 100%; min-width: 0; padding-left: 10px; padding-right: 10px; }
  .lang-drop { flex: none; }
  .lang-drop-label { display: none; }
  .lang-drop summary { padding: 7px 8px; gap: 4px; }
  .theme-toggle { width: 34px; height: 34px; flex: none; }
  footer.site-footer .wrap { grid-template-columns: 1fr; gap: 24px; padding: 40px var(--wrap-pad) 32px; }
  .disclosure-strip { margin-bottom: 16px; }
  .compare-bar { display: block; position: fixed; left: 0; right: 0; bottom: 0; z-index: 40; background: var(--surface); border-top: 1px solid var(--hairline); padding: 10px 16px; }
  body.article, body.hub { padding-bottom: 84px; }
}
@media (max-width: 520px) {
  .hdr-search { display: none; }
  .site-header .wrap { gap: 7px; }
  .header-right { flex: 0 0 auto; margin-left: auto; }
}
@media (min-width: 769px) and (max-width: 1024px) {
  :root { --wrap-pad: 24px; }
  h1 { font-size: 44px; }
  .hdr-search input { width: 150px; }
  .mega-panel { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
.compare-bar { display: none; }
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}

/* 404 page (PHASE G): quiet full-screen miss, no heavy decoration. */
.nf { padding: 96px 0 140px; }
.nf-code {
  font-family: var(--font-mono); font-size: 15px; letter-spacing: 0.12em;
  color: var(--muted); margin: 0 0 14px;
}
.nf h1 { font-size: clamp(44px, 7vw, 84px); margin: 0 0 18px; }
.nf-dek { font-size: 18px; color: var(--muted); max-width: 560px; margin: 0 0 30px; }
.nf-links { display: flex; gap: 14px; flex-wrap: wrap; }
