/* ============================================================================
   LUXWRAP — RESET, PAGE ATMOSPHERE, TYPOGRAPHY, UTILITIES
   ========================================================================= */

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

html {
  scroll-behavior: smooth;
  /* Both ends. Below 900px the rail becomes a fixed BOTTOM bar, so without the
     bottom padding, Tab-ing to a control near the end of a section scrolls it
     to a position where the bar covers it. */
  scroll-padding-top: calc(var(--topbar-h) + 24px);
  scroll-padding-bottom: 24px;
  -webkit-text-size-adjust: 100%;
}
@media (max-width: 900px) {
  html {
    scroll-padding-bottom: calc(54px + 24px);
  }
}

/* the skip link's target must not draw a focus ring around the whole page */
main:focus {
  outline: none;
}

body {
  min-height: 100svh;
  background: var(--ink-950);
  color: var(--text);
  font-family: var(--f-ui);
  font-size: var(--fs-body);
  line-height: 1.6;
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  /* `clip`, not `hidden`. overflow-x:hidden turns the body into a scroll
     container, which silently breaks the position:sticky hero stage. `clip`
     clips the same horizontal overflow WITHOUT establishing a scroll container,
     so the scrub keeps working. (Chrome/Edge/FF, Safari 16+.) */
  overflow-x: clip;
  text-rendering: optimizeLegibility;
}

body.is-locked {
  overflow: hidden;
}

/* ---------------------------------------------------------------- ambience
   The page sits in a dark studio: a cold vignette, a faint engineering grid,
   two slow-breathing colour lights, and a whisper of grain over everything.  */
.ambience {
  position: fixed;
  inset: 0;
  z-index: var(--z-bg);
  pointer-events: none;
  overflow: hidden;
}

.ambience__grid {
  position: absolute;
  inset: -2px;
  background-image: linear-gradient(rgba(120, 165, 220, 0.055) 1px, transparent 1px),
    linear-gradient(90deg, rgba(120, 165, 220, 0.055) 1px, transparent 1px);
  background-size: 64px 64px;
  mask-image: radial-gradient(ellipse 120% 90% at 50% 0%, #000 10%, transparent 78%);
  -webkit-mask-image: radial-gradient(ellipse 120% 90% at 50% 0%, #000 10%, transparent 78%);
  opacity: 0.55;
}

.ambience__glow {
  position: absolute;
  border-radius: 50%;
  filter: blur(120px);
  opacity: 0.42;
  animation: breathe 14s var(--ease-in-out) infinite;
}
.ambience__glow--1 {
  width: 46vw;
  height: 46vw;
  left: -10vw;
  top: -8vw;
  background: radial-gradient(circle, rgba(44, 233, 255, 0.5), transparent 62%);
}
.ambience__glow--2 {
  width: 52vw;
  height: 52vw;
  right: -14vw;
  top: 26vh;
  background: radial-gradient(circle, rgba(255, 61, 139, 0.36), transparent 64%);
  animation-delay: -6s;
}
.ambience__glow--3 {
  width: 38vw;
  height: 38vw;
  left: 24vw;
  bottom: -14vw;
  background: radial-gradient(circle, rgba(139, 92, 255, 0.32), transparent 66%);
  animation-delay: -10s;
}

@keyframes breathe {
  0%,
  100% {
    transform: translate3d(0, 0, 0) scale(1);
    opacity: 0.34;
  }
  50% {
    transform: translate3d(2vw, -2vh, 0) scale(1.14);
    opacity: 0.5;
  }
}

.ambience__vignette {
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse 100% 78% at 50% 42%, transparent 32%, rgba(2, 3, 6, 0.86) 100%);
}

/* Fine film grain — 1 tiny inline SVG, no image request.
   Kept at -6% inset: a full-viewport-plus-a-bit layer. Do NOT inflate this to
   -200% "so the drift never shows an edge" — the paint area explodes and the
   compositor stalls. The drift below is 6px, so 6% of slack is plenty. */
/* Static. A crawling grain layer is the single fastest way to look cheap
   (ui-motifs §15 says so by name), and it is a full-viewport repaint forever
   for an effect nobody consciously sees. Film grain on a photograph does not
   move either — it is in the emulsion. */
.ambience__grain {
  position: absolute;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='140' height='140' filter='url(%23n)' opacity='0.42'/%3E%3C/svg%3E");
  opacity: 0.035;
}

/* Optional CRT scanline — kept almost invisible on purpose */
.ambience__scan {
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(
    to bottom,
    rgba(255, 255, 255, 0.028) 0 1px,
    transparent 1px 4px
  );
  opacity: 0.5;
  mix-blend-mode: overlay;
}

/* ---------------------------------------------------------------- typography */
h1,
h2,
h3,
h4 {
  font-family: var(--f-display);
  font-weight: 800;
  line-height: 0.92;
  letter-spacing: -0.01em;
  text-transform: uppercase;
  text-wrap: balance;
}

h1 {
  font-size: var(--fs-h1);
}
h2 {
  font-size: var(--fs-h2);
}
h3 {
  font-size: var(--fs-h3);
  font-weight: 700;
}

p {
  text-wrap: pretty;
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
  background: none;
  border: none;
}

button {
  cursor: pointer;
}

img,
video,
svg {
  display: block;
  max-width: 100%;
}

img {
  height: auto;
}

::selection {
  background: var(--cy);
  color: var(--ink-950);
}

/* ---------------------------------------------------------------- scrollbar */
::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}
::-webkit-scrollbar-track {
  background: var(--ink-900);
}
::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, var(--cy-dim), var(--vi-dim));
  border: 2px solid var(--ink-900);
  border-radius: 10px;
}
::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(180deg, var(--cy), var(--mg));
}
html {
  scrollbar-color: var(--cy-dim) var(--ink-900);
  scrollbar-width: thin;
}

/* ---------------------------------------------------------------- a11y */
:focus-visible {
  outline: 2px solid var(--cy);
  outline-offset: 3px;
  border-radius: 2px;
}
:focus:not(:focus-visible) {
  outline: none;
}

.skip-link {
  position: fixed;
  top: 8px;
  left: 8px;
  z-index: 999;
  padding: 10px 18px;
  background: var(--li);
  color: var(--ink-950);
  font-family: var(--f-hud);
  font-weight: 700;
  letter-spacing: var(--track-hud);
  text-transform: uppercase;
  transform: translateY(-160%);
  transition: transform var(--t) var(--ease-out);
}
.skip-link:focus-visible {
  transform: translateY(0);
}

.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;
}

/* ---------------------------------------------------------------- utilities */
.wrap {
  width: 100%;
  max-width: var(--maxw);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.hud-label {
  font-family: var(--f-hud);
  font-size: var(--fs-hud);
  font-weight: 600;
  letter-spacing: var(--track-wide);
  text-transform: uppercase;
  color: var(--text-dim);
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-3);
  font-family: var(--f-hud);
  font-size: var(--fs-xs);
  font-weight: 600;
  letter-spacing: var(--track-wide);
  text-transform: uppercase;
  color: var(--cy);
}
.eyebrow::before {
  content: "";
  width: 26px;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--cy));
}
.eyebrow::after {
  content: "";
  width: 6px;
  height: 6px;
  background: var(--cy);
  box-shadow: 0 0 10px var(--cy);
  transform: rotate(45deg);
}

.holo-text {
  background: var(--holo);
  background-size: 220% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  animation: holo-slide 9s linear infinite;
}
@keyframes holo-slide {
  to {
    background-position: 220% 0;
  }
}

.chrome-text {
  background: var(--chrome);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.lead {
  font-size: var(--fs-lead);
  color: var(--text-soft);
  line-height: 1.65;
  max-width: 62ch;
}

.muted {
  color: var(--text-dim);
}

/* ---------------------------------------------------------------- sections */
.section {
  position: relative;
  z-index: var(--z-content);
  padding-block: var(--sp-section);
  scroll-margin-top: calc(var(--topbar-h) + 20px);
}

.section__head {
  display: flex;
  flex-direction: column;
  gap: var(--sp-4);
  margin-bottom: var(--sp-8);
  max-width: 760px;
}

.section__head--split {
  flex-direction: row;
  align-items: flex-end;
  justify-content: space-between;
  max-width: none;
  gap: var(--sp-6);
  flex-wrap: wrap;
}

.section__title {
  font-size: var(--fs-h2);
}

.section__index {
  font-family: var(--f-hud);
  font-size: var(--fs-hud);
  letter-spacing: var(--track-wide);
  color: var(--text-ghost);
}

/* ---------------------------------------------------------------- reveal
   Gated on html.js (set by a one-line script in <head>). If JavaScript never
   runs, nothing is ever hidden — a broken script must not blank the page.

   BOTH rules are wrapped in :where() to force specificity (0,0,0). This is not
   cosmetic. `.is-in` sets `transform: none`, and it stays on the element
   forever — so at any real specificity it silently outranks every *later*
   state that wants a transform: `.panel--lift:hover` (0,2,0) would never lift,
   `.reviews__row:hover` would never slide, and `.build.is-out` (0,2,0) would
   lose both its opacity AND transform, killing the portfolio filter's exit
   animation outright. At (0,0,0) the reveal is the floor, and every hover /
   filter / reduced-motion rule wins over it, which is exactly the intent.
   Keep BOTH in :where() — zeroing only `.is-in` would let the (0,2,0) base
   rule win and nothing would ever reveal at all.                             */
:where(.js) :where([data-reveal]) {
  opacity: 0;
  transform: translateY(26px);
  transition: opacity 0.75s var(--ease-out), transform 0.75s var(--ease-out);
  transition-delay: var(--reveal-delay, 0ms);
}
:where(.js) :where([data-reveal].is-in) {
  opacity: 1;
  transform: none;
}

/* ------------------------------------------------- user motion kill switch
   Driven by the REDUCE MOTION button in the footer (WCAG 2.2.2). `paused`
   rather than `none`: it freezes each animation where it stands instead of
   snapping gradients and marquees back to their first frame.                 */
.motion-off *,
.motion-off *::before,
.motion-off *::after {
  animation-play-state: paused !important;
}

/* ---------------------------------------------------------------- motion off */
@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;
    scroll-behavior: auto !important;
  }
  [data-reveal] {
    opacity: 1;
    transform: none;
  }
  .ambience__grain,
  .ambience__glow {
    animation: none;
  }
}
