/* ====================================================================
   UNS LANDING v3 — THEME TOKENS (dark + light)
   ==================================================================== */

:root {
  /* Brand colors (constant across themes) */
  --uns-red: #C8202E;
  --uns-red-mid: #E63B4D;
  --uns-blue: #1F4FD2;
  --uns-blue-mid: #4A86F9;
  --uns-gold: #C9A961;
  --uns-gold-deep: #8B6A1A;

  /* Type families */
  --f-display: "Inter Tight", -apple-system, system-ui, sans-serif;
  --f-serif: "Shippori Mincho", "Hiragino Mincho ProN", "Yu Mincho", serif;
  --f-mono: "JetBrains Mono", ui-monospace, monospace;

  /* Spacing scale */
  --sp-1: 4px;   --sp-2: 8px;   --sp-3: 12px;  --sp-4: 16px;
  --sp-5: 24px;  --sp-6: 32px;  --sp-7: 48px;  --sp-8: 64px;
  --sp-9: 96px;  --sp-10: 128px;

  /* Radii */
  --r-sm: 8px;  --r-md: 12px;  --r-lg: 16px;  --r-xl: 24px;  --r-pill: 999px;

  /* Motion */
  --ease-out: cubic-bezier(.16, 1, .3, 1);
  --ease-in-out: cubic-bezier(.65, 0, .35, 1);
  --t-fast: 200ms;
  --t-base: 320ms;
  --t-slow: 600ms;

  /* Theme transition speed */
  --theme-t: 480ms;
}

/* ====================================================================
   DARK (default) — Aerospace navy
   ==================================================================== */
:root[data-theme="dark"] {
  --bg-base:    #050810;
  --bg-elev:    #0A1020;
  --bg-card:    rgba(15, 23, 42, 0.62);
  --bg-card-h:  rgba(15, 23, 42, 0.85);
  --bg-overlay: rgba(5, 8, 16, 0.78);
  --bg-glass:   rgba(8, 12, 24, 0.55);

  --fg-1: #F4F1EA;
  --fg-2: #C5CDD9;
  --fg-3: #8390A6;
  --fg-4: rgba(244,241,234, 0.55);

  --line:   rgba(255,255,255, 0.08);
  --line-2: rgba(255,255,255, 0.14);
  --line-strong: rgba(255,255,255, 0.22);

  --accent: var(--uns-blue-mid);
  --accent-h: var(--uns-blue);
  --accent-soft: rgba(74,134,249, 0.14);

  --red: #FF5B6B;
  --red-soft: rgba(230,59,77, 0.16);
  --gold: var(--uns-gold);

  --shadow-card: 0 14px 40px rgba(0, 0, 0, 0.4), 0 0 0 1px rgba(255,255,255,0.04);
  --shadow-cta:  0 12px 28px rgba(31, 79, 210, 0.4);

  --card-border: rgba(255, 255, 255, 0.06);
  --card-border-h: rgba(255, 255, 255, 0.15);
  --bg-glass-blur: blur(16px);

  --hero-grad: linear-gradient(
    180deg,
    rgba(5, 8, 16, 0.95) 0%,
    rgba(5, 8, 16, 0.55) 35%,
    rgba(5, 8, 16, 0.85) 100%
  );

  --noise-opacity: 0.025;
  color-scheme: dark;
}

/* ====================================================================
   LIGHT — Premium white-paper editorial (high contrast)
   ==================================================================== */
:root[data-theme="light"] {
  --bg-base:    #FFFFFF;
  --bg-elev:    #F4F6FB;
  --bg-card:    #FFFFFF;
  --bg-card-h:  #FAFBFE;
  --bg-overlay: rgba(255, 255, 255, 0.85);
  --bg-glass:   rgba(255, 255, 255, 0.85);

  --fg-1: #0B1220;
  --fg-2: #2A3447;
  --fg-3: #5A6478;
  --fg-4: rgba(11, 18, 32, 0.60);

  --line:   rgba(11, 18, 32, 0.10);
  --line-2: rgba(11, 18, 32, 0.18);
  --line-strong: rgba(11, 18, 32, 0.30);

  --accent: #1F4FD2;
  --accent-h: #1340B5;
  --accent-soft: rgba(31, 79, 210, 0.10);

  --red: #C8202E;
  --red-soft: rgba(200, 32, 46, 0.10);
  --gold: #8B6A1A;

  --shadow-card: 0 14px 40px rgba(15, 23, 38, 0.08), 0 0 0 1px rgba(15, 23, 38, 0.04);
  --shadow-cta:  0 14px 30px rgba(31, 79, 210, 0.32);

  --card-border: rgba(11, 18, 32, 0.08);
  --card-border-h: rgba(11, 18, 32, 0.18);
  --bg-glass-blur: blur(12px);

  --hero-grad: linear-gradient(
    180deg,
    rgba(255, 255, 255, 0.85) 0%,
    rgba(255, 255, 255, 0.55) 40%,
    rgba(255, 255, 255, 0.95) 100%
  );

  --noise-opacity: 0.035;
  color-scheme: light;
}

/* ====================================================================
   GLOBAL RESET + body
   ==================================================================== */
*, *::before, *::after { box-sizing: border-box; }
html, body {
  margin: 0; padding: 0;
  background: var(--bg-base);
  color: var(--fg-1);
  font-family: var(--f-display);
  font-feature-settings: "ss01", "cv11";
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

html { scroll-behavior: smooth; }

body {
  font-size: 16px;
  line-height: 1.65;
  transition: background var(--theme-t) var(--ease-in-out), color var(--theme-t) var(--ease-in-out);
  position: relative;
  overflow-x: hidden;
}

/* Subtle film grain on the whole page */
body::before {
  content: "";
  position: fixed; inset: 0;
  pointer-events: none; z-index: 1;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='220' height='220'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2'/></filter><rect width='100%25' height='100%25' filter='url(%23n)' opacity='1'/></svg>");
  opacity: var(--noise-opacity);
  mix-blend-mode: overlay;
}

img { display: block; max-width: 100%; height: auto; }

a {
  color: inherit;
  text-decoration: none;
  transition: color var(--t-fast) ease;
}

a:focus-visible,
button:focus-visible,
summary:focus-visible,
input:focus-visible,
textarea:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

button {
  font: inherit;
  color: inherit;
  background: none;
  border: 0;
  cursor: pointer;
}

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

/* ====================================================================
   THEME WIPE — full-screen overlay during toggle
   ==================================================================== */
.theme-wipe {
  position: fixed; inset: 0;
  z-index: 9999;
  pointer-events: none;
  opacity: 0;
  background: radial-gradient(circle at var(--wx, 50%) var(--wy, 50%),
    var(--bg-base) 0%, var(--bg-base) 50%, transparent 100%);
}
.theme-wipe.active {
  animation: wipeIn var(--theme-t) var(--ease-in-out) forwards;
}
@keyframes wipeIn {
  0%   { opacity: 0; clip-path: circle(0% at var(--wx) var(--wy)); }
  50%  { opacity: 1; clip-path: circle(150% at var(--wx) var(--wy)); }
  100% { opacity: 0; clip-path: circle(150% at var(--wx) var(--wy)); }
}

/* ====================================================================
   TYPOGRAPHY UTILITIES
   ==================================================================== */
.eyebrow {
  display: inline-flex; align-items: center; gap: 12px;
  font-family: var(--f-display);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.32em;
  text-transform: uppercase;
  color: var(--accent);
}
.eyebrow::before {
  content: "";
  width: 6px; height: 6px;
  border-radius: 999px;
  background: var(--red);
  box-shadow: 0 0 10px var(--red);
}
.eyebrow-red { color: var(--red); }

.section-title {
  font-family: var(--f-serif);
  font-size: clamp(34px, 4.6vw, 64px);
  font-weight: 700;
  line-height: 1.12;
  letter-spacing: -0.01em;
  color: var(--fg-1);
  margin: 16px 0 18px;
  text-wrap: balance;
}

.section-sub {
  font-size: clamp(14px, 1.1vw, 16px);
  color: var(--fg-3);
  line-height: 1.75;
  max-width: 56ch;
  text-wrap: pretty;
}

/* ====================================================================
   BUTTONS
   ==================================================================== */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  gap: 10px;
  padding: 12px 22px;
  border-radius: var(--r-md);
  font-family: var(--f-display);
  font-weight: 600;
  font-size: 14px;
  letter-spacing: 0.01em;
  white-space: nowrap;
  transition: transform var(--t-fast) var(--ease-out),
              background var(--t-fast) ease,
              border-color var(--t-fast) ease,
              box-shadow var(--t-fast) ease,
              color var(--t-fast) ease;
  position: relative;
  overflow: hidden;
}
.btn-lg { padding: 16px 28px; font-size: 15px; }

.btn-primary {
  background: var(--accent);
  color: white;
  box-shadow: var(--shadow-cta);
}
:root[data-theme="dark"] .btn-primary {
  background: #245DE8;
}
.btn-primary:hover {
  background: var(--accent-h);
  transform: translateY(-2px);
}
.btn-primary::after {
  content: "";
  position: absolute; inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.18), transparent);
  transform: translateX(-100%);
  transition: transform var(--t-slow) var(--ease-out);
}
.btn-primary:hover::after { transform: translateX(100%); }

.btn-ghost {
  background: transparent;
  color: var(--fg-1);
  border: 1px solid var(--line-2);
}
.btn-ghost:hover {
  background: var(--bg-card);
  border-color: var(--line-strong);
  transform: translateY(-2px);
}

/* ====================================================================
   THEME TOGGLE
   ==================================================================== */
.theme-toggle {
  width: 60px; height: 32px;
  border-radius: 999px;
  background: var(--bg-card);
  border: 1px solid var(--line-2);
  position: relative;
  padding: 0;
  transition: background var(--t-base) ease, border-color var(--t-base) ease;
}
.theme-toggle:hover { border-color: var(--line-strong); }
.tt-track {
  position: relative;
  width: 100%; height: 100%;
  border-radius: 999px;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 6px;
}
.tt-sun, .tt-moon {
  width: 16px; height: 16px;
  display: flex; align-items: center; justify-content: center;
  color: var(--fg-3);
  transition: color var(--t-base) ease, opacity var(--t-base) ease;
}
.tt-sun svg, .tt-moon svg { width: 14px; height: 14px; }

:root[data-theme="dark"] .tt-moon { color: var(--fg-1); }
:root[data-theme="light"] .tt-sun { color: var(--fg-1); }
:root[data-theme="dark"] .tt-sun { opacity: 0.4; }
:root[data-theme="light"] .tt-moon { opacity: 0.4; }

.tt-track::before {
  content: "";
  position: absolute;
  top: 50%; left: 4px;
  width: 24px; height: 24px;
  border-radius: 999px;
  background: var(--accent);
  transform: translateY(-50%);
  transition: transform var(--t-base) var(--ease-out);
  box-shadow: 0 4px 12px var(--accent-soft);
}
:root[data-theme="light"] .tt-track::before { transform: translate(28px, -50%); }

@media (max-width: 520px) {
  .theme-toggle {
    width: 54px;
    height: 30px;
  }
  .tt-track::before {
    width: 22px;
    height: 22px;
  }
  :root[data-theme="light"] .tt-track::before { transform: translate(24px, -50%); }
}

/* ====================================================================
   REVEAL animation
   ==================================================================== */
.reveal {
  opacity: 0;
  transform: translateY(28px);
  transition: opacity 800ms var(--ease-out), transform 800ms var(--ease-out);
}
.reveal.in {
  opacity: 1;
  transform: translateY(0);
}

@media (prefers-reduced-motion: reduce) {
  .reveal { opacity: 1; transform: none; transition: none; }
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}
