/* ==============================================================
   AURIX — base.css
   Tokens, reset, typography, rail nav, topbar, footer, buttons
   ============================================================== */

/* ---------------- Tokens ---------------- */
:root {
  --f-display: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --f-body: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --f-mono: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --f-sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;

  --t-hero: clamp(2.4rem, 1.2rem + 4.6vw, 4.6rem);
  --t-h2: clamp(1.9rem, 1.2rem + 2.6vw, 3.1rem);
  --t-h3: clamp(1.5rem, 1.15rem + 1.2vw, 2.05rem);
  --t-h4: clamp(1.15rem, 1.05rem + .45vw, 1.4rem);
  --t-body: 1rem;
  --t-sm: .885rem;
  --t-xs: .76rem;

  --s1: .25rem; --s2: .5rem; --s3: .75rem; --s4: 1rem;
  --s5: 1.5rem; --s6: 2rem; --s7: 3rem; --s8: 4.5rem;
  --sec: clamp(2.5rem, 1.8rem + 2.2vw, 3.8rem);

  --rail-w: 92px;
  --top-h: 64px;
  --wrap: 76rem;
  --r-sm: 6px; --r-md: 12px; --r-lg: 18px;

  --eo: cubic-bezier(.2, .9, .3, 1);
  --z-rail: 100; --z-fly: 110; --z-veil: 200; --z-top: 1000;
}

/* ---------------- Light: Warm Ivory & Indigo Vista (Default) ---------------- */
:root,
:root[data-theme="light"] {
  color-scheme: light;
  --bg: #f9fae8;
  --bg-2: #eef0d8;
  --panel: rgba(255, 255, 255, .78);
  --panel-2: rgba(11, 28, 58, .06);
  --line: rgba(11, 28, 58, .13);
  --line-2: rgba(11, 28, 58, .25);
  --ink: #0b1c3a;
  --ink-2: #283a50;
  --ink-3: #5a6b80;

  --volt: #14492b;
  --volt-ink: #ffffff;
  --volt-text: #14492b;
  --volt-dim: rgba(20, 73, 43, .12);
  --azure: #0b1c3a;
  --azure-text: #0b1c3a;
  --azure-dim: rgba(11, 28, 58, .1);
  --danger: #d43c3c;

  --glow-volt: rgba(20, 73, 43, .25);
  --glow-azure: rgba(11, 28, 58, .2);
  --solid: rgba(255, 255, 255, .96);
  --shadow: 0 20px 48px -24px rgba(11, 28, 58, .18);
  --grid-line: rgba(11, 28, 58, .04);
  --img-tone: none;
  --chart-track: rgba(11, 28, 58, .12);
}

/* ---------------- Dark: Midnight Navy (Indigo Vista 104) ---------------- */
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #060f1e;
  --bg-2: #0b1c3a;
  --panel: rgba(249, 250, 232, .05);
  --panel-2: rgba(249, 250, 232, .09);
  --line: rgba(249, 250, 232, .14);
  --line-2: rgba(249, 250, 232, .26);
  --ink: #ffffff;
  --ink-2: #f1f5f9;
  --ink-3: #cbd5e1;

  --volt: #14492b;
  --volt-ink: #ffffff;
  --volt-text: #1d7d47;
  --volt-dim: rgba(29, 125, 71, .28);
  --azure: #1d7d47;
  --azure-text: #1d7d47;
  --azure-dim: rgba(29, 125, 71, .16);
  --danger: #ff5d5d;

  --glow-volt: rgba(29, 125, 71, .35);
  --glow-azure: rgba(29, 125, 71, .25);
  --solid: rgba(11, 28, 58, .94);
  --shadow: 0 24px 60px -24px rgba(0, 0, 0, .7);
  --grid-line: rgba(249, 250, 232, .04);
  --img-tone: saturate(.92) brightness(.92);
  --chart-track: rgba(249, 250, 232, .12);
}

/* ---------------- Reset ---------------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  background: var(--bg);
  color: var(--ink);
  font: 400 var(--t-body)/1.65 var(--f-body);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  transition: background-color .3s ease, color .3s ease;
}
/* blueprint grid backdrop */
body::before {
  content: ""; position: fixed; inset: 0; z-index: -2; pointer-events: none;
  background:
    linear-gradient(var(--grid-line) 1px, transparent 1px) 0 0 / 100% 56px,
    linear-gradient(90deg, var(--grid-line) 1px, transparent 1px) 0 0 / 56px 100%;
  mask: radial-gradient(120% 90% at 50% 0%, #000 30%, transparent 78%);
  -webkit-mask: radial-gradient(120% 90% at 50% 0%, #000 30%, transparent 78%);
}

img, svg, canvas { display: block; max-width: 100%; }
img { height: auto; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
select { color-scheme: dark; }
:root[data-theme="light"] select { color-scheme: light; }
select option { background-color: var(--bg-2); color: var(--ink); }
select option:disabled { color: var(--ink-3); }
:root[data-theme="light"] select option { background-color: #ffffff; color: var(--ink); }
button { background: none; border: 0; padding: 0; cursor: pointer; }
ul[class], ol[class] { list-style: none; padding: 0; }

h1, h2, h3, h4 {
  font-family: var(--f-display);
  font-weight: 600;
  line-height: 1.14;
  letter-spacing: .005em;
  text-wrap: balance;
}

::selection { background: var(--volt); color: var(--volt-ink); }
:focus-visible { outline: 2px solid var(--azure); outline-offset: 3px; border-radius: 4px; }

.skip {
  position: fixed; top: -80px; left: 16px; z-index: var(--z-top);
  padding: .55rem 1rem; border-radius: 8px;
  background: var(--volt); color: var(--volt-ink); font-weight: 700;
  transition: top .25s var(--eo);
}
.skip:focus { top: 12px; }

.ic { width: 1.15em; height: 1.15em; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; flex: none; }

/* ---------------- Layout ---------------- */
.page { min-height: 100vh; }
.wrap { width: min(100% - 2.6rem, var(--wrap)); margin-inline: auto; }
.sec { position: relative; padding-block: var(--sec); }
.sec--flush { padding-top: 0; }

/* mono system label — structural device */
.sys {
  display: flex; align-items: center; gap: .7rem;
  font: 600 var(--t-xs)/1 var(--f-sans);
  letter-spacing: .14em; text-transform: uppercase;
  color: var(--volt-text);
  margin-bottom: var(--s4);
}
.sys::before {
  content: "";
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--volt-text);
  box-shadow: 0 0 10px var(--glow-volt), 0 0 3px var(--volt-text);
  flex-shrink: 0;
  animation: blink 2.2s ease-in-out infinite;
}
.sys::after { content: ""; flex: 1; max-width: 72px; height: 1px; background: linear-gradient(90deg, var(--line-2), transparent); }
.sys--center { justify-content: center; }
.sys--center::after { display: none; }

.head { max-width: 47rem; margin-bottom: clamp(2.4rem, 2rem + 2vw, 4rem); }
.head--center { margin-inline: auto; text-align: center; }
.head h2 { font-size: var(--t-h2); text-transform: uppercase; letter-spacing: .01em; }
.head h2 b { font-weight: 600; color: var(--volt-text); }
.head p:not(.sys) { color: var(--ink-2); font-size: 1.06rem; margin-top: var(--s4); text-wrap: pretty; }

/* ---------------- Buttons ---------------- */
.btn {
  position: relative; display: inline-flex; align-items: center; justify-content: center;
  gap: .6rem; min-height: 50px; padding: .8rem 1.7rem;
  font: 600 var(--t-sm)/1.1 var(--f-display);
  letter-spacing: .06em; text-transform: uppercase;
  border-radius: var(--r-sm);
  border: 1px solid transparent;
  transition: transform .25s var(--eo), box-shadow .25s ease, background-color .2s ease, border-color .2s ease, color .2s ease;
  touch-action: manipulation;
  overflow: clip;
}
.btn .ic { transition: transform .25s var(--eo); }
.btn:active { transform: scale(.97); }

.btn--volt { background: var(--volt); color: var(--volt-ink); box-shadow: 0 12px 34px -14px var(--glow-volt); }
.btn--volt:hover { transform: translateY(-2px); box-shadow: 0 16px 40px -14px var(--glow-volt); }
.btn--volt:hover .ic { transform: translateX(3px); }
/* scan sweep */
.btn--volt::after {
  content: ""; position: absolute; top: 0; bottom: 0; width: 44%;
  left: -60%; transform: skewX(-18deg);
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .5), transparent);
  transition: left .5s ease;
}
.btn--volt:hover::after { left: 130%; }

.btn--line { border-color: var(--line-2); color: var(--ink); background: var(--panel); }
.btn--line:hover { border-color: var(--volt-text); color: var(--volt-text); transform: translateY(-2px); }

.btn--text { min-height: 44px; padding: .4rem .1rem; color: var(--volt-text); border-radius: 4px; }
.btn--text:hover .ic { transform: translateX(4px); }

.btn--sm { min-height: 42px; padding: .55rem 1.15rem; font-size: var(--t-xs); }
.btn--block { width: 100%; }

/* ---------------- RAIL NAV (desktop) ---------------- */
.rail {
  position: fixed; inset: 0 auto 0 0; z-index: var(--z-rail);
  width: var(--rail-w);
  display: flex; flex-direction: column; align-items: center;
  padding: 14px 0;
  background: var(--solid);
  border-right: 1px solid var(--line);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}
.rail__logo { display: grid; place-items: center; width: 46px; height: 46px; margin-bottom: 10px; }
.rail__logo svg { width: 38px; height: 38px; }

.rail__nav { display: flex; flex-direction: column; gap: 2px; width: 100%; padding: 10px 8px; flex: 1; overflow-y: auto; scrollbar-width: none; }
.rail__nav::-webkit-scrollbar { display: none; }

.rail__link {
  position: relative;
  display: flex; flex-direction: column; align-items: center; gap: 5px;
  padding: 10px 4px 9px; border-radius: 10px;
  color: var(--ink-2);
  transition: color .18s ease, background-color .18s ease;
}
.rail__link .ic { width: 20px; height: 20px; }
.rail__link span { font: 500 .6rem/1 var(--f-mono); letter-spacing: .1em; text-transform: uppercase; }
.rail__link:hover { color: var(--ink); background: var(--panel-2); }
.rail__link[aria-current="page"], .rail__link.is-active { color: var(--volt-text); }
.rail__link[aria-current="page"]::before, .rail__link.is-active::before {
  content: ""; position: absolute; left: -8px; top: 50%; translate: 0 -50%;
  width: 3px; height: 60%; border-radius: 3px;
  background: var(--volt);
  box-shadow: 0 0 12px var(--glow-volt);
}

.rail__foot { display: flex; flex-direction: column; align-items: center; gap: 12px; padding-top: 10px; border-top: 1px solid var(--line); width: calc(100% - 20px); }

/* services flyout */
.fly {
  position: fixed; left: calc(var(--rail-w) + 12px); top: 58px; z-index: var(--z-fly);
  width: max-content; min-width: 22rem; max-width: 26rem; padding: .55rem;
  background: var(--solid);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  opacity: 0; visibility: hidden; transform: translateX(-10px);
  transition: opacity .22s ease, transform .22s var(--eo), visibility 0s .22s;
}
.fly::before {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: -16px;
  width: 16px;
}
body.admin-bar .fly {
  top: 90px;
}
.fly.is-open { opacity: 1; visibility: visible; transform: none; transition: opacity .22s ease, transform .22s var(--eo); }
.fly a { display: flex; gap: .8rem; align-items: flex-start; padding: .75rem .8rem; border-radius: 10px; transition: background-color .15s ease; }
.fly a:hover { background: var(--panel-2); }
.fly__ic { flex: none; width: 38px; height: 38px; border-radius: 9px; display: grid; place-items: center; background: var(--volt-dim); color: var(--volt-text); }
.fly__ic .ic { width: 19px; height: 19px; }
.fly__t { font: 600 var(--t-sm)/1.3 var(--f-display); white-space: nowrap; }
.fly__d { font-size: var(--t-xs); color: var(--ink-2); white-space: nowrap; }

/* theme switch (square HUD style) */
.mode {
  width: 44px; height: 44px; border-radius: 10px;
  display: grid; place-items: center;
  border: 1px solid var(--line);
  color: var(--ink-2);
  transition: color .2s ease, border-color .2s ease, transform .2s var(--eo);
}
.mode:hover { color: var(--volt-text); border-color: var(--line-2); transform: translateY(-1px); }
.mode .ic { width: 19px; height: 19px; }
.mode .i-moon { display: none; }
.mode .i-sun { display: block; }
:root[data-theme="dark"] .mode .i-sun { display: none; }
:root[data-theme="dark"] .mode .i-moon { display: block; }
:root[data-theme="light"] .mode .i-sun { display: block; }
:root[data-theme="light"] .mode .i-moon { display: none; }

/* ---------------- TOP BAR (mobile / tablet) ---------------- */
.topbar {
  position: fixed; inset: 0 0 auto 0; z-index: 9999;
  display: none; align-items: center; gap: var(--s3);
  height: var(--top-h);
  padding-inline: max(1.1rem, env(safe-area-inset-left));
  background: #ffffff;
  border-bottom: 1px solid var(--line);
}
:root[data-theme="dark"] .topbar {
  background: #0b1c3a !important;
  border-bottom: 1px solid var(--line-2) !important;
}
:root[data-theme="light"] .topbar {
  background: #ffffff !important;
  border-bottom: 1px solid var(--line) !important;
}
.brand { display: inline-flex; align-items: center; gap: .55rem; font: 700 1.15rem/1 var(--f-display); letter-spacing: .04em; margin-right: auto; }
.brand svg { width: 30px; height: 30px; }
.topbar .brand {
  min-width: 0;
  max-height: calc(var(--top-h) - 16px);
}
.topbar .brand__img,
.topbar .brand img {
  height: 32px !important;
  max-height: 32px !important;
  width: auto !important;
  max-width: 170px !important;
  object-fit: contain !important;
  display: block !important;
}
.topbar .mode,
.topbar .burger {
  flex-shrink: 0;
}

.burger {
  width: 44px; height: 44px; border-radius: 10px;
  border: 1px solid var(--line);
  display: grid; place-items: center;
}
.burger .i-x { display: none; }
.burger[aria-expanded="true"] .i-x { display: block; }
.burger[aria-expanded="true"] .i-menu { display: none; }

/* mobile overlay */
.veil {
  position: fixed; inset: 0; z-index: calc(var(--z-rail) - 5);
  padding: calc(var(--top-h) + 16px) 1.1rem 1.4rem;
  background: var(--bg);
  overflow-y: auto;
  opacity: 0; visibility: hidden; transform: translateY(-8px);
  transition: opacity .28s ease, transform .28s var(--eo), visibility 0s .28s;
}
.veil.is-open { opacity: 1; visibility: visible; transform: none; transition: opacity .28s ease, transform .28s var(--eo); }
.veil__link {
  display: flex; align-items: center; justify-content: center;
  text-align: center;
  min-height: 56px; padding: .6rem .4rem;
  border-bottom: 1px solid var(--line);
  font: 600 1.25rem/1.2 var(--f-display); text-transform: uppercase; letter-spacing: .03em;
}
.veil__link .ic { color: var(--ink-2); }
.veil__link[aria-current="page"] { color: var(--volt-text); }
.veil__group { padding: .7rem .4rem .4rem; }
.veil__group p { font: 500 var(--t-xs)/1 var(--f-mono); letter-spacing: .16em; text-transform: uppercase; color: var(--ink-3); margin-bottom: .4rem; }
.veil__sub { display: flex; min-height: 48px; align-items: center; color: var(--ink-2); font-weight: 500; }
.veil__sub:hover { color: var(--volt-text); }
.veil .btn { margin-top: var(--s5); }

/* ---------------- Content offset ---------------- */
.main { margin-left: var(--rail-w); }

/* ---------------- FOOTER ---------------- */
.footer { margin-left: var(--rail-w); border-top: 1px solid var(--line); background: var(--bg-2); }
.footer__grid {
  display: grid;
  grid-template-columns: minmax(260px, 320px) max-content max-content minmax(200px, 240px);
  justify-content: space-between;
  gap: 1.5rem;
  padding-block: var(--s8) var(--s7);
}
.footer__blurb { color: var(--ink-2); font-size: var(--t-sm); max-width: 30ch; margin-top: var(--s4); }
.footer .brand { margin-bottom: var(--s2); }
.footer .brand__img {
  height: clamp(44px, 3vw, 50px) !important;
  max-width: 250px !important;
  width: auto !important;
  object-fit: contain !important;
}
.footer .brand svg {
  width: 44px !important;
  height: 44px !important;
}
.footer__h {
  font: 700 var(--t-sm)/1.2 var(--f-sans);
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--volt-text);
  padding-bottom: 0.4rem;
  border-bottom: 2.5px solid var(--volt-text);
  margin-bottom: var(--s4);
  display: inline-block;
  width: fit-content;
}
.footer__links { display: grid; gap: .3rem; justify-items: start; }
.footer__links a { color: var(--ink-2); font-size: var(--t-sm); padding: .32rem 0; transition: color .15s ease, translate .2s var(--eo); }
.footer__links a:hover { color: var(--volt-text); translate: 3px 0; }
.footer__contact { display: grid; gap: .55rem; margin-bottom: var(--s5); }
.footer__contact li { display: flex; gap: .6rem; align-items: center; color: var(--ink-2); font-size: var(--t-sm); }
.footer__contact .ic { color: var(--volt-text); width: 16px; height: 16px; flex-shrink: 0; }
.footer__contact a { color: var(--ink-2); transition: color .15s ease, translate .2s var(--eo); display: inline-block; }
.footer__contact a:hover { color: var(--volt-text); translate: 3px 0; }
.footer__social { display: flex; gap: .55rem; margin-top: var(--s5); }
.footer__social a {
  width: 40px; height: 40px; border-radius: 9px;
  display: grid; place-items: center;
  border: 1px solid var(--line); color: var(--ink-2);
  transition: color .15s ease, border-color .15s ease, transform .2s var(--eo);
}
.footer__social a:hover { color: var(--volt-text); border-color: var(--volt-text); transform: translateY(-2px); }
.footer__social svg { width: 16px; height: 16px; }

/* status strip */
.statusbar {
  display: flex; flex-wrap: wrap; gap: var(--s3) var(--s5);
  align-items: center; justify-content: center;
  text-align: center;
  border-top: 1px solid var(--line);
  padding-block: var(--s4);
  font: 400 var(--t-xs)/1.5 var(--f-sans);
  color: var(--ink-2);
}
/* Agency credit: flows as prose inside the copyright span, never its own column. */
.footer-credit { white-space: normal; }
.footer-credit__heart { font-size: .95em; line-height: 1; vertical-align: -1px; }
.statusbar a { color: var(--ink-2); }
.statusbar a:hover { color: var(--volt-text); }
.statusbar .ok { display: inline-flex; align-items: center; gap: .5rem; }
.statusbar .ok i {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--volt); box-shadow: 0 0 10px var(--glow-volt);
  animation: blink 2.4s ease-in-out infinite;
}
@keyframes blink { 0%, 100% { opacity: 1; } 50% { opacity: .35; } }

/* ---------------- Responsive chrome ---------------- */
@media (max-width: 64rem) {
  .rail, .fly { display: none; }
  .topbar { display: flex; z-index: 9999; }
  .main, .footer { margin-left: 0; }
  .main { padding-top: var(--top-h); }
  .footer__grid { grid-template-columns: 1fr 1fr; }
  .footer__blurb { max-width: 100%; line-height: 1.6; }
}
@media (max-width: 48rem) {
  h1, h2, h3, h4,
  .head h2 {
    text-wrap: normal;
    text-wrap: wrap;
  }
}
@media (max-width: 40rem) {
  .wrap { width: min(100% - 2rem, var(--wrap)); }
  .footer__grid { grid-template-columns: 1fr; gap: var(--s5); }
  .statusbar { justify-content: center; }
}

/* Apex Expansion Button definition in dark mode */
:root[data-theme="dark"] .btn--volt { border: 1px solid rgba(29, 125, 71, .32); }
