/* BlueCore site styles, shared by the homepage and the blog pages. */

:root {
  --bg: #020610;
  --blue: #2b6bff;
  --blue-bright: #4da3ff;
  --blue-dim: #123a8a;
  --blue-faint: #0a1f4d;
  --text: #dff0ff;
  --text-dim: #8fb4e8;
  --muted: #5b7fc4;
  --panel: rgba(2, 6, 16, 0.78);
  --mono: 'Courier New', Courier, 'Lucida Console', monospace;
}

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

html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--mono);
  line-height: 1.6;
  overflow-x: hidden;
}

a { color: var(--blue-bright); }
a:focus-visible, button:focus-visible {
  outline: 2px solid var(--text);
  outline-offset: 3px;
}

/* ---------- Rain canvas + scanlines ---------- */
#rain {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  display: block;
}
.scanlines {
  position: fixed;
  inset: 0;
  z-index: 3;
  pointer-events: none;
  background: linear-gradient(rgba(0,0,0,0) 50%, rgba(0,0,0,0.22) 50%);
  background-size: 100% 4px;
  opacity: 0.35;
}

/* ---------- Page content sits above the rain ---------- */
main { position: relative; z-index: 2; }

/* ---------- Hero ---------- */
.hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: clamp(2rem, 10vh, 6rem) 1.25rem 1rem;
  background: radial-gradient(ellipse 60% 55% at 50% 50%, rgba(2,6,16,0.92) 0%, rgba(2,6,16,0.55) 55%, rgba(2,6,16,0) 100%);
}
.wordmark {
  font-size: clamp(2.6rem, 11vw, 8.5rem);
  font-weight: bold;
  letter-spacing: 0.28em;
  margin-left: 0.28em; /* visually recentre the tracked-out text */
  color: var(--blue-bright);
  text-shadow: 0 0 10px var(--blue-bright), 0 0 22px var(--blue), 0 0 48px var(--blue-dim);
  animation: flicker 4s infinite;
  line-height: 1.1;
}
.tagline {
  margin-top: 1.4rem;
  font-size: clamp(0.8rem, 2.6vw, 1.3rem);
  letter-spacing: clamp(0.12em, 1.4vw, 0.45em);
  margin-left: clamp(0.12em, 1.4vw, 0.45em);
  color: var(--text);
  text-shadow: 0 0 8px var(--blue);
  min-height: 1.6em;
  white-space: normal;
}
.cursor {
  display: inline-block;
  width: 0.6em;
  height: 1em;
  vertical-align: -0.15em;
  background: var(--blue-bright);
  margin-left: 0.15em;
  box-shadow: 0 0 10px var(--blue-bright);
  animation: blink 1s step-end infinite;
}
.hero-sub {
  margin-top: 2.2rem;
  max-width: 34rem;
  color: var(--text-dim);
  font-size: clamp(0.85rem, 2vw, 1rem);
  text-shadow: 0 0 6px rgba(2,6,16,1);
}
.hero { position: relative; }

/* ---------- Sections ---------- */
.section {
  max-width: 66rem;
  margin: 0 auto;
  padding: 4rem 1.25rem;
}
.section h2 {
  font-size: clamp(1.1rem, 2.4vw, 1.5rem);
  font-weight: bold;
  letter-spacing: 0.12em;
  color: var(--blue-bright);
  text-shadow: 0 0 10px var(--blue);
  margin-bottom: 1.4rem;
}
.section h2::before {
  content: '> ';
  color: var(--blue);
}

.panel {
  background: var(--panel);
  border: 1px solid var(--blue-dim);
  box-shadow: 0 0 18px rgba(43,107,255,0.18), inset 0 0 40px rgba(43,107,255,0.05);
  padding: 1.6rem 1.8rem;
  backdrop-filter: blur(2px);
}

/* ---------- Card grid ---------- */
.grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.2rem;
}
@media (max-width: 860px) { .grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 560px) { .grid { grid-template-columns: 1fr; } }

.card {
  background: var(--panel);
  border: 1px solid var(--blue-dim);
  padding: 1.3rem 1.4rem 1.5rem;
  box-shadow: 0 0 14px rgba(43,107,255,0.12);
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}
.card h3 {
  font-size: 1rem;
  color: var(--text);
  letter-spacing: 0.04em;
  text-shadow: 0 0 8px var(--blue);
}
.card h3::before {
  content: '> ';
  color: var(--blue-bright);
}
.card p {
  color: var(--text-dim);
  font-size: 0.9rem;
  line-height: 1.55;
}

/* ---------- Threat pulse ---------- */
#threat-pulse[hidden], #threat-pulse [hidden] { display: none; }
#threat-pulse { padding-top: 2rem; }
.pulse-intro {
  max-width: 62ch;
  color: var(--text-dim);
  font-size: 0.85rem;
  margin-bottom: 1.4rem;
}
/* .card .x outranks the generic .card p rule above */
.card .stat {
  font-size: clamp(1.8rem, 5vw, 2.6rem);
  font-weight: bold;
  color: var(--blue-bright);
  text-shadow: 0 0 12px var(--blue);
  line-height: 1;
  margin: 0.2rem 0;
}
.card .stat-sub { color: var(--text-dim); font-size: 0.8rem; }
.card .card-note { color: var(--muted); font-size: 0.78rem; }
.kv {
  list-style: none;
  font-size: 0.82rem;
  color: var(--text-dim);
  margin-top: 0.2rem;
}
.kv li {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.3rem 0;
  border-bottom: 1px dotted var(--blue-faint);
}
.kv li:last-child { border-bottom: 0; }
.kv .kv-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.kv .kv-count { color: var(--blue-bright); flex: none; }
.pulse-newest { margin-top: 1.2rem; }
.pulse-newest h3 {
  font-size: 1rem;
  color: var(--text);
  letter-spacing: 0.04em;
  text-shadow: 0 0 8px var(--blue);
  margin-bottom: 0.8rem;
}
.pulse-newest h3::before {
  content: '> ';
  color: var(--blue-bright);
}
.pulse-scroll { overflow-x: auto; max-width: 100%; }
.pulse-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  white-space: nowrap;
}
.pulse-table th {
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: normal;
  padding: 0.4rem 0.6rem;
  border-bottom: 1px solid var(--blue-dim);
}
.pulse-table td {
  font-size: 0.82rem;
  color: var(--text-dim);
  padding: 0.4rem 0.6rem;
  border-bottom: 1px solid var(--blue-faint);
}
.pulse-table td:first-child { color: var(--text); }
.pulse-meta {
  margin-top: 1rem;
  font-size: 0.72rem;
  color: var(--muted);
}
.pulse-meta a { color: var(--text-dim); }
@media (max-width: 560px) {
  .card .stat { font-size: 1.7rem; }
  .pulse-table th, .pulse-table td { padding: 0.3rem 0.4rem; }
  .pulse-newest { padding: 1.2rem 1rem; }
}

/* ---------- Footer ---------- */
footer {
  position: relative;
  z-index: 2;
  text-align: center;
  padding: 2.5rem 1.25rem 3rem;
  color: var(--muted);
  font-size: 0.8rem;
  letter-spacing: 0.08em;
  background: linear-gradient(rgba(2,6,16,0) 0%, rgba(2,6,16,0.9) 60%);
}

@keyframes flicker {
  0%,19%,21%,23%,25%,54%,56%,100% { opacity: 1; }
  20%,24%,55% { opacity: 0.6; }
}
@keyframes blink {
  0%,50% { opacity: 1; }
  50.01%,100% { opacity: 0; }
}
@media (prefers-reduced-motion: reduce) {
  .wordmark, .cursor { animation: none; }
}

/* ---------- Top navigation (homepage and blog) ---------- */
.topnav {
  position: relative;
  z-index: 4;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: flex-end;
  gap: 0.4rem 1.6rem;
  max-width: 66rem;
  margin: 0 auto;
  padding: 1.1rem 1.25rem;
  font-size: 0.78rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}
.topnav [hidden] { display: none; }
.topnav:not(:has(a:not([hidden]))) { display: none; }
.topnav a { color: var(--text-dim); text-decoration: none; }
.topnav a:hover, .topnav a[aria-current="page"] { color: var(--blue-bright); text-shadow: 0 0 8px var(--blue); }
.topnav .topnav-home {
  margin-right: auto;
  color: var(--blue-bright);
  font-weight: bold;
  letter-spacing: 0.28em;
  text-shadow: 0 0 8px var(--blue);
}

/* ---------- Post lists (homepage "Latest posts" and /blog/) ---------- */
#latest { padding-top: 2rem; padding-bottom: 1rem; }
.post-list { list-style: none; display: grid; gap: 1rem; }
.post-item {
  background: var(--panel);
  border: 1px solid var(--blue-dim);
  box-shadow: 0 0 14px rgba(43,107,255,0.12);
  padding: 1.1rem 1.4rem 1.2rem;
}
.post-item:hover { border-color: var(--blue); }
.post-item :is(h2, h3) { font-size: 1.05rem; letter-spacing: 0.02em; line-height: 1.4; }
.post-item :is(h2, h3) a { color: var(--text); text-decoration: none; text-shadow: 0 0 8px var(--blue); }
.post-item :is(h2, h3) a:hover { color: var(--blue-bright); }
.post-item :is(h2, h3) a::before { content: '> '; color: var(--blue-bright); }
.post-item p { color: var(--text-dim); font-size: 0.9rem; margin-top: 0.45rem; max-width: 72ch; }
.post-meta { color: var(--muted); font-size: 0.75rem; letter-spacing: 0.08em; }
.post-item .post-meta { margin-bottom: 0.3rem; }
.more-link { margin-top: 1.1rem; font-size: 0.85rem; }
.more-link a { text-decoration: none; }
.more-link a:hover { text-decoration: underline; }
.draft-badge {
  display: inline-block;
  margin-left: 0.6rem;
  padding: 0 0.4rem;
  border: 1px solid #ffb84d;
  color: #ffb84d;
  font-size: 0.68rem;
  letter-spacing: 0.12em;
}

/* ---------- Blog pages (no rain: a calm background for long reading) ---------- */
body.blog {
  background:
    radial-gradient(ellipse 80% 50% at 50% 0%, rgba(43,107,255,0.14) 0%, rgba(2,6,16,0) 70%),
    var(--bg);
  background-attachment: fixed;
}
.blog main { padding-bottom: 2rem; }
.blog .topnav { max-width: 46rem; }
.blog-head { max-width: 46rem; margin: 0 auto; padding: 2.5rem 1.25rem 1.5rem; }
.blog-head h1 {
  font-size: clamp(1.5rem, 4.4vw, 2.3rem);
  line-height: 1.25;
  color: var(--blue-bright);
  text-shadow: 0 0 10px var(--blue), 0 0 26px var(--blue-dim);
  letter-spacing: 0.02em;
}
.blog-head .post-meta { margin-top: 0.9rem; }
.post-cover {
  width: min(64rem, calc(100vw - 2.5rem));
  margin: 0.5rem 0 2.2rem 50%;
  transform: translateX(-50%);
}
.post-cover img { display: block; width: 100%; height: auto; border: 1px solid var(--blue-dim); box-shadow: 0 0 24px rgba(43,107,255,0.18); }
.blog-head .lede { margin-top: 1rem; color: var(--text-dim); font-size: 1rem; }
.blog-list { max-width: 46rem; margin: 0 auto; padding: 0 1.25rem 2rem; }

.prose {
  max-width: 46rem;
  margin: 0 auto;
  padding: 0 1.25rem 2rem;
  font-size: 1rem;
  line-height: 1.75;
  overflow-wrap: break-word;
}
.prose > * + * { margin-top: 1.1rem; }
.prose h2 {
  margin-top: 2.6rem;
  font-size: 1.25rem;
  line-height: 1.35;
  color: var(--blue-bright);
  text-shadow: 0 0 10px var(--blue);
}
.prose h2::before { content: '> '; color: var(--blue); }
.prose h3 { margin-top: 2rem; font-size: 1.05rem; color: var(--text); text-shadow: 0 0 8px var(--blue); }
.prose h4 { margin-top: 1.6rem; font-size: 0.95rem; color: var(--text-dim); }
.prose a { text-underline-offset: 0.2em; }
.prose strong { color: #ffffff; }
.prose ul, .prose ol { padding-left: 1.6rem; }
.prose li + li { margin-top: 0.4rem; }
.prose ul { list-style: none; }
.prose ul > li { position: relative; }
.prose ul > li::before { content: '-'; position: absolute; left: -1.2rem; color: var(--blue-bright); }
.prose ol > li::marker { color: var(--blue-bright); }
.prose code {
  font-family: var(--mono);
  font-size: 0.9em;
  background: rgba(43,107,255,0.14);
  border: 1px solid var(--blue-faint);
  padding: 0.05em 0.3em;
}
.prose pre {
  background: rgba(2,6,16,0.9);
  border: 1px solid var(--blue-dim);
  box-shadow: inset 0 0 30px rgba(43,107,255,0.06);
  padding: 1rem 1.2rem;
  overflow-x: auto;
  font-size: 0.85rem;
  line-height: 1.5;
}
.prose pre code { background: none; border: 0; padding: 0; font-size: inherit; color: var(--text); }
.prose blockquote {
  border-left: 3px solid var(--blue);
  background: rgba(43,107,255,0.07);
  padding: 0.8rem 1.1rem;
  color: var(--text-dim);
}
.prose blockquote > * + * { margin-top: 0.8rem; }
.prose hr { border: 0; border-top: 1px dashed var(--blue-dim); margin: 2.4rem 0; }
.prose img { max-width: 100%; height: auto; border: 1px solid var(--blue-dim); }
/* A paragraph holding only a diagram breaks out of the reading column on wide screens. */
.prose p:has(> img:only-child), .prose p:has(> a:only-child > img) {
  width: min(64rem, calc(100vw - 2.5rem));
  margin-left: 50%;
  transform: translateX(-50%);
}
.prose p:has(> img:only-child) img, .prose p:has(> a:only-child > img) img { display: block; width: 100%; }
.table-wrap { overflow-x: auto; }
.prose table { border-collapse: collapse; width: 100%; font-size: 0.85rem; line-height: 1.5; }
.prose th {
  text-align: left;
  font-weight: normal;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-size: 0.7rem;
  color: var(--muted);
  padding: 0.45rem 0.7rem;
  border-bottom: 1px solid var(--blue-dim);
}
.prose td { padding: 0.45rem 0.7rem; border-bottom: 1px solid var(--blue-faint); color: var(--text-dim); vertical-align: top; }
.prose td:first-child { color: var(--text); }
.post-foot {
  max-width: 46rem;
  margin: 1rem auto 0;
  padding: 1.4rem 1.25rem 0;
  border-top: 1px dashed var(--blue-dim);
  font-size: 0.85rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem 1.6rem;
}
.post-foot a { text-decoration: none; }
.post-foot a:hover { text-decoration: underline; }
