/* HAPSA Cyber Awareness Portal — design system
   Brand: deep blue + lime + cyber-black, from HAPSA Technologies logo. */

:root {
  /* brand */
  --blue: #0b62e4;
  --blue-deep: #062a6b;
  --blue-bright: #3d8bff;
  --cyan: #22d3ee;
  --lime: #a4d50f;
  --lime-bright: #c3f53c;
  --silver: #c9d1dc;

  /* priority */
  --p-critical: #ff3b5c;
  --p-high: #ff8a1f;
  --p-medium: #ffc53d;
  --p-low: #4ade80;

  /* surfaces (dark = default) */
  --bg: #050a14;
  --bg-2: #0a1122;
  --surface: #0e1729;
  --surface-2: #141f36;
  --line: #1e2b45;
  --text: #e8eef7;
  --text-dim: #93a3bb;
  --text-mute: #7c8ba3;   /* WCAG AA 4.5:1 on --surface at 14px; was #64748b (3.76:1) */

  --radius: 14px;
  --radius-sm: 9px;
  --shadow: 0 18px 45px rgba(0, 0, 0, .45);
  --maxw: 1240px;
  --mono: ui-monospace, "JetBrains Mono", "SF Mono", Menlo, Consolas, monospace;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

html[data-theme="light"] {
  --bg: #f5f8fd;
  --bg-2: #eef3fa;
  --surface: #ffffff;
  --surface-2: #f2f6fc;
  --line: #d9e2f0;
  --text: #0b1729;
  --text-dim: #46586f;
  --text-mute: #5d6b80;   /* WCAG AA on white in light theme */
  --blue-bright: #0b62e4;
  --shadow: 0 14px 34px rgba(11, 40, 90, .10);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

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

img { max-width: 100%; display: block; }
a { color: var(--blue-bright); text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2, h3, h4 { line-height: 1.2; margin: 0 0 .5em; font-weight: 750; letter-spacing: -.02em; }
h1 { font-size: clamp(2rem, 4.5vw, 3.1rem); }
h2 { font-size: clamp(1.5rem, 2.8vw, 2.15rem); }
h3 { font-size: 1.2rem; }
p { margin: 0 0 1em; }

:focus-visible { outline: 2px solid var(--lime); outline-offset: 3px; border-radius: 4px; }

.wrap { max-width: var(--maxw); margin: 0 auto; padding: 0 20px; }
.section { padding: 68px 0; }
.section-sm { padding: 40px 0; }
.center { text-align: center; }
.dim { color: var(--text-dim); }
.mute { color: var(--text-mute); font-size: .88rem; }
.mono { font-family: var(--mono); }
.hide { display: none !important; }

.eyebrow {
  font-family: var(--mono); font-size: .74rem; letter-spacing: .18em;
  text-transform: uppercase; color: var(--lime); margin: 0 0 12px;
}

.lede { font-size: 1.1rem; color: var(--text-dim); max-width: 72ch; }

/* ---------- skip link ---------- */
.skip {
  position: absolute; left: -9999px; top: 0; z-index: 999;
  background: var(--lime); color: #06101f; padding: 10px 16px; font-weight: 700;
}
.skip:focus { left: 12px; top: 12px; }

/* ---------- header ---------- */
.hdr {
  position: sticky; top: 0; z-index: 60;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}
.hdr-in { display: flex; align-items: center; gap: 18px; height: 66px; }
/* Route back to the commercial site. Hidden on narrow screens — the footer column carries it. */
.up-link {
  font-size: .78rem; letter-spacing: .04em; white-space: nowrap; color: var(--text-dim);
  padding: 7px 13px; border: 1px solid var(--line); border-radius: 100px;
  transition: border-color .3s, color .3s;
}
.up-link:hover { color: var(--text); border-color: var(--lime); text-decoration: none; }
@media (max-width: 900px) { .up-link { display: none; } }
.brand { display: flex; align-items: center; gap: 11px; flex: none; }
/* flex:none meant the header could not shrink below "HAPSA Cyber Awareness" + the action
   buttons, pushing ~8px of horizontal scroll onto every page at 390px. Let it shrink. */
@media (max-width: 900px) {
  .hdr-in { gap: 12px; }
  .brand { flex: 0 1 auto; min-width: 0; }
  .brand-txt { min-width: 0; }
  .brand-txt b { font-size: .86rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .brand-txt span { font-size: .55rem; letter-spacing: .12em; }
}
/* The stacked logo is shield-over-wordmark. In the header we want the shield only —
   the wordmark would duplicate the text beside it. Crop to the top of the transparent
   PNG rather than shipping a second asset. */
.brand img {
  width: 46px; height: 34px; object-fit: cover; object-position: center top;
  flex: none;
}
.brand-txt { display: flex; flex-direction: column; line-height: 1.05; }
.brand-txt b { font-size: .95rem; letter-spacing: -.01em; }
.brand-txt span { font-family: var(--mono); font-size: .6rem; letter-spacing: .16em; color: var(--lime); text-transform: uppercase; }

.nav { display: flex; gap: 2px; margin-left: auto; flex-wrap: wrap; }
.nav a {
  color: var(--text-dim); font-size: .87rem; font-weight: 600;
  padding: 8px 11px; border-radius: 8px; text-decoration: none; white-space: nowrap;
}
.nav a:hover { color: var(--text); background: var(--surface-2); text-decoration: none; }
.nav a[aria-current="page"] { color: var(--lime); background: color-mix(in srgb, var(--lime) 12%, transparent); }

.hdr-actions { display: flex; gap: 8px; align-items: center; flex: none; }
.icon-btn {
  width: 38px; height: 38px; display: grid; place-items: center; cursor: pointer;
  background: var(--surface); border: 1px solid var(--line); border-radius: 10px;
  color: var(--text); font-size: 1rem;
}
.icon-btn:hover { border-color: var(--blue); }
.menu-btn { display: none; }

@media (max-width: 1080px) {
  .menu-btn { display: grid; }
  .nav {
    position: fixed; inset: 66px 0 auto 0; flex-direction: column; gap: 0;
    background: var(--bg-2); border-bottom: 1px solid var(--line);
    padding: 10px 20px 18px; max-height: calc(100vh - 66px); overflow-y: auto;
  }
  .nav:not(.open) { display: none; }
  .nav a { padding: 11px 8px; font-size: .95rem; }
}

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 8px; cursor: pointer;
  padding: 11px 20px; border-radius: 10px; font-weight: 700; font-size: .92rem;
  border: 1px solid transparent; text-decoration: none; font-family: inherit;
  transition: transform .12s ease, filter .12s ease;
}
.btn:hover { text-decoration: none; transform: translateY(-1px); }
.btn-primary { background: linear-gradient(135deg, var(--blue) 0%, var(--blue-deep) 100%); color: #fff; }
.btn-lime { background: var(--lime); color: #06101f; }
.btn-ghost { background: var(--surface); border-color: var(--line); color: var(--text); }
.btn-sos { background: var(--p-critical); color: #fff; }
.btn-sm { padding: 7px 13px; font-size: .82rem; }

/* ---------- cards / grid ---------- */
.grid { display: grid; gap: 18px; }
.g2 { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.g3 { grid-template-columns: repeat(auto-fit, minmax(268px, 1fr)); }
.g4 { grid-template-columns: repeat(auto-fit, minmax(212px, 1fr)); }

.card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 22px; position: relative;
}
.card h3 { margin-bottom: 8px; }
.card p:last-child { margin-bottom: 0; }
a.card { color: inherit; display: block; transition: border-color .15s, transform .15s; }
a.card:hover { border-color: var(--blue); transform: translateY(-2px); text-decoration: none; }

.card-ic {
  width: 42px; height: 42px; border-radius: 11px; display: grid; place-items: center;
  font-size: 1.25rem; margin-bottom: 14px;
  background: color-mix(in srgb, var(--blue) 18%, transparent);
  border: 1px solid color-mix(in srgb, var(--blue) 35%, transparent);
}

/* ---------- badges ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 5px; font-family: var(--mono);
  font-size: .66rem; letter-spacing: .1em; text-transform: uppercase; font-weight: 700;
  padding: 3px 9px; border-radius: 999px; border: 1px solid;
}
.b-critical { color: var(--p-critical); border-color: color-mix(in srgb, var(--p-critical) 45%, transparent); background: color-mix(in srgb, var(--p-critical) 12%, transparent); }
.b-high { color: var(--p-high); border-color: color-mix(in srgb, var(--p-high) 45%, transparent); background: color-mix(in srgb, var(--p-high) 12%, transparent); }
.b-medium { color: var(--p-medium); border-color: color-mix(in srgb, var(--p-medium) 45%, transparent); background: color-mix(in srgb, var(--p-medium) 12%, transparent); }
.b-low { color: var(--p-low); border-color: color-mix(in srgb, var(--p-low) 45%, transparent); background: color-mix(in srgb, var(--p-low) 12%, transparent); }
.b-neutral { color: var(--text-dim); border-color: var(--line); background: var(--surface-2); }
.b-lime { color: var(--lime); border-color: color-mix(in srgb, var(--lime) 45%, transparent); background: color-mix(in srgb, var(--lime) 12%, transparent); }

.tag {
  display: inline-block; font-size: .74rem; padding: 3px 10px; border-radius: 999px;
  background: var(--surface-2); border: 1px solid var(--line); color: var(--text-dim); margin: 0 5px 5px 0;
}

/* ---------- hero ---------- */
.hero { position: relative; overflow: hidden; padding: 84px 0 72px; }
.hero::before {
  content: ""; position: absolute; inset: 0; z-index: 0; pointer-events: none;
  background:
    radial-gradient(60% 70% at 15% 0%, color-mix(in srgb, var(--blue) 26%, transparent) 0%, transparent 62%),
    radial-gradient(45% 60% at 88% 12%, color-mix(in srgb, var(--lime) 14%, transparent) 0%, transparent 60%);
}
.hero::after {
  content: ""; position: absolute; inset: 0; z-index: 0; opacity: .5; pointer-events: none;
  background-image: linear-gradient(var(--line) 1px, transparent 1px), linear-gradient(90deg, var(--line) 1px, transparent 1px);
  background-size: 56px 56px;
  mask-image: radial-gradient(70% 60% at 50% 30%, #000 0%, transparent 78%);
}
.hero > * { position: relative; z-index: 1; }
.hero-grid { display: grid; grid-template-columns: 1.15fr .85fr; gap: 44px; align-items: center; }
@media (max-width: 900px) { .hero-grid { grid-template-columns: 1fr; } }

/* ---------- stats ---------- */
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; }
.stat b { display: block; font-size: 1.85rem; font-family: var(--mono); color: var(--lime); line-height: 1.1; letter-spacing: -.02em; }
.stat span { font-size: .82rem; color: var(--text-dim); }

/* ---------- alert / callouts ---------- */
.callout {
  border-left: 3px solid var(--blue); background: var(--surface-2);
  padding: 14px 18px; border-radius: 0 var(--radius-sm) var(--radius-sm) 0; margin: 0 0 18px;
}
.callout.warn { border-color: var(--p-high); }
.callout.danger { border-color: var(--p-critical); }
.callout.ok { border-color: var(--p-low); }
.callout.verify { border-color: var(--p-medium); }
.callout p:last-child { margin-bottom: 0; }
/* Only the leading label becomes a block — inline <b> inside the body must stay inline. */
.callout > b:first-child { display: block; margin-bottom: 3px; font-size: .9rem; }

/* ---------- forms ---------- */
input, select, textarea {
  font-family: inherit; font-size: .95rem; color: var(--text);
  background: var(--surface); border: 1px solid var(--line);
  border-radius: 10px; padding: 11px 14px; width: 100%;
}
input:focus, select:focus, textarea:focus { border-color: var(--blue); outline: none; }
label { display: block; font-size: .85rem; font-weight: 650; margin-bottom: 6px; color: var(--text-dim); }
.field { margin-bottom: 16px; }
.row { display: flex; gap: 10px; flex-wrap: wrap; }

.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip {
  cursor: pointer; font-size: .82rem; font-weight: 600; padding: 7px 14px; border-radius: 999px;
  background: var(--surface); border: 1px solid var(--line); color: var(--text-dim);
}
.chip:hover { color: var(--text); }
.chip[aria-pressed="true"] { background: var(--blue); border-color: var(--blue); color: #fff; }

/* ---------- tables ---------- */
.tbl-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); }
table { border-collapse: collapse; width: 100%; font-size: .9rem; min-width: 560px; }
th, td { text-align: left; padding: 11px 14px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { background: var(--surface-2); font-size: .74rem; text-transform: uppercase; letter-spacing: .08em; color: var(--text-dim); }
tr:last-child td { border-bottom: none; }

/* ---------- threat detail ---------- */
.detail { display: grid; grid-template-columns: 250px 1fr; gap: 40px; align-items: start; }
/* min-width:0 is load-bearing: a grid item defaults to min-width:auto, so the single mobile
   column sized itself to the longest table-of-contents entry (562px) and scrolled the whole
   threat profile sideways on a phone. */
@media (max-width: 900px) { .detail { grid-template-columns: minmax(0, 1fr); } .detail > * { min-width: 0; } }
.toc { position: sticky; top: 82px; max-height: calc(100vh - 110px); overflow-y: auto; font-size: .84rem; }
.toc a { display: block; padding: 5px 10px; border-left: 2px solid var(--line); color: var(--text-dim); }
.toc a:hover { color: var(--lime); border-color: var(--lime); text-decoration: none; }
.sec { scroll-margin-top: 84px; margin-bottom: 34px; }
.sec h2 { font-size: 1.3rem; display: flex; gap: 10px; align-items: baseline; }
.sec h2 .n { font-family: var(--mono); font-size: .8rem; color: var(--lime); }

ul.checks { list-style: none; padding: 0; margin: 0 0 1em; }
ul.checks li { padding: 6px 0 6px 28px; position: relative; border-bottom: 1px solid var(--line); }
ul.checks li:last-child { border-bottom: none; }
ul.checks li::before { content: "▸"; position: absolute; left: 6px; color: var(--lime); }
ul.checks.x li::before { content: "✕"; color: var(--p-critical); }

ol.steps { padding-left: 0; counter-reset: s; list-style: none; margin: 0 0 1em; }
ol.steps li { counter-increment: s; padding: 8px 0 8px 40px; position: relative; }
ol.steps li::before {
  content: counter(s); position: absolute; left: 0; top: 8px;
  width: 26px; height: 26px; border-radius: 8px; display: grid; place-items: center;
  background: color-mix(in srgb, var(--blue) 20%, transparent); border: 1px solid color-mix(in srgb, var(--blue) 40%, transparent);
  font-family: var(--mono); font-size: .78rem; color: var(--blue-bright);
}

/* ---------- meters ---------- */
.meter { height: 8px; background: var(--surface-2); border-radius: 999px; overflow: hidden; border: 1px solid var(--line); }
.meter > i { display: block; height: 100%; background: linear-gradient(90deg, var(--blue), var(--lime)); border-radius: 999px; transition: width .3s ease; }

/* ---------- footer ---------- */
.ftr { border-top: 1px solid var(--line); background: var(--bg-2); padding: 52px 0 26px; margin-top: 40px; }
.ftr-grid { display: grid; grid-template-columns: 1.5fr repeat(4, 1fr); gap: 28px; }
@media (max-width: 1100px) { .ftr-grid { grid-template-columns: 1fr 1fr 1fr; } }
@media (max-width: 820px) { .ftr-grid { grid-template-columns: 1fr 1fr; } }
.ftr h3 { font-size: .78rem; text-transform: uppercase; letter-spacing: .12em; color: var(--lime); margin-bottom: 12px; }
.ftr a { display: block; color: var(--text-dim); font-size: .88rem; padding: 3px 0; }
.ftr a:hover { color: var(--text); }
.ftr-btm { border-top: 1px solid var(--line); margin-top: 34px; padding-top: 20px; display: flex; justify-content: space-between; gap: 14px; flex-wrap: wrap; font-size: .82rem; color: var(--text-mute); }
.ftr-legal { display: flex; gap: 18px; flex-wrap: wrap; }
.ftr-legal a { display: inline; color: var(--text-dim); font-size: inherit; padding: 0; }
.ftr-legal a:hover { color: var(--lime); }

/* ---------- emergency bar ---------- */
.sos-bar {
  background: linear-gradient(90deg, var(--p-critical), #b8102f);
  color: #fff; font-size: .84rem; font-weight: 600; text-align: center; padding: 7px 20px;
}
.sos-bar a { color: #fff; text-decoration: underline; }

/* ---------- search overlay ---------- */
.ovl { position: fixed; inset: 0; z-index: 100; background: rgba(2, 6, 16, .72); backdrop-filter: blur(5px); padding: 8vh 20px; }
.ovl[hidden] { display: none; }
.ovl-box { max-width: 660px; margin: 0 auto; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.ovl-box input { border: none; border-bottom: 1px solid var(--line); border-radius: 0; padding: 17px 20px; font-size: 1.05rem; }
.ovl-res { max-height: 56vh; overflow-y: auto; }
.ovl-res a { display: block; padding: 11px 20px; border-bottom: 1px solid var(--line); color: var(--text); }
.ovl-res a:hover, .ovl-res a.sel { background: var(--surface-2); text-decoration: none; }
.ovl-res small { display: block; color: var(--text-mute); font-size: .8rem; }

/* ---------- misc ---------- */
.divider { height: 1px; background: var(--line); border: none; margin: 34px 0; }
.pill-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 14px; }
.kbd { font-family: var(--mono); font-size: .72rem; border: 1px solid var(--line); background: var(--surface-2); border-radius: 5px; padding: 1px 6px; color: var(--text-dim); }
.scroll-x { overflow-x: auto; }

@media print {
  .hdr, .ftr, .sos-bar, .toc, .icon-btn, .btn { display: none !important; }
  body { background: #fff; color: #000; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}
