/* Cartridge Deck portfolio — this page only. Pixel rules: hard outlines and
   solid offset shadows, square corners, no blur. Motion uses steps() easing.
   Sizes are in board pixels: the visitor view is a fixed 1440x900 board that
   deck.js scales to the window (html.board-on); see "board" at the bottom. */
:root {
  --unicode: 'U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF';
  --page: #10131d;
  --page-checker: #151927;
  --text: #f3efe2;
  --text-soft: #d9d5ea;
  --muted: #8a93c9;
  --note: #9aa6dc;
  --ink: #2a2440;
  --ink-dark: #1b1530;
  --ink-soft: #5a557a;
  --drop: #121020;
  --case: #d6d2e4;
  --case-light: #f4f1fa;
  --case-shade: #8c88a6;
  --title-bar: #2b2f86;
  --tab-line: #4a58a8;
  --status-progress: #ff8a7a;
  --status-live: #8ee8c4;
  --status-complete: #c9c3f5;
  --accent: #ffcf5a;
  --mono: 'FiraSans Medium', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --display: 'FiraSans Bold', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --body: 'FiraSans Regular', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

:root[data-accent="mint"] {
  --accent: #8ee8c4;
}

:root[data-accent="coral"] {
  --accent: #ff8a7a;
}

/* Type: Jersey 25 (pixel display, one weight) + IBM Plex Mono (400/500/600), both SIL OFL,
   self-hosted incl. latin-ext for macrons (ō). See roles in the handoff (option 1b). */
@font-face {
  font-family: 'Jersey 25';
  font-weight: 400;
  src: url('assets/fonts/jersey25-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
  font-display: swap;
}

@font-face {
  font-family: 'Jersey 25';
  font-weight: 400;
  src: url('assets/fonts/jersey25-latin-ext.woff2') format('woff2');
  unicode-range: var(--unicode);
  font-display: swap;
}

@font-face {
  font-family: 'IBM Plex Mono';
  font-weight: 400;
  src: url('assets/fonts/plexmono-400-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
  font-display: swap;
}

@font-face {
  font-family: 'IBM Plex Mono';
  font-weight: 400;
  src: url('assets/fonts/plexmono-400-latin-ext.woff2') format('woff2');
  unicode-range: var(--unicode);
  font-display: swap;
}

@font-face {
  font-family: 'IBM Plex Mono';
  font-weight: 500;
  src: url('assets/fonts/plexmono-500-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
  font-display: swap;
}

@font-face {
  font-family: 'IBM Plex Mono';
  font-weight: 500;
  src: url('assets/fonts/plexmono-500-latin-ext.woff2') format('woff2');
  unicode-range: var(--unicode);
  font-display: swap;
}

@font-face {
  font-family: 'IBM Plex Mono';
  font-weight: 600;
  src: url('assets/fonts/plexmono-600-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
  font-display: swap;
}

@font-face {
  font-family: 'IBM Plex Mono';
  font-weight: 600;
  src: url('assets/fonts/plexmono-600-latin-ext.woff2') format('woff2');
  unicode-range: var(--unicode);
  font-display: swap;
}

@font-face {
  font-family: 'FiraSans Medium';
  font-weight: 600;
  src: url('assets/fonts/FiraSans-Medium.ttf') format('ttf');
  unicode-range: var(--unicode);
  font-display: swap;
}

@font-face {
  font-family: 'FiraSans Regular';
  font-weight: 200;
  src: url('assets/fonts/FiraSans-Regular.ttf') format('ttf');
  unicode-range: var(--unicode);
  font-display: swap;
}

@font-face {
  font-family: 'FiraSans Bold';
  font-weight: 600;
  src: url('assets/fonts/FiraSans-Bold.ttf') format('ttf');
  unicode-range: var(--unicode);
  font-display: swap;
}



* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background-color: var(--page);
  background-image:
    linear-gradient(45deg, var(--page-checker) 25%, transparent 25%),
    linear-gradient(-45deg, var(--page-checker) 25%, transparent 25%);
  background-size: 8px 8px;
  color: var(--text);
  font-family: var(--body);
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  /* faint hard drop so light-on-dark text stays crisp; inherits, rules below override */
  text-shadow: 1px 1px 0 rgba(0, 0, 0, .55);
}

img {
  max-width: 100%;
}

a {
  color: inherit;
}

button {
  font: inherit;
  color: inherit;
}

p {
  margin: 0;
}

:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 3px;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ------------------------------------------------------------- top bar -- */

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 32px;
  gap: 16px;
  flex-wrap: wrap;
}

.topbar-brand {
  line-height: 1;
  color: var(--text);
  text-decoration: none;
  text-shadow: 2px 2px 0 var(--drop);
  font-family: var(--display);
  font-weight: 400;
  font-synthesis: none;
  font-size: 32px;
  letter-spacing: .06em;
}

.topbar-brand:hover {
  color: var(--accent);
}

.topbar-links {
  display: flex;
  gap: 28px;
  flex-wrap: wrap;
  align-items: center;
}

.topbar-links a,
.topbar-links button {
  background: none;
  border: 0;
  padding: 4px 0;
  cursor: pointer;
  text-decoration: none;
  font-family: var(--mono);
  font-weight: 500;
  font-size: 14px;
  color: var(--text);
}

.topbar-links a:hover,
.topbar-links button:hover {
  text-decoration: underline;
  text-underline-offset: 4px;
}

.topbar-links .is-accent {
  color: var(--accent);
}

.edit-strip {
  background: var(--accent);
  color: var(--ink-dark);
  padding: 10px 32px;
  display: flex;
  gap: 16px;
  align-items: center;
  flex-wrap: wrap;
  font-weight: 700;
  text-transform: uppercase;
  font-size: 14px;
  border-bottom: 3px solid var(--ink);
  text-shadow: none;
}

.edit-strip a {
  text-decoration: underline;
}

.topbar-form {
  display: contents;
}

.edit-strip button {
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
  color: inherit;
  font: inherit;
  text-transform: inherit;
  text-decoration: underline;
}

.topbar-links .topbar-login {
  color: var(--muted);
}

/* ------------------------------------------- flowing layout (fallback) -- */

main.stage {
  max-width: 1440px;
  margin: 0 auto;
  padding: 24px 32px 48px;
  display: grid;
  grid-template-columns: minmax(0, 488px) 700px;
  justify-content: space-between;
  gap: 40px;
  align-items: start;
}

@media (max-width: 1239px) {
  html:not(.board-on) main.stage {
    grid-template-columns: 380px 560px;
  }

  html:not(.board-on) .deck {
    zoom: 0.8;
  }
}

/* ---------------------------------------------------------------- profile -- */

.profile-head {
  display: flex;
  align-items: center;
  gap: 18px;
}

.avatar {
  width: 120px;
  height: 120px;
  flex-shrink: 0;
  display: inline-block;
  border: 4px solid var(--case);
  box-shadow: 0 0 0 2px var(--ink);
  image-rendering: pixelated;
  background: var(--ink);
}

.avatar svg {
  width: 100%;
  height: 100%;
  display: block;
}

.greeting {
  color: var(--accent);
  font-family: var(--mono);
  font-weight: 500;
  font-size: 14px;
  letter-spacing: .22em;
}

.profile-name {
  text-transform: uppercase;
  font-family: var(--display);
  font-weight: 400;
  font-synthesis: none;
  font-size: 120px;
  line-height: .9;
  letter-spacing: .03em;
  margin: 8px 0 0;
}

.profile-role {
  margin-top: 30px;
  font-weight: 600;
  font-size: 17px;
  line-height: 1.45;
}

.profile-bio {
  margin-top: 18px;
  color: var(--text-soft);
  max-width: 470px;
  font-weight: 400;
  font-size: 14.5px;
  line-height: 1.8;
  text-wrap: pretty;
}

.profile-facts {
  list-style: none;
  margin: 20px 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.profile-facts li {
  font-family: var(--mono);
  color: var(--text-soft);
  font-weight: 400;
  font-size: 15px;
  line-height: 1.55;
}

.profile-facts li::before {
  content: '';
  display: inline-block;
  width: 7px;
  height: 7px;
  margin: 0 10px 3px 0;
  background: var(--muted);
}

.profile-facts .is-availability {
  color: var(--status-live);
}

.profile-facts .is-availability::before {
  background: var(--status-live);
}

.profile-actions {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  margin-top: 24px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0 18px;
  border: 2px solid var(--ink-dark);
  box-shadow: 3px 3px 0 var(--drop);
  text-decoration: none;
  font-family: var(--body);
  cursor: pointer;
  background: var(--case);
  color: var(--ink-dark);
  text-shadow: none;
  font-weight: 600;
  font-size: 13.5px;
  letter-spacing: .02em;
  white-space: nowrap;
}

.btn:active {
  box-shadow: none;
  transform: translate(3px, 3px);
}

.btn-primary {
  background: var(--accent);
}

.btn-outline {
  background: transparent;
  color: var(--text);
  border-color: var(--text);
  box-shadow: none;
}

.profile-offclock {
  margin-top: 22px;
  font-family: var(--mono);
  font-weight: 400;
  font-size: 13px;
  line-height: 1.65;
  color: var(--note);
  max-width: 440px;
}

/* -------------------------------------------------------------------- deck -- */

/* The deck is a fixed 700x800 box; everything inside is placed on it. */
.deck {
  position: relative;
  width: 700px;
  height: 800px;
}

.deck:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 6px;
}

.deck[data-focus-by="pointer"]:focus-visible {
  outline: none;
}

/* see deck.js: Tab-only ring */

.tv-unit {
  position: absolute;
  left: 50px;
  top: 0;
  width: 600px;
  z-index: 20;
}

.tv-case {
  position: relative;
  width: 600px;
  height: 440px;
  padding: 22px 26px 0;
  background: var(--case);
  border: 4px solid var(--ink-dark);
  box-shadow: inset 4px 4px 0 var(--case-light), inset -4px -4px 0 var(--case-shade), 10px 10px 0 var(--drop);
}

.tv-screen-wrap {
  position: relative;
  width: 540px;
  height: 330px;
  overflow: hidden;
  background: #07060d;
  border: 3px solid var(--ink-dark);
  border-radius: 18px / 14px;
  /* the tube's slight curve */
}

/* CRT glass: darkened corners and a faint sheen over everything on screen, */
.tv-screen-wrap::after {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 3;
  pointer-events: none;
  border-radius: inherit;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, .07), transparent 38%),
    radial-gradient(ellipse at center, transparent 60%, rgba(0, 0, 0, .42) 100%);
  box-shadow: inset 0 0 22px rgba(0, 0, 0, .55);
}

/* and a soft bright band rolling slowly down the tube. */
.tv-screen-wrap::before {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  top: -70px;
  height: 70px;
  z-index: 3;
  pointer-events: none;
  background: linear-gradient(transparent, rgba(255, 255, 255, .045), transparent);
  animation: crt-roll 8s linear infinite;
}

@keyframes crt-roll {
  to {
    transform: translateY(470px);
  }
}

.tv-screen {
  position: absolute;
  inset: 0;
  padding: 20px 22px;
  background: var(--screen-bg, #07060d);
  color: var(--screen-fg, var(--text));
  display: flex;
  flex-direction: column;
}

.tv-screen[data-screen="off"] {
  --screen-bg: #07060d;
  --screen-fg: var(--text);
}

.tv-screen[data-screen="boot"],
.tv-screen[data-screen="loading"] {
  --screen-bg: #0f1230;
  --screen-fg: var(--text);
}

.tv-scanlines {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background: repeating-linear-gradient(to bottom, rgba(0, 0, 0, .22) 0 1px, transparent 1px 3px);
}

.tv-static {
  position: absolute;
  inset: 0;
  z-index: 2;
  width: 100%;
  height: 100%;
  pointer-events: none;
  opacity: 0;
  image-rendering: pixelated;
}

.tv-static.is-active {
  opacity: 1;
}

/* solid: the picture is fully covered while it tunes */

/* Channel change: the picture jitters with a brief red/blue colour split. */
.tv-screen.is-glitch>* {
  animation: crt-glitch .24s steps(3) both;
}

@keyframes crt-glitch {
  0% {
    transform: translateX(-4px);
    filter: drop-shadow(3px 0 0 rgba(255, 40, 90, .75)) drop-shadow(-3px 0 0 rgba(40, 220, 255, .75));
  }

  50% {
    transform: translateX(3px);
    filter: drop-shadow(-2px 0 0 rgba(255, 40, 90, .6)) drop-shadow(2px 0 0 rgba(40, 220, 255, .6));
  }

  100% {
    transform: none;
    filter: none;
  }
}

.tv-osd {
  position: absolute;
  top: 58px;
  right: 22px;
  z-index: 4;
  font-family: var(--mono);
  font-size: 44px;
  color: var(--status-live);
  text-shadow: 3px 3px 0 #000;
  opacity: 0;
  transition: opacity .2s steps(2);
}

.tv-osd.is-active {
  opacity: 1;
}

/* CRT switch-on (matches the demo): a thin line grows out from the centre,
   snaps open into a full cream frame, which fades out through grey as the
   boot text arrives at 700ms. Power-off collapses the picture to a line. */
.tv-screen[data-screen="boot"]::after,
.tv-screen[data-screen="off"]::after {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: #e8ecff;
}

.tv-screen[data-screen="boot"]::after {
  background: #f3efe2;
  transform-origin: 50% 50%;
  animation: crt-on .7s linear forwards;
}

.tv-screen[data-screen="off"]::after {
  animation: crt-collapse .42s steps(6) forwards;
}

@keyframes crt-on {
  0% {
    transform: scale(0, .01);
    opacity: 0;
  }

  2% {
    transform: scale(.03, .01);
    opacity: 1;
  }

  28% {
    transform: scale(.65, .01);
  }

  34% {
    transform: scale(1, .01);
  }

  40% {
    transform: scale(1, .35);
  }

  48% {
    transform: scale(1, 1);
    background: #f3efe2;
  }

  60% {
    background: #a9a9ab;
  }

  75% {
    background: #6a6a78;
    opacity: 1;
  }

  100% {
    transform: scale(1, 1);
    background: #2a2c48;
    opacity: 0;
  }
}

@keyframes crt-collapse {
  0% {
    transform: scaleY(1);
    opacity: .8;
  }

  70% {
    transform: scaleY(.01);
    opacity: 1;
  }

  100% {
    transform: scaleY(0);
    opacity: 0;
  }
}

.tv-strip {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 14px;
  height: 38px;
  font-family: var(--mono);
  color: var(--ink-soft);
  text-shadow: none;
  font-weight: 500;
  font-size: 11.5px;
  letter-spacing: .14em;
  text-transform: uppercase;
}

.tv-led {
  width: 13px;
  height: 13px;
  border: 2px solid var(--ink-dark);
  background: #5a1020;
}

.tv-led[data-state="on"] {
  background: var(--status-live);
}

.tv-led[data-state="boot"] {
  background: var(--status-live);
  animation: blink .5s steps(1) 10;
}

.tv-led[data-state="loading"] {
  background: var(--accent);
  animation: blink .5s steps(1) 10;
}

.tv-power {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 34px;
  padding: 0 10px;
  background: var(--case-light);
  color: var(--ink-dark);
  border: 2px solid var(--ink-dark);
  font-family: var(--mono);
  cursor: pointer;
  text-shadow: none;
  font-weight: 500;
  font-size: 11.5px;
  letter-spacing: .14em;
  text-transform: uppercase;
}

.tv-power[aria-pressed="false"] {
  animation: blink 1s steps(1) 5;
}

.tv-knob {
  margin-left: auto;
  position: relative;
  width: 30px;
  height: 30px;
  border: 2px solid var(--ink-dark);
  background: var(--case-light);
}

.tv-knob-dot {
  position: absolute;
  width: 5px;
  height: 5px;
  background: var(--ink-dark);
  left: var(--dot-x, 11px);
  top: var(--dot-y, 4px);
  transform: translate(-50%, -50%);
  transition: left .2s steps(2), top .2s steps(2);
}

.tv-slot {
  position: absolute;
  left: 50%;
  bottom: 12px;
  width: 130px;
  height: 6px;
  margin-left: -65px;
  background: var(--ink-dark);
}

.tv-stand {
  position: relative;
  width: 186px;
  height: 14px;
  margin: 0 auto;
  background: var(--case-shade);
  border: 3px solid var(--ink-dark);
  border-top: 0;
}

/* --- title / ready: full-height columns, footer row pinned to the bottom -- */
.tv-title,
.tv-ready {
  display: flex;
  flex-direction: column;
  gap: 10px;
  height: 100%;
}

.tv-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.tv-foot {
  margin-top: auto;
}

.tv-kicker {

  font-family: var(--display);
  font-weight: 400;
  font-synthesis: none;
  font-size: 30px;
  letter-spacing: .06em;
  color: var(--muted);
}

.tv-badges {
  display: flex;
  gap: 8px;
}

.badge {
  padding: 1px 8px;
  text-transform: uppercase;
  color: var(--ink-dark);
  text-shadow: none;
  font-family: var(--mono);
  font-size: 11.5px;
  font-weight: 500;
  letter-spacing: .14em;
}

.badge-flag {
  background: var(--accent);
}

.badge-status[data-status="IN PROGRESS"] {
  background: var(--status-progress);
}

.badge-status[data-status="LIVE"] {
  background: var(--status-live);
}

.badge-status[data-status="COMPLETE"] {
  background: var(--status-complete);
}

.tv-header-row {
  display: flex;
  align-items: center;
  gap: 22px;
  margin-top: 4px;
}

.tv-icon {
  width: 64px;
  height: 64px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.tv-icon-img {
  width: 100%;
  height: 100%;
  display: block;
  image-rendering: pixelated;
}

.tv-icon-img svg {
  width: 100%;
  height: 100%;
  display: block;
}

.tv-monogram {
  font-family: var(--display);
  font-size: 36px;
  width: 56px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px dashed var(--hi);
  color: var(--hi);
  font-weight: 400;
  font-synthesis: none;
}

.tv-name {
  margin: 0;
  color: var(--hi);
  font-family: var(--display);
  font-weight: 400;
  font-synthesis: none;
  font-size: 36px;
  line-height: 1;
  letter-spacing: 0;
}

.tv-oneliner {
  margin-top: 8px;
  font-weight: 400;
  font-size: 14px;
}

.tv-blurb {
  opacity: .92;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
  line-clamp: 3;
  overflow: hidden;
  font-size: 13px;
  line-height: 1.75;
}

.tv-meta {
  font-family: var(--mono);
  font-weight: 400;
  font-size: 13px;
  line-height: 1.75;
}

.tv-meta-label {

  font-weight: 500;
  font-size: 11.5px;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--muted);
  opacity: 1;
}

.tv-meta-gap {
  margin-left: 14px;
}

.tv-start,
.tv-open,
.tv-eject {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  height: 42px;
  padding: 0 30px;
  font-family: var(--mono);
  text-decoration: none;
  cursor: pointer;
  border: 0;
  background: var(--hi);
  color: var(--hi-fg);
  background-image: repeating-linear-gradient(to bottom, rgba(0, 0, 0, .12) 0 1px, transparent 1px 3px);
  font-weight: 500;
  font-size: 13px;
  letter-spacing: .12em;
  text-transform: uppercase;
  white-space: nowrap;
}

.tv-start-arrow {
  animation: blink 1s steps(1) 5;
}

.tv-eject {
  background: transparent;
  color: var(--screen-fg);
  border: 2px solid var(--screen-fg);
  padding: 0 16px;
}

.tv-open {
  padding: 0 16px;
}

.tv-open-soon {
  opacity: .75;
  cursor: default;
}

.tv-ready-actions {
  display: flex;
  gap: 12px;
}

.tv-ready-head {
  font-size: 42px;
}

.tv-ready-sub {
  margin-top: 6px;
  font-family: var(--mono);
  font-size: 22px;
}

/* --- loading -- */
.tv-loading {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 16px 10px 0;
}

.tv-loading-head {
  font-family: var(--display);
  font-size: 52px;
  line-height: .9;
  letter-spacing: 2px;
}

.tv-loading-code {
  font-family: var(--mono);
  font-size: 25px;
  color: var(--hi);
}

.tv-bar {
  width: 430px;
  height: 24px;
  border: 2px solid var(--screen-fg);
  background: #000;
  padding: 2px;
}

.tv-bar-fill {
  height: 100%;
  width: 100%;
  background: var(--hi);
  transform-origin: left center;
  background-image: repeating-linear-gradient(to bottom, rgba(0, 0, 0, .18) 0 1px, transparent 1px 3px);
  animation: bar-fill 1.2s steps(10) forwards;
}

@keyframes bar-fill {
  from {
    transform: scaleX(0);
  }

  to {
    transform: scaleX(1);
  }
}

.tv-mono {
  font-family: var(--mono);
  font-size: 20px;
  color: var(--muted);
}

.tv-cursor {
  animation: blink .8s steps(1) 6;
}

/* --- boot / off -- */
.tv-boot {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 14px 10px 0;
}

.tv-boot-head {
  font-family: var(--display);
  font-size: 58px;
  line-height: .9;
  letter-spacing: 2px;
  margin-bottom: 6px;
}

.tv-boot-ver {
  font-family: var(--mono);
  font-size: 18px;
  color: var(--muted);
  margin-bottom: 10px;
}

.tv-boot-line {
  font-family: var(--mono);
  font-size: 22px;
  color: var(--status-live);
  white-space: pre;
}

.tv-boot-line.is-ready {
  color: var(--accent);
}

.tv-off {
  height: 100%;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding-bottom: 14px;
}

/* First-visit cold start: "NO SIGNAL" and a prompt pointing down at POWER. */
.tv-cold {
  flex-direction: column;
  align-items: flex-start;
  justify-content: space-between;
  padding: 22px 6px 6px;
}

.tv-cold-title {
  font-family: var(--display);
  font-size: 40px;
  letter-spacing: 3px;
  color: #3a3d5c;
}

.tv-cold-hint {
  font-family: var(--mono);
  font-size: 26px;
  color: var(--accent);
  animation: blink 1s steps(1) infinite;
}

/* BIOS power-on self test (cold boot only). */
.tv-post-head {
  font-family: var(--mono);
  font-size: 30px;
  color: var(--text);
  margin-bottom: 2px;
}

.tv-post-line {
  font-family: var(--mono);
  font-size: 22px;
  color: var(--text-soft);
  white-space: pre;
}

.tv-post-line.is-dim {
  color: var(--muted);
  margin-bottom: 8px;
}

.tv-post-line.is-ok {
  color: var(--status-live);
  margin-top: 6px;
}

.tv-off-hint {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 19px;
}

.tv-empty {
  margin: auto;
  font-family: var(--mono);
  font-size: 22px;
  color: var(--muted);
}

@keyframes blink {
  50% {
    opacity: .2;
  }
}

/* ------------------------------------------------------------------ shelf -- */

/* Cartridges stand on the plank (y 668); the inserted one slides up behind
   the TV, which sits above the shelf in z-order. */
.shelf {
  position: absolute;
  left: 0;
  top: 468px;
  width: 700px;
  height: 200px;
  z-index: 10;
}

.shelf-plank {
  position: absolute;
  left: 0;
  top: 668px;
  width: 700px;
  height: 13px;
  z-index: 11;
  background: var(--case);
  border: 2px solid var(--ink-dark);
  box-shadow: inset 0 3px 0 var(--case-light), 0 6px 0 var(--drop);
}

.shelf-plank::before,
.shelf-plank::after {
  content: '';
  position: absolute;
  top: 11px;
  width: 16px;
  height: 13px;
  background: var(--case);
  border: 2px solid var(--ink-dark);
  border-top: 0;
}

.shelf-plank::before {
  left: 56px;
}

.shelf-plank::after {
  right: 56px;
}

.cartridge {
  position: absolute;
  left: 50%;
  bottom: 0;
  width: 112px;
  height: 136px;
  margin-left: -56px;
  transform-origin: bottom center;
  text-decoration: none;
  color: var(--ink);
  cursor: pointer;
  background: var(--case);
  border: 3px solid var(--ink-dark);
  box-shadow: inset 3px 3px 0 var(--case-light), inset -3px -3px 0 var(--case-shade), 5px 5px 0 var(--drop);
  transition: transform .36s steps(15), opacity .3s steps(15);
  text-shadow: none;
}

.cart-grip {
  position: absolute;
  top: 10px;
  left: 20px;
  right: 20px;
  height: 8px;
  background: linear-gradient(var(--case-shade) 0 2px, transparent 2px 5px, var(--case-shade) 5px 7px, transparent 7px);
}

.cart-window {
  position: absolute;
  top: 24px;
  left: 11px;
  right: 11px;
  height: 66px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--hi, var(--accent));
  border: 3px solid var(--ink-dark);
}

.cart-window::after {
  content: '';
  position: absolute;
  top: 3px;
  right: 3px;
  width: 7px;
  height: 7px;
  background: var(--case-light);
}

.cartridge-code {
  position: absolute;
  top: 1px;
  left: 3px;
  font-family: var(--mono);
  line-height: 1;
  color: var(--hi-fg, var(--ink-dark));
  font-weight: 500;
  font-size: 10px;
  letter-spacing: .14em;
  text-transform: uppercase;
}

.cartridge-icon {
  width: 50px;
  height: 50px;
  margin-top: 8px;
  image-rendering: pixelated;
  display: inline-block;
}

.cartridge-icon svg {
  width: 100%;
  height: 100%;
  display: block;
}

/* On the window (painted --hi) the icon's own fill is a lighter tint of it. */
.cart-window svg .f {
  fill: color-mix(in srgb, var(--hi) 40%, #fff);
}

.cartridge-monogram {
  width: 40px;
  height: 40px;
  margin-top: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--display);
  font-size: 28px;
  border: 2px dashed var(--ink-dark);
  color: var(--hi-fg, var(--ink-dark));
  font-weight: 400;
  font-synthesis: none;
}

.cartridge-name {
  position: absolute;
  left: 0;
  right: 0;
  top: 98px;
  text-align: center;
  font-family: var(--mono);
  text-transform: uppercase;
  color: var(--ink);
  text-shadow: none;
  font-weight: 500;
  font-size: 11.5px;
  letter-spacing: .14em;
}

/* --lift raises whichever visible cartridge is hovered or focused. */
.cartridge {
  --lift: 0px;
}

.cartridge:hover,
.cartridge:focus-visible {
  --lift: -10px;
}

.cartridge[data-slot="0"] {
  transform: translateY(calc(-20px + var(--lift))) scale(1.1);
  z-index: 10;
}

.cartridge[data-slot="-1"] {
  transform: translateX(-138px) translateY(var(--lift)) scale(.86);
  z-index: 9;
}

.cartridge[data-slot="1"] {
  transform: translateX(138px) translateY(var(--lift)) scale(.86);
  z-index: 9;
}

.cartridge[data-slot="-2"] {
  transform: translateX(-250px) translateY(var(--lift)) scale(.72);
  opacity: .55;
  z-index: 8;
}

.cartridge[data-slot="2"] {
  transform: translateX(250px) translateY(var(--lift)) scale(.72);
  opacity: .55;
  z-index: 8;
}

.cartridge[data-slot="-2"]:hover,
.cartridge[data-slot="2"]:hover {
  opacity: .8;
}

.cartridge[data-slot="-3"] {
  transform: translateX(-330px) scale(.6);
  opacity: 0;
  z-index: 7;
}

.cartridge[data-slot="3"] {
  transform: translateX(330px) scale(.6);
  opacity: 0;
  z-index: 7;
}

.cartridge[data-slot="-4"] {
  transform: translateX(-360px) scale(.5);
  opacity: 0;
  z-index: 6;
}

.cartridge[data-slot="4"] {
  transform: translateX(360px) scale(.5);
  opacity: 0;
  z-index: 6;
}

.cartridge[data-slot="in"] {
  transform: translateY(-232px);
  opacity: 1;
  z-index: 5;
  pointer-events: none;
}

.cartridge[data-slot="filtered"] {
  transform: translateY(40px) scale(.5);
  opacity: 0;
  pointer-events: none;
  z-index: 1;
}

.cartridge:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 3px;
}

/* --------------------------------------------------------------- controls -- */

.deck-controls {
  position: absolute;
  left: 0;
  top: 704px;
  width: 700px;
  height: 42px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.genre-tabs {
  display: flex;
  gap: 8px;
}

.genre-tab {
  height: 42px;
  padding: 0 11px;
  border: 2px solid var(--tab-line);
  background: transparent;
  color: var(--text);
  font-family: var(--mono);
  text-transform: uppercase;
  white-space: nowrap;
  cursor: pointer;
  font-weight: 500;
  font-size: 13px;
  letter-spacing: .12em;
}

.genre-count {
  opacity: .55;
  margin-left: 2px;
}

.genre-tab[aria-pressed="true"] {
  background: var(--text);
  color: var(--ink-dark);
  border-color: var(--text);
  text-shadow: none;
}

.shelf-controls {
  display: flex;
  align-items: center;
  gap: 18px;
}

.shelf-controls button {
  width: 42px;
  height: 42px;
  padding: 0;
  cursor: pointer;
  font-size: 15px;
  background: var(--case-light);
  color: var(--ink-dark);
  border: 2px solid var(--ink-dark);
  box-shadow: 3px 3px 0 var(--drop);
  text-shadow: none;
}

.shelf-controls button:disabled {
  opacity: .4;
  cursor: default;
}

#genre-counter {
  min-width: 7ch;
  text-align: center;
  font-family: var(--display);
  font-weight: 400;
  font-synthesis: none;
  font-size: 40px;
}

@media (prefers-reduced-motion: reduce) {

  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }

  .tv-screen[data-screen]::after {
    display: none;
  }
}

/* ------------------------------------------------------- retro windows -- */

.win-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 4px 6px 4px 10px;
  background: var(--title-bar);
  color: #fff;
  font-family: var(--body);
  font-weight: 700;
  font-size: 14px;
}

.win-btn {
  display: inline-block;
  min-width: 84px;
  padding: 4px 14px;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  background: var(--case-light);
  color: var(--ink-dark);
  border: 2px solid var(--ink-dark);
  box-shadow: 2px 2px 0 var(--ink-dark);
  font-family: var(--mono);
  font-size: 20px;
  text-shadow: none;
}

.win-btn:active {
  box-shadow: none;
  transform: translate(2px, 2px);
}

.win-close {
  width: 22px;
  height: 22px;
  padding: 0;
  line-height: 1;
  cursor: pointer;
  font-size: 12px;
  background: var(--case-light);
  color: var(--ink-dark);
  border: 2px solid var(--ink-dark);
  text-shadow: none;
}

#cv-toast {
  position: fixed;
  left: 24px;
  bottom: 24px;
  width: 350px;
  z-index: 50;
  background: var(--case);
  border: 3px solid var(--ink-dark);
  box-shadow: 6px 6px 0 var(--drop);
}

#cv-toast[hidden] {
  display: none;
}

.toast-body {
  padding: 10px 12px 12px;
  color: var(--ink-dark);
  text-shadow: none;
}

.toast-body p {
  font-family: var(--mono);
  font-size: 21px;
  margin-bottom: 8px;
}

.toast-bar {
  height: 16px;
  background: #fff;
  border: 2px solid var(--ink-dark);
}

.toast-bar-fill {
  height: 100%;
  width: 0;
  background: var(--title-bar);
}

dialog#contact-dialog,
dialog.save-dialog {
  width: 520px;
  max-width: calc(100vw - 32px);
  padding: 0;
  background: var(--case);
  color: var(--ink-dark);
  border: 3px solid var(--ink-dark);
  box-shadow: 8px 8px 0 rgba(0, 0, 0, .45);
  text-shadow: none;
}

dialog#contact-dialog::backdrop,
dialog.save-dialog::backdrop {
  background: rgba(8, 8, 18, .6);
}

/* save.exe (the CV button): two big choices, and a small way out. */
dialog.save-dialog {
  width: 440px;
}

dialog.save-dialog[open] {
  animation: ed-in-up .22s steps(4) both;
}

.save-options {
  display: grid;
  gap: 10px;
  margin-top: 4px;
}

.save-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  text-decoration: none;
  cursor: pointer;
  font-family: var(--mono);
  font-size: 24px;
  letter-spacing: 1px;
  color: var(--ink-dark);
  background: var(--case-light);
  border: 3px solid var(--ink-dark);
  box-shadow: 4px 4px 0 var(--ink-dark);
  text-shadow: none;
}

.save-btn small {
  margin-left: auto;
  font-size: 18px;
  color: inherit;
  opacity: .75;
}

.save-btn:hover {
  background: #fff;
}

.save-btn:active {
  box-shadow: none;
  transform: translate(4px, 4px);
}

.save-primary {
  background: var(--title-bar);
  color: #fff;
}

.save-primary:hover {
  background: #3a3fa6;
}

.save-btn:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
}

.save-nevermind {
  display: block;
  margin: 16px auto 0;
  padding: 2px 6px;
  cursor: pointer;
  font-family: var(--mono);
  font-size: 16px;
  color: var(--ink-soft);
  background: none;
  border: 0;
  text-decoration: underline;
  text-underline-offset: 3px;
  text-shadow: none;
}

.save-nevermind:hover {
  color: var(--ink-dark);
  text-shadow: none;
}

.dialog-body {
  margin: 4px;
  padding: 20px 22px 16px;
  background: #fbf9ef;
}

.dialog-heading {
  font-family: var(--body);
  font-weight: 700;
  font-size: 34px;
  margin: 0 0 10px;
}

.dialog-lede {
  font-size: 14px;
  color: var(--ink-soft);
  margin-bottom: 14px;
  text-shadow: none;
}

.contact-row {
  display: grid;
  grid-template-columns: 108px 1fr auto;
  align-items: center;
  gap: 10px;
  padding: 5px 0;
}

.contact-row-label {
  font-family: var(--mono);
  font-size: 20px;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--ink-soft);
  text-shadow: none;
}

.contact-row-value {
  font-family: var(--mono);
  font-size: 21px;
  overflow-wrap: anywhere;
}

.dialog-actions {
  display: flex;
  justify-content: flex-end;
  padding: 10px 14px 12px;
}

/* ------------------------------------------------------------------- login -- */

body.login-page {
  display: grid;
  place-items: center;
  padding: 16px;
}

.login-win {
  width: 420px;
  max-width: 100%;
  background: var(--case);
  color: var(--ink-dark);
  border: 3px solid var(--ink-dark);
  box-shadow: 8px 8px 0 rgba(0, 0, 0, .45);
  text-shadow: none;
}

.login-win .win-close {
  display: grid;
  place-items: center;
  text-decoration: none;
}

.login-win .dialog-heading {
  font-size: 30px;
}

.login-form {
  display: grid;
  gap: 6px;
}

.login-form label {
  font-family: var(--mono);
  font-size: 20px;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--ink-soft);
  margin-top: 6px;
  text-shadow: none;
}

.login-form input {
  font-family: var(--mono);
  font-size: 22px;
  padding: 6px 10px;
  width: 100%;
  background: #fff;
  color: var(--ink-dark);
  border: 2px solid var(--ink-dark);
  box-shadow: inset 2px 2px 0 var(--case-shade);
  border-radius: 0;
  text-shadow: none;
}

.login-form input:focus-visible {
  outline: 3px solid var(--title-bar);
  outline-offset: 1px;
}

.login-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 16px;
}

.login-actions form {
  margin: 0;
}

.login-back {
  font-family: var(--mono);
  font-size: 20px;
  color: var(--ink-soft);
  text-shadow: none;
}

.login-error {
  margin-bottom: 10px;
  padding: 6px 10px;
  font-size: 14px;
  font-weight: 700;
  background: #ffe1dc;
  color: #7a1a10;
  border: 2px solid #7a1a10;
}

.win-btn:disabled {
  opacity: .5;
  cursor: not-allowed;
}

.login-win :focus-visible {
  outline-color: var(--title-bar);
}

/* ----------------------------------------------------- lights off / on -- */

/* deck.js adds .lights inside .board (first visit only). It covers the whole
   window, and the TV is lifted above it so the set is the only thing lit. A
   soft glow around the screen stands in for light spilling into the room. */
.lights {
  position: fixed;
  inset: 0;
  z-index: 30;
  cursor: pointer;
  background: rgba(4, 5, 12, .9);
}

html.board-on .lights {
  position: absolute;
  inset: -2000px;
  /* the board is transformed: cover the letterbox too */
  background: radial-gradient(ellipse 520px 380px at calc(2000px + 990px) calc(2000px + 300px),
      rgba(20, 24, 60, .55), rgba(4, 5, 12, .93) 100%);
}

html.lights-off .tv-unit,
html.lights-coming-on .tv-unit {
  z-index: 40;
}

html.lights-off .tv-screen-wrap {
  box-shadow: 0 0 60px 10px rgba(143, 160, 255, .18);
}

html.lights-off .tv-power {
  position: relative;
  z-index: 1;
  outline: 3px solid var(--accent);
  outline-offset: 3px;
  animation: power-pulse 1.2s steps(2) infinite;
}

html.lights-off .tv-power.is-nudged {
  animation: power-nudge .4s steps(4), power-pulse 1.2s steps(2) .4s infinite;
}

@keyframes power-pulse {
  50% {
    outline-color: transparent;
  }
}

@keyframes power-nudge {
  25% {
    transform: translateX(-4px);
  }

  75% {
    transform: translateX(4px);
  }
}

/* Lights come up like a fluorescent tube: two flickers, then on. */
html.lights-coming-on .lights {
  pointer-events: none;
  animation: lights-fade .6s ease-out forwards;
}

/* Powering the TV on is not the light switch: the dark-room cover just melts
   away, with no tube flicker (that is look.js's switch). */
@keyframes lights-fade {
  from {
    opacity: 1;
  }

  to {
    opacity: 0;
  }
}

@keyframes lights-up {
  0% {
    opacity: 1;
  }

  30% {
    opacity: .35;
  }

  40% {
    opacity: 1;
  }

  55% {
    opacity: .15;
  }

  65% {
    opacity: .6;
  }

  80%,
  100% {
    opacity: 0;
  }
}

/* ------------------------------------------------------------ project page -- */

/* project.php: one page per project, built from its row. Flowing layout (no
   board scaling); colours come from the project's [data-slug] variables. */
body.project-page {
  min-height: 100vh;
}

.project-page .topbar {
  max-width: 1180px;
  margin: 0 auto;
}

.project {
  max-width: 1180px;
  margin: 0 auto;
  padding: 8px 32px 64px;
}

.project-hero {
  display: flex;
  gap: 28px;
  align-items: center;
  padding: 28px 32px;
  background: var(--screen-bg);
  color: var(--screen-fg);
  border: 4px solid var(--ink-dark);
  box-shadow: 8px 8px 0 var(--drop);
  background-image: repeating-linear-gradient(0deg, rgba(0, 0, 0, .18) 0 2px, transparent 2px 4px);
}

.project-icon {
  flex: none;
  width: 112px;
  height: 112px;
  image-rendering: pixelated;
}

.project-icon svg {
  width: 100%;
  height: 100%;
  display: block;
}

.project-monogram {
  display: grid;
  place-items: center;
  background: var(--hi);
  color: var(--hi-fg);
  font-family: var(--display);
  font-size: 72px;
  border: 3px solid var(--ink-dark);
}

.project-name {
  margin: 2px 0 4px;
  font-family: var(--display);
  font-size: clamp(44px, 7vw, 76px);
  line-height: .95;
  letter-spacing: 1px;
  color: var(--hi);
  overflow-wrap: anywhere;
}

.project-tagline {
  font-family: var(--body);
  font-weight: 700;
  font-size: 20px;
}

.project-badges {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 12px;
}

.badge-party {
  background: var(--case-light);
}

.project-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: 32px;
  margin-top: 32px;
  align-items: start;
}

.project-window {
  background: var(--case);
  border: 3px solid var(--ink-dark);
  box-shadow: 6px 6px 0 var(--drop);
}

.project-md {
  margin: 4px;
  padding: 24px 28px 28px;
  background: var(--paper, #fbf9ef);
  color: var(--ink-dark);
  font-family: var(--body);
  font-size: 17px;
  line-height: 1.6;
  text-shadow: none;
}

.project-md> :first-child {
  margin-top: 0;
}

.project-md h1,
.project-md h2,
.project-md h3 {
  font-family: var(--display);
  letter-spacing: 1px;
  line-height: 1.05;
  margin: 1.4em 0 .4em;
}

.project-md h1 {
  font-size: 40px;
}

.project-md h2 {
  font-size: 32px;
  border-bottom: 3px solid var(--ink-dark);
  padding-bottom: 4px;
}

.project-md h3 {
  font-size: 26px;
}

.project-md p,
.project-md ul,
.project-md ol,
.project-md pre,
.project-md blockquote,
.project-md .wiki-tablewrap {
  margin: 0 0 1em;
}

.project-md a {
  color: #2b2f86;
  text-underline-offset: 3px;
}

.project-md code {
  font-family: var(--mono);
  font-size: 1.1em;
  background: #ece8d8;
  padding: 0 4px;
}

.project-md pre {
  background: var(--ink-dark);
  color: var(--text);
  padding: 14px 16px;
  overflow-x: auto;
  border: 3px solid var(--ink);
}

.project-md pre code {
  background: none;
  padding: 0;
  color: inherit;
}

.project-md blockquote {
  border-left: 6px solid var(--title-bar);
  padding: 4px 14px;
  background: #efeadb;
}

.project-md img {
  max-width: 100%;
  height: auto;
  image-rendering: auto;
  border: 3px solid var(--ink-dark);
}

.project-md .wiki-tablewrap {
  overflow-x: auto;
}

.project-md table {
  border-collapse: collapse;
  width: 100%;
  font-size: 15px;
}

.project-md th,
.project-md td {
  border: 2px solid var(--ink-dark);
  padding: 6px 10px;
  text-align: left;
}

.project-md th {
  background: var(--case);
}

.project-md .wiki-desc {
  font-size: 19px;
  font-weight: 700;
  color: var(--ink-soft);
  text-shadow: none;
}

.project-md .task-item {
  list-style: none;
}

.project-soon {
  font-family: var(--mono);
  font-size: 22px;
  color: var(--ink-soft);
  text-shadow: none;
}

.project-side {
  display: grid;
  gap: 22px;
}

.project-enter {
  display: block;
  padding: 14px 18px;
  text-align: center;
  text-decoration: none;
  background: var(--hi);
  color: var(--hi-fg);
  border: 3px solid var(--ink-dark);
  box-shadow: 4px 4px 0 var(--drop);
  font-family: var(--mono);
  font-size: 26px;
  letter-spacing: 2px;
}

.project-enter:active {
  box-shadow: none;
  transform: translate(4px, 4px);
}

.project-facts h2 {
  margin: 0 0 8px;
  font-family: var(--mono);
  font-size: 20px;
  letter-spacing: 2px;
  color: var(--muted);
  font-weight: 400;
}

.project-facts p {
  font-family: var(--mono);
  font-size: 22px;
}

.project-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  list-style: none;
  margin: 0;
  padding: 0;
}

.project-chips li {
  padding: 2px 10px;
  background: var(--case-light);
  color: var(--ink-dark);
  border: 2px solid var(--ink-dark);
  font-family: var(--mono);
  font-size: 20px;
  text-shadow: none;
}

.project-list {
  margin: 0;
  padding-left: 20px;
  font-family: var(--mono);
  font-size: 20px;
}

.project-missing .project-md h1 {
  font-size: 44px;
}

/* --- the project desk (desk.js adds html.book-on on wide screens) --------
   The page becomes an app screen: the windows fill the viewport under a
   slimmer hero. readme.md is a book (contents on the left, one ### section at
   a time, the next one flips in); gallery.exe shows one image at a time; a
   taskbar switches between them. Without book-on everything stacks. */
.book-count {
  font-family: var(--mono);
  font-size: 16px;
  font-weight: 400;
  letter-spacing: 1px;
}

.book-toc {
  display: none;
}

.page-kicker {
  margin: 0 0 2px;
  font-family: var(--mono);
  font-size: 18px;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--ink-soft);
  text-shadow: none;
}

.book-page+.book-page {
  border-top: 3px dashed var(--case);
}

.book-page .page-kicker+h3,
.book-page>h2:first-child,
.book-page>h3:first-child {
  margin-top: 0;
}

html.book-on body.project-page {
  height: 100vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

html.book-on .project-page .topbar {
  width: 100%;
  max-width: 1400px;
}

html.book-on .project {
  flex: 1;
  min-height: 0;
  width: 100%;
  max-width: 1400px;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding: 4px 32px 24px;
}

html.book-on .project-hero {
  flex: none;
  gap: 20px;
  padding: 14px 22px;
}

html.book-on .project-icon {
  width: 64px;
  height: 64px;
}

html.book-on .project-monogram {
  font-size: 42px;
}

html.book-on .project-name {
  font-size: 46px;
  margin: 0;
}

html.book-on .project-tagline {
  font-size: 17px;
  margin: 2px 0 0;
}

html.book-on .project-badges {
  margin-top: 6px;
}

html.book-on .project-grid {
  flex: 1;
  min-height: 0;
  margin: 0;
  grid-template-columns: minmax(0, 1fr) 270px;
  gap: 24px;
  align-items: stretch;
}

html.book-on .project-side {
  align-content: start;
  overflow: auto;
  min-height: 0;
  padding: 0 6px 6px 0;
}

/* The windows share one spot; only the front one shows. The inset leaves
   room for the drop shadow. */
html.book-on .project-desk {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 0;
}

html.book-on .desk-windows {
  position: relative;
  flex: 1;
  min-height: 0;
}

html.book-on .desk-window {
  position: absolute;
  inset: 0 6px 6px 0;
  display: flex;
  flex-direction: column;
  min-height: 0;
  visibility: hidden;
}

html.book-on .desk-window.is-front {
  visibility: visible;
  z-index: 1;
}

/* A window that isn't open is taken out entirely: visibility alone isn't
   enough, since a child that sets visibility: visible (the current book
   page, photo or journey entry) would still show through a hidden parent. */
html.book-on .desk-window:not(.is-front) {
  display: none;
}

html.book-on .desk-window>.project-md {
  flex: 1;
  min-height: 0;
  overflow: auto;
}

/* Switching: the window opens up out of the taskbar in quick steps. */
html.book-on .desk-window.is-opening {
  animation: win-open .28s steps(15) both;
  transform-origin: 50% 100%;
}

@keyframes win-open {
  from {
    opacity: .2;
    transform: translateY(40px) scale(.9);
  }

  to {
    opacity: 1;
    transform: none;
  }
}

/* Minimise: the window drops back down into the taskbar. */
html.book-on .desk-window.is-closing {
  animation: win-close .22s steps(15) forwards;
  transform-origin: 50% 100%;
  pointer-events: none;
}

@keyframes win-close {
  to {
    opacity: 0;
    transform: translateY(46px) scale(.88);
  }
}

/* --- the desktop behind the windows (wide screens; desk.js unhides it) ------
   A dark blue wallpaper with scanlines (or the project's own picture, set
   by project.php) and a column of icons that open the windows. Minimising
   a window shows it. */
.desk-top[hidden] {
  display: none;
}

html.book-on .desk-top {
  position: absolute;
  inset: 0 6px 6px 0;
  overflow: hidden;
  border: 3px solid var(--ink-dark);
  box-shadow: 6px 6px 0 var(--drop);
  background:
    repeating-linear-gradient(to bottom, rgba(0, 0, 0, .18) 0 1px, transparent 1px 3px),
    radial-gradient(ellipse 70% 60% at 55% 45%, #2c3674 0%, #1b2150 55%, #11142f 100%);
}

.desk-icons {
  list-style: none;
  margin: 0;
  padding: 18px 14px;
  display: flex;
  flex-direction: column;
  flex-wrap: wrap;
  align-content: flex-start;
  gap: 10px;
  height: 100%;
  box-sizing: border-box;
}

.desk-icon {
  position: relative;
  z-index: 1;
  width: 104px;
  padding: 8px 4px 6px;
  display: grid;
  justify-items: center;
  gap: 6px;
  background: none;
  border: 2px solid transparent;
  cursor: pointer;
  color: var(--text);
}

.desk-icon .di-art {
  width: 48px;
  height: 48px;
  filter: drop-shadow(3px 3px 0 rgba(0, 0, 0, .45));
  transition: transform .12s steps(2);
}

.di-label {
  padding: 1px 5px;
  font-family: var(--mono);
  font-size: 17px;
  line-height: 1.15;
  text-align: center;
  overflow-wrap: anywhere;
  text-shadow: 2px 2px 0 rgba(0, 0, 0, .7);
}

.desk-icon:hover .di-art {
  transform: translateY(-3px);
}

.desk-icon:hover,
.desk-icon:focus-visible {
  outline: none;
  border: 2px dotted rgba(255, 255, 255, .55);
  background: rgba(143, 160, 255, .12);
}

.desk-icon:focus-visible .di-label,
.desk-icon:active .di-label {
  background: var(--title-bar);
  text-shadow: none;
}

button.task-logo {
  cursor: pointer;
}

/* Editor, Look tab: the wallpaper field's preview. */
.wall-row {
  display: flex;
  align-items: flex-start;
  gap: 14px;
}

.wall-preview {
  flex: none;
  width: 160px;
  height: 100px;
  object-fit: cover;
  border: 2px solid var(--ink-dark);
  image-rendering: auto;
}

.wall-preview.is-default {
  background: radial-gradient(ellipse 70% 60% at 55% 45%, #2c3674 0%, #1b2150 55%, #11142f 100%);
}

button.task-logo:hover {
  background: color-mix(in srgb, var(--title-bar) 80%, #fff);
}

/* Power on (desk.js, every visit): the monitor opens out of a bright line
   into the picture, overexposed, then settles; live static (.crt-static, a
   canvas) fades out over it. The windows stay put underneath. */
html.book-on .project-desk {
  position: relative;
}

/* Until desk.js powers on (arrive.js sets desk-pre before the first paint)
   the monitor is dark; the delayed reveal is a fallback should it never run. */
html.desk-pre .project-desk {
  visibility: hidden;
  animation: desk-pre-reveal 0s 2.5s forwards;
}

@keyframes desk-pre-reveal {
  to {
    visibility: visible;
  }
}

html.book-on .project-desk.is-booting {
  animation: desk-crt-on .9s linear both;
  transform-origin: 50% 50%;
}

@keyframes desk-crt-on {
  0% {
    transform: scale(.03, .005);
    filter: brightness(5) saturate(0);
  }

  14% {
    transform: scale(1, .006);
    filter: brightness(5) saturate(0);
  }

  30% {
    transform: scale(1, 1);
    filter: brightness(2.4) contrast(1.3) saturate(.4);
  }

  46% {
    filter: brightness(1.5) saturate(.8);
  }

  60% {
    filter: brightness(.85);
  }

  74% {
    filter: brightness(1.15);
  }

  100% {
    transform: none;
    filter: none;
  }
}

.crt-static {
  position: absolute;
  inset: 0 6px 6px 0;
  width: calc(100% - 6px);
  height: calc(100% - 6px);
  z-index: 5;
  pointer-events: none;
  image-rendering: pixelated;
  mix-blend-mode: screen;
  animation: crt-static .9s linear forwards;
}

@keyframes crt-static {
  0% {
    opacity: .95;
  }

  30% {
    opacity: .8;
  }

  60% {
    opacity: .35;
  }

  85% {
    opacity: .1;
  }

  100% {
    opacity: 0;
  }
}

/* Maximised: the window takes the whole viewport, the page dims behind it. */
html.book-on .desk-window.is-max {
  position: fixed;
  inset: 18px 24px;
  z-index: 60;
  box-shadow: 8px 8px 0 var(--drop), 0 0 0 100vmax rgba(8, 7, 16, .72);
}

.win-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.win-ctls {
  display: flex;
  gap: 3px;
}

.win-ctls[hidden] {
  display: none;
}

.win-ctl {
  width: 22px;
  height: 20px;
  padding: 0;
  cursor: pointer;
  line-height: 1;
  font-family: var(--mono);
  font-size: 16px;
  color: var(--ink-dark);
  background: var(--case-light);
  border: 2px solid var(--ink-dark);
  box-shadow: inset -2px -2px 0 rgba(0, 0, 0, .18);
  text-shadow: none;
}

.win-ctl:hover {
  background: #fff;
}

.win-ctl:active {
  box-shadow: inset 2px 2px 0 rgba(0, 0, 0, .25);
}

html.book-on .win-title {
  user-select: none;
}

html.book-on .project-book {
  display: flex;
  flex-direction: column;
  min-height: 0;
}

html.book-on .book-body {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: 230px minmax(0, 1fr);
}

html.book-on .book-toc {
  display: block;
  overflow: auto;
  padding: 10px 8px 10px 10px;
  background: var(--case);
}

.book-toc ol {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 2px;
}

.toc-chapter {
  margin: 12px 4px 2px;
  font-family: var(--mono);
  font-size: 16px;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--ink-soft);
  text-shadow: none;
}

.toc-chapter:first-child {
  margin-top: 0;
}

.book-toc a {
  display: block;
  padding: 4px 8px;
  text-decoration: none;
  color: var(--ink-dark);
  font-family: var(--body);
  font-size: 15px;
  line-height: 1.3;
  border: 2px solid transparent;
  transition: transform .15s cubic-bezier(.2, .8, .2, 1), background .15s;
  text-shadow: none;
}

.book-toc a.is-sub {
  padding-left: 16px;
}

.book-toc a:hover {
  transform: translateX(3px);
  background: var(--case-light);
}

.book-toc a[aria-current="page"] {
  background: var(--ink-dark);
  color: var(--case-light);
  border-color: var(--ink-dark);
}

html.book-on .book-pages {
  position: relative;
  min-height: 0;
  margin: 4px 4px 0 0;
  perspective: 2400px;
  overflow: hidden;
  background: var(--paper, #efeadb);
}

html.book-on .book-page {
  position: absolute;
  inset: 0;
  margin: 0;
  overflow: auto;
  visibility: hidden;
  border-top: 0;
  transform-origin: left center;
  backface-visibility: hidden;
  scrollbar-color: var(--ink-soft) transparent;
}

html.book-on .book-page.is-current {
  visibility: visible;
  z-index: 1;
}

/* Forward: the old page turns away to the left, over the new one. */
html.book-on .book-page.is-leaving {
  visibility: visible;
  z-index: 2;
  animation: page-away .55s cubic-bezier(.45, .05, .55, .95) forwards;
}

/* Back: the new page turns in from the left, over the old one. */
html.book-on .book-page.is-back {
  z-index: 2;
  animation: page-back .55s cubic-bezier(.45, .05, .55, .95);
}

@keyframes page-away {
  0% {
    transform: rotateY(0);
    box-shadow: 0 0 0 rgba(0, 0, 0, 0);
  }

  60% {
    box-shadow: 24px 0 40px rgba(0, 0, 0, .35);
  }

  100% {
    transform: rotateY(-100deg);
    box-shadow: 24px 0 40px rgba(0, 0, 0, 0);
  }
}

@keyframes page-back {
  0% {
    transform: rotateY(-100deg);
    box-shadow: 24px 0 40px rgba(0, 0, 0, 0);
  }

  40% {
    box-shadow: 24px 0 40px rgba(0, 0, 0, .35);
  }

  100% {
    transform: rotateY(0);
    box-shadow: 0 0 0 rgba(0, 0, 0, 0);
  }
}

.book-nav {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 10px;
  background: var(--case);
  border-top: 3px solid var(--ink-dark);
}

.book-nav[hidden] {
  display: none;
}

.book-where {
  flex: 1;
  min-width: 0;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-family: var(--mono);
  font-size: 20px;
  color: var(--ink-dark);
  text-shadow: none;
}

.book-btn {
  min-width: 118px;
  padding: 4px 14px;
  cursor: pointer;
  background: var(--case-light);
  color: var(--ink-dark);
  border: 2px solid var(--ink-dark);
  box-shadow: 3px 3px 0 var(--ink-dark);
  font-family: var(--mono);
  font-size: 20px;
  letter-spacing: 1px;
  text-shadow: none;
}

.book-btn:hover:not(:disabled) {
  background: var(--ink-dark);
  color: var(--case-light);
}

.book-btn:active:not(:disabled) {
  box-shadow: none;
  transform: translate(3px, 3px);
}

.book-btn:disabled {
  opacity: .35;
  cursor: default;
  box-shadow: none;
}

/* --- gallery.exe ---------------------------------------------------------
   Stacked: every image with its caption. Desk: a thumbnail strip on the
   left, one image at a time on a dark stage, the caption in the nav bar. */
.gal-strip {
  display: none;
}

.gal-stage {
  display: grid;
  gap: 18px;
  margin: 4px;
  padding: 18px;
  background: var(--ink-dark);
}

.gal-shot {
  margin: 0;
  display: grid;
  gap: 8px;
  justify-items: center;
}

.gal-shot img {
  display: block;
  max-width: 100%;
  height: auto;
  image-rendering: auto;
}

.gal-shot figcaption {
  font-family: var(--mono);
  font-size: 19px;
  color: var(--case-light);
  text-align: center;
}

.gal-open {
  display: block;
  cursor: zoom-in;
}

html.book-on .gal-body {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: 230px minmax(0, 1fr);
}

html.book-on .gal-strip {
  display: block;
  overflow: auto;
  padding: 10px;
  background: var(--case);
}

.gal-strip ol {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.gal-thumb {
  position: relative;
  display: block;
  aspect-ratio: 16 / 10;
  overflow: hidden;
  background: var(--ink-dark);
  border: 3px solid var(--ink-dark);
  transition: transform .15s cubic-bezier(.2, .8, .2, 1);
}

.gal-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  image-rendering: auto;
  opacity: .75;
  transition: opacity .15s;
}

.gal-thumb:hover {
  transform: translateY(-2px);
}

.gal-thumb:hover img,
.gal-thumb[aria-current="page"] img {
  opacity: 1;
}

.gal-thumb[aria-current="page"] {
  border-color: var(--title-bar);
  box-shadow: 3px 3px 0 var(--ink-dark);
}

.gal-badge {
  position: absolute;
  left: 3px;
  bottom: 3px;
  padding: 0 4px;
  font-family: var(--mono);
  font-size: 13px;
  background: var(--case-light);
  color: var(--ink-dark);
  text-shadow: none;
}

html.book-on .gal-stage {
  position: relative;
  display: block;
  min-height: 0;
  margin: 4px 4px 0 0;
  padding: 0;
  overflow: hidden;
  background: #15121f repeating-linear-gradient(0deg, rgba(255, 255, 255, .025) 0 2px, transparent 2px 4px);
}

/* One grid cell the size of the stage, so the image can fit it either way. */
html.book-on .gal-shot {
  position: absolute;
  inset: 16px 20px 22px 16px;
  display: none;
  grid-template: minmax(0, 1fr) / minmax(0, 1fr);
  place-items: center;
}

html.book-on .gal-shot.is-current {
  display: grid;
}

html.book-on .gal-shot figcaption {
  display: none;
}

html.book-on .gal-shot .gal-open {
  display: contents;
}

html.book-on .gal-shot img {
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  box-sizing: border-box;
  border: 3px solid var(--ink-dark);
  box-shadow: 6px 6px 0 rgba(0, 0, 0, .45);
}

html.book-on .gal-shot.is-in-right {
  animation: shot-in-right .3s steps(6) both;
}

html.book-on .gal-shot.is-in-left {
  animation: shot-in-left .3s steps(6) both;
}

@keyframes shot-in-right {
  from {
    opacity: 0;
    transform: translateX(48px);
  }
}

@keyframes shot-in-left {
  from {
    opacity: 0;
    transform: translateX(-48px);
  }
}

/* --- taskbar ------------------------------------------------------------- */
.taskbar {
  flex: none;
  display: flex;
  align-items: center;
  gap: 10px;
  margin-right: 6px;
  padding: 5px 6px;
  background: var(--case);
  border: 3px solid var(--ink-dark);
  box-shadow: 6px 6px 0 var(--drop);
}

.taskbar[hidden] {
  display: none;
}

.task-logo {
  padding: 3px 10px;
  font-family: var(--display);
  font-size: 22px;
  letter-spacing: 1px;
  line-height: 1;
  color: var(--case-light);
  background: var(--title-bar);
  border: 2px solid var(--ink-dark);
}

.task-btns {
  flex: 1;
  display: flex;
  gap: 6px;
  min-width: 0;
}

.task-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 170px;
  padding: 3px 12px;
  cursor: pointer;
  font-family: var(--mono);
  font-size: 19px;
  color: var(--ink-dark);
  text-align: left;
  background: var(--case-light);
  border: 2px solid var(--ink-dark);
  box-shadow: inset -3px -3px 0 rgba(0, 0, 0, .15), inset 3px 3px 0 rgba(255, 255, 255, .6);
  text-shadow: none;
}

.task-btn:hover {
  background: #fff;
}

.task-btn[aria-pressed="true"] {
  background: var(--ink-dark);
  color: var(--case-light);
  box-shadow: inset 3px 3px 0 rgba(0, 0, 0, .4);
}

.task-btn small {
  margin-left: auto;
  padding: 0 5px;
  font-size: 15px;
  background: rgba(0, 0, 0, .12);
}

.task-btn[aria-pressed="true"] small {
  background: rgba(255, 255, 255, .15);
}

.task-ico {
  font-size: 16px;
}

.task-clock {
  padding: 3px 10px;
  font-family: var(--mono);
  font-size: 17px;
  color: var(--ink-dark);
  white-space: pre;
  border: 2px solid var(--ink-soft);
  box-shadow: inset 2px 2px 0 rgba(0, 0, 0, .15);
  text-shadow: none;
}

@media (max-width: 860px) {
  .project {
    padding: 8px 16px 48px;
  }

  .project-hero {
    flex-direction: column;
    align-items: flex-start;
    padding: 22px;
  }

  .project-grid {
    grid-template-columns: 1fr;
  }

  .project-md {
    padding: 18px;
  }
}

/* Uploaded photos (wider than 128px) are drawn smoothly; pixel art stays crisp. */
img.is-photo {
  image-rendering: auto !important;
}

/* ---------------------------------------------------------------- lighting -- */

/* The room is dark by default (Noir): only the monitor, glowing in the current
   cartridge's colour, and a torch on the pointer are lit. The light switch in
   the top bar (look.js) turns the lights on (Studio): the same room, lit, with
   soft shadows. Edit mode has no lighting. The deck carries the current
   cartridge's --hi via data-slug, so the glow follows the channel. */
html[data-look] .tv-case {
  box-shadow: inset 4px 4px 0 var(--case-light), inset -4px -4px 0 var(--case-shade),
    10px 10px 0 var(--drop), 0 34px 60px -8px rgba(0, 0, 0, .6), 0 12px 24px rgba(0, 0, 0, .35);
}

html[data-look] .tv-stand::after {
  content: '';
  position: absolute;
  left: -60px;
  right: -60px;
  top: 10px;
  height: 26px;
  background: radial-gradient(closest-side, rgba(0, 0, 0, .55), transparent);
  filter: blur(4px);
}

html[data-look] .cartridge {
  filter: drop-shadow(0 16px 14px rgba(0, 0, 0, .5));
}

html[data-look] .cartridge[data-slot="0"] {
  filter: drop-shadow(0 16px 14px rgba(0, 0, 0, .5)) drop-shadow(0 0 16px color-mix(in srgb, var(--hi) 55%, transparent));
}

html[data-look] .shelf-plank {
  box-shadow: inset 0 3px 0 var(--case-light), 0 6px 0 var(--drop), 0 26px 30px rgba(0, 0, 0, .55);
}

html[data-look] .avatar {
  box-shadow: 0 0 0 2px var(--ink), 8px 10px 0 rgba(0, 0, 0, .35), 0 18px 30px rgba(0, 0, 0, .45);
}

html[data-look] .btn {
  box-shadow: 3px 3px 0 var(--drop), 0 12px 20px rgba(0, 0, 0, .35);
}

html[data-look] .genre-tab,
html[data-look] .shelf-controls button {
  box-shadow: 0 8px 14px rgba(0, 0, 0, .35);
}

html[data-look] .profile-name {
  text-shadow: 4px 5px 0 rgba(0, 0, 0, .45), 0 0 28px rgba(255, 207, 90, .18);
}

/* The monitor's light spilling into the room, in the cartridge's colour.
   Brighter with the lights off; out when the TV is off. */
html[data-look] .tv-unit::before {
  content: '';
  position: absolute;
  left: -300px;
  right: -300px;
  top: -180px;
  height: 860px;
  z-index: -1;
  pointer-events: none;
  background: radial-gradient(closest-side, color-mix(in srgb, var(--hi, #8fd0f5) 42%, transparent) 0%,
      color-mix(in srgb, var(--hi, #8fd0f5) 26%, transparent) 55%, transparent 100%);
  opacity: .45;
  transition: opacity .4s, background .5s;
}

html[data-look="noir"] .tv-unit::before {
  opacity: 1;
}

html[data-look] .deck[data-power="off"] .tv-unit::before {
  opacity: 0;
}

/* Layer 1, always: a soft vignette. */
html[data-look] body::before {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 60;
  background: radial-gradient(ellipse 75% 70% at 55% 45%, transparent 55%, rgba(0, 0, 0, .38) 100%);
}

/* Layer 2: the dark, with two lights cut out of it: the monitor (always on,
   placed over the TV by look.js) and a torch following the pointer (--mx/--my).
   Each mask is opaque except its hole; "intersect" keeps the dark only where
   both are opaque, i.e. outside both lights. The switch fades it in and out. */
html[data-look] body::after {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 61;
  background: rgba(3, 4, 12, .76);
  -webkit-mask-image:
    radial-gradient(var(--tv-rx, 440px) var(--tv-ry, 380px) at var(--tv-x, 69%) var(--tv-y, 40%), transparent 38%, #000 100%),
    radial-gradient(circle var(--torch-r, 210px) at var(--mx, -9999px) var(--my, -9999px), transparent 28%, #000 100%);
  mask-image:
    radial-gradient(var(--tv-rx, 440px) var(--tv-ry, 380px) at var(--tv-x, 69%) var(--tv-y, 40%), transparent 38%, #000 100%),
    radial-gradient(circle var(--torch-r, 210px) at var(--mx, -9999px) var(--my, -9999px), transparent 28%, #000 100%);
  -webkit-mask-composite: source-in;
  mask-composite: intersect;
  opacity: 0;
  transition: opacity .6s steps(12);
}

html[data-look="noir"] body::after {
  opacity: 1;
}

/* Lights on: a fluorescent tube catching — the dark stutters away over a
   dozen frames instead of snapping off (look.js adds .lights-flicker). */
html.lights-flicker[data-look] body::after {
  animation: lights-flicker .8s linear forwards;
}

@keyframes lights-flicker {
  0% {
    opacity: 1;
  }

  10% {
    opacity: .35;
  }

  16% {
    opacity: .95;
  }

  26% {
    opacity: .2;
  }

  32% {
    opacity: .8;
  }

  44% {
    opacity: .12;
  }

  52% {
    opacity: .45;
  }

  64% {
    opacity: .06;
  }

  100% {
    opacity: 0;
  }
}

html[data-look="noir"] .profile {
  filter: saturate(.75) brightness(.9);
}

/* Pages inside the monitor (project pages, About Me): the same room, but the
   lit screen is the desk of windows ([data-lamp], placed by look.js) and the
   dark is a little lighter with a wider glow, so the text stays readable. */
/* The paper in the windows is toned down on the pages, so it doesn't glare
   against the dark room: a slightly deeper cream, with a soft shadow
   settling in from the edges. A touch more with the lights off. The window
   chrome (--case: frames, the book's contents, the journey list, the
   taskbar) goes a neutral grey here; the shelf keeps its lavender. */
body.project-page {
  --paper: #efeadb;
  --paper-shade: rgba(28, 22, 48, .16);
  --case: #a2a2a2;
}

html[data-look="noir"] body.project-page {
  --paper: #e6e0cf;
  --paper-shade: rgba(28, 22, 48, .24);
}

body.project-page .project-md,
body.project-page .jr-entry {
  box-shadow: inset 0 0 36px var(--paper-shade);
  transition: background-color .6s steps(6), box-shadow .6s steps(6);
}

body.project-page .jr-md.project-md {
  box-shadow: none;
}

html[data-look] body.project-page::after {
  background: rgba(3, 4, 12, .64);
  -webkit-mask-image:
    radial-gradient(var(--tv-rx, 800px) var(--tv-ry, 500px) at var(--tv-x, 40%) var(--tv-y, 60%), transparent 58%, #000 100%),
    radial-gradient(circle var(--torch-r, 240px) at var(--mx, -9999px) var(--my, -9999px), transparent 28%, #000 100%);
  mask-image:
    radial-gradient(var(--tv-rx, 800px) var(--tv-ry, 500px) at var(--tv-x, 40%) var(--tv-y, 60%), transparent 58%, #000 100%),
    radial-gradient(circle var(--torch-r, 240px) at var(--mx, -9999px) var(--my, -9999px), transparent 28%, #000 100%);
}

html[data-look] body.edit-mode::before,
html[data-look] body.edit-mode::after {
  display: none;
}

/* The light switch: a pixel wall plate with a rocker. Down = off (Noir). */
.light-switch {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 2px 0;
  cursor: pointer;
  background: none;
  border: 0;
  font-family: var(--body);
  font-weight: 600;
  font-size: 17px;
  color: var(--muted);
}

.light-switch:hover {
  color: var(--text);
}

.topbar-links .light-switch:hover {
  text-decoration: none;
}

/* Sound toggle (sfx.js): a pixel speaker, with a sound wave while it is on. */
.sound-switch {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 2px 0;
  cursor: pointer;
  background: none;
  border: 0;
  font-family: var(--body);
  font-weight: 600;
  font-size: 17px;
  color: var(--muted);
}

.sound-switch:hover {
  color: var(--text);
}

.topbar-links .sound-switch:hover {
  text-decoration: none;
}

.snd-icon {
  position: relative;
  width: 20px;
  height: 16px;
  flex: none;
}

.snd-icon::before {
  /* the speaker */
  content: '';
  position: absolute;
  inset: 0 8px 0 0;
  background: currentColor;
  clip-path: polygon(0 30%, 40% 30%, 100% 0, 100% 100%, 40% 70%, 0 70%);
}

.snd-icon::after {
  /* one sound wave */
  content: '';
  position: absolute;
  left: 15px;
  top: 4px;
  width: 3px;
  height: 8px;
  background: currentColor;
}

.sound-switch.is-muted .snd-icon::after {
  display: none;
}

.sound-switch.is-muted .snd-state {
  color: var(--muted);
}

.snd-state {
  font-family: var(--mono);
  font-size: 18px;
  letter-spacing: 1px;
  min-width: 3ch;
}

.ls-plate {
  position: relative;
  width: 26px;
  height: 36px;
  flex: none;
  background: var(--case);
  border: 3px solid var(--ink-dark);
  box-shadow: 3px 3px 0 var(--drop), inset 2px 2px 0 var(--case-light);
}

.ls-rocker {
  position: absolute;
  left: 5px;
  right: 5px;
  top: 5px;
  height: 20px;
  background: var(--case-shade);
  border: 2px solid var(--ink-dark);
  transition: transform .15s steps(2), background .15s;
}

.light-switch[aria-pressed="false"] .ls-rocker {
  transform: translateY(0);
  background: #5a557a;
}

.light-switch[aria-pressed="true"] .ls-rocker {
  transform: translateY(-2px);
  background: var(--accent);
}

.light-switch[aria-pressed="true"] {
  color: var(--text);
}

.ls-state {
  font-family: var(--mono);
  font-size: 18px;
  letter-spacing: 1px;
  min-width: 3ch;
}

/* ------------------------------------------------------------------ footer -- */

.site-footer {
  text-align: center;
  color: var(--muted);
  font-size: 12px;
  padding: 24px;
}

/* ------------------------------------------------------------------- board -- */

/* The spec's 1440x900 board, scaled whole by deck.js (--bs) and centred
   (--bx/--by). Zones use the spec's own coordinates. */
html.board-on,
html.board-on body {
  height: 100%;
  overflow: hidden;
}

html.board-on .board {
  position: fixed;
  left: 0;
  top: 0;
  width: 1440px;
  height: 900px;
  transform-origin: 0 0;
  transform: translate(var(--bx), var(--by)) scale(var(--bs));
}

html.board-on .topbar {
  position: absolute;
  left: 96px;
  top: 24px;
  width: 1248px;
  height: 44px;
  padding: 0;
}

html.board-on main.stage {
  display: block;
  max-width: none;
  margin: 0;
  padding: 0;
}

html.board-on .profile {
  position: absolute;
  left: 96px;
  top: 100px;
  width: 488px;
}

html.board-on .projects {
  position: absolute;
  left: 640px;
  top: 72px;
  width: 700px;
  height: 800px;
}

html.board-on #cv-toast {
  position: absolute;
  left: 96px;
  bottom: 16px;
}

html.board-on dialog#contact-dialog,
html.board-on dialog.save-dialog {
  transform: scale(var(--bs));
}

html.board-on .site-footer {
  display: none;
}

/* ------------------------------------------------------------------ edit -- */

/* Edit mode is a one-screen app: the page itself never scrolls. A left rail
   picks what to edit, the centre card holds its form split into tabs that
   slide in, and the right column previews it. Tabs are radio buttons (the
   .tab-radio inputs) + sibling selectors, so they work without JavaScript. */
:root {
  --ed-card: #22263a;
  --ed-card-deep: #1c2033;
  --field-bg: #262b41;
  --field-bg-focus: #2d3350;
  --field-line: #474d72;
  --field-text: #e4e1f1;
}

body.edit-mode {
  height: 100vh;
  overflow: hidden;
}

body.edit-mode .board {
  height: 100%;
  display: flex;
  flex-direction: column;
}

body.edit-mode .topbar {
  flex: none;
  padding: 14px 28px;
}

body.edit-mode .edit-strip {
  flex: none;
  padding: 8px 28px;
}

body.edit-mode .site-footer {
  display: none;
}

.editor {
  flex: 1;
  min-height: 0;
  display: grid;
  gap: 20px;
  padding: 18px 24px 22px;
  grid-template-columns: 272px minmax(0, 1fr) 330px;
}

.ed-card {
  min-height: 0;
  background: var(--ed-card);
  color: var(--text);
  border: 3px solid var(--ink-dark);
  box-shadow: 6px 6px 0 var(--drop);
}

@keyframes ed-in-left {
  from {
    opacity: 0;
    transform: translateX(-26px);
  }
}

@keyframes ed-in-right {
  from {
    opacity: 0;
    transform: translateX(26px);
  }
}

@keyframes ed-in-up {
  from {
    opacity: 0;
    transform: translateY(18px);
  }
}

/* --- rail -- */
.ed-rail {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 12px;
  animation: ed-in-left .35s cubic-bezier(.2, .8, .2, 1);
}

.ed-list {
  flex: 1;
  min-height: 0;
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 2px;
}

.ed-list-label {
  display: flex;
  justify-content: space-between;
  margin: 10px 2px 2px;
  font-family: var(--mono);
  font-size: 17px;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--muted);
}

.ed-carts {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 6px;
}

.ed-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 8px;
  text-decoration: none;
  color: var(--text);
  background: rgba(255, 255, 255, .03);
  border: 2px solid transparent;
  transition: transform .18s cubic-bezier(.2, .8, .2, 1), background .18s, border-color .18s;
}

.ed-item:hover {
  transform: translateX(4px);
  background: rgba(255, 255, 255, .07);
}

.ed-item.is-active {
  border-color: var(--accent);
  background: rgba(255, 207, 90, .08);
}

.ed-item-icon {
  flex: none;
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  overflow: hidden;
  background: var(--screen-bg, var(--ink));
  border: 2px solid var(--ink-dark);
}

.ed-item-icon .cartridge-icon {
  width: 30px;
  height: 30px;
  margin: 0;
}

.ed-item-icon .cartridge-monogram {
  width: 30px;
  height: 30px;
  margin: 0;
  font-size: 20px;
  border: 0;
  background: var(--hi);
  color: var(--hi-fg);
}

.ed-item-avatar .avatar {
  width: 38px;
  height: 38px;
  border: 0;
  box-shadow: none;
}

.ed-item-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
  font-weight: 700;
  font-size: 14px;
}

.ed-item-text small {
  font-family: var(--mono);
  font-size: 15px;
  font-weight: 400;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* --- dropdowns (<details>): slide open, caret flips -- */
.dropdown {
  position: relative;
}

.dropdown>summary {
  list-style: none;
  cursor: pointer;
}

.dropdown>summary::-webkit-details-marker {
  display: none;
}

.dd-caret {
  display: inline-block;
  margin-left: 8px;
  transition: transform .2s;
}

.dropdown[open] .dd-caret {
  transform: rotate(180deg);
}

.dropdown-panel {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 6px);
  z-index: 30;
  padding: 12px;
  background: var(--ed-card-deep);
  border: 3px solid var(--ink-dark);
  box-shadow: 6px 6px 0 var(--drop);
  animation: dd-down .22s cubic-bezier(.2, .8, .2, 1);
}

.dropdown-up {
  top: auto;
  bottom: calc(100% + 6px);
  animation-name: dd-up;
}

@keyframes dd-down {
  from {
    opacity: 0;
    transform: translateY(-8px);
  }
}

@keyframes dd-up {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
}

.ed-new>summary {
  width: 100%;
}

.ed-new .btn-outline {
  color: var(--text);
}

.new-cart-form {
  display: grid;
  gap: 10px;
}

.dd-button {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 6px 12px 6px 6px;
  background: var(--field-bg);
  border: 2px solid var(--field-line);
  color: var(--field-text);
  transition: border-color .15s, background .15s;
}

.dd-button:hover,
.dropdown[open]>.dd-button {
  border-color: var(--accent);
  background: var(--field-bg-focus);
}

.dd-current {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--mono);
  font-size: 20px;
}

.dd-current-icon {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  background: var(--screen-bg, var(--ink));
  border: 2px solid var(--ink-dark);
}

.dd-current-icon svg {
  width: 30px;
  height: 30px;
  display: block;
}

.dd-current-icon .icon-letter {
  width: 30px;
  height: 30px;
  font-size: 22px;
}

/* Inside a scrolling tab panel an overlay would be clipped, so the icon
   dropdown opens in the flow and pushes the fields below it down. */
.icon-dd .dropdown-panel {
  position: static;
  margin-top: 6px;
  max-height: 300px;
  overflow: auto;
}

.icon-dd[inert] {
  opacity: .45;
}

/* Media tab: the gallery's images as cards (caption, position, remove),
   then the file picker and the list of files about to upload. */
.cv-current {
  margin: 0 0 6px;
  font-family: var(--mono);
  font-size: 17px;
  color: var(--text-soft);
}

.cv-current a {
  color: var(--accent);
}

.media-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 10px;
}

.media-card {
  display: grid;
  grid-template-rows: auto 1fr;
  background: rgba(255, 255, 255, .03);
  border: 2px solid var(--field-line);
}

.media-card:has(input[type="checkbox"]:checked) {
  opacity: .45;
  border-style: dashed;
}

.media-thumb {
  position: relative;
  aspect-ratio: 16 / 10;
  background: var(--ink-dark);
  overflow: hidden;
}

.media-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  image-rendering: auto;
}

.media-badge {
  position: absolute;
  top: 6px;
  left: 6px;
  padding: 0 6px;
  font-family: var(--mono);
  font-size: 15px;
  background: var(--accent);
  color: var(--ink-dark);
  border: 2px solid var(--ink-dark);
  text-shadow: none;
}

.media-move {
  position: absolute;
  top: 6px;
  right: 6px;
  display: flex;
  gap: 4px;
}

.media-move button {
  width: 28px;
  height: 26px;
  padding: 0;
  cursor: pointer;
  font-size: 13px;
  background: var(--ed-card-deep);
  color: var(--text);
  border: 2px solid var(--ink-dark);
}

.media-move button:hover {
  background: var(--accent);
  color: var(--ink-dark);
  text-shadow: none;
}

.media-fields {
  display: grid;
  gap: 6px;
  padding: 8px;
}

.media-fields input[type="text"] {
  width: 100%;
  box-sizing: border-box;
}

.media-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-family: var(--mono);
  font-size: 16px;
  color: var(--muted);
}

.media-pos {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.field .media-pos input {
  width: 64px;
  padding: 3px 6px;
}

.media-pending {
  list-style: none;
  margin: 6px 0 0;
  padding: 0;
  display: grid;
  gap: 4px;
  font-family: var(--mono);
  font-size: 17px;
  color: var(--text);
}

.media-pending li {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 3px 8px;
  background: rgba(255, 255, 255, .04);
}

.media-pending .is-bad {
  color: #ff8a7a;
}

.media-pending small {
  color: var(--muted);
  font-size: 15px;
}

/* Skill / artifact picker (edit.js): chips, then a dropdown that opens in
   the flow like the icon one. */
.tag-picker {
  display: grid;
  gap: 8px;
}

.tp-chips {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.tp-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 4px 3px 10px;
  font-family: var(--mono);
  font-size: 19px;
  color: var(--ink-dark);
  background: var(--accent);
  border: 2px solid var(--ink-dark);
  box-shadow: 2px 2px 0 var(--drop);
  animation: dd-down .18s cubic-bezier(.2, .8, .2, 1);
  text-shadow: none;
}

.tp-remove {
  width: 22px;
  height: 22px;
  display: grid;
  place-items: center;
  padding: 0;
  cursor: pointer;
  font: inherit;
  font-size: 18px;
  line-height: 1;
  color: var(--ink-dark);
  background: rgba(0, 0, 0, .12);
  border: 0;
  text-shadow: none;
}

.tp-remove:hover {
  background: var(--ink-dark);
  color: var(--accent);
}

.tp-dd .dd-current {
  font-size: 19px;
  color: var(--muted);
}

.tp-dd .dropdown-panel {
  position: static;
  margin-top: 6px;
  padding: 10px;
}

.tp-filter {
  width: 100%;
  box-sizing: border-box;
  margin-bottom: 8px;
  padding: 7px 10px;
  font-family: var(--mono);
  font-size: 19px;
  color: var(--field-text);
  background: var(--field-bg);
  border: 2px solid var(--field-line);
}

.tp-filter:focus {
  outline: none;
  border-color: var(--accent);
  background: var(--field-bg-focus);
}

.tp-options {
  list-style: none;
  margin: 0;
  padding: 0;
  max-height: 210px;
  overflow: auto;
  display: grid;
  gap: 2px;
}

.tp-opt {
  width: 100%;
  text-align: left;
  padding: 5px 10px;
  cursor: pointer;
  font-family: var(--mono);
  font-size: 19px;
  color: var(--text);
  background: rgba(255, 255, 255, .03);
  border: 2px solid transparent;
  transition: transform .15s cubic-bezier(.2, .8, .2, 1), background .15s, border-color .15s;
}

.tp-opt:hover,
.tp-opt:focus-visible {
  outline: none;
  transform: translateX(4px);
  background: rgba(255, 255, 255, .07);
  border-color: var(--accent);
}

.tp-create {
  color: var(--accent);
}

.tp-empty {
  padding: 5px 10px;
  font-family: var(--mono);
  font-size: 17px;
  color: var(--muted);
}

/* --- main card: header, tabs, sliding panels, save bar -- */
.ed-main {
  position: relative;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: ed-in-up .35s cubic-bezier(.2, .8, .2, 1);
}

.tab-radio {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
  pointer-events: none;
}

.ed-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 18px 10px;
}

.ed-title {
  margin: 2px 0 0;
  font-family: var(--display);
  font-size: 42px;
  line-height: .95;
  letter-spacing: 1px;
}

.ed-head-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.ed-head-actions form {
  margin: 0;
}

.ed-head-actions .btn-outline {
  color: var(--text);
}

.ed-tabs {
  display: flex;
  gap: 4px;
  padding: 0 18px;
  border-bottom: 3px solid var(--ink-dark);
}

.ed-tabs label {
  position: relative;
  margin-bottom: -3px;
  padding: 7px 16px 6px;
  cursor: pointer;
  font-family: var(--mono);
  font-size: 21px;
  letter-spacing: 1px;
  color: var(--muted);
  border: 3px solid transparent;
  border-bottom: 0;
  transition: color .15s, background .15s;
}

.ed-tabs label:hover {
  color: var(--text);
}

.ed-tabs label.is-danger {
  margin-left: auto;
}

.ed-tabs label.is-danger:hover {
  color: var(--status-progress);
}

#tab-about:checked~.ed-tabs label[for="tab-about"],
#tab-facts:checked~.ed-tabs label[for="tab-facts"],
#tab-contact:checked~.ed-tabs label[for="tab-contact"],
#tab-look:checked~.ed-tabs label[for="tab-look"],
#tab-basics:checked~.ed-tabs label[for="tab-basics"],
#tab-stack:checked~.ed-tabs label[for="tab-stack"],
#tab-page:checked~.ed-tabs label[for="tab-page"],
#tab-intro:checked~.ed-tabs label[for="tab-intro"],
#tab-journey:checked~.ed-tabs label[for="tab-journey"],
#tab-photos:checked~.ed-tabs label[for="tab-photos"],
#tab-media:checked~.ed-tabs label[for="tab-media"],
#tab-danger:checked~.ed-tabs label[for="tab-danger"] {
  color: var(--text);
  background: var(--ed-card);
  border-color: var(--ink-dark);
  box-shadow: inset 0 3px 0 var(--accent);
}

#tab-about:focus-visible~.ed-tabs label[for="tab-about"],
#tab-facts:focus-visible~.ed-tabs label[for="tab-facts"],
#tab-contact:focus-visible~.ed-tabs label[for="tab-contact"],
#tab-look:focus-visible~.ed-tabs label[for="tab-look"],
#tab-basics:focus-visible~.ed-tabs label[for="tab-basics"],
#tab-stack:focus-visible~.ed-tabs label[for="tab-stack"],
#tab-page:focus-visible~.ed-tabs label[for="tab-page"],
#tab-intro:focus-visible~.ed-tabs label[for="tab-intro"],
#tab-journey:focus-visible~.ed-tabs label[for="tab-journey"],
#tab-photos:focus-visible~.ed-tabs label[for="tab-photos"],
#tab-media:focus-visible~.ed-tabs label[for="tab-media"],
#tab-danger:focus-visible~.ed-tabs label[for="tab-danger"] {
  outline: 3px dashed var(--accent);
  outline-offset: -6px;
}

.ed-panels {
  position: relative;
  flex: 1;
  min-height: 0;
}

.ed-form {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  gap: 0;
  max-width: none;
}

.ed-form-error {
  margin: 10px 18px 0;
}

.ed-panel-area {
  position: relative;
  flex: 1;
  min-height: 0;
}

.panel {
  position: absolute;
  inset: 0;
  overflow: auto;
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  opacity: 0;
  visibility: hidden;
  transform: translateX(32px);
  transition: opacity .2s ease, transform .32s cubic-bezier(.2, .8, .2, 1), visibility 0s linear .32s;
}

#tab-about:checked~.ed-panels .p-about,
#tab-facts:checked~.ed-panels .p-facts,
#tab-contact:checked~.ed-panels .p-contact,
#tab-look:checked~.ed-panels .p-look,
#tab-basics:checked~.ed-panels .p-basics,
#tab-stack:checked~.ed-panels .p-stack,
#tab-media:checked~.ed-panels .p-media,
#tab-page:checked~.ed-panels .p-page,
#tab-intro:checked~.ed-panels .p-intro,
#tab-journey:checked~.ed-panels .p-journey,
#tab-photos:checked~.ed-panels .p-photos,
#tab-danger:checked~.ed-panels .p-danger {
  opacity: 1;
  visibility: visible;
  transform: none;
  transition-delay: 0s;
}

.p-danger {
  z-index: 2;
  background: var(--ed-card);
}

.ed-savebar {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 18px;
  background: var(--ed-card-deep);
  border-top: 3px solid var(--ink-dark);
}

/* --- About Me (partials/edit-about.php): each tab holds its own form(s), so
   the save bar sticks to the bottom of the scrolling panel instead. */
.ed-subform {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 100%;
}

.ed-subform .field-grow {
  flex: 1;
  min-height: 220px;
}

.ed-subform .field-grow textarea {
  flex: 1;
  resize: none;
}

.ed-savebar.is-sticky {
  position: sticky;
  bottom: -16px;
  margin: auto -18px -16px;
  z-index: 1;
}

.ed-tabs label small {
  font-size: 16px;
  color: var(--muted);
}

.ed-item-glyph {
  font-size: 26px;
  color: var(--accent);
}

.ed-hero-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.ed-hero-thumb {
  flex: none;
  width: 64px;
  height: 64px;
  object-fit: cover;
  border-radius: 50%;
  border: 3px solid var(--ink-dark);
  image-rendering: auto;
}

.ed-entries {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 8px;
}

.ed-entry {
  background: rgba(255, 255, 255, .03);
  border: 2px solid var(--field-line);
}

.ed-entry[open] {
  border-color: var(--accent);
}

.ed-entry>summary {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 10px;
  cursor: pointer;
  list-style: none;
}

.ed-entry>summary::-webkit-details-marker {
  display: none;
}

.ed-entry>summary:hover {
  background: rgba(255, 255, 255, .05);
}

.ed-entry[open]>summary .dd-caret {
  transform: rotate(180deg);
}

.ed-entry-num {
  flex: none;
  width: 34px;
  font-family: var(--mono);
  font-size: 22px;
  color: var(--accent);
}

.ed-entry-text {
  flex: 1;
  min-width: 0;
  display: grid;
  font-weight: 700;
}

.ed-entry-text small {
  font-family: var(--mono);
  font-weight: 400;
  font-size: 16px;
  color: var(--muted);
}

.ed-entry-thumb {
  flex: none;
  width: 48px;
  height: 36px;
  object-fit: cover;
  border: 2px solid var(--ink-dark);
  image-rendering: auto;
}

.ed-entry .ed-subform {
  min-height: 0;
  padding: 4px 12px 12px;
}

.grid-3.ed-entry-grid {
  grid-template-columns: 150px 1.5fr 1fr;
}

.ed-entry-row .media-pos {
  font-weight: 700;
  font-size: 12px;
  letter-spacing: .5px;
  text-transform: uppercase;
  color: var(--text-soft);
}

.ed-entry-row .media-pos input {
  width: 72px;
  padding: 5px 8px;
  font: inherit;
  font-size: 15px;
  background: var(--field-bg);
  color: var(--field-text);
  border: 2px solid var(--field-line);
}

.ed-entry-row .media-pos input:focus {
  outline: none;
  border-color: var(--accent);
}

.ed-entry-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.ed-entry-delete {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 0 12px 12px;
  padding-top: 10px;
  border-top: 2px dashed var(--field-line);
}

.ed-entry-new {
  border-style: dashed;
}

.ed-about-hero {
  width: 96px;
  height: 96px;
  margin-bottom: 8px;
  object-fit: cover;
  border-radius: 50%;
  border: 3px solid var(--ink-dark);
  image-rendering: auto;
}

/* --- fields: soft, dark inputs -- */
.field {
  display: flex;
  flex-direction: column;
  gap: 5px;
  min-width: 0;
}

.field label,
.field-label {
  font-weight: 700;
  font-size: 12px;
  letter-spacing: .5px;
  text-transform: uppercase;
  color: var(--text-soft);
}

.field label span,
.field-label span {
  font-weight: 400;
  letter-spacing: 0;
  text-transform: none;
  color: var(--muted);
}

.field input[type=text],
.field input[type=email],
.field input[type=url],
.field input[type=number],
.field textarea,
.field select {
  width: 100%;
  padding: 8px 10px;
  border-radius: 0;
  font: inherit;
  font-size: 15px;
  background: var(--field-bg);
  color: var(--field-text);
  border: 2px solid var(--field-line);
  transition: border-color .15s, background .15s;
}

.field input::placeholder,
.field textarea::placeholder {
  color: #7c80a3;
}

.field input:focus,
.field textarea:focus,
.field select:focus {
  outline: none;
  border-color: var(--accent);
  background: var(--field-bg-focus);
}

.field select {
  appearance: none;
  -webkit-appearance: none;
  padding-right: 32px;
  cursor: pointer;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 17px) 55%, calc(100% - 11px) 55%;
  background-size: 6px 6px;
  background-repeat: no-repeat;
}

.field select option {
  background: var(--ed-card-deep);
  color: var(--field-text);
}

.field input[aria-invalid="true"],
.field textarea[aria-invalid="true"] {
  border-color: var(--status-progress);
}

.field .counter {
  align-self: flex-end;
  margin-top: -3px;
  font-size: 11px;
  color: var(--muted);
}

.field-grow {
  flex: 1;
  min-height: 180px;
}

.field-grow textarea {
  flex: 1;
  resize: none;
}

.field .md-editor {
  font-family: var(--mono);
  font-size: 18px;
  line-height: 1.3;
}

.field input[type=file] {
  font-size: 13px;
  color: var(--text-soft);
}

.field input[type=file]::file-selector-button {
  margin-right: 10px;
  padding: 5px 12px;
  cursor: pointer;
  font: inherit;
  background: var(--field-bg);
  color: var(--field-text);
  border: 2px solid var(--field-line);
}

.check {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px !important;
  font-weight: 400 !important;
  text-transform: none !important;
  color: var(--text-soft) !important;
}

.colour-row {
  display: flex;
  gap: 8px;
}

.colour-row input[type=color] {
  flex: none;
  width: 46px;
  height: 40px;
  padding: 2px;
  cursor: pointer;
  background: var(--field-bg);
  border: 2px solid var(--field-line);
}

.grid-2,
.grid-3,
.grid-4 {
  display: grid;
  gap: 12px;
}

.grid-2 {
  grid-template-columns: 1fr 1fr;
}

.grid-3 {
  grid-template-columns: 2fr 1fr 1fr;
}

.grid-4 {
  grid-template-columns: repeat(4, 1fr);
}

.field-error {
  color: var(--status-progress);
  font-size: 13px;
  font-weight: 700;
}

.field-hint {
  font-size: 13px;
  color: var(--muted);
}

.btn-small {
  min-height: 34px;
  padding: 0 12px;
  font-size: 14px;
}

.btn-danger {
  background: var(--status-progress);
  color: var(--ink-dark);
  text-shadow: none;
}

.delete-cart {
  display: grid;
  justify-items: start;
  gap: 10px;
  max-width: 520px;
  padding: 16px;
  border: 3px dashed var(--status-progress);
}

.delete-cart h3 {
  margin: 0;
  font-size: 16px;
  text-transform: uppercase;
  color: var(--status-progress);
}

/* --- icon picker tiles -- */
.icon-group-name {
  margin: 10px 0 4px;
  font-family: var(--mono);
  font-size: 17px;
  letter-spacing: 1px;
  color: var(--muted);
}

.icon-group-name:first-child {
  margin-top: 0;
}

.icon-group {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.icon-opt {
  position: relative;
  cursor: pointer;
}

.icon-opt input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
}

.icon-tile {
  display: grid;
  justify-items: center;
  gap: 2px;
  width: 74px;
  padding: 6px 2px 4px;
  background: var(--screen-bg, var(--ink));
  border: 2px solid var(--ink-dark);
  box-shadow: 2px 2px 0 var(--drop);
  transition: transform .15s, border-color .15s;
}

.icon-tile svg {
  width: 36px;
  height: 36px;
  display: block;
}

.icon-letter {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  font-family: var(--display);
  font-size: 26px;
  background: var(--hi);
  color: var(--hi-fg);
  border: 2px dashed var(--ink-dark);
}

.icon-name {
  font-family: var(--mono);
  font-size: 14px;
  line-height: 1.1;
  text-align: center;
  color: var(--screen-fg, var(--text));
}

.icon-opt:hover .icon-tile {
  transform: translateY(-2px);
  border-color: var(--text);
}

.icon-opt input:checked+.icon-tile {
  outline: 3px solid var(--accent);
  outline-offset: 1px;
  border-color: var(--accent);
}

.icon-opt input:focus-visible+.icon-tile {
  outline: 3px dashed var(--accent);
  outline-offset: 3px;
}

/* --- preview column -- */
.ed-side {
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-height: 0;
  animation: ed-in-right .35s cubic-bezier(.2, .8, .2, 1);
}

.ed-preview-card {
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.ed-preview.tv-case {
  width: 100%;
  height: auto;
  padding: 12px 12px 14px;
  box-shadow: inset 3px 3px 0 var(--case-light), inset -3px -3px 0 var(--case-shade);
}

.ed-preview .tv-screen-wrap {
  width: 100%;
  height: 196px;
}

.ed-preview .tv-screen {
  padding: 12px 14px;
  gap: 6px;
}

.ed-preview .tv-kicker {
  font-size: 16px;
}

.ed-preview .tv-header-row {
  gap: 10px;
}

.ed-preview .tv-icon {
  width: 40px;
  height: 40px;
}

.ed-preview .tv-name {
  font-size: 24px;
}

.ed-preview .tv-oneliner {
  font-size: 13px;
}

.ed-preview .tv-blurb {
  font-size: 12px;
}

.ed-facts {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin: 0;
}

.ed-facts div {
  padding: 6px 8px;
  background: rgba(255, 255, 255, .04);
  border: 2px solid var(--ink-dark);
}

.ed-facts dt {
  font-family: var(--mono);
  font-size: 15px;
  color: var(--muted);
  letter-spacing: 1px;
  text-transform: uppercase;
}

.ed-facts dd {
  margin: 0;
  font-family: var(--mono);
  font-size: 19px;
  overflow-wrap: anywhere;
}

.ed-profile-preview {
  display: grid;
  justify-items: start;
  gap: 4px;
  padding: 10px;
  background: rgba(255, 255, 255, .03);
  border: 2px solid var(--ink-dark);
}

.ed-profile-preview .avatar {
  width: 96px;
  height: 96px;
  margin-bottom: 8px;
}

.ed-pp-name {
  font-family: var(--display);
  font-size: 52px;
  line-height: .9;
}

.ed-pp-role {
  font-weight: 700;
  font-size: 15px;
  color: var(--text-soft);
}

/* --- cropper (edit.js) -- */
.crop-dialog {
  width: 420px;
  max-width: calc(100vw - 32px);
  padding: 0;
  color: var(--text);
  background: var(--ed-card);
  border: 3px solid var(--ink-dark);
  box-shadow: 8px 8px 0 rgba(0, 0, 0, .45);
}

.crop-dialog[open] {
  animation: ed-in-up .25s cubic-bezier(.2, .8, .2, 1);
}

.crop-dialog::backdrop {
  background: rgba(8, 8, 18, .7);
}

.crop-body {
  display: grid;
  gap: 12px;
  padding: 14px;
}

.crop-stage {
  position: relative;
  width: 100%;
  aspect-ratio: 1;
  background: #0e1020;
  border: 3px solid var(--ink-dark);
  cursor: grab;
  touch-action: none;
}

.crop-stage:active {
  cursor: grabbing;
}

.crop-stage:focus-visible {
  outline: 3px dashed var(--accent);
  outline-offset: 3px;
}

.crop-stage canvas {
  width: 100%;
  height: 100%;
  display: block;
}

/* Rule-of-thirds guide over the crop. */
.crop-grid {
  position: absolute;
  inset: 0;
  pointer-events: none;
  border: 2px solid rgba(255, 207, 90, .9);
  background:
    linear-gradient(90deg, transparent calc(33.33% - 1px), rgba(255, 255, 255, .35) 0 calc(33.33% + 1px), transparent 0 calc(66.66% - 1px), rgba(255, 255, 255, .35) 0 calc(66.66% + 1px), transparent 0),
    linear-gradient(0deg, transparent calc(33.33% - 1px), rgba(255, 255, 255, .35) 0 calc(33.33% + 1px), transparent 0 calc(66.66% - 1px), rgba(255, 255, 255, .35) 0 calc(66.66% + 1px), transparent 0);
}

.crop-controls {
  display: grid;
  gap: 8px;
}

.crop-zoom {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--mono);
  font-size: 19px;
  color: var(--text-soft);
}

.crop-zoom input {
  flex: 1;
  accent-color: var(--accent);
}

.crop-actions {
  gap: 10px;
  background: var(--ed-card-deep);
  border-top: 3px solid var(--ink-dark);
}

.crop-use {
  background: var(--accent);
}

.upload-preview {
  width: 64px;
  height: 64px;
  object-fit: cover;
  border: 2px solid var(--ink-dark);
  image-rendering: auto;
}

.upload-preview.is-pixel {
  image-rendering: pixelated;
}

/* Narrow screens: back to one scrolling column, one tab panel at a time. */
@media (max-width: 1099px) {
  body.edit-mode {
    height: auto;
    overflow: auto;
  }

  .editor {
    grid-template-columns: 1fr;
    padding: 14px;
  }

  .ed-rail {
    max-height: 320px;
  }

  .ed-panels,
  .ed-form,
  .ed-panel-area {
    position: static;
  }

  .panel {
    position: static;
    display: none;
    opacity: 1;
    visibility: visible;
    transform: none;
  }

  #tab-about:checked~.ed-panels .p-about,
  #tab-facts:checked~.ed-panels .p-facts,
  #tab-contact:checked~.ed-panels .p-contact,
  #tab-look:checked~.ed-panels .p-look,
  #tab-basics:checked~.ed-panels .p-basics,
  #tab-stack:checked~.ed-panels .p-stack,
  #tab-media:checked~.ed-panels .p-media,
  #tab-page:checked~.ed-panels .p-page,
  #tab-danger:checked~.ed-panels .p-danger,
  #tab-intro:checked~.ed-panels .p-intro,
  #tab-journey:checked~.ed-panels .p-journey,
  #tab-photos:checked~.ed-panels .p-photos {
    display: flex;
  }

  .field-grow textarea {
    min-height: 320px;
  }

  .ed-savebar.is-sticky {
    position: static;
    margin: 4px -18px -16px;
  }

  .grid-3.ed-entry-grid {
    grid-template-columns: 1fr 1fr;
  }

  .grid-3,
  .grid-4 {
    grid-template-columns: 1fr 1fr;
  }
}

/* --------------------------------------------------------------- no-js -- */

/* Project cards: the whole deck, flattened, for no-JS and narrow windows. */
.no-js-grid {
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px;
  margin-top: 32px;
}

.no-js-card {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 14px;
  text-decoration: none;
  background: var(--case);
  color: var(--ink-dark);
  border: 3px solid var(--ink-dark);
  box-shadow: 4px 4px 0 var(--drop);
  text-shadow: none;
}

.no-js-card h3 {
  font-family: var(--body);
  font-weight: 700;
  font-size: 22px;
  margin: 0;
}

.no-js-card p {
  font-size: 14px;
  line-height: 1.45;
}

@media (scripting: none) {

  .shelf,
  .shelf-plank,
  .deck-controls,
  .tv-power,
  .tv-osd,
  .tv-static {
    display: none;
  }

  .deck {
    height: 520px;
  }

  .no-js-grid {
    display: grid;
  }
}

@media not (scripting: none) {
  .no-js-grid {
    display: none;
  }
}

/* ------------------------------------------------------------ narrow -- */

@media (max-width: 1023px) {
  html:not(.board-on) main.stage {
    grid-template-columns: 1fr;
    max-width: 720px;
  }

  html:not(.board-on) .deck {
    display: none;
  }

  html:not(.board-on) .no-js-grid {
    display: grid !important;
  }
}

/* --- zoom into the TV (deck.js zoomInto) ------------------------------------
   The board scales up around the TV screen until the screen fills the
   window, while the room fades to the screen's dark; the next page then
   settles in (html.zoom-arrive, set by desk.js). */
html.zooming {
  overflow: hidden;
}

html.zooming body {
  transform-origin: var(--zx) var(--zy);
  animation: tv-zoom .7s cubic-bezier(.55, 0, .85, .35) forwards;
}

@keyframes tv-zoom {
  to {
    transform: translate(var(--zdx), var(--zdy)) scale(var(--zs));
  }
}

html.zooming::after {
  content: '';
  position: fixed;
  inset: 0;
  z-index: 100;
  pointer-events: none;
  background: #0d0b16;
  animation: zoom-fade .7s linear forwards;
}

@keyframes zoom-fade {

  0%,
  55% {
    opacity: 0;
  }

  100% {
    opacity: 1;
  }
}

html.zoom-arrive .project {
  animation: zoom-arrive .45s steps(6) both;
}

@keyframes zoom-arrive {
  from {
    opacity: 0;
    transform: scale(1.06);
  }
}

/* Zooming back out: the page shrinks away (desk.js), then the deck opens
   inside the TV screen and pulls back out to the room (deck.js). */
html.zoom-leave .project {
  animation: zoom-leave .26s steps(5) forwards;
}

@keyframes zoom-leave {
  to {
    opacity: 0;
    transform: scale(.92);
  }
}

html.zoom-return {
  overflow: hidden;
}

html.zoom-return body {
  transform-origin: var(--zx) var(--zy);
  animation: tv-unzoom .75s cubic-bezier(.15, .65, .45, 1) both;
}

@keyframes tv-unzoom {
  from {
    transform: translate(var(--zdx), var(--zdy)) scale(var(--zs));
  }

  to {
    transform: none;
  }
}

html.zoom-return::after {
  content: '';
  position: fixed;
  inset: 0;
  z-index: 100;
  pointer-events: none;
  background: #0d0b16;
  animation: zoom-unfade .75s linear forwards;
}

@keyframes zoom-unfade {
  0% {
    opacity: 1;
  }

  35% {
    opacity: 0;
  }

  100% {
    opacity: 0;
  }
}

/* Before deck.js starts that zoom, arrive.js has already blacked the page out
   (zoom-cover), so the room never flashes up first. If the zoom doesn't run
   the cover fades away (zoom-uncover); the timed fade at the end is a safety
   net should deck.js never get to it. */
html.zoom-cover::after,
html.zoom-uncover::after {
  content: '';
  position: fixed;
  inset: 0;
  z-index: 100;
  pointer-events: none;
  background: #0d0b16;
}

html.zoom-cover::after {
  animation: zoom-cover 1.6s linear forwards;
}

@keyframes zoom-cover {

  0%,
  80% {
    opacity: 1;
  }

  100% {
    opacity: 0;
  }
}

html.zoom-uncover::after {
  animation: zoom-uncover .35s ease-out forwards;
}

@keyframes zoom-uncover {
  from {
    opacity: 1;
  }

  to {
    opacity: 0;
  }
}

/* --- page to page ------------------------------------------------------------
   Pages change through black: the old one fades out, the new one fades up
   from black, which hides the moment the next page is still loading.
   Browsers with cross-document view transitions (Chrome/Edge) keep the old
   page up until the new one is ready and fade between them over black;
   others fade the new page in over the black <html> background. Nothing
   for anyone who asks for reduced motion. */
html {
  background: #0d0b16;
}

@media (prefers-reduced-motion: no-preference) {
  @view-transition {
    navigation: auto;
  }

  ::view-transition {
    background: #0d0b16;
  }

  ::view-transition-old(root) {
    animation: 160ms ease-in both vt-fade-out;
  }

  ::view-transition-new(root) {
    animation: 300ms ease-out 160ms both vt-fade-in;
  }

  @supports not (view-transition-name: none) {
    body {
      animation: vt-fade-in .28s ease-out both;
    }
  }
}

@keyframes vt-fade-out {
  to {
    opacity: 0;
  }
}

@keyframes vt-fade-in {
  from {
    opacity: 0;
  }
}