/* ============================================================
   1. CSS VARIABLES & RESET
   ============================================================ */
:root {
  /* Palette - dark editorial */
  --page-bg: #0e0e10;
  --header-bg: #1a1a1a;
  --footer-bg: #0a0a0a;
  --surface: #1e1e22;
  --surface-alt: #232328;
  --text-primary: #f5f5f7;
  --text-muted: #9ca0a6;
  --accent: #e5327d;
  --accent-secondary: #7d2a4a;
  --accent-soft: rgba(229, 50, 125, 0.08);
  --accent-soft-strong: rgba(229, 50, 125, 0.16);
  --border: #2a2a2e;
  --border-strong: #3a3a40;
  --success: #3ec28f;
  --warning: #e6a23c;
  --danger: #e25555;

  /* Typography */
  --font-heading: 'Space Grotesk', system-ui, sans-serif;
  --font-body: 'Inter', system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, monospace;
  --font-logo: 'Fraunces', Georgia, serif;

  /* Layout */
  --content-width: 720px;
  --section-gap: clamp(3rem, 6vw, 5rem);
  --component-gap: 1.75rem;

  /* Shadows */
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.3);
  --shadow-md: 0 4px 16px rgba(0,0,0,0.35);
  --shadow-lg: 0 12px 40px rgba(0,0,0,0.45);

  /* Radii */
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 14px;
}

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

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  padding: 0;
  background: var(--page-bg);
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 1.0625rem;
  line-height: 1.65;
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

/* ============================================================
   2. GENERAL TYPOGRAPHY
   ============================================================ */
p, li, blockquote, td, th {
  text-align: left;
}

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

h1, h2, h3, h4 {
  font-family: var(--font-heading);
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.01em;
  text-align: left;
}

h1 {
  font-size: clamp(2rem, 4vw + 1rem, 3.4rem);
  line-height: 1.1;
  margin: 0 0 1rem 0;
}

h2 {
  font-size: clamp(1.5rem, 2.5vw + 0.5rem, 2.1rem);
  line-height: 1.2;
  margin: 2.5rem 0 1.1rem 0;
  scroll-margin-top: 2rem;
}

h3 {
  font-size: 1.3rem;
  line-height: 1.3;
  margin: 2rem 0 0.75rem 0;
  scroll-margin-top: 2rem;
  color: var(--text-primary);
}

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

em {
  font-style: italic;
}

a {
  color: var(--accent);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: border-color 0.2s ease, color 0.2s ease;
}

a:hover, a:focus {
  border-bottom-color: var(--accent);
}

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

ul, ol {
  margin: 0 0 1.1em 0;
  padding-left: 1.5em;
}

li {
  margin-bottom: 0.5em;
  line-height: 1.65;
}

blockquote {
  margin: 1.5em 0;
  padding: 0 0 0 1.25rem;
  border-left: 3px solid var(--accent);
  font-style: italic;
  color: var(--text-muted);
}

/* Figures (global rule) */
figure {
  margin: 1.5em auto;
  max-width: 100%;
}

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

figcaption {
  font-size: 0.875rem;
  color: var(--text-muted);
  text-align: center;
  margin-top: 0.75rem;
  font-style: italic;
}

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

code {
  font-family: var(--font-mono);
  font-size: 0.9em;
  background: var(--surface);
  padding: 0.15em 0.4em;
  border-radius: 3px;
  color: var(--accent);
}

/* ============================================================
   3. LAYOUT — MAIN & SECTIONS
   ============================================================ */
main {
  width: 100%;
  padding: 0;
}

article {
  width: 100%;
}

[data-content] {
  max-width: var(--content-width);
  margin-left: auto;
  margin-right: auto;
  padding-left: 1.5rem;
  padding-right: 1.5rem;
  margin-top: 0;
  margin-bottom: var(--section-gap);
}

[data-content="hero"] {
  margin-bottom: var(--section-gap);
}

/* ============================================================
   4. COMPONENTS — distinct visual identities
   ============================================================ */

/* --- info-box: surface card with left magenta border --- */
.info-box {
  margin-top: var(--component-gap);
  margin-bottom: var(--component-gap);
  background: var(--surface);
  border-left: 3px solid var(--accent);
  padding: 1.25rem 1.5rem;
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
  box-shadow: var(--shadow-sm);
  position: relative;
}

.info-box::before {
  content: 'i';
  display: inline-block;
  width: 1.4rem;
  height: 1.4rem;
  background: var(--accent);
  color: var(--page-bg);
  border-radius: 50%;
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 0.85rem;
  text-align: center;
  line-height: 1.4rem;
  position: absolute;
  top: -0.7rem;
  left: 1.25rem;
}

.info-box p {
  margin: 0;
  padding-top: 0.25rem;
  text-align: left;
  color: var(--text-primary);
}

.info-box p:not(:last-child) {
  margin-bottom: 0.75rem;
}

/* --- callout: warning/attention with bordered box --- */
.callout {
  margin-top: var(--component-gap);
  margin-bottom: var(--component-gap);
  background: var(--surface-alt);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  padding: 1.25rem 1.5rem 1.25rem 3.5rem;
  position: relative;
  box-shadow: var(--shadow-sm);
}

.callout::before {
  content: '!';
  position: absolute;
  left: 1.25rem;
  top: 1.25rem;
  width: 1.6rem;
  height: 1.6rem;
  background: transparent;
  border: 2px solid var(--accent);
  color: var(--accent);
  font-family: var(--font-mono);
  font-weight: 700;
  text-align: center;
  line-height: 1.4rem;
  border-radius: 50%;
  font-size: 0.95rem;
}

.callout p {
  margin: 0;
  text-align: left;
  color: var(--text-primary);
}

.callout p:not(:last-child) {
  margin-bottom: 0.75rem;
}

/* --- key-takeaway: NO container, just border-top + large text --- */
.key-takeaway {
  margin-top: calc(var(--component-gap) + 0.5rem);
  margin-bottom: calc(var(--component-gap) + 0.5rem);
  border-top: 2px solid var(--accent);
  padding-top: 1.5rem;
  background: transparent;
  border-radius: 0;
  box-shadow: none;
}

.key-takeaway::before {
  content: 'PUNTO CHIAVE';
  display: block;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  letter-spacing: 0.15em;
  color: var(--accent);
  margin-bottom: 0.75rem;
  font-weight: 500;
  text-transform: uppercase;
}

.key-takeaway p {
  margin: 0;
  font-family: var(--font-heading);
  font-size: 1.35rem;
  line-height: 1.4;
  font-weight: 600;
  color: var(--text-primary);
  text-align: left;
}

/* --- fun-fact: marginal note, no container, italic with dash marker --- */
.fun-fact {
  margin-top: var(--component-gap);
  margin-bottom: var(--component-gap);
  padding-left: 2rem;
  position: relative;
  background: transparent;
  border: none;
  box-shadow: none;
}

.fun-fact::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0.85em;
  width: 1.25rem;
  height: 2px;
  background: var(--accent);
}

.fun-fact p {
  margin: 0;
  font-style: italic;
  color: var(--text-muted);
  font-size: 1rem;
  line-height: 1.6;
  text-align: left;
}

.fun-fact p strong {
  font-family: var(--font-mono);
  font-style: normal;
  font-size: 0.75rem;
  letter-spacing: 0.15em;
  color: var(--accent);
  text-transform: uppercase;
  display: block;
  margin-bottom: 0.4rem;
  font-weight: 500;
}

/* --- glossary-term: inline-style row, not a box --- */
.glossary-term {
  margin-top: var(--component-gap);
  margin-bottom: var(--component-gap);
  display: block;
  padding: 1rem 0;
  border-top: 1px dashed var(--border-strong);
  border-bottom: 1px dashed var(--border-strong);
  background: transparent;
  box-shadow: none;
}

.glossary-term p {
  margin: 0;
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 0.75rem;
  color: var(--text-muted);
  text-align: left;
}

.glossary-term p strong {
  font-family: var(--font-mono);
  font-weight: 500;
  color: var(--accent);
  text-decoration: underline;
  text-decoration-style: dashed;
  text-underline-offset: 4px;
  text-decoration-color: var(--accent);
  letter-spacing: 0.02em;
  flex-shrink: 0;
}

/* --- dos-donts: two-column grid green/red --- */
.dos-donts {
  margin-top: var(--component-gap);
  margin-bottom: var(--component-gap);
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.dos-donts > div {
  background: var(--surface);
  border-radius: var(--radius-md);
  padding: 1.25rem 1.25rem 1rem 1.25rem;
  box-shadow: var(--shadow-sm);
}

.dos-donts > div:first-child {
  border-top: 3px solid var(--success);
}

.dos-donts > div:last-child {
  border-top: 3px solid var(--danger);
}

.dos-donts > div p {
  margin-top: 0;
  margin-bottom: 0.75rem;
  text-align: left;
}

.dos-donts > div:first-child p:first-child strong {
  color: var(--success);
  font-family: var(--font-mono);
  font-size: 0.8rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
}

.dos-donts > div:last-child p:first-child strong {
  color: var(--danger);
  font-family: var(--font-mono);
  font-size: 0.8rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
}

.dos-donts > div:first-child p:first-child strong::before {
  content: '✓ ';
}

.dos-donts > div:last-child p:first-child strong::before {
  content: '✗ ';
}

.dos-donts ul {
  margin: 0;
  padding-left: 1.1em;
  list-style: none;
}

.dos-donts li {
  position: relative;
  padding-left: 0.5em;
  margin-bottom: 0.6em;
  font-size: 0.96rem;
  line-height: 1.55;
  text-align: left;
}

.dos-donts > div:first-child li::before {
  content: '•';
  color: var(--success);
  position: absolute;
  left: -0.8em;
  font-weight: 700;
}

.dos-donts > div:last-child li::before {
  content: '•';
  color: var(--danger);
  position: absolute;
  left: -0.8em;
  font-weight: 700;
}

/* --- at-a-glance: horizontal cell grid --- */
.at-a-glance {
  margin-top: var(--component-gap);
  margin-bottom: var(--component-gap);
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  background: var(--surface);
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.at-a-glance > div {
  padding: 1.25rem 1rem;
  border-right: 1px solid var(--border);
  text-align: center;
}

.at-a-glance > div:last-child {
  border-right: none;
}

.at-a-glance > div p {
  margin: 0;
  text-align: center;
}

.at-a-glance > div p:first-child strong {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.12em;
  color: var(--text-muted);
  text-transform: uppercase;
  font-weight: 500;
  display: block;
  margin-bottom: 0.5rem;
}

.at-a-glance > div p:last-child {
  font-family: var(--font-heading);
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--accent);
  line-height: 1.35;
}

/* --- comparison: side-by-side table --- */
.comparison {
  margin-top: var(--component-gap);
  margin-bottom: var(--component-gap);
  overflow-x: auto;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
}

.comparison table {
  width: 100%;
  border-collapse: collapse;
  background: var(--surface);
  min-width: 540px;
}

.comparison thead {
  background: var(--footer-bg);
}

.comparison th {
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 0.85rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--accent);
  padding: 0.9rem 1rem;
  text-align: left;
  border-bottom: 2px solid var(--accent-secondary);
}

.comparison td {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border);
  font-size: 0.95rem;
  text-align: left;
  color: var(--text-primary);
}

.comparison tbody tr:nth-child(even) {
  background: var(--page-bg);
}

.comparison tbody tr:last-child td {
  border-bottom: none;
}

.comparison td:first-child {
  font-weight: 600;
  color: var(--text-primary);
}

/* --- section-bridge: separator line with centered text --- */
.section-bridge {
  margin: calc(var(--component-gap) + 1rem) 0;
  text-align: center;
  position: relative;
  padding: 1rem 2rem;
}

.section-bridge::before,
.section-bridge::after {
  content: '';
  display: inline-block;
  width: 40px;
  height: 1px;
  background: var(--border-strong);
  vertical-align: middle;
  margin: 0 0.75rem;
}

.section-bridge p {
  margin: 0;
  display: inline-block;
  vertical-align: middle;
  font-style: italic;
  color: var(--accent);
  font-size: 1rem;
  max-width: 80%;
  text-align: center;
}

/* --- TLDR (data-content block + component) --- */
.tldr {
  background: var(--surface);
  border-left: 4px solid var(--accent);
  padding: 1.5rem 1.75rem;
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
  box-shadow: var(--shadow-sm);
  margin-top: 0;
  margin-bottom: var(--section-gap);
}

.tldr h2 {
  font-family: var(--font-heading);
  font-size: 1.15rem;
  font-weight: 700;
  margin: 0 0 1rem 0;
  letter-spacing: 0.02em;
  color: var(--text-primary);
  scroll-margin-top: 2rem;
}

.tldr h2::before {
  content: 'IN SINTESI · ';
  font-family: var(--font-mono);
  font-size: 0.75rem;
  letter-spacing: 0.15em;
  color: var(--accent);
  font-weight: 500;
  text-transform: uppercase;
  display: inline;
  margin-right: 0.25rem;
}

.tldr ul {
  margin: 0;
  padding-left: 1.25em;
  list-style: none;
}

.tldr li {
  position: relative;
  padding-left: 1.25em;
  margin-bottom: 0.65em;
  font-size: 0.98rem;
  line-height: 1.6;
  color: var(--text-primary);
  text-align: left;
}

.tldr li::before {
  content: '→';
  position: absolute;
  left: -0.2em;
  color: var(--accent);
  font-weight: 700;
}

/* --- author-bio: inline badge --- */
.author-bio {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
  font-size: 0.8rem;
  color: var(--text-muted);
  font-style: italic;
  margin-top: 2rem;
  margin-bottom: 1rem;
}

.author-bio::before {
  content: '◆';
  color: var(--accent);
  font-style: normal;
  font-size: 0.7rem;
}

/* ============================================================
   5. HERO SECTION
   ============================================================ */
.hero {
  width: 100vw;
  margin-left: calc(50% - 50vw);
  margin-right: calc(50% - 50vw);
  background: linear-gradient(180deg, #161618 0%, var(--page-bg) 100%);
  padding: clamp(2.5rem, 6vw, 4.5rem) 1.5rem clamp(3rem, 6vw, 5rem);
  text-align: center;
  position: relative;
  margin-top: 0;
  margin-bottom: var(--section-gap);
  max-width: none;
}

.hero > * {
  position: relative;
  z-index: 1;
  text-align: center;
  margin-left: auto;
  margin-right: auto;
  max-width: var(--content-width);
}

.hero-eyebrow {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 1.25rem;
  font-weight: 500;
  display: block;
  text-align: center;
}

.hero h1 {
  text-align: center;
  margin: 0 auto 1.25rem auto;
  font-size: clamp(2rem, 4vw + 1rem, 3.4rem);
  line-height: 1.08;
  max-width: 900px;
  letter-spacing: -0.015em;
}

.hero-subtitle {
  font-family: var(--font-body);
  font-size: clamp(1rem, 1.2vw + 0.6rem, 1.15rem);
  color: var(--text-muted);
  margin: 0 auto 1.75rem auto;
  max-width: 600px;
  text-align: center;
  letter-spacing: 0.01em;
  line-height: 1.55;
  font-weight: 400;
}

.hero-meta {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 0.75rem 1.25rem;
  flex-wrap: wrap;
  text-align: center;
  font-family: var(--font-body);
  font-size: 0.85rem;
  color: var(--text-muted);
  letter-spacing: 0.01em;
}

.hero-meta .byline {
  font-weight: 600;
  color: var(--text-primary);
}

.hero-meta .separator {
  color: var(--border-strong);
}

.hero-meta time {
  font-family: var(--font-mono);
  font-size: 0.8rem;
}

.hero-cta {
  display: inline-block;
  margin-top: 2rem;
  padding: 0.75rem 1.5rem;
  border: 1px solid var(--accent);
  background: transparent;
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: 0.8rem;
  font-weight: 500;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  border-radius: var(--radius-sm);
  transition: background 0.2s ease, color 0.2s ease, transform 0.2s ease;
}

.hero-cta:hover, .hero-cta:focus {
  background: var(--accent);
  color: var(--page-bg);
  border-bottom-color: var(--accent);
  transform: translateY(-1px);
}

/* ============================================================
   6. HEADER
   ============================================================ */
.site-header {
  background: var(--header-bg);
  border-bottom: 1px solid var(--border);
  padding: 1rem 1.5rem;
  position: sticky;
  top: 0;
  z-index: 50;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.header-inner {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.site-logo {
  display: inline-block;
  border-bottom: none;
}

.site-logo:hover {
  border-bottom: none;
}

.site-logo img {
  display: block;
  width: 180px;
  height: auto;
  max-height: 56px;
}

.header-meta {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  font-size: 0.78rem;
}

.header-meta .trust-marker {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--text-muted);
  padding: 0.35rem 0.6rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

.header-meta .date-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
  padding: 0.35rem 0.6rem;
  background: var(--accent-soft);
  border: 1px solid var(--accent-secondary);
  border-radius: var(--radius-sm);
}

.header-meta .date-badge time {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--accent);
}

/* ============================================================
   7. TABLE OF CONTENTS — vertical with 2 columns
   ============================================================ */
.toc {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 1.5rem 1.75rem;
  margin-top: 0;
  margin-bottom: var(--section-gap);
  box-shadow: var(--shadow-sm);
}

.toc h2 {
  font-family: var(--font-heading);
  font-size: 0.85rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  margin: 0 0 1.25rem 0;
  color: var(--accent);
  font-weight: 500;
  scroll-margin-top: 2rem;
}

.toc-list {
  column-count: 2;
  column-gap: 2rem;
  list-style: none;
  margin: 0;
  padding: 0;
}

.toc-list > li {
  break-inside: avoid;
  margin-bottom: 1rem;
  page-break-inside: avoid;
}

.toc-list > li > a {
  font-family: var(--font-heading);
  font-size: 0.98rem;
  font-weight: 700;
  color: var(--text-primary);
  display: block;
  margin-bottom: 0.35rem;
  border-bottom: none;
  line-height: 1.3;
  transition: color 0.2s ease;
}

.toc-list > li > a:hover {
  color: var(--accent);
}

.toc-list ul {
  list-style: none;
  padding-left: 0.85rem;
  margin: 0.25rem 0 0 0;
  border-left: 1px solid var(--border);
}

.toc-list ul li {
  margin-bottom: 0.25rem;
}

.toc-list ul a {
  font-family: var(--font-body);
  font-size: 0.875rem;
  color: var(--text-muted);
  display: block;
  padding: 0.15rem 0 0.15rem 0.5rem;
  border-bottom: none;
  line-height: 1.45;
  transition: color 0.2s ease, padding-left 0.2s ease;
}

.toc-list ul a:hover {
  color: var(--accent);
  padding-left: 0.7rem;
}

/* ============================================================
   8. FAQ — details/summary accordion
   ============================================================ */
[data-content="faq"] > div {
  margin-bottom: 0.75rem;
}

[data-content="faq"] details {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
  transition: border-color 0.25s ease, box-shadow 0.25s ease;
}

[data-content="faq"] details[open] {
  border-color: var(--accent-secondary);
  box-shadow: var(--shadow-md);
}

[data-content="faq"] summary {
  list-style: none;
  cursor: pointer;
  padding: 1rem 3rem 1rem 1.25rem;
  position: relative;
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 1rem;
  color: var(--text-primary);
  line-height: 1.4;
  transition: color 0.2s ease;
  user-select: none;
}

[data-content="faq"] summary::-webkit-details-marker {
  display: none;
}

[data-content="faq"] summary:hover {
  color: var(--accent);
}

[data-content="faq"] summary::after {
  content: '+';
  position: absolute;
  right: 1.25rem;
  top: 50%;
  transform: translateY(-50%);
  font-family: var(--font-mono);
  font-size: 1.4rem;
  font-weight: 400;
  color: var(--accent);
  transition: transform 0.3s ease, content 0.2s ease;
  line-height: 1;
}

[data-content="faq"] details[open] summary::after {
  content: '−';
  transform: translateY(-50%) rotate(180deg);
}

[data-content="faq"] details > div {
  overflow: hidden;
  max-height: 0;
  opacity: 0;
  transition: max-height 0.35s ease, opacity 0.3s ease;
}

[data-content="faq"] details[open] > div {
  max-height: 1500px;
  opacity: 1;
}

[data-content="faq"] details > div p {
  margin: 0;
  padding: 0 1.25rem 1.25rem 1.25rem;
  color: var(--text-primary);
  text-align: left;
  line-height: 1.7;
}

/* ============================================================
   9. NAV BUTTONS — Back to top
   ============================================================ */
.nav-actions {
  display: flex;
  justify-content: center;
  gap: 1rem;
  margin-top: 2rem;
  flex-wrap: wrap;
}

.btn-nav {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.6rem 1.1rem;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-muted);
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  transition: color 0.2s ease, border-color 0.2s ease, transform 0.2s ease;
}

.btn-nav:hover, .btn-nav:focus {
  color: var(--accent);
  border-color: var(--accent);
  border-bottom-color: var(--accent);
  transform: translateY(-1px);
}

/* ============================================================
   10. FOOTER
   ============================================================ */
.site-footer {
  background: var(--footer-bg);
  border-top: 1px solid var(--border);
  padding: 3rem 1.5rem 1.5rem;
  font-size: 0.82rem;
  color: var(--text-muted);
  line-height: 1.6;
}

.footer-grid {
  max-width: 1200px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 2rem;
}

.footer-col h3 {
  font-family: var(--font-heading);
  font-size: 0.78rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--accent);
  margin: 0 0 1rem 0;
  font-weight: 500;
  scroll-margin-top: 2rem;
}

.footer-col p, .footer-col li {
  font-size: 0.8rem;
  color: var(--text-muted);
  line-height: 1.55;
  text-align: left;
}

.footer-col ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.footer-col li {
  margin-bottom: 0.55rem;
}

.footer-col a {
  color: var(--text-muted);
  border-bottom: 1px dotted var(--border-strong);
  transition: color 0.2s ease, border-color 0.2s ease;
}

.footer-col a:hover, .footer-col a:focus {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

.footer-bottom {
  max-width: 1200px;
  margin: 2.5rem auto 0;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
  font-size: 0.75rem;
  color: var(--text-muted);
}

.footer-bottom p {
  margin: 0;
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* ============================================================
   11. MEDIA QUERIES
   ============================================================ */
@media (max-width: 768px) {
  [data-content] {
    padding-left: 1rem;
    padding-right: 1rem;
  }

  .hero {
    padding-left: 1rem;
    padding-right: 1rem;
  }

  .hero-meta {
    flex-direction: row;
    font-size: 0.8rem;
  }

  /* Two-column components stack */
  .dos-donts {
    grid-template-columns: 1fr;
  }

  .at-a-glance {
    grid-template-columns: 1fr 1fr;
  }

  .at-a-glance > div {
    border-right: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
  }

  .at-a-glance > div:nth-child(2n) {
    border-right: none;
  }

  .at-a-glance > div:nth-last-child(-n+2):nth-child(odd),
  .at-a-glance > div:last-child {
    border-bottom: none;
  }

  .glossary-term p {
    flex-direction: column;
    gap: 0.35rem;
  }

  /* TOC to single column */
  .toc-list {
    column-count: 1;
  }

  /* Footer to 2 columns */
  .footer-grid {
    grid-template-columns: 1fr 1fr;
    gap: 1.75rem;
  }

  .footer-bottom {
    flex-direction: column;
    align-items: flex-start;
    text-align: left;
  }

  .section-bridge {
    padding: 0.5rem 0;
  }

  .section-bridge::before,
  .section-bridge::after {
    display: block;
    width: 60px;
    margin: 0.5rem auto;
  }

  .section-bridge p {
    display: block;
    max-width: 100%;
  }

  .site-header {
    padding: 0.75rem 1rem;
  }

  .header-inner {
    gap: 0.75rem;
  }

  .site-logo img {
    width: 150px;
  }

  .header-meta {
    gap: 0.5rem;
  }

  .header-meta .trust-marker,
  .header-meta .date-badge {
    font-size: 0.65rem;
    padding: 0.3rem 0.5rem;
  }

  .key-takeaway p {
    font-size: 1.15rem;
  }
}

@media (max-width: 480px) {
  .footer-grid {
    grid-template-columns: 1fr;
  }

  .at-a-glance {
    grid-template-columns: 1fr;
  }

  .at-a-glance > div {
    border-right: none;
    border-bottom: 1px solid var(--border);
  }

  .at-a-glance > div:last-child {
    border-bottom: none;
  }

  .header-meta {
    width: 100%;
    justify-content: flex-start;
  }
}

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

/* =========================================
   UNIVERSAL DESKTOP & MOBILE MENU + LOGO
   ========================================= */

/* Header Base */
.site-header {
    background-color: var(--color-bg, #121212);
    border-bottom: 1px solid var(--color-border, #333333);
    position: sticky;
    top: 0;
    z-index: 100;
}

/* Mobile defaults for navigation bar */
.top-navigation-bar {
    width: 100%;
    margin: 0 auto;
    padding: 15px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

/* Logo Fixes */
.site-logo {
    min-width: 180px;
    margin: 0;
}

.site-logo img {
    max-height: 50px !important;
    max-width: none !important;
    width: auto !important; 
    display: block;
    transition: transform 0.2s ease;
}

.site-logo img:hover {
    transform: scale(1.02);
}

/* Desktop Menu */
.site-nav--desktop {
    display: none; 
}

/* Desktop Grid Layout: Logo left, Menu center */
@media (min-width: 1024px) {
    .top-navigation-bar {
        max-width: 100%;
        padding: 15px 40px; 
        display: flex; 
        justify-content: space-between;
        align-items: center;
        gap: 30px;
    }
    
    .site-nav--desktop {
        display: block;
        flex: 1; 
        min-width: 0; 
    }

    .mobile-controls {
        display: none; 
    }
    
    .site-nav--desktop ul {
        display: flex;
        flex-wrap: wrap; 
        justify-content: flex-end; 
        gap: 15px 25px; 
        list-style: none;
        margin: 0;
        padding: 0;
    }
    
    .site-nav--desktop a {
        text-decoration: none;
        color: var(--color-text, #ffffff);
        font-family: var(--font-body, sans-serif);
        font-weight: 500;
        font-size: 14px; 
        transition: color 0.2s ease;
        white-space: normal !important;
        line-height: 1.2;
    }
    
    .site-nav--desktop a:hover {
        color: var(--color-accent, #eab308);
    }
}

/* Mobile Burger Button */
.burger {
    background: transparent;
    border: none;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 5px;
    z-index: 1000;
}

.burger span {
    display: block;
    width: 28px;
    height: 3px;
    background-color: var(--color-text, #ffffff);
    transition: transform 0.3s ease, opacity 0.3s ease;
    border-radius: 2px;
}

/* Burger Animation to X */
.burger.is-active span:nth-child(1) {
    transform: translateY(9px) rotate(45deg);
}
.burger.is-active span:nth-child(2) {
    opacity: 0;
}
.burger.is-active span:nth-child(3) {
    transform: translateY(-9px) rotate(-45deg);
}

/* Mobile Menu Slider */
.mobile-menu {
    position: fixed;
    top: 0;
    right: -100%; 
    width: 85%;
    max-width: 400px;
    height: 100vh;
    background-color: var(--color-bg, #121212);
    box-shadow: -5px 0 20px rgba(0,0,0,0.5);
    transition: right 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 99999;
    overflow-y: auto;
    padding: 60px 30px;
}

.mobile-menu.is-open {
    right: 0; 
}

.mobile-menu__close {
    position: absolute;
    top: 20px;
    right: 20px;
    background: transparent;
    border: none;
    font-size: 36px;
    line-height: 1;
    color: var(--color-text, #ffffff);
    cursor: pointer;
    transition: color 0.2s ease;
}

.mobile-menu__close:hover {
    color: var(--color-accent, #eab308);
}

.menu-mobile {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 25px;
}

.menu-mobile a {
    text-decoration: none;
    color: var(--color-text, #ffffff);
    font-size: 20px;
    font-family: var(--font-display, sans-serif);
    font-weight: 600;
    display: block;
    transition: color 0.2s ease, padding-left 0.2s ease;
}

.menu-mobile a:hover {
    color: var(--color-accent, #eab308);
    padding-left: 10px; 
}

/* Overlay */
.mobile-menu-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(3px); 
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.4s ease, visibility 0.4s;
    z-index: 99998;
}

.mobile-menu-overlay.is-active {
    opacity: 1;
    visibility: visible;
}

.sitemap-main{
  max-width: 900px;
  margin: 0 auto;
  padding: 24px;
}

.sitemap-title{
  margin: 0 0 8px;
  text-align: center;
}

.sitemap-subtitle{
  margin: 0 0 24px;
  text-align: center;
  opacity: 0.75;
}

.sitemap-list{
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 10px;
}

.sitemap-link{
  display: block;
  padding: 12px 14px;
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 12px;
  text-decoration: none;
}

.sitemap-link:hover{
  border-color: rgba(255,255,255,0.2);
}

/* ===== Universal hub (NO body_class needed) ===== */

main.hub-children-main{
  padding-bottom: 48px;
}

/* Article wrapper */
main.hub-children-main .hub-children-article{
  max-width: 1100px;
  margin-left: auto;
  margin-right: auto;
  padding-left: 16px;
  padding-right: 16px;
}

/* Header */
main.hub-children-main .hub-children-header{
  text-align: center;
  margin-top: 24px;
  margin-bottom: 24px;
}

main.hub-children-main .hub-children-title{
  margin: 0 0 10px;
}

main.hub-children-main .hub-children-intro{
  max-width: 900px;
  margin: 0 auto;
  opacity: .9;
}

/* Grid */
main.hub-children-main .hub-children-grid{
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 26px;
  margin-top: 12px;
}

/* Card */
main.hub-children-main .hub-children-card{
  display: block;
  text-decoration: none;
}

main.hub-children-main .hub-children-card__media{
  position: relative;
  border-radius: 18px;
  overflow: hidden;
  background: rgba(255,255,255,0.06);
  box-shadow: 0 10px 28px rgba(0,0,0,.18);
  transition: transform .22s ease, box-shadow .22s ease;
}

main.hub-children-main .hub-children-card:hover .hub-children-card__media{
  transform: translateY(-4px);
  box-shadow: 0 16px 40px rgba(0,0,0,.28);
}

/* Image */
main.hub-children-main .hub-children-card__img{
  width: 100%;
  aspect-ratio: 16 / 9;
  background-size: cover;
  background-position: center;
}

/* Overlay */
main.hub-children-main .hub-children-card__overlay{
  position: absolute;
  inset: 0;
  background: linear-gradient(
    180deg,
    rgba(0,0,0,0.08) 0%,
    rgba(0,0,0,0.42) 55%,
    rgba(0,0,0,0.70) 100%
  );
}

/* Text */
main.hub-children-main .hub-children-card__content{
  position: absolute;
  left: 18px;
  right: 18px;
  bottom: 16px;
}

main.hub-children-main .hub-children-card__title{
  margin: 0;
  font-size: 18px;
  line-height: 1.25;
  font-weight: 700;
  color: #fff;
  text-shadow: 0 6px 18px rgba(0,0,0,.55);
}

/* Responsive */
@media (max-width: 1024px){
  main.hub-children-main .hub-children-grid{
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
  }
}

@media (max-width: 640px){
  main.hub-children-main .hub-children-grid{
    grid-template-columns: 1fr;
  }
}

.home main > *:not([data-content="hero"]):not(.cl-header):not(header):not(.cl-hero),
.home main article > *:not([data-content="hero"]):not(.cl-header):not(header):not(.cl-hero) {
    max-width: var(--content-max-width, 940px) !important;
    margin-left: auto !important;
    margin-right: auto !important;
    padding-left: 1rem !important;
    padding-right: 1rem !important;
    box-sizing: border-box !important;
}

.home main iframe,
.home main article iframe {
    max-width: 100% !important;
    margin-left: auto !important;
    margin-right: auto !important;
    transform: none !important;
    width: 100% !important;
}

/* ===== ХЛЕБНЫЕ КРОШКИ (BREADCRUMBS) - LIGHT & DARK ===== */

/* БАЗОВАЯ (СВЕТЛАЯ) ТЕМА */
#crumbs {
    padding: 10px 0;
    margin-bottom: 20px;
    font-size: 14px;
    color: #64748b; 
    text-align: center; 
}

#crumbs a {
    text-decoration: none;
    color: #475569; 
    transition: color 0.2s ease;
}

#crumbs a:hover {
    color: #2563eb; 
    text-decoration: underline;
}

#crumbs .current {
    font-weight: 600;
    color: #0f172a; 
}

/* ТЕМНАЯ ТЕМА (Автоматическое переключение) */
@media (prefers-color-scheme: dark) {
    #crumbs {
        color: rgba(255, 255, 255, 0.5); 
    }

    #crumbs a {
        color: rgba(255, 255, 255, 0.7); 
    }

    #crumbs a:hover {
        color: #ffffff; 
    }

    #crumbs .current {
        color: #ffffff; 
    }
}

/* =========================================
   СТИЛИ ДЛЯ ОГЛАВЛЕНИЯ (TOC) - LIGHT & DARK
   ========================================= */

/* БАЗОВАЯ (СВЕТЛАЯ) ТЕМА */
.toc-card {
    background: #f8fafc; 
    border: 1px solid #e2e8f0; 
    border-radius: 10px;
    padding: 25px 30px;
    margin: 40px 0;
    box-shadow: 0 2px 4px rgba(0,0,0,0.02);
}

.toc-card h2 {
    margin-top: 0;
    margin-bottom: 20px;
    font-size: 24px;
    color: #1e293b; 
    border-bottom: 1px solid #e2e8f0;
    padding-bottom: 15px;
}

.toc-columns {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.toc-group a {
    color: #475569 !important; 
    text-decoration: none;
    font-size: 16px;
    line-height: 1.5;
    transition: color 0.2s ease, transform 0.2s ease;
    display: inline-block;
}

.toc-group a:hover {
    color: #2563eb !important; 
    transform: translateX(4px);
}

/* Две колонки на компьютерах */
@media (min-width: 768px) {
    .toc-columns {
        display: grid;
        grid-template-columns: 1fr 1fr;
        column-gap: 40px;
    }
}

/* ТЕМНАЯ ТЕМА */
@media (prefers-color-scheme: dark) {
    .toc-card {
        background: #1a1a1f;
        border-color: #2d2d35;
        box-shadow: none;
    }

    .toc-card h2 {
        color: #ffffff;
        border-bottom-color: #2d2d35;
    }

    .toc-group a {
        color: #a0a0b0 !important; 
    }

    .toc-group a:hover {
        color: #ffffff !important; 
    }
}

/* =========================================
   CUSTOM USER STYLES (AUTOMATIC INJECTION)
   ========================================= */

/* Grid for child pages */
.child-pages-small-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
}
@media (max-width: 768px) {
    .child-pages-small-grid {
        grid-template-columns: 1fr;
    }
}

/* Universal Image Scaling & Styling */
.cl-hero img,
.content-article img,
img.article-image,
img.wp-post-image {
    max-width: 100%;
    width: 100%;
    height: auto !important;
    object-fit: cover;
    border-radius: 8px;
    display: block;
    margin: 0 auto;
}
