/* ════════════════════════════════════════════════════════════════
   MELVERN MOGENS — Portfolio
   main.css · design tokens, base, chrome, cursor, menu, primitives
   ════════════════════════════════════════════════════════════════ */

/* ── TOKENS ─────────────────────────────────────────────────── */
:root {
  /* Surface — glacier night, lifted off pure black so it reads as depth
     rather than a void */
  --ink-000: #080b13;
  --ink-050: #0b0f19;
  --ink-100: #10151f;
  --ink-200: #161d2a;
  --ink-300: #1f2736;
  --ink-400: #2a3346;

  /* Ink */
  --fog-100: #f4f8fe;
  --fog-200: #c8d3e4;
  --fog-300: #97a5ba;
  --fog-400: #71809a;

  /* Accent — ice */
  --ice-100: #eaf8ff;
  --ice-200: #b6e7ff;
  --ice-300: #82d2ff;
  --ice-400: #439fff;
  --ice-500: #2a72ea;

  --line-1: rgba(180, 214, 255, 0.13);
  --line-2: rgba(180, 214, 255, 0.23);
  --line-3: rgba(180, 214, 255, 0.40);

  --glow-ice: rgba(130, 210, 255, 0.34);
  --glow-deep: rgba(67, 159, 255, 0.26);

  --grad-ice: linear-gradient(115deg, var(--ice-100) 0%, var(--ice-300) 45%, var(--ice-400) 100%);
  --grad-text: linear-gradient(180deg, #ffffff 0%, #dcebfb 52%, #a5c2e2 100%);

  /* Type */
  --f-display: 'Space Grotesk', 'Inter Tight', system-ui, sans-serif;
  --f-body: 'Inter Tight', system-ui, -apple-system, sans-serif;
  --f-mono: 'JetBrains Mono', ui-monospace, 'SFMono-Regular', monospace;
  --f-serif: 'Instrument Serif', 'Times New Roman', serif;

  /* Rhythm */
  --gutter: clamp(1.25rem, 4vw, 4.5rem);
  --shell: 1440px;
  --sec-pad: clamp(6rem, 14vh, 12rem);
  --radius: 6px;
  --radius-lg: 18px;

  /* Motion */
  --e-out: cubic-bezier(0.16, 1, 0.3, 1);
  --e-io: cubic-bezier(0.65, 0, 0.35, 1);
  --e-soft: cubic-bezier(0.33, 1, 0.68, 1);

  --z-fx: 90;
  --z-chrome: 100;
  --z-menu: 200;
  --z-modal: 300;
  --z-cursor: 400;
  --z-loader: 500;
}

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

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scrollbar-width: none;
}
html::-webkit-scrollbar { display: none; }

body {
  min-height: 100vh;
  background: var(--ink-000);
  color: var(--fog-200);
  font-family: var(--f-body);
  font-size: clamp(0.95rem, 0.9rem + 0.2vw, 1.0625rem);
  font-weight: 350;
  line-height: 1.65;
  letter-spacing: -0.005em;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

body.is-loading,
body.is-locked { overflow: hidden; }

img, svg, canvas { display: block; max-width: 100%; }
img { height: auto; }
ul, ol { list-style: none; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
a { color: inherit; text-decoration: none; }

::selection { background: var(--ice-400); color: #fff; }

:focus-visible {
  outline: 1px solid var(--ice-300);
  outline-offset: 3px;
  border-radius: 2px;
}

.skip-link {
  position: fixed; top: 0; left: 0; z-index: 600;
  padding: 0.75rem 1.25rem;
  background: var(--ice-400); color: #fff;
  font: 500 0.75rem/1 var(--f-mono); letter-spacing: 0.08em; text-transform: uppercase;
  transform: translateY(-120%);
  transition: transform 0.3s var(--e-out);
}
.skip-link:focus-visible { transform: translateY(0); }

/* ── TYPE PRIMITIVES ────────────────────────────────────────── */
h1, h2, h3, h4 {
  font-family: var(--f-display);
  font-weight: 600;
  line-height: 1.02;
  letter-spacing: -0.035em;
  color: var(--fog-100);
}

strong, b { color: var(--fog-100); font-weight: 500; }

.accent-serif {
  font-family: var(--f-serif);
  font-style: italic;
  font-weight: 400;
  color: var(--ice-200);
  letter-spacing: 0.005em;
  font-size: 1.13em;
}

.shell {
  width: 100%;
  max-width: var(--shell);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.section {
  position: relative;
  padding-block: var(--sec-pad);
  isolation: isolate;
}

/* a soft cold light behind each section so the page has depth instead of void */
.section::after {
  content: '';
  position: absolute; inset: 0; z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(75% 45% at 12% 0%, rgba(67, 159, 255, 0.11), transparent 64%),
    radial-gradient(60% 40% at 92% 74%, rgba(130, 210, 255, 0.07), transparent 66%);
}

/* Section header ------------------------------------------------ */
.sec-index {
  display: inline-flex; align-items: center; gap: 0.85rem;
  font: 400 0.6875rem/1 var(--f-mono);
  letter-spacing: 0.22em; text-transform: uppercase;
  color: var(--fog-300);
  margin-bottom: clamp(1.5rem, 3vw, 2.5rem);
}
.sec-index i {
  font-style: normal;
  color: var(--ice-300);
  padding-right: 0.85rem;
  border-right: 1px solid var(--line-2);
}

.sec-title {
  font-size: clamp(2rem, 1.1rem + 3.6vw, 4.4rem);
  line-height: 1.08;
  max-width: 19ch;
  /* gradient-clipped text cannot be re-rastered cheaply; keeping it on its own
     layer means scrolling and revealing only move the layer */
  will-change: transform, opacity;
  background: var(--grad-text);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent; color: transparent;
}

.sec-head { margin-bottom: clamp(3rem, 7vw, 6rem); }

.sec-head--split {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(0, 0.8fr);
  gap: clamp(2rem, 5vw, 5rem);
  align-items: end;
}

.sec-note {
  color: var(--fog-300);
  font-size: 0.95rem;
  line-height: 1.7;
  max-width: 42ch;
  padding-bottom: 0.4rem;
  border-left: 1px solid var(--line-2);
  padding-left: 1.25rem;
}

@media (max-width: 900px) {
  .sec-head--split { grid-template-columns: 1fr; align-items: start; }
}

/* ── ATMOSPHERE ─────────────────────────────────────────────── */
.fx-grain,
.fx-vignette {
  position: fixed; inset: -20%;
  pointer-events: none;
  z-index: var(--z-fx);
}

.fx-grain {
  opacity: 0.055;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='200'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='200' height='200' filter='url(%23n)' opacity='0.55'/%3E%3C/svg%3E");
  animation: grainShift 0.7s steps(3) infinite;
}

@keyframes grainShift {
  0%   { transform: translate3d(0, 0, 0); }
  33%  { transform: translate3d(-3%, 2%, 0); }
  66%  { transform: translate3d(2%, -3%, 0); }
  100% { transform: translate3d(0, 0, 0); }
}

.fx-vignette {
  inset: 0;
  background:
    radial-gradient(140% 100% at 50% 0%, transparent 55%, rgba(0,0,0,0.26) 100%),
    radial-gradient(110% 80% at 50% 100%, transparent 62%, rgba(0,0,0,0.34) 100%);
}

/* ── CUSTOM CURSOR ──────────────────────────────────────────── */
.cursor {
  position: fixed; top: 0; left: 0;
  z-index: var(--z-cursor);
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.35s ease;
}
.cursor.is-ready { opacity: 1; }

.cursor__dot,
.cursor__ring {
  position: absolute; top: 0; left: 0;
  border-radius: 999px;
  will-change: transform;
}

.cursor__dot {
  width: 5px; height: 5px;
  margin: -2.5px 0 0 -2.5px;
  background: var(--ice-100);
  box-shadow: 0 0 12px var(--glow-ice);
}

.cursor__ring {
  width: 34px; height: 34px;
  margin: -17px 0 0 -17px;
  border: 1px solid var(--line-3);
  display: grid; place-items: center;
  transition: width 0.4s var(--e-out), height 0.4s var(--e-out),
              margin 0.4s var(--e-out), background 0.4s var(--e-out),
              border-color 0.4s var(--e-out);
}

.cursor__label {
  font: 500 0.5625rem/1 var(--f-mono);
  letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--ink-000);
  opacity: 0; transform: scale(0.7);
  transition: opacity 0.25s ease, transform 0.35s var(--e-out);
  white-space: nowrap;
}

.cursor.is-hover .cursor__ring {
  width: 74px; height: 74px; margin: -37px 0 0 -37px;
  background: var(--ice-200);
  border-color: transparent;
}
.cursor.is-hover .cursor__dot { opacity: 0; }
.cursor.is-hover .cursor__label { opacity: 1; transform: scale(1); }

.cursor.is-down .cursor__ring { transform: scale(0.85); }

@media (hover: none), (pointer: coarse) {
  .cursor { display: none; }
}

/* ── SCROLL PROGRESS ────────────────────────────────────────── */
.scroll-progress {
  position: fixed; top: 0; left: 0; right: 0;
  height: 2px; z-index: var(--z-chrome);
  background: var(--line-1);
}
.scroll-progress i {
  display: block; height: 100%; width: 100%;
  background: var(--grad-ice);
  box-shadow: 0 0 14px var(--glow-ice);
  transform-origin: left;
  transform: scaleX(0);
}

/* ── HEADER CHROME ──────────────────────────────────────────── */
.chrome {
  position: fixed; top: 0; left: 0; right: 0;
  z-index: var(--z-chrome);
  display: flex; align-items: center; justify-content: space-between;
  gap: 1rem;
  padding: clamp(1.1rem, 2.4vw, 2rem) var(--gutter);
  transition: transform 0.55s var(--e-out), opacity 0.4s ease;
}
.chrome.is-hidden { transform: translateY(-110%); opacity: 0; }

.brand {
  display: inline-flex; align-items: center; gap: 0.8rem;
}

.brand__mark {
  width: 30px; height: 34px;
  display: grid; place-items: center;
  color: var(--ice-200);
  transition: transform 0.7s var(--e-out);
}
.brand__mark svg {
  width: 100%; height: 100%;
  fill: none; stroke: currentColor; stroke-width: 1.1;
  stroke-linejoin: round;
}
.brand:hover .brand__mark { transform: rotate(180deg); }

.brand__text { display: flex; flex-direction: column; gap: 0.15rem; }
.brand__text b {
  font: 600 0.875rem/1 var(--f-display);
  letter-spacing: -0.015em; color: var(--fog-100);
}
.brand__text em {
  font: 400 0.625rem/1 var(--f-mono);
  font-style: normal;
  letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--fog-300);
}

@media (max-width: 560px) { .brand__text em { display: none; } }

/* Menu toggle --------------------------------------------------- */
.menu-toggle {
  position: relative; z-index: 1;
  display: inline-flex; align-items: center; gap: 0.75rem;
  padding: 0.6rem 0.9rem 0.6rem 1.1rem;
  border: 1px solid var(--line-2);
  border-radius: 999px;
  background: rgba(14, 19, 29, 0.82);
  transition: border-color 0.4s var(--e-out), background 0.4s var(--e-out);
}
.menu-toggle:hover { border-color: var(--line-3); background: rgba(28, 37, 54, 0.9); }

.menu-toggle__label {
  font: 500 0.6875rem/1 var(--f-mono);
  letter-spacing: 0.16em; text-transform: uppercase;
  color: var(--fog-100);
}

.menu-toggle__bars {
  position: relative;
  width: 18px; height: 10px;
}
.menu-toggle__bars i {
  position: absolute; left: 0;
  width: 100%; height: 1px;
  background: var(--fog-100);
  transition: transform 0.45s var(--e-out), width 0.45s var(--e-out);
}
.menu-toggle__bars i:nth-child(1) { top: 2px; }
.menu-toggle__bars i:nth-child(2) { top: 7px; width: 62%; }
.menu-toggle:hover .menu-toggle__bars i:nth-child(2) { width: 100%; }

body.menu-open .menu-toggle__bars i:nth-child(1) { transform: translateY(2.5px) rotate(45deg); }
body.menu-open .menu-toggle__bars i:nth-child(2) { transform: translateY(-2.5px) rotate(-45deg); width: 100%; }

/* ── HUD ────────────────────────────────────────────────────── */
.hud {
  position: fixed; bottom: clamp(1.1rem, 2.4vw, 2rem);
  z-index: var(--z-chrome);
  display: inline-flex; align-items: center; gap: 0.55rem;
  font: 400 0.625rem/1 var(--f-mono);
  letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--fog-300);
  transition: opacity 0.5s ease, transform 0.5s var(--e-out);
}
.hud--bl { left: var(--gutter); }
.hud--br { right: var(--gutter); }

.hud__sep { color: var(--fog-400); }
.hud__dot { width: 4px; height: 4px; border-radius: 50%; background: var(--fog-400); }

.hud__pulse {
  position: relative;
  width: 6px; height: 6px; border-radius: 50%;
  background: #58e39c;
}
.hud__pulse::after {
  content: ''; position: absolute; inset: -3px;
  border-radius: 50%; border: 1px solid #58e39c;
  animation: hudPulse 2.4s var(--e-out) infinite;
}
@keyframes hudPulse {
  0%   { transform: scale(0.6); opacity: 0.9; }
  100% { transform: scale(2.1); opacity: 0; }
}

body.menu-open .hud,
body.is-past-hero .hud,
body.is-loading .hud { opacity: 0; transform: translateY(8px); pointer-events: none; }

@media (max-width: 720px) {
  .hud--br { display: none; }
  .hud--bl { font-size: 0.5625rem; }
}

/* ── SECTION RAIL ───────────────────────────────────────────── */
.rail {
  position: fixed; right: clamp(1rem, 2vw, 2rem); top: 50%;
  transform: translateY(-50%);
  z-index: var(--z-chrome);
  display: flex; flex-direction: column; gap: 0.9rem;
  align-items: flex-end;
  opacity: 0;
  transition: opacity 0.6s ease;
}
.rail.is-ready { opacity: 1; }
body.menu-open .rail { opacity: 0; pointer-events: none; }

.rail a {
  position: relative;
  display: flex; align-items: center; justify-content: flex-end;
  height: 14px;
  color: var(--fog-400);
  transition: color 0.35s var(--e-out);
}
/* absolutely positioned: an invisible label must not push the dash around,
   or the dashes stop lining up with each other */
.rail a span {
  position: absolute; right: calc(100% + 0.7rem); top: 50%;
  font: 400 0.5625rem/1 var(--f-mono);
  letter-spacing: 0.16em; text-transform: uppercase;
  white-space: nowrap;
  opacity: 0; transform: translateY(-50%) translateX(6px);
  transition: opacity 0.35s var(--e-out), transform 0.35s var(--e-out);
}
.rail a i {
  flex: 0 0 auto;
  width: 22px; height: 1px;
  background: currentColor;
  transition: width 0.45s var(--e-out), background 0.35s var(--e-out);
}
.rail a:hover { color: var(--fog-200); }
.rail a:hover span { opacity: 1; transform: translateY(-50%) translateX(0); }
.rail a.is-active { color: var(--ice-200); }
.rail a.is-active i { width: 40px; box-shadow: 0 0 10px var(--glow-ice); }

/* the standing label only fits once there is clear space beside the shell */
@media (min-width: 1620px) {
  .rail a.is-active span { opacity: 1; transform: translateY(-50%) translateX(0); }
}

@media (max-width: 1100px) { .rail { display: none; } }

/* ── MENU OVERLAY ───────────────────────────────────────────── */
.menu {
  position: fixed; inset: 0;
  z-index: var(--z-menu);
  display: grid; place-items: center;
  overflow: hidden;
}
.menu[hidden] { display: none; }

.menu__bg {
  position: absolute; inset: 0;
  background:
    radial-gradient(90% 70% at 80% 10%, rgba(43, 140, 255, 0.14), transparent 60%),
    radial-gradient(70% 60% at 10% 90%, rgba(110, 201, 255, 0.10), transparent 60%),
    var(--ink-050);
  clip-path: inset(0 0 100% 0);
  transition: clip-path 0.9s var(--e-out);
}
body.menu-open .menu__bg { clip-path: inset(0 0 0 0); }

.menu__grid {
  position: absolute; inset: 0;
  display: grid; grid-template-columns: repeat(5, 1fr);
  pointer-events: none;
}
.menu__grid i { border-right: 1px solid var(--line-1); }
.menu__grid i:last-child { border-right: 0; }

.menu__body {
  position: relative;
  width: 100%; max-width: var(--shell);
  padding: clamp(4.5rem, 11vh, 7.5rem) var(--gutter) clamp(1.5rem, 4vh, 3rem);
  display: flex; flex-direction: column;
  gap: clamp(1.25rem, 3.5vh, 3rem);
  height: 100%;
  max-height: 100%;
  overflow-y: auto;
  scrollbar-width: none;
  justify-content: space-between;
}

.menu__eyebrow {
  font: 400 0.625rem/1 var(--f-mono);
  letter-spacing: 0.22em; text-transform: uppercase;
  color: var(--fog-400);
  overflow: hidden;
}
.menu__eyebrow span {
  display: inline-block;
  transform: translateY(110%);
  transition: transform 0.7s var(--e-out) 0.3s;
}
body.menu-open .menu__eyebrow span { transform: translateY(0); }

.menu__nav { display: flex; flex-direction: column; }

.menu__nav a {
  position: relative;
  display: flex; align-items: baseline; gap: clamp(1rem, 3vw, 2.5rem);
  padding: clamp(0.2rem, 0.75vh, 0.55rem) 0;
  border-bottom: 1px solid var(--line-1);
  overflow: hidden;
}
.menu__nav a em {
  font: 400 0.6875rem/1 var(--f-mono);
  font-style: normal;
  color: var(--fog-400);
  letter-spacing: 0.1em;
  transition: color 0.4s var(--e-out);
  flex: 0 0 auto;
}
.menu__nav a span {
  position: relative;
  display: block;
  font-family: var(--f-display);
  font-size: clamp(1.5rem, min(4.2vw, 6.4vh), 3.75rem);
  font-weight: 500;
  line-height: 1.1;
  letter-spacing: -0.04em;
  color: var(--fog-100);
  transform: translateY(105%);
  opacity: 0;
  transition: transform 0.85s var(--e-out), opacity 0.6s ease, color 0.4s ease;
  transition-delay: calc(0.28s + var(--i, 0) * 0.055s);
}
body.menu-open .menu__nav a span { transform: translateY(0); opacity: 1; }

.menu__nav a span::after {
  content: attr(data-text);
  position: absolute; left: 0; top: 0;
  color: var(--ice-200);
  clip-path: inset(0 100% 0 0);
  transition: clip-path 0.6s var(--e-out);
}
.menu__nav a:hover span::after { clip-path: inset(0 0 0 0); }
.menu__nav a:hover em { color: var(--ice-300); }

.menu__foot {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: clamp(1.25rem, 4vw, 3rem);
  padding-top: clamp(1.25rem, 3vh, 2rem);
  border-top: 1px solid var(--line-1);
  opacity: 0; transform: translateY(18px);
  transition: opacity 0.7s ease 0.6s, transform 0.7s var(--e-out) 0.6s;
}
body.menu-open .menu__foot { opacity: 1; transform: translateY(0); }

.menu__label {
  font: 400 0.5625rem/1 var(--f-mono);
  letter-spacing: 0.2em; text-transform: uppercase;
  color: var(--fog-400);
  margin-bottom: 0.9rem;
}
.menu__links li { margin-bottom: 0.4rem; }
.menu__links a {
  display: inline-flex; align-items: center; gap: 0.4rem;
  font-size: 0.9rem; color: var(--fog-200);
  transition: color 0.3s ease, gap 0.3s var(--e-out);
}
.menu__links a span { color: var(--fog-400); font-size: 0.75rem; }
.menu__links a:hover { color: var(--ice-200); gap: 0.7rem; }
.menu__links a:hover span { color: var(--ice-300); }

.menu__time {
  font: 300 clamp(1.5rem, 3vw, 2.4rem)/1 var(--f-mono);
  color: var(--fog-100);
  letter-spacing: -0.02em;
}
.menu__col--time { text-align: right; }

@media (max-width: 760px) {
  .menu__foot { grid-template-columns: 1fr 1fr; }
  .menu__col--time { display: none; }
}

/* ── BUTTONS ────────────────────────────────────────────────── */
.btn {
  position: relative;
  display: inline-flex; align-items: center; gap: 0.7rem;
  padding: 0.95rem 1.6rem;
  border-radius: 999px;
  font: 500 0.75rem/1 var(--f-mono);
  letter-spacing: 0.12em; text-transform: uppercase;
  overflow: hidden;
  isolation: isolate;
  transition: color 0.4s var(--e-out), border-color 0.4s var(--e-out);
  will-change: transform;
}
.btn span { position: relative; z-index: 2; }
.btn svg {
  position: relative; z-index: 2;
  width: 13px; height: 13px;
  fill: none; stroke: currentColor; stroke-width: 1.4;
  stroke-linecap: round; stroke-linejoin: round;
  transition: transform 0.45s var(--e-out);
}
.btn:hover svg { transform: translate(2px, -2px); }

.btn::before {
  content: ''; position: absolute; inset: 0; z-index: 1;
  border-radius: inherit;
  transform: translateY(101%);
  transition: transform 0.55s var(--e-out);
}
.btn:hover::before { transform: translateY(0); }

.btn--primary {
  background: var(--grad-ice);
  color: #04101f;
  box-shadow: 0 8px 34px -12px var(--glow-deep);
}
.btn--primary::before { background: var(--fog-100); }
.btn--primary:hover { color: var(--ink-000); }

.btn--ghost {
  border: 1px solid var(--line-2);
  color: var(--fog-100);
}
.btn--ghost::before { background: var(--fog-100); }
.btn--ghost:hover { color: var(--ink-000); border-color: var(--fog-100); }

/* ── TAGS & CHIPS ───────────────────────────────────────────── */
.tag {
  display: inline-flex; align-items: center; gap: 0.45rem;
  padding: 0.4rem 0.75rem;
  border: 1px solid var(--line-2);
  border-radius: 999px;
  font: 400 0.5938rem/1 var(--f-mono);
  letter-spacing: 0.16em; text-transform: uppercase;
  color: var(--fog-200);
  background: rgba(255,255,255,0.02);
}
.tag--live {
  color: var(--ice-100);
  border-color: rgba(110, 201, 255, 0.32);
  background: rgba(43, 140, 255, 0.10);
}
.tag--live::before {
  content: ''; width: 5px; height: 5px; border-radius: 50%;
  background: var(--ice-200); box-shadow: 0 0 8px var(--ice-300);
}

.chip {
  padding: 0.55rem 1.05rem;
  border: 1px solid var(--line-1);
  border-radius: 999px;
  font: 400 0.6875rem/1 var(--f-mono);
  letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--fog-300);
  transition: color 0.35s var(--e-out), border-color 0.35s var(--e-out), background 0.35s var(--e-out);
}
.chip:hover { color: var(--fog-100); border-color: var(--line-3); }
.chip.is-active {
  color: var(--ink-000);
  background: var(--fog-100);
  border-color: var(--fog-100);
}

/* ── MODAL ──────────────────────────────────────────────────── */
.modal {
  position: fixed; inset: 0;
  z-index: var(--z-modal);
  display: grid; place-items: center;
  padding: var(--gutter);
}
.modal[hidden] { display: none; }

.modal__scrim {
  position: absolute; inset: 0;
  background: rgba(3, 5, 10, 0.72);
  backdrop-filter: blur(16px) saturate(0.8);
  opacity: 0;
  transition: opacity 0.5s ease;
}
.modal.is-open .modal__scrim { opacity: 1; }

.modal__panel {
  position: relative;
  width: min(980px, 100%);
  max-height: min(86vh, 760px);
  overflow: auto;
  display: grid;
  grid-template-columns: 0.85fr 1.15fr;
  background: linear-gradient(160deg, var(--ink-200), var(--ink-100));
  border: 1px solid var(--line-2);
  border-radius: var(--radius-lg);
  box-shadow: 0 40px 120px -40px rgba(0,0,0,0.9), 0 0 0 1px rgba(255,255,255,0.02) inset;
  opacity: 0; transform: translateY(28px) scale(0.97);
  transition: opacity 0.5s ease, transform 0.7s var(--e-out);
  scrollbar-width: none;
}
.modal__panel::-webkit-scrollbar { display: none; }
.modal.is-open .modal__panel { opacity: 1; transform: translateY(0) scale(1); }

.modal__media { position: relative; overflow: hidden; min-height: 260px; }
.modal__media img { width: 100%; height: 100%; object-fit: cover; }
.modal__media::after {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(100deg, transparent 40%, rgba(9,11,18,0.85) 100%);
}

.modal__body { padding: clamp(1.75rem, 4vw, 3rem); }
.modal__body h2 {
  font-size: clamp(1.3rem, 1rem + 1.2vw, 1.95rem);
  margin: 1.1rem 0 1.4rem;
  line-height: 1.14;
}
.modal__body p { color: var(--fog-300); font-size: 0.95rem; margin-bottom: 1.75rem; }

.modal__facts {
  display: grid; gap: 0.7rem;
  padding: 1.1rem 0;
  border-block: 1px solid var(--line-1);
  margin-bottom: 1.5rem;
}
.modal__facts > div { display: flex; justify-content: space-between; gap: 1rem; }
.modal__facts dt {
  font: 400 0.625rem/1.4 var(--f-mono);
  letter-spacing: 0.14em; text-transform: uppercase; color: var(--fog-400);
}
.modal__facts dd { font-size: 0.875rem; color: var(--fog-100); text-align: right; }

.modal__close {
  position: absolute; top: 1rem; right: 1rem; z-index: 3;
  width: 42px; height: 42px;
  display: grid; place-items: center;
  border: 1px solid var(--line-2); border-radius: 50%;
  background: rgba(8, 11, 18, 0.7);
  backdrop-filter: blur(8px);
  color: var(--fog-100);
  transition: transform 0.5s var(--e-out), background 0.35s ease, border-color 0.35s ease;
}
.modal__close svg { width: 14px; height: 14px; stroke: currentColor; stroke-width: 1.4; stroke-linecap: round; }
.modal__close:hover { transform: rotate(90deg); background: var(--ice-400); border-color: transparent; }

@media (max-width: 780px) {
  .modal__panel { grid-template-columns: 1fr; }
  .modal__media { min-height: 200px; max-height: 34vh; }
}

/* ── REVEAL ENGINE ──────────────────────────────────────────── */
/* Everything below only hides content once JS has confirmed it is alive —
   without `.js-reveal` the page renders fully visible. */
.js-reveal [data-reveal="fade"] {
  opacity: 0;
  transform: translateY(22px);
  transition: opacity 0.45s ease-out, transform 0.7s var(--e-soft);
  transition-delay: var(--rd, 0ms);
}
.js-reveal [data-reveal="fade"].is-in { opacity: 1; transform: none; }

/* Body copy rises and fades — no mask, so a descender can never be clipped
   and the words stay legible for the whole transition. */
.word-wrap { display: inline-block; vertical-align: top; }
.js-reveal .word-wrap > span {
  display: inline-block;
  transform: translateY(0.36em);
  opacity: 0;
  transition: transform 0.8s var(--e-out), opacity 0.55s ease;
  transition-delay: calc(var(--wi, 0) * 26ms + var(--rd, 0ms));
}
[data-reveal].is-in .word-wrap > span { transform: none; opacity: 1; }

/* Display type keeps the mask, but the clip box is padded past the glyph box
   and the padding is cancelled by an equal negative margin, so layout is
   untouched while nothing gets sliced. */
.char-wrap {
  display: inline-block; overflow: hidden; vertical-align: top;
  padding: 0.16em 0.04em 0.22em;
  margin: -0.16em -0.04em -0.22em;
}
.js-reveal .char-wrap > span {
  display: inline-block;
  transform: translateY(102%);
  opacity: 0;
  transition: transform 0.8s var(--e-out), opacity 0.4s ease;
  transition-delay: calc(var(--ci, 0) * 22ms + var(--rd, 0ms));
}
[data-reveal].is-in .char-wrap > span,
.is-in > .char-wrap > span { transform: none; opacity: 1; }

/* ── REDUCED MOTION ─────────────────────────────────────────── */
@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;
  }
  [data-reveal], .word-wrap > span, .char-wrap > span {
    opacity: 1 !important; transform: none !important; clip-path: none !important;
  }
  .fx-grain { animation: none; }
}

/* ── LATE OVERRIDES ─────────────────────────────────────────── */

/* keep the toggle clickable above the open overlay */
body.menu-open .chrome { z-index: 250; }
body.menu-open .chrome .brand { opacity: 0; pointer-events: none; transition: opacity 0.3s ease; }

/* cursor label only widens the ring when there is something to say */
.cursor.is-hover:not(.has-label) .cursor__ring {
  width: 46px; height: 46px; margin: -23px 0 0 -23px;
  background: transparent;
  border-color: var(--ice-300);
}
.cursor.is-hover:not(.has-label) .cursor__dot { opacity: 1; }

.menu__body::-webkit-scrollbar { display: none; }
