@font-face {
  font-family: Manrope;
  src: url("assets/fonts/manrope.ttf") format("truetype");
  font-weight: 200 800;
  font-display: swap;
}
@font-face {
  font-family: Literata;
  src: url("assets/fonts/literata-italic.ttf") format("truetype");
  font-weight: 500;
  font-style: italic;
  font-display: swap;
}
:root {
  color-scheme: light dark;
  --paper: light-dark(#f7f6f1,#181a18);
  --ink: light-dark(#22241e,#f8f6eb);
  --muted: light-dark(#53574c,#b5baae);
  --line: light-dark(#cbcdc2,#41443c);
  --focus: light-dark(#82532b,#f7c198);
  background: var(--paper);
  color: var(--ink);
  font-family: Manrope,system-ui,sans-serif;
}
:root[data-theme=light] { color-scheme: light; }
:root[data-theme=dark] { color-scheme: dark; }
*,*::before,*::after { box-sizing: border-box; }
body,h1,h2,p { margin: 0; }
button { font: inherit; cursor: pointer; color: inherit; }
button { border: 0; background: none; }
a { color: inherit; text-underline-offset: .25em; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; }
[hidden] { display: none !important; }
.wrap { width: min(1460px,calc(100% - clamp(32px,6.5vw,112px))); margin-inline: auto; }
.sr-only,.skip:not(:focus) { position:absolute;width:1px;height:1px;overflow:hidden;clip-path:inset(50%); }
.skip:focus { position:absolute;top:8px;left:8px;background:var(--paper);padding:10px;z-index:5; }
.mast,.footer,.brand,.mast nav,.intro,.pager,.theme-control,.viewer-bar { display:flex;align-items:center; }
.mast,.intro,.footer,.viewer-bar { justify-content:space-between;gap:16px; }
.mast { min-height:76px;border-bottom:1px solid var(--line); }
.brand { gap:12px;text-decoration:none;font-size:1.2rem;font-weight:760;letter-spacing:-.055em; }
.mark { width:43px;height:37px;background:var(--ink);mask:url("assets/logo-dark.png") center / contain no-repeat; }
.mast nav { gap:clamp(15px,2.6vw,34px);font-size:.9rem;font-weight:650; }
.mast nav > a { text-decoration:none; }
.mast nav a:hover { text-decoration:underline; }
/* Native radios provide arrow-key selection and one Tab stop for the group. */
.theme-control, .page-switch {
  --well: light-dark(#eaeae2,#282c28);
  --tile: light-dark(#fffef8,#495047);
  --rim: light-dark(#cbcec1,#434b42);
  display: inline-flex;
  background: var(--well);
  border: 1px solid var(--rim);
  border-radius: 30px;
  padding: 3px;
  gap: 2px;
  box-shadow: none;
}
.theme-control { margin: 0; min-inline-size: 0; }
.theme-control label { position: relative; display: flex; cursor: pointer; }
.theme-control input {
  position: absolute; inset: 0; opacity: 0; width: 100%; height: 100%;
  margin: 0; cursor: pointer; z-index: 1;
}
.theme-segment {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  min-height: 36px; padding-inline: 12px; border-radius: 24px;
  color: var(--muted); font-size: .84rem; font-weight: 620;
}
.theme-segment svg { width: 17px; height: 17px; stroke-width: 1.75; }
.theme-control input:checked + .theme-segment {
  color: var(--ink);
}
.theme-control input:focus-visible + .theme-segment, .page-switch button:focus-visible {
  outline: 2px solid var(--focus); outline-offset: 1px;
}
@media (hover: hover) {
  .theme-control label:hover input:not(:checked) + .theme-segment { color: var(--ink); background: var(--tile); }
}
.intro { padding-block:clamp(22px,3vw,44px) clamp(19px,2.1vw,32px); }
h1 { font-weight:570;letter-spacing:-.055em;line-height:1.15;font-size:clamp(1.65rem,3.65vw,3.7rem); }
h1 em { font:italic 500 .96em Literata,Georgia,serif; }
.pager { gap:5px; }
.counter { color:var(--muted);font-size:.87rem;font-variant-numeric:tabular-nums;white-space:nowrap;margin-right:12px; }
.page-switch button {
  display: grid; place-items: center; min-width: 42px; height: 36px;
  border-radius: 22px; color: var(--ink);
}
.pager i { width:9px;height:9px;border-right:1.6px solid;border-top:1.6px solid;transform:translateX(-2px) rotate(45deg); }
#prev i { transform:translateX(2px) rotate(-135deg); }
.stage {
  --accent:#fff8eb;
  position:relative;isolation:isolate;overflow:hidden;display:flex;align-items:flex-end;
  min-height:clamp(400px,39vw,604px);background:#353c34;color:var(--accent);
  padding:clamp(26px,4.4vw,74px);touch-action:pan-y pinch-zoom;
}
.scene { position:absolute;inset:0;z-index:-2;width:100%;height:100%;object-fit:cover;object-position:50% 52%; }
.stage::after { content:"";position:absolute;inset:0;z-index:-1;background:linear-gradient(90deg,#18170ff7 0%,#191910b0 33%,transparent 69%),linear-gradient(0deg,#11130d5c,transparent 40%);pointer-events:none; }
.stage[data-style=ink] { --accent:#202119;background:#f5f145; }
.stage[data-style=ink] .scene { object-fit:contain;width:53%;height:84%;inset:8% 3% auto auto; }
.stage[data-style=ink]::after { background:linear-gradient(90deg,#f5f145 0%,#f5f145 36%,transparent 56%); }
.stage-info { width:min(48%,660px); }
.type { font-size:.85rem;font-weight:600; }
.stage-title { margin:clamp(16px,2vw,30px) 0;font:italic 500 clamp(3.4rem,6.9vw,7.7rem)/1.05 Literata,Georgia,serif;letter-spacing:-.065em;overflow-wrap:anywhere; }
.summary { font-size:clamp(1rem,1.25vw,1.2rem);max-width:36ch;line-height:1.45; }
.launch,.inspect { display:inline-flex;align-items:center;justify-content:center;min-height:46px;border-radius:100px;font-size:.94rem;font-weight:730; }
.launch { margin-top:clamp(18px,2.3vw,36px);padding:0 22px;color:#202119;background:#fffcf1;text-decoration:none; }

.inspect { position:absolute;right:20px;bottom:20px;gap:10px;padding:0 16px;background:#191c19dd;color:white; }
.inspect i { width:13px;height:13px;border:1.6px solid;border-radius:50%;position:relative; }
.inspect i::after { content:"";width:6px;height:2px;background:currentColor;position:absolute;right:-4px;bottom:-2px;transform:rotate(45deg); }

.stage :focus-visible { outline:3px solid white;outline-offset:4px;box-shadow:0 0 0 5px #23251c; }
.index { display:grid;grid-template-columns:repeat(auto-fit,minmax(min(250px,100%),1fr));gap:12px 26px;margin-top:20px;scroll-margin-block:1rem; }
.index button { border-top:1px solid var(--line);display:flex;align-items:center;text-align:left;gap:16px;position:relative;padding:14px 0;min-height:66px; }

.index img { width:64px;height:44px;object-fit:cover;object-position:top; }
.index strong { font-size:1.1rem;letter-spacing:-.035em; }

.index button:disabled { color:var(--muted);cursor:default; }
.footer { margin-top:clamp(40px,5vw,70px);padding-block:22px;border-top:1px solid var(--line);color:var(--muted);font-size:.875rem; }
dialog { width: min(1120px,95vw);max-height:94dvh;padding:0;border:1px solid var(--line);background:var(--paper);color:var(--ink); }
dialog::backdrop { background:#141713df; }
.viewer-bar { padding:10px 18px;position:sticky;top:0;background:var(--paper); }
.viewer-bar h2 { font-size:1.1rem; }
.viewer-bar button { min-height:42px; padding:0 16px; border:1px solid var(--line); border-radius:24px; font-weight:650; }

dialog img { width:100%;display:block; }
@media(prefers-reduced-motion:no-preference) {

  .launch,.inspect,.pager button { transition:box-shadow .15s,background-color .15s,color .15s; }

}
@media(max-width:680px) {
  .mast { min-height:62px; }
  .brand { font-size:1rem;gap:7px; }
  .mark { width:36px; }
  .work-nav { display:none; }
  .intro { gap:6px; }
  .counter { display:none; }
  .page-switch button { min-width: 40px; }
  .stage { min-height:460px;padding:24px 20px; }
  .stage::after { background:linear-gradient(0deg,#14150ff5,#15170fdc 35%,#24221a30 85%); }
  .stage-info { width:100%; }
  .stage-title { margin:12px 0;line-height:1.1; }
  .stage[data-style=ink] .scene { inset:4% 5% auto auto;width:69%;height:48%;object-position:top right; }
  .stage[data-style=ink]::after { background:linear-gradient(0deg,#f5f145 40%,transparent 65%); }
  .inspect { inset:12px 12px auto auto;font-size:.82rem;min-height:40px; }
  .index { gap:0;grid-template-columns:1fr; }
  .index img { width:51px;height:36px; }
}

/* The full-size screenshot doubles as the preview control. */
.stage[data-style=ink] {
  background: radial-gradient(ellipse at 78% 20%, #fffc93, transparent 60%), #e9e659;
}
.stage[data-style=ink] > .scene { display: none; }
.stage[data-style=ink]::after { background: linear-gradient(115deg, transparent 45%, #a5a44255 100%); }
.inspect {
  display: grid; gap: 16px; justify-items: center; align-content: center;
  position: absolute; inset: 6% 4% 6% auto; width: 45%; height: 88%;
}
.inspect { background:transparent; border-radius:0; padding:0; }
.screen-frame {
  position: relative; display: block; width: 100%; max-width: 590px; overflow: hidden;
  border: 1px solid #ffffffa8; border-radius: 9px; background: #eeeae2;
}
.screen { display: block; width: 100%; height: auto; max-height: clamp(180px,24vw,370px); object-fit: cover; object-position: top; }
.inspect-label { display: flex; gap: 9px; align-items: center; padding: 8px 13px; border-radius: 2em; background: #191c19ed; color: white; font-size: .83rem; }
.stage-title { text-wrap: balance; }
.index button { transition: background-color .16s; }

@media (prefers-reduced-motion: no-preference) {
  dialog[open] > img { animation: preview-in 320ms cubic-bezier(.18,.8,.2,1); }
  dialog[open]::backdrop { animation: shade-in 240ms ease-out; }
  @keyframes shade-in { from { opacity: 0; } }
}
@media (max-width: 680px) {
  .stage { padding-top: 250px; min-height: 505px; }
  .inspect { inset: 14px 5% auto; width: 90%; height: 215px; gap: 8px; }
  .screen-frame { width: min(80%,305px); }
  .screen { max-height: 150px; }
  .inspect-label { padding: 5px 11px; }
  .stage[data-style=ink]::after { background: linear-gradient(0deg,#f4f178,transparent); }
}

.inspect:focus-visible { outline: none; box-shadow: none; }
.inspect:focus-visible .inspect-label { outline: 2px solid white; outline-offset: 3px; box-shadow: 0 0 0 6px #222; }

@media (prefers-reduced-motion:no-preference) {
  .theme-segment, .page-switch button, .inspect-label, .launch, .viewer-bar button {
    transition: background-color 160ms, color 160ms, box-shadow 160ms, transform 120ms;
  }
  .page-switch button:active, .theme-control input:active + .theme-segment,
  .launch:active, .inspect:active .inspect-label, .viewer-bar button:active { transform: scale(.96); }
}
@media (max-width:760px) {
  .theme-segment { padding-inline: 0; min-width: 42px; min-height: 42px; }
  .theme-segment span { display:none; }
  .page-switch button { min-width: 42px; height: 42px; }
  .mast { flex-wrap: wrap; gap: 6px 8px; padding-block: 6px; }
  .mast nav { margin-left: auto; }
}

.pages {
  display: flex;
  overflow-x: auto;
  border-radius: 14px;
  scroll-snap-type: x mandatory;
  overscroll-behavior-x: contain;
  scrollbar-width: none;
}
.pages::-webkit-scrollbar { display: none; }
.pages > .stage {
  flex: 0 0 100%; min-width: 0; scroll-snap-align: start;
  scroll-snap-stop: always; touch-action: auto;
}
.theme-control {
  position: relative; display: grid; grid-template-columns: repeat(3,1fr);
  gap: 0; border: 0; border-radius: 12px; background: var(--well);
}
.theme-control::before {
  content: ""; pointer-events: none; position: absolute;
  top: 3px; bottom: 3px; left: 3px; width: calc((100% - 6px) / 3);
  background: var(--tile); border-radius: 9px;
}
.theme-control:has(input[value=light]:checked)::before { transform: translateX(100%); }
.theme-control:has(input[value=dark]:checked)::before { transform: translateX(200%); }
.theme-segment { width:100%; border-radius:9px; }
.theme-control label:hover input:not(:checked) + .theme-segment { background:transparent; }
.page-switch { border:0; border-radius:999px; padding:0; gap:0; }
.page-switch button { width:44px; height:44px; }
.page-switch button:active, .viewer-bar button:active { background:var(--line); }
.launch { color:#161917; background:#fafbf6; min-height:46px; }
.stage[data-style=ink] .launch { color:white; background:#22241e; }
.inspect-label { background:#23261de6; }
.viewer-bar button { border:0; background:light-dark(#e9e9e4,#343632); }
.index { gap:8px; }
.index button { padding:10px 14px; border:0; border-radius:12px; }
.index img { border-radius:6px; }
/* The selected project's surface glides beneath its thumbnail and title. */
.index { position:relative; isolation:isolate; }
.selection-surface {
  position:absolute; top:0; left:0; z-index:-1; border-radius:12px;
  pointer-events:none; background:light-dark(#e6e9e1,#30362e);
}
.display-window { position:relative; overflow:hidden; border-radius:14px; }
.project-wave {
  position:absolute; z-index:2; inset:-10% -40%; pointer-events:none; opacity:0;
  background:linear-gradient(110deg, transparent 29%, #aadbd71a 37%, #e9f7de70 46%,
    #ffe5b985 50%, #e4d4f051 55%, transparent 68%);
}
.inspect { perspective:1100px; }
.screen-frame {
  transform:rotateY(calc(-9deg + var(--lean-x,0deg))) rotateX(calc(4deg + var(--lean-y,0deg))) rotateZ(1deg);
  box-shadow:1px 2px #77766f, 2px 4px #504f48, 8px 15px 24px #16181145, 18px 34px 45px -14px #11150f69;
}
@media (prefers-reduced-motion:no-preference) {
  .index.ready .selection-surface { transition:transform 320ms cubic-bezier(.22,.85,.24,1), width 250ms, height 250ms; }
  .screen-frame { transition:transform 220ms ease-out; }
}
.mast nav > .control,.footer .control { text-decoration:none; padding:10px 3px; }
dialog { border:0; border-radius:14px; }
@media (max-width:680px) {
  dialog { width:100%; max-width:100%; max-height:90dvh; margin:auto 0 0; border-radius:18px 18px 0 0; }
}
@media (prefers-reduced-motion:no-preference) {
  .theme-control::before { transition:transform 230ms cubic-bezier(.22,.8,.2,1); }
  .control { transition: opacity 140ms ease-out, transform 160ms ease-out, background-color 160ms; }
  .control:active,.inspect:active .inspect-label { opacity:.78; transform:scale(.975); transition-duration:70ms; }
  dialog[open] > img { animation:none; }
  dialog[open] { animation: sheet-in 200ms cubic-bezier(.2,.8,.3,1); }
  @keyframes sheet-in { from { opacity:.5; translate:0 12px; } }
}
@media (prefers-reduced-transparency:reduce) {
  .inspect-label { background:#23261d; }
}

/* The feathered reveal blends the captured themes across a moving band. */
@property --wave-radius {
  syntax:"<length>";
  inherits:false;
  initial-value:0px;
}
:root.theme-wave::view-transition-group(root) { animation-duration:740ms; }
:root.theme-wave::view-transition-old(root) { animation:none; mix-blend-mode:normal; }
:root.theme-wave::view-transition-new(root) {
  mix-blend-mode:normal;
  mask-image:radial-gradient(circle at var(--wave-x) var(--wave-y),
    #000 max(0px, calc(var(--wave-radius) - 96px)),transparent var(--wave-radius));
  animation:theme-reveal 740ms cubic-bezier(.28,.52,.20,1) both;
}
@keyframes theme-reveal { from { --wave-radius:0px; } to { --wave-radius:var(--wave-reach); } }
.theme-wash {
  pointer-events:none; position:fixed; inset:0; z-index:20;
  background:linear-gradient(115deg,transparent 23%,#b7d7dc66 43%,#f7dbb38a 52%,transparent 75%);
  background-size:250% 100%;
}
@media(prefers-reduced-motion:reduce) {
  :root.theme-wave::view-transition-group(root), :root.theme-wave::view-transition-new(root) { animation-duration:1ms; }
}

/* Desktop keeps the whole work index and the footer in the same viewport. */
@media (min-width: 761px) {
  html, body { overflow:clip; }
  body {
    height:100vh; height:100dvh;
    display:grid; grid-template-rows:auto minmax(0,1fr) auto;
  }
  main, #work, .display-window, .pages > .stage { min-height:0; }
  #work { height:100%; display:grid; grid-template-rows:auto minmax(0,1fr) auto; }
  .mast { min-height:clamp(48px,8vh,76px); }
  .intro { padding-block:clamp(10px,3vh,30px); }
  .display-window { align-self:stretch; }
  .pages { height:100%; }
  .pages > .stage { padding:clamp(18px,5vh,62px) clamp(26px,4vw,74px); }
  .inspect { grid-template-columns:minmax(0,1fr); grid-template-rows:minmax(0,1fr) auto; align-items:end; }
  .screen-frame { max-height:100%; height:fit-content; align-self:center; }
  .screen { max-height:100%; }
  .index { margin-top:clamp(6px,1.5vh,16px); }
  .index button { min-height:44px; padding-block:clamp(4px,1vh,10px); }
  .footer { margin-top:clamp(8px,2vh,24px); padding-block:clamp(6px,1.6vh,20px); }
  .footer a[href="#top"] { display:none; }
  #work:has(.pages[hidden]) { display:block; }
}
@media (min-width:761px) and (max-height:660px) {
  .mast { min-height:48px; }
  h1 { font-size:clamp(1.6rem,4.8vh,2.2rem); }
  .stage-title { font-size:clamp(2.1rem,9vh,4rem); margin-block:10px; }
  .stage .type { font-size:.78rem; }
  .stage .summary { font-size:.95rem; }
  .stage .launch { margin-top:10px; min-height:40px; }
  .index { grid-template-columns:repeat(auto-fit,minmax(104px,1fr)); }
  .index img { width:42px; height:30px; }
  .index button { gap:7px; padding-inline:7px; }
  .index strong { font-size:.9rem; }
}
@media (min-width:761px) and (max-height:450px) {
  .intro { padding-block:2px; }
  .pages > .stage { padding-block:9px; }
  .stage .summary { display:none; }
  .stage-title { margin-block:4px; }
  .footer { margin:0 auto; padding-block:2px; }
}

.stage[data-style=glow] {
  --accent: #31231c;
  background: url("demos/glow/assets/grain-35f581fd.png"),
    radial-gradient(ellipse at 18% 0%, #fae5ce, transparent 65%),
    radial-gradient(ellipse at 92% 8%, #fff5e9, transparent 60%), #efdfcb;
}
.stage[data-style=glow] > .scene,
.stage[data-style=glow]::after { display: none; }
.stage[data-style=glow] .launch { color: #fff6eb; background: #914627; }
.stage[data-style=glow] .screen { object-fit: contain; }
