/* SBH Advantage — base: tokens, type, layout, chrome, controls */

:root {
  --bg: #060914;
  --bg-2: #0a0f22;
  --navy: #111935;
  --surface: rgba(17, 25, 53, 0.55);
  --line: rgba(174, 182, 212, 0.12);
  --line-2: rgba(174, 182, 212, 0.22);
  --text: #e6eaf7;
  --muted: #aeb6d4;
  --subtle: #6d7699;
  --accent: #13bdf9;
  --accent-2: #0797d1;
  --accent-ink: #02121c;
  --royal: #2f4dff;
  --reject: #ff6a4d;

  --f-display: "Archivo", "Segoe UI", system-ui, -apple-system, sans-serif;
  --f-body: "Archivo", "Segoe UI", system-ui, -apple-system, sans-serif;
  --f-mono: "JetBrains Mono", ui-monospace, "SFMono-Regular", Consolas, monospace;

  --gutter: clamp(16px, 4vw, 40px);
  --max: 1240px;
  --radius: 20px;
  --nav-h: 72px;
  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
  --ease-in-out: cubic-bezier(0.65, 0, 0.35, 1);

  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--nav-h) + 12px);
  background: var(--bg);
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--f-body);
  font-size: 1.0625rem;
  line-height: 1.6;
  font-stretch: 100%;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  overflow-x: clip;
}

img, svg, canvas { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
p { margin: 0; }
h1, h2, h3 { margin: 0; font-weight: inherit; }
ul, ol { margin: 0; padding: 0; list-style: none; }
button, input, select, textarea { font: inherit; color: inherit; }
::selection { background: var(--accent); color: var(--accent-ink); }

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

.wrap {
  width: min(var(--max), 100% - 2 * var(--gutter));
  margin-inline: auto;
}

.skip {
  position: fixed;
  left: 16px;
  top: -60px;
  z-index: 100;
  padding: 10px 16px;
  border-radius: 10px;
  background: var(--accent);
  color: var(--accent-ink);
  font-weight: 600;
  transition: top 0.2s var(--ease);
}
.skip:focus { top: 12px; }

/* ---- Type ---------------------------------------------------------- */

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  font-family: var(--f-mono);
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--accent);
}
.eyebrow::before {
  content: "";
  width: 22px;
  height: 1px;
  background: currentColor;
  box-shadow: 0 0 12px currentColor;
}

.h2 {
  font-family: var(--f-display);
  font-size: clamp(2.5rem, 6vw, 5.4rem);
  font-weight: 800;
  font-stretch: 112%;
  line-height: 0.95;
  letter-spacing: -0.035em;
  text-wrap: balance;
}

.h3 {
  font-family: var(--f-display);
  font-size: clamp(1.3rem, 1.7vw, 1.6rem);
  font-weight: 700;
  font-stretch: 108%;
  line-height: 1.15;
  letter-spacing: -0.02em;
}

.section__head { display: grid; gap: 20px; align-content: start; }
.section__sub { color: var(--muted); font-size: clamp(1.05rem, 1.3vw, 1.2rem); max-width: 34ch; }

/* ---- Chrome: grain, progress, nav ---------------------------------- */

.grain {
  position: fixed;
  inset: -50%;
  z-index: 60;
  pointer-events: none;
  opacity: 0.07;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='220' height='220'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 1  0 0 0 0 1  0 0 0 0 1  0 0 0 .9 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  animation: grain 1.2s steps(6) infinite;
}
@keyframes grain {
  0% { transform: translate(0, 0); }
  20% { transform: translate(-3%, 2%); }
  40% { transform: translate(2%, -3%); }
  60% { transform: translate(-2%, -1%); }
  80% { transform: translate(3%, 3%); }
  100% { transform: translate(0, 0); }
}

.progress {
  position: fixed;
  inset: 0 0 auto 0;
  height: 2px;
  z-index: 70;
  pointer-events: none;
}
.progress span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--royal), var(--accent));
  box-shadow: 0 0 14px var(--accent);
  transform-origin: 0 50%;
  transform: scaleX(var(--p, 0));
}

.nav {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 50;
  height: var(--nav-h);
  transition: background-color 0.4s var(--ease), border-color 0.4s var(--ease), transform 0.5s var(--ease);
  border-bottom: 1px solid transparent;
}
.nav.is-scrolled {
  background: rgba(6, 9, 20, 0.72);
  -webkit-backdrop-filter: blur(16px) saturate(140%);
  backdrop-filter: blur(16px) saturate(140%);
  border-bottom-color: var(--line);
}
.nav.is-hidden { transform: translateY(-100%); }
.nav__inner {
  height: 100%;
  display: flex;
  align-items: center;
  gap: 32px;
}
.nav__brand img { height: 30px; width: auto; }
.nav__links {
  display: flex;
  gap: 30px;
  margin-left: auto;
  font-size: 0.92rem;
  color: var(--muted);
}
.nav__links a { position: relative; padding: 6px 0; transition: color 0.2s; }
.nav__links a::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 1px;
  background: var(--accent);
  transform: scaleX(0);
  transform-origin: right;
  transition: transform 0.35s var(--ease);
}
.nav__links a:hover { color: var(--text); }
.nav__links a:hover::after { transform: scaleX(1); transform-origin: left; }
.nav__cta { margin-left: 8px; }
.nav__inner--simple { justify-content: space-between; }
.nav__inner--simple .nav__cta { margin-left: 0; }

@media (max-width: 1000px) {
  .nav__links { display: none; }
  .nav__cta { margin-left: auto; }
  .nav__brand img { height: 26px; }
}

/* ---- Buttons ------------------------------------------------------- */

.btn {
  --mx: 0px;
  --my: 0px;
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  height: 54px;
  padding: 0 26px;
  border: 0;
  border-radius: 999px;
  font-family: var(--f-display);
  font-size: 0.98rem;
  font-weight: 650;
  font-stretch: 105%;
  letter-spacing: 0.005em;
  white-space: nowrap;
  cursor: pointer;
  transform: translate(var(--mx), var(--my));
  transition: transform 0.35s var(--ease), background-color 0.25s, box-shadow 0.35s var(--ease), color 0.25s, border-color 0.25s;
}
.btn svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: transform 0.35s var(--ease);
}
.btn:hover svg { transform: translateX(3px); }
.btn--sm { height: 42px; padding: 0 18px; font-size: 0.9rem; }

.btn--primary {
  background: var(--accent);
  color: var(--accent-ink);
  box-shadow: 0 0 0 1px rgba(19, 189, 249, 0.5), 0 12px 40px -12px rgba(19, 189, 249, 0.75), inset 0 1px 0 rgba(255, 255, 255, 0.45);
}
.btn--primary::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(110deg, transparent 30%, rgba(255, 255, 255, 0.55) 50%, transparent 70%);
  background-size: 250% 100%;
  background-position: 120% 0;
  mix-blend-mode: soft-light;
  transition: background-position 0.9s var(--ease);
}
.btn--primary:hover {
  background: #3dcbff;
  box-shadow: 0 0 0 1px rgba(19, 189, 249, 0.7), 0 18px 60px -12px rgba(19, 189, 249, 0.95), inset 0 1px 0 rgba(255, 255, 255, 0.5);
}
.btn--primary:hover::before { background-position: -20% 0; }

.btn--ghost {
  background: rgba(230, 234, 247, 0.04);
  color: var(--text);
  box-shadow: inset 0 0 0 1px var(--line-2);
}
.btn--ghost:hover { background: rgba(230, 234, 247, 0.08); box-shadow: inset 0 0 0 1px rgba(230, 234, 247, 0.4); }

/* ---- Cards + spotlight -------------------------------------------- */

.card {
  --sx: 50%;
  --sy: 0%;
  position: relative;
  border-radius: var(--radius);
  background: linear-gradient(180deg, rgba(17, 25, 53, 0.66), rgba(9, 13, 30, 0.66));
  box-shadow: inset 0 0 0 1px var(--line), 0 30px 80px -40px rgba(0, 0, 0, 0.8);
  isolation: isolate;
}
.card::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  border-radius: inherit;
  background: radial-gradient(420px circle at var(--sx) var(--sy), rgba(19, 189, 249, 0.12), transparent 60%);
  opacity: 0;
  transition: opacity 0.4s;
}
.card::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  padding: 1px;
  background: radial-gradient(300px circle at var(--sx) var(--sy), rgba(19, 189, 249, 0.75), transparent 60%);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask: linear-gradient(#000 0 0) content-box exclude, linear-gradient(#000 0 0);
  opacity: 0;
  transition: opacity 0.4s;
  pointer-events: none;
}
.card:hover::before, .card:hover::after { opacity: 1; }

/* ---- Fields -------------------------------------------------------- */

.field { display: grid; gap: 8px; }
.field label {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  font-family: var(--f-mono);
  font-size: 0.72rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}
.field label em { font-style: normal; color: var(--subtle); letter-spacing: 0.08em; }
.field input:not([type="range"]), .field select, .field textarea {
  width: 100%;
  min-height: 50px;
  padding: 12px 16px;
  border: 1px solid var(--line-2);
  border-radius: 12px;
  background: rgba(230, 234, 247, 0.03);
  color: var(--text);
  font-size: 1rem;
  transition: border-color 0.2s, box-shadow 0.2s, background-color 0.2s;
  appearance: none;
  -webkit-appearance: none;
}
.field textarea { resize: vertical; min-height: 96px; line-height: 1.5; }
.field input:not([type="range"]):hover, .field select:hover, .field textarea:hover { border-color: rgba(174, 182, 212, 0.38); }
.field input:not([type="range"]):focus, .field select:focus, .field textarea:focus {
  outline: none;
  border-color: var(--accent);
  background: rgba(19, 189, 249, 0.05);
  box-shadow: 0 0 0 4px rgba(19, 189, 249, 0.14);
}
.field [aria-invalid="true"] { border-color: var(--reject) !important; box-shadow: 0 0 0 4px rgba(255, 106, 77, 0.14) !important; }

.select { position: relative; }
.select::after {
  content: "";
  position: absolute;
  right: 18px;
  top: 50%;
  width: 8px;
  height: 8px;
  border-right: 1.5px solid var(--muted);
  border-bottom: 1.5px solid var(--muted);
  transform: translateY(-70%) rotate(45deg);
  pointer-events: none;
}
.select select { padding-right: 44px; cursor: pointer; }
.select select:invalid { color: var(--subtle); }
.select option { background: var(--bg-2); color: var(--text); }

input[type="range"] {
  --fill: 50%;
  width: 100%;
  height: 28px;
  margin: 0;
  background: transparent;
  appearance: none;
  -webkit-appearance: none;
  cursor: pointer;
}
input[type="range"]::-webkit-slider-runnable-track {
  height: 4px;
  border-radius: 4px;
  background: linear-gradient(90deg, var(--accent) var(--fill), rgba(174, 182, 212, 0.18) var(--fill));
}
input[type="range"]::-moz-range-track { height: 4px; border-radius: 4px; background: rgba(174, 182, 212, 0.18); }
input[type="range"]::-moz-range-progress { height: 4px; border-radius: 4px; background: var(--accent); }
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 22px;
  height: 22px;
  margin-top: -9px;
  border-radius: 50%;
  background: var(--text);
  box-shadow: 0 0 0 5px rgba(19, 189, 249, 0.25), 0 0 24px rgba(19, 189, 249, 0.8);
  transition: transform 0.2s var(--ease);
}
input[type="range"]::-moz-range-thumb {
  width: 22px;
  height: 22px;
  border: 0;
  border-radius: 50%;
  background: var(--text);
  box-shadow: 0 0 0 5px rgba(19, 189, 249, 0.25), 0 0 24px rgba(19, 189, 249, 0.8);
}
input[type="range"]:active::-webkit-slider-thumb { transform: scale(1.15); }
input[type="range"]:focus-visible { outline-offset: 6px; }

/* ---- Reveal (only once main.js has armed it) ----------------------- */

/* Uses `translate`, not `transform`, so cards keep their own tilt and rotation. */
.has-reveal .reveal {
  opacity: 0;
  translate: 0 28px;
  transition: opacity 1s var(--ease), translate 1.1s var(--ease), transform 0.6s var(--ease);
  transition-delay: var(--d, 0s), var(--d, 0s), 0s;
}
.has-reveal .reveal.is-in { opacity: 1; translate: none; }

/* ---- Motion preferences -------------------------------------------- */

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
  .grain { animation: none; }
}
