/* ============================================================
   CyberWorld — design tokens
   A security-briefing aesthetic: editorial, calm, evidentiary.
   Not hacker-matrix. Think incident report, not sci-fi terminal.
   ============================================================ */

:root {
  /* Color — light theme is the default per site requirements */
  --ink:        #F8FAFC;   /* page background */
  --panel:      #FFFFFF;   /* card / raised surface */
  --panel-2:    #EEF2F6;   /* hover / secondary surface */
  --hairline:   #E2E8F0;   /* border */
  --paper:      #0B1120;   /* heading text */
  --paper-dim:  #334155;   /* body text */
  --slate:      #64748B;   /* muted text */
  --amber:      #16A34A;   /* primary accent (green) */
  --cyan:       #0891B2;   /* secondary accent (cyan) */
  --amber-dim:  #DCFCE7;
  --red:        #DC2626;   /* danger / critical tag */
  --amber-tag:  #D97706;   /* elevated tag — distinct amber-orange, not primary green */
  --green:      #16A34A;   /* low / informational tag */
  --blue:       #0891B2;   /* advisory tag reuses cyan accent */

  /* Type */
  --f-display: "Poppins", "Inter", -apple-system, "Segoe UI", sans-serif;
  --f-body: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --f-mono: "JetBrains Mono", "Fira Code", "SFMono-Regular", Consolas, monospace;

  /* Layout */
  --maxw: 1180px;
  --maxw-wide: 1760px;
  --radius: 6px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--ink);
  color: var(--paper);
  font-family: var(--f-body);
  font-size: 17px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }

.wrap {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 28px;
}

/* ---------- Skip link / focus ---------- */
.skip-link {
  position: absolute; left: -999px; top: 0;
  background: var(--amber); color: var(--ink);
  padding: 10px 16px; z-index: 200; font-family: var(--f-mono);
}
.skip-link:focus { left: 12px; top: 12px; }

:focus-visible {
  outline: 2px solid var(--amber);
  outline-offset: 3px;
}

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.001ms !important; transition-duration: 0.001ms !important; }
  html { scroll-behavior: auto; }
}

/* ============================================================
   Header
   ============================================================ */
.site-header {
  position: sticky; top: 0; z-index: 100;
  background: rgba(248, 250, 252, 0.92);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--hairline);
}
.header-inner {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 0; gap: 20px;
}
.logo {
  display: flex; align-items: center; gap: 10px;
  font-family: var(--f-mono);
  font-size: 15px;
  letter-spacing: 0.04em;
  color: var(--paper);
}
.logo .mark {
  width: 26px; height: 26px;
  border: 1.5px solid var(--amber);
  border-radius: 50%;
  display: grid; place-items: center;
  position: relative;
}
.logo .mark::before {
  content: "";
  width: 6px; height: 6px;
  background: var(--amber);
  border-radius: 50%;
}
.logo strong { font-weight: 700; }
.logo span.dim { color: var(--slate); }

.nav-links {
  display: flex; gap: 32px;
  font-family: var(--f-mono);
  font-size: 13px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}
.nav-links a {
  color: var(--paper-dim);
  padding: 6px 0;
  border-bottom: 1px solid transparent;
  transition: color 0.15s ease, border-color 0.15s ease;
}
.nav-links a:hover, .nav-links a[aria-current="page"] {
  color: var(--amber);
  border-color: var(--amber);
}

.nav-toggle {
  display: none;
  background: none; border: 1px solid var(--hairline);
  color: var(--paper); font-family: var(--f-mono);
  padding: 8px 12px; border-radius: var(--radius);
  cursor: pointer;
}

@media (max-width: 760px) {
  .nav-links { display: none; }
  .nav-toggle { display: block; }
  .theme-toggle #themeLabel { display: none; }
  .theme-toggle { padding: 8px 10px; }
  .nav-links.open {
    display: flex; flex-direction: column; gap: 0;
    position: absolute; top: 100%; left: 0; right: 0;
    background: var(--panel); border-bottom: 1px solid var(--hairline);
    padding: 8px 28px 20px;
  }
  .nav-links.open a { padding: 12px 0; border-bottom: 1px solid var(--hairline); }
}

/* ============================================================
   Hero
   ============================================================ */
.hero {
  padding: 88px 0 64px;
  border-bottom: 1px solid var(--hairline);
  position: relative;
  overflow: hidden;
}
.hero::before {
  content: "";
  position: absolute; inset: 0;
  background-image:
    linear-gradient(var(--hairline) 1px, transparent 1px),
    linear-gradient(90deg, var(--hairline) 1px, transparent 1px);
  background-size: 64px 64px;
  opacity: 0.18;
  mask-image: radial-gradient(ellipse 70% 60% at 70% 30%, black, transparent);
  pointer-events: none;
}
.hero-inner { position: relative; display: grid; grid-template-columns: 1.3fr 1fr; gap: 56px; align-items: end; }
@media (max-width: 860px) { .hero-inner { grid-template-columns: 1fr; } }

.eyebrow {
  font-family: var(--f-mono);
  font-size: 12.5px; letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--amber);
  display: flex; align-items: center; gap: 10px;
  margin-bottom: 22px;
}
.eyebrow .dot { width: 6px; height: 6px; background: var(--amber); border-radius: 50%; animation: pulse 2.4s ease-in-out infinite; }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: 0.25; } }

.hero h1 {
  font-family: var(--f-display);
  font-weight: 600;
  font-size: clamp(2.4rem, 4.6vw, 3.7rem);
  line-height: 1.06;
  margin: 0 0 22px;
  letter-spacing: -0.01em;
}
.hero h1 em { font-style: italic; color: var(--amber); }

.hero p.lede {
  font-size: 18px;
  color: var(--paper-dim);
  max-width: 46ch;
  margin: 0 0 30px;
}

.hero-actions { display: flex; gap: 14px; flex-wrap: wrap; }

.btn {
  font-family: var(--f-mono);
  font-size: 13.5px;
  letter-spacing: 0.03em;
  padding: 13px 22px;
  border-radius: var(--radius);
  display: inline-flex; align-items: center; gap: 8px;
  cursor: pointer; border: 1px solid transparent;
  transition: transform 0.15s ease, background 0.15s ease, border-color .15s ease;
}
.btn-primary { background: var(--amber); color: var(--ink); font-weight: 700; }
.btn-primary:hover { transform: translateY(-1px); background: #f0b154; }
.btn-ghost { border-color: var(--hairline); color: var(--paper-dim); }
.btn-ghost:hover { border-color: var(--amber); color: var(--amber); }

/* Briefing panel — signature element on the hero */
.briefing-panel {
  background: var(--panel);
  border: 1px solid var(--hairline);
  border-radius: var(--radius);
  padding: 22px;
  box-shadow: 0 1px 3px rgba(15,23,42,0.06);
}
.briefing-panel .bp-head {
  display: flex; justify-content: space-between; align-items: center;
  font-family: var(--f-mono); font-size: 11.5px; color: var(--slate);
  text-transform: uppercase; letter-spacing: 0.08em;
  padding-bottom: 14px; margin-bottom: 14px;
  border-bottom: 1px solid var(--hairline);
}
.bp-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 10px 0; border-bottom: 1px dashed var(--hairline);
  font-size: 14.5px;
}
.bp-row:last-child { border-bottom: none; }
.bp-row .label { color: var(--paper-dim); }
.bp-row .val { font-family: var(--f-mono); font-size: 13px; }

/* ============================================================
   Threat-level badge — signature component, used as real taxonomy
   ============================================================ */
.tl {
  display: inline-flex; align-items: center; gap: 7px;
  font-family: var(--f-mono); font-size: 11.5px; letter-spacing: 0.06em;
  text-transform: uppercase; padding: 5px 10px 5px 8px;
  border-radius: 999px; border: 1px solid currentColor;
}
.tl .ring {
  width: 9px; height: 9px; border-radius: 50%;
  background: currentColor;
}
.tl-critical { color: var(--red); }
.tl-elevated { color: var(--amber-tag); }
.tl-guarded  { color: var(--blue); }
.tl-low      { color: var(--green); }

/* ============================================================
   Section scaffolding
   ============================================================ */
section { padding: 76px 0; }
.section-head {
  display: flex; justify-content: space-between; align-items: baseline;
  margin-bottom: 40px; gap: 24px; flex-wrap: wrap;
  border-bottom: 1px solid var(--hairline);
  padding-bottom: 20px;
}
.section-head h2 {
  font-family: var(--f-display); font-weight: 600;
  font-size: clamp(1.6rem, 3vw, 2.1rem); margin: 0;
}
.section-head .tag {
  font-family: var(--f-mono); font-size: 12px; color: var(--slate);
  letter-spacing: 0.06em; text-transform: uppercase;
}

/* ============================================================
   Post grid / cards
   ============================================================ */
.post-grid {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 1px;
  background: var(--hairline);
  border: 1px solid var(--hairline);
}
@media (max-width: 900px) { .post-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 620px) { .post-grid { grid-template-columns: 1fr; } }

.post-card {
  background: var(--ink);
  padding: 28px 26px;
  display: flex; flex-direction: column; gap: 14px;
  transition: background 0.15s ease;
}
.post-card:hover { background: var(--panel); }
.post-card .meta-row { display: flex; justify-content: space-between; align-items: center; }
.post-card .num { font-family: var(--f-mono); font-size: 12px; color: var(--slate); }
.post-card h3 {
  font-family: var(--f-display); font-weight: 600;
  font-size: 21px; line-height: 1.28; margin: 0;
}
.post-card p { color: var(--paper-dim); font-size: 15px; margin: 0; flex-grow: 1; }
.post-card .read-more {
  font-family: var(--f-mono); font-size: 12.5px; color: var(--amber);
  letter-spacing: 0.04em;
}
.post-card .foot {
  font-family: var(--f-mono); font-size: 12px; color: var(--slate);
  padding-top: 12px; border-top: 1px dashed var(--hairline);
}

/* Featured (large) card */
.post-featured {
  display: grid; grid-template-columns: 1fr 1fr; gap: 40px;
  border: 1px solid var(--hairline); padding: 34px;
  border-radius: var(--radius); align-items: center;
  background: linear-gradient(160deg, var(--panel), var(--ink));
}
@media (max-width: 760px) { .post-featured { grid-template-columns: 1fr; } }
.post-featured h3 { font-family: var(--f-display); font-size: 30px; line-height: 1.15; margin: 14px 0; font-weight: 600; }
.checklist { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.checklist li {
  font-family: var(--f-mono); font-size: 13.5px; color: var(--paper-dim);
  display: flex; gap: 10px; align-items: flex-start;
}
.checklist li::before { content: "▸"; color: var(--amber); flex-shrink: 0; }

/* ============================================================
   Ad slots — Google AdSense placeholders
   ============================================================ */
.ad-slot {
  border: 1px dashed var(--hairline);
  border-radius: var(--radius);
  padding: 18px;
  display: flex; align-items: center; justify-content: center;
  text-align: center;
  color: var(--slate);
  font-family: var(--f-mono);
  font-size: 12px;
  letter-spacing: 0.04em;
  min-height: 90px;
  background: var(--panel);
}
.ad-slot-leaderboard { min-height: 100px; }
.ad-slot-rectangle { min-height: 260px; }
.ad-slot-inline { margin: 40px 0; }

/* ============================================================
   Newsletter / CTA band
   ============================================================ */
.cta-band {
  background: var(--panel);
  border-top: 1px solid var(--hairline);
  border-bottom: 1px solid var(--hairline);
}
.cta-inner {
  padding: 60px 0; display: grid; grid-template-columns: 1.2fr 1fr; gap: 40px; align-items: center;
}
@media (max-width: 760px) { .cta-inner { grid-template-columns: 1fr; } }
.cta-inner h2 { font-family: var(--f-display); font-size: 26px; margin: 0 0 10px; }
.cta-inner p { color: var(--paper-dim); margin: 0; }
.cta-form { display: flex; gap: 10px; }
.cta-form input {
  flex: 1; background: var(--ink); border: 1px solid var(--hairline);
  color: var(--paper); padding: 13px 16px; border-radius: var(--radius);
  font-family: var(--f-body); font-size: 14.5px;
}
.cta-form input:focus { border-color: var(--amber); }

/* ============================================================
   Footer
   ============================================================ */
.site-footer {
  padding: 56px 0 36px;
  border-top: 1px solid var(--hairline);
}
.footer-grid {
  display: grid; grid-template-columns: 2fr 1fr 1fr 1fr; gap: 32px;
  margin-bottom: 40px;
}
@media (max-width: 700px) { .footer-grid { grid-template-columns: 1fr 1fr; } }
.footer-grid h4 {
  font-family: var(--f-mono); font-size: 12px; text-transform: uppercase;
  letter-spacing: 0.06em; color: var(--slate); margin: 0 0 16px;
}
.footer-grid ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.footer-grid a { color: var(--paper-dim); font-size: 14px; }
.footer-grid a:hover { color: var(--amber); }
.footer-bottom {
  display: flex; justify-content: space-between; align-items: center;
  padding-top: 24px; border-top: 1px solid var(--hairline);
  font-family: var(--f-mono); font-size: 12px; color: var(--slate);
  flex-wrap: wrap; gap: 12px;
}

/* Article hero cover image */
.article-cover {
  width: 100%; max-height: 340px; overflow: hidden;
  border-bottom: 1px solid var(--hairline);
}
.article-cover img { width: 100%; height: 100%; object-fit: cover; display: block; }

/* Post card thumbnail */
.post-card .card-thumb { width: 100%; aspect-ratio: 16/7; border-radius: var(--radius); overflow: hidden; margin-bottom: 4px; }
.post-card .card-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }

/* ============================================================
   Article page
   ============================================================ */
.article-header { padding: 64px 0 40px; border-bottom: 1px solid var(--hairline); }
.article-header .eyebrow-row { display: flex; align-items: center; gap: 14px; margin-bottom: 20px; flex-wrap: wrap; }
.article-header h1 {
  font-family: var(--f-display); font-weight: 600;
  font-size: clamp(2rem, 4vw, 2.9rem); line-height: 1.1; margin: 0 0 20px; max-width: 22ch;
}
.article-meta {
  display: flex; gap: 24px; flex-wrap: wrap;
  font-family: var(--f-mono); font-size: 13px; color: var(--slate);
}

.article-body { padding: 52px 0; max-width: 760px; margin: 0 auto; }
.article-body p { margin: 0 0 22px; font-size: 17.5px; color: var(--paper-dim); }
.article-body h2 {
  font-family: var(--f-display); font-size: 26px; font-weight: 600;
  margin: 44px 0 18px; color: var(--paper);
}
.article-body h3 { font-family: var(--f-display); font-size: 20px; margin: 32px 0 12px; }
.article-body ul, .article-body ol { color: var(--paper-dim); font-size: 17px; margin: 0 0 22px; padding-left: 22px; }
.article-body li { margin-bottom: 10px; }
.pull-note {
  border-left: 3px solid var(--amber);
  background: var(--panel);
  padding: 18px 22px; margin: 32px 0;
  font-size: 15.5px; color: var(--paper);
}
.pull-note strong { color: var(--amber); }

.byline-box {
  display: flex; gap: 14px; align-items: center;
  padding: 20px; border: 1px solid var(--hairline); border-radius: var(--radius);
  margin-top: 48px; background: var(--panel);
}
.byline-box .avatar {
  width: 44px; height: 44px; border-radius: 50%;
  background: var(--amber-dim); flex-shrink: 0;
  display: grid; place-items: center; font-family: var(--f-mono); color: var(--amber);
}
.byline-box .name { font-weight: 600; }
.byline-box .role { color: var(--slate); font-size: 13px; font-family: var(--f-mono); }

/* ============================================================
   Dark theme override — toggled via [data-theme="dark"] on <html>
   (Light is now the default; this is the optional alternate theme.)
   ============================================================ */
html[data-theme="dark"] {
  --ink:        #0B1120;
  --panel:      #111827;
  --panel-2:    #16202F;
  --hairline:   #1E293B;
  --paper:      #F8FAFC;
  --paper-dim:  #CBD5E1;
  --slate:      #94A3B8;
  --amber:      #22C55E;
  --cyan:       #06B6D4;
  --amber-dim:  #14532D;
  --red:        #EF4444;
  --amber-tag:  #F59E0B;
  --green:      #22C55E;
  --blue:       #06B6D4;
}
html[data-theme="dark"] .site-header { background: rgba(11, 17, 32, 0.92); }
html[data-theme="dark"] .briefing-panel,
html[data-theme="dark"] .post-featured { box-shadow: none; }

.theme-toggle {
  background: none; border: 1px solid var(--hairline); color: var(--paper-dim);
  font-family: var(--f-mono); font-size: 12px; letter-spacing: 0.04em;
  padding: 8px 14px; border-radius: 999px; cursor: pointer;
  display: inline-flex; align-items: center; gap: 8px;
  transition: border-color 0.15s ease, color 0.15s ease;
}
.theme-toggle:hover { border-color: var(--amber); color: var(--amber); }
.theme-toggle .swatch { width: 9px; height: 9px; border-radius: 50%; background: var(--amber); }

/* ============================================================
   Wide-screen ad rails — fill the empty side space on large monitors
   ============================================================ */
.ad-rail {
  position: fixed;
  top: 140px;
  width: 160px;
  z-index: 10;
  display: none;
}
.ad-rail-left { left: max(12px, calc(50% - 900px)); }
.ad-rail-right { right: max(12px, calc(50% - 900px)); }
.ad-rail .ad-slot {
  min-height: 600px;
  writing-mode: horizontal-tb;
  flex-direction: column;
  padding: 14px 10px;
}
@media (min-width: 1700px) {
  .ad-rail { display: block; }
}

/* Utility */
.visually-hidden {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}
.center { text-align: center; }
.small { font-size: 13px; color: var(--slate); }
