/* =====================================================================
   СРЕДА · Document pages (/privacy, /terms)
   Shared chrome + long-form prose.
   Header / menu / footer rules are kept byte-identical to index.html so
   the sub-pages and the landing page cannot visually drift apart.
   Requires sreda-tokens.css to be loaded first.
   ===================================================================== */

/* =====================================================================
   Page foundations
   ===================================================================== */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  background: var(--sreda-fon);
  color: var(--sreda-text);
  font-family: var(--sreda-font-text);
  font-size: 16px;
  line-height: 26px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  transition: background 240ms ease-out, color 240ms ease-out;
}
img { max-width: 100%; height: auto; display: block; }
a { color: inherit; text-decoration: none; }
button { font: inherit; cursor: pointer; }
::selection { background: var(--sreda-ohra-muted); color: var(--sreda-text); }

.container { max-width: 1240px; margin: 0 auto; padding: 0 32px; }
@media (max-width: 720px) { .container { padding: 0 20px; } }

.header, .btn, footer {
  transition: background 240ms ease-out, color 240ms ease-out,
              border-color 240ms ease-out;
}

/* Visible focus for keyboard users on every interactive element */
a:focus-visible,
button:focus-visible {
  outline: 2px solid var(--sreda-ssylka);
  outline-offset: 3px;
  border-radius: 2px;
}

/* Skip link — first tab stop */
.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 200;
  background: var(--sreda-text);
  color: var(--sreda-text-on-dark);
  font-family: var(--sreda-font-ui);
  font-size: 14px;
  padding: 10px 16px;
  border-radius: var(--sreda-radius-button);
}
.skip-link:focus { left: 16px; top: 16px; }

/* =====================================================================
   Type
   ===================================================================== */
.eyebrow {
  font-family: var(--sreda-font-mono);
  font-size: 11px;
  line-height: 14px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--sreda-text-muted);
  font-weight: 500;
}

/* =====================================================================
   Buttons
   ===================================================================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: var(--sreda-radius-button);
  font-family: var(--sreda-font-ui);
  font-size: 14px;
  line-height: 20px;
  font-weight: 500;
  border: 1px solid transparent;
  transition: opacity var(--sreda-motion-quick), background var(--sreda-motion-quick), border-color var(--sreda-motion-quick);
  text-align: center;
  white-space: nowrap;
  cursor: pointer;
}
.btn:hover { opacity: 0.85; }
.btn:active { opacity: 0.7; }
.btn--primary {
  background: var(--sreda-text);
  color: var(--sreda-text-on-dark);
}
.btn--sm { padding: 7px 12px; font-size: 13px; }

/* =====================================================================
   Header — copied from index.html
   ===================================================================== */
.header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: color-mix(in srgb, var(--sreda-fon) 92%, transparent);
  backdrop-filter: saturate(120%) blur(10px);
  -webkit-backdrop-filter: saturate(120%) blur(10px);
  border-bottom: 1px solid var(--sreda-granitsa);
}
.header__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 72px;
  gap: 24px;
}
.header__brand {
  display: flex;
  align-items: center;
  flex-shrink: 0;
}
.header__brand img {
  height: 30px;
  width: auto;
  display: block;
}
.header__brand .light { display: block; }
.header__brand .dark { display: none; }
:root[data-theme="dark"] .header__brand .light { display: none; }
:root[data-theme="dark"] .header__brand .dark { display: block; }

.header__right {
  display: flex;
  align-items: center;
  gap: 10px;
}
.icon-btn {
  width: 36px; height: 36px;
  border-radius: 999px;
  border: 1px solid transparent;
  background: transparent;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--sreda-text);
  cursor: pointer;
  transition: background var(--sreda-motion-quick), border-color var(--sreda-motion-quick);
}
.icon-btn:hover { background: var(--sreda-poverkhnost); border-color: var(--sreda-granitsa); }
.icon-btn svg { width: 16px; height: 16px; }

.theme-toggle {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--sreda-granitsa);
  border-radius: 999px;
  padding: 2px;
  background: transparent;
  gap: 2px;
}
.theme-toggle button {
  width: 30px; height: 30px;
  border-radius: 999px;
  background: transparent;
  border: 0;
  color: var(--sreda-text-muted);
  display: inline-flex; align-items: center; justify-content: center;
  cursor: pointer;
  transition: background var(--sreda-motion-quick), color var(--sreda-motion-quick);
}
.theme-toggle button:hover { color: var(--sreda-text); }
.theme-toggle button.active {
  background: var(--sreda-poverkhnost-muted);
  color: var(--sreda-text);
}
.theme-toggle button svg { width: 14px; height: 14px; }

/* Menu overlay */
.menu-overlay {
  position: fixed;
  inset: 0;
  background: color-mix(in srgb, var(--sreda-fon) 97%, transparent);
  backdrop-filter: saturate(120%) blur(20px);
  -webkit-backdrop-filter: saturate(120%) blur(20px);
  z-index: 100;
  display: none;
  flex-direction: column;
  padding: 28px 32px 64px;
  overflow-y: auto;
}
.menu-overlay.open { display: flex; }
.menu-overlay__top {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 64px;
}
.menu-overlay__top img { height: 30px; }
.menu-overlay__top .light { display: block; }
.menu-overlay__top .dark { display: none; }
:root[data-theme="dark"] .menu-overlay__top .light { display: none; }
:root[data-theme="dark"] .menu-overlay__top .dark { display: block; }
.menu-overlay__list {
  display: flex; flex-direction: column;
  gap: 0;
  max-width: 1240px; margin: 0 auto;
  width: 100%;
}
.menu-overlay__list a {
  display: flex; justify-content: space-between; align-items: baseline;
  padding: 20px 0;
  font-family: var(--sreda-font-display);
  font-weight: 500;
  font-size: clamp(28px, 4vw, 48px);
  line-height: 1.1;
  color: var(--sreda-text);
  border-bottom: 1px solid var(--sreda-granitsa);
  transition: color var(--sreda-motion-quick), padding-left var(--sreda-motion-quick);
}
.menu-overlay__list a:hover {
  color: var(--sreda-ssylka);
  padding-left: 12px;
}
.menu-overlay__list a .num {
  font-family: var(--sreda-font-mono);
  font-size: 11px;
  letter-spacing: 0.18em;
  color: var(--sreda-text-muted);
  font-weight: 500;
}
.menu-overlay__footer {
  margin-top: 48px;
  max-width: 1240px;
  margin-left: auto; margin-right: auto;
  width: 100%;
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
}
.menu-overlay__footer p {
  font-family: var(--sreda-font-display);
  font-style: italic;
  font-size: 18px;
  color: var(--sreda-text-secondary);
  margin: 0;
}

/* =====================================================================
   Document — the long-form page itself
   ===================================================================== */
.doc-hero {
  padding: 72px 0 40px;
  border-bottom: 1px solid var(--sreda-granitsa);
}
@media (max-width: 900px) { .doc-hero { padding: 44px 0 32px; } }

.doc-hero__inner { max-width: 720px; }

.doc-hero h1 {
  font-family: var(--sreda-font-display);
  font-weight: 500;
  font-size: clamp(32px, 5vw, 52px);
  line-height: 1.08;
  letter-spacing: -0.005em;
  color: var(--sreda-text);
  margin: 20px 0 0;
  text-wrap: balance;
}
.doc-hero__lede {
  font-family: var(--sreda-font-text);
  font-size: 17px;
  line-height: 28px;
  color: var(--sreda-text-secondary);
  margin: 20px 0 0;
  max-width: 620px;
}
.doc-meta {
  margin-top: 28px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px 20px;
  font-family: var(--sreda-font-mono);
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--sreda-text-muted);
}

/* Body of the document — comfortable measure for reading */
.doc {
  padding: 56px 0 88px;
}
@media (max-width: 900px) { .doc { padding: 40px 0 64px; } }

.doc__inner { max-width: 720px; }

.doc h2 {
  font-family: var(--sreda-font-display);
  font-weight: 500;
  font-size: 28px;
  line-height: 34px;
  color: var(--sreda-text);
  margin: 56px 0 0;
  scroll-margin-top: 88px;
  text-wrap: balance;
}
.doc h2:first-child { margin-top: 0; }

.doc h3 {
  font-family: var(--sreda-font-ui);
  font-weight: 600;
  font-size: 17px;
  line-height: 24px;
  color: var(--sreda-text);
  margin: 32px 0 0;
}

.doc p {
  font-size: 16px;
  line-height: 28px;
  color: var(--sreda-text-secondary);
  margin: 14px 0 0;
  text-wrap: pretty;
}
.doc p strong { color: var(--sreda-text); font-weight: 500; }

.doc ul {
  list-style: none;
  padding: 0;
  margin: 16px 0 0;
}
.doc ul li {
  position: relative;
  padding-left: 22px;
  font-size: 16px;
  line-height: 28px;
  color: var(--sreda-text-secondary);
  margin-top: 8px;
  text-wrap: pretty;
}
/* Small cinnabar tick — the accent only ever appears at this scale */
.doc ul li::before {
  content: "";
  position: absolute;
  left: 2px;
  top: 12px;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--sreda-ohra);
}

/* In-document links must be visually distinct from prose */
.doc a:not(.btn),
.doc-hero a:not(.btn) {
  color: var(--sreda-ssylka);
  border-bottom: 1px solid var(--sreda-ohra-muted);
  padding-bottom: 1px;
  transition: color var(--sreda-motion-quick), border-color var(--sreda-motion-quick);
  /* Long emails / URLs must never force a horizontal scrollbar */
  overflow-wrap: anywhere;
}
.doc a:not(.btn):hover,
.doc-hero a:not(.btn):hover {
  color: var(--sreda-text);
  border-bottom-color: var(--sreda-ohra);
}

/* Callout — used for the "what SREDA does not do" and contact blocks */
.doc-note {
  margin-top: 24px;
  padding: 24px 26px;
  background: var(--sreda-poverkhnost);
  border: 1px solid var(--sreda-granitsa);
  border-radius: var(--sreda-radius-card);
}
.doc-note > *:first-child { margin-top: 0; }
@media (max-width: 560px) { .doc-note { padding: 20px; } }

/* A callout heading keeps the document's heading order (no skipped levels)
   without taking on the full weight of a section heading. */
.doc .doc-note__title {
  font-family: var(--sreda-font-ui);
  font-weight: 600;
  font-size: 17px;
  line-height: 24px;
  margin: 0;
}

/* Table of contents */
.doc-toc {
  margin: 0 0 8px;
  padding: 24px 26px;
  background: var(--sreda-poverkhnost);
  border: 1px solid var(--sreda-granitsa);
  border-radius: var(--sreda-radius-card);
}
.doc-toc h2 {
  font-family: var(--sreda-font-mono);
  font-size: 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--sreda-text-muted);
  font-weight: 500;
  margin: 0 0 14px;
  line-height: 14px;
}
.doc-toc ol {
  margin: 0;
  padding: 0;
  list-style: none;
  counter-reset: toc;
  columns: 2;
  column-gap: 32px;
}
@media (max-width: 640px) { .doc-toc ol { columns: 1; } }
.doc-toc li {
  counter-increment: toc;
  break-inside: avoid;
  margin-bottom: 10px;
}
.doc-toc a {
  font-family: var(--sreda-font-ui);
  font-size: 14px;
  line-height: 20px;
  color: var(--sreda-text);
  display: inline-flex;
  gap: 10px;
  /* 44px hit area on touch without disturbing the visual rhythm */
  padding: 4px 0;
  transition: color var(--sreda-motion-quick);
}
.doc-toc a::before {
  content: counter(toc, decimal-leading-zero);
  font-family: var(--sreda-font-mono);
  font-size: 10px;
  letter-spacing: 0.12em;
  color: var(--sreda-text-muted);
  padding-top: 4px;
}
.doc-toc a:hover { color: var(--sreda-ssylka); }
/* The list format already reads as links — the prose underline is noise here */
.doc-toc a { border-bottom: 0; padding-bottom: 4px; }

/* =====================================================================
   Footer — copied from index.html
   ===================================================================== */
footer.footer {
  background: var(--sreda-poverkhnost);
  border-top: 1px solid var(--sreda-granitsa);
  padding: 72px 0 36px;
}
.footer__grid {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) repeat(3, 1fr);
  gap: 48px;
  margin-bottom: 56px;
}
@media (max-width: 760px) { .footer__grid { grid-template-columns: 1fr 1fr; gap: 36px; } }
@media (max-width: 480px) { .footer__grid { grid-template-columns: 1fr; gap: 32px; } }
.footer__brand img { height: 30px; width: auto; margin-bottom: 16px; }
.footer__brand .light { display: block; }
.footer__brand .dark { display: none; }
:root[data-theme="dark"] .footer__brand .light { display: none; }
:root[data-theme="dark"] .footer__brand .dark { display: block; }
.footer__brand .tagline {
  font-family: var(--sreda-font-display);
  font-style: italic;
  font-size: 18px;
  line-height: 26px;
  color: var(--sreda-text);
  margin-bottom: 4px;
}
.footer__brand .sub {
  font-family: var(--sreda-font-mono);
  font-size: 10px; letter-spacing: 0.18em;
  text-transform: uppercase; color: var(--sreda-text-muted);
}
.footer__col h4 {
  font-family: var(--sreda-font-mono);
  font-size: 10px; letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--sreda-text-muted);
  font-weight: 500;
  margin: 0 0 18px;
}
.footer__col ul { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 12px; }
.footer__col a {
  font-family: var(--sreda-font-ui);
  font-size: 14px;
  color: var(--sreda-text);
  transition: color var(--sreda-motion-quick);
}
.footer__col a:hover { color: var(--sreda-ssylka); }
.footer__col a[aria-current="page"] { color: var(--sreda-ssylka); }
.footer__bottom {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 32px;
  padding-top: 32px;
  border-top: 1px solid var(--sreda-granitsa);
  flex-wrap: wrap;
}
.footer__legal {
  font-family: var(--sreda-font-ui);
  font-size: 12px;
  line-height: 20px;
  color: var(--sreda-text-muted);
  max-width: 560px;
  font-style: italic;
  margin: 0;
}
.footer__copyright {
  font-family: var(--sreda-font-mono);
  font-size: 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--sreda-text-muted);
}

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