/* ============================================================
   Rau Tech Solutions v4 — "FIELD"
   Dark room, one living field of light. One gold accent.
   ============================================================ */

/* ---------- Fonts (self-hosted, zero external requests) ---------- */
@font-face {
  font-family: 'Clash Display';
  src: url('../fonts/clash-display-500.woff2') format('woff2');
  font-weight: 500; font-style: normal; font-display: swap;
}
@font-face {
  font-family: 'Clash Display';
  src: url('../fonts/clash-display-600.woff2') format('woff2');
  font-weight: 600; font-style: normal; font-display: swap;
}
@font-face {
  font-family: 'Satoshi';
  src: url('../fonts/satoshi-400.woff2') format('woff2');
  font-weight: 400; font-style: normal; font-display: swap;
}
@font-face {
  font-family: 'Satoshi';
  src: url('../fonts/satoshi-500.woff2') format('woff2');
  font-weight: 500; font-style: normal; font-display: swap;
}
@font-face {
  font-family: 'Satoshi';
  src: url('../fonts/satoshi-700.woff2') format('woff2');
  font-weight: 700; font-style: normal; font-display: swap;
}

/* ---------- Tokens ---------- */
:root {
  --bg: #05070c;
  --bg-2: #090d14;
  --surface: #0e141d;
  --hairline: rgba(255, 255, 255, 0.09);
  --glass: rgba(255, 255, 255, 0.035);
  --t1: #edf2fa;
  --t2: #9aa7ba;
  --t3: #828fa6;
  --gold: #ffc57d;
  --gold-hi: #ffd79e;
  --gold-ink: #191308;
  --ok: #5fe0a0;
  --err: #ff9a9a;
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
  --display: 'Clash Display', 'Avenir Next', 'Segoe UI', sans-serif;
  --body: 'Satoshi', -apple-system, 'Segoe UI', sans-serif;
  --container: 1160px;
  --nav-h: 76px;
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--nav-h) + 16px);
  -webkit-text-size-adjust: 100%;
}
body {
  margin: 0;
  background: var(--bg);
  color: var(--t1);
  font-family: var(--body);
  font-size: 1.0625rem;
  line-height: 1.65;
  overflow-x: clip;
}
h1, h2, h3, p, ul, ol, figure { margin: 0; }
a { color: inherit; }
img, svg { max-width: 100%; }
button, input, textarea { font: inherit; color: inherit; }

::selection { background: rgba(255, 197, 125, 0.25); }

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

.visually-hidden {
  position: absolute; width: 1px; height: 1px;
  margin: -1px; padding: 0; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

.skip {
  position: fixed; top: 12px; left: 12px; z-index: 200;
  background: var(--surface); color: var(--t1);
  padding: 10px 18px; border-radius: 999px;
  border: 1px solid var(--hairline);
  text-decoration: none; font-weight: 500;
  transform: translateY(-64px); opacity: 0;
  transition: transform 0.3s var(--ease), opacity 0.3s;
}
.skip:focus-visible { transform: translateY(0); opacity: 1; }

/* ---------- Backdrop: gradient wash + particle canvas ---------- */
.grade {
  position: fixed; inset: 0; z-index: -2; pointer-events: none;
  background:
    radial-gradient(120vmax 80vmax at 50% -20%, rgba(76, 118, 255, 0.09), transparent 55%),
    radial-gradient(90vmax 70vmax at 85% 115%, rgba(122, 92, 255, 0.06), transparent 55%),
    var(--bg);
}
/* richer wash when the WebGL field is unavailable */
html:not(.field-live) .grade {
  background:
    radial-gradient(120vmax 80vmax at 50% -20%, rgba(76, 118, 255, 0.13), transparent 55%),
    radial-gradient(90vmax 70vmax at 85% 115%, rgba(122, 92, 255, 0.10), transparent 55%),
    radial-gradient(70vmax 50vmax at 10% 60%, rgba(127, 216, 255, 0.05), transparent 60%),
    var(--bg);
}
#field {
  position: fixed; inset: 0; z-index: -1;
  width: 100%; height: 100%;
  pointer-events: none;
  display: none;
}
html.field-live #field { display: block; }

/* ---------- Type ---------- */
.eyebrow {
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--t3);
  margin-bottom: 1.1rem;
}
h1 {
  font-family: var(--display);
  font-weight: 600;
  font-size: clamp(2.7rem, 7.2vw, 5.9rem);
  line-height: 1.02;
  letter-spacing: -0.025em;
  text-wrap: balance;
  max-width: 15ch;
}
h2 {
  font-family: var(--display);
  font-weight: 600;
  font-size: clamp(1.95rem, 4.6vw, 3.5rem);
  line-height: 1.06;
  letter-spacing: -0.02em;
  text-wrap: balance;
}
.grad {
  font-style: normal;
  background: linear-gradient(104deg, #7fd8ff 5%, #8f9dff 55%, #b9a6ff 95%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.lead, .sec-lead {
  color: var(--t2);
  font-size: clamp(1.1rem, 1rem + 0.55vw, 1.3rem);
  line-height: 1.6;
  max-width: 56ch;
}

/* ---------- Nav ---------- */
.nav {
  position: fixed; top: 0; left: 0; right: 0; z-index: 100;
  background: color-mix(in srgb, var(--bg) 62%, transparent);
  -webkit-backdrop-filter: blur(14px) saturate(1.15);
  backdrop-filter: blur(14px) saturate(1.15);
}
.nav-inner {
  max-width: var(--container);
  margin: 0 auto;
  height: var(--nav-h);
  padding: 0 clamp(20px, 4vw, 32px);
  display: flex; align-items: center; gap: 28px;
}
.brand {
  display: inline-flex; align-items: center; gap: 10px;
  font-family: var(--display); font-weight: 600; font-size: 1.2rem;
  letter-spacing: -0.01em;
  text-decoration: none;
}
.spark { width: 17px; height: 17px; fill: var(--gold); flex: none; }
.nav-links {
  display: flex; gap: 26px; margin-left: auto;
}
.nav-links a {
  text-decoration: none;
  color: var(--t2);
  font-weight: 500; font-size: 0.95rem;
  transition: color 0.25s;
}
.nav-links a:hover { color: var(--t1); }
.nav-cta { flex: none; }
.progress {
  height: 1px; background: rgba(255, 255, 255, 0.06);
}
.progress i {
  display: block; height: 100%;
  background: linear-gradient(90deg, rgba(127, 216, 255, 0.7), var(--gold));
  transform: scaleX(0); transform-origin: left;
}

/* ---------- Buttons ---------- */
.pill {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 0.78em 1.5em;
  border: 0; border-radius: 999px;
  font-weight: 500; font-size: 0.98rem;
  text-decoration: none; cursor: pointer;
  transition: transform 0.35s var(--ease), box-shadow 0.35s var(--ease), background 0.25s;
}
.pill-gold {
  background: var(--gold);
  color: var(--gold-ink);
}
.pill-gold:hover {
  background: var(--gold-hi);
  transform: translateY(-2px);
  box-shadow: 0 10px 34px rgba(255, 197, 125, 0.22);
}
.nav-cta { padding: 0.62em 1.25em; font-size: 0.92rem; }
.ghost {
  display: inline-flex; align-items: center;
  color: var(--t2); font-weight: 500;
  text-decoration: none;
  padding: 0.78em 0.4em;
  transition: color 0.25s;
}
.ghost:hover { color: var(--t1); }
.ghost-arrow { transition: transform 0.35s var(--ease); display: inline-block; }
.ghost:hover .ghost-arrow { transform: translateX(4px); }

/* ---------- Sections shared ---------- */
main { position: relative; }
section {
  position: relative;
  max-width: var(--container);
  margin: 0 auto;
  padding: clamp(96px, 14vh, 170px) clamp(20px, 4vw, 32px);
}
.sec-head { max-width: 720px; }
.sec-head .sec-lead { margin-top: 1.1rem; }

/* ---------- Hero ---------- */
.hero {
  min-height: 100vh;
  min-height: 100svh;
  display: flex; flex-direction: column; justify-content: center;
  padding-top: calc(var(--nav-h) + 24px);
}
.hero-inner { will-change: transform; }
.hero .lead { margin-top: 1.6rem; }
.actions {
  display: flex; flex-wrap: wrap; align-items: center;
  gap: 20px; margin-top: 2.4rem;
}
.scroll-cue {
  position: absolute; left: 50%; bottom: 26px;
  transform: translateX(-50%);
  display: flex; flex-direction: column; align-items: center; gap: 10px;
  color: var(--t3);
  font-size: 0.68rem; font-weight: 500;
  letter-spacing: 0.22em; text-transform: uppercase;
  transition: opacity 0.6s;
}
.scroll-cue i {
  width: 1px; height: 42px;
  background: linear-gradient(rgba(255,255,255,0.35), transparent);
}
body.scrolled .scroll-cue { opacity: 0; }

/* hero load-in */
html.js [data-load] {
  opacity: 0;
  transform: translateY(26px);
  transition: opacity 1s var(--ease), transform 1s var(--ease), filter 1s var(--ease);
}
html.js h1[data-load] { filter: blur(12px); }
html.js body.loaded [data-load] {
  opacity: 1; transform: none; filter: none;
}
body.loaded [data-load="1"] { transition-delay: 0.15s; }
body.loaded [data-load="2"] { transition-delay: 0.3s; }
body.loaded [data-load="3"] { transition-delay: 0.55s; }
body.loaded [data-load="4"] { transition-delay: 0.72s; }

/* ---------- Scroll reveals ---------- */
html.js [data-reveal] {
  opacity: 0;
  transform: translateY(26px);
  transition: opacity 0.9s var(--ease), transform 0.9s var(--ease);
}
html.js [data-reveal].in {
  opacity: 1; transform: none;
}

/* ---------- Services / cards ---------- */
.cards {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 22px;
  margin-top: clamp(40px, 6vh, 64px);
}
.card {
  --lit: 0;
  position: relative;
  background: var(--glass);
  border: 1px solid rgba(255, 255, 255, calc(0.08 + 0.16 * var(--lit)));
  border-radius: 20px;
  padding: clamp(24px, 3vw, 34px);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  transition: transform 0.5s var(--ease);
  overflow: hidden;
}
.card::before {
  content: '';
  position: absolute; inset: 0;
  background: radial-gradient(90% 60% at 50% -10%, rgba(170, 200, 255, 0.10), transparent 70%);
  opacity: var(--lit);
  pointer-events: none;
}
.card:hover { transform: translateY(-4px); }
.card .icon {
  width: 44px; height: 44px;
  stroke: #bcd2f5; stroke-width: 1.7; fill: none;
  stroke-linecap: round; stroke-linejoin: round;
  margin-bottom: 18px;
}
html.js .card .icon [pathLength] {
  stroke-dasharray: 1; stroke-dashoffset: 1;
  transition: stroke-dashoffset 1.3s var(--ease) 0.25s;
}
html.js .card.in .icon [pathLength] { stroke-dashoffset: 0; }
.card h3 {
  font-family: var(--display); font-weight: 500;
  font-size: 1.4rem; letter-spacing: -0.01em;
  margin-bottom: 0.5rem;
}
.card > p { color: var(--t2); font-size: 1rem; }
.card ul {
  list-style: none; padding: 0;
  margin-top: 1.2rem;
  display: grid; gap: 0.5rem;
}
.card li {
  position: relative;
  padding-left: 18px;
  color: var(--t2); font-size: 0.94rem;
}
.card li::before {
  content: '';
  position: absolute; left: 2px; top: 0.62em;
  width: 4px; height: 4px; border-radius: 50%;
  background: var(--t3);
}

/* ---------- The Reveal (signature) ---------- */
.reveal-track {
  padding: 0;
  max-width: none;
  height: 300vh;
}
.reveal-stage {
  position: sticky; top: 0;
  height: 100vh;
  height: 100svh;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: clamp(18px, 3vh, 30px);
  padding: calc(var(--nav-h) + 12px) clamp(20px, 4vw, 32px) 24px;
  overflow: hidden;
}
.reveal-head { text-align: center; max-width: 780px; }
.reveal-head .sec-lead { margin-inline: auto; }
.frame {
  width: min(74vw, 720px);
  aspect-ratio: 480 / 330;
  flex: none;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 18px;
  background: rgba(160, 190, 255, 0.02);
  box-shadow:
    0 30px 80px rgba(0, 0, 0, 0.45),
    inset 0 1px 0 rgba(255, 255, 255, 0.08);
  padding: 4px;
}
.wire {
  width: 100%; height: 100%;
  stroke: rgba(234, 242, 255, 0.55); stroke-width: 2; fill: none;
}
.wire .fill { fill: rgba(234, 242, 255, 0.55); stroke: none; }
.wire .dot { fill: rgba(234, 242, 255, 0.55); stroke: none; }
.wire .dim { opacity: 0.5; }
.wire .gold { fill: var(--gold); stroke: none; }
.resolve-caption {
  color: var(--t2);
  font-size: clamp(1.05rem, 1rem + 0.4vw, 1.25rem);
}
.resolve-caption strong { color: var(--t1); font-weight: 700; }

/* when the particle field is live, the frame + caption are scrubbed by scroll
   and the static wireframe hides (particles draw it instead) */
html.field-live .reveal-stage .frame {
  opacity: var(--frame, 0);
  transform: scale(calc(0.955 + 0.045 * var(--frame, 0)));
}
html.field-live .wire { opacity: 0; }
html.field-live .resolve-caption {
  opacity: var(--cap, 0);
  transform: translateY(calc(12px * (1 - var(--cap, 0))));
}

/* ---------- Process ---------- */
.rail-wrap {
  position: relative;
  margin-top: clamp(48px, 7vh, 80px);
}
.rail {
  position: absolute; top: 0; bottom: 0; left: 24px;
  width: 1px;
  background: rgba(255, 255, 255, 0.10);
}
.pulse {
  position: absolute; left: -0.5px; top: 0;
  width: 2px; height: 110px;
  background: linear-gradient(var(--gold), rgba(255, 197, 125, 0));
  border-radius: 2px;
}
html:not(.js) .pulse { display: none; }
.stations {
  list-style: none; margin: 0; padding: 0;
  display: grid; gap: clamp(44px, 7vh, 76px);
}
.station {
  position: relative;
  padding-left: 76px;
  max-width: 640px;
}
/* unlit = muted (but AA-passing) tones; lit = full tones + gold number */
.station h3, .station p, .station .meta { transition: color 0.7s var(--ease); }
html.js .station:not(.lit) h3 { color: #8b96aa; }
html.js .station:not(.lit) p { color: #7e8a9e; }
html.js .station:not(.lit) .meta { color: #7e8a9e; }
html.js .station:not(.lit) .num {
  -webkit-text-stroke-color: rgba(255, 255, 255, 0.22);
}
.station .num {
  position: absolute; left: 0; top: -0.35rem;
  font-family: var(--display); font-weight: 600;
  font-size: 2rem;
  color: transparent;
  -webkit-text-stroke: 1px rgba(255, 255, 255, 0.35);
  transition: color 0.6s, -webkit-text-stroke-color 0.6s;
  background: var(--bg);
  padding: 0 8px 4px 0;
  line-height: 1;
}
.station.lit .num {
  color: var(--gold);
  -webkit-text-stroke-color: transparent;
}
.station h3 {
  font-family: var(--display); font-weight: 500;
  font-size: 1.45rem; letter-spacing: -0.01em;
}
.station p { color: var(--t2); margin-top: 0.4rem; }
.station .meta {
  margin-top: 0.55rem;
  font-size: 0.78rem; font-weight: 500;
  letter-spacing: 0.16em; text-transform: uppercase;
  color: var(--t3);
}
.gold-text { color: var(--gold); }

@media (min-width: 900px) {
  .rail { left: 50%; }
  .pulse { left: -0.5px; }
  .station {
    width: calc(50% - 56px);
    padding-left: 0;
    max-width: none;
  }
  /* zigzag alternates the column side only — body copy stays left-aligned;
     the mirrored feel comes from the number alone */
  .station:nth-child(odd) { margin-right: auto; }
  .station:nth-child(odd) .num { text-align: right; }
  .station:nth-child(even) { margin-left: auto; }
  .station .num {
    position: static;
    display: block;
    margin-bottom: 0.5rem;
    background: none; padding: 0;
  }
}

/* ---------- Studio ---------- */
.studio { text-align: center; }
.studio .eyebrow { margin-bottom: 1.6rem; }
.studio-copy {
  font-family: var(--display); font-weight: 500;
  font-size: clamp(1.4rem, 1.1rem + 1.6vw, 2.2rem);
  line-height: 1.35; letter-spacing: -0.01em;
  max-width: 30ch;
  margin: 0 auto;
  text-wrap: balance;
}

/* ---------- Contact ---------- */
.contact .sec-head { margin-bottom: clamp(36px, 5vh, 56px); }
.panel {
  background: var(--glass);
  border: 1px solid var(--hairline);
  border-radius: 24px;
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  padding: clamp(24px, 4vw, 44px);
  max-width: 760px;
}
.grid2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
}
.fld { display: flex; flex-direction: column; gap: 7px; margin-bottom: 18px; }
.fld label {
  font-size: 0.86rem; font-weight: 500; color: var(--t2);
}
.fld .opt { color: var(--t3); font-weight: 400; }
.fld input, .fld textarea {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--hairline);
  border-radius: 12px;
  padding: 0.8em 0.95em;
  font-size: 1rem;
  color: var(--t1);
  transition: border-color 0.25s, box-shadow 0.25s;
}
.fld input:focus-visible, .fld textarea:focus-visible {
  outline: none;
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(255, 197, 125, 0.16);
}
.fld textarea { resize: vertical; min-height: 120px; }
.fld input[aria-invalid="true"], .fld textarea[aria-invalid="true"] {
  border-color: var(--err);
}
.hp-wrap { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.form-foot {
  display: flex; flex-wrap: wrap; align-items: center; gap: 20px;
  margin-top: 6px;
}
.form-note { font-size: 0.9rem; color: var(--t3); }
.form-note a { color: var(--t2); }
.form-note a:hover { color: var(--t1); }
.form-status { margin-top: 14px; font-size: 0.95rem; min-height: 1.4em; }
.form-status.ok { color: var(--ok); }
.form-status.err { color: var(--err); }
.form-status a { color: inherit; }

/* ---------- Footer ---------- */
.foot {
  border-top: 1px solid rgba(255, 255, 255, 0.07);
  background: color-mix(in srgb, var(--bg) 80%, transparent);
}
.foot-inner {
  max-width: var(--container);
  margin: 0 auto;
  padding: 34px clamp(20px, 4vw, 32px);
  display: flex; flex-wrap: wrap; align-items: center; gap: 12px 28px;
  color: var(--t3); font-size: 0.9rem;
}
.foot-brand {
  display: inline-flex; align-items: center; gap: 9px;
  color: var(--t2); font-weight: 500;
}
.foot-brand .spark { width: 13px; height: 13px; }
.foot-legal { margin-right: auto; }
.foot-mail { color: var(--t3); text-decoration: none; }
.foot-mail:hover { color: var(--t1); text-decoration: underline; }

/* ---------- Mobile ---------- */
@media (max-width: 899px) {
  .nav-links { display: none; }
  .cards { grid-template-columns: 1fr; }
  .frame { width: min(88vw, 560px); }
  .reveal-track { height: 260vh; }
  /* backdrop-filter over a live canvas is the most expensive compositor op
     on mobile GPUs — swap glass for near-opaque surfaces */
  .nav {
    background: color-mix(in srgb, var(--bg) 92%, transparent);
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
  }
  .card, .panel {
    background: rgba(13, 18, 27, 0.82);
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
  }
}
@media (max-width: 640px) {
  .grid2 { grid-template-columns: 1fr; gap: 0; }
  .actions { gap: 12px; }
  .nav-inner { gap: 14px; }
  .nav-cta { font-size: 0.9rem; padding: 0.72em 1.15em; }
  .station { padding-left: 60px; }
  .station .num { font-size: 1.6rem; }
}

/* ---------- Reduced motion / no-JS ---------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
  html.js [data-load], html.js [data-reveal] {
    opacity: 1; transform: none; filter: none;
  }
  html.field-live .reveal-stage .frame { opacity: 1; transform: none; }
  html.field-live .wire { opacity: 1; }
  html.field-live .resolve-caption { opacity: 1; transform: none; }
  .reveal-track { height: auto; padding: clamp(96px, 14vh, 170px) 0; }
  .reveal-stage { position: static; height: auto; }
  html.js .station:not(.lit) h3 { color: var(--t1); }
  html.js .station:not(.lit) p { color: var(--t2); }
  html.js .station:not(.lit) .meta { color: var(--t3); }
  .pulse { display: none; }
  .scroll-cue { display: none; }
}
