:root {
  --c-dark: #141838;
  --c-paper: #F7F5F3;
  --c-text: #151723;
  --c-brand: #142CEB;
  --c-accent: #6EAFED;
  --radius-card: 8px;
  --radius-btn: 6px;
  --card-border: 2px solid var(--c-text);
  --card-shadow: 4px 4px 0 var(--c-text);
  --section-y: clamp(3.5rem, 7vw, 6rem);
  --gap: clamp(1rem, 2vw, 1.75rem);
  --content-max: 1120px;
  --lh-body: 1.65;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 16px;
  line-height: var(--lh-body);
  color: var(--c-text);
  background-color: var(--c-paper);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

img, svg { display: block; max-width: 100%; height: auto; }

/* Typography */
h1, h2, h3, h4 {
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.1;
  margin: 0 0 0.6em;
}
h1 { font-size: clamp(2.4rem, 6vw, 4.5rem); }
h2 { font-size: clamp(1.6rem, 3vw, 2.4rem); line-height: 1.25; margin-top: 0; }
h3 { font-size: clamp(1.2rem, 2vw, 1.5rem); margin-top: 0; }
p { margin: 0 0 1em; }
small, .text-sm { font-size: 0.875rem; }
mark, .hl {
  font-weight: 700;
  padding: 0 0.15em;
  border-radius: 2px;
}
.bg-paper .hl { color: var(--c-brand); background: transparent; }
.bg-dark .hl { color: var(--c-accent); background: transparent; }
a { color: var(--c-brand); text-decoration: underline; text-underline-offset: 0.2em; }
.bg-dark a { color: var(--c-accent); }

/* Layout */
.container { width: 100%; max-width: var(--content-max); margin: 0 auto; padding: 0 var(--gap); }
.section { padding-block: var(--section-y); position: relative; }
.bg-dark { background-color: var(--c-dark); color: var(--c-paper); }
.bg-paper { background-color: var(--c-paper); color: var(--c-text); }

/* Newspaper Hero Grid */
.hero-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--gap);
  border-bottom: 1px solid rgba(247,245,243,0.15);
  padding-bottom: var(--gap);
}
.hero-col { display: flex; flex-direction: column; justify-content: center; }
.hero-divider { border-right: 1px solid rgba(247,245,243,0.15); overflow-x: hidden; }
@media (max-width: 768px) {
  .hero-grid { grid-template-columns: 1fr; }
  .hero-divider { border-right: none; border-bottom: 1px solid rgba(247,245,243,0.15); padding-bottom: var(--gap); }
}

/* Components */
.badge {
  display: inline-flex; align-items: center; gap: 0.4em;
  font-size: 0.75rem; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase;
  margin-bottom: 0.8em;
}
.bg-paper .badge { color: var(--c-brand); }
.bg-dark .badge { color: var(--c-accent); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.6em;
  height: 52px; padding: 0 1.5em;
  font-size: 1rem; font-weight: 600; line-height: 1;
  border-radius: var(--radius-btn);
  text-decoration: none; cursor: pointer;
  transition: transform 0.2s ease, background-color 0.2s ease, color 0.2s ease;
  white-space: nowrap;
}
.btn-primary {
  background-color: var(--c-accent); color: var(--c-dark);
  border: none;
}
.btn-primary:hover { transform: translateY(-2px); background-color: #5da0e0; }
.btn-secondary {
  background: transparent;
  border: 2px solid var(--c-text); color: var(--c-text);
}
.bg-dark .btn-secondary { border-color: var(--c-paper); color: var(--c-paper); }
.bg-dark .btn-secondary:hover { background: rgba(247,245,243,0.08); }
.btn:focus-visible { outline: 3px solid var(--c-accent); outline-offset: 2px; }

.card {
  background: var(--c-paper); color: var(--c-text);
  border: var(--card-border);
  box-shadow: var(--card-shadow);
  border-radius: var(--radius-card);
  padding: var(--gap);
  height: 100%;
  display: flex; flex-direction: column;
}
.theme-card {
  background: var(--c-paper); color: var(--c-text);
  border: var(--card-border);
  box-shadow: var(--card-shadow);
  border-radius: var(--radius-card);
  padding: var(--gap);
}
.theme-card .hl { color: var(--c-brand); }

table { width: 100%; border-collapse: collapse; margin: 1em 0; }
th, td { padding: 0.8em 1em; text-align: left; border-bottom: 1px solid rgba(21,23,35,0.1); }
th { font-weight: 700; background: rgba(20,44,235,0.04); }
.bg-dark th { background: rgba(247,245,243,0.06); border-bottom-color: rgba(247,245,243,0.15); }

details { border: var(--card-border); border-radius: var(--radius-card); margin-bottom: 0.8em; background: var(--c-paper); }
summary { padding: 1em; font-weight: 600; cursor: pointer; list-style: none; display: flex; justify-content: space-between; align-items: center; }
summary::-webkit-details-marker { display: none; }
summary::after { content: "+"; font-weight: 400; }
details[open] summary::after { content: "-"; }
details > div { padding: 0 1em 1em; }

/* Header & Footer */
header { position: sticky; top: 0; z-index: 100; background: rgba(247,245,243,0.95); backdrop-filter: blur(8px); border-bottom: 1px solid rgba(21,23,35,0.08); }
.nav-wrap { display: flex; align-items: center; justify-content: space-between; height: 64px; }
.brand { display: flex; align-items: center; gap: 0.6em; font-weight: 800; font-size: 1.1rem; color: var(--c-text); text-decoration: none; }
.brand img { width: 28px; height: 28px; object-fit: contain; }
nav ul { display: flex; gap: 1.5em; list-style: none; margin: 0; padding: 0; }
nav a { text-decoration: none; font-weight: 500; color: var(--c-text); opacity: 0.8; transition: opacity 0.2s; }
nav a:hover, nav [aria-current="page"] { opacity: 1; color: var(--c-brand); }
footer { background: var(--c-dark); color: var(--c-paper); padding: var(--section-y) 0; }
.footer-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: var(--gap); }
.footer-col h4 { margin-top: 0; font-size: 1rem; color: var(--c-accent); }
.footer-col ul { list-style: none; padding: 0; margin: 0.5em 0 0; }
.footer-col a { color: rgba(247,245,243,0.8); text-decoration: none; display: block; padding: 0.3em 0; }
.footer-col a:hover { color: var(--c-paper); }
.copyright { margin-top: var(--gap); padding-top: var(--gap); border-top: 1px solid rgba(247,245,243,0.1); text-align: center; font-size: 0.85rem; opacity: 0.7; }

/* SVG Utilities */
.svg-responsive { width: 100%; height: auto; max-width: 100%; }
.svg-panel { background: var(--c-dark); border-radius: var(--radius-card); padding: var(--gap); box-shadow: var(--card-shadow); border: 2px solid var(--c-text); }
.bg-dark .svg-panel { background: rgba(247,245,243,0.05); border-color: rgba(247,245,243,0.2); }

/* Animations */
@keyframes grid-light {
  0%, 100% { opacity: 0.25; transform: scale(0.85); }
  50% { opacity: 1; transform: scale(1.15); }
}
.grid-node { animation: grid-light 5s ease-in-out infinite; transform-box: fill-box; transform-origin: center; }
.grid-node:nth-child(odd) { animation-delay: 0.2s; }
.grid-node:nth-child(3n) { animation-delay: 0.6s; }
.grid-node:nth-child(5n) { animation-delay: 1.0s; }

@keyframes dash-flow {
  0%, 100% { stroke-dashoffset: 0; }
  50% { stroke-dashoffset: 1; }
}
.flow-line { stroke-dasharray: 1; stroke-dashoffset: 0; animation: dash-flow 2.5s linear infinite; }

@keyframes float-slow {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}
.float-layer { animation: float-slow 6s ease-in-out infinite; transform-box: fill-box; transform-origin: center; }

@media (prefers-reduced-motion: reduce) {
  .grid-node, .flow-line, .float-layer, [class*="anim"] { animation: none !important; }
  html { scroll-behavior: auto; }
}
