:root {
  --bg: #f7f7f7;
  --surface: #fff;
  --nav: rgba(255, 255, 255, .36);
  --nav-sheen: rgba(255, 255, 255, .5);
  --nav-edge: rgba(255, 255, 255, .6);
  --nav-glow: rgba(255, 255, 255, .9);
  --nav-rim: rgba(255, 255, 255, .35);
  --nav-shadow: rgba(0, 0, 0, .14);
  --nav-text-halo: rgba(255, 255, 255, .85);
  --text: #000;
  --heading: #545454;
  --muted: #6e6e6e;
  --line: rgba(138, 138, 138, .18);
  --chip: rgba(138, 138, 138, .12);
  --cta-bg: #323232;
  --cta-text: #fff;
  --cta-btn-bg: #fff;
  --cta-btn-text: #111;
  --status: #4cc38a;
  --primary: #309575;
  --primary-press: #267a5f;
  --display: "Inter", system-ui, sans-serif;
  --mono: "Geist Mono", ui-monospace, monospace;
  --gutter: 60px;
  --content: 1460px;
  color-scheme: light;
}

:root[data-theme="dark"] {
  --bg: #0e0e0e;
  --surface: #191919;
  --nav: rgba(28, 28, 28, .42);
  --nav-sheen: rgba(255, 255, 255, .12);
  --nav-edge: rgba(255, 255, 255, .16);
  --nav-glow: rgba(255, 255, 255, .28);
  --nav-rim: rgba(255, 255, 255, .08);
  --nav-shadow: rgba(0, 0, 0, .45);
  --nav-text-halo: rgba(0, 0, 0, .7);
  --text: #f5f5f5;
  --heading: #ababab;
  --muted: #989898;
  --line: rgba(138, 138, 138, .22);
  --chip: rgba(138, 138, 138, .16);
  --cta-bg: #222;
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 400 16px/1.5 var(--display);
  font-optical-sizing: auto;
  -webkit-font-smoothing: antialiased;
}

img { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
h1, h2, h3, p { margin: 0; }
:focus-visible { outline: 2px solid #09f; outline-offset: 2px; }

/* Nav */
.nav {
  position: fixed;
  z-index: 10;
  top: 20px;
  left: 50%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  width: min(660px, calc(100% - 32px));
  height: 52px;
  padding: 0 12px 0 20px;
  transform: translateX(-50%);
  text-shadow: 0 0 10px var(--nav-text-halo);
  background: linear-gradient(135deg, var(--nav-sheen), transparent 45%, transparent 70%, var(--nav-rim)), var(--nav);
  border: 1px solid var(--nav-edge);
  border-radius: 26px;
  box-shadow:
    inset 0 1px 1px var(--nav-glow),
    inset 0 -1px 1px var(--nav-rim),
    inset 0 0 12px var(--nav-rim),
    0 10px 32px var(--nav-shadow);
  -webkit-backdrop-filter: blur(9px) saturate(190%);
  backdrop-filter: blur(9px) saturate(190%);
}
/* Edge refraction, Chromium only (main.js adds the class and the SVG filter) */
.nav.refract {
  -webkit-backdrop-filter: url(#nav-glass) blur(3px) saturate(190%);
  backdrop-filter: url(#nav-glass) blur(3px) saturate(190%);
}
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .nav { background: var(--surface); }
}
.nav { transition: width .4s cubic-bezier(.2, .7, .2, 1); }
.nav.compact { width: min(500px, calc(100% - 32px)); }
.nav-logo { font-size: 24px; font-weight: 600; letter-spacing: -.02em; }
.nav-links { display: flex; gap: 32px; }
.nav-links a { padding: 4px 0; transition: opacity .15s; }
.nav-links a:hover { opacity: .55; }
.nav-links a[aria-current="page"] { margin: 0 -10px; padding: 4px 10px; background: var(--chip); border-radius: 8px; }
.theme-toggle {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  padding: 0;
  color: inherit;
  background: var(--chip);
  border: 0;
  border-radius: 50%;
  cursor: pointer;
}
.theme-toggle svg { width: 15px; height: 15px; fill: currentColor; }
.theme-toggle .sun, [data-theme="dark"] .theme-toggle .moon { display: none; }
[data-theme="dark"] .theme-toggle .sun { display: block; }

/* Layout */
main {
  display: flex;
  flex-direction: column;
  gap: 64px;
  width: 100%;
  max-width: calc(var(--content) + var(--gutter) * 2);
  margin: 0 auto;
  padding: 152px var(--gutter) 30px;
}
.section { display: flex; flex-direction: column; gap: 24px; }
.section-title {
  color: var(--heading);
  font-size: 27.2px;
  font-weight: 500;
  line-height: 1.1;
  letter-spacing: -.02em;
}

/* Hero */
.hero { display: flex; flex-direction: column; gap: 32px; padding-top: 112px; min-height: calc(100vh - 350px); min-height: calc(100svh - 350px); }
.hero h1 {
  font-size: clamp(56px, 9vw, 116px);
  font-weight: 500;
  line-height: 1;
  letter-spacing: -.04em;
}
.hero-lede {
  display: flex;
  flex-direction: column;
  gap: 2px;
  color: var(--text);
  font-size: clamp(20px, 2.5vw, 32px);
  font-weight: 500;
  line-height: 1.4;
  letter-spacing: -.01em;
}
.hero-lede a .word { text-decoration: underline; text-underline-offset: 4px; }
.hero-lede a:hover { color: var(--primary); }
.hero-lede strong { color: var(--text); font-weight: 600; }
.hero-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 28px; }
.status { display: inline-flex; align-items: center; gap: 8px; }
.status::before {
  width: 9px;
  height: 9px;
  content: "";
  background: var(--status);
  border-radius: 50%;
  animation: pulse 2.4s infinite;
}
.word {
  display: inline-block;
  opacity: .001;
  filter: blur(2px);
  transform: translateY(2px);
  animation: word-in .2s cubic-bezier(.25, .8, .3, 1) forwards;
}
.js [data-fx="heading"] { animation: heading-in .4s .2s cubic-bezier(.25, .8, .3, 1) both; }
.js [data-fx="lede"] { animation: lede-in .4s .3s cubic-bezier(.25, .8, .3, 1) both; }

@keyframes word-in { to { opacity: 1; filter: blur(0); transform: none; } }
@keyframes heading-in { from { opacity: .001; transform: translate(-2px, -2px) scale(.99); } }
@keyframes lede-in { from { opacity: .001; transform: translateX(-2px) scale(.99); } }
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(76, 195, 138, .55); }
  70%, 100% { box-shadow: 0 0 0 8px rgba(76, 195, 138, 0); }
}

/* Project cards */
.project-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 15px; }
.card {
  display: flex;
  flex-direction: column;
  gap: 20px;
  padding: 20px;
  background: var(--surface);
  border-radius: 22px;
}
.card-media { overflow: hidden; aspect-ratio: 4 / 3; background: #fff; border-radius: 12px; }
.card-media img { width: 100%; height: 100%; object-fit: cover; }
.card-title { font-size: 20px; font-weight: 400; line-height: 1.4; letter-spacing: -.01em; }
.card-tag, .card-desc { color: var(--muted); }
.card-desc { margin-top: 10px; }

.button {
  display: block;
  padding: 14px 20px;
  color: var(--cta-text);
  font-size: 14px;
  font-weight: 600;
  text-align: center;
  background: var(--cta-bg);
  border: 0;
  border-radius: 10px;
  cursor: pointer;
  transition: opacity .15s;
}
.button:hover, .button:active { color: #fff; background: var(--primary); }
.button:active { background: var(--primary-press); }
.button, .pill-button { transition: background-color .15s, border-color .15s, color .15s; }

/* Experience */
.experience-row {
  display: grid;
  grid-template-columns: 50% 1fr auto;
  align-items: center;
  padding: 20px 0;
  font-size: 18px;
  letter-spacing: -.01em;
  border-bottom: 1px solid var(--line);
}
.period { color: var(--muted); text-align: right; }

/* Chips */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 32px;
  padding: 4px 9px;
  font-size: 15px;
  background: var(--chip);
  border-radius: 8px;
  transition: opacity .15s;
}
a.chip:hover { opacity: .65; }
.chips.gravity { position: relative; display: block; height: 400px; overflow: hidden; border-bottom: 1px solid var(--line); }
.gravity .chip {
  position: absolute;
  top: 0;
  left: 0;
  padding: 10px 18px;
  color: #fff;
  white-space: nowrap;
  background: var(--primary);
  border-radius: 999px;
  transform: translateY(-200px);
  cursor: grab;
  user-select: none;
  touch-action: none;
  will-change: transform;
}
.gravity .chip.dragging { cursor: grabbing; }
.chip img { width: 18px; height: 18px; object-fit: contain; border-radius: 4px; }

/* CTA + footer */
.footer {
  max-width: calc(var(--content) + var(--gutter) * 2);
  margin: 0 auto;
  padding: 0 var(--gutter) 30px;
  color: var(--muted);
  font-size: 14px;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 8px 24px;
}
.footer-links { display: flex; flex-wrap: wrap; gap: 8px 20px; }
.footer-links a:hover { color: var(--text); }

/* Inner pages */
.page-head { display: flex; flex-direction: column; gap: 16px; max-width: 760px; padding-top: 32px; }
.page-head h1 { font-size: clamp(44px, 6vw, 60px); font-weight: 500; line-height: 1; letter-spacing: -.04em; }
.page-head p { color: var(--muted); font-size: 20px; line-height: 1.4; }

.about-photo { width: 100%; aspect-ratio: 16 / 7; object-fit: cover; object-position: center 35%; border-radius: 16px; }
.prose { display: flex; flex-direction: column; gap: 40px; max-width: 760px; }
.prose h1 { margin-bottom: -24px; font-size: clamp(44px, 6vw, 60px); font-weight: 500; line-height: 1; letter-spacing: -.04em; }
.about-copy p a { text-decoration: underline; text-decoration-color: var(--muted); text-underline-offset: 3px; transition: color .15s, text-decoration-color .15s; }
.about-copy p a:hover, .about-copy p a:active { color: var(--primary); text-decoration-color: var(--primary); }
.social-links { display: flex; gap: 10px; margin-top: 4px; }
.social-links a { display: grid; place-items: center; width: 44px; height: 44px; background: var(--chip); border-radius: 50%; transition: background-color .15s, color .15s; }
.social-links a:hover, .social-links a:active { color: #fff; background: var(--primary); }
.social-links svg { width: 22px; height: 22px; }
.about-copy { display: flex; flex-direction: column; gap: 22px; }
.prose .intro { font-size: clamp(23px, 3vw, 32px); line-height: 1.3; letter-spacing: -.02em; }
.prose h2 { margin-bottom: 8px; color: var(--heading); font-size: 22px; font-weight: 500; letter-spacing: -.02em; }
.prose p { font-size: 18px; line-height: 1.55; }

.contact {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 28px;
  padding: 72px 0;
  text-align: center;
}
.contact-email {
  font-size: clamp(26px, 7.4vw, 96px);
  font-weight: 500;
  line-height: 1.1;
  letter-spacing: -.04em;
}
.poke-button { white-space: nowrap; transition: scale .2s cubic-bezier(.2, .7, .2, 1), background-color .15s, border-color .15s; }
.poke-smile { position: fixed; z-index: 30; top: 0; left: 0; font-size: 22px; pointer-events: none; }
.contact-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; }
.pill-button {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 14px 26px;
  color: #fff;
  font: 500 17px/1.2 var(--display);
  background: var(--primary);
  border: 1px solid var(--primary);
  border-radius: 999px;
  cursor: pointer;
  transition: opacity .15s;
}
.pill-button:hover, .pill-button:active { color: #fff; background: var(--primary-press); border-color: var(--primary-press); }
.pill-button.outline { color: var(--text); background: transparent; border-color: var(--text); }
.pill-button.outline:hover, .pill-button.outline:active { color: #fff; background: var(--primary); border-color: var(--primary); }
.pill-button svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; }

.not-found { display: flex; flex-direction: column; align-items: flex-start; gap: 24px; min-height: 55vh; justify-content: center; }

/* Linked project cards */
a.card:hover .card-media img { transform: scale(1.03); }
.cursor-pill { position: fixed; z-index: 20; top: 0; left: 0; pointer-events: none; }
.cursor-pill span {
  display: block;
  padding: 7px 14px;
  color: #fff;
  font-size: 14px;
  font-weight: 500;
  white-space: nowrap;
  background: rgba(30, 30, 30, .42);
  border: 1px solid rgba(255, 255, 255, .22);
  border-radius: 999px;
  opacity: 0;
  transform: translate(20px, 16px) scale(.7);
  transform-origin: top left;
  transition: opacity .2s ease, transform .25s cubic-bezier(.2, .7, .2, 1);
  -webkit-backdrop-filter: blur(10px) saturate(185%);
  backdrop-filter: blur(10px) saturate(185%);
}
.cursor-pill.on span { opacity: 1; transform: translate(20px, 16px) scale(1); }
.card-media img { transition: transform .5s cubic-bezier(.2, .7, .2, 1); }
.card-info { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; }
.card-arrow {
  display: grid;
  flex: none;
  place-items: center;
  width: 40px;
  height: 40px;
  font-size: 18px;
  background: var(--chip);
  border-radius: 10px;
  transition: transform .2s;
}
a.card:hover .card-arrow { transform: translateX(3px); }
.card-locked { cursor: pointer; }
.protected-dialog {
  width: min(420px, calc(100% - 32px));
  padding: 24px;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 22px;
}
.protected-dialog::backdrop {
  background: rgba(0, 0, 0, .35);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
}
.protected-dialog h2 { font-size: 24px; font-weight: 500; line-height: 1.2; letter-spacing: -.02em; }
.protected-dialog p { margin-top: 8px; color: var(--muted); }
.protected-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 20px; }
.protected-close { color: var(--text); background: var(--chip); }
.card-arrow svg { width: 16px; height: 16px; fill: currentColor; }

/* Case studies */
.case { display: flex; flex-direction: column; gap: 56px; width: 100%; }
.back-link { color: var(--muted); }
.back-link:hover { color: var(--text); }
.case-head { display: flex; flex-direction: column; gap: 16px; padding-top: 24px; }
.case-head h1 { font-size: clamp(44px, 6vw, 60px); font-weight: 500; line-height: 1.02; letter-spacing: -.04em; }
.case-head p { max-width: 760px; color: var(--muted); font-size: clamp(20px, 2.4vw, 24px); line-height: 1.35; letter-spacing: -.01em; }
.case-meta { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 24px; margin: 0; }
.case-meta dt, .case-section-num { color: var(--muted); font: 12.5px/1.4 var(--mono); text-transform: uppercase; letter-spacing: .03em; }
.case-meta dd { margin: 6px 0 0; }
.case-hero { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; background: #fff; border-radius: 16px; }
.case-section { display: grid; grid-template-columns: 240px minmax(0, 1fr); gap: 32px; }
.case-section h2 { margin-top: 4px; color: var(--heading); font-size: 27.2px; font-weight: 500; line-height: 1.1; letter-spacing: -.02em; }
.case-body { display: flex; flex-direction: column; gap: 18px; max-width: 760px; font-size: 18px; line-height: 1.55; }
.case-body h3 { margin-top: 10px; font-size: 20px; font-weight: 500; letter-spacing: -.01em; }
.case-body ul { display: flex; flex-direction: column; gap: 10px; margin: 0; padding-left: 20px; }
.case-body strong { font-weight: 600; }
.case-body blockquote { margin: 6px 0; padding-left: 18px; font-size: 22px; line-height: 1.35; letter-spacing: -.01em; border-left: 2px solid var(--line); }
.case-body cite { display: block; margin-top: 8px; color: var(--muted); font-size: 15px; font-style: normal; letter-spacing: 0; }
.stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.stat { padding: 18px; background: var(--surface); border-radius: 16px; }
.stat b { display: block; font-size: 36px; font-weight: 500; line-height: 1.1; letter-spacing: -.03em; }
.stat span { display: block; margin-top: 6px; font-size: 15px; font-weight: 500; line-height: 1.3; }
.stat small { display: block; margin-top: 4px; color: var(--muted); font-size: 14px; line-height: 1.35; }
.case-figure { margin: 8px 0; }
.case-figure img { width: 100%; background: #fff; border-radius: 12px; }
.case-figure figcaption { margin-top: 8px; color: var(--muted); font-size: 14px; }
.steps { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 4px 0; padding: 0; list-style: none; }
.steps li { display: flex; align-items: center; gap: 8px; }
.steps span { padding: 8px 14px; font-size: 16px; font-weight: 500; background: var(--surface); border-radius: 10px; }
.steps li:not(:last-child)::after { color: var(--muted); content: "→"; }
.case-placeholder {
  display: grid;
  place-items: center;
  min-height: 220px;
  padding: 20px;
  color: var(--muted);
  font-size: 15px;
  text-align: center;
  border: 1px dashed var(--muted);
  border-radius: 12px;
}
.case-video { display: block; width: 100%; background: #fff; border-radius: 12px; }
.case-embed { width: 100%; height: clamp(520px, 75vh, 760px); background: #fff; border: 1px solid var(--line); border-radius: 12px; }
.case-nav { display: grid; grid-template-columns: 1fr 1fr; gap: 15px; }
.case-nav a { padding: 20px; background: var(--surface); border-radius: 16px; transition: opacity .15s; }
.case-nav a:hover { opacity: .7; }
.case-nav a:last-child { text-align: right; }
.case-nav small { display: block; color: var(--muted); font-size: 14px; }

@media (max-width: 809.98px) {
  .case { gap: 40px; }
  .case-meta, .case-nav { grid-template-columns: 1fr 1fr; }
  .case-section { grid-template-columns: 1fr; gap: 12px; }
  .case-body { font-size: 17px; }
  .stats { grid-template-columns: 1fr; }
}

/* Circle cursor: difference blending inverts whatever is underneath */
.custom-cursor, .custom-cursor * { cursor: none !important; }
.cursor-dot {
  position: fixed;
  z-index: 50;
  top: -13px;
  left: -13px;
  width: 26px;
  height: 26px;
  background: #fafafa;
  border-radius: 50%;
  mix-blend-mode: difference;
  pointer-events: none;
  opacity: 0;
}
.cursor-dot.on { opacity: 1; }
/* The popup sits in the browser's top layer, above the circle, so it keeps the normal cursor */
.custom-cursor dialog, .custom-cursor dialog *, .custom-cursor dialog::backdrop { cursor: auto !important; }
.custom-cursor dialog a, .custom-cursor dialog button { cursor: pointer !important; }
body:has(dialog[open]) .cursor-dot { display: none; }

/* Joke "live viewers" card */
.viewers-card {
  position: fixed;
  z-index: 9;
  left: 20px;
  bottom: 20px;
  width: min(320px, calc(100% - 32px));
  padding: 16px;
  background: linear-gradient(135deg, var(--nav-sheen), transparent 55%), var(--nav);
  border: 1px solid var(--nav-edge);
  border-radius: 22px;
  box-shadow: inset 0 1px 1px var(--nav-glow), 0 10px 32px var(--nav-shadow);
  -webkit-backdrop-filter: blur(18px) saturate(190%);
  backdrop-filter: blur(18px) saturate(190%);
  animation: viewers-in .5s cubic-bezier(.2, .7, .2, 1) both;
}
.viewers-card p { display: flex; gap: 10px; font-size: 15px; line-height: 1.4; letter-spacing: -.01em; text-shadow: 0 0 10px var(--nav-text-halo); }
.viewers-card p::before {
  flex: none;
  width: 9px;
  height: 9px;
  margin-top: 6px;
  content: "";
  background: var(--status);
  border-radius: 50%;
  animation: pulse 2.4s infinite;
}
.viewers-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 14px; }
.viewers-actions .pill-button { justify-content: center; padding: 9px 12px; font-size: 14px; white-space: nowrap; }
@keyframes viewers-in { from { opacity: 0; transform: translateY(14px); } }

/* Scroll reveal, only when JS can undo it */
.js [data-reveal] { opacity: 0; transform: translateY(14px); transition: opacity .6s ease, transform .6s cubic-bezier(.2, .7, .2, 1); }
.js [data-reveal].in { opacity: 1; transform: none; }

@media (max-width: 809.98px) {
  :root { --gutter: 16px; }
  main { gap: 48px; padding-top: 112px; }
  .nav { padding: 0 10px 0 14px; gap: 8px; }
  .nav-logo { font-size: 22px; }
  .nav-links { gap: 14px; font-size: 15px; }
  .hero { padding-top: 40px; min-height: calc(100vh - 290px); min-height: calc(100svh - 290px); }
  .viewers-card { left: 16px; bottom: 16px; }
  .hero-break { display: none; }
  .project-grid { grid-template-columns: 1fr; }
  .card { padding: 14px; border-radius: 18px; }
  .experience-row { grid-template-columns: 1fr auto; gap: 2px 16px; padding: 16px 0; font-size: 17px; }
  .experience-row .role { grid-row: 2; color: var(--muted); }
  .experience-row .period { grid-column: 2; grid-row: 1; }
  .about-photo { aspect-ratio: 4 / 3; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .nav { transition: none; }
  .word { opacity: 1; filter: none; transform: none; animation: none; }
  .js [data-fx] { animation: none; }
  .status::before, .viewers-card p::before, .viewers-card { animation: none; }
  .js [data-reveal] { opacity: 1; transform: none; transition: none; }
}
