/*
  VOICE    A game's title screen with an engineer's notes: calm text, one bold moving picture.
  IDEA     The site renders itself. It opens with a "hello triangle", the first thing every renderer draws,
           which becomes the sun over a synthwave floor made of triangles. Every page change sends a pulse
           of light through the triangles.
  PICTURE  The live triangle backdrop (js/backdrop.js), the project clips, and the Cornell box path traced live.
  COLOUR   Void #07020F and night #120724 (dark purple ground), violet #8B3DFF and light blue #6FE7FF (neon),
           pink #FF5BD8 only in the sun and the pulse; text in lavender white #EEE9FF.
  TYPE     Oxanium for names, titles and buttons (squared 80s sci-fi that stays readable), Exo 2 for
           reading, JetBrains Mono in the shader editor, ProggyClean (Dear ImGui's font) for files and keys.
  CONTROLS Buttons, tabs and rows after Arc Raiders' menus: dark pills with a hairline edge; on hover a
           thin synthwave line circles them.
  LAYOUT   A fixed menu on the left with a triangle cursor, one page at a time on the right, left-aligned.
*/

/* ------------------------------------------------------------------ tokens */
:root {
  color-scheme: dark;
  --void: #07020F;
  --night: #120724;
  --panel: rgb(18 7 36 / .82);
  --violet: #8B3DFF;
  --cyan: #6FE7FF;
  --pink: #FF5BD8;
  --ink: #EEE9FF;
  --text: #D9D2F2;
  --ink-soft: #A99FCB;
  --line: rgb(139 61 255 / .28);

  --font: "Exo 2", "Segoe UI", system-ui, sans-serif;
  --display: "Oxanium", "Exo 2", "Segoe UI", system-ui, sans-serif;
  --code: "JetBrains Mono", ui-monospace, Menlo, Consolas, monospace;
  --pixel: "ProggyClean", ui-monospace, Menlo, Consolas, monospace;
  --pill-fill: rgb(9 10 22 / .72);
  --pill-edge: rgb(255 255 255 / .16);

  --menu-w: 300px;
  --chamfer: 14px;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; background: var(--void); }
body {
  margin: 0;
  min-height: 100svh;
  color: var(--text);
  font: 400 17px/1.65 var(--font);
  overflow-x: clip;
}

/* The canvas behind everything; without WebGL a drawn pattern stands in */
.backdrop { position: fixed; inset: 0; z-index: -1; display: block; width: 100%; height: 100%; }
.no-webgl .backdrop { display: none; }
.no-webgl body {
  background:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='64' height='110.85'%3E%3Cpath d='M0 0h64M0 55.43h64M0 110.85h64M0 0l64 110.85M64 0 0 110.85M32 0l32 55.43-32 55.42-32-55.42z' fill='none' stroke='%238B3DFF' stroke-opacity='.22'/%3E%3C/svg%3E"),
    linear-gradient(var(--void), #1a0a36);
  background-attachment: fixed;
}
.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }

a { color: var(--cyan); text-decoration-thickness: 1px; text-underline-offset: .22em; }
a:hover { color: var(--ink); }
:focus-visible { outline: 2px solid var(--cyan); outline-offset: 3px; }
[tabindex="-1"]:focus { outline: none; } /* page headings get focus on page change, for screen readers */
::selection { background: var(--violet); color: #fff; }
h1, h2, h3 { color: var(--ink); font-family: var(--display); }

.skip { position: absolute; left: -9999px; top: 12px; z-index: 50; padding: 10px 14px; background: var(--cyan); color: var(--void); }
.skip:focus { left: 12px; }

/* ------------------------------------------------------------------ menu */
.menu {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 10;
  display: flex;
  flex-direction: column;
  width: var(--menu-w);
  padding: 34px 26px 26px 34px;
  background: linear-gradient(90deg, rgb(7 2 15 / .9), rgb(7 2 15 / .55));
  border-right: 1px solid var(--line);
  transition: opacity .9s ease;
}
.brand { display: grid; grid-template-columns: auto 1fr; column-gap: 12px; align-items: center; text-decoration: none; }
.brand-mark {
  grid-row: span 2;
  width: 24px;
  height: 21px;
  background: linear-gradient(var(--cyan), var(--pink));
  clip-path: polygon(50% 0, 100% 100%, 0 100%);
  filter: drop-shadow(0 0 6px rgb(111 231 255 / .6));
}
.brand-name { font: 800 21px/1.1 var(--display); letter-spacing: .01em; color: var(--ink); }
.brand-role { font-size: 14px; font-weight: 500; line-height: 1.3; color: var(--cyan); }
.menu-toggle { display: none; }
.menu-panel { display: flex; flex: 1; flex-direction: column; justify-content: space-between; gap: 32px; min-height: 0; }

.menu-nav { position: relative; margin-top: 52px; }
.menu-list { display: grid; gap: 1px; margin: 0; padding: 0 0 0 22px; list-style: none; }
.menu-item a {
  display: block;
  padding: 8px 0;
  color: var(--ink-soft);
  font-size: 16px;
  font-weight: 500;
  line-height: 1.3;
  text-decoration: none;
  transition: color .2s;
}
.menu-item a:hover { color: var(--ink); }
.menu-item a[aria-current="page"] { color: var(--ink); text-shadow: 0 0 14px rgb(111 231 255 / .55); }
.menu-item.is-sub a { margin-left: 2px; padding-left: 16px; border-left: 1px solid var(--line); font-size: 15px; }
.menu-item.is-sub a[aria-current="page"] { border-left-color: var(--cyan); }
.menu-cursor {
  position: absolute;
  top: -6px;
  left: 0;
  width: 10px;
  height: 12px;
  background: var(--cyan);
  clip-path: polygon(0 0, 100% 50%, 0 100%);
  filter: drop-shadow(0 0 5px var(--cyan));
  transition: transform .38s cubic-bezier(.2, .9, .25, 1.2);
  animation: blink 1.4s steps(2, jump-none) infinite;
}
@keyframes blink { 50% { opacity: .45; } }

.menu-foot { display: grid; gap: 12px; }
.copyright { margin: 0; color: var(--ink-soft); font-size: 13px; line-height: 1.4; }
.source svg, .button svg, .row-link svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.keys { margin: 0; color: var(--ink-soft); font: 13px/1 var(--pixel); }
kbd {
  display: inline-block;
  min-width: 20px;
  margin-right: 4px;
  padding: 4px 5px 3px;
  text-align: center;
  color: var(--ink);
  background: rgb(139 61 255 / .16);
  border: 1px solid rgb(139 61 255 / .55);
  font: inherit;
}

/* ------------------------------------------------------------------ pages */
main {
  margin-left: var(--menu-w);
  padding: clamp(40px, 8vh, 104px) clamp(28px, 5vw, 88px) 120px;
  transition: opacity .9s ease;
}
.view { max-width: 980px; }
.js .view:not(.is-active) { display: none; }
/* A new page wipes in from the left. Each block wipes on its own, so the rail
   (fixed to the right edge on wide screens) can wipe in from the other side. */
.view.is-entering > :not(.cols):not(.rail),
.view.is-entering > .cols > :not(.rail),
.view.is-entering .rail { animation: wipe .6s cubic-bezier(.2, .75, .25, 1) both; }
@keyframes wipe {
  from { clip-path: inset(-40px 100% -40px -40px); opacity: .3; }
  to { clip-path: inset(-40px -40px -40px -40px); opacity: 1; }
}
@keyframes wipe-left {
  from { clip-path: inset(-40px -40px -40px 100%); opacity: .3; }
  to { clip-path: inset(-40px -40px -40px -40px); opacity: 1; }
}

.view-head h2 {
  margin: 0 0 12px;
  font-size: clamp(34px, 4.2vw, 56px);
  font-weight: 700;
  line-height: 1.04;
  text-wrap: balance;
  text-shadow: 0 0 26px rgb(111 231 255 / .28);
}
.lede { max-width: 36em; margin: 0; color: var(--ink); font-size: 20px; line-height: 1.5; text-wrap: pretty; }

/* Home: sits in the sky above the synthwave floor */
.home { max-width: 620px; }
.home-name {
  margin: 0;
  font-size: clamp(44px, 5.6vw, 92px);
  font-weight: 800;
  line-height: .98;
  text-shadow: 0 0 30px rgb(111 231 255 / .35), 0 0 2px rgb(255 255 255 / .5);
}
.home-role { margin: 12px 0 0; color: var(--cyan); font: 600 22px/1.3 var(--display); letter-spacing: .02em; }
.home-lede { max-width: 540px; margin: 22px 0 26px; color: var(--ink); text-wrap: pretty; }
.home-actions { display: flex; flex-wrap: wrap; gap: 12px; margin: 0; }
.view > .home-actions { margin-top: 40px; }
/* Buttons, tabs and rows: dark pills with a hairline edge, after Arc Raiders' menus.
   On hover or keyboard focus a thin synthwave line circles them. */
@property --orbit { syntax: "<angle>"; inherits: false; initial-value: 0deg; }
@keyframes orbit { to { --orbit: 360deg; } }
.button, .tab, .row-link, .menu-toggle {
  position: relative;
  isolation: isolate;
  border: 1px solid var(--pill-edge);
  border-radius: 999px;
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  transition: color .2s, background-color .2s, border-color .2s, box-shadow .25s;
}
.button::after, .tab::after, .row-link::after, .menu-toggle::after {
  content: "";
  position: absolute;
  inset: -1px;
  z-index: 1;
  padding: 1.5px;
  border-radius: inherit;
  background: conic-gradient(from var(--orbit), var(--cyan), var(--violet), var(--pink), var(--violet), var(--cyan));
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  opacity: 0;
  pointer-events: none;
  transition: opacity .25s;
  animation: orbit 2.6s linear infinite paused;
}
.button:hover::after, .button:focus-visible::after,
.tab:hover::after, .tab:focus-visible::after,
.row-link:hover::after, .row-link:focus-visible::after,
.menu-toggle:hover::after, .menu-toggle:focus-visible::after { opacity: 1; animation-play-state: running; }
.button:focus-visible, .tab:focus-visible, .row-link:focus-visible, .menu-toggle:focus-visible { outline: none; }
.button:hover, .button:focus-visible, .row-link:hover, .row-link:focus-visible {
  box-shadow: 0 0 22px rgb(139 61 255 / .28), inset 0 0 18px rgb(111 231 255 / .06);
}

.button {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 46px;
  padding: 11px 24px;
  color: var(--ink);
  background: var(--pill-fill);
  border-color: rgb(238 233 255 / .62);
  font: 600 14px/1 var(--display);
  letter-spacing: .08em;
  text-transform: uppercase;
  text-decoration: none;
}
.button-quiet { color: var(--text); border-color: var(--pill-edge); }
.button:hover, .button:focus-visible { color: #fff; background: rgb(22 14 44 / .82); }
.button svg { width: 18px; height: 18px; }

/* Media: js/media.js puts a <video> or <img> inside .shot-frame */
.shot { margin: 36px 0 0; }
.shot-frame {
  position: relative;
  aspect-ratio: 16 / 9;
  clip-path: polygon(var(--chamfer) 0, 100% 0, 100% calc(100% - var(--chamfer)), calc(100% - var(--chamfer)) 100%, 0 100%, 0 var(--chamfer));
  background: linear-gradient(135deg, rgb(111 231 255 / .75), rgb(139 61 255 / .55) 50%, rgb(255 91 216 / .6));
}
.shot-frame::before, .shot-frame > video, .shot-frame > img {
  position: absolute;
  inset: 1px;
  display: block;
  width: calc(100% - 2px);
  height: calc(100% - 2px);
  clip-path: polygon(calc(var(--chamfer) - .5px) 0, 100% 0, 100% calc(100% - var(--chamfer) + .5px), calc(100% - var(--chamfer) + .5px) 100%, 0 100%, 0 calc(var(--chamfer) - .5px));
}
.shot-frame::before {
  content: "";
  background:
    linear-gradient(rgb(139 61 255 / .1) 1px, transparent 1px) 0 0 / 40px 40px,
    linear-gradient(90deg, rgb(139 61 255 / .1) 1px, transparent 1px) 0 0 / 40px 40px,
    #0c0419;
}
.shot-frame > video, .shot-frame > img { object-fit: cover; background: #000; }
.shot.is-missing .shot-frame > video, .shot.is-missing .shot-frame > img { display: none; }
.shot-empty { display: none; }
.shot.is-missing .shot-empty {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 24px;
  text-align: center;
  color: var(--ink-soft);
  font-size: 15px;
}
.shot-empty code { color: var(--cyan); font: 26px/1 var(--pixel); text-shadow: 0 0 10px rgb(111 231 255 / .5); }

figcaption { margin-top: 12px; max-width: 60ch; color: var(--ink-soft); font-size: 15px; line-height: 1.5; }

.cols {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr);
  gap: 32px 56px;
  margin-top: 36px;
}
.prose p { max-width: 62ch; margin: 0 0 1em; text-wrap: pretty; }
.prose p:last-child { margin-bottom: 0; }
.rail-title, .sub {
  margin: 0 0 12px;
  color: var(--cyan);
  font: 700 15px/1.3 var(--display);
  letter-spacing: .03em;
}
.sub { margin-top: 44px; }
.prose .sub { margin-top: 32px; }
.ticks { display: grid; gap: 9px; margin: 0; padding: 0; list-style: none; }
.ticks li { position: relative; padding-left: 20px; }
.ticks li::before {
  content: "";
  position: absolute;
  left: 0;
  top: .62em;
  width: 7px;
  height: 8px;
  background: var(--violet);
  clip-path: polygon(0 0, 100% 50%, 0 100%);
}

.facts { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 8px 18px; margin: 0; }
.facts dt { color: var(--ink-soft); font-size: 15px; line-height: 1.65; }
.facts dd { margin: 0; color: var(--ink); overflow-wrap: anywhere; }

/* Rows like a game's settings list: the experiments on the VulkanGraphics page, the contacts on About Me */
.rows { display: grid; gap: 8px; margin: 0; padding: 0; list-style: none; }
.row-link {
  display: flex;
  align-items: center;
  gap: 14px;
  min-height: 58px;
  padding: 10px 24px 10px 26px;
  color: var(--ink);
  background: rgb(9 10 22 / .62);
  text-decoration: none;
}
.row-link b { font: 600 17px/1.25 var(--display); letter-spacing: .02em; }
.row-link span { margin-left: auto; color: var(--ink-soft); font-size: 15px; line-height: 1.35; text-align: right; }
.row-link span::after {
  content: "";
  display: inline-block;
  width: 7px;
  height: 9px;
  margin-left: 14px;
  background: currentColor;
  clip-path: polygon(0 0, 100% 50%, 0 100%);
}
.row-link svg { flex: none; width: 20px; height: 20px; color: var(--cyan); }
.row-link:hover, .row-link:focus-visible { color: #fff; background: rgb(22 14 44 / .8); }
.row-link:hover span, .row-link:focus-visible span { color: var(--ink); }
.contact { margin-top: 4px; }
.contact .row-link span { min-width: 0; overflow-wrap: anywhere; }
@media (max-width: 700px) {
  .levels .row-link { flex-wrap: wrap; row-gap: 2px; padding: 12px 22px; border-radius: 26px; }
  .levels .row-link span { flex: 1 1 100%; margin-left: 0; text-align: left; }
  .contact .row-link { gap: 12px; padding: 10px 18px; }
  .contact .row-link span { font-size: 14px; }
}

/* Live / recording */
.tabs { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 32px; }
.tab {
  min-height: 42px;
  padding: 9px 20px;
  border-color: transparent;
  color: var(--ink-soft);
  background: none;
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
  font: 600 14px/1 var(--display);
  letter-spacing: .08em;
  text-transform: uppercase;
  cursor: pointer;
}
.tab:hover, .tab:focus-visible { color: var(--ink); }
.tab[aria-selected="true"] { color: #fff; background: var(--pill-fill); border-color: rgb(238 233 255 / .85); }
.tab-panel { margin-top: 14px; }
.tab-panel > .shot { margin-top: 0; }

/* Experience */
.jobs { display: grid; gap: 30px; max-width: 760px; margin-top: 40px; }
.job h3 { margin: 0 0 10px; color: var(--cyan); font: 700 19px/1.3 var(--display); letter-spacing: .02em; }
.job p { margin: 0; }

/* The rail: each page's facts and source. Beside the text on mid-sized screens,
   under it on small ones, and a column mirroring the menu on wide ones. */
.view > .rail { max-width: 760px; margin-top: 48px; }
.rail-foot { margin: 24px 0 0; }
.rail-foot.source { margin-top: 20px; }

/* Source links */
.source { display: flex; flex-wrap: wrap; gap: 6px 26px; margin: 32px 0 0; }
.source a { display: inline-flex; align-items: center; gap: 9px; min-height: 44px; font: 26px/1 var(--pixel); text-decoration: none; }
.source a:hover { text-decoration: underline; }
.source svg { width: 20px; height: 20px; }

/* ------------------------------------------------ the extra figure per page */
.diagram, .equation, .passes-figure { margin: 48px 0 0; }
.diagram-scroll { overflow-x: auto; }
.diagram svg { display: block; width: 100%; min-width: 760px; height: auto; overflow: visible; }
.d-cloud { fill: rgb(139 61 255 / .16); stroke: rgb(139 61 255 / .55); stroke-width: 1; }
.d-ink { fill: var(--cyan); }
.d-soft-fill { fill: var(--ink-soft); }
.d-ray { stroke: var(--ink-soft); stroke-width: 1.5; }
.d-bracket { fill: none; stroke: var(--ink-soft); stroke-width: 1; }
.d-empty circle { fill: #0c0419; stroke: var(--ink-soft); stroke-width: 1.25; }
.d-filled circle { fill: var(--cyan); }
.d-stop { stroke: var(--pink); stroke-width: 3; }
.d-skipped circle { fill: none; stroke: var(--ink-soft); stroke-width: 1; stroke-dasharray: 2 2.6; opacity: .7; }
.d-label { fill: var(--ink-soft); font: 400 14px var(--font); }

.equation img { display: block; width: min(100%, 620px); height: auto; }

.passes { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 0 5px; margin: 0; padding: 0; list-style: none; }
.passes li::before {
  content: "";
  display: block;
  height: 6px;
  margin-bottom: 14px;
  background: linear-gradient(90deg, var(--violet), var(--cyan));
  box-shadow: 0 0 12px rgb(111 231 255 / .45);
}
.passes b { display: block; color: var(--ink); font: 700 17px/1.3 var(--display); }
.passes span { display: block; margin-top: 4px; padding-right: 14px; color: var(--ink-soft); font-size: 15px; line-height: 1.45; }

/* ------------------------------------- the live Cornell box (js/demos/cornell.js) */
.cornell { width: min(100%, 560px); margin: 0 auto; }
[data-view="path-tracer"] .tabs { justify-content: center; }
.cornell-view { position: relative; aspect-ratio: 1; overflow: hidden; background: #000; }
.cornell-still[hidden] { display: none; }
.cornell-view canvas, .cornell-still { position: absolute; inset: 0; display: block; width: 100%; height: 100%; }
.cornell canvas { cursor: grab; touch-action: pan-y; }
.cornell.is-dragging canvas { cursor: grabbing; }
.cornell.is-still .imgui { display: none; }

/* Styled after Dear ImGui's classic dark theme */
.imgui {
  position: absolute;
  top: 10px;
  left: 10px;
  z-index: 1;
  width: 248px;
  color: #fff;
  background: rgb(15 15 15 / .94);
  border: 1px solid rgb(110 110 128 / .5);
  font: 13px/1 var(--pixel);
  -webkit-font-smoothing: none;
  user-select: none;
}
.imgui-title {
  all: unset;
  box-sizing: border-box;
  display: flex;
  align-items: center;
  gap: 7px;
  width: 100%;
  height: 19px;
  padding: 0 6px;
  background: #294A7A;
}
.imgui-title::before { content: ""; width: 7px; height: 6px; background: #fff; clip-path: polygon(0 0, 100% 0, 50% 100%); }
.imgui-title[aria-expanded="false"] { background: rgb(0 0 0 / .6); }
.imgui-title[aria-expanded="false"]::before { width: 6px; height: 7px; clip-path: polygon(0 0, 100% 50%, 0 100%); }
.imgui :focus-visible { outline: 1px solid #4296FA; outline-offset: 0; }
.imgui-body { display: grid; gap: 4px; padding: 8px; }
.imgui-body[hidden] { display: none; }
.imgui-row { display: flex; align-items: center; gap: 4px; min-height: 19px; }
.imgui-frame { position: relative; flex: 0 0 150px; height: 19px; background: rgb(41 74 122 / .54); }
.imgui-progress { flex-basis: 100%; }
.imgui-progress-fill { position: absolute; inset: 0 auto 0 0; width: 0; background: #E6B300; }
.imgui-progress-text, .imgui-slider output { position: absolute; inset: 0; display: grid; place-items: center; white-space: nowrap; pointer-events: none; }
.imgui-slider:hover { background: rgb(66 150 250 / .4); }
.imgui-slider:active { background: rgb(66 150 250 / .67); }
.imgui-slider input { -webkit-appearance: none; appearance: none; position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; background: transparent; }
.imgui-slider input::-webkit-slider-runnable-track { height: 19px; background: transparent; }
.imgui-slider input::-webkit-slider-thumb { -webkit-appearance: none; width: 10px; height: 15px; margin-top: 2px; border: 0; border-radius: 0; background: #3D85E0; }
.imgui-slider input:active::-webkit-slider-thumb { background: #4296FA; }
.imgui-slider input::-moz-range-track { height: 19px; background: transparent; }
.imgui-slider input::-moz-range-thumb { width: 10px; height: 15px; border: 0; border-radius: 0; background: #3D85E0; }
.imgui-check { -webkit-appearance: none; appearance: none; position: relative; flex: none; width: 19px; height: 19px; margin: 0; background: rgb(41 74 122 / .54); }
.imgui-check:hover { background: rgb(66 150 250 / .4); }
.imgui-check:checked::after { content: ""; position: absolute; left: 5px; top: 4px; width: 9px; height: 5px; border: solid #4296FA; border-width: 0 0 2px 2px; transform: rotate(-48deg); }
.imgui-button { all: unset; box-sizing: border-box; height: 19px; padding: 3px 4px; background: rgb(66 150 250 / .4); }
.imgui-button:hover { background: #4296FA; }
.imgui-button:active { background: #0F87FA; }
.imgui-hint { margin: 2px 0 0; color: #808080; }

/* -------------------------------------------------------------- the intro */
.intro-code {
  position: fixed;
  z-index: 5;
  margin: 0;
  color: var(--cyan);
  font: 26px/1 var(--pixel);
  white-space: nowrap;
  text-shadow: 0 0 12px rgb(111 231 255 / .6);
  transform: translateX(-50%);
  opacity: 0;
  pointer-events: none;
  transition: opacity .35s;
}
.intro-code-on .intro-code { opacity: 1; }
.is-intro .menu, .is-intro main { opacity: 0; pointer-events: none; }

/* ------------------------------------------------- the shader editor (js/editor.js) */
.edit-hint { display: none; }
.has-editor .edit-hint {
  display: block;
  flex-basis: 100%;
  width: max-content;
  margin: 0 0 4px 56px;
  color: var(--pink);
  font: 600 14px/1 var(--display);
  letter-spacing: .06em;
  text-shadow: 0 0 10px rgb(255 91 216 / .55);
  pointer-events: none;
  animation: bob 1.5s cubic-bezier(.37, 0, .63, 1) infinite alternate;   /* ease-in-out sine: it floats on a sine wave */
}
.has-editor .edit-hint::after {
  content: "";
  display: block;
  width: 10px;
  height: 8px;
  margin: 7px auto 0;
  background: currentColor;
  clip-path: polygon(0 0, 100% 0, 50% 100%);
  filter: drop-shadow(0 0 4px rgb(255 91 216 / .7));
}
@keyframes bob { from { transform: translateY(-4px); } to { transform: translateY(4px); } }
.imgui-button[hidden] { display: none; }

.editor[hidden] { display: none; }
.is-editing { overflow: hidden; }
.editor {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: clamp(12px, 2.4vh, 24px);
  padding: clamp(10px, 3vw, 40px);
  background: rgb(7 2 15 / .84);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
}
.editor-note {
  margin: 0;
  max-width: 90ch;
  text-align: center;
  color: var(--ink);
  font: 600 clamp(17px, 1.6vw, 22px)/1.35 var(--display);
  letter-spacing: .02em;
  text-shadow: 0 0 18px rgb(111 231 255 / .35);
}
.editor-panel {
  position: relative;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  flex: 1 1 auto;
  width: min(1560px, 100%);
  min-height: 0;
  max-height: 960px;
  overflow: hidden;
  background: #0a0517;
  border-radius: 18px;
  box-shadow: 0 30px 90px rgb(0 0 0 / .6);
}
.editor-panel::before {             /* the same neon frame as the clips */
  content: "";
  position: absolute;
  inset: 0;
  z-index: 3;
  padding: 1px;
  border-radius: inherit;
  background: linear-gradient(135deg, rgb(111 231 255 / .75), rgb(139 61 255 / .55) 50%, rgb(255 91 216 / .6));
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  pointer-events: none;
}
.editor-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 20px;
  padding: 14px 18px 14px 22px;
  border-bottom: 1px solid var(--line);
}
.editor-title { display: inline-flex; align-items: center; gap: 10px; margin: 0; color: var(--cyan); font: 26px/1 var(--pixel); text-shadow: 0 0 10px rgb(111 231 255 / .45); }
.editor-title svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.editor-sub { flex: 1 1 240px; margin: 0; color: var(--ink-soft); font-size: 14px; line-height: 1.4; }
.editor-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.editor-actions .button { min-height: 38px; padding: 8px 16px; font-size: 12px; }
.editor-main { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); min-height: 0; }
.editor-preview { display: grid; place-items: center; min-height: 0; padding: 18px; border-left: 1px solid var(--line); }
.editor-preview .cornell-view { width: min(100%, calc(100svh - 260px)); }
.editor-preview canvas { cursor: grab; touch-action: pan-y; }

.code { position: relative; min-width: 0; min-height: 0; }
.code-scroll { position: absolute; inset: 0; display: flex; align-items: flex-start; overflow: auto; }
.code-gutter, .code-highlight, .code-highlight code, .code-input {
  margin: 0;
  font: 13.5px/1.6 var(--code);
  font-variant-ligatures: none;
  letter-spacing: 0;
  tab-size: 2;
  white-space: pre;
}
.code-gutter {
  position: sticky;
  left: 0;
  z-index: 2;
  flex: none;
  min-height: 100%;
  padding: 14px 10px 48px 14px;
  text-align: right;
  color: rgb(169 159 203 / .42);
  background: #0a0517;
  border-right: 1px solid rgb(139 61 255 / .18);
  user-select: none;
}
.code-gutter .is-error { color: var(--pink); text-shadow: 0 0 8px rgb(255 91 216 / .6); }
.code-area { position: relative; flex: 1 0 auto; }
.code-highlight { padding: 14px 20px 48px; color: #d6cff2; pointer-events: none; }
.code-input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  padding: 14px 20px 48px;
  overflow: hidden;
  resize: none;
  border: 0;
  outline: 0;
  color: transparent;
  -webkit-text-fill-color: transparent;
  caret-color: var(--cyan);
  background: transparent;
}
.code-input::selection { color: transparent; -webkit-text-fill-color: transparent; background: rgb(139 61 255 / .42); }
.tok-comment { color: #6e6590; }
.tok-macro { color: #b48cff; }
.tok-number { color: var(--pink); }
.tok-keyword { color: #b48cff; }
.tok-type { color: var(--cyan); }
.tok-builtin { color: #a6f1ff; }
.tok-call { color: #fff; }
.tok-constant { color: #ffb3ec; }

.editor-status {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 18px;
  min-height: 46px;
  max-height: 30vh;
  overflow: auto;
  padding: 10px 22px;
  border-top: 1px solid var(--line);
  color: var(--ink-soft);
  font-size: 14px;
}
.status-ok { color: var(--cyan); }
.status-bad { color: var(--pink); }
.status-keys { color: var(--ink-soft); font-size: 13px; }
.status-keys kbd { margin-right: 3px; }
@media (pointer: coarse) { .status-keys { display: none; } }
.status-error { all: unset; flex-basis: 100%; color: #ffc6ef; font: 13px/1.5 var(--code); cursor: pointer; }
button.status-error:hover, button.status-error:focus-visible { text-decoration: underline; }

@media (max-width: 900px) {
  .editor { padding: 0; gap: 0; }
  .editor-note { display: none; }
  .editor-panel { width: 100%; max-height: none; border-radius: 0; }
  .editor-sub { display: none; }
  .editor-main { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr); }
  .editor-preview { order: -1; padding: 10px; border-left: 0; border-bottom: 1px solid var(--line); }
  .editor-preview .cornell-view { width: min(100%, 34svh); }
  .code-gutter, .code-highlight, .code-input { font-size: 12.5px; }
}

/* ---------------------------------------------------------------- wider */
@media (min-width: 1500px) {
  /* only with JavaScript: without it every page shows at once, so the rails stay in the flow */
  .js:not([data-view="home"]) main { margin-right: var(--menu-w); }
  .js .view:not([data-view="home"]) { margin-inline: auto; }
  .js .cols { display: block; }
  .js .rail, .js .view > .rail {
    position: fixed;
    inset: 0 0 0 auto;
    z-index: 10;
    display: flex;
    flex-direction: column;
    width: var(--menu-w);
    max-width: none;
    margin: 0;
    padding: 135px 34px 26px 30px;
    overflow-y: auto;
    font-size: 15px;
    line-height: 1.55;
    background: linear-gradient(270deg, rgb(7 2 15 / .9), rgb(7 2 15 / .55));
    border-left: 1px solid var(--line);
  }
  .js .view.is-entering .rail { animation-name: wipe-left; }
  .js .rail .ticks { gap: 10px; }
  .js .rail .facts { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .js .rail .facts dt { font-size: 14px; line-height: 1.4; }
  .js .rail .facts dd { margin-bottom: 14px; }
  .js .rail-foot, .js .rail-foot.source { margin-top: auto; padding-top: 28px; }
  .js .rail .source { flex-direction: column; flex-wrap: nowrap; align-items: flex-start; gap: 0; }
  .js .rail .edit-hint { flex: none; }
}

/* ------------------------------------------------------------- narrower */
@media (max-width: 1100px) {
  .cols { grid-template-columns: minmax(0, 1fr); }
  .passes { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 22px 5px; }
}

@media (max-width: 900px) {
  .menu {
    inset: 0 0 auto 0;
    flex-direction: row;
    align-items: center;
    width: auto;
    height: 64px;
    padding: 0 16px 0 20px;
    background: rgb(7 2 15 / .88);
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }
  .brand { grid-template-columns: auto auto; }
  .brand-mark { grid-row: auto; width: 20px; height: 17px; }
  .brand-name { font-size: 18px; }
  .brand-role { display: none; }
  .menu-toggle {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    min-height: 44px;
    margin-left: auto;
    padding: 0 18px;
    color: var(--ink);
    background: var(--pill-fill);
    font: 600 14px/1 var(--display);
    letter-spacing: .08em;
    text-transform: uppercase;
    cursor: pointer;
  }
  .menu-toggle-mark { width: 10px; height: 9px; background: var(--cyan); clip-path: polygon(0 0, 100% 0, 50% 100%); transition: transform .25s; }
  .menu-open .menu-toggle-mark { transform: rotate(180deg); }
  .menu-panel {
    position: fixed;
    inset: 64px 0 0 0;
    display: none;
    padding: 20px 24px 28px;
    overflow-y: auto;
    background: var(--void);
  }
  .menu-open .menu-panel { display: flex; }
  .menu-nav { margin-top: 0; }
  .menu-item a { padding: 11px 0; font-size: 19px; }
  .menu-item.is-sub a { font-size: 17px; }
  .keys { display: none; }

  main { margin-left: 0; padding: 104px 20px 96px; }
  .home-name { font-size: clamp(40px, 12vw, 64px); }
  .home-lede { margin: 18px 0 22px; }
  .button { padding: 10px 16px; }
  .lede { font-size: 18px; }
  .passes { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .passes li { position: relative; padding: 0 0 18px 24px; }
  .passes li::before { position: absolute; left: 0; top: 5px; bottom: 5px; width: 6px; height: auto; margin: 0; }
  .facts { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .facts dd { margin-bottom: 10px; }
  .source a { font-size: 13px; }
}

@media (prefers-reduced-motion: reduce) {
  .has-editor .edit-hint { animation: none; }
  .button::after, .tab::after, .row-link::after, .menu-toggle::after { animation: none; }
  .view.is-entering > *, .view.is-entering .cols > *, .view.is-entering .rail { animation: none; }
  .menu-cursor { animation: none; transition: none; }
}

/* ------------------------------------------------------------- 404 page */
.lost-page main.lost { margin: 0; max-width: 760px; min-height: 100svh; padding: clamp(64px, 16vh, 180px) clamp(24px, 8vw, 120px); }
.lost-code { margin: 0 0 14px; color: var(--cyan); font: 26px/1 var(--pixel); text-shadow: 0 0 12px rgb(111 231 255 / .6); }
.lost h1 { margin: 0 0 18px; font-size: clamp(40px, 6vw, 76px); font-weight: 800; line-height: 1.02; text-shadow: 0 0 26px rgb(111 231 255 / .3); }
.lost p { color: var(--ink); font-size: 19px; }
