@font-face { font-family: "Michroma"; src: url("../fonts/michroma-latin-400.woff2") format("woff2"); font-display: swap; }
@font-face { font-family: "VT323"; src: url("../fonts/vt323-latin-400.woff2") format("woff2"); font-display: swap; }
@font-face { font-family: "IBM Plex Sans"; font-weight: 400; src: url("../fonts/ibm-plex-sans-latin-400.woff2") format("woff2"); font-display: swap; }
@font-face { font-family: "IBM Plex Sans"; font-weight: 500; src: url("../fonts/ibm-plex-sans-latin-500.woff2") format("woff2"); font-display: swap; }
@font-face { font-family: "IBM Plex Sans"; font-weight: 600 700; src: url("../fonts/ibm-plex-sans-latin-600.woff2") format("woff2"); font-display: swap; }

:root {
  --mat: #27383f; --mat-line: #314750; --room: #10171b;
  --case: #d8cdb0; --muted: #a9bcc0;
  --bios: #0000aa; --bios-text: #d0d0d0; --bios-hi: #ffff55; --bios-bar: #00aaaa; --bios-sel: #aa0000;
  --win: #c0c0c0; --win-navy: #000080;
  --display: "Michroma", "Eurostile", "Arial Narrow", sans-serif;
  --body: "IBM Plex Sans", system-ui, sans-serif;
  --term: "VT323", "Courier New", monospace;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  display: grid; grid-template-rows: auto 1fr;
  background: var(--room);
  color: #e9e4d6; font-family: var(--body);
}
/* without the 3D room, fall back to the anti-static mat */
body.no-gl {
  background:
    linear-gradient(var(--mat-line) 1px, transparent 1px) 0 0 / 40px 40px,
    linear-gradient(90deg, var(--mat-line) 1px, transparent 1px) 0 0 / 40px 40px,
    var(--mat);
}

/* ---------- header ---------- */
.top { padding: 18px 28px 6px; }
.badge { font-family: var(--display); font-weight: 400; font-size: 20px; letter-spacing: .14em; text-transform: uppercase; margin: 0; color: var(--case); }
.badge small { display: block; font-family: var(--body); font-size: 13px; letter-spacing: .02em; text-transform: none; color: var(--muted); margin-top: 6px; }

/* ---------- layout ---------- */
main { display: grid; grid-template-columns: minmax(0, 1fr); padding: 6px 28px 24px; min-height: 0; }
.stage { position: relative; min-width: 0; min-height: 0; overflow: hidden; }
.stage canvas { display: block; width: 100%; height: 100%; touch-action: none; cursor: grab; }
.stage canvas:active { cursor: grabbing; }
.stage.is-hot canvas { cursor: pointer; }
.css3d { position: absolute; inset: 0; pointer-events: none; }
.css3d .screen { pointer-events: auto; }
.hint { position: absolute; left: 0; bottom: 0; margin: 0; font-family: var(--term); font-size: 19px; color: var(--muted); pointer-events: none; z-index: 1; transition: opacity .3s; }
body.is-docked .hint, html:not(.flat) body.is-docked .top { opacity: 0; }
.top { transition: opacity .3s; }
.tip {
  position: fixed; z-index: 5; pointer-events: none; opacity: 0;
  font-family: var(--term); font-size: 20px; line-height: 1;
  background: var(--bios-hi); color: #111; padding: 4px 9px 5px; border: 2px solid #111;
  transform: translate(14px, 18px);
}
.tip.on { opacity: 1; }

/* Monitor layout with WebGL: the room fills the window and the name floats over the wall */
html:not(.flat) body:not(.no-gl) { grid-template-rows: 1fr; }
html:not(.flat) body:not(.no-gl) .top { position: absolute; top: 0; left: 0; z-index: 2; pointer-events: none; }
html:not(.flat) body:not(.no-gl) main { padding: 0; height: 100vh; }
html:not(.flat) body:not(.no-gl) .hint { left: 28px; bottom: 20px; text-shadow: 0 1px 2px #000; }

/* Monitor layout with WebGL: the screen moves into the monitor. Until then, keep it out of view. */
html:not(.flat) body:not(.no-gl) main > .screen { visibility: hidden; position: absolute; }

/* ---------- opening shot: glasses on (js/intro.js) ---------- */
.intro { position: fixed; inset: 0; z-index: 30; pointer-events: none; overflow: hidden; transition: opacity .35s; }
.intro.out { opacity: 0; }
.intro-rig { position: absolute; width: 300vw; height: 300vw; left: -100vw; top: calc(50vh - 150vw); transform-origin: 50% 50%; will-change: transform; }
.intro-blur { position: fixed; inset: 0; --blur: 14px; --dim: .8;
  -webkit-backdrop-filter: blur(var(--blur)) brightness(var(--dim)); backdrop-filter: blur(var(--blur)) brightness(var(--dim));
  -webkit-mask-repeat: no-repeat; mask-repeat: no-repeat;
  -webkit-mask-composite: xor; mask-composite: exclude; }
.intro-frames { position: absolute; inset: 0; width: 100%; height: 100%; filter: blur(.35vw); }
/* eyelids: two black halves that part as --open goes 0 → 1 */
.intro-lids { position: absolute; inset: 0; --open: 0;
  background:
    linear-gradient(#000 0 0) top / 100% calc(50% * (1 - var(--open)) + 2px) no-repeat,
    linear-gradient(#000 0 0) bottom / 100% calc(50% * (1 - var(--open)) + 2px) no-repeat; }

/* ---------- the screen (BIOS) ---------- */
.screen {
  position: relative;
  display: flex; flex-direction: column; min-height: 0; min-width: 0;
  background: var(--bios); color: var(--bios-text);
  font-family: var(--term); font-size: 22px; line-height: 1.12;
  border: 10px solid #1b1e20; border-radius: 6px;
  box-shadow: 0 0 0 2px #3e4649, 0 18px 0 rgba(0,0,0,.22);
}
.screen.crt { width: 640px; height: 480px; border: 0; border-radius: 16px; box-shadow: none; font-size: 26px; line-height: 1.08; overflow: hidden; }
.screen.crt::after {
  content: ""; position: absolute; inset: 0; pointer-events: none; border-radius: inherit;
  background: repeating-linear-gradient(transparent 0 2px, rgba(0,0,0,.13) 2px 4px);
  box-shadow: inset 0 0 60px rgba(0,0,0,.45);
}
.screen-title { background: var(--bios-bar); color: #000; padding: 3px 12px 4px; display: flex; justify-content: space-between; gap: 12px; white-space: nowrap; }
.screen-title span { overflow: hidden; text-overflow: ellipsis; }
.screen-body { flex: 1; min-height: 0; overflow: auto; margin: 10px; padding: 12px 14px; border: 4px double var(--bios-text); }
.screen.has-more:not(.is-proj) .screen-foot::after { content: "▼ more"; order: 1; color: var(--bios-hi); }
.screen-foot > :last-child:not(:first-child) { order: 2; }
.screen-foot { padding: 0 14px 10px; display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; min-height: 1.12em; }
.screen h2, .screen h3 { font: inherit; color: var(--bios-hi); margin: 0 0 10px; }
.screen h3 { margin-top: 4px; }
.screen h2:focus { outline: none; }
.screen p { margin: 0 0 12px; }
.screen dl { margin: 0 0 12px; display: grid; grid-template-columns: max-content 1fr; column-gap: 14px; }
.screen dt::after { content: " :"; }
.screen dd { margin: 0; color: #fff; }
.screen .rows { list-style: none; margin: 0 0 12px; padding: 0; }
.screen .rows li { display: flex; justify-content: space-between; gap: 12px; padding: 0 6px; }
.screen .rows li:hover { background: var(--bios-sel); color: #fff; }
.screen .rows li span:last-child { color: var(--bios-hi); text-align: right; }
.screen .jobs { list-style: none; margin: 0 0 12px; padding: 0; }
.screen .jobs li { display: flex; flex-direction: column; padding: 0 6px 10px; }
.screen .jobs li:hover { background: rgba(170, 0, 0, .55); }
.screen .jobs .now { background: var(--bios-hi); color: #000; padding: 0 5px; }
.screen .stack { list-style: none; margin: 0 0 12px; padding: 0; }
.screen .stack li { display: flex; flex-direction: column; padding: 0 6px 8px; }
.screen .stack li:hover { background: rgba(170, 0, 0, .55); }
.screen .quote { margin: 0 0 18px; padding: 0 6px; }
.screen .quote blockquote { margin: 0 0 4px; color: #fff; }
.screen .quote figcaption { padding-left: 1.2em; }
.screen a { color: #fff; }
.screen .hi { color: var(--bios-hi); } .screen .wh { color: #fff; } .screen .dim { color: var(--bios-text); opacity: .7; }
.screen button { font: inherit; cursor: pointer; }
.screen .btn { display: inline-block; background: var(--bios-text); color: #000; padding: 1px 12px 2px; text-decoration: none; }
.screen .btn:hover, .screen .btn:focus-visible { background: var(--bios-hi); outline: none; }
.foot-btn { background: none; border: 0; color: var(--bios-text); padding: 0 4px; text-decoration: none; }
.screen a.foot-btn { color: var(--bios-text); }
.foot-btn:hover, .foot-btn:focus-visible, .screen a.foot-btn:hover, .screen a.foot-btn:focus-visible { background: var(--bios-sel); color: #fff; outline: none; }
.screen:not(.crt) [data-act="dock"] { display: none; }

.menu { display: grid; grid-template-columns: 1fr 1fr; column-gap: 16px; margin: 0 0 12px; }
.menu.one { grid-template-columns: 1fr; max-width: 420px; }
.menu a { display: flex; justify-content: space-between; gap: 10px; color: var(--bios-hi); padding: 0 6px; text-decoration: none; }
.menu a span:last-child { color: #fff; }
.menu a:hover, .menu a:focus-visible { background: var(--bios-sel); color: #fff; outline: none; }

.cursor { display: inline-block; width: .55em; height: .9em; background: var(--bios-text); vertical-align: -.08em; animation: cur 1s steps(1) infinite; }
@keyframes cur { 50% { opacity: 0; } }
.post p { margin: 0 0 6px; }

/* ---------- project window ---------- */
.screen.is-proj { background: #008080; }
.screen.is-proj .screen-title, .screen.is-proj .screen-foot { display: none; }
.screen.is-proj .screen-body { margin: 0; padding: 12px; border: 0; display: flex; }
.win {
  flex: 1; min-width: 0; min-height: 0; display: flex; flex-direction: column; background: var(--win); color: #000;
  border: 2px solid; border-color: #fff #404040 #404040 #fff; padding: 3px; font-size: .86em;
}
.win-bar { background: var(--win-navy); color: #fff; display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 1px 4px 2px 8px; }
.win-bar h2 { min-width: 0; color: #fff; margin: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.win-bar span { display: flex; flex: none; }
.win-bar button, .win-bar a, .win .wbtn {
  background: var(--win); color: #000; border: 2px solid; border-color: #fff #404040 #404040 #fff;
  padding: 0 8px 1px; margin-left: 3px; text-decoration: none; font: inherit; line-height: 1.1;
}
.win-bar button:hover, .win-bar a:hover, .win .wbtn:hover,
.win-bar button:focus-visible, .win-bar a:focus-visible, .win .wbtn:focus-visible { background: #dedede; outline: 1px dotted #000; outline-offset: -4px; }
.win-addr { display: flex; gap: 8px; align-items: center; padding: 3px 4px; }
.win-addr span:last-child { flex: 1; min-width: 0; background: #fff; border: 2px solid; border-color: #404040 #fff #fff #404040; padding: 0 6px 1px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.win-page { position: relative; flex: 0 0 42%; min-height: 120px; background: #fff; border: 2px solid; border-color: #404040 #fff #fff #404040; overflow: hidden; }
.win-page img, .win-page video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: top; display: block; background: #000; }
.win-page video { object-fit: contain; }
/* the live site renders at twice the size, scaled down, so it shows its desktop layout */
.win-page iframe { position: absolute; top: 0; left: 0; width: 200%; height: 200%; border: 0; transform: scale(.5); transform-origin: 0 0; background: #fff; }
.screen.crt .win-page iframe { pointer-events: none; }
body.is-docked .screen.crt .win-page iframe { pointer-events: auto; }
.win-page .ph { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; padding: 10px; color: #404040; background: repeating-linear-gradient(45deg, #ececec 0 12px, #fff 12px 24px); }
.win-readme { flex: 1; min-height: 0; overflow: auto; margin-top: 4px; padding: 6px 10px 8px; background: #fffff4; color: #111;
  border: 2px solid; border-color: #404040 #fff #fff #404040; font-size: 19px; line-height: 1.1; }
.win-readme:focus-visible { outline: 1px dotted #000; outline-offset: -4px; }
.win-readme p { margin: 0 0 8px; overflow-wrap: anywhere; }
.win-readme h3 { font: inherit; color: var(--win-navy); margin: 10px 0 4px; text-decoration: underline; }
.win-readme ul { margin: 0 0 6px; padding-left: 1.1em; list-style: square; }
.win-readme li { margin: 0 0 3px; }
.readme-head { display: flex; justify-content: space-between; align-items: start; gap: 10px; }
.readme-facts { color: #555; }
.readme-lead { color: var(--win-navy); }
.readme-tags { display: flex; flex-wrap: wrap; gap: 4px 6px; }
.readme-tags span { background: #e4e4d8; border: 1px solid #9a9a8a; padding: 0 6px; }
.win-status { display: flex; justify-content: space-between; padding: 1px 4px 0; color: #333; font-size: 18px; }
.win-status .readme-more { visibility: hidden; }
.win-status.has-more .readme-more { visibility: visible; }
.win .wbtn { flex: none; }

/* ---------- no WebGL: the screen is the whole page ---------- */
body.no-gl main { place-items: start center; }
body.no-gl .screen { width: min(760px, 100%); min-height: min(560px, calc(100vh - 120px)); }

/* ---------- phones and portrait tablets (html.flat, set in index.html) ---------- */
html.flat, html.flat body { height: auto; }
.flat main { padding: 6px 14px 18px; gap: 16px; }
.flat .top { padding: 14px 14px 4px; }
.flat .tip { display: none; }
.flat .stage { height: min(62vw, 560px); min-height: 300px; }
.flat .hint { font-size: 17px; right: 0; }
.flat .screen { font-size: 20px; min-height: 420px; }
.flat .screen.is-proj .screen-body { padding: 6px; }
.flat .win-page { min-height: 0; aspect-ratio: 4 / 3; flex: none; }
.flat .win-readme { flex: none; max-height: none; overflow: visible; font-size: inherit; }
.flat .win-status { display: none; }
@media (max-width: 600px) { .flat .menu { grid-template-columns: 1fr; } }
@media (max-width: 420px) { .flat .screen { font-size: 19px; } }

@media (prefers-reduced-motion: reduce) { .cursor { animation: none; } }
