/* Outfit (SIL Open Font License, see /assets/fonts/OFL-Outfit.txt), hosted on this site */
@font-face { font-family: "Outfit"; font-style: normal; font-weight: 300 900; font-display: swap; src: url("/assets/fonts/outfit-latin-ext.woff2") format("woff2"); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "Outfit"; font-style: normal; font-weight: 300 900; font-display: swap; src: url("/assets/fonts/outfit-latin.woff2") format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }

:root {
  --bg: hsl(0 0% 4%);
  --fg: hsl(0 0% 96%);
  --card: hsl(0 0% 8%);
  --muted: hsl(0 0% 12%);
  --muted-fg: hsl(0 0% 70%);
  --border: hsl(0 0% 20%);
  --primary: hsl(220 30% 65%);
  --primary-fg: hsl(0 0% 4%);
  --radius: 0.5rem;
  --max: 72rem;
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: "Outfit", ui-sans-serif, system-ui, sans-serif;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
main { flex: 1; }
a { color: inherit; }
img, iframe { max-width: 100%; }
img { height: auto; }
h1, h2, h3 { line-height: 1.15; margin: 0; letter-spacing: -0.02em; }
p { margin: 0 0 1rem; }
code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.9em;
  background: var(--muted);
  padding: 0.1em 0.35em;
  border-radius: 0.25rem;
}

.container { width: 100%; max-width: var(--max); margin: 0 auto; padding: 0 1rem; }
.container.narrow { max-width: 56rem; }
@media (min-width: 640px) { .container { padding: 0 1.5rem; } }

/* Header */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: hsl(0 0% 4% / 0.8);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid hsl(0 0% 20% / 0.5);
}
.site-header .container { display: flex; align-items: center; justify-content: space-between; height: 4rem; }
.brand { display: inline-flex; align-items: center; gap: 0.35rem; font-weight: 700; font-size: 1.15rem; text-decoration: none; }
.brand span {
  background: linear-gradient(90deg, var(--primary), hsl(220 30% 80%));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
/* Home page: GLSL / Image switch for the background behind the headline (fx/hero.js) */
.brand-wrap { display: flex; align-items: center; gap: 0.9rem; }
.bg-toggle {
  display: inline-flex; padding: 2px; border: 1px solid var(--border); border-radius: 999px;
  background: hsl(0 0% 100% / 0.03);
}
.bg-toggle[hidden] { display: none; }
.bg-toggle button {
  font: inherit; font-size: 0.72rem; font-weight: 600; letter-spacing: 0.04em; line-height: 1;
  padding: 0.38rem 0.65rem; border: 0; border-radius: 999px; cursor: pointer;
  background: none; color: var(--muted-fg); transition: color .15s, background-color .15s;
}
.bg-toggle button:hover:not(:disabled) { color: var(--fg); }
.bg-toggle button[aria-pressed="true"] { background: var(--primary); color: var(--bg); }
.bg-toggle button:disabled { opacity: 0.4; cursor: not-allowed; }
.bg-toggle button:focus-visible { outline: 2px solid var(--primary); outline-offset: 1px; }
@media (max-width: 380px) { .brand-wrap { gap: 0.5rem; } .bg-toggle button { padding: 0.34rem 0.5rem; } }
.nav { display: flex; gap: 1.75rem; }
.nav a { text-decoration: none; font-size: 0.9rem; color: var(--muted-fg); transition: color .15s; }
.nav a:hover, .nav a[aria-current="page"] { color: var(--primary); }
.nav-toggle {
  display: none; background: none; border: 1px solid var(--border); color: var(--fg);
  border-radius: var(--radius); padding: 0.4rem 0.6rem; font: inherit; cursor: pointer;
}
@media (max-width: 700px) {
  .nav-toggle { display: inline-flex; }
  .nav {
    display: none; position: absolute; top: 4rem; left: 0; right: 0;
    flex-direction: column; gap: 0; background: var(--bg); border-bottom: 1px solid var(--border);
  }
  .nav.open { display: flex; }
  .nav a { padding: 0.9rem 1rem; border-top: 1px solid hsl(0 0% 20% / 0.5); }
}

/* Buttons */
.btn {
  display: inline-flex; align-items: center; gap: 0.5rem;
  padding: 0.75rem 1.4rem; border-radius: var(--radius);
  font-weight: 500; font-size: 0.95rem; text-decoration: none;
  border: 1px solid var(--border); background: transparent; color: var(--fg);
  transition: background .15s, border-color .15s, transform .15s; cursor: pointer;
}
.btn:hover { background: var(--muted); }
.btn.primary { background: var(--primary); color: var(--primary-fg); border-color: var(--primary); box-shadow: 0 0 30px hsl(220 30% 65% / 0.25); }
.btn.primary:hover { background: hsl(220 30% 72%); }
.btn.small { padding: 0.45rem 0.8rem; font-size: 0.8rem; }

/* Hero */
.hero { position: relative; overflow: hidden; padding: 7rem 0 6rem; text-align: center; }
.hero:has(.hero-bg) { padding: 1.25rem 0 2.75rem; }
.hero::before {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background-image:
    linear-gradient(hsl(0 0% 100% / 0.03) 1px, transparent 1px),
    linear-gradient(90deg, hsl(0 0% 100% / 0.03) 1px, transparent 1px);
  background-size: 2rem 2rem;
  mask-image: radial-gradient(ellipse at center, #000 30%, transparent 75%);
  -webkit-mask-image: radial-gradient(ellipse at center, #000 30%, transparent 75%);
}
.hero::after {
  content: ""; position: absolute; width: 40rem; height: 40rem; left: 50%; top: 40%;
  transform: translate(-50%, -50%); border-radius: 50%; pointer-events: none;
  background: hsl(220 30% 65% / 0.08); filter: blur(100px);
}
.hero > .container { position: relative; z-index: 1; }
/* Live ocean behind the headline (assets/fx/hero.js); the still shows until it starts */
.hero-bg { position: absolute; inset: 0; z-index: 0; overflow: hidden; background: #05080c; }
.hero-bg img, .hero-bg canvas { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: block; }
/* The shader renders at low resolution for speed; a soft blur hides the pixels. Scaled up a
   touch so the blurred edges stay outside the frame. */
.hero-bg img, .hero-bg canvas { filter: blur(var(--hero-blur, 3px)); transform: scale(1.06); }
.hero-bg canvas { opacity: 0; transition: opacity 1.2s ease; }
.hero.live .hero-bg canvas { opacity: 1; }
/* Phones: the ocean fades out just below the headline, so the intro and buttons sit on black.
   hero.js sets --ocean-end to the headline's bottom edge; desktops keep the full ocean. */
@media (max-width: 700px) {
  .hero-bg {
    -webkit-mask-image: linear-gradient(to bottom, #000 calc(var(--ocean-end, 100%) - 1.5rem), transparent calc(var(--ocean-end, 100%) + 2.5rem));
            mask-image: linear-gradient(to bottom, #000 calc(var(--ocean-end, 100%) - 1.5rem), transparent calc(var(--ocean-end, 100%) + 2.5rem));
  }
}
.hero-bg::after {
  content: ""; position: absolute; inset: 0;
  background:
    radial-gradient(ellipse 60% 55% at 50% 45%, hsl(0 0% 4% / 0.72), hsl(0 0% 4% / 0.35) 70%, transparent),
    /* fades out from just under the intro line to solid black just below the buttons */
    linear-gradient(to bottom, hsl(0 0% 4% / 0.35), transparent 18%, transparent calc(100% - 9.5rem), var(--bg) calc(100% - 2.5rem));
}
.hero:has(.hero-bg)::before, .hero:has(.hero-bg)::after { display: none; }
.hero .lead { text-shadow: 0 1px 12px hsl(0 0% 0% / 0.6); }
.pill {
  display: inline-flex; align-items: center; gap: 0.5rem;
  padding: 0.35rem 0.85rem; border-radius: 999px;
  border: 1px solid var(--border); background: hsl(0 0% 8% / 0.6);
  font-size: 0.8rem; color: var(--primary); margin-bottom: 1.75rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}
.hero h1 { font-size: clamp(2.6rem, 8vw, 5.25rem); font-weight: 800; letter-spacing: -0.04em; }
.hero h1 em { font-style: normal; color: var(--primary); }
.hero .lead { max-width: 38rem; margin: 1.75rem auto 2.5rem; color: var(--muted-fg); font-size: 1.15rem; }
.hero .actions { display: flex; gap: 1rem; justify-content: center; flex-wrap: wrap; }

/* Sections */
.section { padding: 5rem 0; }
.section.alt { background: hsl(0 0% 6%); border-top: 1px solid hsl(0 0% 20% / 0.5); border-bottom: 1px solid hsl(0 0% 20% / 0.5); }
.section-head { margin-bottom: 2.5rem; }
.section-head h2 { font-size: clamp(1.8rem, 4vw, 2.4rem); font-weight: 700; }
.section-head p { color: var(--muted-fg); margin-top: 0.75rem; max-width: 40rem; }
.page-head { padding: 4.5rem 0 2.5rem; }
.page-head.tight { padding-top: 1.5rem; padding-bottom: 1.75rem; }
.page-head h1 { font-size: clamp(2.4rem, 6vw, 3.5rem); font-weight: 800; }
.page-head p { color: var(--muted-fg); margin-top: 0.75rem; font-size: 1.1rem; max-width: 40rem; }

/* Cards */
.grid { display: grid; gap: 1.5rem; grid-template-columns: repeat(auto-fill, minmax(18rem, 1fr)); }
.card {
  display: flex; flex-direction: column; background: var(--card);
  border: 1px solid var(--border); border-radius: 1rem; padding: 1.5rem;
  text-decoration: none; transition: border-color .2s, transform .2s;
}
a.card:hover { border-color: hsl(220 30% 65% / 0.6); transform: translateY(-2px); }
.card.has-thumb { padding-top: 0; overflow: hidden; }
.card .thumb {
  display: block; width: calc(100% + 3rem); max-width: none; height: auto; aspect-ratio: 16 / 9;
  object-fit: cover; margin: 0 -1.5rem 1.25rem; border-bottom: 1px solid var(--border);
  transition: transform .3s;
}
a.card:hover .thumb { transform: scale(1.02); }
/* Hover loop over the thumbnail (site.js plays it) */
.card .thumb-wrap {
  position: relative; width: calc(100% + 3rem); margin: 0 -1.5rem 1.25rem; aspect-ratio: 16 / 9;
  overflow: hidden; border-bottom: 1px solid var(--border);
}
.card .thumb-wrap .thumb { width: 100%; margin: 0; border: 0; }
.thumb-clip {
  position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; pointer-events: none;
  opacity: 0; transition: opacity .35s ease, transform .3s;
}
.thumb-clip.playing { opacity: 1; }
a.card:hover .thumb-clip { transform: scale(1.02); }
.grid.films { grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr)); gap: 1rem; }
.card.film { padding: 1.25rem 1.25rem 1.1rem; }
.card.film.has-thumb { padding-top: 0; }
.card.film .thumb { width: calc(100% + 2.5rem); margin: 0 -1.25rem 1rem; }
.card.film .thumb.poster { aspect-ratio: 2 / 3; height: auto; object-fit: cover; }
.card.film h3 { font-size: 1.15rem; margin: 0.35rem 0 0.4rem; }
.film-year { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.8rem; color: var(--primary); }
.card.film p { flex: none; margin: 0; }
.film-role { color: var(--fg) !important; font-size: 0.92rem !important; }
.film-studio { font-size: 0.85rem !important; }
.film-note { font-size: 0.8rem !important; margin-top: 0.6rem !important; padding-top: 0.6rem; border-top: 1px solid hsl(0 0% 20% / 0.6); }
.card h3 { font-size: 1.3rem; font-weight: 600; margin: 0.75rem 0 0.5rem; }
.card p { color: var(--muted-fg); font-size: 0.95rem; flex: 1; }
.card .meta { display: flex; align-items: center; justify-content: space-between; margin-top: 1rem; font-size: 0.85rem; }
.card .more { color: var(--primary); }
/* build.py wraps images in <picture> for AVIF and phone sizes; the box stays the <img>'s */
picture { display: contents; }
.date { color: var(--muted-fg); font-size: 0.85rem; }
/* Post view counts (assets/fx/views.js): empty until the counter answers */
.views:not(:empty)::before { content: " · "; }
.tag {
  display: inline-block; padding: 0.15rem 0.6rem; border-radius: 999px;
  background: var(--muted); color: var(--primary); font-size: 0.75rem; font-weight: 500;
}

/* Media / embeds */
.frame {
  background: var(--card); border: 1px solid var(--border); border-radius: 1rem;
  padding: 0.5rem; box-shadow: 0 20px 40px hsl(0 0% 0% / 0.4); margin-bottom: 2.5rem;
}
@media (min-width: 640px) { .frame { padding: 1rem; } }
.frame-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 0.5rem 0.5rem 1rem; }
.frame-head strong { display: block; font-size: 1.05rem; }
.frame-head span { color: var(--muted-fg); font-size: 0.85rem; }
.embed {
  position: relative; width: 100%; border-radius: 0.75rem; overflow: hidden;
  background: #000; box-shadow: inset 0 0 0 1px var(--border);
}
.embed.game { height: 70vh; min-height: 400px; max-height: 720px; }
.embed.video { aspect-ratio: 16 / 9; }
.embed iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
/* Fill mode: the fallback "fullscreen" for iPhone, which has no Fullscreen API */
.fs-exit {
  display: none; position: absolute; z-index: 2;
  bottom: calc(env(safe-area-inset-bottom, 0px) + 0.6rem); left: 50%; transform: translateX(-50%);
  padding: 0.4rem 0.75rem; opacity: 0.75; border-radius: 999px; border: 1px solid hsl(0 0% 100% / 0.25);
  background: hsl(0 0% 0% / 0.6); color: #fff; font: 500 0.8rem/1 inherit; cursor: pointer;
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
}
.embed.is-filled {
  position: fixed; inset: 0; z-index: 1000; width: 100vw; height: 100vh; height: 100dvh;
  min-height: 0; max-height: none; border-radius: 0; box-shadow: none;
}
.embed.is-filled .fs-exit { display: block; }
html.fs-lock, html.fs-lock body { overflow: hidden; overscroll-behavior: none; }
.frame-note { color: var(--muted-fg); font-size: 0.8rem; padding: 0.75rem 0.5rem 0.25rem; margin: 0; }

/* Article */
.post-head { padding: 3rem 0 2rem; }
.back { display: inline-flex; gap: 0.4rem; color: var(--muted-fg); text-decoration: none; font-size: 0.9rem; margin-bottom: 2rem; }
.back:hover { color: var(--primary); }
.post-head .row { display: flex; gap: 1rem; align-items: center; margin-bottom: 1rem; }
.post-head h1 { font-size: clamp(2.2rem, 5vw, 3.2rem); font-weight: 800; }
.prose { font-size: 1.1rem; color: hsl(0 0% 88%); padding-bottom: 5rem; }
.prose h2 { font-size: 1.6rem; margin: 2.5rem 0 1rem; }
.prose a { color: var(--primary); }
.prose figure { margin: 2rem 0; }
.prose figure img { display: block; width: 100%; height: auto; border-radius: 0.75rem; box-shadow: inset 0 0 0 1px var(--border); }
.prose figcaption { color: var(--muted-fg); font-size: 0.9rem; font-style: italic; margin-top: 0.6rem; }
.prose ul { padding-left: 1.25rem; }
.prose li { margin: 0.4rem 0; }
.prose.before-frame { padding-bottom: 1rem; }
.frame-actions { display: flex; gap: 0.5rem; flex-shrink: 0; }
.embed.game.app { height: 85vh; max-height: 900px; min-height: 560px; }

/* About */
.about-grid { display: grid; gap: 3rem; grid-template-columns: 1fr; padding-bottom: 5rem; }
@media (min-width: 900px) { .about-grid { grid-template-columns: 2fr 1fr; } }
.about-grid .prose { padding-bottom: 0; }
.timeline { list-style: none; margin: 0; padding: 0; border-left: 1px solid var(--border); }
.timeline li { position: relative; padding: 0 0 1.5rem 1.25rem; }
.timeline li::before {
  content: ""; position: absolute; left: -5px; top: 0.45rem; width: 9px; height: 9px;
  border-radius: 50%; background: var(--primary);
}
.timeline .yr { font-size: 0.8rem; color: var(--primary); font-family: ui-monospace, Menlo, monospace; }
.timeline strong { display: block; }
.timeline span { color: var(--muted-fg); font-size: 0.9rem; }
.chips { display: flex; flex-wrap: wrap; gap: 0.5rem; margin: 0.5rem 0 1.5rem; }
.chips span { padding: 0.3rem 0.7rem; border-radius: var(--radius); background: var(--muted); border: 1px solid var(--border); font-size: 0.85rem; }
.side h3 { font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted-fg); margin: 0 0 0.75rem; }

/* Contact */
.contact-list { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fill, minmax(16rem, 1fr)); padding-bottom: 5rem; }
.contact-list .card strong { font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted-fg); font-weight: 500; }
.contact-list .card span { font-size: 1.15rem; margin-top: 0.35rem; word-break: break-word; }

/* Footer */
.site-footer { border-top: 1px solid hsl(0 0% 20% / 0.5); padding: 3.5rem 0 2rem; margin-top: auto; }
.footer-grid { display: grid; gap: 2.5rem; grid-template-columns: 1fr; }
@media (min-width: 700px) { .footer-grid { grid-template-columns: 2fr 1fr 1fr; } }
.site-footer h4 { margin: 0 0 1rem; font-size: 1rem; }
.site-footer p, .site-footer li { color: var(--muted-fg); font-size: 0.9rem; }
.site-footer ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.5rem; }
.site-footer a { text-decoration: none; }
.site-footer a:hover { color: var(--primary); }
.copyright { text-align: center; color: var(--muted-fg); font-size: 0.8rem; margin-top: 3rem; padding-top: 2rem; border-top: 1px solid hsl(0 0% 20% / 0.5); }

/* Blog category tabs */
.tabs { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-bottom: 2rem; }
.tabs[hidden], .card[hidden] { display: none; }
.tab {
  font: inherit; font-size: 0.9rem; cursor: pointer; padding: 0.5rem 1rem; border-radius: 999px;
  border: 1px solid var(--border); background: transparent; color: var(--muted-fg);
  transition: color .15s, border-color .15s, background .15s;
}
.tab:hover { color: var(--fg); border-color: hsl(220 30% 65% / 0.6); }
.tab[aria-selected="true"] { background: var(--primary); border-color: var(--primary); color: var(--primary-fg); }
.tab .count { opacity: 0.65; font-size: 0.8rem; margin-left: 0.15rem; }

/* Shader cards: the real shader fades in over the thumbnail on hover (fx/card-live.js) */
.card .thumb-wrap iframe {
  position: absolute; inset: 0; width: 100%; height: 100%; border: 0; display: block;
  opacity: 0; transition: opacity .4s; pointer-events: none;
}
.card.is-live .thumb-wrap iframe { opacity: 1; }

/* GLSL source panel under live shaders */
.src-panel { margin: -1.5rem 0 2.5rem; border: 1px solid var(--border); border-radius: 1rem; background: var(--card); overflow: hidden; }
.src-panel summary { cursor: pointer; list-style: none; display: flex; align-items: baseline; gap: 0.6rem; padding: 0.9rem 1.1rem; }
.src-panel summary::-webkit-details-marker { display: none; }
.src-panel summary::before { content: "▸"; color: var(--primary); transition: transform .2s; display: inline-block; }
.src-panel[open] summary::before { transform: rotate(90deg); }
.src-panel summary span { font-weight: 600; }
.src-panel summary code { font-size: 0.8rem; }
.src-panel summary em { font-style: normal; color: var(--muted-fg); font-size: 0.85rem; margin-left: auto; }
.src-body { border-top: 1px solid var(--border); }
.src-bar { display: flex; align-items: flex-start; gap: 0.5rem; padding: 0.6rem 0.8rem; flex-wrap: wrap; }
.src-status { margin: 0; flex: 1 1 14rem; align-self: center; font: 0.78rem/1.4 ui-monospace, SFMono-Regular, Menlo, monospace; color: var(--muted-fg); white-space: pre-wrap; max-height: 6rem; overflow: auto; }
.src-status[data-kind="err"] { color: #ff8a8a; }
.src-status[data-kind="ok"] { color: #8be0a4; }
.src-edit { position: relative; height: 28rem; font: 12.5px/1.55 ui-monospace, SFMono-Regular, Menlo, monospace; tab-size: 2; background: hsl(0 0% 5%); }
.src-edit pre, .src-edit textarea {
  position: absolute; inset: 0; margin: 0; padding: 0.9rem 1rem; border: 0; overflow: auto;
  font: inherit; white-space: pre; tab-size: inherit; letter-spacing: 0;
}
.src-edit pre { pointer-events: none; color: hsl(0 0% 82%); scrollbar-width: none; }
.src-edit pre::-webkit-scrollbar { display: none; }
.src-edit pre code { background: none; padding: 0; font: inherit; border-radius: 0; }
.src-edit textarea { color: transparent; background: transparent; caret-color: #fff; resize: none; outline: none; }
.src-edit textarea::selection { background: hsl(220 60% 60% / .35); color: transparent; }
.src-hl .c { color: hsl(220 10% 50%); font-style: italic; }
.src-hl .p { color: hsl(300 45% 72%); }
.src-hl .n { color: hsl(30 85% 68%); }
.src-hl .k { color: hsl(330 75% 72%); }
.src-hl .t { color: hsl(190 70% 65%); }
.src-hl .f { color: hsl(220 70% 75%); }
.src-hl .u { color: hsl(50 80% 70%); }

/* Breakdown sliders (Portfolio) */
.compare-card { margin: 0 0 2.5rem; }
.compare { position: relative; border-radius: 1rem; overflow: hidden; border: 1px solid var(--border); background: #000; touch-action: pan-y; user-select: none; }
.compare img { display: block; width: 100%; height: auto; }
.compare-before { position: absolute; inset: 0; height: 100%; object-fit: cover; clip-path: inset(0 calc(100% - var(--pos)) 0 0); }
.compare-handle { position: absolute; top: 0; bottom: 0; left: var(--pos); width: 2px; margin-left: -1px; background: #fff; box-shadow: 0 0 12px hsl(0 0% 0% / .6); pointer-events: none; }
.compare-handle::after {
  content: "◂ ▸"; position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
  padding: 0.45rem 0.6rem; border-radius: 999px; background: #fff; color: #111; font-size: 0.75rem; white-space: nowrap; letter-spacing: 0.1em;
}
.compare-range { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: ew-resize; }
.compare-range:focus-visible + .compare-handle, .compare:has(.compare-range:focus-visible) .compare-handle { outline: 2px solid var(--primary); }
.compare-tag { position: absolute; top: 0.75rem; padding: 0.25rem 0.6rem; border-radius: 999px; background: hsl(0 0% 0% / .6); color: #fff; font-size: 0.75rem; pointer-events: none; }
.compare-tag.left { left: 0.75rem; } .compare-tag.right { right: 0.75rem; }
.compare-card figcaption { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 0.75rem; align-items: center; margin-top: 0.75rem; }
.compare-card figcaption span { color: var(--muted-fg); font-size: 0.9rem; }
.compare-card .chips { display: flex; gap: 0.4rem; flex-wrap: wrap; }
.compare-card .chip { font: inherit; font-size: 0.8rem; padding: 0.3rem 0.75rem; border-radius: 999px; border: 1px solid var(--border); background: transparent; color: var(--muted-fg); cursor: pointer; }
.compare-card .chip[aria-pressed="true"] { background: var(--primary); color: var(--primary-fg); border-color: var(--primary); }

/* Page transitions (same-origin navigations; browsers without support just navigate) */
@view-transition { navigation: auto; }
.site-header { view-transition-name: site-header; }
::view-transition-group(*) { animation-duration: 0.38s; animation-timing-function: cubic-bezier(.2, .8, .2, 1); }
::view-transition-old(root) { animation: 0.2s ease both vt-out; }
::view-transition-new(root) { animation: 0.3s ease 0.05s both vt-in; }
::view-transition-old(*), ::view-transition-new(*) { height: 100%; object-fit: cover; }
@keyframes vt-out { to { opacity: 0; transform: translateY(-6px); } }
@keyframes vt-in { from { opacity: 0; transform: translateY(8px); } }
@media (prefers-reduced-motion: reduce) { @view-transition { navigation: none; } }

/* Notched phones held sideways (viewport-fit=cover): keep the page clear of the notch, and let
   a filled game run edge to edge with its own picture kept clear of it. */
.container { padding-left: max(1rem, env(safe-area-inset-left)); padding-right: max(1rem, env(safe-area-inset-right)); }
@media (min-width: 640px) { .container { padding-left: max(1.5rem, env(safe-area-inset-left)); padding-right: max(1.5rem, env(safe-area-inset-right)); } }
.embed.is-filled iframe { left: env(safe-area-inset-left, 0px); width: calc(100% - env(safe-area-inset-left, 0px) - env(safe-area-inset-right, 0px)); }
@media (orientation: landscape) and (max-height: 540px) {
  .embed.is-filled .fs-exit { left: auto; right: calc(env(safe-area-inset-right, 0px) + 0.6rem); bottom: 0.6rem; transform: none; }
}

/* Locked posts (build.py locked_body, assets/fx/unlock.js) */
.lock-ico { display: inline-block; vertical-align: -0.12em; flex: none; }
.card.is-locked { position: relative; }
.lock-badge {
  position: absolute; top: 0.75rem; right: 0.75rem; z-index: 2; display: inline-flex; align-items: center; gap: 0.35rem;
  padding: 0.25rem 0.65rem; border-radius: 999px; font-size: 0.75rem; font-weight: 600; color: #fff;
  background: hsl(0 0% 0% / 0.65); border: 1px solid hsl(0 0% 100% / 0.2); backdrop-filter: blur(6px);
}
.card .more .lock-ico { opacity: 0.85; }
.lock-tag { display: inline-flex; align-items: center; gap: 0.3rem; }
.lock-box {
  text-align: center; background: var(--card); border: 1px solid var(--border); border-radius: 1rem;
  padding: 2.5rem 1.5rem 2rem; margin-bottom: 5rem;
}
.lock-big {
  display: inline-grid; place-items: center; width: 4.5rem; height: 4.5rem; border-radius: 50%;
  background: var(--muted); color: var(--primary); margin-bottom: 1rem;
}
.lock-box h2 { font-size: 1.5rem; margin-bottom: 0.75rem; }
.lock-box p { color: var(--muted-fg); max-width: 32rem; margin: 0 auto 0.5rem; }
.lock-form { display: flex; gap: 0.5rem; justify-content: center; flex-wrap: wrap; margin-top: 1.25rem; }
.lock-form input {
  min-width: 0; width: 16rem; padding: 0.6rem 0.9rem; border-radius: 0.6rem; font: inherit;
  background: var(--bg); color: var(--fg); border: 1px solid var(--border);
}
.lock-form input:focus { outline: 2px solid var(--primary); outline-offset: 1px; }
.lock-box .lock-err { color: #ff7a8a; min-height: 1.5em; margin-top: 0.75rem; }
.lock-box.shake { animation: lock-shake .4s; }
@keyframes lock-shake { 20%, 60% { transform: translateX(-6px); } 40%, 80% { transform: translateX(6px); } }
@media (prefers-reduced-motion: reduce) { .lock-box.shake { animation: none; } }

/* Portfolio: Selected credits, closed until clicked (fx/credits.js animates it).
   The closed bar shows a small fan of posters; opening it cascades the cards in, row by row. */
.credits { margin-bottom: 4rem; }
.credits-head { scroll-margin-top: 5rem; }
.credits-head {
  list-style: none; cursor: pointer; position: relative; overflow: hidden;
  display: flex; align-items: center; gap: 1.5rem; padding: 1.6rem 1.75rem;
  border: 1px solid var(--border); border-radius: 1rem;
  background: radial-gradient(120% 140% at 100% 50%, hsl(220 30% 65% / 0.10), transparent 60%), var(--card);
  transition: border-color .3s, box-shadow .3s;
}
.credits-head::-webkit-details-marker { display: none; }
.credits-head:hover { border-color: hsl(220 30% 65% / 0.55); box-shadow: 0 18px 50px -20px hsl(220 40% 40% / 0.45); }
.credits-head:focus-visible { outline: 2px solid var(--primary); outline-offset: 3px; }
.credits-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 0.5rem; }
.credits-title { font-size: clamp(1.8rem, 4vw, 2.4rem); font-weight: 700; line-height: 1.1; }
.credits-sub { color: var(--muted-fg); max-width: 40rem; }
.credits-peek { display: flex; align-items: center; padding-left: 1.2rem; flex: none; }
.credits-peek img {
  width: 3rem; height: auto; aspect-ratio: 2 / 3; object-fit: cover; margin-left: -1.2rem; border-radius: 0.35rem;
  border: 1px solid hsl(0 0% 100% / 0.14); box-shadow: 0 8px 22px hsl(0 0% 0% / 0.6);
  transform: rotate(calc((var(--k) - 2) * 5deg)) translateY(calc(var(--k) * var(--k) * 0.6px - var(--k) * 2.4px));
  transition: transform .55s cubic-bezier(.2, .8, .2, 1), opacity .35s, margin .55s cubic-bezier(.2, .8, .2, 1);
}
.credits-head:hover .credits-peek img { margin-left: -0.55rem; transform: rotate(calc((var(--k) - 2) * 8deg)) translateY(-3px); }
.credits[open] .credits-peek img { opacity: 0; transform: translateY(14px) scale(0.85); }
.credits-cta {
  flex: none; display: inline-flex; align-items: center; gap: 0.5rem; padding: 0.5rem 0.6rem 0.5rem 0.95rem;
  border: 1px solid var(--border); border-radius: 999px; font-size: 0.85rem; color: var(--muted-fg);
  transition: color .25s, border-color .25s, background-color .25s;
}
.credits-head:hover .credits-cta { color: var(--fg); border-color: hsl(220 30% 65% / 0.55); background: hsl(220 30% 65% / 0.08); }
.credits-cta svg { transition: transform .5s cubic-bezier(.2, .8, .2, 1); }
.credits[open] .credits-cta svg { transform: rotate(180deg); }
.credits-body { padding-top: 1.5rem; }
.credits[open] .card.film { animation: credit-in .75s cubic-bezier(.2, .75, .25, 1) both; animation-delay: var(--d, calc(var(--i) * 30ms)); }
.credits[open] .card.film .thumb.poster { animation: poster-in .9s cubic-bezier(.2, .75, .25, 1) both; animation-delay: calc(var(--d, calc(var(--i) * 30ms)) + 60ms); }
.credits.closing .card.film { animation: credit-out .28s ease-in both; animation-delay: 0ms; }
@keyframes credit-in { from { opacity: 0; transform: translateY(26px) scale(0.96); filter: blur(6px); } to { opacity: 1; transform: none; filter: none; } }
@keyframes poster-in { from { clip-path: inset(0 0 100% 0); transform: scale(1.08); } to { clip-path: inset(0); transform: none; } }
@keyframes credit-out { to { opacity: 0; transform: translateY(10px) scale(0.98); } }
@media (max-width: 700px) {
  .credits-head { flex-wrap: wrap; gap: 1rem; padding: 1.3rem 1.25rem; }
  .credits-text { flex-basis: 100%; }
  .credits-peek { order: 2; }
  .credits-cta { order: 3; margin-left: auto; }
}
@media (prefers-reduced-motion: reduce) {
  .credits[open] .card.film, .credits[open] .card.film .thumb.poster, .credits.closing .card.film { animation: none; }
  .credits-peek img, .credits-cta svg { transition: none; }
}

/* Header search button and the command palette (fx/palette.js) */
.site-header .container { gap: 1rem; }
.search-btn {
  margin-left: auto; display: inline-flex; align-items: center; gap: 0.5rem; height: 2.1rem; padding: 0 0.55rem 0 0.7rem;
  border: 1px solid var(--border); border-radius: 999px; background: hsl(0 0% 100% / 0.03); color: var(--muted-fg);
  font: inherit; font-size: 0.8rem; cursor: pointer; transition: color .15s, border-color .15s, background-color .15s;
}
.search-btn:hover { color: var(--fg); border-color: hsl(220 30% 65% / 0.55); background: hsl(220 30% 65% / 0.08); }
.search-btn:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.search-kbd, .palette kbd {
  font: 600 0.68rem/1 inherit; font-family: inherit; padding: 0.22rem 0.38rem; border-radius: 0.3rem;
  border: 1px solid var(--border); background: var(--muted); color: var(--muted-fg);
}
.nav { margin-left: 0.75rem; }
@media (max-width: 900px) { .search-label, .search-kbd { display: none; } .search-btn { padding: 0; width: 2.1rem; justify-content: center; } }
@media (max-width: 700px) { .nav { margin-left: 0; } }
html.pal-open { overflow: hidden; }
.palette {
  width: min(40rem, calc(100vw - 2rem)); max-width: none; max-height: none; margin: 12vh auto auto; padding: 0;
  border: 0; background: none; color: var(--fg); overflow: visible;
}
.palette::backdrop { background: hsl(0 0% 0% / 0.55); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); }
.palette[open] .pal-box { animation: pal-in .22s cubic-bezier(.2, .8, .2, 1); }
.palette[open]::backdrop { animation: pal-fade .22s ease; }
@keyframes pal-in { from { opacity: 0; transform: translateY(-10px) scale(0.98); } }
@keyframes pal-fade { from { opacity: 0; } }
.pal-box {
  border: 1px solid hsl(0 0% 100% / 0.12); border-radius: 1rem; overflow: hidden;
  background: hsl(0 0% 7% / 0.92); backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px);
  box-shadow: 0 30px 80px -20px hsl(0 0% 0% / 0.8), 0 0 0 1px hsl(220 30% 65% / 0.08);
}
.pal-bar { display: flex; align-items: center; gap: 0.7rem; padding: 0.95rem 1.1rem; border-bottom: 1px solid var(--border); color: var(--muted-fg); }
.pal-bar input { flex: 1; min-width: 0; border: 0; outline: 0; background: none; color: var(--fg); font: inherit; font-size: 1.05rem; }
.pal-bar input::placeholder { color: hsl(0 0% 55%); }
.pal-list { list-style: none; margin: 0; padding: 0.4rem; max-height: min(26rem, 55vh); overflow-y: auto; overscroll-behavior: contain; }
.pal-group { padding: 0.7rem 0.75rem 0.3rem; font-size: 0.7rem; letter-spacing: 0.08em; text-transform: uppercase; color: hsl(0 0% 55%); }
.pal-item { display: flex; flex-direction: column; gap: 0.1rem; padding: 0.55rem 0.75rem; border-radius: 0.55rem; cursor: pointer; }
.pal-item.is-sel { background: hsl(220 30% 65% / 0.16); box-shadow: inset 2px 0 0 var(--primary); }
.pal-t { font-size: 0.95rem; }
.pal-d { font-size: 0.8rem; color: var(--muted-fg); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pal-empty { padding: 1.5rem 0.9rem; color: var(--muted-fg); font-size: 0.9rem; }
.pal-foot { display: flex; gap: 1.1rem; padding: 0.6rem 1.1rem; border-top: 1px solid var(--border); font-size: 0.75rem; color: hsl(0 0% 55%); }
.pal-foot kbd { margin-right: 0.2rem; }
@media (max-width: 700px) { .pal-foot { display: none; } .palette { margin-top: 5vh; } }
@media (prefers-reduced-motion: reduce) { .palette[open] .pal-box, .palette[open]::backdrop { animation: none; } }
/* A credit found through the palette glows briefly */
.card.film.is-found { animation: found-glow 2.2s ease-out; }
@keyframes found-glow { 0%, 30% { border-color: var(--primary); box-shadow: 0 0 0 3px hsl(220 30% 65% / 0.35), 0 0 40px hsl(220 30% 65% / 0.35); } 100% { box-shadow: none; } }

/* Home screensaver (fx/hero.js): the page dims to black, then the live ocean rises full screen */
.dream-veil {
  position: fixed; inset: 0; z-index: 300; pointer-events: none; background: #000;
  opacity: 0; visibility: hidden; transition: opacity .45s ease, visibility 0s .45s;
}
html.dream-dim .dream-veil { opacity: 1; visibility: visible; transition: opacity 1.4s ease; }
html.dream .hero-bg {
  position: fixed; inset: 0; z-index: 301; -webkit-mask-image: none; mask-image: none;
  animation: dream-up 2.6s ease both;
}
html.dream .hero-bg::after { background: radial-gradient(ellipse 90% 80% at 50% 45%, transparent 55%, hsl(0 0% 0% / 0.55)); }
html.dream .hero-bg img, html.dream .hero-bg canvas { filter: none; transform: none; }
@keyframes dream-up { from { opacity: 0; } }
.dream-ui {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 302; pointer-events: none; display: none;
  justify-content: space-between; align-items: flex-end; padding: 0 2rem calc(1.75rem + env(safe-area-inset-bottom));
}
html.dream .dream-ui { display: flex; }
.dream-mark { font-weight: 700; font-size: 1.05rem; letter-spacing: 0.02em; color: hsl(0 0% 100% / 0.75); animation: dream-up 1.2s 1.5s ease both; }
.dream-hint { font-size: 0.8rem; color: hsl(0 0% 100% / 0.55); animation: dream-hint 6s 1.8s ease both; }
@keyframes dream-hint { 0% { opacity: 0; } 15%, 70% { opacity: 1; } 100% { opacity: 0; } }

/* 404: "404" in particles you can push around (fx/lost.js) */
.lost { position: relative; height: clamp(12rem, 38vw, 22rem); margin-top: 2.5rem; }
.lost canvas { position: absolute; inset: 0; width: 100%; height: 100%; touch-action: none; cursor: crosshair; opacity: 0; transition: opacity .8s; }
.lost-title { position: absolute; inset: 0; display: grid; place-items: center; margin: 0; font-size: clamp(8rem, 30vw, 17rem); font-weight: 800; letter-spacing: -0.04em; color: var(--primary); transition: opacity .6s; }
.lost.is-live canvas { opacity: 1; }
.lost.is-live .lost-title { opacity: 0; }
.lost-head { padding-top: 1rem; padding-bottom: 1.25rem; text-align: center; }
.lost-head p { margin-left: auto; margin-right: auto; }
.lost-play { font-size: 0.9rem !important; color: hsl(0 0% 55%) !important; }
.lost-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 0.75rem; padding-bottom: 5rem; }

/* Forms: contact form and new-post sign-up (fx/forms.js) */
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.hp { position: absolute; left: -10000px; width: 1px; height: 1px; opacity: 0; }
.contact-form { display: grid; gap: 1rem; padding: 1.5rem; margin-bottom: 3.5rem; border: 1px solid var(--border); border-radius: 1rem; background: var(--card); }
.field-row { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr)); }
.field { display: grid; gap: 0.4rem; }
.field span { font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted-fg); }
.contact-form input, .contact-form textarea, .signup input[type=email] {
  width: 100%; font: inherit; font-size: 1rem; color: var(--fg); background: hsl(0 0% 4%);
  border: 1px solid var(--border); border-radius: 0.6rem; padding: 0.75rem 0.9rem;
  transition: border-color .15s, box-shadow .15s;
}
.contact-form textarea { resize: vertical; min-height: 9rem; line-height: 1.5; }
.contact-form input:focus, .contact-form textarea:focus, .signup input[type=email]:focus {
  outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px hsl(220 30% 65% / 0.2);
}
.form-foot { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; }
.form-status { margin: 0; font-size: 0.9rem; color: var(--muted-fg); }
.form-status[data-state=ok] { color: hsl(150 45% 65%); }
.form-status[data-state=error] { color: hsl(355 70% 72%); }
.btn:disabled { opacity: 0.6; cursor: progress; }
.contact-or { font-size: 1.1rem; font-weight: 600; margin: 0 0 1rem; color: var(--muted-fg); }
.signup {
  display: grid; gap: 0.9rem; padding: 1.5rem; margin: 0 0 5rem; border: 1px solid var(--border); border-radius: 1rem;
  background: radial-gradient(120% 140% at 100% 0%, hsl(220 30% 65% / 0.10), transparent 60%), var(--card);
}
.signup-text { display: grid; gap: 0.3rem; }
.signup-text strong { font-size: 1.15rem; }
.signup-text span { color: var(--muted-fg); font-size: 0.92rem; }
.signup-text a { color: var(--primary); }
.signup-row { display: flex; gap: 0.6rem; flex-wrap: wrap; }
.signup-row input[type=email] { flex: 1 1 14rem; width: auto; }
.signup.is-sent .signup-row { opacity: 0.6; }
/* The post body has its own bottom padding; pull the sign-up up under it */
.prose + .signup, .frame + .signup { margin-top: -2rem; }

/* GPU benchmark under a live shader (fx/bench.js) */
.bench { margin: 0.75rem 0.5rem 0.25rem; padding: 1rem 1.1rem; border: 1px solid var(--border); border-radius: 0.75rem; background: hsl(0 0% 5%); }
.bench-top { display: flex; align-items: baseline; gap: 0.75rem; flex-wrap: wrap; }
.bench-badge { font-size: 0.72rem; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; padding: 0.2rem 0.5rem; border-radius: 999px; align-self: center; }
.bench-badge.great { background: hsl(150 45% 45% / 0.18); color: hsl(150 45% 68%); }
.bench-badge.ok { background: hsl(40 70% 50% / 0.18); color: hsl(40 75% 68%); }
.bench-badge.slow { background: hsl(355 70% 55% / 0.18); color: hsl(355 70% 72%); }
.bench-fps { font-size: 1.6rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.bench-fps small { font-size: 0.85rem; font-weight: 500; color: var(--muted-fg); }
.bench-ms { font-size: 0.82rem; color: var(--muted-fg); }
.bench-meter { height: 6px; border-radius: 999px; background: var(--muted); overflow: hidden; margin: 0.7rem 0 0.6rem; }
.bench-meter i { display: block; height: 100%; border-radius: inherit; transition: width .8s cubic-bezier(.2, .8, .2, 1); }
.bench-meter i.great { background: linear-gradient(90deg, hsl(150 45% 40%), hsl(150 50% 60%)); }
.bench-meter i.ok { background: linear-gradient(90deg, hsl(40 70% 45%), hsl(40 80% 62%)); }
.bench-meter i.slow { background: linear-gradient(90deg, hsl(355 60% 45%), hsl(355 70% 62%)); }
.bench-meter i.run { width: 100%; background: linear-gradient(90deg, transparent, var(--primary), transparent); background-size: 50% 100%; background-repeat: no-repeat; animation: bench-run 1.1s linear infinite; }
@keyframes bench-run { from { background-position: -50% 0; } to { background-position: 150% 0; } }
.bench-gpu { margin: 0; font-size: 0.85rem; color: var(--fg); }
.bench-when { color: var(--muted-fg); }
.bench-tip { margin: 0.4rem 0 0; font-size: 0.85rem; color: var(--muted-fg); }
.bench-run span { font-size: 0.9rem; color: var(--muted-fg); }
@media (max-width: 640px) { .frame-actions { flex-wrap: wrap; justify-content: flex-end; } }
