/* =========================================================================
   Fish It Scripts — main.css
   Токены, шрифты, каркас, шапка, подвал, ToC, hero, секции.
   Концепция: глубокая вода тёмной ночью, биолюминесцентное свечение.
   ========================================================================= */

/* ---- Шрифты (самохостинг, подмножества latin + cyrillic) --------------- */
@font-face {
  font-family: 'Manrope';
  src: url('../fonts/Manrope-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: 'Manrope';
  src: url('../fonts/Manrope-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: 'Mulish';
  src: url('../fonts/Mulish-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: 'Mulish';
  src: url('../fonts/Mulish-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: 'Chivo Mono';
  src: url('../fonts/ChivoMono-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:       #0A1210;   /* глубокая вода ночью, зеленовато-чёрный */
  --bg-card:       #131F1B;   /* тёмно-зелёные карточки */
  --bg-code:       #070C0A;   /* блок кода/файла */
  --accent:        #10B981;   /* изумруд — биолюминесценция */
  --accent-dim:    #065F46;   /* тёмный изумруд для бейджей */
  --accent-sand:   #E8B980;   /* песочный — улов/монеты, цвет причала */
  --text-primary:  #F0FAF6;   /* тёплый почти белый с зелёным оттенком */
  --text-muted:    #6B8079;   /* серо-зелёный */
  --border:        #1C2C26;   /* тёмно-зелёная граница */

  --accent-glow:   rgba(16, 185, 129, 0.35);
  --sand-glow:     rgba(232, 185, 128, 0.14);

  --font-display: 'Manrope', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-body:    'Mulish', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-mono:    'Chivo Mono', ui-monospace, 'Cascadia Code', Consolas, monospace;

  --radius-card: 5px;
  --radius-badge: 3px;
  --radius-pill: 999px;

  --wrap: 1120px;
  --wrap-narrow: 760px;

  --space-section: clamp(48px, 8vw, 88px);

  --shadow-card: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow-lift: 0 10px 30px -12px rgba(0, 0, 0, 0.6);

  --ease: 0.2s ease;
}

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

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

body {
  margin: 0;
  background-color: var(--bg-base);
  background-image:
    radial-gradient(1100px 620px at 78% -8%, rgba(16, 185, 129, 0.10), transparent 60%),
    radial-gradient(760px 520px at -6% 4%, rgba(6, 95, 70, 0.14), transparent 55%);
  background-attachment: fixed;
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 17px;
  line-height: 1.75;
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  min-height: 100vh;
}

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

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

::selection { background: var(--accent-dim); color: var(--text-primary); }

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

/* ---- Типографика ------------------------------------------------------- */
h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 700;
  line-height: 1.14;
  letter-spacing: -0.01em;
  color: var(--text-primary);
  margin: 0 0 0.5em;
  text-wrap: balance;
}
h1 { font-size: clamp(28px, 5.2vw, 46px); }
h2 { font-size: clamp(23px, 3.6vw, 32px); }
h3 { font-size: clamp(18px, 2.4vw, 22px); }

p { margin: 0 0 1.1em; }
strong { color: var(--text-primary); font-weight: 700; }

.mono { font-family: var(--font-mono); font-weight: 500; }

.text-sand { color: var(--accent-sand); }
.text-muted { color: var(--text-muted); }

/* ---- Скрытые/утилиты --------------------------------------------------- */
.visually-hidden {
  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: absolute;
  left: 12px; top: -60px;
  z-index: 200;
  background: var(--accent);
  color: var(--bg-base);
  font-weight: 700;
  padding: 8px 14px;
  border-radius: var(--radius-badge);
  transition: top var(--ease);
}
.skip-link:focus { top: 12px; color: var(--bg-base); }

/* ---- Каркас ------------------------------------------------------------ */
.container {
  width: 100%;
  max-width: var(--wrap);
  margin-inline: auto;
  padding-inline: clamp(16px, 4vw, 32px);
}
.page-narrow { max-width: var(--wrap-narrow); }

main {
  display: block;
  padding-block: clamp(28px, 5vw, 48px) var(--space-section);
}

.section { margin-top: var(--space-section); scroll-margin-top: 84px; }
.section > .section__intro { color: var(--text-muted); max-width: 62ch; }

.section__eyebrow {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 10px;
}

.page-title { margin-bottom: 0.4em; }

.lead {
  font-size: clamp(17px, 2.2vw, 20px);
  color: var(--text-muted);
  max-width: 66ch;
}

/* Общая проза страниц-гайдов */
.prose h2 { margin-top: 1.8em; scroll-margin-top: 84px; }
.prose h3 { margin-top: 1.4em; color: var(--accent-sand); }
.prose ul, .prose ol { padding-left: 22px; margin: 0 0 1.2em; }
.prose li { margin-bottom: 0.4em; }
.prose li::marker { color: var(--accent); }
.prose a { border-bottom: 1px solid var(--accent-dim); }
.prose a:hover { border-bottom-color: var(--accent); }

hr.rule {
  border: 0;
  height: 1px;
  background: var(--border);
  margin: var(--space-section) 0;
}

/* ---- Шапка / навигация ------------------------------------------------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(10, 18, 16, 0.82);
  backdrop-filter: saturate(140%) blur(10px);
  -webkit-backdrop-filter: saturate(140%) blur(10px);
  border-bottom: 1px solid var(--border);
}
.nav {
  max-width: var(--wrap);
  margin-inline: auto;
  padding: 14px clamp(16px, 4vw, 32px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.nav-logo {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 19px;
  color: var(--text-primary);
  letter-spacing: -0.02em;
}
.nav-logo:hover { color: var(--text-primary); }
.nav-logo__mark {
  font-size: 20px;
  filter: drop-shadow(0 0 8px var(--accent-glow));
}
.nav-logo__text { line-height: 1; }

.nav-links {
  display: flex;
  align-items: center;
  gap: 6px;
  list-style: none;
  margin: 0;
  padding: 0;
}
.nav-links a {
  display: inline-block;
  padding: 8px 12px;
  border-radius: var(--radius-badge);
  color: var(--text-muted);
  font-weight: 700;
  font-size: 15px;
  transition: color var(--ease), background var(--ease);
}
.nav-links a:hover { color: var(--text-primary); background: var(--bg-card); }

.nav-burger {
  display: none;
  width: 42px; height: 38px;
  border: 1px solid var(--border);
  border-radius: var(--radius-badge);
  background: var(--bg-card);
  cursor: pointer;
  position: relative;
}
.nav-burger__bar,
.nav-burger__bar::before,
.nav-burger__bar::after {
  content: '';
  position: absolute;
  left: 50%;
  width: 18px; height: 2px;
  background: var(--text-primary);
  transform: translateX(-50%);
  transition: transform var(--ease), opacity var(--ease);
}
.nav-burger__bar { top: 50%; transform: translate(-50%, -50%); }
.nav-burger__bar::before { top: -6px; }
.nav-burger__bar::after  { top: 6px; }
.nav-burger[aria-expanded="true"] .nav-burger__bar { background: transparent; }
.nav-burger[aria-expanded="true"] .nav-burger__bar::before { top: 0; transform: translateX(-50%) rotate(45deg); }
.nav-burger[aria-expanded="true"] .nav-burger__bar::after  { top: 0; transform: translateX(-50%) rotate(-45deg); }

.site-header--minimal .nav { justify-content: center; }
.site-header--minimal .nav-logo { pointer-events: none; }

/* ---- Hero -------------------------------------------------------------- */
.hero {
  position: relative;
  padding-block: clamp(40px, 7vw, 80px) 8px;
  overflow: hidden;
}
.hero::after {
  content: '';
  position: absolute;
  left: 50%; bottom: -40%;
  width: min(680px, 92%); height: 340px;
  transform: translateX(-50%);
  background: radial-gradient(closest-side, var(--accent-glow), transparent 72%);
  filter: blur(18px);
  opacity: 0.55;
  pointer-events: none;
  z-index: 0;
}
.hero__inner { position: relative; z-index: 1; max-width: 780px; }
.hero__eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--accent);
  border: 1px solid var(--border);
  background: var(--bg-card);
  border-radius: var(--radius-pill);
  padding: 5px 13px;
  margin-bottom: 18px;
}
.hero__title { margin-bottom: 14px; }
.hero__title .accent { color: var(--accent); }
.hero__subtitle {
  font-size: clamp(17px, 2.4vw, 20px);
  color: var(--text-muted);
  max-width: 60ch;
  margin-bottom: 22px;
}
.hero__facts {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  list-style: none;
  margin: 0 0 26px;
  padding: 0;
}
.hero__facts .fact {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 14px;
  font-weight: 700;
  color: var(--text-primary);
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  padding: 7px 14px;
}
.hero__facts .fact::before {
  content: '✓';
  color: var(--accent);
  font-weight: 700;
}
.hero__actions { display: flex; flex-wrap: wrap; gap: 12px; }

/* ---- Table of Contents ------------------------------------------------- */
.toc {
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent-dim);
  border-radius: var(--radius-card);
  padding: 16px 20px;
  margin: 26px 0;
  background: var(--bg-card);
}
.toc__title {
  font-family: var(--font-mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--text-muted);
  margin: 0 0 10px;
}
.toc__list {
  list-style: decimal;
  padding-left: 20px;
  margin: 0;
  display: grid;
  gap: 6px;
}
.toc__item::marker { color: var(--accent); font-family: var(--font-mono); font-size: 13px; }
.toc__link {
  color: var(--text-primary);
  text-decoration: none;
  border-bottom: 1px dotted var(--border);
  padding-bottom: 1px;
}
.toc__link:hover { color: var(--accent); border-bottom-color: var(--accent); }

/* ---- Подвал ------------------------------------------------------------ */
.site-footer {
  border-top: 1px solid var(--border);
  background: linear-gradient(180deg, transparent, rgba(7, 12, 10, 0.6));
  margin-top: var(--space-section);
}
.footer-inner {
  max-width: var(--wrap);
  margin-inline: auto;
  padding: clamp(32px, 5vw, 52px) clamp(16px, 4vw, 32px) 36px;
}
.footer-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr)) 1.5fr;
  gap: 28px;
  padding-bottom: 28px;
  border-bottom: 1px solid var(--border);
}
.footer-tg {
  display: inline-block;
  margin-top: 12px;
  font-size: 13.5px;
  font-weight: 700;
  color: var(--accent);
}
.footer-tg:hover { color: var(--text-primary); }
.footer-heading {
  font-family: var(--font-mono);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--text-muted);
  margin: 0 0 12px;
}
.footer-col a {
  display: block;
  color: var(--text-primary);
  padding: 4px 0;
  font-size: 15px;
}
.footer-col a:hover { color: var(--accent); }
.footer-brand .footer-logo {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 18px;
  margin: 0 0 8px;
}
.footer-tagline { color: var(--text-muted); font-size: 14px; margin: 0; max-width: 34ch; }
.footer-disclaimer {
  padding-top: 22px;
  color: var(--text-muted);
  font-size: 13px;
  line-height: 1.6;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 8px;
}
.footer-disclaimer p { margin: 0; max-width: 68ch; }
.footer-copy { white-space: nowrap; }
.site-footer--minimal .footer-inner { padding-block: 26px; text-align: center; }
.site-footer--minimal .footer-disclaimer { justify-content: center; padding-top: 0; }

/* ---- Списки постов (fallback index) ------------------------------------ */
.post-list { display: grid; gap: 22px; margin-top: 24px; }
.post-item {
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  background: var(--bg-card);
  padding: 20px 22px;
}
.post-item h2 { margin: 0 0 8px; font-size: 22px; }

/* ---- 404 --------------------------------------------------------------- */
.error-404 { text-align: center; padding-block: clamp(40px, 8vw, 90px); }
.error-404__code {
  font-family: var(--font-mono);
  font-weight: 500;
  font-size: clamp(64px, 16vw, 132px);
  line-height: 1;
  color: var(--accent);
  opacity: 0.28;
  margin: 0;
  text-shadow: 0 0 40px var(--accent-glow);
}
.error-404__text { color: var(--text-muted); max-width: 46ch; margin-inline: auto; }
.error-404__actions {
  display: flex; flex-wrap: wrap; gap: 12px; justify-content: center;
  margin: 26px 0 22px;
}
.error-404__links {
  list-style: none; padding: 0; margin: 0;
  display: flex; flex-wrap: wrap; gap: 8px 22px; justify-content: center;
}
.error-404__links a { border-bottom: 1px dotted var(--border); }

/* ---- Адаптив ----------------------------------------------------------- */
@media (max-width: 860px) {
  .footer-grid { grid-template-columns: 1fr 1fr; }
  .footer-brand { grid-column: 1 / -1; order: -1; }
}
@media (max-width: 460px) {
  .footer-grid { grid-template-columns: 1fr; }
}

@media (max-width: 720px) {
  .nav-burger { display: block; }
  .nav-links {
    position: absolute;
    left: 0; right: 0; top: 100%;
    flex-direction: column;
    align-items: stretch;
    gap: 2px;
    background: var(--bg-base);
    border-bottom: 1px solid var(--border);
    padding: 10px clamp(16px, 4vw, 32px) 18px;
    box-shadow: var(--shadow-lift);
    display: none;
  }
  .nav-links.is-open { display: flex; }
  .nav-links a { padding: 12px; font-size: 16px; border-radius: var(--radius-badge); }
  .nav { position: relative; flex-wrap: wrap; }
}

@media (max-width: 520px) {
  .footer-grid { grid-template-columns: 1fr; }
  .footer-disclaimer { flex-direction: column; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { transition: none !important; animation: none !important; }
}
