/* ==========================================================================
   base.css — shared by every page
   Tokens, reset, typography, layout, buttons, header/nav, footer, utilities.
   Page-specific styles live in their own file (home.css, case-study.css, …).
   ========================================================================== */

/* --- Tokens ------------------------------------------------------------- */
:root {
  color-scheme: dark;

  /* Color. Text colors are all ≥ 4.5:1 against --bg. */
  --bg: #05040a;
  --bg-raised: #0b0912;
  --surface: #110e1c;
  --line: rgb(255 255 255 / 0.1);
  --line-strong: rgb(255 255 255 / 0.24);
  --text: #f4f1fb;
  --text-muted: #b5aec8;
  --magenta: #ff3fa4;
  --magenta-bright: #ff6bba;
  --violet: #8b5cf6;        /* decorative only; use --violet-text for text */
  --violet-text: #a98bff;
  --focus: #ffffff;
  --glow: rgb(255 63 164 / 0.35);

  /* Type */
  --font-display: "Sora", "Avenir Next", "Segoe UI", system-ui, sans-serif;
  --font-body: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --step--1: clamp(0.8125rem, 0.79rem + 0.1vw, 0.875rem);
  --step-0: clamp(1rem, 0.96rem + 0.2vw, 1.125rem);
  --step-1: clamp(1.1875rem, 1.1rem + 0.45vw, 1.4375rem);
  --step-2: clamp(1.5rem, 1.3rem + 1vw, 2.125rem);
  --step-3: clamp(1.875rem, 1.5rem + 1.9vw, 3.125rem);
  --step-4: clamp(2rem, 1.2rem + 4.6vw, 5.25rem);

  /* Space and layout */
  --space-1: 0.5rem;
  --space-2: 1rem;
  --space-3: 1.5rem;
  --space-4: 2.5rem;
  --space-5: 4rem;
  --space-6: clamp(5rem, 10vw, 9rem);
  --gutter: clamp(1.25rem, 4vw, 3rem);
  --container: 76rem;
  --radius: 0.75rem;
  --header-h: 5rem;

  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
}

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

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-h) + 1rem);
}

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--text);
  font: 400 var(--step-0) / 1.65 var(--font-body);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

main {
  flex: 1 0 auto;
}

main:focus {
  outline: none; /* only focused programmatically by the skip link */
}

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

h1,
h2,
h3,
h4,
p,
ul {
  margin: 0;
}

ul {
  padding: 0;
}

.list-reset {
  list-style: none;
}

a {
  color: inherit;
}

/* --- Typography --------------------------------------------------------- */
h1,
h2,
h3,
h4 {
  font-family: var(--font-display);
  font-weight: 600;
  line-height: 1.12;
  letter-spacing: -0.02em;
  text-wrap: balance;
}

h1 { font-size: var(--step-4); }
h2 { font-size: var(--step-3); }
h3 { font-size: var(--step-2); }
h4 { font-size: var(--step-1); }

p {
  text-wrap: pretty;
}

.lead {
  font-size: var(--step-1);
  line-height: 1.55;
  color: var(--text-muted);
}

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

/* Inline text links (anything without a class) */
a:not([class]) {
  text-decoration-color: var(--magenta);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.2em;
}

a:not([class]):hover {
  color: var(--magenta-bright);
}

.text-gradient {
  display: block;
  padding-bottom: 0.1em; /* keeps descenders from being clipped */
  color: var(--magenta);
}

@supports (background-clip: text) or (-webkit-background-clip: text) {
  .text-gradient {
    background: linear-gradient(95deg, var(--magenta) 0%, var(--violet-text) 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
  }
}

@media (forced-colors: active) {
  .text-gradient {
    background: none;
    -webkit-text-fill-color: currentColor;
    color: CanvasText;
  }
}

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

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

.skip-link {
  position: absolute;
  left: var(--gutter);
  top: -5rem;
  z-index: 100;
  padding: 0.75rem 1.25rem;
  border-radius: 0.5rem;
  background: var(--text);
  color: var(--bg);
  font-weight: 600;
  text-decoration: none;
}

.skip-link:focus {
  top: 0.75rem;
}

/* --- Layout ------------------------------------------------------------- */
.container {
  width: 100%;
  max-width: calc(var(--container) + 2 * var(--gutter));
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.section {
  padding-block: var(--space-6);
}

/* --- Buttons ------------------------------------------------------------ */
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.65rem;
  min-height: 3rem;
  padding: 0.75rem 1.6rem;
  border: 1px solid transparent;
  border-radius: 999px;
  font: 600 var(--step-0) / 1.2 var(--font-body);
  text-decoration: none;
  cursor: pointer;
  transition:
    background-color 0.25s var(--ease),
    border-color 0.25s var(--ease),
    box-shadow 0.25s var(--ease);
}

.button--primary {
  background: var(--magenta);
  color: #12040c;
}

.button--primary:hover {
  background: var(--magenta-bright);
  box-shadow: 0 0 2rem -0.25rem var(--glow);
}

.button--ghost {
  border-color: var(--line-strong);
  background: rgb(255 255 255 / 0.02);
  color: var(--text);
}

.button--ghost:hover {
  border-color: var(--violet-text);
  background: rgb(139 92 246 / 0.14);
}

/* Decorative arrow (hidden from screen readers via empty alt text) */
.arrow {
  display: inline-block;
  transition: transform 0.25s var(--ease);
}

a:hover > .arrow,
.button:hover > .arrow {
  transform: translateX(0.25rem);
}

/* --- Motion (transparent WebM + still poster) ------------------------------
   A .motion box stacks one <video> and its still <img> in the same spot.
   The poster shows first and stays whenever the video can't or shouldn't play
   (reduced motion, Safari/iOS, no JS, load error). See js/main.js.
   Keep this above the components that size/position a .motion box.          */
.motion {
  position: relative;
}

.motion__video,
.motion__poster {
  display: block;
  width: 100%;
  height: 100%;
}

.motion__video {
  position: absolute;
  inset: 0;
}

/* The video is transparent, so hide the poster once it's playing. */
.motion.is-playing .motion__poster {
  visibility: hidden;
}

.motion:not(.is-playing) .motion__video {
  visibility: hidden;
}

/* --- Header and navigation ---------------------------------------------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  isolation: isolate;
  border-bottom: 1px solid var(--line);
}

/* The frosted glass lives on its own layer behind the content rather than on the
   header itself, so the animated logo video isn't a child of the blurred element
   (that combination flickered in the preview pane). */
.site-header::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: rgb(5 4 10 / 0.74);
  -webkit-backdrop-filter: blur(14px) saturate(140%);
  backdrop-filter: blur(14px) saturate(140%);
}

.site-header__inner {
  position: relative;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-1) var(--space-3);
  min-height: var(--header-h);
  padding-block: 0.5rem;
}

/* Monogram link: a static gradient mark with its chord lines (assets/brand/logo-mark.png) */
.monogram {
  position: relative;
  display: block;
  flex: none;
  width: 3.5rem;
  height: 3.5rem;
  border-radius: 50%;
  text-decoration: none;
  transition: filter 0.25s var(--ease);
}

.monogram:hover {
  filter: drop-shadow(0 0 0.9rem var(--glow));
}

.monogram__img {
  display: block;
  width: 100%;
  height: 100%;
}

.site-nav__list {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0 clamp(1.25rem, 3vw, 2.5rem);
}

.site-nav a {
  position: relative;
  display: inline-block;
  padding: 0.6rem 0;
  color: var(--text-muted);
  font: 500 var(--step--1) / 1 var(--font-body);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  text-decoration: none;
  transition: color 0.2s var(--ease);
}

.site-nav a::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0.2rem;
  height: 1px;
  background: linear-gradient(90deg, var(--magenta), var(--violet));
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.3s var(--ease);
}

.site-nav a:hover,
.site-nav a[aria-current] {
  color: var(--text);
}

.site-nav a:hover::after,
.site-nav a[aria-current]::after {
  transform: scaleX(1);
}

/* Menu button: only shown when JS is running and the screen is narrow */
.nav-toggle {
  display: none;
  align-items: center;
  gap: 0.85rem;
  min-height: 2.75rem;
  padding: 0 0.25rem 0 0.75rem;
  border: 0;
  background: none;
  color: var(--text);
  font: 500 var(--step--1) / 1 var(--font-body);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  cursor: pointer;
}

.nav-toggle__icon,
.nav-toggle__icon::before,
.nav-toggle__icon::after {
  display: block;
  width: 1.5rem;
  height: 2px;
  background: currentColor;
  transition: transform 0.3s var(--ease), background-color 0.2s var(--ease);
}

.nav-toggle__icon {
  position: relative;
}

.nav-toggle__icon::before,
.nav-toggle__icon::after {
  content: "";
  position: absolute;
  left: 0;
}

.nav-toggle__icon::before { top: -7px; }
.nav-toggle__icon::after { top: 7px; }

.nav-toggle[aria-expanded="true"] .nav-toggle__icon {
  background: transparent;
}

.nav-toggle[aria-expanded="true"] .nav-toggle__icon::before {
  transform: translateY(7px) rotate(45deg);
}

.nav-toggle[aria-expanded="true"] .nav-toggle__icon::after {
  transform: translateY(-7px) rotate(-45deg);
}

@media (max-width: 47.99rem) {
  .js .nav-toggle {
    display: inline-flex;
  }

  .js .site-nav {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    padding: var(--space-1) var(--gutter) var(--space-3);
    background: var(--bg);
    border-bottom: 1px solid var(--line);
  }

  .js .nav-toggle[aria-expanded="false"] ~ .site-nav {
    display: none;
  }

  .js .site-nav__list {
    flex-direction: column;
    align-items: stretch;
  }

  .js .site-nav a {
    display: block;
    padding: 1.1rem 0;
    border-bottom: 1px solid var(--line);
    font-size: var(--step-0);
  }

  .js .site-nav li:last-child a {
    border-bottom: 0;
  }

  .js .site-nav a::after {
    display: none;
  }
}

/* --- Footer ------------------------------------------------------------- */
.site-footer {
  border-top: 1px solid var(--line);
  background: var(--bg);
}

.site-footer__inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2) var(--space-4);
  padding-block: var(--space-4);
  color: var(--text-muted);
  font-size: var(--step--1);
}

.site-footer__list {
  display: flex;
  flex-wrap: wrap;
  gap: 0 var(--space-3);
}

.site-footer__list a {
  display: inline-block;
  padding: 0.5rem 0;
  color: var(--text-muted);
  text-decoration: none;
}

.site-footer__list a:hover {
  color: var(--text);
  text-decoration: underline;
  text-decoration-color: var(--magenta);
  text-underline-offset: 0.25em;
}

/* --- Image placeholder (shared) ------------------------------------------
   Visible stand-in for artwork that hasn't been supplied yet. Replace the
   whole element with an <img> and delete this block once all are swapped.   */
.media-placeholder {
  position: relative;
  display: grid;
  place-items: center;
  aspect-ratio: var(--ratio, 16 / 10);
  padding: var(--space-4);
  background:
    repeating-linear-gradient(135deg, rgb(255 255 255 / 0.025) 0 12px, transparent 12px 24px),
    radial-gradient(80% 90% at 70% 100%, rgb(139 92 246 / 0.28), transparent 70%),
    var(--surface);
  color: var(--text-muted);
  font: 500 var(--step--1) / 1.5 var(--font-body);
  letter-spacing: 0.1em;
  text-align: center;
  text-transform: uppercase;
}

.media-placeholder::before {
  content: "";
  position: absolute;
  inset: 0.75rem;
  border: 1px dashed rgb(255 63 164 / 0.55);
  border-radius: calc(var(--radius) - 0.25rem);
  pointer-events: none;
}

/* --- Scroll reveal (JS adds .is-visible; without JS nothing is hidden) --- */
.js .reveal {
  opacity: 0;
  transform: translateY(1.5rem);
  transition:
    opacity 0.9s var(--ease) var(--reveal-delay, 0s),
    transform 0.9s var(--ease) var(--reveal-delay, 0s);
}

.js .reveal.is-visible {
  opacity: 1;
  transform: none;
}

/* --- Copy button (beside a plain-text email address; built by js/main.js) --- */
.copy-button {
  display: inline-grid;
  place-items: center;
  width: 2.25rem;
  height: 2.25rem;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 50%;
  background: none;
  color: var(--text-muted);
  cursor: pointer;
  transition: color 0.2s var(--ease), background 0.2s var(--ease), border-color 0.2s var(--ease);
}

.copy-button:hover {
  border-color: var(--line-strong);
  background: rgb(255 255 255 / 0.06);
  color: var(--text);
}

.copy-button svg {
  grid-area: 1 / 1;
  width: 1.15rem;
  height: 1.15rem;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.copy-button__done,
.copy-button.is-copied .copy-button__copy {
  display: none;
}

.copy-button.is-copied {
  color: var(--magenta-bright);
}

.copy-button.is-copied .copy-button__done {
  display: block;
}

.copy-wrap {
  position: relative;
  display: inline-flex;
}

.copy-status {
  position: absolute;
  top: 50%;
  left: calc(100% + 0.25rem);
  transform: translateY(-50%);
  color: var(--magenta-bright);
  font-size: var(--step--1);
  white-space: nowrap;
}

.copy-status:empty {
  display: none;
}

/* --- Reduced motion ------------------------------------------------------ */
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }

  .js .reveal {
    opacity: 1;
    transform: none;
  }
}
