/* ==========================================================================
   andrewkunk.com: one stylesheet
   1. tokens   2. base   3. layout + rails   4. components
   5. pages    6. case studies   7. effects + fun   8. motion prefs
   ========================================================================== */

/* 1. TOKENS ---------------------------------------------------------------- */
:root {
    --bg: hsl(0 0% 85%);
    --fg: #111;
    --muted: #4d4d4d;
    --accent: hsl(240 100% 40%);
    --accent-hover: hsl(240 100% 62%);
    --surface: hsl(0 0% 62%);
    --surface-soft: hsl(0 0% 79%);
    --line: color-mix(in srgb, var(--fg) 85%, transparent);
    --ok: hsl(120 100% 27%);

    --mono: "Source Code Pro", ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
    --sans: "Raleway", "Helvetica Neue", Helvetica, Arial, sans-serif;

    --rail: 4.75rem;
    --gutter: clamp(1rem, 4vw, 3rem);
    --measure: 72rem;
    --radius-xl: clamp(2rem, 5vw, 4rem);
    --radius: 2rem;
    --ease: cubic-bezier(.2, .8, .2, 1);

    color-scheme: light;
}

:root[data-theme="dark"] {
    --bg: #111;
    --fg: #ddd;
    --muted: #a3a3a3;
    --accent: hsl(240 100% 74%);
    --accent-hover: hsl(240 100% 84%);
    --surface: #222;
    --surface-soft: #1a1a1a;
    --ok: hsl(120 100% 42%);
    color-scheme: dark;
}

/* 2. BASE ------------------------------------------------------------------ */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }

html {
    background: var(--bg);
    color: var(--fg);
    font-family: var(--mono);
    font-size: 100%;
    line-height: 1.55;
    scrollbar-width: thin;
    -webkit-text-size-adjust: 100%;
    scroll-padding-top: 5rem;
}
@media (prefers-reduced-motion: no-preference) { html { scroll-behavior: smooth; } }

body {
    min-height: 100vh;
    font-size: clamp(1rem, .95rem + .25vw, 1.125rem);
    text-rendering: optimizeLegibility;
    -webkit-font-smoothing: antialiased;
}

img, svg, video, iframe { display: block; max-width: 100%; }
img { height: auto; }

h1, h2, h3, h4, h5, h6 { font-weight: 800; line-height: 1.1; letter-spacing: -.02em; text-wrap: balance; }
h1 { font-size: clamp(2.5rem, 6vw + 1rem, 5.5rem); }
h2 { font-size: clamp(1.9rem, 3vw + 1rem, 3.25rem); }
h3 { font-size: clamp(1.4rem, 1.5vw + 1rem, 2rem); }
h4 { font-size: 1.35rem; }
h5, h6 { font-size: 1.1rem; }
p { text-wrap: pretty; }

a { color: inherit; text-decoration-thickness: 1px; text-underline-offset: .2em; }
a:hover { color: var(--accent); cursor: crosshair; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: crosshair; }

:focus-visible { outline: 2px solid var(--accent-hover); outline-offset: 3px; border-radius: 4px; }
::selection { background: var(--accent); color: var(--bg); }

hr { border: 0; border-top: 1px solid var(--line); margin-block: 2rem; }

.icon { width: 1em; height: 1em; display: inline-block; vertical-align: -.125em; flex: none; }

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

.skip-link {
    position: fixed; z-index: 100; top: .75rem; left: 50%; translate: -50% -200%;
    background: var(--fg); color: var(--bg); padding: .6rem 1.2rem; border-radius: 99px;
    text-decoration: none; transition: translate .2s var(--ease);
}
.skip-link:focus { translate: -50% 0; }

/* 3. LAYOUT + RAILS ------------------------------------------------------- */
.container {
    width: min(100% - 2 * var(--gutter), var(--measure));
    margin-inline: auto;
}
.container--narrow { --measure: 46rem; }

main { display: block; padding-block: 2rem 4rem; }
section + section, .section { margin-top: clamp(4rem, 10vw, 8rem); }

@media (min-width: 60rem) {
    body { padding-inline: var(--rail); }
    .topbar { display: none !important; }
}
@media (max-width: 59.99rem) {
    .rail { display: none !important; }
    body { padding-top: 4rem; }
}

.rail {
    position: fixed; z-index: 20; top: 0; bottom: 0;
    width: var(--rail);
    display: flex; flex-direction: column; align-items: center;
    padding-block: 1.5rem;
    background: var(--bg);
}
.rail--left { left: 0; border-right: 1px solid var(--line); }
.rail--right { right: 0; border-left: 1px solid var(--line); gap: 1.6rem; }

/* vertical text that reads bottom-to-top, like the original rotated headers */
.rail__brand, .rail__link {
    writing-mode: vertical-rl; transform: rotate(180deg);
    text-decoration: none; white-space: nowrap;
    font-size: 1.1rem; letter-spacing: .02em;
}
.rail__brand { font-weight: 800; font-size: 1.35rem; }
/* studio page: the brand link cycles through studio.kunk logos on hover (logo-cycle.js).
   The link is already rotated 180deg for vertical text; rotating the SVG 90deg more
   makes the wordmark read bottom-to-top, matching the rail text. */
.rail__brand.has-logo { position: relative; display: block; width: 1.9rem; height: 8.75rem; text-decoration: none; }
.brand-logo .kunk-logo {
    position: absolute; top: 50%; left: 50%; width: 8.75rem; max-width: none; height: auto;
    translate: -50% -50%; rotate: 90deg;
    animation: logo-in .35s var(--ease);
}
@keyframes logo-in { from { opacity: 0; scale: .7; } }
.rail__brand:hover, .rail__link:hover, .rail__link:focus-visible,
.rail [aria-current="page"] {
    text-decoration: underline solid var(--accent-hover) 3px; text-underline-offset: .35em;
}
.rail [aria-current="page"] { color: var(--accent); }

.rail__ruler {
    flex: 1; width: 14px; margin-block: 1.5rem; position: relative;
    background:
        repeating-linear-gradient(to bottom, var(--line) 0 1px, transparent 1px 10px) right / 6px 100% no-repeat,
        repeating-linear-gradient(to bottom, var(--line) 0 1px, transparent 1px 50px) right / 14px 100% no-repeat;
    opacity: .7;
}
.rail__progress {
    position: absolute; inset: 0 auto 0 0; width: 3px; border-radius: 3px;
    background: var(--accent);
    transform-origin: top; transform: scaleY(var(--progress, 0));
}

.rail__nav { list-style: none; padding: 0; display: flex; flex-direction: column; gap: 1.6rem; flex: 1; }

.rail__face img { width: 2rem; height: 2rem; image-rendering: pixelated; transition: transform .25s var(--ease); }
.rail__face:hover img, .rail__face:focus-visible img { transform: scale(2.2) rotate(-8deg); }

.theme-toggle { font-size: 1.25rem; display: inline-grid; place-items: center; }
.theme-toggle .icon { transition: transform .5s var(--ease); }
.theme-toggle:hover .icon { transform: rotate(90deg); }
[data-theme="dark"] .icon--moon, [data-theme="light"] .icon--sun,
:root:not([data-theme]) .icon--sun { display: none; }

/* mobile top bar + menu sheet */
.topbar {
    position: fixed; z-index: 20; inset: 0 0 auto 0; height: 4rem;
    display: flex; align-items: center; justify-content: space-between;
    padding-inline: 1rem; background: var(--bg); border-bottom: 1px solid var(--line);
}
.topbar__brand { font-weight: 800; text-decoration: none; font-size: 1.1rem; }
.topbar__btn { display: grid; place-items: center; width: 2.75rem; height: 2.75rem; font-size: 1.25rem; }
.topbar__btn img { image-rendering: pixelated; }

.sheet {
    width: 100%; max-width: none; height: 100%; max-height: none; margin: 0;
    border: 0; padding: 5rem var(--gutter) 2rem;
    background: var(--bg); color: var(--fg);
}
.sheet { opacity: 0; translate: 0 -1rem; transition: opacity .3s, translate .35s var(--ease), display .35s allow-discrete, overlay .35s allow-discrete; }
.sheet[open] { display: flex; flex-direction: column; opacity: 1; translate: 0 0; }
@starting-style { .sheet[open] { opacity: 0; translate: 0 -1rem; } }
.sheet__close { position: absolute; top: 1rem; left: 1rem; font-size: 1.6rem; width: 2.75rem; height: 2.75rem; display: grid; place-items: center; }
.sheet__nav { list-style: none; padding: 0; display: grid; gap: .25rem; }
.sheet__nav a { font-size: clamp(2rem, 9vw, 3rem); font-weight: 800; text-decoration: none; }
.sheet__nav [aria-current="page"] { color: var(--accent); }
.sheet__nav [aria-current="page"]::after { content: " ←"; font-weight: 300; }
.sheet__actions { margin-top: auto; display: flex; gap: .75rem; flex-wrap: wrap; }

/* 4. COMPONENTS ------------------------------------------------------------ */
.eyebrow {
    font-size: .8rem; font-weight: 600; letter-spacing: .15em; text-transform: uppercase;
    color: var(--muted); margin-bottom: .75rem;
}
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.lede { font-size: clamp(1.15rem, 1rem + .8vw, 1.6rem); line-height: 1.45; max-width: 40ch; }
.plain-list { list-style: none; padding: 0; display: grid; gap: .35rem; }

.pill {
    display: inline-flex; align-items: center; gap: .5em;
    padding: .75em 1.5em; border: 1px solid var(--line); border-radius: 99px;
    text-decoration: none; font-weight: 600; line-height: 1.2;
    transition: background .2s, color .2s, border-color .2s, transform .2s var(--ease);
}
.pill:hover { background: var(--fg); color: var(--bg); border-color: var(--fg); }
.pill:active { transform: scale(.97); }
.pill--solid { background: var(--accent); border-color: var(--accent); color: #fff; }
.pill--solid:hover { background: var(--fg); border-color: var(--fg); }
.pill--small { font-size: .85rem; padding: .5em 1em; }
.button-row { display: flex; flex-wrap: wrap; gap: .75rem; margin-top: 1.5rem; }
.link-button { text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: .2em; }
.link-button:hover { color: var(--accent); }

.badge {
    display: inline-flex; align-items: center; gap: .6em;
    padding: .4em .9em; border: 1px solid var(--line); border-radius: 99px;
    font-size: .85rem; font-weight: 600;
}
.badge__dot {
    width: .6em; height: .6em; border-radius: 50%; background: var(--ok);
    box-shadow: 0 0 0 0 color-mix(in srgb, var(--ok) 60%, transparent);
    animation: pulse 2s infinite;
}
@keyframes pulse { 70% { box-shadow: 0 0 0 .6em transparent; } 100% { box-shadow: 0 0 0 0 transparent; } }

.tags { list-style: none; padding: 0; display: flex; flex-wrap: wrap; gap: .4rem; }
.tags li { font-size: .75rem; padding: .15em .7em; border: 1px solid var(--line); border-radius: 99px; color: var(--muted); }

.section__head { display: flex; justify-content: space-between; align-items: end; gap: 1rem; flex-wrap: wrap; margin-bottom: 2rem; }
.section__head h2 { max-width: 20ch; }

/* footer */
.site-footer {
    width: min(100% - 2 * var(--gutter), var(--measure)); margin: clamp(4rem, 10vw, 8rem) auto 0;
    border-top: 1px solid var(--line); padding-block: clamp(3rem, 8vw, 6rem) 2rem;
}
.site-footer__big { font-size: clamp(2.2rem, 6vw, 4.5rem); font-weight: 800; line-height: 1.05; letter-spacing: -.03em; max-width: 14ch; }
.site-footer__big em { font-style: normal; color: var(--accent); }
.site-footer__grid {
    display: grid; gap: 2rem; margin-top: 4rem;
    grid-template-columns: repeat(auto-fit, minmax(12rem, 1fr));
}
.site-footer__grid a { text-decoration: none; }
.site-footer__grid a:hover, .site-footer__grid [aria-current="page"] { text-decoration: underline solid var(--accent-hover) 2px; }
.clock { font-size: 1.25rem; font-weight: 600; }
.clock span { font-variant-numeric: tabular-nums; }
.site-footer__credits { margin-top: 4rem; text-align: center; font-size: .85rem; font-weight: 600; }
.site-footer__credits .icon { color: hsl(350 90% 55%); }
.konami-hint { display: block; margin-top: .4rem; opacity: .25; letter-spacing: .3em; font-weight: 400; }

/* dialogs ------------------------------------------------------------------
   Every popup is a native <dialog>, opened with Invoker Commands
   (commandfor + command="show-modal"). The browser handles the top layer,
   focus trapping, Esc and the inert background; CSS does the rest.         */

/* The global `* { margin: 0 }` reset removes the browser's `margin: auto`,
   which is what centers a modal dialog. Restore it explicitly.             */
dialog {
    position: fixed; inset: 0; margin: auto;
    max-width: calc(100vw - 2rem); max-height: calc(100dvh - 2rem);
    color: var(--fg); background: var(--bg);
    overscroll-behavior: contain;
}

/* lock page scroll while a modal is open. (No scrollbar-gutter here: a reserved
   gutter shrinks the top layer, leaving an undimmed strip and an off-center dialog.
   The tiny content shift happens behind the blurred backdrop, so it isn't seen.) */
html:has(dialog:modal) { overflow: hidden; }

/* enter + exit animation in pure CSS: @starting-style for the entry,
   allow-discrete so display/overlay wait for the exit transition to finish */
.modal, .lightbox {
    opacity: 0; scale: .94; translate: 0 1.25rem;
    transition:
        opacity .25s ease, scale .35s var(--ease), translate .35s var(--ease),
        display .35s allow-discrete, overlay .35s allow-discrete;
}
.modal[open], .lightbox[open] { opacity: 1; scale: 1; translate: 0 0; }
@starting-style {
    .modal[open], .lightbox[open] { opacity: 0; scale: .94; translate: 0 1.25rem; }
}
dialog::backdrop {
    background: rgb(0 0 0 / 0); backdrop-filter: blur(0);
    transition: background .35s, backdrop-filter .35s, display .35s allow-discrete, overlay .35s allow-discrete;
}
dialog[open]::backdrop { background: rgb(0 0 0 / .55); backdrop-filter: blur(4px); }
@starting-style { dialog[open]::backdrop { background: rgb(0 0 0 / 0); backdrop-filter: blur(0); } }

/* contact modal */
.modal {
    width: min(100% - 2rem, 34rem);
    max-height: calc(100dvh - 6rem);  /* leaves room for the head peeking over the top */
    padding: 3.25rem clamp(1.25rem, 5vw, 2.5rem) clamp(1.25rem, 4vw, 2rem);
    border: 1px solid var(--line); border-radius: var(--radius);
    box-shadow: 0 2rem 5rem -2rem rgb(0 0 0 / .45);
    overflow: visible;                /* lets the pixel head peek over the top edge */
    text-align: left;
}
.modal[open] { display: grid; gap: 1.5rem; }
/* the box never scrolls (so the head stays put); only the PGP block does */
.contact { grid-template-rows: auto auto auto minmax(0, 1fr) auto; }
.contact > .pgp { overflow: auto; min-height: 0; scrollbar-width: thin; }

.modal__face {
    position: absolute; top: 0; left: 50%; translate: -50% -55%;
    width: 4rem; height: 4rem; padding: .35rem; image-rendering: pixelated;
    border-radius: 50%; background: var(--bg); border: 1px solid var(--line);
    transition: rotate .4s var(--ease), scale .4s var(--ease);
}
.modal[open] .modal__face { animation: peek .7s var(--ease) .1s both; }
.modal__face:hover { rotate: -12deg; scale: 1.15; }
@keyframes peek { from { translate: -50% 10%; opacity: 0; } }

.modal__close {
    position: absolute; top: .9rem; right: .9rem; z-index: 1;
    width: 2.5rem; height: 2.5rem; display: grid; place-items: center;
    border: 1px solid transparent; border-radius: 50%; font-size: 1.15rem;
    transition: border-color .2s, color .2s, rotate .3s var(--ease);
}
.modal__close:hover, .modal__close:focus-visible { border-color: var(--line); rotate: 90deg; color: var(--accent); }

.modal__head { text-align: center; display: grid; gap: .35rem; justify-items: center; }
.modal__head .eyebrow { margin: 0; }
.modal__title { font-size: clamp(1.9rem, 6vw, 2.6rem); letter-spacing: -.04em; }
.modal__desc { color: var(--muted); font-size: .9rem; max-width: 36ch; text-wrap: balance; }
.modal__desc [data-dc-time] { color: var(--fg); font-weight: 600; font-variant-numeric: tabular-nums; }

.contact-cards { list-style: none; padding: 0; display: grid; gap: .75rem; }
.contact-card {
    display: grid; align-items: center; gap: .15rem 1rem;
    grid-template-columns: auto 1fr; grid-template-areas: "icon label" "icon value" "actions actions";
    padding: 1rem 1.1rem; border: 1px solid var(--line); border-radius: 1.5rem;
    transition: background .2s;
}
.contact-card:hover, .contact-card:focus-within { background: var(--surface-soft); }
.contact-card__icon {
    grid-area: icon; width: 2.75rem; height: 2.75rem; border-radius: 50%;
    display: grid; place-items: center; background: var(--accent); color: #fff; font-size: 1.05rem;
}
.contact-card__label { grid-area: label; font-size: .7rem; font-weight: 600; letter-spacing: .15em; text-transform: uppercase; color: var(--muted); }
.contact-card__value { grid-area: value; font-size: clamp(1.05rem, 3.6vw, 1.25rem); font-weight: 800; overflow-wrap: anywhere; }
.contact-card__actions { grid-area: actions; display: flex; gap: .5rem; flex-wrap: wrap; margin-top: .75rem; }
@media (min-width: 30rem) {
    .contact-card { grid-template-columns: auto 1fr auto; grid-template-areas: "icon label actions" "icon value actions"; }
    .contact-card__actions { margin-top: 0; }
}

.mini-btn {
    display: inline-flex; align-items: center; gap: .45em; white-space: nowrap;
    padding: .5em .95em; border: 1px solid var(--line); border-radius: 99px;
    font-size: .8rem; font-weight: 600; text-decoration: none; line-height: 1.2;
    transition: background .2s, color .2s, border-color .2s, scale .15s;
}
.mini-btn:hover { background: var(--fg); color: var(--bg); border-color: var(--fg); }
.mini-btn:active { scale: .95; }
.mini-btn__idle, .mini-btn__done { display: inline-flex; align-items: center; gap: .45em; }
.mini-btn__done { display: none; }
.mini-btn[data-state="copied"] { background: var(--ok); border-color: var(--ok); color: #fff; }
.mini-btn[data-state="copied"] .mini-btn__idle { display: none; }
.mini-btn[data-state="copied"] .mini-btn__done { display: inline-flex; animation: pop-in .3s var(--ease); }
@keyframes pop-in { from { scale: .6; opacity: 0; } }

.pgp { border-top: 1px solid var(--line); padding-top: 1rem; }
.pgp summary {
    list-style: none; cursor: crosshair; font-weight: 600; font-size: .95rem;
    display: flex; align-items: center; gap: .6rem;
}
.pgp summary::-webkit-details-marker { display: none; }
.pgp summary span { flex: 1; }
.pgp summary::after { content: "+"; font-size: 1.3rem; line-height: 1; color: var(--accent); transition: rotate .25s var(--ease); }
.pgp[open] summary::after { rotate: 45deg; }
.pgp summary:hover span { text-decoration: underline solid var(--accent-hover) 2px; text-underline-offset: .25em; }
.pgp__body { display: grid; gap: .75rem; justify-items: start; padding-top: 1rem; }
.pgp__fp { display: grid; gap: .25rem; }
.pgp__fp .eyebrow { margin: 0; }
.pgp__fp code { font-size: .85rem; font-weight: 600; word-spacing: .2em; }
.pgp pre {
    width: 100%; overflow-x: auto; scrollbar-width: thin;   /* the .pgp section is the one vertical scroller */
    font-size: .68rem; line-height: 1.45; padding: 1rem; border-radius: 1rem; background: var(--surface-soft);
}
/* smooth open/close for <details> where the browser supports it */
@supports (interpolate-size: allow-keywords) {
    .pgp { interpolate-size: allow-keywords; }
    .pgp::details-content { height: 0; overflow: clip; transition: height .35s var(--ease), content-visibility .35s allow-discrete; }
    .pgp[open]::details-content { height: auto; }
}

.modal__foot { display: flex; align-items: center; justify-content: center; gap: .6rem; font-size: .8rem; font-weight: 600; color: var(--muted); }

/* lightbox */
.lightbox {
    width: 100%; height: 100%; max-width: none; max-height: none; margin: 0;
    border: 0; padding: clamp(1rem, 4vw, 3rem); background: transparent; color: #eee;
}
.lightbox[open] { display: grid; place-items: center; }
/* horizontal swipes step through images (lightbox.js), so keep the browser from
   treating them as pans or back/forward navigation; vertical pan + pinch-zoom still work */
.lightbox { touch-action: pan-y pinch-zoom; overscroll-behavior: contain; }
html:has(.lightbox[open]) { overscroll-behavior-x: none; }
.lightbox[open]::backdrop { background: rgb(0 0 0 / .88); }
.lightbox figure { display: grid; gap: .75rem; justify-items: center; max-height: 100%; }
.lightbox img { max-height: calc(100dvh - 8rem); width: auto; border-radius: 1rem; }
.lightbox figcaption { font-size: .9rem; opacity: .8; text-align: center; }
.lightbox .modal__close { position: fixed; color: #fff; }
.lightbox__nav {
    position: fixed; top: 50%; translate: 0 -50%; z-index: 1;
    width: 3rem; height: 3rem; display: grid; place-items: center;
    border: 1px solid rgb(255 255 255 / .25); border-radius: 50%;
    background: rgb(0 0 0 / .45); color: #fff; font-size: 1.15rem;
    transition: border-color .2s, color .2s, scale .2s var(--ease);
}
.lightbox__nav[hidden] { display: none; }
.lightbox__nav:hover, .lightbox__nav:focus-visible { border-color: var(--accent); color: var(--accent); scale: 1.08; }
.lightbox__prev { left: clamp(.5rem, 2vw, 1.5rem); }
.lightbox__next { right: clamp(.5rem, 2vw, 1.5rem); }
@media (max-width: 40rem) {
    /* small screens: buttons sit below the image so they don't cover it */
    .lightbox__nav { top: auto; bottom: 1rem; translate: none; }
}

/* toast: a manual popover, so it renders in the top layer above open dialogs */
.toast {
    position: fixed; inset: auto auto 1.5rem 50%; margin: 0;
    padding: .75rem 1.25rem; border: 0; border-radius: 99px; background: var(--fg); color: var(--bg);
    font-weight: 600; font-size: .9rem; pointer-events: none;
    opacity: 0; translate: -50% 1rem;
    transition: opacity .3s, translate .35s var(--ease), display .35s allow-discrete, overlay .35s allow-discrete;
}
.toast:popover-open { opacity: 1; translate: -50% 0; }
@starting-style { .toast:popover-open { opacity: 0; translate: -50% 1rem; } }

/* tiles + cards (big rounded image blocks with tilt) */
.tiles { display: grid; gap: clamp(1rem, 3vw, 2rem); grid-template-columns: repeat(auto-fit, minmax(min(100%, 22rem), 1fr)); }
.tile {
    position: relative; display: flex; flex-direction: column; justify-content: space-between;
    min-height: clamp(18rem, 45vh, 30rem); padding: clamp(1.5rem, 4vw, 2.75rem);
    border-radius: var(--radius-xl); overflow: hidden; text-decoration: none;
    background-color: var(--surface); background-position: center; background-size: cover; background-repeat: no-repeat;
    transform-style: preserve-3d;
}
.tile::before {
    content: ""; position: absolute; inset: 0; pointer-events: none;
    background: linear-gradient(to bottom, color-mix(in srgb, var(--bg) 55%, transparent), transparent 35%, transparent 55%, color-mix(in srgb, var(--bg) 80%, transparent));
}
.tile > * { position: relative; }
.tile--wide { grid-column: 1 / -1; }
.tile__title { font-size: clamp(2.25rem, 5vw, 3.75rem); font-weight: 800; transform: translateZ(40px); }
.tile__desc { max-width: 28ch; font-weight: 600; transform: translateZ(25px); }
.tile__arrow {
    position: absolute; right: clamp(1.25rem, 3vw, 2.25rem); bottom: clamp(1.25rem, 3vw, 2.25rem);
    width: 3.25rem; height: 3.25rem; border-radius: 50%; display: grid; place-items: center;
    background: var(--bg); color: var(--fg); transition: transform .3s var(--ease), background .2s;
}
.tile:hover { color: var(--fg); }
.tile:hover .tile__arrow { transform: rotate(-45deg) scale(1.1); background: var(--accent); color: #fff; }
.tile:hover .tile__title { text-decoration: underline solid var(--accent-hover) 4px; text-underline-offset: .15em; }

/* blog list */
.post-list { list-style: none; padding: 0; border-top: 1px solid var(--line); }
.post-row { border-bottom: 1px solid var(--line); padding-block: 1.25rem; display: grid; gap: .6rem; }
.post-row > a {
    display: grid; gap: .25rem 2rem; text-decoration: none;
    grid-template-columns: 9rem 1fr auto; align-items: baseline;
}
.post-row time, .post-row__meta { color: var(--muted); font-size: .9rem; }
.post-row__title { font-size: clamp(1.15rem, 1rem + .8vw, 1.6rem); font-weight: 800; }
.post-row > a:hover .post-row__title { color: var(--accent); }
.post-row .tags { padding-left: 11rem; }
@media (max-width: 40rem) {
    .post-row > a { grid-template-columns: 1fr; }
    .post-row .tags { padding-left: 0; }
}

/* 5. PAGES ----------------------------------------------------------------- */
/* home */
.hero { display: grid; gap: 2rem 4rem; align-items: end; padding-top: clamp(1rem, 4vw, 3rem); }
@media (min-width: 52rem) { .hero { grid-template-columns: 1.1fr 1fr; } }
.hero h1 { font-size: clamp(3.5rem, 9vw, 7.5rem); letter-spacing: -.05em; }
.hero h1 span { display: block; font-size: .45em; font-weight: 400; letter-spacing: -.02em; }
.hero .lede { max-width: 32ch; }
.hero .badge { margin-top: 1.5rem; }

.stage {
    position: relative; margin-top: clamp(2rem, 5vw, 3.5rem);
    height: clamp(22rem, 60vh, 42rem); border-radius: var(--radius-xl); overflow: hidden;
    background: var(--surface);
}
.stage canvas { position: absolute; inset: 0; width: 100% !important; height: 100% !important; }
.stage__hint {
    position: absolute; left: 1.5rem; bottom: 1.25rem; z-index: 1; pointer-events: none;
    font-size: .8rem; padding: .3em .8em; border-radius: 99px; background: var(--bg); opacity: .85;
}

.marquee {
    margin-top: clamp(3rem, 8vw, 6rem); border-block: 1px solid var(--line);
    overflow: hidden; white-space: nowrap; user-select: none;
    margin-inline: calc(-1 * var(--gutter)); padding-block: .9rem;
}
.marquee__track { display: inline-flex; gap: 2.5rem; animation: marquee 30s linear infinite; padding-left: 2.5rem; }
.marquee__track span { font-size: clamp(1.5rem, 3vw, 2.5rem); font-weight: 800; }
.marquee__track span:nth-child(even) { color: var(--accent); font-weight: 300; }
.marquee + section { margin-top: clamp(3rem, 8vw, 6rem); }
.marquee:hover .marquee__track { animation-play-state: paused; }
@keyframes marquee { to { transform: translateX(-50%); } }

.intro-split { display: grid; gap: 2rem; }
@media (min-width: 52rem) { .intro-split { grid-template-columns: 1fr 1.4fr; align-items: start; } }

/* studio */
/* circles backdrop (from the original studio.kunk.io): top of the page only,
   full width between the rails, faint, fading out at the bottom and sides */
.hero-circles {
    position: absolute; z-index: -1; top: 0; left: var(--rail); right: var(--rail);
    height: clamp(30rem, 88vh, 52rem);
    pointer-events: none; opacity: .09;
    mask-image: linear-gradient(to bottom, #000 35%, transparent 100%),
                linear-gradient(to right, transparent, #000 8%, #000 92%, transparent);
    mask-composite: intersect;
}
[data-theme="dark"] .hero-circles { opacity: .11; }
.party .hero-circles { opacity: .3; }
.hero-circles canvas { width: 100% !important; height: 100% !important; }
@media (max-width: 59.99rem) { .hero-circles { left: 0; right: 0; top: 4rem; height: clamp(26rem, 75vh, 40rem); } }
/* sphere backdrop behind the hero: full width between the rails, top of page only */
.hero-spheres {
    position: absolute; z-index: -1; top: 0; left: var(--rail); right: var(--rail);
    height: clamp(30rem, 88vh, 52rem);
    pointer-events: none; opacity: .3;
    /* fade out toward the bottom and the side edges */
    mask-image: linear-gradient(to bottom, #000 30%, transparent 100%),
                linear-gradient(to right, transparent, #000 10%, #000 90%, transparent);
    mask-composite: intersect;
}
[data-theme="dark"] .hero-spheres { opacity: .38; }
.hero-spheres canvas { width: 100% !important; height: 100% !important; }
@media (max-width: 59.99rem) { .hero-spheres { left: 0; right: 0; top: 4rem; height: clamp(26rem, 75vh, 40rem); } }
.studio-hero h1 { max-width: 22ch; font-size: clamp(2.25rem, 3.5vw + 1rem, 4.25rem); }
.studio-hero .lede { margin-top: 1.5rem; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(10rem, 1fr)); gap: 1rem; margin-top: 3rem; }
.stat { border-top: 1px solid var(--line); padding-top: 1rem; }
.stat strong { display: block; font-size: clamp(2rem, 4vw, 3rem); line-height: 1; letter-spacing: -.04em; }
.stat span { color: var(--muted); font-size: .9rem; }

.services { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(min(100%, 19rem), 1fr)); }
.service {
    position: relative; padding: 2rem; border: 1px solid var(--line); border-radius: var(--radius);
    background: var(--bg); transition: background .25s, transform .3s var(--ease);
}
.service:hover { background: var(--surface-soft); transform: translateY(-4px); }
.service .icon { font-size: 2rem; color: var(--accent); margin-bottom: 1.25rem; }
.service h3 { font-size: 1.4rem; margin-bottom: .6rem; }
.service p { color: var(--muted); }
.service ul { margin-top: 1rem; padding-left: 1.1rem; font-size: .9rem; display: grid; gap: .2rem; }

.process { list-style: none; padding: 0; counter-reset: step; display: grid; gap: 0; border-top: 1px solid var(--line); }
.process li {
    counter-increment: step; display: grid; gap: .5rem 2rem; padding-block: 2rem;
    border-bottom: 1px solid var(--line); grid-template-columns: 6rem 1fr;
}
.process li::before {
    content: counter(step, decimal-leading-zero); grid-row: span 2;
    font-size: 3rem; font-weight: 300; line-height: 1; color: var(--accent);
}
.process h3 { font-size: 1.4rem; }
.process p { color: var(--muted); max-width: 60ch; }
@media (max-width: 40rem) { .process li { grid-template-columns: 1fr; } .process li::before { grid-row: auto; } }

.plans { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(min(100%, 17rem), 1fr)); }
.plan { padding: 2rem; border-radius: var(--radius); background: var(--surface-soft); display: flex; flex-direction: column; gap: .75rem; }
.plan--featured { background: var(--fg); color: var(--bg); }
.plan--featured .muted { color: color-mix(in srgb, var(--bg) 70%, transparent); }
.plan h3 { font-size: 1.5rem; }
.plan ul { padding-left: 1.1rem; display: grid; gap: .25rem; font-size: .95rem; }
.plan .eyebrow { margin: 0; }
.plan--featured .eyebrow { color: var(--accent-hover); }

.chips { display: flex; flex-wrap: wrap; gap: .5rem; padding: 0; }
.chips li { list-style: none; padding: .45em 1em; border: 1px solid var(--line); border-radius: 99px; font-weight: 600; }

.faq { border-top: 1px solid var(--line); }
.faq details { border-bottom: 1px solid var(--line); }
.faq summary {
    list-style: none; cursor: crosshair; padding-block: 1.25rem;
    display: flex; justify-content: space-between; gap: 1rem; font-weight: 600; font-size: 1.1rem;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; font-size: 1.5rem; line-height: 1; transition: transform .25s var(--ease); color: var(--accent); }
.faq details[open] summary::after { transform: rotate(45deg); }
.faq details p { padding-bottom: 1.25rem; color: var(--muted); max-width: 65ch; }

/* about */
.about-canvas { position: fixed; inset: 0; z-index: -1; pointer-events: none; }
.about-hero { min-height: 70vh; display: grid; align-content: center; gap: 2rem; }
.about-hero h1 { max-width: 18ch; }
.strike { text-decoration: line-through; opacity: .45; }
.timeline { list-style: none; padding: 0; border-left: 1px solid var(--line); margin-left: .5rem; }
.timeline li { position: relative; padding: 0 0 2rem 2rem; }
.timeline li::before {
    content: ""; position: absolute; left: -.4rem; top: .45rem; width: .8rem; height: .8rem;
    border-radius: 50%; background: var(--bg); border: 1px solid var(--fg);
}
.timeline li.is-now::before { background: var(--ok); border-color: var(--ok); }
.timeline time { color: var(--muted); font-size: .85rem; }
.timeline h3 { font-size: 1.15rem; }
.timeline p { color: var(--muted); }
.past { opacity: .6; }
.past h3 { text-decoration: line-through; text-decoration-thickness: 2px; }

/* portfolio index */
.filters { display: flex; flex-wrap: wrap; gap: .5rem; margin-block: 2.5rem 1.5rem; }
.filters button[aria-pressed="true"] { background: var(--fg); color: var(--bg); border-color: var(--fg); }
.filters button sup { font-size: .7em; margin-left: .2em; opacity: .7; }
.cards { display: grid; gap: clamp(1rem, 3vw, 2rem); grid-template-columns: repeat(auto-fill, minmax(min(100%, 26rem), 1fr)); }
.card {
    position: relative; display: flex; flex-direction: column; justify-content: flex-end; gap: .4rem;
    aspect-ratio: 16 / 11; padding: clamp(1.5rem, 3vw, 2.5rem); border-radius: var(--radius-xl);
    background-color: var(--card-bg, var(--surface)); background-position: center;
    background-size: var(--fit, cover); background-repeat: no-repeat;
    text-decoration: none; overflow: hidden; transform-style: preserve-3d;
}
.card::before {
    content: ""; position: absolute; inset: 0; z-index: 0;
    background: linear-gradient(to top, color-mix(in srgb, var(--bg) 85%, transparent), transparent 60%);
}
.card > * { position: relative; z-index: 1; transform: translateZ(30px); }
.card__title { font-size: clamp(1.5rem, 2.5vw, 2.25rem); }
.card__meta { font-size: .85rem; font-weight: 600; color: var(--muted); }
.card:hover { color: var(--fg); }
.card:hover .card__title { text-decoration: underline solid var(--accent-hover) 3px; text-underline-offset: .15em; }
.card[hidden] { display: none; }

/* blog post */
.post-head { padding-top: clamp(1rem, 4vw, 3rem); margin-bottom: 3rem; display: grid; gap: 1rem; }
.post-head .post-meta { color: var(--muted); }
.back-link { text-decoration: none; font-weight: 600; display: inline-flex; gap: .5em; align-items: center; }
.back-link:hover .icon { transform: translateX(-4px); }
.back-link .icon { transition: transform .2s var(--ease); }
.note {
    padding: 1rem 1.25rem; border: 1px dashed var(--line); border-radius: 1rem;
    font-size: .9rem; color: var(--muted); margin-bottom: 2.5rem;
}

.prose { font-family: var(--sans); font-size: clamp(1.05rem, 1rem + .3vw, 1.2rem); line-height: 1.7; }
.prose > * + * { margin-top: 1.25em; }
.prose h2, .prose h3 { font-family: var(--mono); margin-top: 2.25em; }
.prose h2 { font-size: 1.75rem; }
.prose h3 { font-size: 1.3rem; }
.prose a { color: var(--accent); }
.prose blockquote { border-left: 3px solid var(--accent); padding-left: 1.25rem; font-style: italic; }
.prose code { font-family: var(--mono); font-size: .9em; background: var(--surface-soft); padding: .1em .35em; border-radius: .3em; }
.prose pre { font-size: .85rem; background: var(--surface-soft); padding: 1.25rem; border-radius: 1rem; overflow-x: auto; }
.prose pre code { background: none; padding: 0; }
.prose ul, .prose ol { padding-left: 1.4rem; }
.prose li + li { margin-top: .4em; }
.prose figure img { border-radius: 1.25rem; }
.prose figcaption { font-family: var(--mono); font-size: .8rem; color: var(--muted); margin-top: .5rem; }

/* shop */
.shop { min-height: 70vh; display: grid; place-items: center; text-align: center; gap: 2rem; }
.sign-wrap { perspective: 600px; }
.sign {
    position: relative; display: inline-block; padding: 1.5rem 2.5rem; margin-top: 4rem;
    border: 3px solid var(--fg); border-radius: 1.25rem; background: var(--bg);
    font-size: clamp(2rem, 7vw, 4rem); font-weight: 800; letter-spacing: -.03em;
    transform-origin: 50% -4rem; animation: swing 4s ease-in-out infinite;
}
.sign::before, .sign::after {
    content: ""; position: absolute; bottom: 100%; width: 2px; height: 4.3rem; background: var(--fg);
}
.sign::before { left: 22%; transform: skewX(-25deg); transform-origin: bottom; }
.sign::after { right: 22%; transform: skewX(25deg); transform-origin: bottom; }
.sign:hover { animation-duration: .6s; }
@keyframes swing { 0%, 100% { transform: rotate(3deg); } 50% { transform: rotate(-3deg); } }
.gift { width: 6rem; image-rendering: auto; animation: wiggle 5s ease-in-out infinite; margin-inline: auto; border-radius: 1rem; }
@keyframes wiggle { 0%, 80%, 100% { transform: rotate(0); } 84% { transform: rotate(-10deg); } 88% { transform: rotate(8deg); } 92% { transform: rotate(-5deg); } }

/* 404 */
.lost { position: fixed; inset: 0; z-index: 0; }
.lost-copy {
    position: relative; z-index: 1; min-height: 70vh; display: grid; place-content: center;
    text-align: center; gap: 1rem; pointer-events: none;
}
.lost-copy a, .lost-copy button { pointer-events: auto; }
.lost-copy h1 { font-size: clamp(5rem, 20vw, 14rem); letter-spacing: -.06em; line-height: .9; }
.lost-score { font-variant-numeric: tabular-nums; }

/* 6. CASE STUDIES (portfolio project pages) ------------------------------ */
.case-hero { border-radius: var(--radius-xl); overflow: hidden; background: var(--surface); margin-top: 1rem; }
/* show the whole hero, never cropped: it fits the viewport below the back link (so tall
   portrait posters stay in full view) and the frame shrinks to hug the image, centered */
figure.case-hero { width: fit-content; max-width: 100%; margin-inline: auto; }
figure.case-hero img {
    width: auto; max-width: 100%; height: auto;
    max-height: max(20rem, calc(100dvh - 8rem));
}
.case-hero--pair {
    display: grid; grid-template-columns: repeat(2, auto); justify-content: center;
    gap: 1rem; background: none; border-radius: 0;
}
.case-hero--pair img { border-radius: var(--radius-xl); }
.case-top { display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.5rem; }

.case { font-family: var(--sans); }
.case h1, .case h2, .case h3, .case h4, .case h5, .case h6, .case .techie, .case .button { font-family: var(--mono); }
.case h1 { margin-top: 3rem; margin-bottom: 1.5rem; max-width: 22ch; }
.case h2 { margin-top: 2.5rem; margin-bottom: 1rem; }
.case h3 { margin-top: 3.5rem; margin-bottom: 1rem; }
.case h4 { margin-top: 2rem; margin-bottom: .75rem; }
.case h5 { font-family: var(--sans); font-weight: 400; font-size: clamp(1.1rem, 1rem + .6vw, 1.4rem); line-height: 1.5; margin-block: 1.5rem; letter-spacing: 0; }
.case p { font-size: clamp(1.05rem, 1rem + .3vw, 1.2rem); line-height: 1.7; max-width: 70ch; margin-block: 1rem; }
.case a:not(.button, .project-nav a, .webLabels, .noTxtDec) { color: var(--accent); }
/* legacy "top" class: on an empty div it's a spacer; on real content (headings,
   intro blocks) it only adds space above, never a fixed height */
.case .top:empty { height: 2rem; }
.case .top:not(:empty) { margin-top: 2rem; }
.case :is(h1, h2, h3) { line-height: 1.15; }
.case .rule { border-top: 1px solid var(--line); margin-block: 2.5rem; }
.case hr.half { width: 50%; }
.case .techie { font-size: .9rem; line-height: 1.6; color: var(--muted); }
.case .button {
    display: inline-flex; align-items: center; padding: .75em 1.5em; margin: .5rem .5rem .5rem 0;
    border: 1px solid var(--line); border-radius: 99px; text-decoration: none; font-weight: 600; font-size: .9rem;
}
.case .button:hover { background: var(--fg); color: var(--bg); }
.case .button.colored { background: var(--accent); border-color: var(--accent); color: #fff; }

/* legacy two-column rows */
.case .row { display: grid; gap: 1rem 2rem; align-items: start; }
@media (min-width: 48rem) {
    .case .row:has(> .one-half) { grid-template-columns: 1fr 1fr; }
    .case .row .one-half:last-child:not(:first-child) { justify-self: end; text-align: right; }
    /* ...but linked cards (web design thumbnails) fill their column; this needs the
       same :not(:first-child) as the rule above, or that rule wins and the card shrinks to its label */
    .case .row a.one-half:last-child:not(:first-child) { justify-self: stretch; text-align: left; }
    .case .half-text { display: inline-block; width: calc(50% - 1rem); vertical-align: top; margin-right: 1rem; }
}

/* images: every image in a case study is a real <img>, click to zoom */
.shot { margin-block: 1.5rem; }
.shot img {
    width: 100%; height: auto; border-radius: 1.5rem; background: var(--surface);
    cursor: zoom-in; transition: transform .35s var(--ease), box-shadow .35s;
}
.shot img:hover { transform: scale(1.01); box-shadow: 0 1rem 3rem -1rem rgb(0 0 0 / .35); }
.shot--contain img { object-fit: contain; background: none; }
.shot--narrow { max-width: 25rem; margin-inline: auto; }
.duo { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 16rem), 1fr)); gap: 1rem; margin-block: 1.5rem; }
.duo .shot { margin: 0; }
.duo .shot img { aspect-ratio: 4 / 3; object-fit: cover; }
.shot-grid { display: grid; gap: 1rem; }
.shot-grid--photos { grid-template-columns: repeat(auto-fill, minmax(min(100%, 18rem), 1fr)); }
.shot-grid--photos .shot { margin: 0; }
.shot-grid--photos .shot img { aspect-ratio: 1; object-fit: cover; }
.shot-grid--squares { grid-template-columns: repeat(auto-fit, minmax(min(100%, 20rem), 1fr)); }
.shot-grid--squares .shot { margin: 0; }

.video { aspect-ratio: 16 / 9; border-radius: 1.5rem; overflow: hidden; margin-block: 1.5rem; background: var(--surface); }
.video iframe { width: 100%; height: 100%; border: 0; }

/* web design project links */
.case .webLabels, .case .noTxtDec { text-decoration: none; color: inherit; display: block; }
.case .webLabels h4 { margin: 0 0 .75rem; }
.wd-images {
    aspect-ratio: 2.04; border-radius: var(--radius); margin-bottom: 1rem; padding: 1.5rem;
    background: var(--surface) center / cover no-repeat; transition: transform .35s var(--ease);
}
.wd-images h2 { margin: 0; color: #fff; text-shadow: 0 2px 12px rgb(0 0 0 / .6); }
.case a:hover .wd-images { transform: scale(1.015); }

.warning { display: inline-flex; gap: .5em; align-items: center; color: hsl(35 100% 40%); }
[data-theme="dark"] .warning { color: hsl(40 100% 60%); }

.project-nav {
    display: grid; grid-template-columns: 1fr auto 1fr; gap: 1rem; align-items: center;
    margin-top: clamp(4rem, 10vw, 7rem); padding-top: 2rem; border-top: 1px solid var(--line);
    font-family: var(--mono);
}
.project-nav a { text-decoration: none; font-weight: 800; font-size: clamp(1rem, 2vw, 1.4rem); }
.project-nav a span { display: block; font-size: .75rem; font-weight: 600; letter-spacing: .15em; text-transform: uppercase; color: var(--muted); }
.project-nav__next { text-align: right; }
.project-nav__all { font-size: .9rem !important; padding: .6em 1.2em; border: 1px solid var(--line); border-radius: 99px; }
.project-nav__prev span::before { content: "← "; }
.project-nav__next span::after { content: " →"; }
@media (max-width: 40rem) {
    .project-nav { grid-template-columns: 1fr 1fr; }
    .project-nav__all { grid-column: 1 / -1; grid-row: 2; justify-self: center; }
}

/* 7. EFFECTS + FUN --------------------------------------------------------- */
/* reveal-on-scroll (added by JS only, so content is visible without JS) */
.js [data-reveal] { opacity: 0; transform: translateY(1.5rem); transition: opacity .8s var(--ease), transform .8s var(--ease); }
.js [data-reveal].is-in { opacity: 1; transform: none; }

/* text scramble keeps width steady */
[data-scramble] { font-variant-ligatures: none; }

/* theme switch: circular reveal using View Transitions */
::view-transition-old(root), ::view-transition-new(root) { animation: none; mix-blend-mode: normal; }

/* party mode (konami code) */
.party .stage canvas, .party .hero-spheres canvas, .party .tile, .party .card, .party .rail__face img { animation: hue 2s linear infinite; }
.party .site-footer__big em, .party h1 { animation: hue 1.5s linear infinite; color: hsl(300 100% 55%); }
@keyframes hue { to { filter: hue-rotate(360deg); } }
.rain {
    position: fixed; z-index: 150; top: -4rem; width: 2.5rem; image-rendering: pixelated; pointer-events: none;
    animation: fall linear forwards;
}
@keyframes fall { to { transform: translateY(110vh) rotate(var(--spin, 360deg)); } }

/* 8. MOTION PREFERENCES ---------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
    .js [data-reveal] { opacity: 1; transform: none; }
    .marquee__track { animation: none; }
}
.case .w600 { font-weight: 600; }
