/* ============================================================
   Vertbits Lab — global.css
   Reset · variables · typography · glass · nav · footer · theming
   ============================================================ */

/* ---------- Reset ---------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
img, svg { display: block; max-width: 100%; }
button { font: inherit; color: inherit; background: none; border: none; cursor: pointer; }
a { color: inherit; text-decoration: none; }
input, textarea, select { font: inherit; }
ul { list-style: none; }

/* ---------- Variables (Dark — default) ---------- */
:root {
  --bg:             #080c16;
  --bg-card:        #111827;
  --bg-surface:     #1a2035;
  --border:         rgba(255,255,255,0.07);
  --border-hover:   rgba(255,255,255,0.15);
  --text-primary:   #e2e8f0;
  --text-secondary: #94a3b8;
  --text-muted:     #5b6b82;
  --accent:         #00e5c7;
  --accent-dim:     rgba(0,229,199,0.10);
  --accent-hover:   #00c9ae;
  --accent-glow:    rgba(0,229,199,0.45);
  --on-accent:      #04211d;
  --danger:         #ef4444;
  --warning:        #f59e0b;
  --success:        #22c55e;

  --field-bg:        rgba(255,255,255,0.05);
  --field-bg-focus:  rgba(255,255,255,0.085);

  --nav-bg:         rgba(8,12,22,0.85);
  --footer-bg:      rgba(10,14,26,0.6);
  --term-bg:        rgba(0,0,0,0.35);

  /* --font-serif is the display/heading font (Space Grotesk) — kept name for back-compat */
  --font-serif: 'Space Grotesk', system-ui, -apple-system, sans-serif;
  --font-display: 'Space Grotesk', system-ui, -apple-system, sans-serif;
  --font-sans:  'Inter', system-ui, -apple-system, sans-serif;
  --font-mono:  'JetBrains Mono', 'SFMono-Regular', Menlo, monospace;

  --nav-h: 80px;
  --maxw: 1120px;
}

/* ---------- Variables (Light) ---------- */
[data-theme="light"] {
  --bg:             #e9e8e3;
  --bg-card:        #f6f5f1;
  --bg-surface:     #dedcd5;
  --border:         rgba(15,23,42,0.10);
  --border-hover:   rgba(15,23,42,0.22);
  --text-primary:   #11151f;
  --text-secondary: #3f4a5c;
  --text-muted:     #76808f;
  --accent:         #008f7a;
  --accent-dim:     rgba(0,143,122,0.12);
  --accent-hover:   #007a68;
  --accent-glow:    rgba(0,143,122,0.32);
  --on-accent:      #f2fffc;

  --field-bg:        rgba(15,23,42,0.045);
  --field-bg-focus:  rgba(15,23,42,0.07);

  --nav-bg:         rgba(233,232,227,0.85);
  --footer-bg:      rgba(246,245,241,0.7);
  --term-bg:        rgba(15,23,42,0.06);
}

/* ---------- Base ---------- */
html { background: var(--bg); }
body {
  font-family: var(--font-sans);
  color: var(--text-primary);
  line-height: 1.6;
  font-size: 17px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  min-height: 100vh;
  background: transparent;
  position: relative;
  z-index: 0;
  transition: color 0.3s ease;
}
body.page-inner { padding-top: var(--nav-h); }

/* ---------- Ambient background ---------- */
/* Animated constellation is drawn by js/background.js into #bgCanvas (z-index -2).
   These drifting red glows add depth behind it. */
body::after {
  content: ''; position: fixed; inset: -25%; z-index: -1; pointer-events: none;
  background:
    radial-gradient(closest-side, rgba(251,40,75,0.15), transparent 70%) 16% 20% / 64% 64% no-repeat,
    radial-gradient(closest-side, rgba(190,18,60,0.11), transparent 70%) 84% 80% / 56% 56% no-repeat;
  animation: bg-drift 30s ease-in-out infinite alternate;
}
[data-theme="light"] body::after {
  background:
    radial-gradient(closest-side, rgba(225,29,72,0.10), transparent 70%) 16% 20% / 64% 64% no-repeat,
    radial-gradient(closest-side, rgba(159,18,57,0.07), transparent 70%) 84% 80% / 56% 56% no-repeat;
}
#bgCanvas { position: fixed; inset: 0; width: 100%; height: 100%; z-index: -2; pointer-events: none; display: block; }

/* ---------- Frosted glass (realistic) ----------
   Four layers: refractive tinted fill · masked gradient edge that
   "catches the light" · diagonal specular streak · inner shadows. */
:root {
  --glass-fill-a: rgba(255,255,255,0.09);
  --glass-fill-b: rgba(255,255,255,0.025);
  --glass-fill-c: rgba(255,255,255,0.055);
  --glass-edge-hi: rgba(255,255,255,0.55);
  --glass-edge-lo: rgba(255,255,255,0.07);
  --glass-streak: rgba(255,255,255,0.10);
  --glass-shadow: rgba(0,0,0,0.65);
}
[data-theme="light"] {
  --glass-fill-a: rgba(255,255,255,0.62);
  --glass-fill-b: rgba(255,255,255,0.30);
  --glass-fill-c: rgba(255,255,255,0.48);
  --glass-edge-hi: rgba(255,255,255,0.95);
  --glass-edge-lo: rgba(255,255,255,0.35);
  --glass-streak: rgba(255,255,255,0.55);
  --glass-shadow: rgba(15,23,42,0.22);
}

.glass {
  position: relative;
  border-radius: 22px;
  background: linear-gradient(135deg,
    var(--glass-fill-a) 0%,
    var(--glass-fill-b) 36%,
    var(--glass-fill-b) 60%,
    var(--glass-fill-c) 100%);
  -webkit-backdrop-filter: blur(24px) saturate(1.55) brightness(1.07);
  backdrop-filter: blur(24px) saturate(1.55) brightness(1.07);
  box-shadow:
    0 40px 90px -42px var(--glass-shadow),
    inset 0 1px 0 rgba(255,255,255,0.16),
    inset 0 -1px 0 rgba(255,255,255,0.035),
    inset 1px 0 0 rgba(255,255,255,0.05),
    inset -1px 0 0 rgba(255,255,255,0.025);
}
.glass > * { position: relative; z-index: 1; }

/* gradient edge — bright where light hits (top-left), faint elsewhere */
.glass::before {
  content: ''; position: absolute; inset: 0; z-index: 2;
  border-radius: inherit; padding: 1px; pointer-events: none;
  background: linear-gradient(155deg,
    var(--glass-edge-hi) 0%,
    var(--glass-edge-lo) 28%,
    rgba(255,255,255,0.02) 55%,
    rgba(255,255,255,0.20) 100%);
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
          mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
          mask-composite: exclude;
}
/* diagonal specular streak + ambient top-left bloom */
.glass::after {
  content: ''; position: absolute; inset: 0; z-index: 0;
  border-radius: inherit; pointer-events: none; overflow: hidden;
  background:
    linear-gradient(115deg,
      transparent 38%,
      var(--glass-streak) 45%,
      rgba(255,255,255,0.03) 52%,
      transparent 60%),
    radial-gradient(130% 65% at 8% 0%, rgba(255,255,255,0.085), transparent 55%);
  background-size: 220% 100%, 100% 100%;
  background-position: 78% 0, 0 0;
  transition: background-position 1.1s cubic-bezier(0.22,0.7,0.2,1);
}
/* the streak glides across when the panel is hovered — light moving over glass */
.glass:hover::after { background-position: 22% 0, 0 0; }

h1, h2, h3, h4 { font-family: var(--font-display); font-weight: 600; line-height: 1.08; letter-spacing: -0.5px; }
.serif { font-family: var(--font-serif); }
.mono  { font-family: var(--font-mono); }

.container { max-width: var(--maxw); margin: 0 auto; padding: 0 24px; width: 100%; }

::selection { background: var(--accent); color: var(--bg); }

/* subtle themed scrollbar */
::-webkit-scrollbar { width: 10px; }
::-webkit-scrollbar-thumb { background: var(--bg-surface); border-radius: 5px; }
::-webkit-scrollbar-thumb:hover { background: var(--border-hover); }

/* ---------- A11y / utility ---------- */
.sr-only {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* ---------- Section kicker (mono tag with animated rule) ---------- */
.section-tag {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 1.5px;
  color: var(--text-muted);
  text-transform: uppercase;
}
.kicker {
  display: inline-flex; align-items: center; gap: 12px;
  font-family: var(--font-mono); font-size: 12px;
  letter-spacing: 2.5px; text-transform: uppercase;
  color: var(--accent);
}
.kicker::before {
  content: ''; width: 26px; height: 1.5px; background: var(--accent);
  transform: scaleX(0); transform-origin: left;
  animation: rule-in 0.8s cubic-bezier(0.22,0.7,0.2,1) 0.15s forwards;
}

/* ---------- Trust chips ---------- */
.chips { display: flex; flex-wrap: wrap; gap: 10px; }
.chips span {
  display: inline-flex; align-items: center; gap: 8px;
  font-family: var(--font-mono); font-size: 11.5px; letter-spacing: 0.3px;
  color: var(--text-secondary);
  border: 1px solid var(--border); border-radius: 999px;
  padding: 7px 14px;
  background: var(--field-bg);
  transition: border-color 0.25s ease, color 0.25s ease;
}
.chips span::before { content: '✓'; color: var(--accent); font-weight: 700; }
.chips span:hover { border-color: var(--accent); color: var(--text-primary); }

/* ---------- Buttons ---------- */
.btn-outline {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 14px;
  letter-spacing: 0.5px;
  color: var(--accent);
  background: transparent;
  border: 1.5px solid var(--accent);
  border-radius: 2px;
  padding: 14px 38px;
  transition: background-color 0.25s ease, color 0.25s ease, box-shadow 0.25s ease;
}
.btn-outline:hover { background: var(--accent); color: var(--on-accent); box-shadow: 0 0 24px var(--accent-glow); }

.btn-accent {
  position: relative; overflow: hidden;
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  cursor: pointer; border: none; border-radius: 999px;
  padding: 15px 32px;
  font-family: var(--font-mono); font-size: 14px; letter-spacing: 0.5px;
  color: var(--on-accent);
  background: linear-gradient(180deg, var(--accent), var(--accent-hover));
  box-shadow: 0 12px 32px -12px var(--accent-glow), inset 0 1px 0 rgba(255,255,255,0.4);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.btn-accent:hover { transform: translateY(-2px); box-shadow: 0 18px 44px -14px var(--accent-glow), inset 0 1px 0 rgba(255,255,255,0.4); }
/* shine sweep on hover */
.btn-accent::after {
  content: ''; position: absolute; top: 0; bottom: 0; left: -80%; width: 50%;
  background: linear-gradient(105deg, transparent, rgba(255,255,255,0.4), transparent);
  transform: skewX(-20deg);
  transition: left 0.55s ease;
}
.btn-accent:hover::after { left: 130%; }

/* ============================================================
   Navigation
   ============================================================ */
.nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--nav-h);
  z-index: 100;
  background: var(--nav-bg);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
  transition: background-color 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease;
}
/* Height stays constant (a shrinking bar leaves a visible gap under it);
   scrolling just makes it solid with a soft drop shadow. */
.nav.scrolled { background: var(--bg); box-shadow: 0 14px 34px -22px rgba(0,0,0,0.55); }

.nav__inner {
  max-width: var(--maxw);
  height: 100%;
  margin: 0 auto;
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.nav__brand { display: flex; align-items: center; gap: 12px; }
.nav__brand img { width: auto; height: 44px; }
.nav__brand span { font-family: var(--font-display); font-weight: 700; font-size: 23px; color: var(--text-primary); text-transform: uppercase; letter-spacing: 1px; }

.nav__menu { display: flex; align-items: center; gap: 28px; }
.nav__links { display: flex; align-items: center; gap: 24px; }
.nav__links a {
  position: relative;
  font-family: var(--font-mono);
  font-size: 13.5px;
  color: var(--text-secondary);
  padding: 4px 0;
  transition: color 0.2s ease;
}
/* animated underline on hover */
.nav__links a::after {
  content: '';
  position: absolute;
  left: 0; right: 0; bottom: -2px;
  height: 2px;
  background: var(--accent);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.25s ease;
}
.nav__links a:hover { color: var(--text-primary); }
.nav__links a:hover::after { transform: scaleX(1); }
.nav__links a.active { color: var(--text-primary); }
.nav__links a.active::after { transform: scaleX(1); }

/* Theme toggle */
.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px; height: 34px;
  border-radius: 6px;
  color: var(--text-secondary);
  transition: color 0.2s ease, background-color 0.2s ease, transform 0.4s ease;
}
.theme-toggle:hover { color: var(--accent); background: var(--bg-surface); transform: rotate(30deg); }
.theme-toggle svg { width: 18px; height: 18px; }
.theme-toggle .icon-moon { display: none; }
[data-theme="light"] .theme-toggle .icon-sun  { display: none; }
[data-theme="light"] .theme-toggle .icon-moon { display: block; }

/* Hamburger */
.nav__toggle { display: none; width: 34px; height: 34px; align-items: center; justify-content: center; color: var(--text-primary); }
.nav__toggle svg { width: 22px; height: 22px; }

/* Mobile dropdown panel */
.nav__mobile {
  position: fixed;
  top: var(--nav-h); left: 0; right: 0;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.35s ease;
  z-index: 99;
}
.nav__mobile.open { max-height: 420px; }
.nav__mobile a {
  display: block;
  font-family: var(--font-mono);
  font-size: 14px;
  color: var(--text-secondary);
  padding: 16px 24px;
  border-top: 1px solid var(--border);
}
.nav__mobile a:first-child { border-top: none; }
.nav__mobile a.active { color: var(--accent); }

/* ============================================================
   Marquee strip (shared: index + about)
   ============================================================ */
.marquee { overflow: hidden; background: var(--bg-card); border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); padding: 14px 0; }
.marquee__track { display: flex; width: max-content; animation: marquee 26s linear infinite; }
.marquee:hover .marquee__track { animation-play-state: paused; }
.marquee__group { display: flex; flex: 0 0 auto; }
.marquee__group span { font-family: var(--font-mono); font-size: 14.5px; color: var(--text-muted); padding: 0 16px; white-space: nowrap; }
.marquee__group span.sep { color: var(--accent); padding: 0; }

/* ============================================================
   Footer — rising CTA band · single brand row · slim legal bar
   ============================================================ */
.footer {
  position: relative;
  margin-top: 110px;
  border-top: 1px solid var(--border);
  background: var(--footer-bg);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  font-size: 14px;
  color: var(--text-secondary);
}

/* --- CTA band: mascot stands on the glass edge --- */
.footer__cta { max-width: var(--maxw); margin: 0 auto; padding: 0 24px; }
.footer__cta-card {
  display: flex; align-items: center; justify-content: space-between; gap: 28px;
  margin-top: -56px;            /* band rises out of the footer */
  padding: 38px 44px;
  flex-wrap: wrap;
}
.footer__cta-text h2 {
  font-family: var(--font-display); font-weight: 600;
  font-size: clamp(22px, 3vw, 30px); letter-spacing: -0.6px;
  color: var(--text-primary);
}
.footer__cta-text h2 em { font-style: normal; color: var(--accent); }
.footer__cta-text p { font-family: var(--font-sans); font-size: 14.5px; color: var(--text-secondary); margin-top: 6px; max-width: 460px; }
.footer__cta-card .btn-accent { flex: 0 0 auto; }
.footer__cta-text { flex: 1 1 320px; }
/* mascot rides inside the card: feet on the bottom edge, head just peeking above.
   Kept in-flow so it can never cover content above the footer. */
.footer__cta-mascot {
  order: 3; align-self: flex-end; flex: 0 0 auto;
  height: 215px; width: auto;
  margin: -70px 0 -38px;     /* -38px cancels card padding so feet sit on the edge */
  filter: drop-shadow(0 22px 40px rgba(251,40,75,0.32));
  pointer-events: none;
}

/* --- single brand row: logo · links · email --- */
.footer__inner {
  max-width: var(--maxw); margin: 0 auto;
  padding: 38px 24px 34px;
  display: flex; align-items: center; justify-content: space-between;
  gap: 26px; flex-wrap: wrap;
}
.footer__brandlink { display: inline-flex; align-items: center; gap: 12px; }
.footer__brandlink img { width: auto; height: 40px; filter: drop-shadow(0 0 18px rgba(0,229,199,0.18)); }
.footer__brandlink span { font-family: var(--font-display); font-weight: 700; font-size: 18px; color: var(--text-primary); text-transform: uppercase; letter-spacing: 1px; }
.footer__nav { display: flex; gap: clamp(16px, 2.5vw, 28px); flex-wrap: wrap; }
.footer__nav a {
  position: relative;
  font-family: var(--font-mono); font-size: 13px;
  color: var(--text-secondary);
  padding: 4px 0;
  transition: color 0.2s ease;
}
.footer__nav a::after {
  content: ''; position: absolute; left: 0; right: 0; bottom: 0; height: 2px;
  background: var(--accent); transform: scaleX(0); transform-origin: left;
  transition: transform 0.25s ease;
}
.footer__nav a:hover { color: var(--text-primary); }
.footer__nav a:hover::after { transform: scaleX(1); }
.footer__mail { font-family: var(--font-mono); font-size: 13px; color: var(--accent); }
.footer__mail:hover { text-decoration: underline; }

/* --- legal bottom --- */
.footer__bottom {
  border-top: 1px solid var(--border);
  font-family: var(--font-mono); font-size: 12px; color: var(--text-muted);
  padding: 15px 24px;
}
.footer__bottom-inner {
  max-width: var(--maxw); margin: 0 auto;
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: 8px;
}
.footer__tagline { color: var(--accent); letter-spacing: 0.4px; }

/* ============================================================
   Page loader — logo + spinning ring overlay (html.boot)
   Shown briefly on first paint and during page transitions.
   ============================================================ */
html::before, html::after {
  content: ''; position: fixed; opacity: 0; pointer-events: none;
  transition: opacity 0.3s ease;
}
html::after {
  inset: 0; z-index: 9998;
  background: var(--bg) url('../assets/images/logo.svg') center / 64px auto no-repeat;
}
html::before {
  top: 50%; left: 50%; width: 122px; height: 122px; margin: -61px 0 0 -61px;
  z-index: 9999; border-radius: 50%;
  border: 2px solid var(--accent-dim);
  border-top-color: var(--accent);
}
html.boot::before, html.boot::after { opacity: 1; }
/* failsafe: if JS never removes .boot, the overlay fades itself out after 5s */
html.boot::before { animation: spin 0.9s linear infinite, loader-done 0.5s ease 5s forwards; }
html.boot::after  { animation: logo-pulse 1.3s ease-in-out infinite, loader-done 0.5s ease 5s forwards; }

/* ============================================================
   Responsive
   ============================================================ */
@media (max-width: 900px) {
  .footer__cta-mascot { height: 170px; margin: -50px 0 -30px; }
}
@media (max-width: 768px) {
  :root { --nav-h: 64px; }
  .nav__links { display: none; }
  .nav__toggle { display: inline-flex; }
  .nav__menu { gap: 8px; }
  .nav__brand img { height: 34px; }
  .nav__brand span { font-size: 19px; }
  .footer { margin-top: 88px; }
  .footer__cta-card { padding: 26px 24px; }
  .footer__cta-card .btn-accent { width: 100%; order: 4; }
  .footer__cta-mascot { height: 140px; margin: -42px 0 -26px; }
  .footer__inner { flex-direction: column; align-items: flex-start; gap: 20px; padding: 30px 24px 26px; }
  .footer__bottom-inner { flex-direction: column; align-items: flex-start; }
}
