/* ==========================================================
   Custom Properties & Reset — светлая тема в красных тонах
   Все имена классов сохранены, разметку менять не нужно
   ========================================================== */
:root {
  --bg-primary: #fdf7f6;
  --bg-secondary: #ffffff;
  --bg-surface: #ffffff;
  --bg-soft: #fef2f2;
  --border-color: #f1e3e1;
  --border-accent: #fecaca;
  --accent-red: #dc2626;
  --accent-red-hover: #b91c1c;
  --accent-red-dark: #991b1b;
  --accent-red-light: #ef4444;
  --text-main: #1c1917;
  --text-muted: #57534e;            /* раньше был белый — на светлом фоне не виден */
  --radius: 14px;
  --shadow-sm: 0 1px 2px rgba(68, 20, 20, 0.07);
  --shadow-md: 0 8px 24px -8px rgba(127, 29, 29, 0.18);
  --font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
  --header-height: 72px;
}

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  font-family: var(--font-family);
  background-color: var(--bg-primary);
  color: var(--text-main);
  line-height: 1.5;
  -webkit-text-size-adjust: 100%;
}

body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background:
    radial-gradient(900px 420px at 100% -10%, rgba(220, 38, 38, 0.09), transparent 60%),
    radial-gradient(700px 360px at 0% 0%, rgba(251, 146, 60, 0.07), transparent 60%),
    var(--bg-primary);
  background-repeat: no-repeat;
}

::selection {
  background: rgba(220, 38, 38, 0.2);
}

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

/* ==========================================================
   Header & Navigation (Mobile-First)
   ========================================================== */
.site-header {
  position: sticky;
  top: 0;
  z-index: 1000;
  background-color: rgba(255, 255, 255, 0.92);
  -webkit-backdrop-filter: saturate(180%) blur(10px);
  backdrop-filter: saturate(180%) blur(10px);
  border-bottom: 1px solid var(--border-color);
  box-shadow: var(--shadow-sm);
  height: var(--header-height);
}

/* тонкая красная линия сверху шапки */
.site-header::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--accent-red-dark), var(--accent-red), #fb923c);
}

.header-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1rem;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.logo-link {
  display: inline-block;
  flex-shrink: 0;
}

.site-logo {
  width: 140px;
  height: 60px;
  object-fit: contain;
  display: block;
}

/* Текстовый логотип (десктоп) */
.logo-img {
  font-family: 'Inter', 'Helvetica Neue', sans-serif;
  font-size: 24px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 2px;
  color: var(--accent-red);
  cursor: pointer;
  user-select: none;
  transition: opacity 0.3s ease;
  white-space: nowrap;
}

.logo-img:hover {
  opacity: 0.75;
}

@media (max-width: 768px) {
  .logo-img {
    font-size: 18px;
    letter-spacing: 0.5px;
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
  }
}

@media (max-width: 380px) {
  .logo-img {
    font-size: 16px;
    max-width: 150px;
  }
}

/* Burger */
.burger-btn {
  display: flex;
  flex-direction: column;
  justify-content: space-around;
  width: 40px;
  height: 40px;
  padding: 8px;
  background: var(--bg-soft);
  border: 1px solid var(--border-accent);
  border-radius: 10px;
  cursor: pointer;
  z-index: 1001;
  transition: background-color 0.2s ease;
}

.burger-btn:hover {
  background: #fee2e2;
}

.burger-bar {
  width: 100%;
  height: 3px;
  background-color: var(--accent-red);
  border-radius: 2px;
  transition: transform 0.3s ease, opacity 0.3s ease;
}

.burger-btn.is-active .burger-bar:nth-child(1) {
  transform: translateY(8px) rotate(45deg);
}

.burger-btn.is-active .burger-bar:nth-child(2) {
  opacity: 0;
}

.burger-btn.is-active .burger-bar:nth-child(3) {
  transform: translateY(-8px) rotate(-45deg);
}

.primary-nav {
  position: fixed;
  top: var(--header-height);
  left: 0;
  width: 100%;
  height: calc(100vh - var(--header-height));
  background-color: var(--bg-secondary);
  transform: translateX(-100%);
  visibility: hidden;
  transition: transform 0.3s ease-in-out, visibility 0.3s;
  padding: 2rem 1.5rem;
  border-top: 1px solid var(--border-color);
  box-shadow: 0 10px 25px -5px rgba(127, 29, 29, 0.2);
}

.primary-nav.is-active {
  transform: translateX(0);
  visibility: visible;
}

.nav-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.nav-link {
  display: block;
  color: var(--text-main);
  text-decoration: none;
  font-size: 1.125rem;
  font-weight: 600;
  padding: 0.75rem 1rem;
  border-radius: 10px;
  transition: color 0.2s ease, background-color 0.2s ease;
}

.nav-link:hover {
  color: var(--accent-red);
  background-color: var(--bg-soft);
}

/* ==========================================================
   Layout Main Container
   ========================================================== */
.main-container {
  max-width: 1000px;
  margin: 0 auto;
  padding: 2rem 1rem;
  width: 100%;
  flex: 1;
}

/* ==========================================================
   Content Styling (.article scope ONLY)
   ========================================================== */
.article h1 {
  font-size: 1.75rem;
  font-weight: 800;
  line-height: 1.25;
  color: var(--text-main);
  margin-bottom: 1.25rem;
  letter-spacing: -0.01em;
}

.article h2 {
  font-size: 1.35rem;
  font-weight: 700;
  line-height: 1.3;
  color: var(--text-main);
  margin: 2.25rem 0 1rem 0;
  padding: 0.6rem 0.75rem 0.6rem 1rem;
  border-left: 4px solid var(--accent-red);
  background: linear-gradient(90deg, var(--bg-soft), transparent 80%);
  border-radius: 0 8px 8px 0;
}

.article h3 {
  font-size: 1.15rem;
  font-weight: 600;
  line-height: 1.4;
  color: var(--accent-red-dark);
  margin: 1.5rem 0 0.75rem 0;
}

.article p {
  font-size: 1rem;
  line-height: 1.7;
  color: var(--text-muted);
  margin-bottom: 1.25rem;
}

.article a {
  color: var(--accent-red);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  transition: color 0.2s ease;
}

.article a:hover {
  color: var(--accent-red-hover);
}

.article strong {
  color: var(--text-main);
}

.article img {
  border-radius: var(--radius);
  max-width: 100%;
  height: auto;
  display: block;
  margin: 1.5rem 0;
  box-shadow: var(--shadow-md);
}

.article ul,
.article ol {
  margin: 0 0 1.25rem 0;
  padding: 1rem 1.25rem 1rem 2.25rem;
  color: var(--text-muted);
  background-color: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}

.article li {
  margin-bottom: 0.5rem;
  line-height: 1.6;
}

.article li:last-child {
  margin-bottom: 0;
}

.article ul li::marker {
  color: var(--accent-red);
}

.article ol li::marker {
  color: var(--accent-red);
  font-weight: 700;
}

.article blockquote {
  margin: 1.5rem 0;
  padding: 1rem 1.25rem;
  background: var(--bg-soft);
  border-left: 4px solid var(--accent-red-light);
  border-radius: 0 var(--radius) var(--radius) 0;
  color: var(--text-main);
}

.article blockquote p:last-child {
  margin-bottom: 0;
}

.article hr {
  border: none;
  height: 1px;
  background: var(--border-accent);
  margin: 2rem 0;
}

/* Tables */
.article table {
  display: block;
  overflow-x: auto;
  width: fit-content;
  max-width: 100%;
  border-collapse: collapse;
  margin: 1.5rem auto;
  background-color: var(--bg-surface);
  border-radius: var(--radius);
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-md);
  -webkit-overflow-scrolling: touch;
}

.article table th,
.article table td {
  padding: 0.85rem 1rem;
  text-align: left;
}

.article table th {
  background-color: var(--bg-soft);
  color: var(--accent-red-dark);
  font-weight: 700;
  border-bottom: 2px solid var(--border-accent);
  white-space: nowrap;
}

.article table td {
  border-bottom: 1px solid var(--border-color);
  color: var(--text-main);
  white-space: normal;
  word-break: break-word;
  min-width: 120px;
}

.article table tr:last-child td {
  border-bottom: none;
}

.article table tr:nth-child(even) {
  background-color: #fffaf9;
}

.article table tbody tr:hover {
  background-color: var(--bg-soft);
}

/* ==========================================================
   Author Block
   ========================================================== */
.author-block {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.25rem;
  position: relative;
  background: linear-gradient(180deg, #ffffff, #fff5f4);
  border: 1px solid var(--border-color);
  border-top: 4px solid var(--accent-red);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  padding: 1.5rem;
  margin-top: 3rem;
  text-align: center;
}

.author-avatar {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid #ffffff;
  box-shadow: 0 0 0 2px var(--accent-red), var(--shadow-md);
  flex-shrink: 0;
}

.author-header {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.35rem;
  margin-bottom: 0.5rem;
}

.author-name {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-main);
}

.author-badge {
  display: inline-block;
  background-color: #fee2e2;
  color: var(--accent-red-dark);
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.2rem 0.65rem;
  border-radius: 999px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.author-bio {
  font-size: 0.9rem;
  line-height: 1.6;
  color: var(--text-muted);
}

/* ==========================================================
   Footer & Compliance
   ========================================================== */
.site-footer {
  background-color: var(--bg-secondary);
  border-top: 1px solid var(--border-color);
  box-shadow: inset 0 3px 0 var(--accent-red);
  padding: 2.5rem 1rem 1.5rem;
  margin-top: auto;
}

.footer-container {
  max-width: 1000px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

.footer-top {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.5rem;
}

.footer-menu {
  list-style: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
}

.footer-menu a {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.9rem;
  padding-bottom: 2px;
  border-bottom: 1px solid transparent;
  transition: color 0.2s ease, border-color 0.2s ease;
}

.footer-menu a:hover {
  color: var(--accent-red);
  border-bottom-color: var(--accent-red);
}

.footer-regulators {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 1.25rem;
  flex-wrap: wrap;
  padding: 1rem;
  background-color: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
}

.regulator-badge {
  width: 100px;
  height: 40px;
  object-fit: contain;
  display: block;
  filter: grayscale(100%);
  opacity: 0.75;
  transition: filter 0.2s ease, opacity 0.2s ease;
}

.regulator-badge:hover {
  filter: grayscale(0%);
  opacity: 1;
}

.footer-legal {
  text-align: center;
  font-size: 0.8rem;
  color: var(--text-muted);
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

/* ==========================================================
   Back to Top Button
   ========================================================== */
.back-to-top {
  position: fixed;
  bottom: 20px;
  right: 20px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background-color: var(--accent-red);
  color: #ffffff;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transform: translateY(8px);
  transition: opacity 0.3s ease, visibility 0.3s ease, transform 0.3s ease, background-color 0.2s ease;
  z-index: 999;
  box-shadow: 0 6px 16px rgba(220, 38, 38, 0.4);
}

.back-to-top:hover {
  background-color: var(--accent-red-hover);
}

.back-to-top.is-visible {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

/* ==========================================================
   Desktop Responsive Layout (min-width: 768px)
   ========================================================== */
@media (min-width: 768px) {
  .burger-btn {
    display: none;
  }

  .header-container {
    gap: 2.5rem;
  }

  .primary-nav {
    position: static;
    height: auto;
    width: auto;
    background-color: transparent;
    transform: none;
    visibility: visible;
    padding: 0;
    border-top: none;
    box-shadow: none;
  }

  .nav-list {
    flex-direction: row;
    gap: 0.5rem;
  }

  .nav-link {
    font-size: 0.95rem;
    padding: 0.5rem 0.9rem;
  }

  .article h1 {
    font-size: 2.25rem;
  }

  .article h2 {
    font-size: 1.6rem;
  }

  .author-block {
    flex-direction: row;
    text-align: left;
    align-items: flex-start;
  }

  .author-header {
    align-items: flex-start;
    flex-direction: row;
    gap: 0.75rem;
  }

  .footer-top {
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
  }

  .footer-menu {
    flex-direction: row;
    gap: 1.5rem;
  }
}

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