:root {
  color-scheme: light;
  --bg: #f4f7fb;
  --bg-accent: #e8eef9;
  --surface: #ffffff;
  --surface-muted: #f7f9fc;
  --surface-accent: #edf4ff;
  --text: #172033;
  --text-muted: #5b6475;
  --heading: #0f172a;
  --line: #d7dfeb;
  --line-strong: #b8c6da;
  --primary: #1d4ed8;
  --primary-strong: #1e40af;
  --primary-soft: #dbeafe;
  --shadow-soft: 0 16px 40px rgba(15, 23, 42, 0.08);
  --shadow-card: 0 10px 24px rgba(15, 23, 42, 0.06);
  --radius-xl: 24px;
  --radius-lg: 18px;
  --radius-md: 14px;
  --radius-sm: 10px;
  --wrap-width: 1380px;
}

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

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-width: 320px;
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  line-height: 1.6;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(219, 234, 254, 0.8), transparent 26rem),
    linear-gradient(180deg, #fbfdff 0%, var(--bg) 100%);
}

img,
svg,
video {
  display: block;
  max-width: 100%;
}

a {
  color: var(--primary);
}

a:hover {
  color: var(--primary-strong);
}

a:focus-visible,
button:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible {
  outline: 3px solid rgba(29, 78, 216, 0.22);
  outline-offset: 3px;
}

main {
  display: block;
}

.wrap,
.site-shell {
  width: min(100% - 2rem, var(--wrap-width));
  margin: 0 auto;
  padding: 24px 0 40px;
}

.hero,
section,
.footer,
.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-card);
}

.hero {
  padding: 28px;
  margin-bottom: 24px;
}

section {
  padding: 24px;
  margin-top: 24px;
}

.footer {
  margin-top: 24px;
  padding: 18px;
  color: var(--text-muted);
  font-size: 0.95rem;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.42rem 0.8rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--surface-accent);
  color: var(--primary-strong);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

h1,
h2,
h3 {
  margin: 0;
  color: var(--heading);
  line-height: 1.1;
}

h1 {
  margin-top: 14px;
  font-size: clamp(2.3rem, 5vw, 4rem);
}

h2 {
  margin-bottom: 10px;
  font-size: clamp(1.65rem, 2.8vw, 2rem);
}

p {
  margin: 0;
}

.lead {
  margin-top: 12px;
  max-width: 72ch;
  color: var(--text-muted);
  font-size: 1rem;
  line-height: 1.8;
}

.meta {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-top: 20px;
}

.meta .box {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface-muted);
}

.meta strong {
  display: block;
  margin-bottom: 4px;
  color: var(--heading);
  font-size: 1.4rem;
}

.nav-links {
  margin-top: 20px;
}

.nav-links a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0.75rem 1.1rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface-muted);
  color: var(--heading);
  font-weight: 700;
  text-decoration: none;
  transition:
    background-color 0.2s ease,
    border-color 0.2s ease,
    transform 0.2s ease;
}

.nav-links a:hover,
.nav-links a:focus-visible {
  background: #ffffff;
  border-color: var(--line-strong);
  transform: translateY(-1px);
}

.toc {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 14px;
  margin-top: 20px;
}

.toc a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 60px;
  padding: 0.85rem 1rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface);
  color: var(--heading);
  text-align: center;
  text-decoration: none;
  font-weight: 700;
  line-height: 1.3;
  transition:
    border-color 0.2s ease,
    background-color 0.2s ease,
    transform 0.2s ease;
}

.toc a:hover,
.toc a:focus-visible {
  border-color: var(--primary);
  background: var(--surface-accent);
  transform: translateY(-1px);
}

.section-note,
.note {
  margin-bottom: 18px;
  color: var(--text-muted);
  line-height: 1.75;
}

.card {
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.9) inset;
}

.back-to-top {
  position: fixed;
  right: 20px;
  bottom: 20px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 46px;
  height: 46px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.4);
  background: var(--primary);
  color: #ffffff;
  box-shadow: var(--shadow-soft);
  text-decoration: none;
  font-size: 1.2rem;
  font-weight: 700;
}

.back-to-top:hover,
.back-to-top:focus-visible {
  background: var(--primary-strong);
  color: #ffffff;
}

.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;
}

@media (max-width: 980px) {
  .meta {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 640px) {
  .wrap,
  .site-shell {
    width: min(100% - 1rem, var(--wrap-width));
    padding-top: 16px;
    padding-bottom: 28px;
  }

  .hero,
  section,
  .footer {
    border-radius: 18px;
  }

  .hero,
  section {
    padding: 18px;
  }

  .meta {
    grid-template-columns: 1fr;
  }

  .back-to-top {
    right: 14px;
    bottom: 14px;
  }
}
