/* ============================================================
   Oliver Harman — Portfolio "OPERATOR"
   Dark-default, mono-led, International Orange spark
   ============================================================ */

/* --- Tokens (dark default) --- */
:root, html[data-mode="dark"] {
  --page: #0A0A09;
  --surface: #141413;
  --surface-2: #1A1A18;
  --ink: #F0EDE6;
  --ink-soft: #B5B0A6;
  --ink-mute: #6C6862;
  --rule: rgba(240, 237, 230, 0.08);
  --rule-med: rgba(240, 237, 230, 0.18);
  --rule-strong: rgba(240, 237, 230, 0.36);
  --accent: #2563EB;
  --accent-soft: rgba(37, 99, 235, 0.14);
  --accent-ink: #FFFFFF;
  --selection: rgba(255, 77, 0, 0.28);
  --signal: #FF4D00;

  --font-display: "Geist", -apple-system, BlinkMacSystemFont, "Helvetica Neue", sans-serif;
  --font-body: "Sora", -apple-system, BlinkMacSystemFont, "Helvetica Neue", sans-serif;
  --font-mono: "Sora", -apple-system, BlinkMacSystemFont, "Helvetica Neue", sans-serif;

  --display-weight: 600;
  --display-tracking: -0.025em;
  --display-stretch: 100; /* fixed-width fonts; reserved for variable-width swaps */
  --body-tracking: -0.005em;

  /* density */
  --d: 1;
  --pad-page-x: clamp(20px, 4vw, 56px);
  --section-y: calc(120px * var(--d));
  --block-y: calc(48px * var(--d));
  --gutter: calc(32px * var(--d));
  --measure: 68ch;

  --t-fast: 160ms cubic-bezier(0.2, 0.7, 0.2, 1);
  --t-med: 320ms cubic-bezier(0.2, 0.7, 0.2, 1);
  --t-slow: 720ms cubic-bezier(0.2, 0.7, 0.2, 1);
}

/* --- Light mode (Print) --- */
html[data-mode="light"] {
  --page: #F4F0E8;
  --surface: #EBE6DB;
  --surface-2: #E2DCCD;
  --ink: #0E0D0B;
  --ink-soft: #45413A;
  --ink-mute: #756F62;
  --rule: rgba(14, 13, 11, 0.10);
  --rule-med: rgba(14, 13, 11, 0.22);
  --rule-strong: rgba(14, 13, 11, 0.42);
  --accent: #2563EB;
  --accent-soft: rgba(37, 99, 235, 0.10);
  --accent-ink: #FFFFFF;
  --selection: rgba(221, 63, 0, 0.22);
}

/* Density */
html[data-density="compact"] { --d: 0.74; }
html[data-density="roomy"]   { --d: 1.30; }

/* --- Reset --- */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html {
  background: var(--page);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  font-feature-settings: "ss01", "ss03";
  transition: background var(--t-med), color var(--t-med);
}
body {
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.55;
  letter-spacing: var(--body-tracking);
  background: var(--page);
  color: var(--ink);
  min-height: 100vh;
  overflow-x: hidden;
}
::selection { background: var(--selection); color: var(--ink); }
img, svg { display: block; max-width: 100%; }
button { font: inherit; color: inherit; }
a { color: inherit; text-decoration: none; }

/* --- Type --- */
.display, h1.display, h2.display {
  font-family: var(--font-display);
  font-weight: var(--display-weight);
  font-stretch: 75%;
  letter-spacing: var(--display-tracking);
  line-height: 0.92;
  margin: 0;
}
.display.ultra { font-stretch: 60%; font-weight: 800; letter-spacing: -0.05em; }
.eyebrow {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.10em;
  text-transform: uppercase;
  color: var(--ink-mute);
  margin: 0;
}
.label {
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.04em;
  color: var(--ink-mute);
}
.mono { font-family: var(--font-mono); }
.accent { color: var(--accent); }
.lede {
  font-size: clamp(20px, 1.6vw, 26px);
  line-height: 1.4;
  color: var(--ink-soft);
  max-width: 36ch;
  letter-spacing: -0.01em;
}
p { max-width: var(--measure); }

/* --- Layout --- */
.page {
  padding: 0 var(--pad-page-x);
  min-height: 100vh;
}
.container {
  max-width: 1440px;
  margin: 0 auto;
}
.divider { height: 1px; background: var(--rule); width: 100%; }

/* --- Status strip (above nav) --- */
.status-strip {
  position: sticky; top: 0; z-index: 60;
  display: flex; align-items: center; gap: 32px;
  padding: 10px 0;
  border-bottom: 1px solid var(--rule);
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-mute);
  background: var(--page);
  overflow: hidden;
}
.status-strip .item { display: inline-flex; align-items: center; gap: 8px; white-space: nowrap; flex-shrink: 0; }
.status-strip .item .k { color: var(--ink-mute); }
.status-strip .item .v { color: var(--ink); }
.status-strip .item .sep { color: var(--rule-strong); margin: 0 4px; }
.status-strip .spacer { flex: 1; }
.status-strip .item .signal-tag { color: var(--accent); }
@media (max-width: 1100px) {
  .status-strip { gap: 18px; }
  .status-strip .item.hide-mobile { display: none; }
}
@media (max-width: 720px) {
  .status-strip { gap: 12px; font-size: 10px; }
  .status-strip .item.hide-tablet { display: none; }
}

/* --- Nav (sticky, no dot, no pill) --- */
.nav {
  position: sticky; top: 33px; z-index: 50;
  display: grid; grid-template-columns: 1fr auto 1fr;
  align-items: center;
  padding: 18px 0;
  background: color-mix(in oklab, var(--page) 92%, transparent);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--rule);
  margin: 0 calc(-1 * var(--pad-page-x));
  padding-left: var(--pad-page-x);
  padding-right: var(--pad-page-x);
}
.nav-mark {
  font-family: var(--font-mono);
  font-size: 13px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ink);
  white-space: nowrap;
  display: inline-flex; align-items: center; gap: 12px;
  font-weight: 500;
}
.nav-mark .slash { color: var(--accent); font-weight: 600; }
.nav-mark .role { color: var(--ink-mute); font-weight: 400; }
.nav-links {
  display: flex; gap: 4px;
  justify-content: center;
  align-items: center;
  border: 1px solid var(--rule-med);
  border-radius: 999px;
  padding: 4px;
}
.nav-links a {
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-soft);
  padding: 7px 14px;
  border-radius: 999px;
  transition: all var(--t-fast);
}
.nav-links a:hover { color: var(--ink); background: var(--surface); }
.nav-links a.current { color: var(--accent-ink); background: var(--ink); }
.nav-links a.nav-link-cta {
  background: var(--ink);
  color: var(--accent-ink);
}
.nav-links a.nav-link-cta:hover {
  background: var(--accent);
  color: var(--accent-ink);
}
.nav-cta {
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 10px 16px;
  border: 1px solid var(--ink);
  background: var(--ink);
  color: var(--accent-ink);
  border-radius: 999px;
  transition: all var(--t-fast);
  display: inline-flex; align-items: center; gap: 8px;
  justify-self: end;
}
.nav-cta:hover { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.nav-cta .arrow { transition: transform var(--t-fast); }
.nav-cta:hover .arrow { transform: translateX(3px); }

@media (max-width: 1024px) { .nav-links { display: none; } }
@media (max-width: 600px) {
  .nav { grid-template-columns: 1fr auto; }
  .nav-mark .role { display: none; }
  .nav-cta { padding: 8px 12px; font-size: 11px; }
}

/* --- Section scaffolding --- */
.section {
  padding: var(--section-y) 0;
  border-top: 1px solid var(--rule);
  position: relative;
}
.section:first-of-type { border-top: 0; }
.section-head {
  display: grid; grid-template-columns: 200px 1fr;
  gap: 64px;
  margin-bottom: var(--block-y);
  align-items: baseline;
}
.section-head .meta {
  display: flex; flex-direction: column; gap: 6px;
  position: sticky; top: 110px;
  align-self: start;
}
.section-head .meta .num {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.12em;
  color: var(--accent);
}
.section-head .meta .label {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-mute);
}
.section-head h2.display {
  font-size: clamp(40px, 6vw, 80px);
  letter-spacing: -0.045em;
}
@media (max-width: 800px) {
  .section-head { grid-template-columns: 1fr; gap: 16px; }
  .section-head .meta { position: static; flex-direction: row; align-items: center; gap: 12px; }
}

/* --- Buttons --- */
.btn {
  display: inline-flex; align-items: center; gap: 10px;
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 14px 22px;
  border: 1px solid var(--rule-strong);
  border-radius: 0;
  background: transparent;
  color: var(--ink);
  cursor: pointer;
  transition: all var(--t-fast);
  white-space: nowrap;
}
.btn:hover { background: var(--ink); color: var(--page); border-color: var(--ink); }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.btn.primary:hover { filter: brightness(1.1); }
.btn .arrow { transition: transform var(--t-fast); }
.btn:hover .arrow { transform: translateX(4px); }

/* --- Reveal --- */
.reveal { transform: translateY(20px); transition: transform 0.7s cubic-bezier(0.2, 0.7, 0.2, 1); }
.reveal.in { transform: none; }
@media (prefers-reduced-motion: reduce) { .reveal { transform: none; } }

/* --- HERO --- */
.hero {
  padding: calc(48px * var(--d)) 0 calc(80px * var(--d));
  position: relative;
}
.hero-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 48px;
}
.hero h1.display {
  font-size: clamp(64px, 14vw, 240px);
  line-height: 0.84;
  font-stretch: 60%;
  font-weight: 700;
  letter-spacing: -0.06em;
  margin: 0;
}
.hero h1 .word {
  display: inline-block;
}
.hero h1 .accent-word {
  color: var(--accent);
}
.hero h1 .underline {
  border-bottom: 4px solid var(--accent);
  padding-bottom: 0.05em;
}
.hero-tagline {
  font-size: clamp(20px, 2vw, 30px);
  line-height: 1.3;
  color: var(--ink-soft);
  max-width: 30ch;
  letter-spacing: -0.01em;
  margin: 0;
  font-weight: 400;
}
.hero-tagline strong { color: var(--ink); font-weight: 500; }
.hero-tagline .typewriter { color: var(--accent); }
.hero-tagline .typewriter::after {
  content: "▌";
  display: inline-block;
  color: var(--accent);
  animation: blink 1.1s steps(2) infinite;
  margin-left: 0;
}
@keyframes blink { 50% { opacity: 0; } }

.hero-bottom {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 48px;
  align-items: end;
  margin-top: 56px;
}
@media (max-width: 900px) {
  .hero-bottom { grid-template-columns: 1fr; gap: 32px; }
}

.hero-meta {
  display: flex; flex-direction: column;
  border-top: 1px solid var(--rule-med);
}
.hero-meta .row {
  display: grid; grid-template-columns: 140px 1fr;
  gap: 16px;
  padding: 12px 0;
  border-bottom: 1px solid var(--rule);
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.04em;
}
.hero-meta .row .k { color: var(--ink-mute); text-transform: uppercase; }
.hero-meta .row .v { color: var(--ink); }
.hero-meta .row .v .signal-tag {
  color: var(--accent);
  font-weight: 500;
}

.hero-actions {
  display: flex; gap: 12px; flex-wrap: wrap;
  margin-top: 32px;
}

/* --- Marquee / message wall --- */
.marquee-section {
  padding: calc(64px * var(--d)) 0;
  border-top: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
  background: var(--surface);
  margin: 0 calc(-1 * var(--pad-page-x));
  padding-left: 0; padding-right: 0;
  overflow: hidden;
  position: relative;
}
.marquee-section .marquee-label {
  position: absolute;
  top: 12px; left: var(--pad-page-x);
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-mute);
  z-index: 2;
}
.marquee-section .marquee-label .count {
  color: var(--accent);
}
.marquee {
  display: flex; gap: 20px;
  width: max-content;
  animation: marquee-scroll 90s linear infinite;
  padding: 32px 0;
}
.marquee:hover { animation-play-state: paused; }
@keyframes marquee-scroll {
  from { transform: translateX(0); }
  to { transform: translateX(-50%); }
}
.msg-bubble {
  flex-shrink: 0;
  max-width: 320px;
  min-width: 220px;
  padding: 16px 20px;
  border-radius: 22px;
  background: var(--surface-2);
  color: var(--ink);
  border: 1px solid var(--rule);
  font-size: 14px;
  line-height: 1.45;
  position: relative;
  display: flex; flex-direction: column; gap: 6px;
}
.msg-bubble .msg-text {
  font-family: var(--font-body);
}
.msg-bubble .msg-meta {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-mute);
}
.msg-bubble.right {
  background: #2563EB;
  color: #fff;
  border-color: #2563EB;
  align-self: flex-end;
}
.msg-bubble.right .msg-meta { color: rgba(255,255,255,0.65); }
.marquee-row { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.marquee-row .msg-bubble.left { align-self: flex-start; }
.marquee-row .msg-bubble.right { align-self: flex-end; }

/* --- Currently widget --- */
.currently {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 48px;
  padding: calc(64px * var(--d)) 0;
  border-top: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
}
@media (max-width: 800px) {
  .currently { grid-template-columns: 1fr; gap: 16px; }
}
.currently .head {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-mute);
  display: flex; flex-direction: column; gap: 6px;
}
.currently .head .num { color: var(--accent); }
.currently-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 32px;
}
@media (max-width: 900px) { .currently-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 480px) { .currently-grid { grid-template-columns: 1fr; } }
.currently-item .k {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.10em;
  text-transform: uppercase;
  color: var(--ink-mute);
  margin-bottom: 8px;
}
.currently-item .v {
  font-size: 18px;
  line-height: 1.35;
  letter-spacing: -0.01em;
  color: var(--ink);
}
.currently-item .v .accent { color: var(--accent); }

/* --- About --- */
.about-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 64px;
}
@media (max-width: 800px) { .about-grid { grid-template-columns: 1fr; gap: 32px; } }
.about-grid p {
  font-size: clamp(20px, 1.6vw, 26px);
  line-height: 1.45;
  letter-spacing: -0.01em;
  margin: 0 0 18px;
  max-width: 36ch;
  color: var(--ink);
  font-weight: 400;
}
.about-grid p:last-child { margin-bottom: 0; }
.about-grid strong { color: var(--accent); font-weight: 500; }

/* --- Projects preview (home) --- */
.projects-preview { border-top: 1px solid var(--rule-med); }
.projects-preview .pitem {
  display: grid;
  grid-template-columns: 60px 1fr 200px 32px;
  gap: 32px;
  align-items: center;
  padding: 28px 0;
  border-bottom: 1px solid var(--rule);
  cursor: pointer;
  position: relative;
  transition: padding var(--t-med), background var(--t-fast);
}
.projects-preview .pitem:hover { padding-left: 20px; padding-right: 20px; background: var(--surface); }
.projects-preview .pitem .num {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--ink-mute);
  letter-spacing: 0.06em;
}
.projects-preview .pitem .title {
  font-family: var(--font-display);
  font-stretch: 75%;
  font-weight: 600;
  font-size: clamp(28px, 3.6vw, 56px);
  line-height: 0.95;
  letter-spacing: -0.035em;
  margin: 0;
}
.projects-preview .pitem .meta {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--ink-mute);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.projects-preview .pitem .arrow {
  font-family: var(--font-mono);
  color: var(--ink-mute);
  font-size: 20px;
  transition: all var(--t-fast);
}
.projects-preview .pitem:hover .arrow { color: var(--accent); transform: translateX(6px); }
.projects-preview .pitem:hover .title { color: var(--accent); }
@media (max-width: 800px) {
  .projects-preview .pitem { grid-template-columns: 40px 1fr 24px; gap: 16px; }
  .projects-preview .pitem .meta { display: none; }
}

/* --- Experience as schedule/manifest --- */
.exp-list {
  display: flex; flex-direction: column;
}
.exp-item {
  display: grid;
  grid-template-columns: 180px 1fr;
  gap: 48px;
  padding: 36px 0;
  border-top: 1px solid var(--rule);
}
.exp-item:first-child { border-top: 0; padding-top: 0; }
.exp-item .when {
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.06em;
  color: var(--ink-mute);
  padding-top: 8px;
}
.exp-item .when .duration {
  display: block;
  margin-top: 4px;
  color: var(--accent);
}
.exp-item .role {
  font-family: var(--font-display);
  font-stretch: 75%;
  font-weight: 600;
  font-size: clamp(22px, 2.4vw, 36px);
  letter-spacing: -0.025em;
  line-height: 1.1;
  margin: 0 0 4px;
  color: var(--ink);
}
.exp-item .company {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--accent);
  margin-bottom: 18px;
  letter-spacing: 0.04em;
  display: inline-flex; align-items: center; gap: 8px;
}
.exp-item .company::before { content: "▸"; color: var(--ink-mute); font-size: 10px; }
.exp-item ul {
  list-style: none; padding: 0; margin: 0;
  display: flex; flex-direction: column; gap: 10px;
}
.exp-item ul li {
  padding-left: 24px;
  position: relative;
  color: var(--ink-soft);
  max-width: 72ch;
  line-height: 1.5;
}
.exp-item ul li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 12px;
  width: 12px;
  height: 1px;
  background: var(--ink-mute);
}
.exp-item ul li sup {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--accent);
  margin-left: 2px;
  letter-spacing: 0;
}
@media (max-width: 800px) {
  .exp-item { grid-template-columns: 1fr; gap: 12px; }
}

/* --- Footnotes --- */
.footnotes {
  margin-top: 32px;
  padding: 24px;
  border: 1px solid var(--rule);
  background: var(--surface);
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--ink-mute);
  letter-spacing: 0.02em;
  line-height: 1.7;
}
.footnotes .fn { margin-bottom: 6px; }
.footnotes .fn sup { color: var(--accent); margin-right: 6px; }

/* --- Skills matrix --- */
.skills-matrix {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0;
  border: 1px solid var(--rule-med);
}
@media (max-width: 700px) { .skills-matrix { grid-template-columns: 1fr; } }
.skill-cell {
  padding: 28px;
  border-right: 1px solid var(--rule-med);
  border-bottom: 1px solid var(--rule-med);
}
.skill-cell:nth-child(2n) { border-right: 0; }
.skill-cell.full { grid-column: 1 / -1; border-right: 0; }
.skill-cell:last-child { border-bottom: 0; }
.skill-cell .head {
  display: flex; align-items: baseline; justify-content: space-between;
  margin-bottom: 16px;
}
.skill-cell .head h3 {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink);
  margin: 0;
  font-weight: 500;
}
.skill-cell .head .num {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--accent);
}
.skill-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.skill-tag {
  font-family: var(--font-mono);
  font-size: 12px;
  padding: 5px 10px;
  border: 1px solid var(--rule-med);
  border-radius: 0;
  color: var(--ink-soft);
  letter-spacing: 0.02em;
  transition: all var(--t-fast);
}
.skill-tag:hover { color: var(--accent-ink); background: var(--ink); border-color: var(--ink); }

/* --- Certs --- */
.certs-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0;
  border: 1px solid var(--rule-med);
}
@media (max-width: 800px) { .certs-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 500px) { .certs-grid { grid-template-columns: 1fr; } }
.cert {
  padding: 24px;
  border-right: 1px solid var(--rule-med);
  border-bottom: 1px solid var(--rule-med);
  display: flex; flex-direction: column; gap: 8px;
}
.cert:nth-child(3n) { border-right: 0; }
.cert:nth-last-child(-n+3) { border-bottom: 0; }
@media (max-width: 800px) {
  .cert:nth-child(3n) { border-right: 1px solid var(--rule-med); }
  .cert:nth-child(2n) { border-right: 0; }
}
.cert .num {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--accent);
  letter-spacing: 0.12em;
}
.cert .name {
  font-size: 16px;
  line-height: 1.3;
  color: var(--ink);
  letter-spacing: -0.01em;
}
.cert .org {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--ink-mute);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  margin-top: auto;
}

/* --- Cert hover FX: cursor-tracked spotlight + technical grid ---
   Replaces the old blue water wave on certs (the .pitem rows + project-card
   thumbnails keep the wave; certs are dropped from initWaterFX). --mx/--my are
   set per-card on pointermove by initCertFX() in site.js; they default to 50%,
   so the glow sits centred when JS is off. The cards rely on the shared
   positioning context (.cert { position:relative; isolation:isolate;
   overflow:hidden } + content at z-index:1) defined in the water-FX section. */
.cert {
  cursor: default; /* keep the arrow over the labels — certs aren't links, so no text I-beam */
  transition: transform var(--t-med), box-shadow var(--t-med);
}
.cert::before,
.cert::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: 0;
  transition: opacity var(--t-med);
}
/* accent glow centred on the cursor */
.cert::before {
  background: radial-gradient(220px circle at var(--mx, 50%) var(--my, 50%),
    color-mix(in oklab, var(--accent) 26%, transparent), transparent 70%);
}
/* faint technical grid, masked to a halo that follows the cursor */
.cert::after {
  background-image:
    linear-gradient(to right,  color-mix(in oklab, var(--accent) 38%, transparent) 1px, transparent 1px),
    linear-gradient(to bottom, color-mix(in oklab, var(--accent) 38%, transparent) 1px, transparent 1px);
  background-size: 22px 22px;
  -webkit-mask: radial-gradient(150px circle at var(--mx, 50%) var(--my, 50%), #000 0%, transparent 62%);
          mask: radial-gradient(150px circle at var(--mx, 50%) var(--my, 50%), #000 0%, transparent 62%);
}
.cert:hover {
  transform: translateY(-2px);
  box-shadow: inset 0 0 0 1px color-mix(in oklab, var(--accent) 55%, transparent);
}
.cert:hover::before,
.cert:hover::after { opacity: 1; }
.cert:hover .num { color: var(--accent); }

/* reduced motion: initCertFX bails, so the glow stays centred and just fades in;
   drop the grid halo (it only reads as a cursor chase) for a calm, static look. */
@media (prefers-reduced-motion: reduce) {
  .cert::after { content: none; }
}

/* --- Multi-step contact form --- */
.builder {
  border: 1px solid var(--rule-med);
  background: var(--surface);
}
.builder-bar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 24px;
  border-bottom: 1px solid var(--rule-med);
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.10em;
  text-transform: uppercase;
  color: var(--ink-mute);
}
.builder-progress {
  display: flex; gap: 6px;
}
.builder-progress .tick {
  width: 28px; height: 4px; background: var(--rule-med); border-radius: 0;
  transition: background var(--t-fast);
}
.builder-progress .tick.done { background: var(--accent); }
.builder-progress .tick.active { background: var(--ink); }
.builder-step { padding: 40px 24px; }
.builder-step h3 {
  font-family: var(--font-display);
  font-stretch: 75%;
  font-weight: 600;
  font-size: clamp(28px, 3.5vw, 48px);
  letter-spacing: -0.035em;
  line-height: 1.05;
  margin: 0 0 32px;
  color: var(--ink);
}
.builder-options {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}
@media (max-width: 600px) { .builder-options { grid-template-columns: 1fr; } }
.builder-option {
  display: flex; flex-direction: column; gap: 6px;
  padding: 20px;
  border: 1px solid var(--rule-med);
  background: var(--page);
  cursor: pointer;
  text-align: left;
  transition: all var(--t-fast);
  font: inherit;
  color: inherit;
  position: relative;
}
.builder-option:hover { border-color: var(--ink); background: var(--surface-2); }
.builder-option.selected {
  border-color: var(--accent);
  background: var(--accent-soft);
}
.builder-option .opt-num {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--accent);
  letter-spacing: 0.12em;
}
.builder-option .opt-name {
  font-size: 18px;
  font-weight: 500;
  color: var(--ink);
  letter-spacing: -0.01em;
}
.builder-option .opt-desc {
  font-size: 13px;
  color: var(--ink-mute);
  line-height: 1.4;
}
.builder-input {
  width: 100%;
  background: var(--page);
  border: 1px solid var(--rule-med);
  color: var(--ink);
  padding: 14px 16px;
  font: inherit;
  font-size: 16px;
  letter-spacing: -0.01em;
  border-radius: 0;
  transition: border-color var(--t-fast);
}
.builder-input:focus { outline: 0; border-color: var(--accent); }
textarea.builder-input { min-height: 120px; resize: vertical; font-family: inherit; }
.builder-foot {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 24px;
  border-top: 1px solid var(--rule-med);
}
.builder-back, .builder-next {
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  background: transparent;
  border: 0;
  padding: 10px 16px;
  color: var(--ink-soft);
  cursor: pointer;
  transition: color var(--t-fast);
}
.builder-back:hover { color: var(--ink); }
.builder-back:disabled { opacity: 0.3; cursor: not-allowed; }
.builder-next {
  background: var(--accent);
  color: var(--accent-ink);
  padding: 12px 20px;
  border: 1px solid var(--accent);
}
.builder-next:hover { filter: brightness(1.1); }
.builder-next:disabled { opacity: 0.4; cursor: not-allowed; }

.builder-success {
  padding: 64px 24px; text-align: center;
}
.builder-success .check {
  width: 56px; height: 56px;
  border: 2px solid var(--accent);
  margin: 0 auto 24px;
  display: flex; align-items: center; justify-content: center;
  color: var(--accent);
  font-size: 22px;
}
.builder-success h3 {
  font-family: var(--font-display);
  font-stretch: 75%;
  font-weight: 600;
  font-size: clamp(28px, 3vw, 44px);
  letter-spacing: -0.035em;
  margin: 0 0 12px;
  color: var(--ink);
}
.builder-success p { color: var(--ink-soft); margin: 0 auto; max-width: 40ch; }

/* --- Contact direct --- */
.contact-grid {
  display: grid; grid-template-columns: 1.2fr 1fr;
  gap: 64px;
  align-items: start;
}
.contact-direct {
  display: grid; grid-template-columns: minmax(0, 48ch) 1fr;
  gap: 80px;
  align-items: start;
}
@media (max-width: 900px) { .contact-direct { grid-template-columns: 1fr; gap: 32px; } }
.contact-meta {
  display: flex; flex-direction: column;
  border-top: 1px solid var(--rule-med);
}
.contact-meta a {
  display: grid; grid-template-columns: 100px 1fr 20px;
  gap: 16px;
  padding: 16px 0;
  border-bottom: 1px solid var(--rule);
  font-family: var(--font-mono);
  font-size: 13px;
  letter-spacing: 0.02em;
  transition: padding var(--t-fast), color var(--t-fast);
  align-items: center;
}
.contact-meta a:hover { padding-left: 12px; color: var(--accent); }
.contact-meta a .k { color: var(--ink-mute); letter-spacing: 0.08em; text-transform: uppercase; font-size: 11px; }
.contact-meta a .v { color: var(--ink); }
.contact-meta a:hover .v { color: var(--accent); }
.contact-meta a .arr { color: var(--ink-mute); justify-self: end; }
.contact-meta a:hover .arr { color: var(--accent); }

/* --- Footer --- */
.footer {
  padding: 64px 0 40px;
  border-top: 1px solid var(--rule);
  display: grid; grid-template-columns: 1fr 1fr 1fr;
  gap: 32px;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--ink-mute);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.footer .col { display: flex; flex-direction: column; gap: 6px; }
.footer .col .head { color: var(--ink); }
.footer .col a { color: var(--ink-mute); }
.footer .col a:hover { color: var(--accent); }
.footer .col.right { align-items: flex-end; text-align: right; }
@media (max-width: 700px) {
  .footer { grid-template-columns: 1fr; gap: 24px; }
  .footer .col.right { align-items: flex-start; text-align: left; }
}

/* --- Projects index page --- */
.projects-list { display: flex; flex-direction: column; }
.proj-card {
  display: grid;
  grid-template-columns: 1fr 1.3fr;
  gap: 48px;
  padding: calc(56px * var(--d)) 0;
  border-top: 1px solid var(--rule);
  align-items: center;
}
.proj-card:last-child { border-bottom: 1px solid var(--rule); }
.proj-card .info { display: flex; flex-direction: column; gap: 16px; }
.proj-card .num,
.proj-card .info > .num {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
}
.proj-card .plate {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-mute);
  display: flex; gap: 16px; align-items: center;
}
.proj-card .plate .index { color: var(--accent); }
.proj-card h3 {
  font-family: var(--font-display);
  font-stretch: 70%;
  font-weight: 700;
  font-size: clamp(40px, 5.4vw, 88px);
  line-height: 0.9;
  letter-spacing: -0.05em;
  margin: 0;
  color: var(--ink);
}
.proj-card .desc {
  color: var(--ink-soft);
  max-width: 50ch;
  font-size: 16px;
  line-height: 1.5;
}
.proj-card .spec-row {
  display: grid; grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-top: 8px;
  padding-top: 16px;
  border-top: 1px solid var(--rule);
  font-family: var(--font-mono);
  font-size: 11px;
}
.proj-card .spec-row .spec .k { color: var(--ink-mute); letter-spacing: 0.08em; text-transform: uppercase; display: block; margin-bottom: 4px; }
.proj-card .spec-row .spec .v { color: var(--ink); }
.proj-card .stack { display: flex; flex-wrap: wrap; gap: 6px; }
.proj-card .stack span {
  font-family: var(--font-mono);
  font-size: 11px;
  padding: 4px 10px;
  border: 1px solid var(--rule-med);
  color: var(--ink-soft);
  letter-spacing: 0.02em;
}
.proj-card .visual {
  aspect-ratio: 4 / 3;
  background: var(--surface);
  border: 1px solid var(--rule-med);
  overflow: hidden;
  position: relative;
  transition: transform var(--t-med);
}
.proj-card:hover .visual { transform: translateY(-4px); }
.proj-card .visual picture { display: block; width: 100%; height: 100%; }
.proj-card .visual img { width: 100%; height: 100%; object-fit: cover; transition: transform var(--t-slow); }
.proj-card:hover .visual img { transform: scale(1.04); }
.proj-card.flip { grid-template-columns: 1.3fr 1fr; }
.proj-card.flip .visual { order: -1; }
@media (max-width: 800px) {
  .proj-card, .proj-card.flip { grid-template-columns: 1fr; gap: 24px; }
  .proj-card.flip .visual { order: 0; }
}

/* --- Placeholder visual --- */
.ph {
  width: 100%; height: 100%;
  background-image:
    repeating-linear-gradient(135deg, transparent 0 14px, color-mix(in oklab, var(--ink) 5%, transparent) 14px 15px);
  display: flex; align-items: flex-end; padding: 16px;
  color: var(--ink-mute);
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  position: relative;
}
.ph::before {
  content: "";
  position: absolute;
  inset: 12px;
  border: 1px dashed var(--rule-med);
}

/* --- Case study --- */
.cs-hero {
  padding-top: 48px;
  padding-bottom: 64px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 64px;
  align-items: end;
  border-bottom: 1px solid var(--rule);
}
@media (max-width: 900px) { .cs-hero { grid-template-columns: 1fr; gap: 32px; } }
.cs-hero .num {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.12em;
  color: var(--accent);
  margin-bottom: 14px;
  text-transform: uppercase;
}
.cs-hero h1.display {
  font-size: clamp(52px, 9vw, 144px);
  line-height: 0.86;
  font-stretch: 65%;
  font-weight: 700;
  letter-spacing: -0.055em;
}
.cs-hero .subtitle {
  font-size: clamp(18px, 1.5vw, 24px);
  color: var(--ink-soft);
  margin-top: 24px;
  max-width: 40ch;
  line-height: 1.4;
  letter-spacing: -0.005em;
}
.cs-hero .facts {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0;
  border: 1px solid var(--rule-med);
}
.cs-hero .facts .f {
  display: flex; flex-direction: column; gap: 6px;
  padding: 20px;
  border-right: 1px solid var(--rule-med);
  border-bottom: 1px solid var(--rule-med);
}
.cs-hero .facts .f:nth-child(2n) { border-right: 0; }
.cs-hero .facts .f:nth-last-child(-n+2) { border-bottom: 0; }
.cs-hero .facts .f .k {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-mute);
}
.cs-hero .facts .f .v {
  font-size: 15px;
  color: var(--ink);
  line-height: 1.3;
}

.cs-cover {
  width: 100%;
  aspect-ratio: 21 / 9;
  background: var(--surface);
  border: 1px solid var(--rule-med);
  margin: 48px 0;
  overflow: hidden;
  position: relative;
}
.cs-cover picture { display: block; width: 100%; height: 100%; }
.cs-cover img { width: 100%; height: 100%; object-fit: cover; }
/* parallax: oversize the image so the ±6% scrub never reveals an edge */
.cs-cover.oh-parallax picture,
.cs-cover.oh-parallax > img { height: 116%; }

.cs-block {
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: 64px;
  padding: 72px 0;
  border-top: 1px solid var(--rule);
}
.cs-block .head {
  display: flex; flex-direction: column; gap: 6px;
  position: sticky; top: 110px; align-self: start;
}
.cs-block .head .num {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.12em;
  color: var(--accent);
  text-transform: uppercase;
}
.cs-block .head h2 {
  font-family: var(--font-display);
  font-stretch: 70%;
  font-weight: 600;
  font-size: clamp(28px, 3.4vw, 52px);
  letter-spacing: -0.04em;
  line-height: 0.95;
  margin: 0;
  color: var(--ink);
}
.cs-block .body { display: flex; flex-direction: column; gap: 24px; }
.cs-block .body p {
  font-size: 17px; line-height: 1.6; color: var(--ink); margin: 0; max-width: 64ch;
  letter-spacing: -0.005em;
}
.cs-block .body p.lede {
  font-size: clamp(22px, 1.9vw, 30px);
  color: var(--ink);
  line-height: 1.35;
  max-width: 32ch;
  letter-spacing: -0.015em;
  font-weight: 400;
}
.cs-block .body ul { padding-left: 0; list-style: none; display: flex; flex-direction: column; gap: 12px; }
.cs-block .body ul li {
  padding-left: 26px;
  position: relative;
  max-width: 60ch;
  color: var(--ink-soft);
  line-height: 1.55;
}
.cs-block .body ul li::before {
  content: "▸";
  position: absolute; left: 0; top: 1px;
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: 12px;
}
.cs-block .body strong { color: var(--ink); font-weight: 500; }
@media (max-width: 800px) {
  .cs-block { grid-template-columns: 1fr; gap: 16px; padding: 56px 0; }
  .cs-block .head { position: static; flex-direction: row; align-items: baseline; gap: 14px; }
}

.results-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0;
  margin-top: 8px;
  border: 1px solid var(--rule-med);
}
@media (max-width: 700px) { .results-grid { grid-template-columns: 1fr; } }
.result {
  padding: 28px;
  border-right: 1px solid var(--rule-med);
  display: flex; flex-direction: column; gap: 10px;
  background: var(--surface);
}
.result:last-child { border-right: 0; }
@media (max-width: 700px) {
  .result { border-right: 0; border-bottom: 1px solid var(--rule-med); }
  .result:last-child { border-bottom: 0; }
}
.result .n {
  font-family: var(--font-display);
  font-stretch: 70%;
  font-weight: 700;
  font-size: clamp(40px, 5vw, 72px);
  line-height: 0.9;
  letter-spacing: -0.05em;
  color: var(--accent);
}
.result .l {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--ink-mute);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.cs-image {
  margin: 32px 0;
  border: 1px solid var(--rule-med);
  overflow: hidden;
  background: var(--surface);
}
.cs-image picture { display: block; width: 100%; }
.cs-image img { width: 100%; height: auto; display: block; }
.cs-image .cap {
  padding: 14px 20px;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--ink-mute);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  border-top: 1px solid var(--rule-med);
  background: var(--page);
}

.cs-next {
  display: grid; grid-template-columns: 1fr 1fr;
  gap: 0;
  padding: 64px 0;
  border-top: 1px solid var(--rule);
}
@media (max-width: 700px) { .cs-next { grid-template-columns: 1fr; } }
.cs-next a {
  display: flex; flex-direction: column; gap: 16px;
  padding: 32px;
  border: 1px solid var(--rule-med);
  border-right: 0;
  transition: all var(--t-fast);
}
.cs-next a:last-child { border-right: 1px solid var(--rule-med); }
.cs-next a:hover { border-color: var(--accent); background: var(--surface); }
.cs-next a .k {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.10em;
  text-transform: uppercase;
  color: var(--ink-mute);
}
.cs-next a:hover .k { color: var(--accent); }
.cs-next a .v {
  font-family: var(--font-display);
  font-stretch: 70%;
  font-weight: 600;
  font-size: clamp(28px, 3vw, 44px);
  letter-spacing: -0.035em;
  line-height: 1;
  color: var(--ink);
}

.tag-row { display: flex; flex-wrap: wrap; gap: 6px; }
.tag {
  font-family: var(--font-mono);
  font-size: 11px;
  padding: 4px 10px;
  border: 1px solid var(--rule-med);
  letter-spacing: 0.02em;
  color: var(--ink-soft);
}

/* Diagrams */
.diagram {
  padding: 32px;
  background: var(--surface);
  border: 1px solid var(--rule-med);
  margin: 16px 0;
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--ink);
  white-space: pre;
  overflow-x: auto;
  line-height: 1.65;
}

/* Back link */
.back-link {
  display: inline-flex; align-items: center; gap: 8px;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.10em;
  text-transform: uppercase;
  color: var(--ink-mute);
  padding: 32px 0 0;
  transition: color var(--t-fast);
}
.back-link:hover { color: var(--accent); }

/* Print */
@media print {
  .status-strip, .nav, .marquee-section, .footer { display: none !important; }
}

/* ============================================================
   LEVEL-UP LAYER — water hover FX, page transitions,
   staggered reveals, magnetic CTAs, animated wave dividers.
   Added on top of the base sheet; nothing above is altered.
   ============================================================ */

/* ============ "TIDAL WASH" — bespoke water splash from the left ============
   A body of water surges in from the left on hover, with a churning multi-layer
   foamy leading edge, underwater caustic light, a glossy crest sheen, and foam
   spray. Slow + organic. Motion only runs while hovered (idle = free). The
   markup (.oh-water + layers) is injected by site.js — no per-element HTML. */
:root {
  --w-deep: color-mix(in oklab, var(--accent) 60%, #001a3a);   /* shadowed depth   */
  --w-mid:  var(--accent);                                     /* core blue        */
  --w-cyan: color-mix(in oklab, var(--accent) 28%, #00d8ff);   /* shallow highlight */
  --w-foam: color-mix(in oklab, var(--accent) 10%, #ffffff);   /* foam / sheen     */
  --w-ease: cubic-bezier(0.16, 0.84, 0.26, 1);                 /* smooth wash-in   */
  --oh-edge: 36px;                                             /* churn-zone width */
}

/* positioning + clip context on each target */
.projects-preview .pitem,
.cert,
.proj-card .visual { position: relative; isolation: isolate; }
.projects-preview .pitem,
.cert { overflow: hidden; }

/* real content rides above the water (and the rain layer) */
.projects-preview .pitem > *:not(.oh-water):not(.oh-rain),
.cert > *:not(.oh-water):not(.oh-rain) { position: relative; z-index: 1; }

/* the water layer washes in from the left */
.oh-water {
  position: absolute;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
  transform: translateX(-104%);
  transition: transform 1.45s var(--w-ease);
  will-change: transform;
}

/* deep gradient body (fills all but the churn zone on the right) */
.oh-water .oh-body {
  position: absolute;
  inset: 0 var(--oh-edge) 0 0;
  background:
    radial-gradient(130% 90% at 8% 0%, color-mix(in oklab, var(--w-cyan) 55%, transparent), transparent 62%),
    linear-gradient(116deg, var(--w-deep) 0%, var(--w-mid) 58%, color-mix(in oklab, var(--w-mid) 62%, var(--w-cyan)) 100%);
}

/* churning leading edge: two vertical-wave SVGs scrolling at different speeds */
.oh-water .oh-edge {
  position: absolute;
  top: -50%; right: 0;
  width: calc(var(--oh-edge) + 22px);
  height: 200%;
  display: block;
}
.oh-water .oh-edge .w1 { fill: var(--w-mid); }
.oh-water .oh-edge .w2 { fill: color-mix(in oklab, var(--w-cyan) 55%, var(--w-mid)); opacity: 0.6; }

/* caustic light shimmer over the body (underwater feel) */
.oh-water .oh-caustics {
  position: absolute; inset: 0 var(--oh-edge) 0 0;
  mix-blend-mode: screen;
  opacity: 0;
  background:
    repeating-linear-gradient(58deg,  transparent 0 15px, color-mix(in oklab, var(--w-foam) 38%, transparent) 15px 18px, transparent 18px 40px),
    repeating-linear-gradient(-50deg, transparent 0 26px, color-mix(in oklab, var(--w-foam) 20%, transparent) 26px 28px, transparent 28px 64px);
  background-size: 240% 240%, 200% 200%;
  filter: blur(1.6px);
  transition: opacity 0.6s ease;
}

/* glossy crest highlight + soft foam line on the leading edge */
.oh-water .oh-sheen {
  position: absolute; top: 0; bottom: 0;
  right: calc(var(--oh-edge) - 8px);
  width: 20px;
  background: linear-gradient(90deg, transparent, color-mix(in oklab, var(--w-foam) 75%, transparent));
  opacity: 0; filter: blur(2px);
  transition: opacity 0.5s ease;
}

/* foam droplets spraying off the crest */
.oh-water .oh-drop {
  position: absolute;
  right: calc(var(--oh-edge) - 9px);
  width: 5px; height: 5px; border-radius: 50%;
  background: var(--w-foam);
  opacity: 0; filter: blur(0.3px);
}

/* ===== motion — engaged only while hovered ===== */
[data-fx="wave"] .projects-preview .pitem:hover .oh-water,
[data-fx="wave"] .proj-card:hover .visual .oh-water { transform: translateX(0); }

[data-fx="wave"] .pitem:hover .oh-edge .w1,
[data-fx="wave"] .proj-card:hover .visual .oh-edge .w1 { animation: oh-churn 3.6s linear infinite; }
[data-fx="wave"] .pitem:hover .oh-edge .w2,
[data-fx="wave"] .proj-card:hover .visual .oh-edge .w2 { animation: oh-churn 5.6s linear infinite reverse; }

[data-fx="wave"] .pitem:hover .oh-caustics,
[data-fx="wave"] .proj-card:hover .visual .oh-caustics { opacity: 0.5; animation: oh-caustic 9s linear infinite; }

[data-fx="wave"] .pitem:hover .oh-sheen,
[data-fx="wave"] .proj-card:hover .visual .oh-sheen { opacity: 0.85; }

[data-fx="wave"] .pitem:hover .oh-drop,
[data-fx="wave"] .proj-card:hover .visual .oh-drop { animation: oh-spray 1.9s ease-out var(--d, 0s) infinite; }

@keyframes oh-churn   { to { transform: translateY(-25%); } }
@keyframes oh-caustic { to { background-position: 120px 80px, -90px 60px; } }
@keyframes oh-spray {
  0%   { opacity: 0;    transform: translate(0, 0)       scale(0.5); }
  20%  { opacity: 0.95; }
  65%  { opacity: 0.45; }
  100% { opacity: 0;    transform: translate(15px, -24px) scale(1); }
}

/* text legibility over the fill */
[data-fx="wave"] .projects-preview .pitem:hover .title,
[data-fx="wave"] .projects-preview .pitem:hover .num,
[data-fx="wave"] .projects-preview .pitem:hover .meta,
[data-fx="wave"] .projects-preview .pitem:hover .arrow { color: var(--accent-ink); }
[data-fx="wave"] .projects-preview .pitem:hover { background: transparent; }

/* thumbnail wash sits above the screenshot */
.proj-card .visual .oh-water { z-index: 3; }
.proj-card .visual .oh-body { opacity: 0.8; }

/* reduced motion: a calm fade-in, no slosh / churn / spray */
@media (prefers-reduced-motion: reduce) {
  .oh-water { transform: none; opacity: 0; transition: opacity 0.5s ease; }
  [data-fx="wave"] .pitem:hover .oh-water,
  [data-fx="wave"] .proj-card:hover .visual .oh-water { opacity: 1; transform: none; }
  .oh-water .oh-edge .w1, .oh-water .oh-edge .w2,
  .oh-water .oh-caustics, .oh-water .oh-drop { animation: none !important; }
}

/* ===================================================================
   "Rain on glass" — video hover FX (injected by initRainFX in site.js).
   Two surfaces, three look families (sharing the wave's data-fx values):
     • HOME ROWS (.projects-preview .pitem): rain washes BEHIND the text.
         rain        = crisp dark clip + light text
         rain-frost  = same clip softened behind a misted-glass veil
         rain-refract = the row text ripples (displacement) over the clip
     • PROJECT CARDS (.proj-card .visual): rain OVERLAYS the screenshot
         (screen blend); frost blurs it, refract warps it. (Kept available;
          not used on the live pages right now.)
   The clip (rain-004 / rain-022) comes from [data-rain-src]; default 004.
   =================================================================== */

/* shared layer: a positioned wrapper holding the <video>; hidden until hover */
.oh-rain {
  position: absolute;
  inset: 0;
  opacity: 0;
  overflow: hidden;
  pointer-events: none;
  transition: opacity 0.5s var(--w-ease, ease);
  will-change: opacity;
}
.oh-rain video { width: 100%; height: 100%; object-fit: cover; display: block; }
[data-fx^="rain"] .proj-card:hover .visual .oh-rain,
[data-fx^="rain"] .projects-preview .pitem:hover .oh-rain { opacity: 1; }

/* ---------- HOME ROWS: a washed-out blue accent panel, rain glowing over it ----------
   The clips are white-rain-on-black, so a blue backdrop + screen-blended video turns
   the black transparent (showing blue) and lets the white rain glow on the accent.
   It washes in from the left (clip-path) to echo the wave, instead of a hard fade. */
.projects-preview .pitem .oh-rain {
  z-index: 0;
  background:
    radial-gradient(135% 165% at 6% 50%, color-mix(in oklab, var(--accent) 52%, #9cc3ff) 0%, transparent 60%),
    linear-gradient(100deg,
      color-mix(in oklab, var(--accent) 84%, #0a2a6b) 0%,
      var(--accent) 64%,
      color-mix(in oklab, var(--accent) 74%, #79b0ff) 100%);
  opacity: 1;                          /* reveal via the wash-in, not opacity */
  clip-path: inset(0 100% 0 0);        /* hidden: collapsed to the left edge */
  transition: clip-path 1.05s var(--w-ease, ease);
}
.projects-preview .pitem .oh-rain video {
  mix-blend-mode: screen;              /* black drops out → blue shows, white rain glows */
  filter: blur(0.7px) brightness(1.1); /* washed out / softened a touch */
  opacity: 0.9;
}
/* photo backdrop variant: a case-study screenshot replaces the blue panel
   (background-image set inline by initRainFX); rain still screen-blends over it */
.projects-preview .pitem .oh-rain.has-photo { background-size: cover; background-position: center; }
[data-fx^="rain"] .projects-preview .pitem:hover .oh-rain { clip-path: inset(0 0 0 0); }
[data-fx^="rain"] .projects-preview .pitem:hover { background: transparent; }
/* if a rain scope sits inside a wave page (e.g. only the work section is rain),
   suppress the wave's water layer on those rows so only the rain shows */
[data-fx^="rain"] .projects-preview .pitem .oh-water { display: none; }

/* text fades to light as the panel washes over it */
[data-fx^="rain"] .projects-preview .pitem .num,
[data-fx^="rain"] .projects-preview .pitem .title,
[data-fx^="rain"] .projects-preview .pitem .meta,
[data-fx^="rain"] .projects-preview .pitem .arrow { transition: color 0.55s var(--w-ease, ease); }
[data-fx^="rain"] .projects-preview .pitem:hover .num,
[data-fx^="rain"] .projects-preview .pitem:hover .title,
[data-fx^="rain"] .projects-preview .pitem:hover .meta,
[data-fx^="rain"] .projects-preview .pitem:hover .arrow { color: var(--accent-ink); }

/* B (rows) — rain-frost: push the softness further into a misted-glass blue */
[data-fx="rain-frost"] .projects-preview .pitem .oh-rain video {
  filter: blur(4px) brightness(1.2) contrast(0.92);
  transform: scale(1.08); /* hide the blurred edges */
  opacity: 1;
}
[data-fx="rain-frost"] .projects-preview .pitem .oh-rain::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(
    0deg,
    color-mix(in oklab, var(--accent) 40%, rgba(220, 232, 255, 0.40)),
    color-mix(in oklab, var(--accent) 22%, rgba(220, 232, 255, 0.26))
  );
}
[data-fx="rain-frost"] .projects-preview .pitem:hover .num,
[data-fx="rain-frost"] .projects-preview .pitem:hover .title,
[data-fx="rain-frost"] .projects-preview .pitem:hover .meta,
[data-fx="rain-frost"] .projects-preview .pitem:hover .arrow { text-shadow: 0 1px 12px rgba(0, 0, 0, 0.5); }

/* C (rows) — rain-refract: the text itself ripples under the running water */
[data-fx="rain-refract"] .projects-preview .pitem:hover .num,
[data-fx="rain-refract"] .projects-preview .pitem:hover .title,
[data-fx="rain-refract"] .projects-preview .pitem:hover .meta,
[data-fx="rain-refract"] .projects-preview .pitem:hover .arrow { filter: url(#rain-refract); }

/* ---------- PROJECT CARDS: rain overlays the screenshot (kept available) ---------- */
.proj-card .visual .oh-rain { z-index: 4; }
[data-fx^="rain"] .proj-card .visual .oh-rain { mix-blend-mode: screen; }
[data-fx="rain"] .proj-card:hover .visual .oh-rain { opacity: 0.85; }
[data-fx="rain-frost"] .proj-card:hover .visual .oh-rain { opacity: 0.95; }
[data-fx="rain-refract"] .proj-card:hover .visual .oh-rain { opacity: 0.8; }
[data-fx="rain-frost"] .proj-card .visual > img,
[data-fx="rain-frost"] .proj-card .visual > .ph { transition: filter 0.5s ease; }
[data-fx="rain-frost"] .proj-card:hover .visual > img,
[data-fx="rain-frost"] .proj-card:hover .visual > .ph { filter: blur(3px) brightness(0.82) saturate(0.9); }
[data-fx="rain-refract"] .proj-card .visual > img,
[data-fx="rain-refract"] .proj-card .visual > .ph { transition: filter 0.4s ease; }
[data-fx="rain-refract"] .proj-card:hover .visual > img,
[data-fx="rain-refract"] .proj-card:hover .visual > .ph { filter: url(#rain-refract); }

/* reduced motion: gentle fade instead of the wash-in; no warp / blur churn */
@media (prefers-reduced-motion: reduce) {
  .oh-rain { transition: opacity 0.4s ease; }
  .projects-preview .pitem .oh-rain { clip-path: none; opacity: 0; transition: opacity 0.4s ease; }
  [data-fx^="rain"] .projects-preview .pitem:hover .oh-rain { opacity: 1; }
  [data-fx="rain-refract"] .projects-preview .pitem:hover .num,
  [data-fx="rain-refract"] .projects-preview .pitem:hover .title,
  [data-fx="rain-refract"] .projects-preview .pitem:hover .meta,
  [data-fx="rain-refract"] .projects-preview .pitem:hover .arrow,
  [data-fx="rain-frost"] .proj-card:hover .visual > img,
  [data-fx="rain-frost"] .proj-card:hover .visual > .ph,
  [data-fx="rain-refract"] .proj-card:hover .visual > img,
  [data-fx="rain-refract"] .proj-card:hover .visual > .ph { filter: none; }
  [data-fx="rain-frost"] .projects-preview .pitem .oh-rain video { filter: none; transform: none; }
}

/* --- Cross-page transitions (View Transitions API; no-op where unsupported) --- */
@view-transition { navigation: auto; }
::view-transition-old(root) { animation: oh-vt-out 0.26s cubic-bezier(0.4, 0, 1, 1) both; }
::view-transition-new(root) { animation: oh-vt-in 0.42s cubic-bezier(0, 0, 0.2, 1) both; }
@keyframes oh-vt-out { to   { opacity: 0; transform: translateY(-10px); } }
@keyframes oh-vt-in  { from { opacity: 0; transform: translateY(12px);  } }
@media (prefers-reduced-motion: reduce) {
  ::view-transition-old(root), ::view-transition-new(root) { animation: none; }
}
/* Shared-element morph groups (vt-title-* / vt-cover-*, stamped by site.js): give the
   position/size morph a smooth, slightly longer ease than the root cross-fade. The
   wildcard targets every named group; browsers that don't parse it just drop this rule. */
@media (prefers-reduced-motion: no-preference) {
  ::view-transition-group(*) {
    animation-duration: 0.5s;
    animation-timing-function: cubic-bezier(0.16, 0.84, 0.26, 1);
  }
}

/* --- Richer staggered reveals (opt-in via .oh-stagger from site.js) --- */
.oh-stagger-item {
  opacity: 0;
  transform: translateY(22px);
  transition: opacity var(--t-slow), transform var(--t-slow);
  transition-delay: calc(var(--i, 0) * 70ms);
  will-change: opacity, transform;
}
.oh-stagger[data-stagger="left"]  .oh-stagger-item { transform: translateX(-28px); }
.oh-stagger[data-stagger="scale"] .oh-stagger-item { transform: scale(0.93); }
.oh-stagger.oh-in .oh-stagger-item { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) {
  .oh-stagger-item { opacity: 1 !important; transform: none !important; transition: none; }
}

/* --- Hero entrance: per-line clip/mask reveal ---
   Pure CSS (runs on load, compositor-only, no GSAP dependency so there's no FOUC
   and it can't break). Each line clips its inner span, which rises from below.
   The padding/negative-margin pair keeps descenders (the comma in "Hello,") from
   being clipped by overflow:hidden. Identical on desktop + mobile. */
.hero-headline .hero-line {
  display: block;
  overflow: hidden;
  padding-bottom: 0.08em;
  margin-bottom: -0.08em;
}
.hero-headline .hero-line-inner {
  display: block;
  transform: translateY(110%);
  animation: hero-rise 0.82s cubic-bezier(0.16, 0.84, 0.26, 1) both;
}
.hero-headline .hero-line:nth-child(1) .hero-line-inner { animation-delay: 0.08s; }
.hero-headline .hero-line:nth-child(2) .hero-line-inner { animation-delay: 0.16s; }
.hero-headline .hero-line:nth-child(3) .hero-line-inner { animation-delay: 0.24s; }
.hero-headline .hero-line:nth-child(4) .hero-line-inner { animation-delay: 0.32s; }
@keyframes hero-rise { to { transform: translateY(0); } }

/* desktop cursor-reactive weight (set by initHeroCursorWeight; --hw defaults to the
   design weight so it's a no-op until/ unless JS drives it) */
@media (hover: hover) and (pointer: fine) {
  .hero-headline { font-variation-settings: "wght" var(--hw, 700); }
}

/* one-shot scramble glyphs reuse the accent colour already on .accent-word */
.hero-headline .accent-word[data-scrambling] { font-variation-settings: "wght" 600; }

@media (prefers-reduced-motion: reduce) {
  .hero-headline .hero-line-inner { transform: none; animation: none; }
}

/* --- Animated wave dividers --- */
.oh-divider {
  line-height: 0;
  margin: calc(var(--block-y) * 0.5) 0;
  color: var(--accent);
}
.oh-divider svg { display: block; width: 100%; height: 26px; opacity: 0.6; }
.oh-divider path {
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-dasharray: 1;
  stroke-dashoffset: 1;
  transition: stroke-dashoffset 1.7s cubic-bezier(0.2, 0.7, 0.2, 1);
}
.oh-divider.in path { stroke-dashoffset: 0; }
@media (prefers-reduced-motion: reduce) {
  .oh-divider path { transition: none; stroke-dashoffset: 0; }
}

/* ============================================================
   MOBILE / TOUCH PARITY — .is-active mirrors the rain + cert hover
   triggers, driven by initActiveInView() on coarse pointers so the
   premium feel survives on touch. Plus the tap-ripple keyframe.
   .is-active is only ever added on touch devices (JS-gated), so these
   rules are inert on desktop where :hover already does the work.
   ============================================================ */

/* HOME ROWS — rain washes in on the centred row, text flips to light */
[data-fx^="rain"] .projects-preview .pitem.is-active .oh-rain { clip-path: inset(0 0 0 0); }
[data-fx^="rain"] .projects-preview .pitem.is-active { background: transparent; }
[data-fx^="rain"] .projects-preview .pitem.is-active .num,
[data-fx^="rain"] .projects-preview .pitem.is-active .title,
[data-fx^="rain"] .projects-preview .pitem.is-active .meta,
[data-fx^="rain"] .projects-preview .pitem.is-active .arrow { color: var(--accent-ink); }
[data-fx="rain-frost"] .projects-preview .pitem.is-active .num,
[data-fx="rain-frost"] .projects-preview .pitem.is-active .title,
[data-fx="rain-frost"] .projects-preview .pitem.is-active .meta,
[data-fx="rain-frost"] .projects-preview .pitem.is-active .arrow { text-shadow: 0 1px 12px rgba(0, 0, 0, 0.5); }

/* PROJECT CARDS — rain overlays the screenshot, card lifts */
[data-fx^="rain"] .proj-card.is-active .visual .oh-rain { opacity: 1; }
[data-fx="rain"] .proj-card.is-active .visual .oh-rain { opacity: 0.85; }
[data-fx="rain-frost"] .proj-card.is-active .visual .oh-rain { opacity: 0.95; }
.proj-card.is-active .visual { transform: translateY(-4px); }
.proj-card.is-active .visual img { transform: scale(1.04); }

/* CERTS — light up the centred card (glow defaults to centre when JS isn't tracking --mx/--my) */
.cert.is-active {
  transform: translateY(-2px);
  box-shadow: inset 0 0 0 1px color-mix(in oklab, var(--accent) 55%, transparent);
}
.cert.is-active::before,
.cert.is-active::after { opacity: 1; }
.cert.is-active .num { color: var(--accent); }

/* TAP RIPPLE — injected by initTapRipple() into clip-safe surfaces */
.oh-ripple {
  position: absolute;
  border-radius: 50%;
  background: radial-gradient(circle, color-mix(in oklab, var(--accent) 45%, transparent), transparent 70%);
  transform: scale(0);
  opacity: 0.55;
  pointer-events: none;
  z-index: 5;
  animation: oh-ripple 0.6s ease-out forwards;
}
@keyframes oh-ripple { to { transform: scale(1.12); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .oh-ripple { display: none; } }

/* --- Reading-progress bar (driven by initScrollProgress) --- */
.oh-progress {
  position: fixed;
  top: 0; left: 0;
  height: 2px; width: 100%;
  transform: scaleX(0);
  transform-origin: 0 50%;
  background: var(--accent);
  z-index: 80;
  pointer-events: none;
  will-change: transform;
}

/* --- Section-number HUD (desktop only; driven by initSectionHUD) --- */
.oh-hud {
  position: fixed;
  left: var(--pad-page-x);
  bottom: 22px;
  z-index: 70;
  display: inline-flex;
  align-items: baseline;
  gap: 10px;
  padding: 8px 12px;
  background: color-mix(in oklab, var(--page) 78%, transparent);
  backdrop-filter: blur(10px);
  border: 1px solid var(--rule);
  font-family: var(--font-mono);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  opacity: 0;
  transform: translateY(6px);
  transition: opacity var(--t-med), transform var(--t-med);
  pointer-events: none;
}
.oh-hud.show { opacity: 1; transform: none; }
.oh-hud .oh-hud-num { color: var(--accent); font-size: 11px; }
.oh-hud .oh-hud-label { color: var(--ink-soft); font-size: 11px; }
@media (max-width: 767px) { .oh-hud { display: none; } }
@media (prefers-reduced-motion: reduce) {
  .oh-hud { transition: none; }
}
