:root {
  --space:      #0a0713;
  --space-2:    #150a24;
  --steel:      #93a3b8;
  --steel-deep: #45566b;
  --red:        #ff3b2e;
  --red-deep:   #c1170f;
  --gold:       #f4b53a;
  --green:      #7ee787;
  --ink:        #eaf0f8;
  --muted:      #98a3b7;
  --panel:      rgba(16, 12, 30, 0.66);
  --line:       rgba(150, 170, 200, 0.16);
  --display: "Orbitron", "Arial Narrow", "Helvetica Neue", sans-serif;
  --body:    "Helvetica Neue", Arial, system-ui, sans-serif;
}

* { box-sizing: border-box; }
html, body { height: 100%; }

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

/* --- Deep space: nebula wash + drifting starfield ------------------------------------------------------------- */
.nebula {
  position: fixed;
  inset: 0;
  z-index: -2;
  background:
    radial-gradient(60% 50% at 22% 18%, rgba(150, 40, 110, 0.45), transparent 70%),
    radial-gradient(55% 45% at 82% 28%, rgba(74, 36, 120, 0.50), transparent 70%),
    radial-gradient(70% 60% at 60% 100%, rgba(40, 30, 90, 0.45), transparent 70%),
    linear-gradient(160deg, var(--space-2), var(--space));
  filter: saturate(1.1);
}
.starfield {
  position: fixed;
  inset: -10%;
  z-index: -1;
  background:
    radial-gradient(1px 1px at 12% 24%, #fff, transparent),
    radial-gradient(1px 1px at 28% 62%, #cdd6f4, transparent),
    radial-gradient(1.5px 1.5px at 44% 18%, #fff, transparent),
    radial-gradient(1px 1px at 61% 48%, #fff, transparent),
    radial-gradient(2px 2px at 76% 22%, #ffe9c0, transparent),
    radial-gradient(1px 1px at 83% 71%, #cdd6f4, transparent),
    radial-gradient(1px 1px at 50% 84%, #fff, transparent),
    radial-gradient(1.5px 1.5px at 8% 80%, #fff, transparent);
  background-repeat: repeat;
  opacity: 0.9;
  animation: drift 140s linear infinite;
}
@keyframes drift { from { transform: translateY(0); } to { transform: translateY(-40px); } }

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

/* --- Landing hero -------------------------------------------------------------------------------------------- */
.landing { flex: 1; }
.hero {
  position: relative;
  max-width: 880px;
  margin: 0 auto;
  text-align: center;
  padding: 5rem 1.5rem 3rem;
}
.hero .ship {
  display: block;
  width: min(680px, 92%);
  margin: 0 auto 1.5rem;
  filter: drop-shadow(0 18px 40px rgba(0, 0, 0, 0.6));
  animation: float 9s ease-in-out infinite;
}
/* Real hero image (static/img/yamato.png) when provided; falls back to .ship SVG. */
.hero-ship {
  display: block;
  width: min(640px, 92%);
  margin: 0 auto 1.5rem;
  border-radius: 10px;
  filter: drop-shadow(0 18px 44px rgba(0, 0, 0, 0.65));
  animation: float 9s ease-in-out infinite;
}
@keyframes float { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-10px); } }

.eyebrow {
  letter-spacing: 0.4em;
  text-transform: uppercase;
  font-size: 0.7rem;
  color: var(--muted);
  margin: 0 0 0.6rem;
}
.logo {
  font-family: var(--display);
  font-weight: 900;
  font-style: italic;
  line-height: 0.92;
  margin: 0;
  letter-spacing: 0.06em;
  font-size: clamp(2.8rem, 9vw, 5.6rem);
  color: var(--red);
  text-shadow: 0 0 24px rgba(255, 59, 46, 0.55), 0 2px 0 var(--red-deep);
}
.logo b { display: block; color: var(--red); }
.subtitle {
  font-family: var(--display);
  font-weight: 500;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  font-size: clamp(0.8rem, 2.4vw, 1.05rem);
  color: var(--gold);
  margin: 0.9rem 0 0;
}
.subtitle i { font-style: italic; color: var(--ink); }
.tagline {
  color: var(--ink);
  font-size: 1.08rem;
  max-width: 34rem;
  margin: 1rem auto 2rem;
}
.cta {
  display: inline-block;
  font-family: var(--display);
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  font-size: 0.95rem;
  color: #fff;
  padding: 0.9rem 2rem;
  border-radius: 4px;
  background: linear-gradient(180deg, var(--red), var(--red-deep));
  box-shadow: 0 0 22px rgba(255, 59, 46, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.25);
  border: 1px solid rgba(255, 120, 100, 0.5);
}
.cta:hover { text-decoration: none; filter: brightness(1.08); box-shadow: 0 0 30px rgba(255, 59, 46, 0.7); }
.gate-note { color: var(--muted); font-size: 0.85rem; margin-top: 1.6rem; }
.gate-note strong { color: var(--gold); }
.gate-note b { color: var(--ink); }

/* --- Crew cards ---------------------------------------------------------------------------------------------- */
.crew {
  max-width: 940px;
  margin: 0 auto;
  padding: 1rem 1.5rem 4rem;
  text-align: center;
}
.crew h2 {
  font-family: var(--display);
  font-weight: 700;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  font-size: 0.95rem;
  color: var(--gold);
  margin: 0 0 1.4rem;
}
.crew-cards {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 0.9rem;
}
.crew-cards a {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.3rem;
  padding: 1.3rem 1.1rem;
  background: var(--panel);
  border: 1px solid var(--line);
  border-top: 3px solid var(--gold);
  border-radius: 8px;
  color: var(--ink);
  text-align: center;
  backdrop-filter: blur(4px);
  transition: border-color 0.15s, transform 0.15s;
}
.crew-cards a:hover {
  text-decoration: none;
  border-top-color: var(--red);
  transform: translateY(-3px);
}
/* Avatar: photo at static/img/crew/<slug>.jpg when provided; else the initial badge. */
.crew-cards .avatar {
  position: relative;
  width: 72px;
  height: 72px;
  margin-bottom: 0.5rem;
  border-radius: 50%;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle at 50% 35%, var(--steel), var(--steel-deep));
  border: 1px solid var(--line);
}
.crew-cards .avatar img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.crew-cards .avatar b { font-family: var(--display); font-weight: 900; font-size: 1.4rem; color: var(--space); opacity: 0.85; }
.crew-cards .rank {
  font-size: 0.64rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
}
.crew-cards .cname { font-family: var(--display); font-weight: 700; font-size: 1.02rem; }
.crew-note { color: var(--muted); font-size: 0.86rem; margin-top: 1.6rem; }

/* --- Top bar (wiki) ------------------------------------------------------------------------------------------ */
.bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.6rem;
  border-bottom: 1px solid var(--line);
  background: rgba(10, 7, 19, 0.7);
  backdrop-filter: blur(6px);
}
.brand { font-family: var(--display); font-weight: 700; color: var(--gold); letter-spacing: 0.16em; }
.who { color: var(--muted); font-size: 0.82rem; }

/* --- Wiki ---------------------------------------------------------------------------------------------------- */
.wiki { flex: 1; width: 100%; max-width: 820px; margin: 0 auto; padding: 2.6rem 1.6rem 3rem; }
.wiki h1 {
  font-family: var(--display);
  font-weight: 700;
  font-size: 2rem;
  margin: 0 0 0.3rem;
  letter-spacing: 0.04em;
  color: var(--gold);
}
.lede { color: var(--muted); margin: 0 0 2rem; }
.group { margin-bottom: 2rem; }
.group h2 {
  font-family: var(--display);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.22em;
  color: var(--red);
  border-bottom: 1px solid var(--line);
  padding-bottom: 0.4rem;
}
.entries { list-style: none; margin: 0.6rem 0 0; padding: 0; }
.entries li { padding: 0.35rem 0; }
.entries a { color: var(--ink); font-size: 1.05rem; }
.entries a:hover { color: var(--gold); }

/* --- Search ------------------------------------------------------------------------------------------------ */
.search-form {
  display: flex;
  gap: 0.6rem;
  margin: 0 0 2rem;
}
.search-form input[type="search"] {
  flex: 1;
  font-family: var(--body);
  font-size: 1rem;
  color: var(--ink);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 0.65rem 0.9rem;
  outline: none;
}
.search-form input[type="search"]::placeholder { color: var(--muted); }
.search-form input[type="search"]:focus { border-color: var(--gold); }
.search-form button {
  font-family: var(--display);
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-size: 0.85rem;
  color: #fff;
  padding: 0 1.4rem;
  border-radius: 4px;
  background: linear-gradient(180deg, var(--red), var(--red-deep));
  border: 1px solid rgba(255, 120, 100, 0.5);
  box-shadow: 0 0 18px rgba(255, 59, 46, 0.35);
  cursor: pointer;
}
.search-form button:hover { filter: brightness(1.08); }

.search-results .hit { padding: 0.7rem 0; border-bottom: 1px solid var(--line); }
.search-results .hit a { color: var(--ink); font-size: 1.05rem; }
.search-results .hit a:hover { color: var(--gold); }
.search-results .hit-cat {
  font-family: var(--display);
  font-size: 0.66rem;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--red);
  margin-left: 0.7rem;
}
.search-results .hit-snippet {
  margin: 0.35rem 0 0;
  color: var(--muted);
  font-size: 0.92rem;
}
.search-results .hit-snippet mark {
  background: rgba(244, 181, 58, 0.25);
  color: var(--gold);
  padding: 0 0.15em;
  border-radius: 2px;
}

/* --- Article ----------------------------------------------------------------------------------------------- */
.article .crumb { margin: 0 0 1.4rem; font-size: 0.9rem; }
/* Per-article profile image at top of /wiki/<slug>. The figure is removed entirely
   by the template's onerror when no static/img/articles/<slug>.jpg is dropped in,
   so the article body leads cleanly for image-less entries. */
.article-portrait {
  margin: 0 0 1.6rem;
  width: 168px;
  height: 168px;
  border-radius: 50%;
  overflow: hidden;
  background: radial-gradient(circle at 50% 35%, var(--steel), var(--steel-deep));
  border: 1px solid var(--line);
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.55), 0 0 0 3px rgba(244, 181, 58, 0.18);
}
.article-portrait img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.article .kicker {
  font-family: var(--display);
  text-transform: uppercase;
  letter-spacing: 0.2em;
  font-size: 0.72rem;
  color: var(--red);
  margin: 0;
}
.article p { margin: 0 0 1.1rem; }
.article .updated {
  color: var(--muted);
  font-size: 0.8rem;
  border-top: 1px solid var(--line);
  padding-top: 1rem;
  margin-top: 2rem;
}

/* --- NOC Dashboard (/wiki/noc) ------------------------------------------------------------------------------ */
/* Live tile grid showing Cloud Armor + IAP defense activity. Reuses the Star Blazers theme tokens (--gold, --red,
   --green) and the topbar partial. The page is IAP-gated by the LB's /wiki/* path rule and auto-refreshes via a
   <meta http-equiv="refresh"> tag in the template head — no JS framework. Tile geometry: CSS grid with
   auto-fit minmax so the page reads at-a-glance from across a conference room without horizontal scroll. */
.noc-dash { flex: 1; width: 100%; max-width: 1180px; margin: 0 auto; padding: 1.6rem 1.5rem 4rem; }
.noc-dash-hero { text-align: center; padding: 1.4rem 0 1.6rem; }
.noc-dash-hero .eyebrow {
  letter-spacing: 0.42em; text-transform: uppercase; font-size: 0.66rem;
  color: var(--muted); margin: 0 0 0.6rem;
}
.noc-dash-hero h1 {
  font-family: var(--display); font-weight: 900; font-style: italic; margin: 0;
  letter-spacing: 0.05em; font-size: clamp(2rem, 6vw, 3.4rem); color: var(--red);
  text-shadow: 0 0 22px rgba(255, 59, 46, 0.5), 0 2px 0 var(--red-deep);
}
.noc-dash-hero h1 b { color: var(--ink); }
.noc-dash-hero .subtitle {
  font-family: var(--display); font-weight: 500; letter-spacing: 0.14em; text-transform: uppercase;
  font-size: 0.78rem; color: var(--muted); margin: 0.6rem 0 0;
}
.noc-dash-hero .live { color: var(--green); font-weight: 700; }
.noc-dash-hero .live::before { content: "● "; animation: blink 1.6s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0.25; } }

.noc-dash-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1rem;
  margin-top: 1rem;
}

.noc-dash-tile {
  display: flex; flex-direction: column; gap: 0.6rem;
  padding: 1.1rem 1.2rem 1.2rem;
  background: var(--panel); border: 1px solid var(--line);
  border-top: 3px solid var(--steel-deep);
  border-radius: 8px; color: var(--ink); backdrop-filter: blur(4px);
}
.noc-dash-tile.t-wide { grid-column: 1 / -1; }
.noc-dash-tile.k-counts   { border-top-color: var(--gold); }
.noc-dash-tile.k-ips      { border-top-color: var(--red); }
.noc-dash-tile.k-urls     { border-top-color: var(--red); }
.noc-dash-tile.k-priors   { border-top-color: var(--gold); }
.noc-dash-tile.k-alerts   { border-top-color: var(--green); }
/* Tripwire tile: gold accent — "caught one in the trap". A pop of warmth on
   a board that is otherwise red (blocks) and green (alerts healthy). */
.noc-dash-tile.k-tripwire { border-top-color: var(--gold); }
.noc-dash-tile .t-num-trip {
  color: var(--gold);
  text-shadow: 0 0 16px rgba(244, 181, 58, 0.45);
}

.noc-dash-tile .t-label {
  font-family: var(--display); font-weight: 700; font-size: 0.72rem;
  letter-spacing: 0.2em; text-transform: uppercase; color: var(--muted);
  margin: 0;
}

/* Counts tile: two big numbers side by side (1h / 24h). Demo-readable from across a room. */
.noc-dash-tile .t-twin { display: flex; gap: 1rem; }
.noc-dash-tile .t-twin-cell { flex: 1; display: flex; flex-direction: column; align-items: flex-start; }
.noc-dash-tile .t-num {
  font-family: var(--display); font-weight: 900;
  font-size: clamp(2.2rem, 6vw, 3.4rem);
  line-height: 1; color: var(--ink);
}
.noc-dash-tile .t-num-hot { color: var(--red); text-shadow: 0 0 16px rgba(255, 59, 46, 0.45); }
.noc-dash-tile .t-sub {
  margin-top: 0.3rem;
  font-family: var(--display); font-size: 0.66rem; letter-spacing: 0.18em;
  text-transform: uppercase; color: var(--muted);
}

/* Top-N list tiles: ordered list, key on the left, count badge on the right. */
.noc-dash-tile .t-list { list-style: none; margin: 0; padding: 0; }
.noc-dash-tile .t-list li {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 0.6rem;
  padding: 0.35rem 0;
  border-bottom: 1px solid var(--line);
  font-size: 0.92rem;
}
.noc-dash-tile .t-list li:last-child { border-bottom: 0; }
.noc-dash-tile .t-key { color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.noc-dash-tile .t-key-mono { font-family: "Menlo", "Monaco", "Consolas", monospace; font-size: 0.86rem; }
.noc-dash-tile .t-count {
  font-family: var(--display); font-weight: 700; color: var(--gold);
  background: rgba(244, 181, 58, 0.12); padding: 0.1rem 0.55rem;
  border-radius: 4px; font-size: 0.82rem;
}

.noc-dash-tile .t-empty { color: var(--muted); font-size: 0.86rem; margin: 0.3rem 0 0; }
.noc-dash-tile .t-note  { color: var(--muted); font-size: 0.78rem; margin: 0.4rem 0 0; }
.noc-dash-tile .t-note-warn { color: var(--gold); }

/* Alert policies tile: one row per policy, status dot + name + enabled/disabled + last-change timestamp. */
.noc-dash-tile .t-alerts { list-style: none; margin: 0; padding: 0; }
.noc-dash-tile .t-alert-row {
  display: grid;
  grid-template-columns: 0.6rem 1fr auto auto;
  align-items: center;
  gap: 0.7rem;
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--line);
  font-size: 0.92rem;
}
.noc-dash-tile .t-alert-row:last-child { border-bottom: 0; }
.noc-dash-tile .t-alert-dot {
  width: 0.6rem; height: 0.6rem; border-radius: 50%;
  background: var(--steel-deep);
}
.noc-dash-tile .noc-alert-green .t-alert-dot { background: var(--green); box-shadow: 0 0 8px rgba(126, 231, 135, 0.6); }
.noc-dash-tile .noc-alert-amber .t-alert-dot { background: var(--gold); box-shadow: 0 0 8px rgba(244, 181, 58, 0.6); }
.noc-dash-tile .noc-alert-red   .t-alert-dot { background: var(--red);   box-shadow: 0 0 8px rgba(255, 59, 46, 0.6); }
.noc-dash-tile .t-alert-name  { color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.noc-dash-tile .t-alert-state {
  font-family: var(--display); font-size: 0.7rem; letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--muted);
}
.noc-dash-tile .noc-alert-red .t-alert-state { color: var(--red); }
.noc-dash-tile .t-alert-when {
  color: var(--muted); font-size: 0.74rem;
  font-family: "Menlo", "Monaco", "Consolas", monospace;
}

/* --- Footer ------------------------------------------------------------------------------------------------ */
.site-footer {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.5rem;
  padding: 1.2rem 1.6rem;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.78rem;
}
