/* Basic website: a 2000s academic homepage read as a well log.
   Colours are tokens so the CRT theme and the full website can restyle the same markup. */
:root {
  color-scheme: light;
  --desk: #d5d6d1;
  --paper: #fffff7;
  --sheet: #ffffff;
  --ink: #171717;
  --muted: #555;
  --navy: #18315a;
  --link: #0000cc;
  --visited: #551a8b;
  --mark: #fff1a6;
  --rule: #999;
  --soft-rule: #b9b9af;
  --chrome: #deded6;
  --chrome-edge: #f5f5ed;
  --band: #e6eaf0;
  --band-edge: #b4bdc6;
  --mud: #8a6328;
  --published: #1c6b3a;
  --working: #1f5a9c;
  --progress: #a8650d;
  --idea: #77706a;
  --chart-bg: #fff;
  --chart-grid: #e3e5e8;
  --chart-text: #444;
  --chart-ink: #222;
  --chart-window: rgba(31, 90, 156, .1);
  --s-blue: #1f5a9c;
  --s-brown: #b86a08;
  --s-green: #288544;
  --s-red: #b3261e;
}
html[data-theme='crt'] {
  color-scheme: dark;
  --desk: #050a07;
  --paper: #0c1410;
  --sheet: #101b15;
  --ink: #b9f0b4;
  --muted: #7fb07c;
  --navy: #d7ffd2;
  --link: #ffd36b;
  --visited: #d9a8ff;
  --mark: #24402a;
  --rule: #3d6a43;
  --soft-rule: #2c4a31;
  --chrome: #16261b;
  --chrome-edge: #3d6a43;
  --band: #13241a;
  --band-edge: #2c4a31;
  --mud: #9be89a;
  --published: #9be89a;
  --working: #8fd0ff;
  --progress: #ffd36b;
  --idea: #8aa58a;
  --chart-bg: #0c1410;
  --chart-grid: #1e3524;
  --chart-text: #7fb07c;
  --chart-ink: #b9f0b4;
  --chart-window: rgba(155, 232, 154, .1);
  --s-blue: #8fd0ff;
  --s-brown: #ffd36b;
  --s-green: #9be89a;
  --s-red: #ff9c8f;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 24px 12px; background: var(--desk); color: var(--ink); font: 17px/1.55 "Times New Roman", Times, serif; overflow-wrap: break-word; }
html[data-theme='crt'] body { font-family: "Courier New", Courier, monospace; font-size: 15px; text-shadow: 0 0 6px rgba(155, 232, 154, .35); }
.page { position: relative; max-width: 850px; margin: auto; background: var(--paper); border: 1px solid #777; box-shadow: 5px 5px 0 rgba(0, 0, 0, .18); }
a { color: var(--link); }
a:visited { color: var(--visited); }
a:hover { background: var(--mark); }
a:focus-visible, summary:focus-visible { outline: 2px solid var(--navy); outline-offset: 4px; }
.skip { position: absolute; left: -10000px; }
.skip:focus { left: 16px; top: 3px; background: var(--sheet); padding: 8px; z-index: 6; }

/* Header */
.window-title { display: flex; justify-content: space-between; gap: 12px; margin: 0; padding: 5px 12px; background: #18315a; color: #fff; font: bold 12px/1.5 "Courier New", monospace; text-shadow: none; }
.intro { padding: 30px 30px 18px; text-align: center; }
.eyebrow { margin: 0; color: var(--muted); font: 12px/1.5 "Courier New", monospace; }
h1 { margin: 8px 0 10px; color: var(--navy); font-size: clamp(30px, 6vw, 44px); line-height: 1.1; letter-spacing: -.01em; }
.intro p { margin: 10px 0; }
.tagline { font-size: 19px; font-style: italic; }
.mode-switch { margin-top: 16px; }
nav { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; padding: 10px; background: var(--chrome); border-block: 1px solid var(--rule); }
nav a { padding: 3px 10px; border: 2px outset var(--chrome-edge); background: var(--chrome); font: 13px/1.5 Arial, sans-serif; }
nav a:active { border-style: inset; }

/* Body */
main { padding: 8px 30px 16px; }
.welcome { padding: 12px; border: 1px dashed var(--rule); background: var(--sheet); }
small { font-size: 14px; }
section { margin: 30px 0; scroll-margin-top: 12px; }
h2 { margin: 0 0 12px; padding: 5px 10px; border: 1px solid var(--band-edge); border-left: 6px solid var(--navy); background: var(--band); color: var(--navy); font-size: 21px; line-height: 1.3; }
.project-list { padding-left: 24px; }
.project-list li { margin: 14px 0; padding-left: 3px; }
.project-list li[hidden] + li { margin-top: 14px; }

/* Status: one square of colour says how real a project is. */
.status { display: inline-block; color: var(--muted); font-style: italic; }
.status::before, .key i { content: ""; display: inline-block; width: 9px; height: 9px; margin-right: 6px; background: var(--idea); border: 1px solid rgba(0, 0, 0, .35); }
.status[data-state='published']::before, .key [data-state='published'] i { background: var(--published); }
.status[data-state='working']::before, .key [data-state='working'] i { background: var(--working); }
.status[data-state='progress']::before, .key [data-state='progress'] i { background: var(--progress); }
.key { display: flex; flex-wrap: wrap; gap: 6px; margin: 12px 0 0; font: 13px/1.5 Arial, sans-serif; }
.key button { border: 2px outset var(--chrome-edge); background: var(--chrome); color: var(--ink); padding: 2px 9px; }
.key button[aria-pressed='true'] { border-style: inset; background: var(--mark); }
#filter-empty { font-style: italic; color: var(--muted); }

details { border: 1px solid var(--soft-rule); background: var(--sheet); margin: 16px 0; padding: 8px 12px; }
summary { cursor: pointer; color: var(--link); text-decoration: underline; font-size: 15px; }
figure { margin: 18px 0 8px; }
img { display: block; max-width: 100%; height: auto; }
figcaption { margin-top: 6px; color: var(--muted); font-size: 14px; }

/* A sentence you can change */
.live-sentence { margin: 16px 0; padding: 12px 14px; border: 1px solid var(--soft-rule); border-left: 6px solid var(--mud); background: var(--sheet); }
.live-sentence p { margin: 0 0 8px; }
.live-sentence input { width: 4.4em; padding: 0 2px; color: var(--link); border: 0; border-bottom: 1px dashed var(--link); background: var(--mark); cursor: ew-resize; text-align: center; }
.live-sentence strong { white-space: nowrap; }
.live-sentence canvas { display: block; width: 100%; height: 150px; margin-top: 10px; background: var(--chart-bg); border: 1px solid var(--soft-rule); }
.method-note { color: var(--muted); font: 13px/1.5 Arial, sans-serif; border-top: 1px dashed var(--rule); padding-top: 10px; }

.contact { border-top: 1px solid var(--rule); padding-top: 18px; }
.contact label { display: block; margin: 12px 0; }
.contact input, .contact textarea { display: block; width: 100%; padding: 6px; }
#contact-email { overflow-wrap: anywhere; }

footer { padding: 12px 20px 20px; border-top: 3px double var(--rule); text-align: center; font-size: 14px; }
.badges { display: flex; justify-content: center; flex-wrap: wrap; gap: 8px; margin: 15px 0; }
.badges span { min-width: 88px; padding: 3px 7px; border: 2px outset #fff; background: #ddd; color: #222; font: 9px/1.4 "Courier New", monospace; text-shadow: none; }
.badges span:first-child { background: #ffe09a; }
.badges b { font-size: 10px; }

/* Controls */
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 2px solid var(--navy); outline-offset: 3px; }
.text-button { border: 0; background: transparent; color: var(--link); text-decoration: underline; padding: 3px; }
.text-button:hover { background: var(--mark); }
.retro-button, .lab-toolbar button { border: 2px outset var(--chrome-edge); background: var(--chrome); color: var(--ink); padding: 5px 10px; font: 14px Arial, sans-serif; }
.retro-button:active, .lab-toolbar [aria-pressed=true] { border-style: inset; background: var(--band); }
.lab-entry { text-align: center; }
.lab-entry small { display: block; }
textarea { display: block; width: 100%; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
td, th { text-align: left; border-bottom: 1px solid var(--soft-rule); padding: 6px; }

/* Depth track: the page as a well log. Built by site.js on wide screens only. */
#depth-rail { display: none; }
@media (min-width: 1240px) {
  #depth-rail { display: block; position: fixed; top: 24px; bottom: 24px; left: calc(50% - 425px - 176px); width: 160px; font: 11px/1.2 "Courier New", monospace; color: var(--muted); }
  #depth-rail .track { position: absolute; top: 0; bottom: 0; right: 0; width: 46px; border: 1px solid var(--rule); background: var(--paper); }
  #depth-rail svg { position: absolute; inset: 0; width: 100%; height: 100%; }
  #depth-rail path { fill: none; stroke: var(--mud); stroke-width: 1.2; vector-effect: non-scaling-stroke; }
  #depth-rail .top { position: absolute; right: 54px; transform: translateY(-50%); max-width: 106px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); text-decoration: none; padding: 1px 3px; }
  #depth-rail .top + .top::before { content: none; }
  #depth-rail .tick { position: absolute; right: 0; width: 54px; border-top: 1px dashed var(--rule); }
  #depth-rail .unused::after { content: ""; position: absolute; right: -54px; top: 50%; width: 52px; border-top: 1px dashed var(--rule); }
  #depth-rail .top[aria-current='true'] { color: var(--navy); font-weight: bold; background: var(--mark); }
  #depth-rail .bit { position: absolute; right: -1px; width: 48px; height: 0; border-top: 2px solid #c22; transition: top .08s linear; }
  #depth-rail .bit span { position: absolute; left: 0; width: 46px; top: -15px; text-align: center; font-size: 10px; white-space: nowrap; color: #c22; font-weight: bold; background: var(--paper); }
  html[data-theme='crt'] #depth-rail .bit, html[data-theme='crt'] #depth-rail .bit span { border-color: #ffd36b; color: #ffd36b; }
}

/* Laboratory window */
dialog { color: var(--ink); background: var(--paper); width: min(960px, calc(100% - 24px)); max-height: 90dvh; padding: 20px; border: 3px outset #ddd; box-shadow: 6px 6px 0 #0005; }
#privacy-dialog h3 { margin: 14px 0 2px; font-size: 16px; }
dialog::backdrop { background: #15213b99; }
#laboratory { padding: 0; }
.lab-titlebar { position: sticky; top: 0; z-index: 2; display: flex; justify-content: space-between; align-items: center; background: #18315a; color: white; padding: 5px 10px; font: 14px monospace; text-shadow: none; }
.lab-toolbar, .button-row { display: flex; flex-wrap: wrap; gap: 8px; padding: 10px 0; }
.lab-toolbar { padding: 8px; background: var(--chrome); border-bottom: 1px solid var(--rule); }
#lab-panel { padding: 4px 20px 16px; }
#lab-panel h3 { margin-bottom: 4px; }
#lab-panel canvas { display: block; width: 100%; height: 300px; background: var(--chart-bg); border: 1px solid var(--soft-rule); }
#lab-panel .molecule-canvas { height: 380px; touch-action: none; }
.lab-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; margin: 16px 0; }
.lab-grid label { display: block; font-size: 15px; }
.lab-grid input, .lab-grid select { display: block; width: 100%; }
.lab-control output { float: right; font-family: monospace; }
.terminal { background: #132016; color: #b7f4b6; padding: 16px; overflow: auto; font: 13px/1.5 monospace; }
.lab-taskbar { display: flex; flex-wrap: wrap; justify-content: space-between; padding: 5px 12px; background: var(--chrome); font-size: 13px; }
#lab-notebook { margin: 12px; }
.readouts { display: flex; flex-wrap: wrap; gap: 20px; font: 14px monospace; margin: 12px 0; }
progress { width: 100%; }
.fraction { display: grid; grid-template-columns: 150px 1fr 65px; gap: 8px; align-items: center; font-size: 14px; }
.fraction meter { width: 100%; }
#case-select { max-width: 100%; }

/* Public statistics */
.bars { display: grid; grid-template-columns: minmax(110px, 38%) 1fr 3em; gap: 4px 8px; align-items: center; margin: 8px 0 18px; font: 13px/1.4 Arial, sans-serif; }
.bars i { display: block; height: 12px; background: var(--navy); min-width: 2px; }
.bars b { text-align: right; font-family: monospace; }


/* Private dashboard */
.dashboard { max-width: 1100px; }
.dashboard table { table-layout: fixed; overflow-wrap: anywhere; }
.dashboard input { max-width: 100%; }
.dashboard .delta-up { color: var(--published); }
.dashboard .delta-down { color: #b3261e; }
#heatmap { display: block; width: 100%; max-width: 700px; border: 1px solid var(--rule); }
#journey { max-height: 400px; overflow: auto; font: 12px/1.6 monospace; }
#replay-stage { width: 100%; overflow: hidden; background: #eee; }
#replay-stage .replayer-wrapper { transform-origin: top left; }
#replay-stage iframe { border: none; }

@media (max-width: 520px) {
  body { margin: 8px; }
  main { padding: 6px 15px 12px; }
  .intro { padding: 22px 14px 12px; }
  h2 { font-size: 20px; }
  nav a { padding: 4px 8px; }
  #lab-panel { padding: 4px 10px 12px; }
  #lab-panel canvas { height: 230px; }
  #lab-panel .molecule-canvas { height: 280px; }
  .fraction { grid-template-columns: 110px 1fr 50px; }
}
@media (prefers-reduced-motion: reduce) { #depth-rail .bit { transition: none; } }
@media print {
  body { margin: 0; background: white; }
  .page { border: 0; box-shadow: none; max-width: none; }
  nav, .badges, .skip, dialog, .lab-entry, .text-button, .key, .mode-switch, #depth-rail { display: none !important; }
}
.trajectory { margin-top: 4px; padding: 0 12px 4px; border: 1px solid var(--soft-rule); background: var(--sheet); }
.trajectory .frame-control { flex: 1; min-width: 180px; font-size: 15px; }
.trajectory .frame-control input { display: block; width: 100%; }
#trajectory-readout { margin: 0 0 8px; font: 13px/1.5 monospace; }
/* The square brackets of the basic page are decoration, so the full website can drop them. */
.text-button::before, .bracket::before { content: "[ "; }
.text-button::after, .bracket::after { content: " ]"; }
.intro .bracket + .bracket { margin-left: .6em; }

/* Header "now" line and publication list */
.now { max-width: 62ch; }
.publication-list { padding-left: 1.4em; }
.publication-list li { margin: 12px 0; }
.contact-trap { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }
