/* AJ/OS 26 — Retro OS Desktop redesign of antjanus.com
   Bevel recipe after 98.css (jdan/98.css): four inset box-shadows, light from top-left. */

:root {
  --desk: #2a3f54;
  --desk-2: #314a62;
  --face: #c0c0c0;
  --hi: #ffffff;
  --lite: #dfdfdf;
  --shadow: #808080;
  --frame: #0a0a0a;
  --field: #ffffff;
  --field-alt: #f1f1ee;
  --ink: #0b0b0b;
  --ink-dim: #3b3b3b;
  --link: #00008b;
  --select: #2a3f54;
  --select-ink: #ffffff;
  --title-a: #1c2e40;
  --title-b: #4a6d8c;
  --title-ink: #ffffff;
  --tip: #ffffe1;
  --tip-ink: #1b1b1b;
  --gold: #8a5300;
  --folder: #e2b93b;
  --folder-lite: #f7dc72;
  --ok: #1c6e52;
  --bad: #a03227;
  --desk-ink: #ffffff;

  --raised: inset -1px -1px var(--frame), inset 1px 1px var(--hi), inset -2px -2px var(--shadow), inset 2px 2px var(--lite);
  --sunken: inset -1px -1px var(--hi), inset 1px 1px var(--shadow), inset -2px -2px var(--lite), inset 2px 2px var(--frame);
  --window: inset -1px -1px var(--frame), inset 1px 1px var(--lite), inset -2px -2px var(--shadow), inset 2px 2px var(--hi);
  --status: inset -1px -1px var(--lite), inset 1px 1px var(--shadow);

  --font-pixel: "Pixelify Sans", "Courier New", monospace;
  --font-body: "IBM Plex Sans", system-ui, sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, monospace;
  --font-dos: "VT323", "IBM Plex Mono", monospace;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --desk: #0a1017;
    --desk-2: #111a24;
    --face: #2c3038;
    --hi: #5f6773;
    --lite: #40464f;
    --shadow: #15181c;
    --frame: #000000;
    --field: #15181d;
    --field-alt: #1c2027;
    --ink: #e9ebef;
    --ink-dim: #b4bac4;
    --link: #9cc3f0;
    --select: #4a6d8c;
    --select-ink: #ffffff;
    --title-a: #22364a;
    --title-b: #4a6d8c;
    --tip: #2f2a17;
    --tip-ink: #f3e7bf;
    --gold: #e0b35c;
    --folder: #c79d2a;
    --folder-lite: #e2bf55;
    --ok: #4fbe93;
    --bad: #ee8579;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --desk: #0a1017;
  --desk-2: #111a24;
  --face: #2c3038;
  --hi: #5f6773;
  --lite: #40464f;
  --shadow: #15181c;
  --frame: #000000;
  --field: #15181d;
  --field-alt: #1c2027;
  --ink: #e9ebef;
  --ink-dim: #b4bac4;
  --link: #9cc3f0;
  --select: #4a6d8c;
  --select-ink: #ffffff;
  --title-a: #22364a;
  --title-b: #4a6d8c;
  --tip: #2f2a17;
  --tip-ink: #f3e7bf;
  --gold: #e0b35c;
  --folder: #c79d2a;
  --folder-lite: #e2bf55;
  --ok: #4fbe93;
  --bad: #ee8579;
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font-body);
  font-size: 1.0625rem;
  line-height: 1.55;
  color: var(--ink);
  background-color: var(--desk);
  background-image:
    url("assets/wallpaper.png"),
    radial-gradient(var(--desk-2) 1px, transparent 1.5px);
  background-size: cover, 4px 4px;
  background-attachment: fixed, scroll;
  overflow-x: hidden;
  min-height: 100vh;
}
img { max-width: 100%; display: block; }
a { color: var(--link); text-underline-offset: 3px; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 2px dotted currentColor; outline-offset: 2px; }
button, input, select { font: inherit; color: inherit; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.skip { position: absolute; left: 8px; top: -60px; z-index: 100; background: var(--tip); color: var(--tip-ink); padding: 10px 14px; box-shadow: var(--raised); }
.skip:focus { top: 8px; }

/* ---------- Icons ---------- */
.ico { width: 32px; height: 32px; flex: none; shape-rendering: crispEdges; }
.ico-16 { width: 18px; height: 18px; }
.ico-24 { width: 24px; height: 24px; }
.ico-48 { width: 48px; height: 48px; }

/* ---------- Desktop layout ---------- */
.desktop { max-width: 1320px; margin: 0 auto; padding: 28px 24px 104px; }
.desktop.has-rail { display: grid; grid-template-columns: 112px minmax(0, 1fr); gap: 28px; }
.stack { display: grid; gap: 28px; min-width: 0; }
.grid-12 { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 28px; align-items: start; }
.span-12 { grid-column: span 12; } .span-8 { grid-column: span 8; } .span-7 { grid-column: span 7; }
.span-6 { grid-column: span 6; } .span-5 { grid-column: span 5; } .span-4 { grid-column: span 4; }
.span-3 { grid-column: span 3; } .span-9 { grid-column: span 9; }

/* desktop shortcut icons */
.shortcuts { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; align-content: start; }
.shortcut a {
  display: grid; justify-items: center; gap: 6px; padding: 8px 4px; text-decoration: none;
  color: var(--desk-ink); font-family: var(--font-pixel); font-size: 0.9375rem; line-height: 1.2; text-align: center;
}
.shortcut span { padding: 1px 4px; text-shadow: 1px 1px 0 #000; }
.shortcut a:hover span, .shortcut a:focus-visible span { background: var(--select); text-shadow: none; outline: 1px dotted #fff; }
.shortcut a:focus-visible { outline: none; }

/* ---------- Window ---------- */
.win {
  background: var(--face);
  box-shadow: var(--window), 6px 6px 0 rgb(0 0 0 / 0.28);
  padding: 4px;
  min-width: 0;
  position: relative;
}
.win-title {
  display: flex; align-items: center; gap: 8px;
  min-height: 34px; padding: 3px 4px 3px 8px;
  background: linear-gradient(90deg, var(--title-a), var(--title-b));
  color: var(--title-ink);
  user-select: none;
}
.win-title h1, .win-title h2, .win-title .t {
  margin: 0; flex: 1; min-width: 0;
  font-family: var(--font-pixel); font-weight: 600; font-size: 1rem; letter-spacing: 0.01em;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.win.is-draggable .win-title { cursor: grab; }
.win.is-dragging .win-title { cursor: grabbing; }
.win.is-dragging { z-index: 30; }
.win-ctrls { display: flex; gap: 3px; margin-left: auto; }
.win-ctrls button {
  width: 30px; height: 26px; padding: 0; border: 0; background: var(--face); color: var(--ink);
  box-shadow: var(--raised); display: grid; place-items: center; cursor: pointer; position: relative;
}
.win-ctrls button::after { content: ""; position: absolute; inset: -9px -2px; }
.win-ctrls button:active { box-shadow: var(--sunken); }
.win-ctrls button svg { width: 12px; height: 12px; }
.win-ctrls button:focus-visible { outline: 2px dotted var(--ink); outline-offset: -6px; }
.win.is-rolled .win-body, .win.is-rolled .menubar, .win.is-rolled .statusbar, .win.is-rolled .toolbar { display: none; }
.win.is-max { grid-column: 1 / -1 !important; transform: none !important; }
.win[hidden] { display: none; }

.menubar { display: flex; flex-wrap: wrap; gap: 2px; padding: 4px 2px; border-bottom: 1px solid var(--shadow); box-shadow: 0 1px 0 var(--hi); margin-bottom: 4px; }
.menubar a, .menubar button {
  font-size: 0.9375rem; padding: 6px 10px; min-height: 36px; display: inline-block; line-height: 24px;
  color: var(--ink); text-decoration: none; background: none; border: 0; cursor: pointer;
}
.menubar a:hover, .menubar button:hover { background: var(--select); color: var(--select-ink); }
.menubar u { text-underline-offset: 2px; }

.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 6px 4px 8px; }
.address { flex: 1; min-width: 200px; display: flex; align-items: center; gap: 8px; font-size: 0.9375rem; }
.address .field { flex: 1; padding: 6px 10px; font-family: var(--font-mono); font-size: 0.9375rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.win-body { padding: 14px 12px 12px; }
.win-body.flush { padding: 0; }
.statusbar { display: flex; gap: 3px; padding-top: 4px; font-size: 0.875rem; }
.statusbar > * { box-shadow: var(--status); padding: 3px 8px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.statusbar > :first-child { flex: 1; }

.field { background: var(--field); color: var(--ink); box-shadow: var(--sunken); padding: 14px 16px; }
.field.alt { background: var(--field-alt); }
.inset-plain { box-shadow: var(--status); padding: 12px; }

/* ---------- Type ---------- */
.px { font-family: var(--font-pixel); }
.display { font-family: var(--font-pixel); font-weight: 700; font-size: clamp(2.1rem, 4.4vw, 3.6rem); line-height: 1.05; margin: 0 0 16px; letter-spacing: -0.01em; }
.h-sec { font-family: var(--font-pixel); font-weight: 600; font-size: 1.6rem; line-height: 1.15; margin: 0 0 8px; }
.h-sub { font-family: var(--font-pixel); font-weight: 600; font-size: 1.25rem; line-height: 1.2; margin: 0 0 6px; }
.lede { font-size: 1.1875rem; line-height: 1.55; max-width: 62ch; margin: 0 0 16px; }
.dim { color: var(--ink-dim); }
.eyebrow { font-family: var(--font-dos); font-size: 1.25rem; line-height: 1; letter-spacing: 0.04em; text-transform: uppercase; color: var(--ink-dim); margin: 0 0 8px; }
p { margin: 0 0 12px; }
.mono { font-family: var(--font-mono); }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 8px 18px; border: 0; background: var(--face); color: var(--ink);
  box-shadow: var(--raised); text-decoration: none; cursor: pointer; font-size: 1rem; line-height: 1.2;
}
.btn:hover { text-decoration: none; }
.btn:active, .btn[aria-pressed="true"] { box-shadow: var(--sunken); padding: 9px 17px 7px 19px; }
.btn:focus-visible { outline: 2px dotted var(--ink); outline-offset: -7px; }
.btn.default { box-shadow: inset -2px -2px var(--frame), inset 1px 1px var(--frame), inset 2px 2px var(--hi), inset -3px -3px var(--shadow), inset 3px 3px var(--lite); font-weight: 600; }
.btn.default:active { box-shadow: var(--sunken), 0 0 0 1px var(--frame); }
.btn.quiet { box-shadow: none; text-decoration: underline; padding-inline: 8px; }
.btn.quiet:active { box-shadow: none; }
.btn-row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }

/* ---------- Home hero ---------- */
.hero-stage { position: relative; min-height: 760px; }
.hero-photo { position: absolute; left: 0; top: 0; width: 60%; }
.hero-photo img { width: 100%; height: 540px; object-fit: cover; object-position: 30% 30%; }
.hero-welcome { position: absolute; right: 0; top: 64px; width: 52%; z-index: 2; }
.welcome-grid { display: grid; grid-template-columns: 110px 1fr; gap: 18px; }
.welcome-side {
  background: linear-gradient(180deg, var(--title-b), var(--title-a)); color: #fff;
  font-family: var(--font-pixel); font-weight: 700; writing-mode: vertical-rl; transform: rotate(180deg);
  display: flex; align-items: center; justify-content: flex-end; padding: 14px 0; font-size: 1.9rem; letter-spacing: 0.02em;
  box-shadow: var(--sunken);
}
.welcome-side small { font-weight: 400; font-size: 1.1rem; opacity: 0.9; margin-top: 8px; }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1px; background: var(--shadow); box-shadow: var(--sunken); padding: 2px; margin: 16px 0; }
.stats div { background: var(--field); padding: 10px 12px; }
.stats b { display: block; font-family: var(--font-pixel); font-size: 1.75rem; line-height: 1.1; }
.stats span { font-size: 0.875rem; color: var(--ink-dim); }

/* ---------- Details view (Explorer list) ---------- */
.details { width: 100%; border-collapse: collapse; background: var(--field); font-size: 1rem; }
.details-wrap { box-shadow: var(--sunken); padding: 2px; background: var(--field); overflow-x: auto; }
.details th {
  text-align: left; font-weight: 500; font-size: 0.9375rem; background: var(--face); box-shadow: var(--raised);
  padding: 0; white-space: nowrap; position: sticky; top: 0;
}
.details th > span, .details th > button { display: block; width: 100%; text-align: left; padding: 7px 10px; background: none; border: 0; cursor: default; }
.details th > button { cursor: pointer; }
.details th > button:focus-visible { outline: 2px dotted var(--ink); outline-offset: -5px; }
.details th[aria-sort="ascending"] > button::after { content: " \25B4"; }
.details th[aria-sort="descending"] > button::after { content: " \25BE"; }
.details td { padding: 8px 10px; vertical-align: top; border-bottom: 1px dotted color-mix(in srgb, var(--shadow) 60%, transparent); }
.details tr:hover td { background: color-mix(in srgb, var(--select) 12%, var(--field)); }
.details .name { display: flex; gap: 10px; align-items: flex-start; }
.details .name a { font-weight: 500; }
.details .name .ico { width: 24px; height: 24px; margin-top: 1px; }
.details .desc { display: block; color: var(--ink-dim); font-size: 0.9375rem; margin-top: 2px; }
.details td.date { font-family: var(--font-mono); font-size: 0.9375rem; white-space: nowrap; }
.details td.type { white-space: nowrap; font-size: 0.9375rem; }

/* ---------- Large-icon view ---------- */
.icon-view { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; padding: 12px; background: var(--field); box-shadow: var(--sunken); }
.icon-view a { display: grid; justify-items: center; text-align: center; gap: 6px; padding: 10px 6px; color: var(--ink); text-decoration: none; font-size: 0.9375rem; line-height: 1.3; }
.icon-view a:hover span, .icon-view a:focus-visible span { background: var(--select); color: var(--select-ink); }
.icon-view a:focus-visible { outline: 1px dotted var(--ink); outline-offset: -2px; }
.icon-view small { color: var(--ink-dim); font-size: 0.8125rem; }

/* ---------- Thumbnail view cards ---------- */
.thumbs { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 18px; }
.thumb { display: grid; grid-template-rows: auto 1fr; background: var(--field); box-shadow: var(--sunken); padding: 3px; color: var(--ink); text-decoration: none; }
.thumb .pic { aspect-ratio: 16 / 9; background: var(--desk) linear-gradient(135deg, var(--title-a), var(--title-b)); overflow: hidden; }
.thumb .pic img { width: 100%; height: 100%; object-fit: cover; }
.thumb .cap { padding: 12px 12px 14px; }
.thumb .cap b { display: block; font-size: 1.0625rem; line-height: 1.3; margin-bottom: 6px; color: var(--link); text-decoration: underline; text-underline-offset: 3px; }
.thumb .cap p { font-size: 0.9375rem; color: var(--ink-dim); margin: 0 0 8px; }
.thumb .meta { font-family: var(--font-mono); font-size: 0.8125rem; color: var(--ink-dim); }
.thumb:hover .cap b { text-decoration-thickness: 2px; }
.thumb:focus-visible { outline: 2px dotted var(--ink); outline-offset: 3px; }

/* chips */
.chips { display: flex; flex-wrap: wrap; gap: 6px; list-style: none; padding: 0; margin: 0; }
.chip { font-family: var(--font-mono); font-size: 0.8125rem; padding: 3px 8px; background: var(--face); box-shadow: var(--status); color: var(--ink); text-decoration: none; }
a.chip:hover, button.chip:hover { background: var(--select); color: var(--select-ink); }
button.chip { border: 0; cursor: pointer; min-height: 40px; padding: 6px 12px; font-size: 0.875rem; box-shadow: var(--raised); }
button.chip[aria-pressed="true"] { box-shadow: var(--sunken); background: var(--select); color: var(--select-ink); }
button.chip:focus-visible { outline: 2px dotted currentColor; outline-offset: -6px; }
.badge { font-family: var(--font-dos); font-size: 1.05rem; line-height: 1; padding: 3px 7px 2px; background: var(--tip); color: var(--tip-ink); box-shadow: inset 0 0 0 1px var(--frame); text-transform: uppercase; }
.badge.new { background: var(--select); color: var(--select-ink); }

/* ---------- Dialog / message box ---------- */
.msg { display: grid; grid-template-columns: 40px 1fr; gap: 14px; align-items: start; }
.msg .ico { width: 40px; height: 40px; }
.tip-box { background: var(--tip); color: var(--tip-ink); box-shadow: var(--sunken); padding: 16px 18px; }
.tip-box a { color: inherit; }

/* Tabs (property sheet) */
.tabs { display: flex; flex-wrap: wrap; gap: 0; padding-left: 4px; position: relative; z-index: 1; }
.tab {
  background: var(--face); border: 0; padding: 8px 16px; min-height: 40px; cursor: pointer; font-size: 0.9375rem;
  box-shadow: inset -1px 0 var(--frame), inset 1px 1px var(--hi), inset -2px 0 var(--shadow), inset 2px 2px var(--lite);
  margin-top: 4px; color: var(--ink);
}
.tab[aria-selected="true"], .tab[aria-pressed="true"] { margin-top: 0; padding-bottom: 12px; margin-bottom: -3px; font-weight: 600; z-index: 2; position: relative; }
.tab:focus-visible { outline: 2px dotted var(--ink); outline-offset: -6px; }
.sheet { box-shadow: var(--window); padding: 16px; background: var(--face); }

/* Tree view */
.tree, .tree ul { list-style: none; margin: 0; padding: 0; }
.tree ul { padding-left: 22px; margin-left: 9px; border-left: 1px dotted var(--shadow); }
.tree li { position: relative; }
.tree ul > li::before { content: ""; position: absolute; left: -22px; top: 19px; width: 18px; border-top: 1px dotted var(--shadow); }
.tree a, .tree .node { display: flex; align-items: center; gap: 8px; padding: 6px 6px; color: var(--ink); text-decoration: none; font-size: 0.9875rem; min-height: 38px; }
.tree a:hover span, .tree a:focus-visible span { background: var(--select); color: var(--select-ink); }
.tree a:focus-visible { outline: 1px dotted var(--ink); outline-offset: -2px; }
.tree .ico { width: 22px; height: 22px; }
.tree .count { color: var(--ink-dim); font-family: var(--font-mono); font-size: 0.8125rem; }

/* Explorer split */
.explorer { display: grid; grid-template-columns: 250px minmax(0, 1fr); gap: 6px; }
.explorer > .pane-left { background: var(--field); box-shadow: var(--sunken); padding: 8px; align-self: start; position: sticky; top: 16px; }
.explorer > .pane-right { min-width: 0; }

/* Progress (Win95 chunked) */
.progress { height: 24px; box-shadow: var(--sunken); padding: 3px; background: var(--field); }
.progress > i { display: block; height: 100%; width: var(--p, 0%); background: repeating-linear-gradient(90deg, var(--select) 0 12px, transparent 12px 15px); }

/* ---------- Taskbar ---------- */
.taskbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 50; height: 52px;
  display: flex; align-items: center; gap: 6px; padding: 4px 6px;
  background: var(--face); box-shadow: inset 0 1px var(--lite), inset 0 2px var(--hi);
}
.start-btn { font-family: var(--font-pixel); font-weight: 700; font-size: 1.0625rem; padding: 6px 12px 6px 8px; min-height: 42px; }
.start-btn[aria-expanded="true"] { box-shadow: var(--sunken); }
.logo-mark { width: 26px; height: 26px; flex: none; }
.tasks { display: flex; gap: 4px; flex: 1; min-width: 0; overflow: hidden; list-style: none; margin: 0; padding: 0; }
.tasks a {
  display: flex; align-items: center; gap: 6px; min-height: 42px; padding: 4px 12px; max-width: 170px; min-width: 0;
  background: var(--face); box-shadow: var(--raised); color: var(--ink); text-decoration: none; font-size: 0.9375rem; white-space: nowrap;
}
.tasks a span { overflow: hidden; text-overflow: ellipsis; }
.tasks a[aria-current="page"] {
  box-shadow: var(--sunken); font-weight: 600;
  background: repeating-conic-gradient(var(--face) 0 25%, var(--hi) 0 50%) 0 0 / 2px 2px;
}
.tasks a[aria-current="page"] span { background: var(--face); padding: 0 3px; }
.tasks a:focus-visible { outline: 2px dotted var(--ink); outline-offset: -6px; }
.tasks .ico { width: 20px; height: 20px; }
.restored { display: flex; gap: 4px; }
.tray { display: flex; align-items: center; gap: 4px; box-shadow: var(--status); padding: 2px 4px 2px 6px; min-height: 42px; }
.tray button { background: none; border: 0; min-width: 40px; min-height: 38px; display: grid; place-items: center; cursor: pointer; color: var(--ink); }
.tray button:hover { box-shadow: var(--raised); }
.tray button:focus-visible { outline: 2px dotted var(--ink); outline-offset: -4px; }
.clock { font-family: var(--font-dos); font-size: 1.3rem; padding: 0 6px; white-space: nowrap; }
.theme-ico-dark { display: none; }
:root[data-theme="dark"] .theme-ico-dark { display: block; }
:root[data-theme="dark"] .theme-ico-light { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-ico-dark { display: block; }
  :root:not([data-theme="light"]) .theme-ico-light { display: none; }
}

/* Start menu */
.start-menu {
  position: fixed; left: 4px; bottom: 50px; z-index: 60; width: min(340px, calc(100vw - 8px));
  background: var(--face); box-shadow: var(--window), 4px 4px 0 rgb(0 0 0 / 0.35); padding: 3px;
  display: grid; grid-template-columns: 38px 1fr;
}
.start-menu[hidden] { display: none; }
.start-banner {
  background: linear-gradient(0deg, var(--title-a), var(--title-b)); color: #fff;
  writing-mode: vertical-rl; transform: rotate(180deg); font-family: var(--font-pixel); font-weight: 700; font-size: 1.4rem;
  padding: 10px 0; display: flex; align-items: center; justify-content: flex-start;
}
.start-banner span { font-weight: 400; opacity: 0.85; margin-top: 6px; }
.start-menu ul { list-style: none; margin: 0; padding: 2px 0; }
.start-menu li.sep { height: 0; border-top: 1px solid var(--shadow); border-bottom: 1px solid var(--hi); margin: 4px 2px; }
.start-menu a, .start-menu button {
  display: flex; align-items: center; gap: 12px; width: 100%; padding: 6px 12px; min-height: 46px;
  color: var(--ink); text-decoration: none; font-size: 1rem; background: none; border: 0; text-align: left; cursor: pointer;
}
.start-menu a:hover, .start-menu a:focus-visible, .start-menu button:hover, .start-menu button:focus-visible { background: var(--select); color: var(--select-ink); outline: none; }
.start-menu u { text-underline-offset: 2px; }

/* reading progress in taskbar */
.read-progress { width: 150px; }
.read-progress .progress { height: 22px; }

/* ---------- Footer as "About AJ/OS" dialog ---------- */
.foot { margin-top: 28px; }
.foot-grid { display: grid; grid-template-columns: 1.3fr 1fr 1fr 1.4fr; gap: 24px; }
.foot h3 { font-family: var(--font-pixel); font-size: 1.05rem; margin: 0 0 8px; }
.foot ul { list-style: none; padding: 0; margin: 0; display: grid; gap: 2px; }
.foot ul a { display: inline-block; padding: 4px 0; }
.foot .copy { margin: 16px 0 0; font-size: 0.9375rem; color: var(--ink-dim); }
.subscribe { display: flex; gap: 8px; flex-wrap: wrap; }
.subscribe input { flex: 1; min-width: 160px; min-height: 44px; padding: 8px 10px; border: 0; background: var(--field); box-shadow: var(--sunken); }
.subscribe input:focus-visible { outline: 2px dotted var(--ink); outline-offset: 2px; }
.form-note { font-size: 0.9375rem; margin-top: 8px; min-height: 1.4em; }

/* ---------- Article ---------- */
.article-layout { display: grid; grid-template-columns: 280px minmax(0, 1fr); gap: 28px; align-items: start; }
.help-toc { position: sticky; top: 20px; }
.help-toc ol { list-style: none; margin: 0; padding: 0; }
.help-toc a { display: flex; gap: 8px; align-items: center; padding: 7px 8px; color: var(--ink); text-decoration: none; font-size: 0.9875rem; line-height: 1.3; min-height: 40px; }
.help-toc a .ico { width: 20px; height: 20px; }
.help-toc a:hover, .help-toc a[aria-current="true"] { background: var(--select); color: var(--select-ink); }
.help-toc a:focus-visible { outline: 1px dotted var(--ink); outline-offset: -2px; }
.toc-mobile { display: none; }
.doc-page { background: var(--field); box-shadow: var(--sunken); padding: 8px; }
.doc-ruler { height: 26px; margin: 0 0 8px; background: repeating-linear-gradient(90deg, var(--ink-dim) 0 1px, transparent 1px 12px) bottom / 100% 6px no-repeat, var(--field-alt); box-shadow: var(--status); font-family: var(--font-dos); font-size: 0.95rem; color: var(--ink-dim); padding: 0 8px; line-height: 20px; }
.prose { max-width: 70ch; margin: 0 auto; padding: 20px 28px 40px; font-size: 1.125rem; line-height: 1.7; }
.prose h2 { font-family: var(--font-pixel); font-weight: 600; font-size: 1.85rem; line-height: 1.15; margin: 2.2em 0 0.6em; scroll-margin-top: 20px; }
.prose p, .prose ol, .prose ul { margin: 0 0 1.1em; }
.prose li { margin-bottom: 0.3em; }
.prose code { font-family: var(--font-mono); font-size: 0.92em; background: var(--field-alt); box-shadow: var(--status); padding: 1px 5px; }
.art-head { padding: 28px 28px 8px; max-width: 70ch; margin: 0 auto; }
.art-head h1 { font-family: var(--font-pixel); font-size: clamp(2.2rem, 4.2vw, 3.3rem); line-height: 1.05; margin: 8px 0 14px; }
.art-meta { font-family: var(--font-dos); font-size: 1.25rem; color: var(--ink-dim); text-transform: uppercase; letter-spacing: 0.04em; }
.art-hero { margin: 0 auto; max-width: 900px; }
.art-hero img { width: 100%; height: auto; }

/* callouts as message boxes */
.callout { margin: 1.6em 0; background: var(--face); box-shadow: var(--window); padding: 3px; }
.callout .ct { background: linear-gradient(90deg, var(--title-a), var(--title-b)); color: #fff; font-family: var(--font-pixel); font-size: 0.95rem; padding: 4px 8px; }
.callout .cb { display: grid; grid-template-columns: 36px 1fr; gap: 14px; padding: 14px 16px 12px; font-size: 1.0625rem; line-height: 1.6; }
.callout .cb .ico { width: 34px; height: 34px; }
.callout .cb p { margin: 0 0 0.5em; }
.callout.q .cb { background: var(--tip); color: var(--tip-ink); margin: 2px; box-shadow: var(--status); }
.callout.q .cb a { color: inherit; }

/* code as MS-DOS Prompt */
.dos { margin: 1.6em -40px; background: var(--face); box-shadow: var(--window); padding: 3px; }
.dos .ct { display: flex; align-items: center; gap: 8px; background: linear-gradient(90deg, var(--title-a), var(--title-b)); color: #fff; padding: 3px 4px 3px 8px; font-family: var(--font-pixel); font-size: 0.95rem; }
.dos .ct span { flex: 1; }
.dos .copy { min-height: 30px; padding: 3px 12px; font-size: 0.875rem; font-family: var(--font-body); }
.dos .copy:active { padding: 4px 11px 2px 13px; }
.dos pre { margin: 2px; background: #000; color: #d0d0d0; padding: 16px 18px; overflow-x: auto; font-family: var(--font-mono); font-size: 0.9375rem; line-height: 1.6; box-shadow: var(--sunken); tab-size: 2; }
.dos pre:focus-visible { outline: 2px dotted #fff; outline-offset: -4px; }
.tok-k { color: #7fd1ff; } .tok-s { color: #ffe08a; } .tok-c { color: #8e9aa8; } .tok-t { color: #b9f2a6; }

/* ---------- Pattern stat strip (live demo) ---------- */
.hss-strip { display: grid; gap: 1px; background: var(--shadow); box-shadow: var(--status); padding: 1px; grid-template-columns: 1fr; }
@media (min-width: 21rem) { .hss-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 42rem) { .hss-strip { grid-template-columns: repeat(4, minmax(0, 1fr)); } .hss-strip.five { grid-template-columns: repeat(5, minmax(0, 1fr)); } }
.hss-tile { background: var(--field); padding: 12px 14px; min-width: 0; border: 0; text-align: left; color: var(--ink); }
.hss-tile .l { display: block; font-family: var(--font-mono); font-size: 0.8125rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--ink-dim); }
.hss-tile .n { display: block; font-size: 1.6rem; font-weight: 700; font-variant-numeric: tabular-nums; line-height: 1.2; }
.hss-tile .s { display: block; font-size: 0.875rem; color: var(--ink-dim); overflow-wrap: anywhere; }
button.hss-tile { cursor: pointer; }
button.hss-tile[aria-pressed="true"] { background: color-mix(in srgb, var(--select) 18%, var(--field)); box-shadow: inset 0 -3px 0 var(--select); }
button.hss-tile:focus-visible { outline: 2px dotted var(--ink); outline-offset: -4px; }
.hss-list { list-style: none; padding: 0; margin: 10px 0 0; box-shadow: var(--sunken); background: var(--field); padding: 2px; }
.hss-list li { display: flex; justify-content: space-between; gap: 12px; padding: 8px 12px; border-bottom: 1px dotted var(--shadow); }
.hss-list li[hidden] { display: none; }

.pane-code { margin: 0; background: #000; color: #d0d0d0; padding: 16px; font-family: var(--font-mono); font-size: 0.9375rem; line-height: 1.6; overflow-x: auto; box-shadow: var(--sunken); white-space: pre; }
.pane-prose { max-width: 72ch; font-size: 1.0625rem; line-height: 1.7; }

/* pattern cards */
.pat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 22px; }
.pat-card { display: flex; flex-direction: column; }
.pat-card .win-body { display: flex; flex-direction: column; gap: 8px; flex: 1; }
.pat-card h3 { margin: 0; font-size: 1.125rem; line-height: 1.3; }
.pat-card p { font-size: 0.9375rem; color: var(--ink-dim); margin: 0; }
.pat-preview { height: 120px; background: var(--field); box-shadow: var(--sunken); display: grid; place-items: center; overflow: hidden; }
.pat-meta { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; font-family: var(--font-mono); font-size: 0.8125rem; color: var(--ink-dim); }
.pat-empty { display: none; }
.pat-empty.show { display: block; }

/* misc lists */
.row-list { list-style: none; margin: 0; padding: 0; }
.row-list li { padding: 10px 0; border-bottom: 1px dotted var(--shadow); }
.row-list li:last-child { border-bottom: 0; }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; margin: 0; }
.kv dt { color: var(--ink-dim); }
.kv dd { margin: 0; }
.two-col { columns: 2; column-gap: 28px; }
.fig-caption { font-size: 0.875rem; color: var(--ink-dim); margin-top: 6px; }

/* ---------- Responsive ---------- */
@media (max-width: 1100px) {
  .desktop.has-rail { grid-template-columns: 1fr; }
  .shortcuts { grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: 2px; }
  .shortcut .ico-48 { width: 36px; height: 36px; }
  .span-8, .span-7, .span-6, .span-5, .span-4, .span-9, .span-3 { grid-column: span 12; }
  .span-6.keep-md, .span-4.keep-md, .span-3.keep-md { grid-column: span 6; }
  .article-layout { grid-template-columns: 1fr; }
  .help-toc { display: none; }
  .toc-mobile { display: block; }
  .dos { margin-inline: 0; }
  .foot-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 860px) {
  .hero-stage { min-height: 0; display: grid; gap: 20px; }
  .hero-photo, .hero-welcome { position: static; width: auto; }
  .hero-photo img { height: 320px; }
  .explorer { grid-template-columns: 1fr; }
  .explorer > .pane-left { position: static; }
  .tasks li:not(.cur) { display: none; }
  .read-progress { display: none; }
}
@media (max-width: 640px) {
  body { font-size: 1rem; }
  .desktop { padding: 16px 16px 96px; }
  .grid-12, .stack { gap: 20px; }
  .span-6.keep-md, .span-4.keep-md, .span-3.keep-md { grid-column: span 12; }
  .welcome-grid { grid-template-columns: 1fr; }
  .welcome-side { writing-mode: horizontal-tb; transform: none; padding: 8px 12px; font-size: 1.3rem; justify-content: flex-start; }
  .welcome-side small { margin: 0 0 0 10px; }
  .stats b { font-size: 1.35rem; }
  .win-body { padding: 12px 8px 10px; }
  .field { padding: 12px; }
  .prose { padding: 12px 6px 28px; font-size: 1.0625rem; }
  .doc-page { padding: 3px; }
  .art-hero { padding: 0 4px !important; }
  .dos { margin-inline: -4px; }
  .dos pre { padding: 12px; font-size: 0.875rem; }
  .art-head { padding: 18px 10px 4px; }
  .foot-grid { grid-template-columns: 1fr; }
  .details thead { display: none; }
  .details, .details tbody, .details tr, .details td { display: block; }
  .details tr { border-bottom: 1px dotted var(--shadow); padding: 6px 0; }
  .details td { border: 0; padding: 3px 8px; }
  .details td.date, .details td.type { display: inline-block; }
  .two-col { columns: 1; }
  .clock { display: none; }
  .tasks a { max-width: 150px; }
  .thumbs { grid-template-columns: 1fr; }
  .pat-grid { grid-template-columns: 1fr; }
  .toolbar .address { min-width: 0; }
  .toolbar .address > span { display: none; }
}

@media (prefers-reduced-motion: no-preference) {
  .btn, .tab, .tasks a { transition: box-shadow 80ms linear; }
  .win.is-opening { animation: open 160ms steps(4) both; }
  @keyframes open { from { transform: scale(0.96); opacity: 0.4; } }
}
@media (prefers-reduced-motion: reduce) {
  * { scroll-behavior: auto !important; animation: none !important; transition: none !important; }
}

/* expandable tree nodes: Win95 plus/minus boxes */
.tree summary { list-style: none; }
.tree summary::-webkit-details-marker { display: none; }
.tree summary::before {
  content: "+"; flex: none; width: 15px; height: 15px; display: grid; place-items: center;
  font: 700 13px/1 var(--font-mono); background: var(--field); color: var(--ink); border: 1px solid var(--shadow);
}
.tree details[open] > summary::before { content: "\2212"; }
.tree summary:focus-visible { outline: 1px dotted var(--ink); outline-offset: -2px; }
.toc-mobile > summary::-webkit-details-marker { display: none; }
.dos pre code { background: none; box-shadow: none; padding: 0; font-size: inherit; color: inherit; }

/* UI pattern library article */
.prose .prose-fig { margin: 1.6em 0; padding: 0; }
.prose .prose-fig img { width: 100%; height: auto; display: block; }
.prose .callout .cb p + p { margin-top: .7em; }
.prose .live-pattern a.btn { white-space: normal; text-decoration: none; height: auto; }
.prose p code { overflow-wrap: anywhere; }
