/* ==========================================================================
   Diffusion Science — Stylesheet
   Brand: Diffusion Science | Tagline: Understanding how things spread
   ========================================================================== */

/* ---------- Design Tokens ---------- */
:root {
  /* Color Palette */
  --navy: #0F1B2D;
  --navy-light: #1a2942;
  --navy-lighter: #243352;
  --cyan: #06B6D4;
  --cyan-light: #22d3ee;
  --cyan-dim: #0891b2;
  --white: #F8FAFC;
  --violet: #8B5CF6;
  --violet-light: #a78bfa;
  --violet-dim: #7c3aed;
  --slate: #64748B;
  --slate-light: #94a3b8;
  --slate-dark: #475569;

  /* Semantic */
  --bg: var(--navy);
  --bg-card: var(--navy-light);
  --bg-elevated: var(--navy-lighter);
  --text: var(--white);
  --text-muted: var(--slate-light);
  --text-subtle: var(--slate);
  --accent: var(--cyan);
  --accent-alt: var(--violet);
  --border: rgba(148, 163, 184, 0.15);
  --border-strong: rgba(148, 163, 184, 0.3);

  /* Typography */
  --font-display: 'Space Grotesk', sans-serif;
  --font-body: 'Inter', sans-serif;

  /* Spacing */
  --space-xs: 0.5rem;
  --space-sm: 0.75rem;
  --space-md: 1.25rem;
  --space-lg: 2rem;
  --space-xl: 3rem;
  --space-2xl: 5rem;

  /* Radius */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 20px;
  --radius-full: 999px;

  /* Transitions */
  --transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);

  /* Layout */
  --max-width: 1200px;
  --content-width: 760px;
  --header-height: 72px;
}

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

html {
  scroll-behavior: smooth;
  font-size: 16px;
}

body {
  font-family: var(--font-body);
  background-color: var(--bg);
  color: var(--text);
  line-height: 1.7;
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

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

a {
  color: var(--cyan);
  text-decoration: none;
  transition: color var(--transition);
}

a:hover {
  color: var(--cyan-light);
}

ul, ol {
  list-style-position: inside;
}

/* ---------- Typography ---------- */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-display);
  font-weight: 600;
  line-height: 1.25;
  letter-spacing: -0.02em;
  color: var(--text);
}

h1 { font-size: clamp(2rem, 5vw, 3.2rem); }
h2 { font-size: clamp(1.6rem, 4vw, 2.4rem); }
h3 { font-size: clamp(1.3rem, 3vw, 1.75rem); }
h4 { font-size: 1.25rem; }

p { margin-bottom: var(--space-md); }

p:last-child { margin-bottom: 0; }

.lead {
  font-size: 1.2rem;
  color: var(--text-muted);
  line-height: 1.6;
}

.text-cyan { color: var(--cyan); }
.text-violet { color: var(--violet); }
.text-muted { color: var(--text-muted); }

/* ---------- Layout Helpers ---------- */
.container {
  width: 100%;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 var(--space-lg);
}

.content-container {
  max-width: var(--content-width);
  margin: 0 auto;
}

.section {
  padding: var(--space-2xl) 0;
}

.section-sm {
  padding: var(--space-xl) 0;
}

.text-center { text-align: center; }

.gradient-text {
  background: linear-gradient(135deg, var(--cyan), var(--violet));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* ---------- Header / Navigation ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 1000;
  background: rgba(15, 27, 45, 0.85);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
  height: var(--header-height);
  display: flex;
  align-items: center;
}

.nav {
  width: 100%;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 var(--space-lg);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-lg);
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  flex-shrink: 0;
}

.nav-brand img {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
}

.nav-brand-text {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.15rem;
  color: var(--text);
  letter-spacing: -0.02em;
}

.nav-brand-text span {
  color: var(--cyan);
}

.nav-links {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  list-style: none;
}

.nav-links a {
  color: var(--text-muted);
  font-size: 0.92rem;
  font-weight: 500;
  padding: var(--space-xs) 0;
  position: relative;
  transition: color var(--transition);
}

.nav-links a:hover,
.nav-links a.active {
  color: var(--text);
}

.nav-links a.active::after {
  content: '';
  position: absolute;
  bottom: -4px;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--cyan), var(--violet));
  border-radius: var(--radius-full);
}

.nav-toggle {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: var(--space-xs);
  color: var(--text);
}

.nav-toggle span {
  display: block;
  width: 24px;
  height: 2px;
  background: var(--text);
  margin: 5px 0;
  transition: var(--transition);
  border-radius: 2px;
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: var(--space-xs);
  padding: 0.7rem 1.5rem;
  border-radius: var(--radius-full);
  font-family: var(--font-body);
  font-weight: 500;
  font-size: 0.95rem;
  cursor: pointer;
  transition: all var(--transition);
  border: none;
  text-decoration: none;
}

.btn-primary {
  background: linear-gradient(135deg, var(--cyan), var(--cyan-dim));
  color: var(--navy);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(6, 182, 212, 0.3);
  color: var(--navy);
}

.btn-outline {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border-strong);
}

.btn-outline:hover {
  border-color: var(--cyan);
  color: var(--cyan);
}

/* ---------- Hero Section ---------- */
.hero {
  position: relative;
  padding: var(--space-2xl) 0;
  overflow: hidden;
}

.hero-bg {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 0;
}

.hero-bg img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0.35;
}

.hero-bg::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(15,27,45,0.6) 0%, rgba(15,27,45,0.9) 70%, var(--navy) 100%);
}

.hero-content {
  position: relative;
  z-index: 1;
  max-width: 680px;
}

.hero-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: var(--space-xs);
  padding: 0.4rem 1rem;
  background: rgba(6, 182, 212, 0.1);
  border: 1px solid rgba(6, 182, 212, 0.25);
  border-radius: var(--radius-full);
  font-size: 0.82rem;
  color: var(--cyan);
  font-weight: 500;
  margin-bottom: var(--space-md);
}

.hero h1 {
  margin-bottom: var(--space-md);
}

.hero .lead {
  margin-bottom: var(--space-lg);
  max-width: 560px;
}

.hero-actions {
  display: flex;
  gap: var(--space-sm);
  flex-wrap: wrap;
}

/* ---------- Featured Article ---------- */
.featured {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: var(--space-xl);
  align-items: center;
}

.featured-image {
  border-radius: var(--radius-lg);
  overflow: hidden;
  position: relative;
  aspect-ratio: 16 / 10;
}

.featured-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.5s ease;
}

.featured-image:hover img {
  transform: scale(1.03);
}

.featured-content .tag {
  display: inline-block;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--violet);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: var(--space-sm);
}

.featured-content h2 {
  margin-bottom: var(--space-sm);
  line-height: 1.2;
}

.featured-content h2 a {
  color: var(--text);
}

.featured-content h2 a:hover {
  color: var(--cyan);
}

.featured-excerpt {
  color: var(--text-muted);
  margin-bottom: var(--space-md);
}

.article-meta {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  font-size: 0.85rem;
  color: var(--text-subtle);
}

.article-meta .dot {
  width: 3px;
  height: 3px;
  background: var(--slate);
  border-radius: 50%;
}

/* ---------- Topic Hubs ---------- */
.topic-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-md);
  margin-top: var(--space-xl);
}

.topic-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  transition: all var(--transition);
  text-decoration: none;
  color: var(--text);
  display: block;
}

.topic-card:hover {
  border-color: var(--cyan);
  transform: translateY(-4px);
  box-shadow: 0 12px 40px rgba(6, 182, 212, 0.08);
  color: var(--text);
}

.topic-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: var(--space-md);
  font-size: 1.5rem;
}

.topic-icon.cyan { background: rgba(6, 182, 212, 0.12); color: var(--cyan); }
.topic-icon.violet { background: rgba(139, 92, 246, 0.12); color: var(--violet); }
.topic-icon.slate { background: rgba(100, 116, 139, 0.12); color: var(--slate-light); }

.topic-card h3 {
  font-size: 1.15rem;
  margin-bottom: var(--space-xs);
}

.topic-card p {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-bottom: 0;
}

.topic-card .count {
  font-size: 0.8rem;
  color: var(--text-subtle);
  margin-top: var(--space-sm);
}

/* ---------- Section Header ---------- */
.section-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  margin-bottom: var(--space-xl);
  gap: var(--space-md);
}

.section-header h2 {
  margin-bottom: 0;
}

.section-header .subtitle {
  color: var(--text-muted);
  margin-top: var(--space-xs);
}

.section-link {
  font-size: 0.9rem;
  font-weight: 500;
  white-space: nowrap;
}

/* ---------- Article Cards Grid ---------- */
.article-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-lg);
}

.article-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: all var(--transition);
  display: flex;
  flex-direction: column;
}

.article-card:hover {
  border-color: var(--border-strong);
  transform: translateY(-4px);
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.2);
}

.article-card-image {
  aspect-ratio: 3 / 2;
  overflow: hidden;
}

.article-card-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.5s ease;
}

.article-card:hover .article-card-image img {
  transform: scale(1.05);
}

.article-card-body {
  padding: var(--space-md);
  flex: 1;
  display: flex;
  flex-direction: column;
}

.article-card .tag {
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: var(--space-xs);
}

.tag.ml { color: var(--cyan); }
.tag.physics { color: var(--violet); }
.tag.chem { color: var(--cyan-light); }
.tag.bio { color: var(--violet-light); }
.tag.visual { color: var(--slate-light); }
.tag.research { color: var(--cyan); }

.article-card h3 {
  font-size: 1.1rem;
  line-height: 1.35;
  margin-bottom: var(--space-xs);
}

.article-card h3 a {
  color: var(--text);
}

.article-card h3 a:hover {
  color: var(--cyan);
}

.article-card p {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-bottom: var(--space-md);
  flex: 1;
}

.article-card .article-meta {
  margin-top: auto;
}

/* ---------- Diagram / Visual Section ---------- */
.diagram-section {
  background: linear-gradient(180deg, var(--navy) 0%, var(--navy-light) 100%);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

.diagram-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-2xl);
  align-items: center;
}

.diagram-visual {
  border-radius: var(--radius-lg);
  overflow: hidden;
  aspect-ratio: 4 / 3;
  border: 1px solid var(--border);
}

.diagram-visual img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.diagram-step {
  display: flex;
  gap: var(--space-md);
  margin-bottom: var(--space-lg);
}

.diagram-step:last-child { margin-bottom: 0; }

.diagram-step-num {
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--cyan), var(--violet));
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-weight: 600;
  color: var(--navy);
  font-size: 1rem;
}

.diagram-step-content h4 {
  margin-bottom: var(--space-xs);
}

.diagram-step-content p {
  color: var(--text-muted);
  font-size: 0.92rem;
  margin-bottom: 0;
}

/* ---------- Newsletter ---------- */
.newsletter {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-xl);
  text-align: center;
}

.newsletter h2 {
  margin-bottom: var(--space-sm);
}

.newsletter p {
  color: var(--text-muted);
  max-width: 480px;
  margin: 0 auto var(--space-lg);
}

.newsletter-form {
  display: flex;
  gap: var(--space-sm);
  max-width: 440px;
  margin: 0 auto;
}

.newsletter-form input {
  flex: 1;
  padding: 0.7rem 1.2rem;
  border-radius: var(--radius-full);
  border: 1px solid var(--border-strong);
  background: var(--navy);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 0.95rem;
}

.newsletter-form input:focus {
  outline: none;
  border-color: var(--cyan);
}

/* ---------- Page Header ---------- */
.page-header {
  padding: var(--space-2xl) 0 var(--space-xl);
  border-bottom: 1px solid var(--border);
}

.page-header h1 {
  margin-bottom: var(--space-sm);
}

.page-header .lead {
  max-width: 560px;
}

.breadcrumb {
  display: flex;
  gap: var(--space-xs);
  font-size: 0.85rem;
  color: var(--text-subtle);
  margin-bottom: var(--space-md);
}

.breadcrumb a {
  color: var(--text-subtle);
}

.breadcrumb a:hover {
  color: var(--cyan);
}

.breadcrumb .sep {
  color: var(--slate-dark);
}

/* ---------- Article List ---------- */
.article-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-lg);
}

.article-list-item {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: var(--space-lg);
  padding: var(--space-lg) 0;
  border-bottom: 1px solid var(--border);
}

.article-list-item:last-child { border-bottom: none; }

.article-list-item .thumb {
  border-radius: var(--radius-md);
  overflow: hidden;
  aspect-ratio: 3 / 2;
}

.article-list-item .thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.5s ease;
}

.article-list-item:hover .thumb img {
  transform: scale(1.05);
}

.article-list-item h3 {
  font-size: 1.35rem;
  margin-bottom: var(--space-xs);
}

.article-list-item h3 a {
  color: var(--text);
}

.article-list-item h3 a:hover {
  color: var(--cyan);
}

.article-list-item p {
  color: var(--text-muted);
  font-size: 0.95rem;
  margin-bottom: var(--space-sm);
}

/* ---------- Article Page ---------- */
.article-hero {
  padding: var(--space-xl) 0 var(--space-lg);
}

.article-hero .tag {
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: var(--space-sm);
  display: inline-block;
}

.article-hero h1 {
  font-size: clamp(1.8rem, 4vw, 2.8rem);
  margin-bottom: var(--space-md);
  line-height: 1.2;
}

.article-hero .article-meta {
  margin-bottom: var(--space-lg);
}

.article-hero-image {
  border-radius: var(--radius-lg);
  overflow: hidden;
  aspect-ratio: 16 / 9;
  margin-bottom: var(--space-xl);
}

.article-hero-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.article-body {
  max-width: var(--content-width);
  margin: 0 auto;
}

.article-body p, .article-body ul, .article-body ol {
  margin-bottom: var(--space-md);
}

.article-body h2 {
  margin-top: var(--space-xl);
  margin-bottom: var(--space-md);
  font-size: 1.6rem;
}

.article-body h3 {
  margin-top: var(--space-lg);
  margin-bottom: var(--space-sm);
  font-size: 1.3rem;
}

.article-body ul, .article-body ol {
  color: var(--text-muted);
  padding-left: var(--space-md);
  list-style-position: outside;
}

.article-body li {
  margin-bottom: var(--space-xs);
}

.article-body strong {
  color: var(--text);
  font-weight: 600;
}

.article-body blockquote {
  border-left: 3px solid var(--cyan);
  padding-left: var(--space-md);
  margin: var(--space-lg) 0;
  font-style: italic;
  color: var(--text-muted);
}

.article-body code {
  background: var(--bg-elevated);
  padding: 0.15rem 0.4rem;
  border-radius: 4px;
  font-size: 0.88em;
  font-family: 'JetBrains Mono', 'Courier New', monospace;
  color: var(--cyan-light);
}

.article-body pre {
  background: var(--bg-elevated);
  padding: var(--space-md);
  border-radius: var(--radius-md);
  overflow-x: auto;
  margin-bottom: var(--space-md);
  border: 1px solid var(--border);
}

.article-body pre code {
  background: none;
  padding: 0;
  color: var(--text);
}

/* Callout box */
.callout {
  background: rgba(6, 182, 212, 0.06);
  border: 1px solid rgba(6, 182, 212, 0.2);
  border-radius: var(--radius-md);
  padding: var(--space-md);
  margin: var(--space-lg) 0;
}

.callout-title {
  font-family: var(--font-display);
  font-weight: 600;
  color: var(--cyan);
  font-size: 0.9rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: var(--space-xs);
}

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

/* Article footer */
.article-footer {
  max-width: var(--content-width);
  margin: var(--space-xl) auto 0;
  padding-top: var(--space-xl);
  border-top: 1px solid var(--border);
}

.article-nav {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-md);
  margin-bottom: var(--space-xl);
}

.article-nav-item {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: var(--space-md);
  transition: border-color var(--transition);
}

.article-nav-item:hover {
  border-color: var(--cyan);
}

.article-nav-item .label {
  font-size: 0.78rem;
  color: var(--text-subtle);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: var(--space-xs);
}

.article-nav-item h4 {
  font-size: 1rem;
  margin: 0;
}

.article-nav-item a {
  color: var(--text);
}

.article-nav-item.next {
  text-align: right;
}

/* ---------- Glossary ---------- */
.glossary-search {
  margin-bottom: var(--space-xl);
}

.glossary-search input {
  width: 100%;
  max-width: 500px;
  padding: 0.8rem 1.2rem;
  border-radius: var(--radius-full);
  border: 1px solid var(--border-strong);
  background: var(--bg-card);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 1rem;
}

.glossary-search input:focus {
  outline: none;
  border-color: var(--cyan);
}

.glossary-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-md);
}

.glossary-item {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: var(--space-md);
  transition: border-color var(--transition);
}

.glossary-item:hover {
  border-color: var(--cyan);
}

.glossary-item .term {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.1rem;
  margin-bottom: var(--space-xs);
  color: var(--text);
}

.glossary-item .term .letter-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: var(--radius-sm);
  background: rgba(6, 182, 212, 0.12);
  color: var(--cyan);
  font-size: 0.85rem;
  margin-right: var(--space-xs);
  vertical-align: middle;
}

.glossary-item .def {
  color: var(--text-muted);
  font-size: 0.92rem;
  line-height: 1.6;
}

.glossary-item .category-tag {
  display: inline-block;
  font-size: 0.72rem;
  color: var(--text-subtle);
  margin-top: var(--space-sm);
}

/* ---------- About Page ---------- */
.about-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-2xl);
  align-items: start;
}

.about-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  margin-top: var(--space-md);
}

.about-card h3 {
  font-size: 1.2rem;
  margin-bottom: var(--space-sm);
  color: var(--cyan);
}

.about-card p {
  color: var(--text-muted);
  font-size: 0.95rem;
}

/* ---------- Contact ---------- */
.contact-grid {
  display: grid;
  grid-template-columns: 1fr 1.2fr;
  gap: var(--space-2xl);
  align-items: start;
}

.contact-info-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  margin-bottom: var(--space-md);
}

.contact-info-card h3 {
  font-size: 1.1rem;
  margin-bottom: var(--space-xs);
}

.contact-info-card p {
  color: var(--text-muted);
  font-size: 0.92rem;
  margin-bottom: 0;
}

.contact-form {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-xl);
}

.form-group {
  margin-bottom: var(--space-md);
}

.form-group label {
  display: block;
  font-size: 0.88rem;
  font-weight: 500;
  margin-bottom: var(--space-xs);
  color: var(--text-muted);
}

.form-group input,
.form-group textarea,
.form-group select {
  width: 100%;
  padding: 0.75rem 1rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: var(--navy);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 0.95rem;
  transition: border-color var(--transition);
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
  outline: none;
  border-color: var(--cyan);
}

.form-group textarea {
  min-height: 140px;
  resize: vertical;
}

.form-feedback {
  padding: var(--space-md);
  border-radius: var(--radius-sm);
  background: rgba(6, 182, 212, 0.1);
  border: 1px solid rgba(6, 182, 212, 0.3);
  color: var(--cyan-light);
  font-size: 0.92rem;
  margin-top: var(--space-md);
  display: none;
}

.form-feedback.visible {
  display: block;
}

/* ---------- Legal / Content Pages ---------- */
.legal-content {
  max-width: var(--content-width);
  margin: 0 auto;
}

.legal-content h2 {
  margin-top: var(--space-xl);
  margin-bottom: var(--space-md);
}

.legal-content h2:first-child { margin-top: 0; }

.legal-content h3 {
  margin-top: var(--space-lg);
  margin-bottom: var(--space-sm);
}

.legal-content p, .legal-content li {
  color: var(--text-muted);
}

.legal-content ul {
  padding-left: var(--space-md);
  list-style-position: outside;
}

.legal-content li {
  margin-bottom: var(--space-xs);
}

.last-updated {
  font-size: 0.85rem;
  color: var(--text-subtle);
  margin-bottom: var(--space-lg);
}

/* ---------- Sitemap Page ---------- */
.sitemap-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-xl);
  margin-top: var(--space-xl);
}

.sitemap-section h3 {
  font-size: 1.1rem;
  margin-bottom: var(--space-md);
  color: var(--cyan);
}

.sitemap-section ul {
  list-style: none;
}

.sitemap-section li {
  margin-bottom: var(--space-xs);
}

.sitemap-section a {
  color: var(--text-muted);
  font-size: 0.95rem;
}

.sitemap-section a:hover {
  color: var(--cyan);
}

/* ---------- 404 ---------- */
.error-page {
  min-height: 60vh;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.error-code {
  font-family: var(--font-display);
  font-size: clamp(5rem, 15vw, 9rem);
  font-weight: 700;
  background: linear-gradient(135deg, var(--cyan), var(--violet));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  line-height: 1;
  margin-bottom: var(--space-md);
}

.error-page p {
  color: var(--text-muted);
  max-width: 420px;
  margin: 0 auto var(--space-lg);
}

/* ---------- Footer ---------- */
.site-footer {
  background: var(--navy-light);
  border-top: 1px solid var(--border);
  padding: var(--space-2xl) 0 var(--space-lg);
  margin-top: var(--space-2xl);
}

.footer-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr;
  gap: var(--space-xl);
  margin-bottom: var(--space-xl);
}

.footer-brand {
  max-width: 320px;
}

.footer-brand .nav-brand {
  margin-bottom: var(--space-md);
}

.footer-brand p {
  color: var(--text-muted);
  font-size: 0.92rem;
}

.footer-col h4 {
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text);
  margin-bottom: var(--space-md);
  font-family: var(--font-body);
  font-weight: 600;
}

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

.footer-col li {
  margin-bottom: var(--space-xs);
}

.footer-col a {
  color: var(--text-muted);
  font-size: 0.92rem;
}

.footer-col a:hover {
  color: var(--cyan);
}

.footer-bottom {
  padding-top: var(--space-lg);
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.85rem;
  color: var(--text-subtle);
  flex-wrap: wrap;
  gap: var(--space-sm);
}

.footer-bottom a {
  color: var(--text-subtle);
}

.footer-bottom a:hover {
  color: var(--cyan);
}

.footer-legal {
  display: flex;
  gap: var(--space-md);
}

/* ---------- Animations ---------- */
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(24px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes particleDrift {
  0% { transform: translate(0, 0); }
  50% { transform: translate(10px, -10px); }
  100% { transform: translate(0, 0); }
}

.animate-in {
  opacity: 0;
  animation: fadeInUp 0.6s ease forwards;
}

.animate-delay-1 { animation-delay: 0.1s; }
.animate-delay-2 { animation-delay: 0.2s; }
.animate-delay-3 { animation-delay: 0.3s; }
.animate-delay-4 { animation-delay: 0.4s; }

/* ---------- Responsive ---------- */
@media (max-width: 1024px) {
  .topic-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .article-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .footer-grid {
    grid-template-columns: 2fr 1fr 1fr;
  }
  .footer-brand {
    grid-column: 1 / -1;
  }
}

@media (max-width: 768px) {
  :root {
    --space-2xl: 3.5rem;
    --space-xl: 2.5rem;
  }

  .nav-links {
    display: none;
    position: absolute;
    top: var(--header-height);
    left: 0;
    right: 0;
    background: var(--navy);
    border-bottom: 1px solid var(--border);
    flex-direction: column;
    padding: var(--space-md) var(--space-lg);
    gap: var(--space-sm);
    align-items: flex-start;
  }

  .nav-links.open {
    display: flex;
  }

  .nav-toggle {
    display: block;
  }

  .nav-toggle.open span:nth-child(1) {
    transform: rotate(45deg) translate(5px, 5px);
  }
  .nav-toggle.open span:nth-child(2) {
    opacity: 0;
  }
  .nav-toggle.open span:nth-child(3) {
    transform: rotate(-45deg) translate(7px, -7px);
  }

  .featured {
    grid-template-columns: 1fr;
    gap: var(--space-md);
  }

  .diagram-grid {
    grid-template-columns: 1fr;
    gap: var(--space-xl);
  }

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

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

  .about-grid,
  .contact-grid {
    grid-template-columns: 1fr;
  }

  .article-list-item {
    grid-template-columns: 1fr;
  }

  .article-list-item .thumb {
    aspect-ratio: 16 / 9;
  }

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

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

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

  .footer-brand {
    grid-column: 1 / -1;
  }

  .article-nav {
    grid-template-columns: 1fr;
  }

  .article-nav-item.next {
    text-align: left;
  }

  .newsletter-form {
    flex-direction: column;
  }

  .section-header {
    flex-direction: column;
    align-items: flex-start;
  }
}

@media (max-width: 480px) {
  .container {
    padding: 0 var(--space-md);
  }
  .footer-grid {
    grid-template-columns: 1fr;
  }
  .footer-bottom {
    flex-direction: column;
    text-align: center;
  }
}

/* ---------- Reduced Motion ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
  .animate-in {
    opacity: 1;
    animation: none;
  }
}

