/* A dark room lit by photographs. No web fonts, images or frameworks: the CSP allows nothing from outside.
   Two lights: --sun (warm) for what was photographed and for people; --screen (cool) for what was written: code, the terminal. */

/* ---- design tokens ------------------------------------------------------ */
:root {
  color-scheme: dark;
  --night: #0e0d0b;
  --surface: #171512;
  --raised: #1f1c18;
  --line: #2c2823;
  --paper: #ede7dc;
  --soft: #cfc7ba;
  --ash: #968d80;
  --sun: #ffc27a;          /* set from the colour temperature by src/site.js */
  --screen: #7fdccb;
  --err: #ff8f7a;
  --display: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, "Noto Serif TC", "Source Han Serif TC", "Songti TC", "PMingLiU", serif;
  --body: system-ui, -apple-system, "Segoe UI", Roboto, "PingFang TC", "Noto Sans TC", "Microsoft JhengHei", sans-serif;
  --mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, "Liberation Mono", "Noto Sans Mono CJK TC", monospace;
  --t-xs: 0.75rem; --t-s: 0.875rem; --t-m: 1rem; --t-l: 1.25rem;
  --t-xl: clamp(1.7rem, 1.1rem + 1.8vw, 2.5rem);
  --t-xxl: clamp(2.8rem, 1.2rem + 5.2vw, 5.6rem);
  --wrap: 1240px;
  --gutter: clamp(16px, 4vw, 48px);
  --nav-h: 60px;
}
/* An easter egg from the old site (`theme matrix`): the light turns phosphor green. */
:root[data-theme="matrix"] { --sun: #8dfc9a; --screen: #8dfc9a; }

/* ---- base --------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; scroll-behavior: smooth; scroll-padding-top: calc(var(--nav-h) + 8px); }
body { margin: 0; min-height: 100vh; background: var(--night); color: var(--paper); font-family: var(--body); font-size: var(--t-m); line-height: 1.75; -webkit-font-smoothing: antialiased; }
h1, h2, h3 { margin: 0; text-wrap: balance; }
p { margin: 0; }
img { display: block; max-width: 100%; height: auto; }
a { color: inherit; text-decoration-color: color-mix(in srgb, var(--paper) 35%, transparent); text-underline-offset: 5px; }
a:hover { color: var(--sun); text-decoration-color: var(--sun); }
button { font: inherit; color: inherit; }
::selection { background: color-mix(in srgb, var(--sun) 35%, transparent); color: var(--paper); }
:focus-visible { outline: 2px solid var(--sun); outline-offset: 3px; }
.wrap { max-width: var(--wrap); margin: 0 auto; padding-inline: var(--gutter); }
.label, .path { font-family: var(--mono); font-size: var(--t-xs); letter-spacing: 0.08em; color: var(--ash); }
.label { text-transform: uppercase; }
.path { display: block; margin-bottom: 6px; color: var(--screen); letter-spacing: 0.04em; }
.sr { position: absolute !important; width: 1px; height: 1px; margin: -1px; padding: 0; border: 0; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; }
.skip { position: absolute; left: 12px; top: -60px; z-index: 100; padding: 10px 14px; background: var(--surface); color: var(--paper); border: 1px solid var(--sun); border-radius: 8px; transition: top 0.15s; }
.skip:focus { top: 12px; }

.pill { display: inline-flex; align-items: center; gap: 8px; min-height: 36px; padding: 6px 14px; font-size: var(--t-s); line-height: 1.2; text-decoration: none; white-space: nowrap; color: var(--paper); background: transparent; border: 1px solid var(--line); border-radius: 999px; cursor: pointer; transition: border-color 0.15s, color 0.15s; }
.pill:hover { color: var(--sun); border-color: var(--sun); }
.tool { min-width: 36px; min-height: 36px; padding: 0 10px; font-family: var(--mono); font-size: var(--t-xs); color: var(--soft); background: transparent; border: 1px solid var(--line); border-radius: 999px; cursor: pointer; }
.tool:hover { color: var(--sun); border-color: var(--sun); }

/* ---- navigation ---------------------------------------------------------- */
.nav { position: sticky; top: env(safe-area-inset-top, 0px); z-index: 20; background: color-mix(in srgb, var(--night) 84%, transparent); -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px); border-bottom: 1px solid var(--line); }
.nav-row { display: flex; align-items: center; gap: clamp(12px, 2vw, 24px); height: var(--nav-h); }
.brand { display: flex; align-items: center; gap: 10px; margin-right: auto; font-weight: 600; text-decoration: none; white-space: nowrap; }
.mark { margin: 0; font: 600 3.4px/1 var(--mono); letter-spacing: 0; color: var(--paper); white-space: pre; }
.brand:hover .mark { color: var(--sun); }
.links { display: flex; gap: clamp(14px, 2.4vw, 30px); font-size: var(--t-s); }
.links a { position: relative; padding-block: 4px; color: var(--soft); text-decoration: none; white-space: pre; }
.links a[aria-current="true"] { color: var(--paper); }
/* "You are here": the dock's dot from the old site, now a small light. */
.links a::after { content: ""; position: absolute; left: 50%; bottom: -8px; width: 5px; height: 5px; margin-left: -2.5px; border-radius: 50%; background: var(--sun); box-shadow: 0 0 10px 2px color-mix(in srgb, var(--sun) 60%, transparent); opacity: 0; transform: scale(0.4); transition: opacity 0.3s, transform 0.3s; }
.links a[aria-current="true"]::after { opacity: 1; transform: none; }
.nav-tools { display: flex; align-items: center; gap: 8px; }

/* ---- hero ----------------------------------------------------------------- */
.hero { position: relative; }
.hero-stage { position: relative; width: 100%; aspect-ratio: 16 / 7; min-height: 440px; max-height: 78vh; overflow: hidden; background: #000; }
.hero-stage .pic, .hero-stage img { width: 100%; height: 100%; }
.hero-stage img { object-fit: cover; }
.hero-text { position: absolute; z-index: 2; left: 0; right: 0; bottom: 0; padding-block: 64px clamp(24px, 4vw, 48px); pointer-events: none; background: linear-gradient(180deg, transparent, rgba(14, 13, 11, 0.82)); }
.hero-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 24px; align-items: end; }
.hero h1 { font-family: var(--display); font-weight: 700; font-size: var(--t-xxl); line-height: 1.02; letter-spacing: 0.005em; white-space: pre; text-shadow: 0 2px 30px rgba(0, 0, 0, 0.6); }
.hero .line { margin-top: 14px; max-width: 32em; font-size: clamp(1.05rem, 0.95rem + 0.4vw, 1.3rem); color: var(--soft); text-shadow: 0 1px 16px rgba(0, 0, 0, 0.8); }
.hero .role { margin-top: 6px; font-family: var(--mono); font-size: var(--t-xs); letter-spacing: 0.06em; color: var(--ash); }
.hero-exif { display: grid; justify-items: end; gap: 2px; font-family: var(--mono); font-size: var(--t-xs); line-height: 1.7; color: var(--soft); text-align: right; text-shadow: 0 1px 10px #000; }
.hero-exif .exif { color: var(--paper); }
.hero-exif .hint { color: var(--sun); }

/* ---- pictures that develop out of letters (src/site.js) --------------------- */
.pic { position: relative; display: block; overflow: hidden; background: #000; cursor: zoom-in; }
.pic img { width: 100%; height: 100%; object-fit: cover; }
.dev-canvas { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.pic.is-dev img { visibility: hidden; }
.exif { font-family: var(--mono); font-size: var(--t-xs); color: var(--ash); font-variant-numeric: tabular-nums; white-space: nowrap; }

/* ---- lately --------------------------------------------------------------- */
.now { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); border-bottom: 1px solid var(--line); }
.now > div { display: grid; gap: 4px; padding: 22px 24px 22px 0; min-width: 0; }
.now > div + div { padding-left: 24px; border-left: 1px solid var(--line); }
.now p { font-size: var(--t-s); color: var(--soft); }

/* ---- between sections: a ramp of characters that develops into view ---------- */
.rule { padding-block: 56px 0; overflow: hidden; font: 13px/1 var(--mono); color: var(--ash); white-space: pre; user-select: none; }

/* ---- sections ------------------------------------------------------------- */
.sec { padding-block: clamp(28px, 4vw, 48px) clamp(64px, 9vw, 112px); }
.sec-head { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 2fr); gap: 24px; align-items: end; margin-bottom: clamp(32px, 5vw, 56px); }
.sec-head h2, .about-side h2 { font-family: var(--display); font-weight: 700; font-size: var(--t-xl); line-height: 1.2; white-space: pre-wrap; }
.sec-head p { max-width: 34em; color: var(--soft); }

/* photos: a big one with a tall one, three upright, one panorama */
.ph-grid { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: clamp(10px, 1.6vw, 22px); }
.ph { display: grid; gap: 10px; align-content: start; margin: 0; min-width: 0; }
.ph .pic { width: 100%; max-width: 100%; }
.ph figcaption { display: flex; justify-content: space-between; gap: 12px; font-size: var(--t-s); color: var(--soft); }
.ph-a { grid-column: span 8; } .ph-a .pic { aspect-ratio: 3 / 2; }
.ph-b { grid-column: span 4; } .ph-b .pic { aspect-ratio: 2 / 3; }
.ph-c, .ph-d, .ph-e { grid-column: span 4; } .ph-c .pic, .ph-d .pic, .ph-e .pic { aspect-ratio: 4 / 5; }
.ph-f { grid-column: span 12; } .ph-f .pic { aspect-ratio: 21 / 9; }
.more { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 16px; margin-top: 28px; }

/* lab */
.ex { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: clamp(20px, 3vw, 40px); }
.card { display: grid; gap: 14px; align-content: start; min-width: 0; }
.card-media .pic { aspect-ratio: 4 / 3; max-width: 100%; border-radius: 3px; }
.card h3 { font-family: var(--display); font-size: var(--t-l); font-weight: 700; }
.card .q { font-family: var(--display); font-size: clamp(1.1rem, 1rem + 0.4vw, 1.3rem); line-height: 1.55; }
.card p:not(.q) { font-size: var(--t-s); color: var(--soft); }
.card .meta { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px 16px; padding-top: 12px; border-top: 1px solid var(--line); font-family: var(--mono); font-size: var(--t-xs); color: var(--ash); }
.pic-letters { cursor: pointer; }
.ex-small { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: clamp(20px, 3vw, 40px); padding-top: 24px; border-top: 1px solid var(--line); }
.ex-small > div { display: grid; gap: 6px; align-content: start; min-width: 0; }
.ex-small h3 { font-size: var(--t-m); font-weight: 600; }
.ex-small p { font-size: var(--t-s); color: var(--soft); }
.term-link { justify-self: start; font-family: var(--mono); font-size: var(--t-xs); color: var(--screen); }

/* work: a dense index, lit by the screen */
.group + .group { margin-top: 44px; }
.group > .label { display: block; margin-bottom: 10px; }
.idx { margin: 0; padding: 0; list-style: none; border-top: 1px solid var(--paper); }
.idx a { display: grid; grid-template-columns: minmax(0, 2.2fr) minmax(0, 3fr) minmax(0, 1.4fr) 20px; gap: 20px; align-items: baseline; padding: 16px 0; color: var(--paper); text-decoration: none; border-bottom: 1px solid var(--line); }
.idx a:hover { color: var(--paper); background: linear-gradient(90deg, color-mix(in srgb, var(--screen) 7%, transparent), transparent 70%); }
.idx .n { font-family: var(--mono); font-size: 1.05rem; font-weight: 500; white-space: pre-wrap; overflow-wrap: anywhere; }
.idx a:hover .n { color: var(--screen); }
.idx .d { font-size: var(--t-s); color: var(--soft); }
.idx .k { font-family: var(--mono); font-size: var(--t-xs); color: var(--ash); }
.idx .arr { text-align: right; color: var(--ash); }

/* about */
.about { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 2fr); gap: clamp(24px, 4vw, 56px); }
.about-side { display: grid; gap: 18px; align-content: start; }
.portrait { margin: 0; display: grid; gap: 10px; }
.face { margin: 0; font: 7px/1 var(--mono); letter-spacing: 0; color: var(--sun); white-space: pre; }
.portrait figcaption { max-width: 22em; font-size: var(--t-xs); color: var(--ash); }
.about-body { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: clamp(24px, 4vw, 56px); }
.about-body .lead { margin-bottom: 24px; font-family: var(--display); font-size: clamp(1.4rem, 1rem + 1.2vw, 2rem); font-weight: 700; line-height: 1.5; }
.about-body p:not(.lead) { color: var(--soft); }
.about-body p + p { margin-top: 16px; }
.facts { margin: 0; border-top: 1px solid var(--paper); }
.facts div { display: grid; grid-template-columns: 6.5em minmax(0, 1fr); gap: 12px; padding: 11px 0; font-size: var(--t-s); border-bottom: 1px solid var(--line); }
.facts dt { padding-top: 3px; font-family: var(--mono); font-size: var(--t-xs); color: var(--ash); }
.facts dd { margin: 0; }

/* the mirror: the one bright frame on a dark page, like a print on a light box */
.mirror-grid { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: clamp(20px, 3vw, 40px); align-items: start; }
.mirror-main { min-width: 0; }
.lightbox-stage { display: grid; gap: 16px; margin: 0; }
.mstage { position: relative; display: grid; place-items: center; aspect-ratio: 4 / 3; max-width: 100%; overflow: hidden; color: var(--night); background: var(--paper); border-radius: 3px; box-shadow: 0 0 80px -10px color-mix(in srgb, var(--paper) 22%, transparent); }
.mstage pre { margin: 0; font-family: var(--mono); line-height: 1; letter-spacing: 0; white-space: pre; color: var(--night); }
.mirror-placeholder { font-size: clamp(8px, 1.6vw, 17px); opacity: 0.85; }
.lightbox-stage[data-state="live"] .mirror-placeholder { display: none; }
.mstage .mirror-ascii { max-width: 100%; overflow: hidden; background: transparent; border: 0; }
.mstage .br { position: absolute; inset: 7%; pointer-events: none; }
.mstage .br i { position: absolute; width: 22px; height: 22px; border: 1.5px solid color-mix(in srgb, var(--night) 65%, transparent); }
.mstage .br i:nth-child(1) { left: 0; top: 0; border-right: 0; border-bottom: 0; }
.mstage .br i:nth-child(2) { right: 0; top: 0; border-left: 0; border-bottom: 0; }
.mstage .br i:nth-child(3) { left: 0; bottom: 0; border-right: 0; border-top: 0; }
.mstage .br i:nth-child(4) { right: 0; bottom: 0; border-left: 0; border-top: 0; }
.flash { position: absolute; inset: 0; background: var(--paper); opacity: 0; pointer-events: none; }
.flash.go { animation: flash 0.5s ease-out; }
@keyframes flash { from { opacity: 0.9; } to { opacity: 0; } }
.mread { position: absolute; left: 0; right: 0; top: 0; display: flex; flex-wrap: wrap; justify-content: space-between; gap: 4px 12px; padding: 8px 12px; font-family: var(--mono); font-size: 11px; color: color-mix(in srgb, var(--night) 72%, transparent); background: color-mix(in srgb, var(--paper) 94%, transparent); border-bottom: 1px solid color-mix(in srgb, var(--night) 12%, transparent); font-variant-numeric: tabular-nums; }
.mread .rec { color: #b8402e; }
.lightbox-stage:not([data-state="live"]) .mread .rec { color: color-mix(in srgb, var(--night) 35%, transparent); }
.mctl { display: flex; flex-wrap: wrap; align-items: center; gap: 16px 20px; }
.shutter { display: grid; flex: none; place-items: center; width: 64px; height: 64px; padding: 0; background: transparent; border: 2px solid var(--paper); border-radius: 50%; cursor: pointer; }
.shutter span { width: 50px; height: 50px; background: var(--paper); border-radius: 50%; transition: transform 0.12s, background 0.2s; }
.shutter:hover span { background: var(--sun); }
.shutter:active span { transform: scale(0.88); }
.mirror-actions { display: flex; flex-wrap: wrap; gap: 8px; }
/* the lens: 28 / 50 / 85mm, like a zoom ring */
.focal, .ms-focal { display: inline-flex; gap: 4px; }
.focal [aria-pressed="true"], .ms-focal [aria-pressed="true"] { color: var(--night); background: var(--sun); border-color: var(--sun); }
.mirror-intro { max-width: 40em; font-size: var(--t-s); color: var(--soft); }
.mirror-status { font-size: var(--t-xs); color: var(--ash); }
.mirror-status:empty { display: none; }
.lightbox-stage[data-state="error"] .mirror-status { color: var(--err); }
.prints { display: grid; gap: 12px; min-width: 0; }
.print-list { display: grid; gap: 14px; max-height: 620px; padding-right: 4px; overflow-y: auto; }
.print-list .empty { padding: 18px; font-size: var(--t-s); color: var(--ash); border: 1px dashed var(--line); border-radius: 3px; }
.print { display: grid; gap: 8px; margin: 0; padding: 12px 12px 10px; color: #1b1814; background: var(--paper); border-radius: 2px; box-shadow: 0 10px 30px rgba(0, 0, 0, 0.45); animation: drop 0.45s cubic-bezier(0.2, 0.8, 0.2, 1); }
@keyframes drop { from { transform: translateY(-10px) rotate(-1.5deg); opacity: 0; } }
.print pre { margin: 0; overflow: hidden; font: 600 4.6px/1 var(--mono); white-space: pre; }
.print figcaption { display: flex; justify-content: space-between; align-items: center; gap: 8px; font-family: var(--mono); font-size: 10.5px; color: #6b6255; }
.print-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 6px; }
.print button { padding: 2px 10px; font-family: var(--mono); font-size: 10.5px; color: #1b1814; background: none; border: 1px solid #c9bfb0; border-radius: 999px; cursor: pointer; }

/* contact */
.contact { padding-block: clamp(72px, 11vw, 140px) 40px; border-top: 1px solid var(--line); }
.contact .big { font-family: var(--display); font-weight: 700; font-size: clamp(2rem, 1rem + 4vw, 4.4rem); line-height: 1.15; max-width: 16em; }
.mail { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 16px; margin-top: 28px; }
.mail .addr { font-family: var(--mono); font-size: clamp(1.05rem, 0.9rem + 0.8vw, 1.6rem); overflow-wrap: anywhere; }
.status { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 6px 24px; margin-top: clamp(64px, 9vw, 112px); padding-top: 18px; font-family: var(--mono); font-size: var(--t-xs); color: var(--ash); border-top: 1px solid var(--line); }
.status-ver { color: var(--screen); }
.colophon { margin-top: 8px; font-size: var(--t-xs); color: var(--ash); }

/* ---- the command line and the terminal drawer -------------------------------- */
.cmdline { position: fixed; left: 16px; bottom: calc(16px + env(safe-area-inset-bottom, 0px)); z-index: 40; display: flex; align-items: center; gap: 8px; max-width: calc(100vw - 32px); padding: 8px 12px; font-family: var(--mono); font-size: var(--t-xs); color: var(--ash); background: color-mix(in srgb, var(--night) 88%, transparent); border: 1px solid var(--line); border-radius: 999px; cursor: pointer; -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); }
.cmdline:hover { color: var(--paper); border-color: var(--screen); }
.cmdline b { min-width: 0; overflow: hidden; color: var(--screen); font-weight: 500; text-overflow: ellipsis; white-space: pre; }
.cmdline .caret { flex: none; width: 7px; height: 13px; background: var(--screen); animation: blink 1.1s steps(1) infinite; }
.cmdline kbd { font: inherit; padding: 0 5px; border: 1px solid var(--line); border-radius: 4px; }
@keyframes blink { 50% { opacity: 0; } }
html[data-drawer="open"] .cmdline { display: none; }

.term { position: fixed; left: 0; right: 0; bottom: 0; z-index: 50; display: flex; flex-direction: column; height: min(62vh, 680px); height: min(62dvh, 680px); color: var(--paper); background: color-mix(in srgb, var(--night) 96%, transparent); border-top: 1px solid var(--screen); box-shadow: 0 -30px 80px rgba(0, 0, 0, 0.6); font-family: var(--mono); font-size: 14px; line-height: 1.65; -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px); }
.term.is-in { animation: term-in 0.28s cubic-bezier(0.2, 0.8, 0.2, 1); }
@keyframes term-in { from { transform: translateY(40px); opacity: 0; } }
.term-bar { display: flex; flex: none; align-items: center; gap: 12px; padding: 8px max(var(--gutter), 12px); border-bottom: 1px solid var(--line); }
.term-title { color: var(--screen); }
.term-hint { flex: 1; min-width: 0; overflow: hidden; font-size: var(--t-xs); color: var(--ash); text-overflow: ellipsis; white-space: nowrap; }
.screen { flex: 1; min-height: 0; padding: 14px max(var(--gutter), 12px) 10px; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; scrollbar-color: var(--line) transparent; }
#log { max-width: 980px; }
.chips { display: flex; flex: none; flex-wrap: wrap; gap: 8px; padding: 8px max(var(--gutter), 12px) calc(10px + env(safe-area-inset-bottom, 0px)); border-top: 1px solid var(--line); }
.chip { min-height: 32px; padding: 0 12px; font: inherit; font-size: var(--t-xs); color: var(--soft); background: transparent; border: 1px solid var(--line); border-radius: 999px; cursor: pointer; }
.chip:hover { color: var(--screen); border-color: var(--screen); }
.prompt { display: flex; align-items: center; gap: 10px; max-width: 980px; padding-top: 6px; }
.prompt input { flex: 1; min-width: 0; padding: 4px 0; font: inherit; color: var(--paper); background: transparent; border: 0; outline: none; caret-color: var(--screen); }
.prompt:focus-within { box-shadow: 0 1px 0 var(--screen); }

/* terminal output (src/render.js) */
.entry { position: relative; margin: 0 0 14px; animation: rise 0.16s ease-out both; }
.entry > :first-child { margin-top: 0; }
.entry p, .entry dl, .entry ul, .entry blockquote, .entry pre { margin: 0.35rem 0; }
.boot { color: var(--ash); }
.ok { color: var(--screen); }
.dim { color: var(--ash); }
.em { color: var(--paper); font-weight: 700; }
.err { color: var(--err); }
.echo { word-break: break-word; }
.ps1 { color: var(--screen); white-space: nowrap; user-select: none; }
.typed { color: var(--paper); }
.h { margin: 0.9rem 0 0.25rem; font-size: 1em; font-weight: 700; color: var(--sun); }
.h::before { content: "# "; color: var(--ash); }
.art { margin: 0.6rem 0 0.9rem; overflow-x: auto; font-family: inherit; line-height: 1.15; color: var(--screen); }
.row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 22px; margin: 0.6rem 0 0.9rem; }
.row .art { margin: 0; }
.kv { display: grid; grid-template-columns: minmax(8ch, max-content) 1fr; column-gap: 2.5ch; row-gap: 0.2rem; }
.kv dt { color: var(--ash); }
.kv dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.list { padding: 0; list-style: none; }
.list li { position: relative; padding-left: 2ch; }
.list li::before { content: "›"; position: absolute; left: 0; color: var(--screen); }
.quote { padding-left: 1.5ch; color: var(--paper); border-left: 2px solid var(--sun); }
a.lnk, .cmd { color: var(--screen); text-decoration: underline; text-decoration-color: color-mix(in srgb, var(--screen) 45%, transparent); text-underline-offset: 3px; }
a.lnk:hover, .cmd:hover { color: var(--sun); }
a.lnk::after { content: "\00a0↗"; font-size: 0.8em; color: var(--ash); }
.cmd { padding: 0; font: inherit; background: none; border: 0; cursor: pointer; }
code.cmd { cursor: default; }
.sub { display: block; }
.ascii-face { margin: 0.5rem 0; overflow-x: auto; font-size: 13px; line-height: 1; letter-spacing: 0; color: var(--sun); }
.ascii3d { width: max-content; max-width: 100%; margin: 0.5rem auto; overflow-x: auto; font-size: 12px; line-height: 1; letter-spacing: 0; white-space: pre; color: var(--screen); }
.reveal-canvas { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
#wipe { position: fixed; inset: 0; z-index: 60; width: 100%; height: 100%; pointer-events: none; }
@keyframes rise { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

/* pictures in the terminal */
.shot { max-width: min(100%, 720px); margin: 8px 0; }
.shot-open { position: relative; display: block; width: 100%; padding: 0; overflow: hidden; background: #000; border: 1px solid var(--line); border-radius: 4px; cursor: zoom-in; }
.shot-open:hover, .shot-open:focus-visible { border-color: var(--screen); }
.shot-img { display: block; width: 100%; height: auto; }
.entry .shot-ascii { position: absolute; inset: 0; margin: 0; overflow: hidden; font-family: var(--mono); font-weight: 400; letter-spacing: 0; text-align: left; white-space: pre; color: var(--sun); background: var(--night); }
.shot.is-ascii .shot-img { visibility: hidden; }
.shot-play { position: absolute; right: 10px; bottom: 10px; display: grid; place-items: center; width: 36px; height: 36px; font-size: 14px; color: var(--night); background: var(--sun); border-radius: 50%; pointer-events: none; }
.shot figcaption { margin-top: 6px; font-size: 12px; line-height: 1.5; }
.entry .exif, .viewer .exif { display: block; margin-top: 4px; color: var(--sun); }
.sheet { display: grid; grid-template-columns: repeat(auto-fill, minmax(132px, 1fr)); gap: 12px 10px; margin: 8px 0; padding: 0; list-style: none; }
.sheet-item { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.sheet-open { position: relative; display: block; width: 100%; aspect-ratio: 3 / 2; padding: 0; overflow: hidden; background: #000; border: 1px solid var(--line); border-radius: 4px; cursor: zoom-in; }
.sheet-open:hover, .sheet-open:focus-visible { border-color: var(--screen); }
.sheet-img { display: block; width: 100%; height: 100%; object-fit: contain; }
.sheet-item .cmd { align-self: flex-start; font-size: 12px; line-height: 1.4; text-align: left; }
.sheet .shot-play { right: 6px; bottom: 6px; width: 28px; height: 28px; font-size: 11px; }

/* the mirror inside the terminal, and its big view */
.entry .mirror { max-width: min(100%, 720px); margin: 10px 0; }
.mirror-btn { min-height: 40px; padding: 0 16px; font: inherit; color: var(--paper); background: transparent; border: 1px solid var(--screen); border-radius: 999px; cursor: pointer; }
.mirror-btn:hover, .mirror-btn:focus-visible { color: var(--night); background: var(--screen); }
.entry .mirror-ascii { margin: 0; max-width: 100%; overflow: hidden; font-family: var(--mono); letter-spacing: 0; white-space: pre; color: var(--sun); background: var(--surface); border: 1px solid var(--line); border-radius: 4px; }
.entry .mirror[data-state="live"] .mirror-status::before { content: "● "; color: var(--err); }
.mirror-hint { font-size: 12px; }
.mirror[data-state="ready"] .mirror-hint, .mirror[data-state="error"] .mirror-hint, .mirror[data-state="off"] .mirror-hint { display: none; }
.mirror-video { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.mirror-stage { inset: 0; width: min(98vw, 2400px); height: min(96vh, 1600px); height: min(96dvh, 1600px); max-width: none; max-height: none; padding: 0; overflow: hidden; color: var(--paper); background: var(--surface); border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 30px 90px rgba(0, 0, 0, 0.7); }
.mirror-stage[open] { display: flex; flex-direction: column; }
.mirror-stage::backdrop { background: rgba(0, 0, 0, 0.86); }
.ms-bar { display: flex; flex: none; align-items: center; gap: 8px; padding: 6px 10px; border-bottom: 1px solid var(--line); }
.ms-title { font-weight: 700; color: var(--sun); }
.ms-status { flex: 1; min-width: 0; overflow: hidden; font-size: 12px; color: var(--ash); text-overflow: ellipsis; white-space: nowrap; }
.ms-status:not(:empty)::before { content: "● "; color: var(--err); }
.ms-btn { min-width: 44px; min-height: 44px; padding: 0 12px; font: inherit; color: var(--paper); background: transparent; border: 1px solid var(--line); border-radius: 999px; cursor: pointer; }
.ms-btn:hover, .ms-btn:focus-visible { color: var(--sun); border-color: var(--sun); }
.ms-view { display: grid; flex: 1; min-height: 0; place-items: center; padding: 8px; overflow: hidden; background: var(--night); }
.ms-ascii { margin: 0; font-family: var(--mono); letter-spacing: 0; white-space: pre; color: var(--sun); }

/* ---- picture viewer (src/lightbox.js) ----------------------------------------------- */
.viewer { width: min(94vw, 1100px); max-height: 94vh; max-height: 94dvh; padding: 0; overflow: hidden; color: var(--paper); background: var(--surface); border: 1px solid var(--line); border-radius: 6px; box-shadow: 0 30px 90px rgba(0, 0, 0, 0.7); }
.viewer[open] { display: flex; flex-direction: column; }
.viewer::backdrop { background: rgba(8, 7, 6, 0.9); }
.vbar { display: flex; flex: none; align-items: center; gap: 12px; height: 52px; padding: 0 8px 0 16px; border-bottom: 1px solid var(--line); }
.vtitle { flex: 1; min-width: 0; overflow: hidden; font-family: var(--display); font-weight: 700; text-overflow: ellipsis; white-space: nowrap; }
.vcount { font-family: var(--mono); font-size: 12px; color: var(--ash); font-variant-numeric: tabular-nums; }
.vclose, .vprev, .vnext { min-width: 44px; min-height: 44px; font: inherit; color: var(--paper); background: transparent; border: 1px solid var(--line); border-radius: 999px; cursor: pointer; }
.vclose:hover, .vprev:hover, .vnext:hover { color: var(--sun); border-color: var(--sun); }
.vstage { display: grid; flex: 1; min-height: 0; place-items: center; overflow: auto; background: #000; }
.vstage img, .vstage video { display: block; width: auto; height: auto; max-width: 100%; max-height: 66vh; max-height: 66dvh; }
.vcap { flex: none; max-height: 22vh; max-height: 22dvh; margin: 0; padding: 10px 16px; overflow: auto; font-size: 13px; line-height: 1.6; color: var(--soft); }
.vnav { display: flex; flex: none; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 16px 12px; }
.vlinks a { color: var(--screen); }

/* ---- feedback ---------------------------------------------------------------------- */
.toast { position: fixed; left: 50%; bottom: 72px; z-index: 90; max-width: min(92vw, 520px); padding: 10px 16px; font-size: 13px; color: var(--paper); background: var(--raised); border: 1px solid var(--sun); border-radius: 8px; box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5); opacity: 0; transform: translate(-50%, 12px); pointer-events: none; transition: opacity 0.18s, transform 0.18s; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.boot-fail { margin: 16px var(--gutter); padding: 12px 14px; color: var(--paper); background: color-mix(in srgb, var(--sun) 10%, var(--surface)); border: 1px solid var(--sun); border-left-width: 4px; border-radius: 4px; }
.boot-fail strong { color: var(--sun); }
.boot-fail p { margin: 4px 0 10px; }
.boot-fail pre { margin: 6px 0 0; padding: 8px; overflow-wrap: anywhere; font: 12px/1.5 var(--mono); white-space: pre-wrap; color: var(--ash); background: var(--night); border-radius: 3px; user-select: all; }

/* ---- small screens ---------------------------------------------------------------- */
@media (max-width: 860px) {
  .links { display: none; }
  .hero-stage { aspect-ratio: 4 / 5; min-height: 0; max-height: 86vh; }
  .hero-row { grid-template-columns: minmax(0, 1fr); }
  .hero-exif { justify-items: start; text-align: left; }
  .now > div + div { padding-left: 0; border-left: 0; border-top: 1px solid var(--line); }
  .sec-head, .about, .about-body, .mirror-grid { grid-template-columns: minmax(0, 1fr); }
  .ph-a, .ph-b, .ph-f { grid-column: span 12; }
  .ph-c, .ph-d { grid-column: span 6; }
  .ph-e { display: none; }
  .ph-b .pic { aspect-ratio: 4 / 5; }
  .ph-f .pic { aspect-ratio: 3 / 2; }
  .ph figcaption { flex-direction: column; gap: 0; }
  .ex, .ex-small { grid-template-columns: minmax(0, 1fr); }
  .idx a { grid-template-columns: minmax(0, 1fr) 20px; gap: 2px 12px; }
  .idx .d, .idx .k { grid-column: 1; }
  .idx .arr { grid-row: 1; grid-column: 2; }
  .face { font-size: 6px; }
  .term { height: 78vh; height: 78dvh; font-size: 13px; }
}
@media (max-width: 420px) {
  .nav-tools .pill { display: none; }
  .ph-c, .ph-d { grid-column: span 12; }
}

/* ---- motion and print ----------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
  .cmdline .caret { animation: none; }
}
@media print {
  .nav, .cmdline, .term, #wipe, .toast, .viewer, .mirror-stage, .mirror-sec, .dev-canvas, .reveal-canvas, .rule { display: none !important; }
  body { color: #000; background: #fff; }
  .pic.is-dev img { visibility: visible; }
}
