:root {
  --bg: #0B0F14;
  --surface: #12181F;
  --surface-2: #171E26;
  --line: #26313D;
  --text: #E7ECEF;
  --text-muted: #8B99A6;
  --accent: #C9A227;
  --accent-dim: #7A6420;
  --green: #3FB950;
  --red: #E5534B;
  --blue: #539BF5;
  --radius: 4px;
  --mono: 'IBM Plex Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
  --sans: 'Space Grotesk', system-ui, sans-serif;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.grid-overlay {
  position: fixed;
  inset: 0;
  background-image:
    linear-gradient(var(--line) 1px, transparent 1px),
    linear-gradient(90deg, var(--line) 1px, transparent 1px);
  background-size: 48px 48px;
  opacity: 0.15;
  pointer-events: none;
  z-index: 0;
}

.wrap { width: 100%; max-width: 960px; margin: 0 auto; padding: 0 24px; position: relative; z-index: 1; }

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---------- Header ---------- */
header.site {
  border-bottom: 1px solid var(--line);
  font-family: var(--mono);
  position: relative;
  z-index: 2;
  background: rgba(11,15,20,0.85);
  backdrop-filter: blur(6px);
}
header.site .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 20px;
  padding-bottom: 20px;
  gap: 16px;
  flex-wrap: wrap;
}
.brand { font-weight: 700; letter-spacing: 0.04em; color: var(--text); font-size: 14px; }
.brand:hover { text-decoration: none; color: var(--accent); }
.brand .prompt { color: var(--accent); }
nav.site-nav { display: flex; gap: 18px; font-size: 12px; letter-spacing: 0.06em; flex-wrap: wrap; }
nav.site-nav a { color: var(--text-muted); text-transform: uppercase; }
nav.site-nav a:hover { color: var(--accent); text-decoration: none; }

/* ---------- Hero ---------- */
.hero { padding: 72px 0 48px; position: relative; z-index: 1; }
.hero .eyebrow {
  font-family: var(--mono); font-size: 12px; letter-spacing: 0.14em;
  color: var(--accent); text-transform: uppercase; margin-bottom: 18px;
}
.hero h1 { font-size: clamp(2.2rem, 6vw, 3.6rem); font-weight: 700; letter-spacing: -0.02em; line-height: 1.05; margin: 0 0 20px; }
.hero h1 .cursor { color: var(--accent); animation: blink 1.1s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0; } }
.hero p.lede { font-size: 1.05rem; color: var(--text-muted); max-width: 620px; margin: 0 0 28px; }
.hero .meta { font-family: var(--mono); font-size: 12px; color: var(--text-muted); display: flex; gap: 20px; flex-wrap: wrap; }
.hero .meta .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--green); display: inline-block; margin-right: 6px; box-shadow: 0 0 8px var(--green); }

/* ---------- Section headings ---------- */
.section-head { font-family: var(--mono); font-size: 13px; letter-spacing: 0.1em; color: var(--text-muted); text-transform: uppercase; margin: 48px 0 20px; display: flex; align-items: center; gap: 12px; }
.section-head::before { content: "//"; color: var(--accent); }
.section-head::after { content: ""; flex: 1; height: 1px; background: var(--line); }

/* ---------- Category grid ---------- */
.cat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
.cat-card {
  display: block; background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 22px; transition: border-color .18s, transform .18s;
}
.cat-card:hover { border-color: var(--accent); text-decoration: none; transform: translateY(-2px); }
.cat-card .icon { font-family: var(--mono); font-size: 20px; color: var(--accent); margin-bottom: 12px; }
.cat-card h3 { margin: 0 0 8px; font-size: 1.1rem; color: var(--text); }
.cat-card p { margin: 0 0 14px; font-size: 0.9rem; color: var(--text-muted); }
.cat-card .count { font-family: var(--mono); font-size: 11px; color: var(--accent); letter-spacing: 0.06em; }

/* ---------- Note list ---------- */
.note-list { list-style: none; padding: 0; margin: 0; }
.note-list li { border-bottom: 1px solid var(--line); }
.note-list li:first-child { border-top: 1px solid var(--line); }
.note-item { display: flex; align-items: baseline; gap: 16px; padding: 16px 4px; transition: background .15s; }
.note-item:hover { background: var(--surface); text-decoration: none; }
.note-item .date { font-family: var(--mono); font-size: 12px; color: var(--text-muted); white-space: nowrap; min-width: 92px; }
.note-item .body { flex: 1; }
.note-item .body h3 { margin: 0 0 4px; font-size: 1.02rem; color: var(--text); font-weight: 600; }
.note-item .body p { margin: 0; font-size: 0.88rem; color: var(--text-muted); }
.note-item .sev { font-family: var(--mono); font-size: 10px; padding: 2px 7px; border-radius: 3px; letter-spacing: 0.05em; text-transform: uppercase; white-space: nowrap; }
.sev-critical { background: rgba(229,83,75,0.15); color: var(--red); border: 1px solid var(--red); }
.sev-high { background: rgba(229,83,75,0.1); color: #ff8a80; border: 1px solid var(--accent-dim); }
.sev-medium { background: rgba(201,162,39,0.12); color: var(--accent); border: 1px solid var(--accent-dim); }
.sev-low { background: rgba(83,155,245,0.12); color: var(--blue); border: 1px solid #2c4a6e; }
.sev-info { background: var(--surface-2); color: var(--text-muted); border: 1px solid var(--line); }

/* ---------- Tags ---------- */
.tags { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.tag { font-family: var(--mono); font-size: 11px; color: var(--text-muted); background: var(--surface-2); border: 1px solid var(--line); padding: 2px 8px; border-radius: 3px; }
.tag::before { content: "#"; color: var(--accent-dim); }

/* ---------- Article ---------- */
article.note { padding: 40px 0 20px; }
.note-header { margin-bottom: 32px; padding-bottom: 24px; border-bottom: 1px solid var(--line); }
.note-header .kicker { font-family: var(--mono); font-size: 12px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--accent); margin-bottom: 14px; }
.note-header h1 { font-size: clamp(1.8rem, 4vw, 2.6rem); line-height: 1.12; margin: 0 0 14px; letter-spacing: -0.02em; }
.note-header .note-meta { font-family: var(--mono); font-size: 12px; color: var(--text-muted); display: flex; gap: 18px; flex-wrap: wrap; align-items: center; }

.note-body { font-size: 1.02rem; }
.note-body h2 { font-size: 1.5rem; margin: 40px 0 14px; padding-top: 8px; border-top: 1px solid var(--line); }
.note-body h3 { font-size: 1.2rem; margin: 28px 0 10px; color: var(--accent); }
.note-body p, .note-body li { color: #d4dae0; }
.note-body a { text-decoration: underline; text-underline-offset: 3px; }
.note-body img { border: 1px solid var(--line); border-radius: var(--radius); }
.note-body blockquote { border-left: 3px solid var(--accent); margin: 20px 0; padding: 4px 18px; color: var(--text-muted); background: var(--surface); }
.note-body table { width: 100%; border-collapse: collapse; margin: 20px 0; font-size: 0.92rem; }
.note-body th, .note-body td { border: 1px solid var(--line); padding: 8px 12px; text-align: left; }
.note-body th { background: var(--surface-2); font-family: var(--mono); font-size: 0.85rem; }

/* code */
.note-body code { font-family: var(--mono); font-size: 0.88em; background: var(--surface-2); padding: 2px 6px; border-radius: 3px; color: #f0d97a; }
.note-body pre { background: #0d1117; border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; overflow-x: auto; margin: 18px 0; position: relative; }
.note-body pre code { background: none; padding: 0; color: #e7ecef; font-size: 0.85rem; line-height: 1.55; }
.highlight { background: #0d1117 !important; border: 1px solid var(--line); border-radius: var(--radius); margin: 18px 0; }
.highlight pre { border: none; margin: 0; background: none; }

/* ---------- Callouts ---------- */
.callout { border: 1px solid var(--line); border-left-width: 3px; border-radius: var(--radius); padding: 12px 16px; margin: 18px 0; font-size: 0.95rem; background: var(--surface); }
.callout.tip { border-left-color: var(--green); }
.callout.warn { border-left-color: var(--accent); }
.callout.danger { border-left-color: var(--red); }

/* ---------- Footer ---------- */
footer.site { margin-top: auto; border-top: 1px solid var(--line); font-family: var(--mono); font-size: 11px; color: var(--text-muted); }
footer.site .wrap { display: flex; justify-content: space-between; padding: 22px 24px; flex-wrap: wrap; gap: 8px; }

.back-link { font-family: var(--mono); font-size: 12px; color: var(--text-muted); display: inline-block; margin: 24px 0; }
.back-link:hover { color: var(--accent); text-decoration: none; }
.back-link::before { content: "\2190  "; }

.empty { font-family: var(--mono); font-size: 13px; color: var(--text-muted); padding: 24px; border: 1px dashed var(--line); border-radius: var(--radius); text-align: center; }

@media (max-width: 560px) {
  .note-item { flex-direction: column; gap: 4px; }
  .note-item .date { min-width: 0; }
  header.site .wrap { flex-direction: column; align-items: flex-start; }
}
@media (prefers-reduced-motion: reduce) { .hero h1 .cursor { animation: none; } }
