/* ThreatNotes — design system
   Philosophy: build trust, not spectacle. One font, one accent, narrow column. */

:root {
  /* dark theme (default) */
  --bg:      #121212;
  --surface: #1b1b1b;
  --surface-2:#222222;
  --text:    #F7F7F7;   /* brighter body text for long reading sessions */
  --muted:   #b0b6bd;   /* lifted: preview/summary text no longer dim */
  --faint:   #808791;
  --border:  #2a2a2a;
  --accent:  #00D084;   /* used sparingly: links to read, rules, active state */
  --accent-dim:#00b473;
  --link:    #6BB4FF;   /* body links = blue */
  --code-bg: #0d0d0d;
  --nav-bg:  rgba(18,18,18,.86);

  --font-sans: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  --font-mono: 'JetBrains Mono', 'IBM Plex Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  --measure: 820px;     /* reading width: wide enough for code/diagrams, still not full-width */
  --radius: 8px;
}

/* light theme — opt-in via toggle; code blocks stay dark for consistency */
[data-theme="light"] {
  --bg:      #ffffff;
  --surface: #f6f7f9;
  --surface-2:#eceef1;
  --text:    #15181c;
  --muted:   #56606b;
  --faint:   #6d7680;
  --border:  #e2e6ea;
  --accent:  #018a5a;   /* darker green stays readable on white */
  --accent-dim:#017a4f;
  --link:    #0969da;
  --code-bg: #0d0d0d;
  --nav-bg:  rgba(255,255,255,.86);
}

* { box-sizing: border-box; }

html { color-scheme: dark; }
[data-theme="light"] { color-scheme: light; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 18px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* ---------- layout ---------- */
.container { width: 100%; max-width: var(--measure); margin: 0 auto; padding: 0 20px; }
.wide      { max-width: 940px; }

/* ---------- top nav ---------- */
.nav {
  position: sticky; top: 0; z-index: 50;
  background: var(--nav-bg);
  backdrop-filter: saturate(140%) blur(8px);
  border-bottom: 1px solid var(--border);
}
.nav-inner {
  max-width: 940px; margin: 0 auto; padding: 14px 20px;
  display: flex; align-items: center; gap: 20px; flex-wrap: wrap;
}
.brand {
  font-weight: 700; font-size: 17px; letter-spacing: -.01em;
  color: var(--text); text-decoration: none; margin-right: 4px;
  display: inline-flex; align-items: center; gap: 8px;
}
.brand .mark { width: 10px; height: 10px; border-radius: 2px; background: var(--accent); }
.nav-links { display: flex; gap: 18px; flex-wrap: wrap; margin-left: auto; }
.nav-links a {
  color: var(--muted); text-decoration: none; font-size: 14px;
  letter-spacing: .01em; transition: color .15s;
}
.nav-links a:hover, .nav-links a[aria-current="page"] { color: var(--text); }

/* theme toggle */
.theme-toggle {
  background: transparent; border: 1px solid var(--border); border-radius: 6px;
  color: var(--muted); cursor: pointer; padding: 5px 8px; line-height: 0;
  display: inline-flex; align-items: center; justify-content: center;
  transition: color .15s, border-color .15s;
}
.theme-toggle:hover { color: var(--text); border-color: var(--faint); }
.theme-toggle svg { width: 16px; height: 16px; display: block; }
.theme-toggle .icon-sun { display: none; }
.theme-toggle .icon-moon { display: block; }
[data-theme="light"] .theme-toggle .icon-sun { display: block; }
[data-theme="light"] .theme-toggle .icon-moon { display: none; }

/* ---------- hero ---------- */
.hero { padding: 48px 0 34px; border-bottom: 1px solid var(--border); }
.hero h1 {
  font-size: clamp(24px, 3.4vw, 33px); line-height: 1.14; letter-spacing: -.02em;
  margin: 0 0 14px; font-weight: 700; text-wrap: balance;
}
.hero h1 .g { color: var(--accent); }
.hero p { color: var(--muted); font-size: 16px; line-height: 1.55; margin: 0 0 22px; max-width: 58ch; }

/* ---------- buttons ---------- */
.btn {
  display: inline-block; background: var(--accent); color: #06231a;
  font-weight: 650; font-size: 14px; letter-spacing: .02em;
  padding: 11px 20px; border-radius: 6px; text-decoration: none;
  transition: background .15s, transform .05s;
}
.btn:hover { background: #12e895; }
.btn:active { transform: translateY(1px); }
.btn-ghost { background: transparent; color: var(--text); border: 1px solid var(--border); }
.btn-ghost:hover { border-color: var(--faint); background: var(--surface); }

/* ---------- section label ---------- */
.eyebrow {
  font-family: var(--font-mono); font-size: 12px; letter-spacing: .14em;
  text-transform: uppercase; color: var(--faint); margin: 0 0 22px;
  display: flex; align-items: center; gap: 10px;
}
.eyebrow::before { content: ""; width: 22px; height: 2px; background: var(--accent); }

/* ---------- article cards ---------- */
.cards { display: flex; flex-direction: column; gap: 2px; }
.card {
  display: block; text-decoration: none; color: inherit;
  padding: 22px 0; border-bottom: 1px solid var(--border);
  transition: none;
}
.card:hover .card-title { color: var(--accent); }
.card-meta {
  font-family: var(--font-mono); font-size: 12px; color: var(--faint);
  display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 8px;
}
.card-meta .cat { color: var(--accent); }
.card-title { font-size: 22px; font-weight: 680; letter-spacing: -.015em; margin: 0 0 8px; line-height: 1.25; transition: color .15s; }
.card-sum { color: var(--muted); font-size: 15.5px; margin: 0 0 12px; }
.card-more { color: var(--accent); font-size: 14px; font-weight: 600; }

/* ---------- search ---------- */
.search { margin: 8px 0 26px; }
.search input {
  width: 100%; background: var(--surface); border: 1px solid var(--border);
  color: var(--text); font-family: var(--font-sans); font-size: 15px;
  padding: 12px 14px; border-radius: 8px; outline: none;
}
.search input:focus { border-color: var(--accent-dim); }
.search input::placeholder { color: var(--faint); }
.no-results { color: var(--muted); font-size: 15px; padding: 16px 0; display: none; }

/* ---------- article ---------- */
.post { padding: 56px 0 40px; }
.post-header { margin-bottom: 44px; }
.post-header h1 {
  font-size: clamp(34px, 5.4vw, 54px); line-height: 1.08; letter-spacing: -.028em;
  margin: 0 0 18px; font-weight: 780; text-wrap: balance;
}
.post-header .sub { color: var(--muted); font-size: 20px; line-height: 1.5; margin: 0 0 24px; }
.byline {
  font-family: var(--font-mono); font-size: 13px; color: var(--faint);
  display: flex; align-items: center; gap: 8px 12px; flex-wrap: wrap;
  padding-top: 20px; border-top: 1px solid var(--border);
}
.byline .author { color: var(--text); font-weight: 500; }
.byline .sep { color: var(--border); }
.byline .cat-tag { color: var(--accent); text-decoration: none; }
.byline .cat-tag:hover { text-decoration: underline; }

/* article body typography */
.prose { font-size: 19px; line-height: 1.75; }
.prose > * + * { margin-top: 24px; }
.prose h2 {
  font-size: 25px; font-weight: 700; letter-spacing: -.015em; line-height: 1.2;
  margin-top: 52px; padding-top: 4px;
}
.prose h3 { font-size: 20px; font-weight: 680; margin-top: 40px; }
.prose p { margin: 0; }
.prose a { color: var(--link); text-decoration: none; border-bottom: 1px solid rgba(90,169,255,.35); }
.prose a:hover { border-bottom-color: var(--link); }
.prose strong { color: var(--text); font-weight: 680; }
.prose ul, .prose ol { margin: 0; padding-left: 22px; }
.prose li { margin: 8px 0; }
.prose li::marker { color: var(--accent); }
.prose hr { border: 0; border-top: 1px solid var(--border); margin: 40px 0; }

/* pull-quote / blockquote */
.prose blockquote {
  margin: 32px 0; padding: 4px 0 4px 22px; border-left: 3px solid var(--accent);
  color: var(--text); font-size: 21px; line-height: 1.4; font-weight: 500; letter-spacing: -.01em;
}
.prose blockquote p { margin: 0; }

/* figures — uniform width, centered, consistent spacing; padding is baked into screenshots */
.prose figure { margin: 42px auto; }
figure img {
  display: block; width: 100%; height: auto; border-radius: var(--radius);
  border: 1px solid var(--border);
}
figcaption {
  font-family: var(--font-mono); font-size: 12.5px; color: var(--muted);
  text-align: center; margin: 14px auto 0; line-height: 1.55; max-width: 92%;
}

/* code */
.prose code {
  font-family: var(--font-mono); font-size: .87em;
  background: var(--surface-2); color: #e6e6e6;
  padding: 2px 6px; border-radius: 5px; border: 1px solid var(--border);
}
.prose pre {
  background: var(--code-bg); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 18px 18px; overflow-x: auto; margin: 28px 0; font-size: 14px; line-height: 1.6;
}
.prose pre code { background: none; border: 0; padding: 0; font-size: 13.5px; color: #e6e6e6; }

/* tables */
.prose table { width: 100%; border-collapse: collapse; margin: 28px 0; font-size: 15px; display: block; overflow-x: auto; }
.prose th, .prose td { text-align: left; padding: 10px 14px; border-bottom: 1px solid var(--border); }
.prose th { color: var(--muted); font-family: var(--font-mono); font-size: 12px; text-transform: uppercase; letter-spacing: .08em; }

/* reading progress bar */
.progress {
  position: fixed; top: 0; left: 0; height: 3px; width: 0;
  background: var(--accent); z-index: 100; transition: width .1s linear;
}

/* author box at end of article */
.author-box {
  margin-top: 56px; padding: 24px; background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius);
  display: flex; gap: 18px; align-items: flex-start; flex-wrap: wrap;
}
.author-box .avatar {
  width: 52px; height: 52px; border-radius: 50%; flex: none;
  background: linear-gradient(135deg, var(--accent), #0a8f5c);
  color: #06231a; font-weight: 750; font-size: 20px;
  display: flex; align-items: center; justify-content: center;
}
.author-box .who { flex: 1; min-width: 220px; }
.author-box .who .name { font-weight: 680; font-size: 17px; color: var(--text); margin: 0 0 3px; }
.author-box .who .role { color: var(--muted); font-size: 14px; margin: 0 0 12px; line-height: 1.5; }
.author-box .who .social { display: flex; gap: 16px; flex-wrap: wrap; }
.author-box .who .social a {
  color: var(--accent); text-decoration: none; font-size: 13.5px; font-weight: 600;
  font-family: var(--font-mono);
}
.author-box .who .social a:hover { text-decoration: underline; }

/* newsletter / subscribe */
.subscribe {
  margin-top: 32px; padding: 26px; background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius);
}
.subscribe h3 { margin: 0 0 6px; font-size: 18px; font-weight: 700; }
.subscribe p { margin: 0 0 16px; color: var(--muted); font-size: 14.5px; }
.subscribe form { display: flex; gap: 10px; flex-wrap: wrap; }
.subscribe input[type=email] {
  flex: 1; min-width: 220px; background: var(--bg); border: 1px solid var(--border);
  color: var(--text); font-family: var(--font-sans); font-size: 15px;
  padding: 11px 14px; border-radius: 6px; outline: none;
}
.subscribe input[type=email]:focus { border-color: var(--accent-dim); }
.subscribe button {
  background: var(--accent); color: #06231a; border: 0; font-weight: 650;
  font-size: 14px; padding: 11px 22px; border-radius: 6px; cursor: pointer;
}
.subscribe button:hover { background: #12e895; }

/* post footer nav */
.post-foot { margin-top: 40px; padding-top: 24px; border-top: 1px solid var(--border); }
.post-foot a { color: var(--accent); text-decoration: none; font-size: 14px; font-weight: 600; }

/* ---------- generic page ---------- */
.page { padding: 56px 0; }
.page h1 { font-size: 32px; letter-spacing: -.02em; margin: 0 0 24px; }
.page .prose { max-width: var(--measure); }

/* ---------- footer ---------- */
.site-foot { border-top: 1px solid var(--border); margin-top: 72px; padding: 40px 0 56px; }
.site-foot .inner { max-width: 940px; margin: 0 auto; padding: 0 20px; display: flex; gap: 20px 40px; flex-wrap: wrap; align-items: baseline; }
.site-foot .brand2 { font-weight: 700; color: var(--text); }
.site-foot .links { display: flex; gap: 20px; flex-wrap: wrap; margin-left: auto; }
.site-foot a { color: var(--muted); text-decoration: none; font-size: 14px; }
.site-foot a:hover { color: var(--text); }
.site-foot .copy { color: var(--faint); font-size: 13px; width: 100%; margin-top: 8px; }

/* ---------- misc ---------- */
::selection { background: rgba(0,208,132,.28); color: #fff; }
a:focus-visible, input:focus-visible, .btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
img { max-width: 100%; }

@media (max-width: 600px) {
  body { font-size: 17px; }
  .hero { padding: 56px 0 40px; }
  .nav-links { gap: 14px; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
