/* =========================================================
   CVN Managed Services — Theme System
   Tokens, color themes (teal/blue/blend), light/dark, base
   ========================================================= */

:root {
  /* Type */
  --font-display: "Space Grotesk", system-ui, sans-serif;
  --font-body: "Plus Jakarta Sans", system-ui, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, monospace;

  /* Spatial */
  --container: 1240px;
  --radius-sm: 10px;
  --radius: 18px;
  --radius-lg: 28px;
  --radius-xl: 40px;

  /* Motion */
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-in-out: cubic-bezier(0.65, 0, 0.35, 1);
  --dur: 0.6s;

  /* Z layers */
  --z-bg: 0;
  --z-base: 1;
  --z-nav: 90;
  --z-dock: 95;
  --z-overlay: 120;
}

/* ---------- Universal fallback (applies even if data-theme / data-mode
   attributes never get set — e.g. inline script deferred by a CDN).
   Guarantees the accent vars the gradients depend on always resolve,
   and defaults the palette to teal + dark. ---------- */
:root {
  --accent: #06b6b0;
  --accent-2: #0ea5e9;
  --accent-deep: #017e84;
  --accent-ink: #00343a;
  --glow: 6 182 176;
  --glow-2: 14 165 233;

  --bg: #060912;
  --bg-2: #0a0f1d;
  --surface: #0e1525;
  --surface-2: #131c30;
  --surface-glass: rgba(16, 24, 42, 0.62);
  --border: rgba(255, 255, 255, 0.09);
  --border-strong: rgba(255, 255, 255, 0.16);
  --ink: #eaf0fb;
  --ink-soft: #aeb9cf;
  --ink-muted: #7c89a3;
  --shadow-color: 0 0 0;
  --hero-ink: #f4f8ff;
  --on-accent: #ffffff;
}

/* ---------- Accent themes ---------- */
:root[data-theme="teal"] {
  --accent: #06b6b0;
  --accent-2: #0ea5e9;
  --accent-deep: #017e84;
  --accent-ink: #00343a;
  --glow: 6 182 176;
  --glow-2: 14 165 233;
}
:root[data-theme="blue"] {
  --accent: #2f6bff;
  --accent-2: #00b3ff;
  --accent-deep: #0047a8;
  --accent-ink: #002766;
  --glow: 47 107 255;
  --glow-2: 0 179 255;
}
:root[data-theme="blend"] {
  --accent: #11b8a6;
  --accent-2: #3b6dff;
  --accent-deep: #036b8f;
  --accent-ink: #022b44;
  --glow: 17 184 166;
  --glow-2: 59 109 255;
}

/* ---------- Light mode ---------- */
:root[data-mode="light"] {
  --bg: #eef2f8;
  --bg-2: #e4eaf3;
  --surface: #ffffff;
  --surface-2: #f6f8fc;
  --surface-glass: rgba(255, 255, 255, 0.72);
  --border: rgba(12, 22, 45, 0.10);
  --border-strong: rgba(12, 22, 45, 0.18);
  --ink: #0a1424;
  --ink-soft: #38465f;
  --ink-muted: #65728a;
  --shadow-color: 18 30 55;
  --hero-ink: #0a1424;
  --on-accent: #ffffff;
  color-scheme: light;
}

/* ---------- Dark mode ---------- */
:root[data-mode="dark"] {
  --bg: #060912;
  --bg-2: #0a0f1d;
  --surface: #0e1525;
  --surface-2: #131c30;
  --surface-glass: rgba(16, 24, 42, 0.62);
  --border: rgba(255, 255, 255, 0.09);
  --border-strong: rgba(255, 255, 255, 0.16);
  --ink: #eaf0fb;
  --ink-soft: #aeb9cf;
  --ink-muted: #7c89a3;
  --shadow-color: 0 0 0;
  --hero-ink: #f4f8ff;
  --on-accent: #ffffff;
  color-scheme: dark;
}

/* ---------- Reset / base ---------- */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; padding: 0; }

html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}

body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--ink);
  line-height: 1.6;
  font-size: clamp(15px, 1vw + 13px, 17px);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
  transition: background 0.5s var(--ease), color 0.5s var(--ease);
}

h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 700;
  line-height: 1.05;
  letter-spacing: -0.02em;
  color: var(--ink);
  text-wrap: balance;
}

p { text-wrap: pretty; }
a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; }
button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; }
ul { list-style: none; }

::selection { background: rgb(var(--glow) / 0.28); }

/* Focus */
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 4px;
}

/* ---------- Layout helpers ---------- */
.container {
  width: 100%;
  max-width: var(--container);
  margin-inline: auto;
  padding-inline: clamp(20px, 5vw, 56px);
}
#main-content { position: relative; z-index: var(--z-base); }
.footer { position: relative; z-index: var(--z-base); }
.section { padding-block: clamp(64px, 9vw, 132px); position: relative; }
.section-tight { padding-block: clamp(44px, 6vw, 80px); }

.eyebrow {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--accent-deep);
  display: inline-flex;
  align-items: center;
  gap: 0.6em;
}
:root[data-mode="dark"] .eyebrow { color: var(--accent-2); }
.eyebrow::before {
  content: "";
  width: 26px; height: 1px;
  background: linear-gradient(90deg, var(--accent), transparent);
}

.headline {
  font-size: clamp(2rem, 4.6vw, 3.6rem);
  letter-spacing: -0.03em;
}
.lead {
  font-size: clamp(1.02rem, 1.4vw, 1.22rem);
  color: var(--ink-soft);
  max-width: 56ch;
}

.text-grad {
  background: linear-gradient(100deg, var(--accent-2, #0ea5e9), var(--accent, #06b6b0) 55%, var(--accent-deep, #017e84));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: var(--accent, #06b6b0); /* fallback color if background-clip:text is unsupported */
}
/* If background-clip:text isn't supported, show solid accent text (never invisible) */
@supports not ((-webkit-background-clip: text) or (background-clip: text)) {
  .text-grad { -webkit-text-fill-color: currentColor; color: var(--accent, #06b6b0); background: none; }
}

.section-head { max-width: 720px; margin-bottom: clamp(36px, 5vw, 64px); }
.section-head.center { margin-inline: auto; text-align: center; }
.section-head.center .eyebrow::before { display: none; }
.section-head .lead { margin-top: 18px; }
.section-head h2 { margin-top: 16px; }

/* ---------- Utility ---------- */
.glass {
  background: var(--surface-glass);
  backdrop-filter: blur(18px) saturate(1.4);
  -webkit-backdrop-filter: blur(18px) saturate(1.4);
  border: 1px solid var(--border);
}
.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;
}
.no-scroll { overflow: hidden; }
