/* ===========================================================
   Cybersec91 / Infosec91 — Internal Portal
   Shared minimalist stylesheet (v2)
   =========================================================== */

:root {
  /* Dark (default) — editorial, restrained */
  --bg:           #0B0D12;
  --bg-elev:      #11141B;
  --bg-card:      #14181F;
  --bg-subtle:    #1A1E26;
  --bg-deep:      #08090D;

  --line:         #1F242E;
  --line-strong:  #2A303C;

  --ink:          #ECEDEF;
  --ink-muted:    #8B91A0;
  --ink-dim:      #5A6072;

  --accent:       #7F77DD;   /* cybersec91 violet */
  --accent-hi:    #A9A3EE;
  --accent-lo:    #4540A0;

  --signal:       #5DCAA5;   /* infosec91 teal */
  --signal-hi:    #7FE3C2;

  --warn:         #EF9F27;
  --warn-hi:      #FFC062;

  --crit:         #E3725F;
  --crit-hi:      #F0997B;

  /* Type */
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-mono: 'JetBrains Mono', 'SF Mono', ui-monospace, Menlo, Consolas, monospace;
  --font-serif: 'Source Serif Pro', 'Iowan Old Style', 'Apple Garamond', Georgia, serif;
}

[data-theme="light"] {
  --bg:           #FAF9F4;
  --bg-elev:      #FFFFFF;
  --bg-card:      #FFFFFF;
  --bg-subtle:    #F2F0E8;
  --bg-deep:      #EDEAE0;

  --line:         #E4E1D6;
  --line-strong:  #C9C5B7;

  --ink:          #1A1A18;
  --ink-muted:    #54524D;
  --ink-dim:      #888780;

  --accent:       #4540A0;
  --accent-hi:    #2C2870;
  --accent-lo:    #2C2870;

  --signal:       #0F6E56;
  --signal-hi:    #085041;

  --warn:         #854F0B;
  --warn-hi:      #633806;

  --crit:         #993C1D;
  --crit-hi:      #712B13;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--ink);
  font-size: 15px;
  line-height: 1.7;
  font-feature-settings: 'ss01', 'cv11';
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* ============ TOP NAV ============ */
.topnav {
  position: sticky; top: 0; z-index: 100;
  background: color-mix(in srgb, var(--bg) 90%, transparent);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}
.topnav-inner {
  max-width: 1280px; margin: 0 auto;
  padding: 14px 32px;
  display: flex; align-items: center; justify-content: space-between;
  gap: 24px;
}
.topnav-brand {
  display: flex; align-items: center; gap: 14px;
  text-decoration: none; color: var(--ink);
  flex-shrink: 0;
}
.brand-mark {
  width: 56px; height: 32px;
  background-image: url("e91-logo-transparent.png");
  background-size: contain;
  background-repeat: no-repeat;
  background-position: left center;
}
[data-theme="light"] .brand-mark {
  background-image: url("e91-logo-transparent.png");
}
.brand-context {
  font-size: 12px; color: var(--ink-muted);
  padding-left: 14px; border-left: 1px solid var(--line);
  letter-spacing: 0.2px;
}
.topnav-links {
  display: flex; align-items: center; gap: 2px;
  flex-wrap: wrap;
}
.topnav-link {
  font-size: 13px; font-weight: 500;
  color: var(--ink-muted); text-decoration: none;
  padding: 7px 12px; border-radius: 6px;
  transition: all 0.15s;
  white-space: nowrap;
}
.topnav-link:hover { color: var(--ink); background: var(--bg-subtle); }
.topnav-link.active { color: var(--accent-hi); background: color-mix(in srgb, var(--accent) 10%, transparent); }
[data-theme="light"] .topnav-link.active { color: var(--accent); }

.theme-toggle {
  width: 32px; height: 32px; border-radius: 8px;
  background: transparent; border: 1px solid var(--line);
  display: inline-flex; align-items: center; justify-content: center;
  cursor: pointer; padding: 0; margin-left: 8px;
  color: var(--ink-muted);
  transition: all 0.15s;
}
.theme-toggle:hover { background: var(--bg-subtle); color: var(--ink); border-color: var(--line-strong); }
.theme-toggle svg { width: 15px; height: 15px; 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; }

/* ============ LAYOUT ============ */
.shell { max-width: 1280px; margin: 0 auto; padding: 72px 32px 80px; }
.shell-narrow { max-width: 920px; margin: 0 auto; padding: 72px 32px 80px; }

/* ============ TYPE ============ */
.eyebrow {
  font-size: 11px; font-weight: 600; letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--ink-muted);
}
.eyebrow-accent { color: var(--accent-hi); }
[data-theme="light"] .eyebrow-accent { color: var(--accent); }
.eyebrow-signal { color: var(--signal); }

.h-display {
  font-size: 56px; font-weight: 500; letter-spacing: -1.6px;
  line-height: 1.04; color: var(--ink);
}
.h-section {
  font-size: 32px; font-weight: 500; letter-spacing: -0.6px;
  line-height: 1.2;
}
.h-card {
  font-size: 20px; font-weight: 600; letter-spacing: -0.2px;
  line-height: 1.3;
}

.lede {
  font-size: 19px; line-height: 1.55; color: var(--ink-muted);
  max-width: 70ch;
}
.body { font-size: 15px; line-height: 1.7; color: var(--ink-muted); }
.body-strong { color: var(--ink); }

.mono { font-family: var(--font-mono); font-feature-settings: 'tnum'; }

/* ============ SECTION HEAD ============ */
.section { margin-top: 96px; }
.section:first-of-type { margin-top: 0; }
.section-head {
  display: flex; align-items: flex-end; justify-content: space-between;
  border-bottom: 1px solid var(--line);
  padding-bottom: 18px;
  margin-bottom: 32px;
  gap: 32px;
}
.section-head-left { display: flex; align-items: baseline; gap: 18px; flex-wrap: wrap; }
.section-num {
  font-family: var(--font-mono);
  font-size: 12px; color: var(--ink-dim);
  letter-spacing: 1px;
}
.section-title {
  font-size: 13px; font-weight: 600; letter-spacing: 1.5px;
  text-transform: uppercase; color: var(--ink);
}
.section-meta {
  font-family: var(--font-mono);
  font-size: 11px; color: var(--ink-dim);
  letter-spacing: 0.5px;
}

/* ============ CARDS ============ */
.card {
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 28px;
  transition: border-color 0.15s, transform 0.15s;
}
.card-hover:hover { border-color: var(--line-strong); }
.card-link {
  text-decoration: none; color: inherit;
  display: flex; flex-direction: column;
}
.card-link:hover { border-color: color-mix(in srgb, var(--accent) 50%, var(--line)); }

/* ============ TAGS ============ */
.tag {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 10.5px; font-weight: 600; letter-spacing: 1.2px;
  text-transform: uppercase;
  padding: 4px 9px; border-radius: 4px;
  border: 1px solid var(--line);
  color: var(--ink-muted);
  background: var(--bg-subtle);
}
.tag-accent  { color: var(--accent-hi); border-color: color-mix(in srgb, var(--accent) 35%, transparent); background: color-mix(in srgb, var(--accent) 12%, transparent); }
[data-theme="light"] .tag-accent { color: var(--accent); }
.tag-signal  { color: var(--signal); border-color: color-mix(in srgb, var(--signal) 35%, transparent); background: color-mix(in srgb, var(--signal) 12%, transparent); }
[data-theme="light"] .tag-signal { color: var(--signal); }
.tag-warn    { color: var(--warn-hi); border-color: color-mix(in srgb, var(--warn) 35%, transparent); background: color-mix(in srgb, var(--warn) 10%, transparent); }
[data-theme="light"] .tag-warn { color: var(--warn); }
.tag-crit    { color: var(--crit-hi); border-color: color-mix(in srgb, var(--crit) 35%, transparent); background: color-mix(in srgb, var(--crit) 10%, transparent); }
[data-theme="light"] .tag-crit { color: var(--crit); }

/* ============ STATUS DOTS ============ */
.dot {
  width: 7px; height: 7px; border-radius: 50%;
  display: inline-block; flex-shrink: 0;
}
.dot-live    { background: var(--signal); box-shadow: 0 0 10px color-mix(in srgb, var(--signal) 60%, transparent); }
.dot-build   { background: var(--warn); }
.dot-plan    { background: var(--ink-dim); }
.dot-future  { background: var(--accent); }

/* ============ FOOTER ============ */
.portal-footer {
  border-top: 1px solid var(--line);
  margin: 96px 32px 0;
  padding: 32px 0 28px;
  max-width: 1280px;
  margin-left: auto; margin-right: auto;
  font-size: 12px;
  color: var(--ink-dim);
  display: flex; justify-content: space-between; align-items: center; gap: 24px;
  flex-wrap: wrap;
}
.portal-footer .pf-mono { font-family: var(--font-mono); letter-spacing: 0.5px; }

/* ============ RESPONSIVE ============ */

/* Tablet — 1100px and below: tighter padding, slightly smaller type */
@media (max-width: 1100px) {
  .topnav-inner { padding: 13px 24px; }
  .shell, .shell-narrow { padding: 56px 24px 64px; }
  .section { margin-top: 80px; }
  .h-display { font-size: 44px; letter-spacing: -1.2px; }
  .h-section { font-size: 28px; }
}

/* Mobile / narrow tablet — 820px: nav collapses, single-column */
@media (max-width: 820px) {
  body { font-size: 14.5px; }
  .topnav-inner {
    padding: 10px 16px;
    flex-wrap: nowrap;
    align-items: center;
    gap: 12px;
  }
  .brand-context { display: none; }
  .brand-mark { width: 48px; height: 28px; }

  /* Hamburger button */
  .nav-burger {
    display: inline-flex !important;
    width: 36px; height: 36px;
    align-items: center; justify-content: center;
    background: transparent; border: 1px solid var(--line);
    border-radius: 8px; cursor: pointer;
    color: var(--ink-muted);
    margin-left: auto;
  }
  .nav-burger:hover { color: var(--ink); border-color: var(--line-strong); background: var(--bg-subtle);}
  .nav-burger svg { width: 16px; height: 16px;}

  /* Drawer behaviour */
  .topnav-links {
    position: fixed;
    top: 56px; left: 0; right: 0;
    background: var(--bg);
    border-bottom: 1px solid var(--line);
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    padding: 8px 16px 16px;
    transform: translateY(-110%);
    transition: transform 0.22s ease;
    box-shadow: 0 12px 24px rgba(0,0,0,0.18);
    max-height: calc(100vh - 56px);
    overflow-y: auto;
  }
  .topnav-links.open { transform: translateY(0); }
  .topnav-link {
    padding: 11px 12px;
    font-size: 14px;
    border-radius: 8px;
    border-bottom: 1px solid var(--line);
  }
  .topnav-link:last-of-type { border-bottom: 0; }
  .theme-toggle { margin: 8px 0 0; align-self: flex-start;}

  /* Shell + type */
  .shell, .shell-narrow { padding: 36px 18px 56px; }
  .h-display { font-size: 32px; letter-spacing: -0.8px; line-height: 1.08;}
  .h-section { font-size: 22px; letter-spacing: -0.4px;}
  .h-card { font-size: 17px; }
  .lede { font-size: 15.5px; }
  .body { font-size: 14px; }
  .pullquote { font-size: 18px; padding-left: 18px;}

  /* Section heads stack */
  .section { margin-top: 56px; }
  .section-head {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
    padding-bottom: 14px;
    margin-bottom: 22px;
  }
  .section-head-left { gap: 10px;}

  /* Cards */
  .card { padding: 20px; border-radius: 10px;}

  /* Footer */
  .portal-footer {
    margin: 64px 18px 0;
    padding: 24px 0 22px;
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
    text-align: left;
  }
}

/* Hamburger hidden by default on desktop */
.nav-burger { display: none; }

/* Very small phones */
@media (max-width: 420px) {
  .h-display { font-size: 28px; }
  .h-section { font-size: 19px; }
  .shell, .shell-narrow { padding: 28px 14px 48px;}
  .section { margin-top: 44px; }
}

/* Touch targets — make small mono labels still tappable when used as links */
@media (hover: none) and (pointer: coarse) {
  a, button { -webkit-tap-highlight-color: transparent; }
}

/* Prevent overflow from inline SVG diagrams on narrow screens */
svg { max-width: 100%; height: auto; }
img { max-width: 100%; height: auto; }
table { max-width: 100%; }
.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }

/* ============ UTILITY ============ */
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.row-tight { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.divider {
  height: 1px; background: var(--line); margin: 32px 0;
  border: 0;
}
.kbd {
  font-family: var(--font-mono);
  font-size: 11px;
  padding: 2px 6px;
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  background: var(--bg-subtle);
  color: var(--ink-muted);
}

/* simple subtle link */
a.tlink { color: var(--accent-hi); text-decoration: none; border-bottom: 1px solid color-mix(in srgb, var(--accent) 30%, transparent); }
[data-theme="light"] a.tlink { color: var(--accent); }
a.tlink:hover { border-bottom-color: var(--accent); }

/* Pull-quote */
.pullquote {
  font-family: var(--font-serif);
  font-size: 22px;
  line-height: 1.5;
  letter-spacing: -0.2px;
  color: var(--ink);
  font-weight: 400;
  font-style: italic;
  padding: 8px 0 8px 24px;
  border-left: 2px solid var(--accent);
  max-width: 60ch;
}
