:root {
  --bg-primary: #080c10;
  --bg-secondary: #0d1117;
  --bg-card: #111820;
  --bg-card-hover: #151e28;
  --accent: #00d4e8;
  --accent-dim: #00a8ba;
  --accent-glow: rgba(0, 212, 232, 0.15);
  --accent-glow-strong: rgba(0, 212, 232, 0.3);
  --text-primary: #e8edf3;
  --text-secondary: #8da0b3;
  --text-muted: #4a6070;
  --border: rgba(0, 212, 232, 0.15);
  --border-strong: rgba(0, 212, 232, 0.3);
  --green: #00e87a;
  --amber: #e8a000;
  --red: #e83c3c;
  --purple-band: #9b00e8;
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', 'Consolas', monospace;
}

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

html {
  scroll-behavior: smooth;
}

body {
  background-color: var(--bg-primary);
  color: var(--text-primary);
  font-family: var(--font-sans);
  line-height: 1.6;
  min-height: 100vh;
}

/* Circuit background pattern */
body::before {
  content: '';
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background-image:
    linear-gradient(rgba(0,212,232,0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0,212,232,0.03) 1px, transparent 1px);
  background-size: 40px 40px;
  pointer-events: none;
  z-index: 0;
}

/* ── NAV ── */
nav {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(8, 12, 16, 0.92);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  padding: 0 2rem;
}

.nav-inner {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}

.nav-logo {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
}

.nav-logo img {
  width: 36px;
  height: 36px;
  object-fit: contain;
  filter: drop-shadow(0 0 6px var(--accent));
}

.nav-logo-text {
  font-family: var(--font-mono);
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--accent);
  letter-spacing: 0.1em;
  text-shadow: 0 0 12px var(--accent);
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 2rem;
  list-style: none;
}

.nav-links a {
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 0.875rem;
  font-weight: 500;
  letter-spacing: 0.05em;
  transition: color 0.2s;
  position: relative;
}

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

.nav-links a::after {
  content: '';
  position: absolute;
  bottom: -4px;
  left: 0; right: 0;
  height: 1px;
  background: var(--accent);
  transform: scaleX(0);
  transition: transform 0.2s;
}

.nav-links a:hover::after, .nav-links a.active::after {
  transform: scaleX(1);
}

/* Nav dropdown */
.nav-dropdown {
  position: relative;
}

.nav-dropdown > a {
  display: flex;
  align-items: center;
  gap: 4px;
}

.nav-dropdown > a::before {
  content: '';
  display: none;
}

.dropdown-caret {
  display: inline-block;
  width: 0;
  height: 0;
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  border-top: 4px solid currentColor;
  margin-left: 2px;
  opacity: 0.6;
  transition: transform 0.2s;
}

.nav-dropdown:hover .dropdown-caret,
.nav-dropdown:focus-within .dropdown-caret {
  transform: rotate(180deg);
}

.nav-dropdown-menu {
  display: none;
  position: absolute;
  top: calc(100% + 12px);
  left: 50%;
  transform: translateX(-50%);
  background: rgba(13,17,23,0.98);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.5rem 0;
  min-width: 190px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.5);
  z-index: 200;
  list-style: none;
}

.nav-dropdown-menu::before {
  content: '';
  position: absolute;
  top: -6px;
  left: 50%;
  transform: translateX(-50%);
  width: 10px;
  height: 10px;
  background: rgba(13,17,23,0.98);
  border-left: 1px solid var(--border);
  border-top: 1px solid var(--border);
  rotate: 45deg;
}

.nav-dropdown:hover .nav-dropdown-menu,
.nav-dropdown:focus-within .nav-dropdown-menu {
  display: block;
}

.nav-dropdown-menu li a {
  display: block;
  padding: 0.55rem 1.1rem;
  white-space: nowrap;
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.nav-dropdown-menu li a:hover {
  color: var(--accent);
  background: var(--accent-glow);
}

.nav-dropdown-menu li a::after {
  display: none;
}

.nav-cta {
  background: transparent;
  border: 1px solid var(--accent);
  color: var(--accent) !important;
  padding: 6px 16px;
  border-radius: 4px;
  transition: background 0.2s, box-shadow 0.2s !important;
}

.nav-cta:hover {
  background: var(--accent-glow) !important;
  box-shadow: 0 0 16px var(--accent-glow-strong);
}

.nav-cta::after {
  display: none !important;
}

/* hamburger */
.nav-toggle {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  flex-direction: column;
  gap: 5px;
  padding: 4px;
}

.nav-toggle span {
  display: block;
  width: 24px;
  height: 2px;
  background: var(--accent);
  transition: 0.2s;
}

/* ── MAIN LAYOUT ── */
main {
  position: relative;
  z-index: 1;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 2rem;
}

/* ── HERO ── */
.hero {
  padding: 8rem 2rem 6rem;
  text-align: center;
  position: relative;
  overflow: hidden;
}

.hero::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 600px;
  height: 600px;
  background: radial-gradient(circle, var(--accent-glow) 0%, transparent 70%);
  pointer-events: none;
}

.hero-logo {
  width: 160px;
  height: 160px;
  object-fit: contain;
  margin: 0 auto 2rem;
  display: block;
  filter: drop-shadow(0 0 24px var(--accent)) drop-shadow(0 0 48px rgba(0,212,232,0.3));
  animation: pulse-glow 3s ease-in-out infinite;
}

@keyframes pulse-glow {
  0%, 100% { filter: drop-shadow(0 0 24px var(--accent)) drop-shadow(0 0 48px rgba(0,212,232,0.3)); }
  50% { filter: drop-shadow(0 0 36px var(--accent)) drop-shadow(0 0 72px rgba(0,212,232,0.5)); }
}

.hero-eyebrow {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  letter-spacing: 0.3em;
  color: var(--accent);
  text-transform: uppercase;
  margin-bottom: 1rem;
}

.hero h1 {
  font-size: clamp(2.5rem, 6vw, 4.5rem);
  font-weight: 800;
  line-height: 1.1;
  margin-bottom: 1rem;
  background: linear-gradient(135deg, #fff 30%, var(--accent) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero-subtitle {
  font-family: var(--font-mono);
  font-size: 1rem;
  color: var(--accent);
  margin-bottom: 1.5rem;
  letter-spacing: 0.05em;
}

.hero-desc {
  font-size: 1.15rem;
  color: var(--text-secondary);
  max-width: 640px;
  margin: 0 auto 2.5rem;
  line-height: 1.7;
}

.hero-actions {
  display: flex;
  gap: 1rem;
  justify-content: center;
  flex-wrap: wrap;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 28px;
  border-radius: 4px;
  font-weight: 600;
  font-size: 0.9rem;
  text-decoration: none;
  transition: all 0.2s;
  cursor: pointer;
  border: none;
  letter-spacing: 0.03em;
}

.btn-primary {
  background: var(--accent);
  color: #000;
  box-shadow: 0 0 20px var(--accent-glow-strong);
}

.btn-primary:hover {
  background: #fff;
  box-shadow: 0 0 32px var(--accent);
  transform: translateY(-1px);
}

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

.btn-outline:hover {
  background: var(--accent-glow);
  box-shadow: 0 0 16px var(--accent-glow-strong);
  transform: translateY(-1px);
}

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

.btn-ghost:hover {
  color: var(--text-primary);
  border-color: var(--text-secondary);
}

/* ── BADGE ── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  border-radius: 2px;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.05em;
}

.badge-apache {
  background: rgba(0,212,232,0.1);
  border: 1px solid var(--border-strong);
  color: var(--accent);
}

.hero-badges {
  display: flex;
  gap: 0.75rem;
  justify-content: center;
  margin-bottom: 2rem;
  flex-wrap: wrap;
}

/* ── SECTION HEADERS ── */
section {
  padding: 5rem 0;
}

.section-label {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.3em;
  color: var(--accent);
  text-transform: uppercase;
  margin-bottom: 0.75rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.section-label::before {
  content: '//';
  opacity: 0.5;
}

.section-title {
  font-size: clamp(1.75rem, 4vw, 2.5rem);
  font-weight: 700;
  margin-bottom: 1rem;
  color: var(--text-primary);
}

.section-desc {
  font-size: 1.05rem;
  color: var(--text-secondary);
  max-width: 560px;
  line-height: 1.7;
}

/* ── CARDS ── */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1.75rem;
  transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
}

.card:hover {
  border-color: var(--border-strong);
  box-shadow: 0 0 24px var(--accent-glow);
  background: var(--bg-card-hover);
}

.card-icon {
  width: 40px;
  height: 40px;
  background: var(--accent-glow);
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 1rem;
  font-size: 1.25rem;
}

.card h3 {
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
  color: var(--text-primary);
}

.card p {
  font-size: 0.9rem;
  color: var(--text-secondary);
  line-height: 1.6;
}

/* ── THREE PILLARS ── */
.pillars-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.5rem;
  margin-top: 3rem;
}

.pillar-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 2rem;
  text-align: center;
  position: relative;
  overflow: hidden;
  transition: all 0.2s;
}

.pillar-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: var(--accent);
  box-shadow: 0 0 12px var(--accent);
}

.pillar-card:hover {
  border-color: var(--border-strong);
  box-shadow: 0 0 32px var(--accent-glow);
  transform: translateY(-2px);
}

.pillar-number {
  font-family: var(--font-mono);
  font-size: 3rem;
  font-weight: 800;
  color: var(--accent);
  opacity: 0.2;
  line-height: 1;
  margin-bottom: 0.5rem;
}

.pillar-card h3 {
  font-size: 1.25rem;
  font-weight: 700;
  margin-bottom: 0.75rem;
}

.pillar-card p {
  color: var(--text-secondary);
  font-size: 0.9rem;
  line-height: 1.6;
}

/* ── CRS FORMULA ── */
.formula-block {
  background: var(--bg-card);
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  padding: 2rem;
  margin: 2rem 0;
  text-align: center;
  position: relative;
  overflow: hidden;
}

.formula-block::before {
  content: 'FORMULA';
  position: absolute;
  top: 0.75rem;
  left: 1rem;
  font-family: var(--font-mono);
  font-size: 0.65rem;
  letter-spacing: 0.2em;
  color: var(--text-muted);
}

.formula-text {
  font-family: var(--font-mono);
  font-size: clamp(1rem, 2.5vw, 1.5rem);
  color: var(--accent);
  font-weight: 700;
  text-shadow: 0 0 20px var(--accent);
}

/* ── IMS SCALE ── */
.ims-scale {
  margin: 2rem 0;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.ims-row {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 1rem 1.25rem;
  transition: all 0.2s;
}

.ims-row:hover {
  border-color: var(--border-strong);
  background: var(--bg-card-hover);
}

.ims-badge {
  font-family: var(--font-mono);
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--accent);
  min-width: 36px;
  text-shadow: 0 0 12px var(--accent);
}

.ims-label {
  font-weight: 600;
  font-size: 0.95rem;
  margin-bottom: 0.25rem;
}

.ims-desc {
  font-size: 0.85rem;
  color: var(--text-secondary);
  line-height: 1.5;
}

/* ── CRS BANDS TABLE ── */
.bands-table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.5rem 0;
  font-size: 0.9rem;
}

.bands-table th {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
  padding: 0.75rem 1rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

.bands-table td {
  padding: 0.875rem 1rem;
  border-bottom: 1px solid var(--border);
  color: var(--text-secondary);
}

.band-dot {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
}

.band-dot::before {
  content: '';
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
}

.band-green .band-dot::before { background: var(--green); box-shadow: 0 0 8px var(--green); }
.band-amber .band-dot::before { background: var(--amber); box-shadow: 0 0 8px var(--amber); }
.band-red .band-dot::before { background: var(--red); box-shadow: 0 0 8px var(--red); }
.band-purple .band-dot::before { background: var(--purple-band); box-shadow: 0 0 8px var(--purple-band); }

.band-green { color: var(--green); }
.band-amber { color: var(--amber); }
.band-red { color: var(--red); }
.band-purple { color: var(--purple-band); }

/* ── BLOG GRID ── */
.blog-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 1.5rem;
  margin-top: 2.5rem;
}

.blog-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  text-decoration: none;
  display: flex;
  flex-direction: column;
  transition: all 0.2s;
}

.blog-card:hover {
  border-color: var(--border-strong);
  box-shadow: 0 0 24px var(--accent-glow);
  transform: translateY(-2px);
}

.blog-card-header {
  padding: 1.5rem;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(135deg, var(--bg-card) 0%, rgba(0,212,232,0.05) 100%);
}

.blog-part {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.2em;
  color: var(--accent);
  text-transform: uppercase;
  margin-bottom: 0.5rem;
}

.blog-card h3 {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 0.25rem;
  line-height: 1.3;
}

.blog-card-sub {
  font-size: 0.85rem;
  color: var(--text-muted);
  font-style: italic;
}

.blog-card-body {
  padding: 1.5rem;
  flex: 1;
}

.blog-card-body p {
  font-size: 0.9rem;
  color: var(--text-secondary);
  line-height: 1.6;
}

.blog-card-footer {
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.read-more {
  font-size: 0.8rem;
  color: var(--accent);
  font-family: var(--font-mono);
  display: flex;
  align-items: center;
  gap: 4px;
}

.week-tag {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--text-muted);
  padding: 2px 8px;
  border: 1px solid var(--border);
  border-radius: 2px;
}

/* ── ARTICLE LAYOUT ── */
.article-header {
  padding: 4rem 0 3rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: 3rem;
}

.article-meta {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}

.meta-tag {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.15em;
  color: var(--accent);
  text-transform: uppercase;
  padding: 3px 10px;
  border: 1px solid var(--border-strong);
  border-radius: 2px;
  background: var(--accent-glow);
}

.article-header h1 {
  font-size: clamp(2rem, 5vw, 3.25rem);
  font-weight: 800;
  line-height: 1.15;
  margin-bottom: 1rem;
  background: linear-gradient(135deg, #fff 40%, var(--accent) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.article-subtitle {
  font-size: 1.2rem;
  color: var(--text-secondary);
  font-style: italic;
  margin-bottom: 1.5rem;
}

.article-byline {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.875rem;
  color: var(--text-muted);
}

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

/* ── ARTICLE BODY ── */
.article-body {
  max-width: 760px;
}

.article-body h2 {
  font-size: 1.75rem;
  font-weight: 700;
  margin: 2.5rem 0 1rem;
  color: var(--text-primary);
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}

.article-body h3 {
  font-size: 1.25rem;
  font-weight: 600;
  margin: 2rem 0 0.75rem;
  color: var(--accent);
}

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

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

.article-body em {
  color: var(--text-primary);
}

.pull-quote {
  border-left: 3px solid var(--accent);
  padding: 1rem 1.5rem;
  margin: 2rem 0;
  background: var(--accent-glow);
  border-radius: 0 6px 6px 0;
}

.pull-quote p {
  font-size: 1.1rem;
  font-weight: 500;
  color: var(--text-primary) !important;
  font-style: italic;
  margin: 0 !important;
}

.callout {
  background: var(--bg-card);
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  padding: 1.25rem 1.5rem;
  margin: 1.75rem 0;
}

.callout p {
  color: var(--text-primary) !important;
  margin: 0 !important;
  font-size: 0.95rem !important;
}

.callout-label {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  letter-spacing: 0.2em;
  color: var(--accent);
  text-transform: uppercase;
  margin-bottom: 0.5rem;
}

.article-body ol, .article-body ul {
  padding-left: 1.5rem;
  margin-bottom: 1.25rem;
}

.article-body li {
  color: var(--text-secondary);
  line-height: 1.7;
  margin-bottom: 0.5rem;
  font-size: 1rem;
}

.article-body li strong {
  color: var(--text-primary);
}

.signpost {
  background: linear-gradient(135deg, var(--bg-card), rgba(0,212,232,0.05));
  border: 1px solid var(--accent);
  border-radius: 6px;
  padding: 1.25rem 1.5rem;
  margin: 2.5rem 0;
  font-style: italic;
  color: var(--text-secondary);
  font-size: 0.95rem;
}

/* ── SIDEBAR ── */
.article-layout {
  display: grid;
  grid-template-columns: 1fr 280px;
  gap: 3rem;
  align-items: start;
}

.article-sidebar {
  position: sticky;
  top: 80px;
}

.sidebar-box {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1.5rem;
  margin-bottom: 1.5rem;
}

.sidebar-box h4 {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.2em;
  color: var(--accent);
  text-transform: uppercase;
  margin-bottom: 1rem;
}

.toc-list {
  list-style: none;
  padding: 0;
}

.toc-list li {
  margin-bottom: 0;
}

.toc-list a {
  display: block;
  padding: 0.4rem 0;
  font-size: 0.85rem;
  color: var(--text-secondary);
  text-decoration: none;
  border-bottom: 1px solid var(--border);
  transition: color 0.2s;
}

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

.toc-list li:last-child a {
  border-bottom: none;
}

/* ── KPI GRID ── */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
  margin: 1.5rem 0;
}

.kpi-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 1.25rem;
  transition: all 0.2s;
}

.kpi-card:hover {
  border-color: var(--border-strong);
  box-shadow: 0 0 16px var(--accent-glow);
}

.kpi-number {
  font-family: var(--font-mono);
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--accent);
  margin-bottom: 0.25rem;
}

.kpi-name {
  font-size: 0.875rem;
  font-weight: 600;
  margin-bottom: 0.25rem;
}

.kpi-desc {
  font-size: 0.8rem;
  color: var(--text-muted);
  line-height: 1.5;
}

/* ── RULES LIST ── */
.rules-list {
  list-style: none;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin: 1.5rem 0;
}

.rules-list li {
  display: flex;
  gap: 1rem;
  align-items: flex-start;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 1rem 1.25rem;
  font-size: 0.9rem;
  color: var(--text-secondary);
  transition: all 0.2s;
}

.rules-list li:hover {
  border-color: var(--border-strong);
  background: var(--bg-card-hover);
}

.rule-num {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--accent);
  min-width: 28px;
  padding-top: 1px;
}

/* ── CATEGORIES ── */
.categories-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.25rem;
  margin: 1.5rem 0;
}

.cat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1.5rem;
  text-align: center;
  transition: all 0.2s;
}

.cat-card:hover {
  border-color: var(--border-strong);
  box-shadow: 0 0 20px var(--accent-glow);
}

.cat-label {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  letter-spacing: 0.2em;
  color: var(--text-muted);
  text-transform: uppercase;
  margin-bottom: 0.5rem;
}

.cat-name {
  font-size: 0.9rem;
  font-weight: 600;
  margin-bottom: 0.75rem;
}

.cat-ceiling {
  font-family: var(--font-mono);
  font-size: 2rem;
  font-weight: 800;
  color: var(--accent);
  text-shadow: 0 0 16px var(--accent);
  margin-bottom: 0.25rem;
}

.cat-ceiling-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-bottom: 0.75rem;
}

.cat-examples {
  font-size: 0.78rem;
  color: var(--text-muted);
  line-height: 1.5;
}

/* ── DEMO SECTION ── */
.demo-placeholder {
  background: var(--bg-card);
  border: 1px dashed var(--border-strong);
  border-radius: 8px;
  padding: 4rem 2rem;
  text-align: center;
}

.demo-placeholder-icon {
  font-size: 3rem;
  margin-bottom: 1rem;
}

.demo-placeholder h3 {
  font-size: 1.25rem;
  font-weight: 600;
  margin-bottom: 0.75rem;
}

.demo-placeholder p {
  color: var(--text-secondary);
  font-size: 0.9rem;
  margin-bottom: 1.5rem;
  max-width: 400px;
  margin-left: auto;
  margin-right: auto;
}

/* ── CRS CALCULATOR DEMO ── */
.calculator {
  background: var(--bg-card);
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  padding: 2rem;
  max-width: 600px;
  margin: 2rem auto;
}

.calc-title {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  letter-spacing: 0.2em;
  color: var(--accent);
  text-transform: uppercase;
  margin-bottom: 1.5rem;
  text-align: center;
}

.calc-group {
  margin-bottom: 1.25rem;
}

.calc-group label {
  display: block;
  font-size: 0.8rem;
  color: var(--text-muted);
  font-family: var(--font-mono);
  letter-spacing: 0.05em;
  margin-bottom: 0.5rem;
}

.calc-group select {
  width: 100%;
  background: var(--bg-secondary);
  border: 1px solid var(--border-strong);
  border-radius: 4px;
  color: var(--text-primary);
  padding: 0.6rem 1rem;
  font-size: 0.9rem;
  font-family: var(--font-sans);
  appearance: none;
  cursor: pointer;
  transition: border-color 0.2s;
}

.calc-group select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-glow);
}

.calc-result {
  margin-top: 1.5rem;
  padding: 1.5rem;
  border-radius: 6px;
  text-align: center;
  border: 1px solid var(--border);
}

.calc-score {
  font-family: var(--font-mono);
  font-size: 3rem;
  font-weight: 800;
  line-height: 1;
  margin-bottom: 0.5rem;
}

.calc-band {
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.1em;
}

.calc-formula-display {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 0.5rem;
}

/* ── CONTACT FORM ── */
.contact-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 3rem;
  align-items: start;
}

.form-group {
  margin-bottom: 1.25rem;
}

.form-group label {
  display: block;
  font-size: 0.8rem;
  color: var(--text-muted);
  font-family: var(--font-mono);
  letter-spacing: 0.05em;
  margin-bottom: 0.5rem;
}

.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  background: var(--bg-card);
  border: 1px solid var(--border-strong);
  border-radius: 4px;
  color: var(--text-primary);
  padding: 0.75rem 1rem;
  font-size: 0.9rem;
  font-family: var(--font-sans);
  transition: border-color 0.2s, box-shadow 0.2s;
  resize: vertical;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-glow);
}

.form-group input::placeholder,
.form-group textarea::placeholder {
  color: var(--text-muted);
}

.form-group select {
  appearance: none;
  cursor: pointer;
}

/* ── CODE BLOCK ── */
.code-block {
  background: #000;
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  padding: 1.25rem;
  overflow-x: auto;
  margin: 1.5rem 0;
}

.code-block pre {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--accent);
  line-height: 1.6;
  white-space: pre;
}

.code-label {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  letter-spacing: 0.2em;
  color: var(--text-muted);
  text-transform: uppercase;
  margin-bottom: 0.5rem;
}

/* ── FOOTER ── */
footer {
  background: var(--bg-secondary);
  border-top: 1px solid var(--border);
  padding: 3rem 0 2rem;
  position: relative;
  z-index: 1;
}

.footer-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 2rem;
}

.footer-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr;
  gap: 3rem;
  margin-bottom: 2.5rem;
}

.footer-brand img {
  width: 48px;
  margin-bottom: 1rem;
  filter: drop-shadow(0 0 8px var(--accent));
}

.footer-brand p {
  font-size: 0.85rem;
  color: var(--text-muted);
  line-height: 1.6;
  max-width: 240px;
}

.footer-col h5 {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.2em;
  color: var(--accent);
  text-transform: uppercase;
  margin-bottom: 1rem;
}

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

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

.footer-col a {
  font-size: 0.85rem;
  color: var(--text-muted);
  text-decoration: none;
  transition: color 0.2s;
}

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

.footer-bottom {
  border-top: 1px solid var(--border);
  padding-top: 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
}

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

.footer-bottom a {
  color: var(--accent);
  text-decoration: none;
}

/* ── HERO STATS ── */
.hero-stats {
  display: flex;
  gap: 3rem;
  justify-content: center;
  margin-top: 3rem;
  padding-top: 2.5rem;
  border-top: 1px solid var(--border);
  flex-wrap: wrap;
}

.stat {
  text-align: center;
}

.stat-value {
  font-family: var(--font-mono);
  font-size: 2rem;
  font-weight: 800;
  color: var(--accent);
  text-shadow: 0 0 16px var(--accent);
  display: block;
}

.stat-label {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
}

/* ── FEATURES GRID ── */
.features-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1.25rem;
  margin-top: 2.5rem;
}

/* ── DIVIDER ── */
.divider {
  border: none;
  border-top: 1px solid var(--border);
  margin: 2rem 0;
}

/* ── ALERT BOX ── */
.alert {
  background: rgba(0,212,232,0.05);
  border: 1px solid var(--accent);
  border-radius: 6px;
  padding: 1rem 1.5rem;
  margin: 1.5rem 0;
  font-size: 0.9rem;
  color: var(--text-primary);
}

.alert-label {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  color: var(--accent);
  letter-spacing: 0.2em;
  text-transform: uppercase;
  display: block;
  margin-bottom: 0.5rem;
}

/* ── TABLE ── */
.table-wrapper {
  overflow-x: auto;
  margin: 1.5rem 0;
  border-radius: 8px;
  border: 1px solid var(--border);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

table th {
  background: var(--bg-card);
  padding: 0.75rem 1rem;
  text-align: left;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  text-transform: uppercase;
  border-bottom: 1px solid var(--border);
}

table td {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border);
  color: var(--text-secondary);
  vertical-align: top;
  line-height: 1.5;
}

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

table tr:hover td {
  background: var(--accent-glow);
}

table td strong {
  color: var(--text-primary);
}

/* ── PAGE HEADER ── */
.page-header {
  padding: 5rem 0 3rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: 3rem;
}

.page-header h1 {
  font-size: clamp(2rem, 5vw, 3rem);
  font-weight: 800;
  background: linear-gradient(135deg, #fff 30%, var(--accent) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 1rem;
}

.page-header p {
  color: var(--text-secondary);
  font-size: 1.05rem;
  max-width: 560px;
  line-height: 1.7;
}

/* ── RESPONSIVE ── */
@media (max-width: 900px) {
  .pillars-grid { grid-template-columns: 1fr; }
  .categories-grid { grid-template-columns: 1fr; }
  .article-layout { grid-template-columns: 1fr; }
  .article-sidebar { position: static; }
  .footer-grid { grid-template-columns: 1fr 1fr; gap: 2rem; }
  .contact-grid { grid-template-columns: 1fr; }
  .kpi-grid { grid-template-columns: 1fr; }
}

@media (max-width: 640px) {
  .nav-links { display: none; }
  .nav-links.open {
    display: flex;
    flex-direction: column;
    position: absolute;
    top: 64px; left: 0; right: 0;
    background: rgba(8,12,16,0.97);
    border-bottom: 1px solid var(--border);
    padding: 1rem 2rem 1.5rem;
    gap: 1rem;
  }
  .nav-dropdown-menu {
    position: static;
    transform: none;
    box-shadow: none;
    border: none;
    border-left: 2px solid var(--border);
    border-radius: 0;
    padding: 0.25rem 0 0.25rem 1rem;
    margin-top: 0.25rem;
    background: transparent;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
  }
  .nav-dropdown-menu::before { display: none; }
  .nav-dropdown:hover .nav-dropdown-menu,
  .nav-dropdown:focus-within .nav-dropdown-menu { display: flex; }
  .nav-toggle { display: flex; }
  .hero { padding: 5rem 1.5rem 4rem; }
  .hero-logo { width: 120px; height: 120px; }
  .hero-stats { gap: 2rem; }
  .footer-grid { grid-template-columns: 1fr; gap: 1.5rem; }
  .footer-brand p { max-width: 100%; }
  section { padding: 3rem 0; }
}

/* ── THEME TOGGLE BUTTON ── */
.theme-toggle {
  background: none;
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 5px 7px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.2s, border-color 0.2s, background 0.2s;
  flex-shrink: 0;
}

.theme-toggle:hover {
  color: var(--accent);
  border-color: var(--accent);
  background: var(--accent-glow);
}

.theme-toggle svg { width: 16px; height: 16px; display: block; }

/* Dark mode shows sun (click → go light); light mode shows moon (click → go dark) */
.theme-toggle .icon-moon { display: none; }
.theme-toggle .icon-sun  { display: block; }
html[data-theme="light"] .theme-toggle .icon-sun  { display: none; }
html[data-theme="light"] .theme-toggle .icon-moon { display: block; }

/* ── LIGHT MODE ─────────────────────────────────────────────────────────── */
html[data-theme="light"] {
  --bg-primary:        #f0f4f8;
  --bg-secondary:      #e4eaf0;
  --bg-card:           #ffffff;
  --bg-card-hover:     #f7f9fc;
  --accent:            #0099b3;
  --accent-dim:        #007a90;
  --accent-glow:       rgba(0, 153, 179, 0.1);
  --accent-glow-strong: rgba(0, 153, 179, 0.2);
  --text-primary:      #0d1117;
  --text-secondary:    #3a5166;
  --text-muted:        #6a8599;
  --border:            rgba(0, 153, 179, 0.18);
  --border-strong:     rgba(0, 153, 179, 0.35);
  --green:   #009950;
  --amber:   #b87800;
  --red:     #c42020;
  --purple-band: #7000b8;
}

/* Background grid — slightly more visible on light */
html[data-theme="light"] body::before {
  background-image:
    linear-gradient(rgba(0,153,179,0.06) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0,153,179,0.06) 1px, transparent 1px);
}

/* Nav — override hardcoded dark background */
html[data-theme="light"] nav {
  background: rgba(240, 244, 248, 0.95);
}

html[data-theme="light"] .nav-dropdown-menu {
  background: rgba(255,255,255,0.98);
  box-shadow: 0 8px 32px rgba(0,0,0,0.12);
}

html[data-theme="light"] .nav-dropdown-menu::before {
  background: rgba(255,255,255,0.98);
}

/* Mobile nav open panel */
html[data-theme="light"] .nav-links.open {
  background: rgba(240,244,248,0.98);
}

/* Hero h1 gradient — white start is invisible on light bg */
html[data-theme="light"] .hero h1 {
  background: linear-gradient(135deg, #0d1117 30%, var(--accent) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

html[data-theme="light"] .article-header h1 {
  background: linear-gradient(135deg, #0d1117 40%, var(--accent) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

html[data-theme="light"] .page-header h1 {
  background: linear-gradient(135deg, #0d1117 30%, var(--accent) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* Code block — keep dark even in light mode for readability */
html[data-theme="light"] .code-block {
  background: #1a1f26;
  border-color: rgba(0,153,179,0.3);
}

/* Blog card header gradient */
html[data-theme="light"] .blog-card-header {
  background: linear-gradient(135deg, #ffffff 0%, rgba(0,153,179,0.05) 100%);
}

/* Signpost */
html[data-theme="light"] .signpost {
  background: linear-gradient(135deg, #ffffff, rgba(0,153,179,0.05));
}

/* Formula text shadow toned down on light */
html[data-theme="light"] .formula-text {
  text-shadow: 0 0 12px var(--accent-glow-strong);
}

html[data-theme="light"] .ims-badge {
  text-shadow: none;
}

html[data-theme="light"] .cat-ceiling {
  text-shadow: none;
}

html[data-theme="light"] .stat-value {
  text-shadow: none;
}

html[data-theme="light"] .nav-logo-text {
  text-shadow: none;
}
