/* =========================================================================
   AdoptMeScripts — main.css
   База, типографика, шапка/подвал, ToC, hero, 404.
   Концепция: «тёплый ночной питомник» — мягкие округлые формы,
   пастельно-голубой акцент, персиковый для валюты/наград.
   ========================================================================= */

/* ---- Шрифты (самохостинг, latin + cyrillic) ---- */
@font-face {
  font-family: 'Rubik';
  src: url('../fonts/Rubik-Bold-cyrillic.woff2') format('woff2');
  font-weight: 700; font-style: normal; font-display: swap;
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: 'Rubik';
  src: url('../fonts/Rubik-Bold-latin.woff2') format('woff2');
  font-weight: 700; font-style: normal; font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Nunito';
  src: url('../fonts/Nunito-Regular-cyrillic.woff2') format('woff2');
  font-weight: 400; font-style: normal; font-display: swap;
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: 'Nunito';
  src: url('../fonts/Nunito-Regular-latin.woff2') format('woff2');
  font-weight: 400; font-style: normal; font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Overpass Mono';
  src: url('../fonts/OverpassMono-Medium-cyrillic.woff2') format('woff2');
  font-weight: 500; font-style: normal; font-display: swap;
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: 'Overpass Mono';
  src: url('../fonts/OverpassMono-Medium-latin.woff2') format('woff2');
  font-weight: 500; font-style: normal; font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* ---- Токены ---- */
:root {
  --bg-base:      #0E1116;
  --bg-card:      #171B22;
  --bg-code:      #0A0C10;
  --accent:       #7DA6F2;
  --accent-dim:   #2C3E66;
  --accent-peach: #FFB088;
  --text-primary: #F5F7FB;
  --text-soft:    #C4CCDA;   /* комфортный для чтения длинного текста */
  --text-muted:   #7A8296;
  --border:       #232838;

  /* производные */
  --accent-soft:  rgba(125, 166, 242, 0.12);
  --accent-line:  rgba(125, 166, 242, 0.35);
  --peach-soft:   rgba(255, 176, 136, 0.12);
  --card-hover:   #1B2029;

  --font-display: 'Rubik', 'Trebuchet MS', system-ui, sans-serif;
  --font-body:    'Nunito', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-mono:    'Overpass Mono', ui-monospace, 'Cascadia Code', monospace;

  --radius:       16px;   /* самый мягкий радиус в сети */
  --radius-sm:    12px;
  --radius-pill:  999px;

  --container:    1080px;
  --gap:          clamp(16px, 3vw, 28px);

  --shadow-card:  0 2px 10px rgba(0, 0, 0, 0.28);
  --shadow-pop:   0 12px 40px rgba(0, 0, 0, 0.45);
  --shadow-accent: 0 8px 30px rgba(125, 166, 242, 0.18);

  --ease:         0.2s ease;
}

/* ---- Reset / база ---- */
*, *::before, *::after { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
  scroll-padding-top: 84px; /* чтобы якоря ToC не прятались под шапку */
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font-body);
  font-size: 17px;
  line-height: 1.75;
  color: var(--text-primary);
  background-color: var(--bg-base);
  background-image:
    radial-gradient(120% 80% at 85% -10%, rgba(125, 166, 242, 0.10), transparent 60%),
    radial-gradient(90% 70% at 5% 0%, rgba(255, 176, 136, 0.06), transparent 55%);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

img { max-width: 100%; height: auto; }

a {
  color: var(--accent);
  text-decoration: none;
  transition: color var(--ease);
}
a:hover { color: var(--text-primary); }

/* ---- Типографика ---- */
h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 700;
  line-height: 1.25;
  color: var(--text-primary);
  margin: 0 0 0.6em;
  letter-spacing: -0.01em;
}
h1 { font-size: clamp(1.9rem, 5vw, 3rem); }
h2 { font-size: clamp(1.5rem, 3.5vw, 2.1rem); margin-top: 1.4em; }
h3 { font-size: clamp(1.15rem, 2vw, 1.4rem); }
h4 { font-size: 1.05rem; }

p { margin: 0 0 1.1em; }

ul, ol { margin: 0 0 1.1em; padding-left: 1.4em; }
li { margin-bottom: 0.4em; }

strong { font-weight: 700; color: var(--text-primary); }

code, kbd, .mono {
  font-family: var(--font-mono);
  font-size: 0.92em;
}
:not(pre) > code {
  background: var(--bg-code);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 2px 7px;
  color: var(--accent);
}
.mono { color: var(--accent-peach); }

/* ---- Layout ---- */
.container {
  width: 100%;
  max-width: var(--container);
  margin-inline: auto;
  padding-inline: clamp(16px, 4vw, 32px);
}

.site-main {
  padding-block: clamp(28px, 6vw, 56px) clamp(48px, 8vw, 90px);
}

section { scroll-margin-top: 84px; }
.section { margin-top: clamp(40px, 7vw, 72px); }

.section__head { margin-bottom: clamp(16px, 3vw, 28px); }
.section__lead {
  color: var(--text-muted);
  max-width: 62ch;
  margin-top: -0.4em;
}

/* Читаемый текстовый блок (гайды) */
.prose { max-width: 74ch; }
.prose h2 { margin-top: 1.6em; }
.prose a { border-bottom: 1px dotted var(--accent-line); }
.prose a:hover { border-bottom-color: var(--accent); }

.eyebrow {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 2px;
  color: var(--accent);
  font-weight: 700;
  margin: 0 0 12px;
}

/* ---- Кнопки ---- */
.btn-primary,
.btn-download,
.btn-ghost {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 1rem;
  line-height: 1;
  padding: 14px 26px;
  border-radius: var(--radius);
  border: 1px solid transparent;
  cursor: pointer;
  transition: transform var(--ease), background var(--ease), border-color var(--ease), box-shadow var(--ease);
  text-align: center;
}
.btn-primary {
  background: var(--accent);
  color: #0E1116;
  box-shadow: var(--shadow-accent);
}
.btn-primary:hover {
  color: #0E1116;
  transform: translateY(-2px);
  box-shadow: 0 12px 34px rgba(125, 166, 242, 0.30);
}
.btn-ghost {
  background: transparent;
  color: var(--text-primary);
  border-color: var(--border);
}
.btn-ghost:hover { border-color: var(--accent); color: var(--text-primary); }

/* ---- Skip link / a11y ---- */
.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--accent);
  color: #0E1116;
  padding: 10px 16px;
  border-radius: 0 0 var(--radius-sm) 0;
  font-weight: 700;
  z-index: 200;
}
.skip-link:focus { left: 0; color: #0E1116; }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 4px;
}

/* =========================================================================
   Шапка / навигация
   ========================================================================= */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(14, 17, 22, 0.82);
  backdrop-filter: saturate(140%) blur(12px);
  -webkit-backdrop-filter: saturate(140%) blur(12px);
  border-bottom: 1px solid var(--border);
}
.nav {
  max-width: var(--container);
  margin-inline: auto;
  padding: 12px clamp(16px, 4vw, 32px);
  display: flex;
  align-items: center;
  gap: 20px;
}
.nav-logo {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.15rem;
  color: var(--text-primary);
  margin-right: auto;
}
.nav-logo__paw { font-size: 1.25rem; }
.nav-logo:hover { color: var(--accent); }

.nav-links {
  display: flex;
  align-items: center;
  gap: 4px;
  list-style: none;
  margin: 0;
  padding: 0;
}
.nav-links a {
  display: inline-block;
  padding: 8px 14px;
  border-radius: var(--radius-pill);
  color: var(--text-muted);
  font-weight: 700;
  font-size: 0.95rem;
  transition: color var(--ease), background var(--ease);
}
.nav-links a:hover { color: var(--text-primary); background: var(--accent-soft); }

.nav-burger {
  display: none;
  flex-direction: column;
  gap: 5px;
  width: 44px;
  height: 40px;
  padding: 10px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
}
.nav-burger span {
  display: block;
  height: 2px;
  width: 100%;
  background: var(--text-primary);
  border-radius: 2px;
  transition: transform var(--ease), opacity var(--ease);
}

/* Минимальная шапка на gate-страницах */
.site-header--minimal .nav { justify-content: center; }
.site-header--minimal .nav-logo { margin-right: 0; }

/* =========================================================================
   Table of Contents
   ========================================================================= */
.toc {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 22px;
  margin: 28px 0;
  background: var(--bg-card);
  box-shadow: var(--shadow-card);
}
.toc__title {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--text-muted);
  margin: 0 0 10px;
  font-weight: 700;
}
.toc__list {
  list-style: decimal;
  padding-left: 22px;
  margin: 0;
  columns: 2;
  column-gap: 32px;
}
.toc__item { margin-bottom: 6px; break-inside: avoid; }
.toc__link {
  color: var(--text-primary);
  border-bottom: 1px dotted var(--border);
}
.toc__link:hover { color: var(--accent); border-bottom-color: var(--accent); }

/* =========================================================================
   Hero (главная)
   ========================================================================= */
.hero {
  padding: clamp(36px, 7vw, 72px) 0 clamp(8px, 2vw, 16px);
  text-align: left;
}
.hero__title { margin-bottom: 0.35em; }
.hero__title .accent { color: var(--accent); }
.hero__subtitle {
  font-size: clamp(1.05rem, 2vw, 1.28rem);
  color: var(--text-muted);
  max-width: 58ch;
  margin-bottom: 1.4em;
}
.hero__facts {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 12px;
  list-style: none;
  padding: 0;
  margin: 0;
}
.hero__fact {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 16px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  font-weight: 700;
  font-size: 0.95rem;
}
.hero__fact::before { content: '✓'; color: var(--accent-peach); font-weight: 700; }

/* =========================================================================
   Подвал
   ========================================================================= */
.site-footer {
  border-top: 1px solid var(--border);
  background: var(--bg-card);
  margin-top: clamp(48px, 9vw, 96px);
  padding: clamp(32px, 5vw, 52px) 0 40px;
}
.footer-grid {
  max-width: var(--container);
  margin-inline: auto;
  padding-inline: clamp(16px, 4vw, 32px);
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr)) 2fr;
  gap: clamp(20px, 4vw, 44px);
}
.footer-heading {
  font-family: var(--font-display);
  font-weight: 700;
  color: var(--text-primary);
  margin: 0 0 12px;
  font-size: 1rem;
}
.footer-col a {
  display: block;
  color: var(--text-muted);
  padding: 4px 0;
  font-weight: 700;
}
.footer-col a:hover { color: var(--accent); }
.footer-disclaimer { color: var(--text-muted); font-size: 0.9rem; line-height: 1.65; }
.footer-legal { display: flex; flex-wrap: wrap; gap: 6px 18px; margin: 10px 0 0; }
.footer-legal a { color: var(--text-muted); font-weight: 700; }
.footer-legal a:hover { color: var(--accent); }
.footer-brand { font-family: var(--font-display); color: var(--text-primary); margin: 0 0 8px; }
.footer-copy { margin-top: 12px; opacity: 0.7; }

/* =========================================================================
   404
   ========================================================================= */
.error-404 { text-align: center; padding: clamp(40px, 10vw, 100px) 0; }
.error-404__paw { font-size: 3rem; margin: 0 0 8px; }
.error-404__code {
  font-size: clamp(4rem, 14vw, 7rem);
  margin: 0;
  color: var(--accent);
  line-height: 1;
}
.error-404__text { color: var(--text-muted); max-width: 46ch; margin: 16px auto 28px; }
.error-404__actions { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }

/* =========================================================================
   Адаптив
   ========================================================================= */
@media (max-width: 720px) {
  body { font-size: 16px; }

  .nav-burger { display: flex; }

  .nav-links {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    flex-direction: column;
    align-items: stretch;
    gap: 2px;
    padding: 12px clamp(16px, 4vw, 32px) 18px;
    background: rgba(14, 17, 22, 0.98);
    border-bottom: 1px solid var(--border);
    box-shadow: var(--shadow-pop);
    transform: translateY(-8px);
    opacity: 0;
    pointer-events: none;
    transition: transform var(--ease), opacity var(--ease);
  }
  .is-nav-open .nav-links { transform: translateY(0); opacity: 1; pointer-events: auto; }
  .nav-links a { padding: 12px 14px; }

  .is-nav-open .nav-burger span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
  .is-nav-open .nav-burger span:nth-child(2) { opacity: 0; }
  .is-nav-open .nav-burger span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

  .toc__list { columns: 1; }

  .footer-grid { grid-template-columns: 1fr 1fr; }
  .footer-disclaimer { grid-column: 1 / -1; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; }
}
