/* ==========================================================================
   ActiveVitPH — foundation layer
   Design tokens, reset, typography scale, atmosphere primitives.
   ========================================================================== */

:root {
  /* Surfaces, darkest to lightest */
  --ink-1000: #05060a;
  --ink-950: #080a0f;
  --ink-900: #0c0f16;
  --ink-850: #11151e;
  --ink-800: #161b26;
  --ink-750: #1c222f;
  --ink-700: #242b3a;

  /* Hairlines */
  --line: rgba(255, 255, 255, 0.07);
  --line-soft: rgba(255, 255, 255, 0.045);
  --line-strong: rgba(255, 255, 255, 0.14);

  /* Text */
  --text: #e9ebf2;
  --text-2: #a7adc0;
  --text-3: #737a8f;
  --text-4: #4e5568;

  /* Accents — brass leads, teal supports. Everything else stays neutral. */
  --brass: #e6ae5d;
  --brass-hi: #ffd9a0;
  --brass-deep: #b17f36;
  --brass-glow: rgba(230, 174, 93, 0.35);

  --teal: #5ad3cc;
  --teal-glow: rgba(90, 211, 204, 0.28);

  --violet: #8d7cf7;
  --good: #5cd991;
  --bad: #ef7269;

  /* Radii */
  --r-xs: 6px;
  --r-sm: 10px;
  --r-md: 16px;
  --r-lg: 24px;
  --r-xl: 36px;
  --r-pill: 999px;

  /* Elevation — layered rather than a single blurry drop */
  --sh-1: 0 1px 2px rgba(0, 0, 0, 0.4), 0 2px 8px rgba(0, 0, 0, 0.25);
  --sh-2: 0 2px 4px rgba(0, 0, 0, 0.35), 0 12px 32px -8px rgba(0, 0, 0, 0.6);
  --sh-3: 0 4px 8px rgba(0, 0, 0, 0.35), 0 32px 64px -16px rgba(0, 0, 0, 0.75);
  --sh-inset: inset 0 1px 0 rgba(255, 255, 255, 0.06);

  /* Type */
  --font-display: "Space Grotesk", "Segoe UI", system-ui, sans-serif;
  --font-body: "Inter", "Segoe UI", system-ui, -apple-system, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, "Cascadia Mono", monospace;

  /* Rhythm */
  --shell: 1240px;
  --gutter: clamp(20px, 5vw, 56px);

  /* Motion */
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-in-out: cubic-bezier(0.65, 0, 0.35, 1);
  --t-fast: 140ms;
  --t-mid: 260ms;
  --t-slow: 520ms;
}

/* --------------------------------------------------------------- reset --- */

*,
*::before,
*::after { box-sizing: border-box; }

* { margin: 0; }

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: 96px;
}

body {
  background: var(--ink-1000);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.65;
  font-feature-settings: "cv05" 1, "cv11" 1;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  min-height: 100vh;
  overflow-x: hidden;
}

img,
svg,
canvas { display: block; max-width: 100%; }

button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}

button { cursor: pointer; background: none; border: 0; padding: 0; }

a { color: inherit; text-decoration: none; }

ul, ol { padding: 0; list-style: none; }

:focus-visible {
  outline: 2px solid var(--brass);
  outline-offset: 3px;
  border-radius: var(--r-xs);
}

::selection {
  background: var(--brass);
  color: var(--ink-1000);
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* ----------------------------------------------------------- typography --- */

h1, h2, h3, h4, h5 {
  font-family: var(--font-display);
  font-weight: 600;
  line-height: 1.08;
  letter-spacing: -0.025em;
  text-wrap: balance;
}

.t-hero {
  font-size: clamp(2.5rem, 5vw, 4.15rem);
  font-weight: 700;
  letter-spacing: -0.04em;
  line-height: 1;
}

.t-display {
  font-size: clamp(2rem, 4.4vw, 3.2rem);
  letter-spacing: -0.035em;
  line-height: 1.04;
}

.t-section {
  font-size: clamp(1.6rem, 3vw, 2.3rem);
  letter-spacing: -0.03em;
}

.t-card {
  font-family: var(--font-display);
  font-size: 1.12rem;
  font-weight: 600;
  letter-spacing: -0.015em;
  line-height: 1.25;
}

.t-lead {
  font-size: clamp(1.02rem, 1.5vw, 1.2rem);
  line-height: 1.62;
  color: var(--text-2);
  text-wrap: pretty;
}

.t-body { color: var(--text-2); text-wrap: pretty; }

.t-meta {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-3);
}

.t-num {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
}

.brass { color: var(--brass); }
.dim { color: var(--text-3); }

/* --------------------------------------------------------------- layout --- */

.shell {
  width: 100%;
  max-width: var(--shell);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.shell-wide {
  width: 100%;
  max-width: 1560px;
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.stack > * + * { margin-top: var(--stack-gap, 1rem); }

.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;
}

/* ----------------------------------------------------- atmosphere layers --- */

/* Film grain. One inline turbulence texture, tiled, very low opacity. */
.grain {
  position: fixed;
  inset: 0;
  z-index: 900;
  pointer-events: none;
  opacity: 0.035;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3'/%3E%3C/filter%3E%3Crect width='180' height='180' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* Vignette that keeps the eye in the middle of the page. */
.vignette {
  position: fixed;
  inset: 0;
  z-index: 899;
  pointer-events: none;
  background: radial-gradient(
    120% 90% at 50% 30%,
    transparent 40%,
    rgba(0, 0, 0, 0.45) 100%
  );
}

/* Named glow blobs, positioned by the page that uses them. */
.glow {
  position: absolute;
  border-radius: 50%;
  pointer-events: none;
  filter: blur(80px);
  will-change: transform;
}

.glow--brass { background: radial-gradient(circle, rgba(230, 174, 93, 0.22), transparent 68%); }
.glow--teal  { background: radial-gradient(circle, rgba(90, 211, 204, 0.16), transparent 68%); }
.glow--violet{ background: radial-gradient(circle, rgba(141, 124, 247, 0.15), transparent 68%); }

/* Faint engineering grid, used behind hero and section breaks. */
.mesh {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(to right, rgba(255, 255, 255, 0.035) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(255, 255, 255, 0.035) 1px, transparent 1px);
  background-size: 68px 68px;
  mask-image: radial-gradient(90% 70% at 50% 35%, #000 10%, transparent 78%);
}

/* ------------------------------------------------------------- surfaces --- */

.glass {
  background:
    linear-gradient(
      168deg,
      rgba(255, 255, 255, 0.055) 0%,
      rgba(255, 255, 255, 0.018) 46%,
      rgba(255, 255, 255, 0.006) 100%
    );
  border: 1px solid var(--line);
  backdrop-filter: blur(18px) saturate(130%);
  -webkit-backdrop-filter: blur(18px) saturate(130%);
  box-shadow: var(--sh-2), var(--sh-inset);
}

.panel {
  background: linear-gradient(170deg, var(--ink-850), var(--ink-950));
  border: 1px solid var(--line);
  box-shadow: var(--sh-2), var(--sh-inset);
}

/* Hairline that fades at both ends — used to separate sections. */
.rule {
  height: 1px;
  border: 0;
  background: linear-gradient(
    to right,
    transparent,
    rgba(255, 255, 255, 0.12) 22%,
    rgba(255, 255, 255, 0.12) 78%,
    transparent
  );
}

/* -------------------------------------------------------------- buttons --- */

.btn {
  --btn-bg: var(--ink-800);
  --btn-fg: var(--text);
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.6em;
  padding: 0.86em 1.5em;
  border-radius: var(--r-pill);
  font-family: var(--font-display);
  font-size: 0.94rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--btn-fg);
  background: var(--btn-bg);
  border: 1px solid var(--line-strong);
  white-space: nowrap;
  transition:
    transform var(--t-fast) var(--ease-out),
    box-shadow var(--t-mid) var(--ease-out),
    border-color var(--t-mid) var(--ease-out),
    background-color var(--t-mid) var(--ease-out),
    color var(--t-mid) var(--ease-out);
}

.btn:hover { transform: translateY(-2px); }
.btn:active { transform: translateY(0) scale(0.985); }
.btn[disabled] { opacity: 0.4; pointer-events: none; }

/* The one obvious primary action. */
.btn--primary {
  --btn-fg: #1a1206;
  background: linear-gradient(165deg, var(--brass-hi), var(--brass) 52%, var(--brass-deep));
  border-color: rgba(255, 217, 160, 0.5);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.4) inset,
    0 8px 24px -6px var(--brass-glow),
    0 2px 6px rgba(0, 0, 0, 0.4);
}

.btn--primary:hover {
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.5) inset,
    0 16px 40px -8px rgba(230, 174, 93, 0.5),
    0 2px 6px rgba(0, 0, 0, 0.4);
}

.btn--ghost {
  background: rgba(255, 255, 255, 0.03);
  border-color: var(--line);
  color: var(--text-2);
  backdrop-filter: blur(10px);
}

.btn--ghost:hover {
  color: var(--text);
  border-color: var(--line-strong);
  background: rgba(255, 255, 255, 0.06);
}

.btn--sm { padding: 0.6em 1.05em; font-size: 0.84rem; }
.btn--icon { padding: 0.62em; aspect-ratio: 1; border-radius: var(--r-sm); }

/* ---------------------------------------------------------------- chips --- */

.chip {
  display: inline-flex;
  align-items: center;
  gap: 0.45em;
  padding: 0.34em 0.75em;
  border-radius: var(--r-pill);
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.035);
  font-family: var(--font-mono);
  font-size: 0.66rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-3);
  white-space: nowrap;
}

.chip--brass {
  color: var(--brass-hi);
  border-color: rgba(230, 174, 93, 0.3);
  background: rgba(230, 174, 93, 0.09);
}

.chip--teal {
  color: var(--teal);
  border-color: rgba(90, 211, 204, 0.28);
  background: rgba(90, 211, 204, 0.08);
}

.chip__dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: currentColor;
  box-shadow: 0 0 8px currentColor;
}

/* ------------------------------------------------------- scroll reveals --- */

/* Gated on the .js class so the page is fully readable if the script never
   arrives — otherwise a failed request would hide most of the site. */
.js [data-reveal] {
  opacity: 0;
  transform: translateY(22px);
  transition:
    opacity 700ms var(--ease-out),
    transform 700ms var(--ease-out);
  transition-delay: var(--reveal-delay, 0ms);
}

.js [data-reveal].is-in {
  opacity: 1;
  transform: none;
}

/* ------------------------------------------------------------ scrollbar --- */

* {
  scrollbar-width: thin;
  scrollbar-color: var(--ink-700) transparent;
}

*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-track { background: transparent; }
*::-webkit-scrollbar-thumb {
  background: var(--ink-700);
  border-radius: var(--r-pill);
  border: 3px solid var(--ink-1000);
}
*::-webkit-scrollbar-thumb:hover { background: var(--ink-750); }
