
/* Layout: 12-col editorial; every row shares a top edge, asymmetry comes from column widths (7/5 then 5/7). The page ground changes per world: chalk → slate → sand → warm black. Single committed look. */
@property --bg { syntax: '<color>'; inherits: true; initial-value: #ecebe7; }
@property --fg { syntax: '<color>'; inherits: true; initial-value: #1a1a18; }
@property --muted { syntax: '<color>'; inherits: true; initial-value: #66655e; }
@property --chip { syntax: '<color>'; inherits: true; initial-value: #1a1a18; }
@property --chip-fg { syntax: '<color>'; inherits: true; initial-value: #ecebe7; }
:root {
  --bg: #ecebe7; --fg: #1a1a18; --muted: #66655e; --chip: #1a1a18; --chip-fg: #ecebe7;   /* Gaming: chalk */
  --font: "Schibsted Grotesk", "Helvetica Neue", Helvetica, Arial, sans-serif;
  --ease: cubic-bezier(0.19, 1, 0.22, 1);
  --t-display: clamp(2.25rem, 1.2rem + 3.6vw, 4.5rem);
  --t-h2: clamp(1.9rem, 1.2rem + 2.2vw, 3.1rem);
  --t-body: 1.0625rem; --t-small: 0.8125rem;
  --gutter: clamp(16px, 4vw, 56px);
  --col-gap: 24px;
  color-scheme: light;
  transition: --bg 1.4s var(--ease), --fg 1.4s var(--ease), --muted 1.4s var(--ease), --chip 1.4s var(--ease), --chip-fg 1.4s var(--ease);
}
:root[data-world="tech"]        { --bg: #222a33; --fg: #e6eaee; --muted: #98a4b0; --chip: #e6eaee; --chip-fg: #222a33; color-scheme: dark; }
:root[data-world="commercials"] { --bg: #e4dccd; --fg: #221d17; --muted: #6d6252; --chip: #221d17; --chip-fg: #e4dccd; color-scheme: light; }
:root[data-world="ai"]          { --bg: #0c0b0a; --fg: #efe7da; --muted: #a0957f; --chip: #efe7da; --chip-fg: #0c0b0a; color-scheme: dark; }

* { box-sizing: border-box; }
html { background: var(--bg); }
body { background: var(--bg); color: var(--fg); font-family: var(--font); font-size: var(--t-body); line-height: 1.5; -webkit-font-smoothing: antialiased; }
::selection { background: var(--fg); color: var(--bg); }
a { color: inherit; text-decoration: none; }
:focus-visible { outline: 2px solid var(--fg); outline-offset: 4px; border-radius: 2px; }
h1, h2, h3 { margin: 0; font-weight: 400; text-wrap: balance; }
p { margin: 0; }
.wrap { max-width: 1440px; margin: 0 auto; padding-left: max(var(--gutter), env(safe-area-inset-left, 0px)); padding-right: max(var(--gutter), env(safe-area-inset-right, 0px)); }

.link, .see { display: inline-flex; align-items: center; gap: .5em; position: relative; padding-bottom: 3px; }
.link::after, .see::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 1px; background: currentColor; transform: scaleX(0); transform-origin: right; transition: transform .7s var(--ease); }
.link:hover::after, .link:focus-visible::after, .see:hover::after, .see:focus-visible::after { transform: scaleX(1); transform-origin: left; }
.link svg, .see svg { width: .8em; height: .8em; transition: transform .7s var(--ease); flex: none; }
.link:hover svg, .see:hover svg { transform: translateX(5px); }

/* nav */
body::before { content: ""; position: fixed; inset: 0 0 auto; height: env(safe-area-inset-top, 0px); z-index: 10; background: var(--bg); }
.nav { position: sticky; top: env(safe-area-inset-top, 0px); z-index: 9; background: var(--bg); }
.nav .wrap { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; padding-block: 22px; }
.brand { font-weight: 500; letter-spacing: -0.01em; }
.nav ul { display: flex; gap: clamp(16px, 2.4vw, 32px); list-style: none; margin: 0; padding: 0; font-size: .9375rem; }
.nav nav { justify-self: end; }
.index a { color: var(--muted); transition: color .6s var(--ease); }
.index a:hover, .index a[aria-current="true"] { color: var(--fg); }

/* hero: headline, then the line under it on the same left edge */
.hero .wrap { padding-block: clamp(48px, 8vw, 112px) clamp(32px, 4vw, 56px); }
.hero h1 { font-size: var(--t-display); line-height: 1.04; letter-spacing: -0.035em; max-width: 21ch; }
.hero h1 .ln { display: block; overflow: hidden; padding-bottom: .06em; }
.hero h1 .ln span { display: inline-block; animation: rise 1.6s var(--ease) both; }
.hero h1 .ln:nth-child(2) span { animation-delay: .12s; }
@keyframes rise { from { transform: translateY(.5em); opacity: .2; } to { transform: none; opacity: 1; } }
.hero-meta { display: grid; justify-items: start; gap: 18px; margin-top: 28px; }
.hero-meta p { color: var(--muted); max-width: 52ch; }

.doors { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--col-gap); margin-top: clamp(48px, 6vw, 88px); }
.door { display: grid; gap: 14px; align-content: start; }
.door .media { aspect-ratio: 3 / 4; }
.door-label { display: grid; gap: 2px; }
.door-label h2 { font-size: 1.25rem; letter-spacing: -0.015em; }
.door-label span { color: var(--muted); font-size: var(--t-small); }

/* media */
.media { position: relative; overflow: hidden; background: color-mix(in srgb, var(--fg) 8%, var(--bg)); border-radius: 3px; max-width: 100%; }
.media img, .media video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; transition: transform 1.6s var(--ease), opacity .9s var(--ease); }
.media video { opacity: 0; }
.media.playing video { opacity: 1; }
.media:hover img, .media:hover video { transform: scale(1.03); }
.door .media img { animation: drift 18s ease-in-out infinite alternate; }
@keyframes drift { from { transform: scale(1.04); } to { transform: scale(1.1) translate3d(-1.5%, -1%, 0); } }
@media (hover: hover) and (pointer: fine) { .media { cursor: none; } }

.cursor { position: fixed; left: 0; top: 0; z-index: 20; pointer-events: none; padding: 8px 14px; border-radius: 999px; background: var(--chip); color: var(--chip-fg); font-size: var(--t-small); font-weight: 500; transform: translate(-50%, -50%) scale(.6); opacity: 0; transition: opacity .4s var(--ease), transform .5s var(--ease); }
.cursor.on { opacity: 1; transform: translate(-50%, -50%) scale(1); }

/* worlds */
.world .wrap { padding-block: clamp(72px, 9vw, 128px) clamp(32px, 4vw, 56px); }
.world-head { display: grid; gap: 14px; margin-bottom: clamp(36px, 5vw, 64px); }
.world-head h2 { font-size: var(--t-h2); letter-spacing: -0.03em; line-height: 1.05; }
.world-head p { color: var(--muted); max-width: 56ch; }

.grid { container-type: inline-size; display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); column-gap: var(--col-gap); row-gap: clamp(48px, 6vw, 80px); align-items: start; }
.tile { display: grid; gap: 16px; align-content: start; }
.tile .media { aspect-ratio: auto; height: calc(((100cqw - 11 * var(--col-gap)) / 12 * 7 + 6 * var(--col-gap)) * 9 / 16); }
.tile.w7 { grid-column: span 7; }
.tile.w5 { grid-column: span 5; }
.tile.w4 { grid-column: span 4; }
.tile.w4 .media { height: auto; aspect-ratio: 4 / 5; }
.cap { display: grid; gap: 4px; }
.cap h3 { font-size: 1.125rem; font-weight: 500; letter-spacing: -0.01em; }
.cap .meta { color: var(--muted); font-size: var(--t-small); }

.more { margin-top: clamp(48px, 6vw, 80px); display: grid; gap: clamp(28px, 3vw, 40px); }
.minis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--col-gap); }
.mini { display: grid; gap: 10px; font-size: .9375rem; align-content: start; }
.mini .media { aspect-ratio: 16 / 9; }
.see { justify-self: start; font-size: clamp(1.25rem, 1rem + 1vw, 1.75rem); letter-spacing: -0.02em; }

/* footer */
.foot .wrap { padding-block: clamp(96px, 12vw, 180px) clamp(72px, 8vw, 112px); display: grid; gap: 28px; }
.foot h2 { font-size: var(--t-h2); letter-spacing: -0.03em; line-height: 1.05; max-width: 16ch; }
.mail { display: flex; flex-wrap: wrap; align-items: baseline; gap: 20px; font-size: clamp(1.25rem, 1rem + 1.2vw, 2rem); letter-spacing: -0.02em; }
.mail .addr { user-select: all; }
.mail button { font: inherit; font-size: var(--t-small); color: var(--muted); background: none; border: 0; padding: 0; cursor: pointer; }
.mail button:hover { color: var(--fg); }
.credit { color: var(--muted); font-size: var(--t-small); max-width: 60ch; }

@media (max-width: 1000px) { .doors, .minis { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 760px) {
  .grid { grid-template-columns: 1fr; row-gap: 40px; }
  .tile.w7, .tile.w5, .tile.w4 { grid-column: 1 / -1; }
  .tile .media { height: auto; aspect-ratio: 16 / 9; }
  .nav .wrap { grid-template-columns: 1fr auto; }
  .nav .index { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  :root { transition: none; }
  .hero h1 .ln span, .door .media img { animation: none; }
  .media img, .media video, .link::after, .link svg, .see::after, .see svg { transition: none; }
}

/* links that wrap media */
a.tile, a.mini, a.card { display: grid; color: inherit; }
.tile:hover .cap h3, .card:hover h2, .mini:hover span { text-decoration: underline; text-underline-offset: 4px; text-decoration-thickness: 1px; }

.mobile-work { display: none; }

/* page head (world, about, project) */
.page-head .wrap { padding-block: clamp(48px, 7vw, 104px) clamp(32px, 4vw, 56px); display: grid; gap: 16px; }
.page-head h1 { font-size: var(--t-display); line-height: 1.04; letter-spacing: -0.035em; max-width: 20ch; }
.page-head p { color: var(--muted); max-width: 56ch; }
.back { color: var(--muted); font-size: .9375rem; justify-self: start; }
.back:hover { color: var(--fg); }

/* world page: every project */
.all { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: clamp(40px, 5vw, 64px) var(--col-gap); padding-bottom: clamp(72px, 9vw, 128px); }
.card { gap: 14px; align-content: start; }
.card .media { aspect-ratio: 16 / 9; }
.card h2 { font-size: 1.0625rem; font-weight: 500; letter-spacing: -0.01em; }
.card .meta { color: var(--muted); font-size: var(--t-small); }
.others { display: flex; flex-wrap: wrap; gap: 12px 32px; padding-bottom: clamp(56px, 7vw, 96px); font-size: clamp(1.125rem, 1rem + .6vw, 1.5rem); letter-spacing: -0.015em; }

/* project page */
.player { position: relative; aspect-ratio: 16 / 9; max-width: 100%; border-radius: 3px; overflow: hidden; background: #000; }
.player iframe, .player video, .player img { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; object-fit: cover; }
.facts { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 24px var(--col-gap); padding-block: clamp(36px, 5vw, 64px) clamp(64px, 8vw, 112px); }
.facts dl { grid-column: 1 / span 7; display: grid; grid-template-columns: max-content 1fr; gap: 14px 40px; margin: 0; }
.facts dt { color: var(--muted); font-size: var(--t-small); padding-top: 3px; }
.facts dd { margin: 0; }
.tags { display: flex; flex-wrap: wrap; gap: 8px; list-style: none; margin: 0; padding: 0; }
.tags li { font-size: var(--t-small); padding: 5px 12px; border-radius: 999px; background: color-mix(in srgb, var(--fg) 9%, transparent); }
.next { grid-column: 9 / span 4; display: grid; gap: 12px; align-content: start; }
.next .label { color: var(--muted); font-size: var(--t-small); }
.next .media { aspect-ratio: 16 / 9; }
.next h2 { font-size: 1.0625rem; font-weight: 500; }
.soon { position: absolute; left: 16px; bottom: 14px; z-index: 2; font-size: var(--t-small); color: #fff; text-shadow: 0 1px 6px rgba(0,0,0,.6); }

/* about */
.about .wrap { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: var(--col-gap); padding-bottom: clamp(72px, 9vw, 128px); }
.bio { grid-column: 1 / span 7; display: grid; gap: 20px; font-size: clamp(1.0625rem, 1rem + .35vw, 1.3125rem); line-height: 1.55; max-width: 62ch; }
.side { grid-column: 9 / span 4; display: grid; gap: 36px; align-content: start; }
.side h2 { font-size: var(--t-small); font-weight: 500; color: var(--muted); margin-bottom: 10px; letter-spacing: .02em; }
.side ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.skills { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--col-gap); margin-top: clamp(56px, 7vw, 96px); }
.skills h3 { font-size: 1.25rem; letter-spacing: -0.015em; margin-bottom: 10px; }
.skills p { color: var(--muted); max-width: 40ch; }

/* reel dialog */
dialog.reel { padding: 0; border: 0; background: transparent; width: min(1280px, calc(100vw - 32px)); max-width: none; }
dialog.reel::backdrop { background: rgba(8, 8, 8, .88); }
.reel-frame { position: relative; aspect-ratio: 16 / 9; background: #000; border-radius: 3px; overflow: hidden; }
.reel-frame iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.reel-close { position: absolute; top: -44px; right: 0; font: inherit; font-size: .9375rem; color: #f2f0ec; background: #0c0b0a; border-radius: 3px; padding-inline: 10px; border: 0; padding: 8px 0; cursor: pointer; }
.reel-close:hover { text-decoration: underline; text-underline-offset: 4px; }

@media (max-width: 1000px) { .all { grid-template-columns: repeat(2, minmax(0, 1fr)); } .skills { grid-template-columns: 1fr; } }
@media (max-width: 760px) {
  .all { grid-template-columns: 1fr; }
  .facts dl, .next, .bio, .side { grid-column: 1 / -1; }
  .mobile-work { display: list-item; }
  .facts dl { grid-template-columns: 1fr; gap: 6px; }
  .facts dd { margin-bottom: 12px; }
}
