/* ============================================================
   BELLAMY WORKS — B/W
   Strict monochrome. Two colors, start to finish.
   ============================================================ */

/* ---------- Tokens ---------- */
:root {
  /* primitives — the only two colors that exist */
  --ink:   oklch(0.145 0 0);   /* ≈ #0A0A0A */
  --paper: oklch(0.985 0 0);   /* ≈ #FAFAF9 */

  /* semantic (dark opening state: paper on ink) */
  --bg: var(--ink);
  --fg: var(--paper);

  --muted:  color-mix(in oklch, var(--fg) 62%, var(--bg));
  --faint:  color-mix(in oklch, var(--fg) 38%, var(--bg));
  --line:   color-mix(in oklch, var(--fg) 16%, var(--bg));

  /* type */
  --font-display: "Clash Display", "Geist", system-ui, sans-serif;
  --font-body:    "Geist", system-ui, -apple-system, sans-serif;
  --font-mono:    "Geist Mono", ui-monospace, "SF Mono", monospace;
  --font-serif:   "Fraunces", Georgia, serif;

  --step-0: clamp(1rem, 0.94rem + 0.3vw, 1.125rem);      /* body 16→18 */
  --step-1: clamp(1.25rem, 1.1rem + 0.7vw, 1.75rem);
  --step-2: clamp(1.75rem, 1.4rem + 1.8vw, 3rem);
  --step-3: clamp(2.5rem, 1.8rem + 3.5vw, 5rem);
  --step-4: clamp(3.5rem, 2rem + 7.5vw, 9rem);
  --step-hero: clamp(3.75rem, 1rem + 13.5vw, 13.5rem);

  --tracking-mono: 0.08em;

  /* space (8pt) */
  --space-2: 8px;  --space-3: 16px; --space-4: 24px; --space-5: 32px;
  --space-6: 48px; --space-7: 64px; --space-8: 96px; --space-9: 128px;
  --section-pad: clamp(96px, 12vw, 200px);
  --gutter: clamp(20px, 4vw, 72px);

  --ease-out: cubic-bezier(0.19, 1, 0.22, 1);   /* expo-ish out */
  --dur: 0.28s;
}

/* light half of the page (post-inversion). Same names, swapped roles. */
html[data-mode="light"] {
  --bg: var(--paper);
  --fg: var(--ink);
}

/* ---------- Reset & base ---------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }
html.lenis, html.lenis body { height: auto; }
.lenis.lenis-smooth { scroll-behavior: auto !important; }

body {
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-body);
  font-size: var(--step-0);
  font-weight: 300;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: clip;
  transition: background-color 0.6s var(--ease-out), color 0.6s var(--ease-out);
}

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

/* every image on this site is monochrome, by law */
img { filter: grayscale(1) contrast(1.04); }

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

::selection { background: var(--fg); color: var(--bg); }

:focus-visible {
  outline: 2px solid var(--fg);
  outline-offset: 4px;
}

.visually-hidden {
  position: absolute; width: 1px; height: 1px;
  clip-path: inset(50%); overflow: hidden; white-space: nowrap;
}

.skip-link {
  position: fixed; top: 12px; left: 12px; z-index: 300;
  padding: 10px 16px;
  background: var(--fg); color: var(--bg);
  font-family: var(--font-mono); font-size: 0.8rem;
  transform: translateY(-250%);
  transition: transform var(--dur) var(--ease-out);
}
.skip-link:focus-visible { transform: none; }

.mono {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  font-weight: 400;
  letter-spacing: var(--tracking-mono);
  text-transform: uppercase;
}

/* ---------- Film grain (whole site, never leaves) ---------- */
body::after {
  content: "";
  position: fixed; inset: -50%;
  z-index: 200;
  pointer-events: none;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  background-size: 256px 256px;
  opacity: 0.055;
  animation: grain 0.9s steps(6) infinite;
}
@keyframes grain {
  0%   { transform: translate(0, 0); }
  20%  { transform: translate(-4%, 3%); }
  40%  { transform: translate(3%, -5%); }
  60%  { transform: translate(-5%, -2%); }
  80%  { transform: translate(4%, 4%); }
  100% { transform: translate(0, 0); }
}

/* ---------- Preloader ---------- */
.preloader {
  position: fixed; inset: 0; z-index: 250;
  background: var(--ink); color: var(--paper);
  display: grid; place-items: center;
}
.preloader__mark {
  display: flex; align-items: baseline; gap: 0.05em;
  font-family: var(--font-display);
  font-weight: 500;
  font-size: clamp(5rem, 22vw, 18rem);
  line-height: 1;
}
.preloader__glyph { display: inline-block; opacity: 0; transform: translateY(0.35em); }
.preloader__glyph--slash { font-weight: 300; }
.preloader__index {
  position: absolute;
  right: var(--gutter); bottom: var(--gutter);
  font-size: 0.9rem;
}

/* ---------- Custom cursor ---------- */
.cursor {
  position: fixed; top: 0; left: 0; z-index: 240;
  width: 12px; height: 12px;
  border-radius: 50%;
  background: #fff;
  mix-blend-mode: difference;
  pointer-events: none;
  transform: translate(-50%, -50%);
  transition: width 0.25s var(--ease-out), height 0.25s var(--ease-out);
  opacity: 0;
}
.cursor.is-active { opacity: 1; }
.cursor.is-hovering { width: 56px; height: 56px; }
@media (hover: none), (pointer: coarse) { .cursor { display: none; } }

/* ---------- Header ---------- */
.site-header {
  position: fixed; top: 0; left: 0; right: 0; z-index: 100;
  display: flex; align-items: center; justify-content: space-between;
  gap: var(--space-4);
  padding: var(--space-4) var(--gutter);
  mix-blend-mode: difference;
  color: #fff;
}
.site-header__mark {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.35rem;
  letter-spacing: -0.02em;
}
.site-header__locus { display: none; }
@media (min-width: 768px) { .site-header__locus { display: block; } }
.site-header__contact { position: relative; padding: 12px 0; }
.site-header__contact::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: 8px;
  height: 1px; background: currentColor;
  transform: scaleX(0); transform-origin: right;
  transition: transform 0.35s var(--ease-out);
}
.site-header__contact:hover::after,
.site-header__contact:focus-visible::after { transform: none; transform-origin: left; }

/* ---------- Hero ---------- */
.hero {
  position: relative;
  isolation: isolate; /* scope the canvas-wrap's negative z-index to this section */
  min-height: 100svh;
  display: flex; flex-direction: column; justify-content: flex-end;
  padding: var(--space-8) var(--gutter) var(--space-7);
  overflow: clip;
}
.hero__canvas-wrap { position: absolute; inset: 0; z-index: -1; }
#hero-canvas { width: 100%; height: 100%; display: block; }
.hero__fallback {
  position: absolute; inset: 0;
  width: 100%; height: 100%; object-fit: cover;
  opacity: 0.85;
}
.hero__canvas-wrap.is-webgl .hero__fallback { display: none; }

.hero__eyebrow {
  color: #fff;
  mix-blend-mode: difference;
  margin-bottom: var(--space-4);
}
.hero__title {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: var(--step-hero);
  line-height: 0.92;
  letter-spacing: -0.025em;
  text-transform: uppercase;
}
.hero__line { display: block; }
.hero__line--indent { margin-left: clamp(0px, 8vw, 160px); }
.hero__slash {
  font-family: var(--font-mono);
  font-size: 0.18em;
  font-weight: 400;
  vertical-align: super;
  letter-spacing: 0;
}
.hero__statement {
  max-width: 44ch;
  margin-top: var(--space-5);
  font-size: var(--step-1);
  font-weight: 300;
  line-height: 1.45;
  color: var(--muted);
}
.hero__scrollcue {
  position: absolute;
  right: var(--gutter); bottom: var(--space-7);
  display: none;
  align-items: center; gap: 12px;
  color: var(--faint);
}
@media (min-width: 1024px) { .hero__scrollcue { display: flex; } }
.hero__scrollcue-line { width: 64px; height: 1px; background: currentColor; }

/* ---------- Manifesto ---------- */
.manifesto {
  padding: var(--section-pad) var(--gutter);
  max-width: 1440px; margin-inline: auto;
}
.manifesto__index { color: var(--faint); margin-bottom: var(--space-7); }
.manifesto__body { max-width: 24ch; }
.manifesto__graf {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: var(--step-3);
  line-height: 1.14;
  letter-spacing: -0.015em;
}
.manifesto__graf + .manifesto__graf { margin-top: var(--space-7); }
.manifesto__graf--close { color: var(--muted); }
.manifesto__variable {
  font-family: var(--font-serif);
  font-style: italic;
  font-weight: 380;
  font-variation-settings: "opsz" 72, "SOFT" 0, "WONK" 0;
}

/* ---------- Inversion ---------- */
.inversion {
  min-height: 130svh; /* runway for the scrubbed flip — enough scrub, no dead white */
  padding: var(--section-pad) var(--gutter);
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  text-align: center;
}
.inversion__stage {
  display: flex; flex-direction: column; align-items: center;
  font-family: var(--font-display);
  font-weight: 500;
  font-size: var(--step-4);
  line-height: 1;
  letter-spacing: -0.02em;
  text-transform: uppercase;
}
.inversion__slash {
  font-weight: 300;
  font-size: 0.6em;
  color: var(--faint);
  margin: 0.1em 0;
}
.inversion__caption { margin-top: var(--space-8); color: var(--muted); }

/* ---------- Craft ---------- */
.craft {
  padding: var(--section-pad) var(--gutter);
  max-width: 1440px; margin-inline: auto;
}
.craft__index { color: var(--faint); margin-bottom: var(--space-5); }
.craft__heading {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: var(--step-3);
  line-height: 1.05;
  letter-spacing: -0.02em;
  margin-bottom: var(--space-8);
}
.craft__grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr));
  gap: clamp(16px, 2vw, 32px);
}
.craft__card { position: relative; }
.craft__card--drift { transform: translateY(clamp(0px, 4vw, 72px)); }
.craft__media {
  overflow: clip;
  aspect-ratio: 9 / 16;
  background: color-mix(in oklch, var(--fg) 6%, var(--bg));
}
.craft__media img {
  width: 100%; height: 100%; object-fit: cover;
  transition: transform 0.9s var(--ease-out), filter 0.9s var(--ease-out);
}
@media (hover: hover) {
  .craft__card:hover .craft__media img { transform: scale(1.045); }
}
.craft__label { margin-top: var(--space-4); color: var(--muted); }
.craft__desc {
  margin-top: var(--space-2);
  max-width: 34ch;
  color: var(--muted);
  font-size: 0.95rem;
}
.craft__link {
  display: inline-block;
  margin-top: var(--space-3);
  font-size: 0.72rem;
  letter-spacing: 0.12em;
  padding-bottom: 3px;
  border-bottom: 1px solid var(--fg);
  transition: opacity 0.3s var(--ease-out);
}
.craft__link:hover, .craft__link:focus-visible { opacity: 0.55; }

/* ---------- Principles (horizontal) ---------- */
.principles { position: relative; }
.principles__pin {
  height: 100svh;
  display: flex; flex-direction: column; justify-content: center;
  overflow: clip;
  padding-block: var(--space-6);
}
.principles__index {
  color: var(--faint);
  padding-inline: var(--gutter);
  margin-bottom: var(--space-6);
}
.principles__track {
  display: flex; align-items: baseline;
  gap: clamp(40px, 6vw, 112px);
  padding-inline: var(--gutter);
  width: max-content;
}
.principle { display: flex; align-items: baseline; gap: var(--space-4); flex: none; }
.principle__no { color: var(--faint); font-size: 1rem; }
.principle__text {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: clamp(2.25rem, 6vw, 5.5rem);
  line-height: 1;
  letter-spacing: -0.02em;
  white-space: nowrap;
}

/* ---------- Colophon ---------- */
.colophon {
  padding: var(--section-pad) var(--gutter);
  max-width: 1440px; margin-inline: auto;
}
.colophon__index { color: var(--faint); margin-bottom: var(--space-7); }
.colophon__heading {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: var(--step-4);
  line-height: 1.02;
  letter-spacing: -0.02em;
}
.colophon__email {
  display: inline-block;
  margin-top: var(--space-7);
  font-family: var(--font-mono);
  font-size: var(--step-1);
  letter-spacing: 0.02em;
  padding: 12px 0;
  position: relative;
}
.colophon__email::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: 4px;
  height: 2px; background: currentColor;
  transform-origin: left;
  transition: transform 0.4s var(--ease-out);
}
@media (hover: hover) {
  .colophon__email:hover::after { transform: scaleX(0.2); }
}

/* ---------- Footer ---------- */
.site-footer {
  border-top: 1px solid var(--line);
  padding: var(--space-6) var(--gutter) var(--space-5);
  max-width: 1440px; margin-inline: auto;
}
.site-footer__row {
  display: flex; flex-wrap: wrap; align-items: baseline;
  justify-content: space-between; gap: var(--space-4);
}
.site-footer__mark {
  font-family: var(--font-display);
  font-weight: 600; font-size: 1.35rem; letter-spacing: -0.02em;
}
.site-footer__nav { display: flex; flex-wrap: wrap; gap: var(--space-4); }
.site-footer__nav a { padding: 10px 0; position: relative; }
.site-footer__nav a::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: 6px;
  height: 1px; background: currentColor;
  transform: scaleX(0); transform-origin: right;
  transition: transform 0.3s var(--ease-out);
}
.site-footer__nav a:hover::after,
.site-footer__nav a:focus-visible::after { transform: none; transform-origin: left; }
.site-footer__colophon {
  margin-top: var(--space-6);
  color: var(--faint);
  max-width: 68ch;
  text-transform: none;
  letter-spacing: 0.03em;
}

/* ---------- Split/reveal scaffolding (JS enhances) ---------- */
[data-reveal] { opacity: 1; }
.js [data-reveal] { opacity: 0; }
/* clip vertically to mask the line reveal, never horizontally — horizontal clip
   silently eats overflowing glyphs (cost us the "t" in "built to last") */
.js .split-line { display: block; overflow: visible clip; }

/* ---------- Reduced motion / static kill-switch (?static) ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
html.static body::after { animation: none; }
html.static [data-reveal] { opacity: 1 !important; }
html.static .preloader, html.static .cursor { display: none; }
html.static .principles__pin { height: auto; }
html.static .principles__track { width: auto; flex-wrap: wrap; }
html.static .principle__text { white-space: normal; }
html.static .inversion { min-height: auto; }

/* Safety net if JS never runs to add .static (keep in sync with html.static above) */
@media (prefers-reduced-motion: reduce) {
  body::after { animation: none; }
  .js [data-reveal] { opacity: 1; }
  .preloader { display: none; }
  .cursor { display: none; }
  .principles__pin { height: auto; }
  .principles__track { width: auto; flex-wrap: wrap; }
  .principle__text { white-space: normal; }
  .inversion { min-height: auto; }
}
