/* AntJanus.app — a macOS-native reading of antjanus.com.
   Desktop wallpaper, menu bar, one window: edge-to-edge source-list sidebar,
   unified toolbar over a scrolling content layer, inspectors, grouped lists. */

/* ---------- Primitives ---------- */
:root {
  --slate-900: #1f2f42;
  --slate-800: #2a3f54;
  --slate-700: #364f6a;
  --slate-600: #34587f;
  --slate-500: #4a6d8c;
  --slate-300: #86b1e0;
  --gray-0: #ffffff;
  --gray-50: #f6f7f9;
  --gray-100: #eceff3;
  --gray-150: #e3e7ec;
  --gray-600: #5b5f66;
  --gray-700: #4a4e55;
  --gray-900: #1d1d1f;
  --ink-dark-0: #ececee;
  --ink-dark-1: #a9adb5;
  --night-900: #161719;
  --night-850: #1e1f22;
  --night-800: #26282c;
  --night-750: #2c2e33;
  --night-700: #34373d;

  --tag-red: #d6453d;
  --tag-orange: #e0822c;
  --tag-yellow: #d9b01c;
  --tag-green: #3fa35b;
  --tag-blue: #3478f6;
  --tag-purple: #9a55d6;
  --tag-gray: #8e8e93;

  --font-ui: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Inter", "Helvetica Neue", Arial, sans-serif;
  --font-display: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Inter", "Helvetica Neue", Arial, sans-serif;
  --font-read: "New York", ui-serif, "Source Serif 4", Georgia, serif;
  --font-mono: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, Consolas, monospace;

  --fs-caption: 0.8125rem;   /* 13px */
  --fs-ui: 0.9375rem;        /* 15px */
  --fs-body: 1.0625rem;      /* 17px */
  --fs-read: 1.1875rem;      /* 19px */
  --fs-lede: 1.25rem;
  --fs-h3: 1.25rem;
  --fs-h2: 1.625rem;
  --fs-h1: 2.125rem;

  --r-window: 14px;
  --r-card: 12px;
  --r-control: 8px;
  --menubar-h: 30px;
  --toolbar-h: 56px;
  --sidebar-w: 264px;
  --ease: cubic-bezier(.2, .8, .2, 1);
}

/* ---------- Semantic tokens: light ---------- */
:root {
  color-scheme: light;
  --wallpaper-a: #9db7d2;
  --wallpaper-b: #364f6a;
  --wallpaper-c: #1f2f42;
  --wallpaper-d: #d9c7a8;
  --menubar-bg: rgba(246, 247, 249, 0.72);
  --menubar-ink: #1d1d1f;
  --window-bg: #ffffff;
  --window-edge: rgba(0, 0, 0, 0.22);
  --window-shadow: 0 30px 80px rgba(10, 20, 35, 0.38), 0 0 0 0.5px rgba(0, 0, 0, 0.25);
  --sidebar-bg: rgba(232, 236, 241, 0.82);
  --sidebar-solid: #e8ecf1;
  --toolbar-bg: rgba(255, 255, 255, 0.78);
  --toolbar-solid: #fbfbfc;
  --surface: #ffffff;
  --surface-2: #f5f6f8;
  --surface-3: #eceff3;
  --group-bg: #f5f6f8;
  --text: #1d1d1f;
  --text-2: #50555d;
  --text-3: #5f6570;
  --separator: rgba(0, 0, 0, 0.11);
  --separator-strong: rgba(0, 0, 0, 0.18);
  --control-bg: rgba(0, 0, 0, 0.055);
  --control-bg-hover: rgba(0, 0, 0, 0.09);
  --control-bg-press: rgba(0, 0, 0, 0.14);
  --field-bg: rgba(0, 0, 0, 0.05);
  --hover: rgba(0, 0, 0, 0.05);
  --selection-inactive: rgba(0, 0, 0, 0.08);
  --code-bg: #fbfbfc;
  --code-head: #f1f3f5;
  --code-ink: #262626;
  --tok-keyword: #9b2393;
  --tok-string: #c41a16;
  --tok-number: #1c00cf;
  --tok-comment: #5d6c79;
  --tok-type: #0b4f79;
  --tok-func: #326d74;
  --tok-tag: #3900a0;
  --bubble-in: #e9e9eb;
  --bubble-in-ink: #1d1d1f;
  --callout-why: #fff7e0;
  --callout-why-edge: #d9b01c;
  --ok: #1c6e52;
  --warn: #7e610f;
  --bad: #a03227;
  --scrim: rgba(0, 0, 0, 0.32);

  --accent-fill: #34587f;
  --accent-text: #2e5680;
  --accent-soft: rgba(52, 88, 127, 0.12);
  --on-accent: #ffffff;
}

/* Accent picker: System Settings > Appearance > Accent color */
:root[data-accent="blue"] { --accent-fill: #0a64d6; --accent-text: #0a5cc2; --accent-soft: rgba(10, 100, 214, 0.12); }
:root[data-accent="purple"] { --accent-fill: #7a3fc2; --accent-text: #7236b8; --accent-soft: rgba(122, 63, 194, 0.12); }
:root[data-accent="graphite"] { --accent-fill: #5b5f66; --accent-text: #4a4e55; --accent-soft: rgba(91, 95, 102, 0.14); }
:root[data-accent="green"] { --accent-fill: #1f7a4d; --accent-text: #1b6e45; --accent-soft: rgba(31, 122, 77, 0.12); }

/* ---------- Semantic tokens: dark ---------- */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --wallpaper-a: #2a3f54;
    --wallpaper-b: #16212e;
    --wallpaper-c: #0b1119;
    --wallpaper-d: #4a3b2a;
    --menubar-bg: rgba(22, 23, 25, 0.62);
    --menubar-ink: #ececee;
    --window-bg: #1e1f22;
    --window-edge: rgba(255, 255, 255, 0.14);
    --window-shadow: 0 30px 80px rgba(0, 0, 0, 0.6), 0 0 0 0.5px rgba(255, 255, 255, 0.16);
    --sidebar-bg: rgba(38, 40, 44, 0.84);
    --sidebar-solid: #26282c;
    --toolbar-bg: rgba(30, 31, 34, 0.8);
    --toolbar-solid: #232427;
    --surface: #1e1f22;
    --surface-2: #26282c;
    --surface-3: #2c2e33;
    --group-bg: #26282c;
    --text: #ececee;
    --text-2: #b3b7bf;
    --text-3: #a3a8b1;
    --separator: rgba(255, 255, 255, 0.1);
    --separator-strong: rgba(255, 255, 255, 0.18);
    --control-bg: rgba(255, 255, 255, 0.09);
    --control-bg-hover: rgba(255, 255, 255, 0.14);
    --control-bg-press: rgba(255, 255, 255, 0.2);
    --field-bg: rgba(255, 255, 255, 0.08);
    --hover: rgba(255, 255, 255, 0.06);
    --selection-inactive: rgba(255, 255, 255, 0.1);
    --code-bg: #1a1b1e;
    --code-head: #26282c;
    --code-ink: #e6e6e6;
    --tok-keyword: #ff7ab2;
    --tok-string: #ff8170;
    --tok-number: #d9c97c;
    --tok-comment: #8a99a6;
    --tok-type: #6bdfff;
    --tok-func: #67b7a4;
    --tok-tag: #dabaff;
    --bubble-in: #3a3b3f;
    --bubble-in-ink: #ececee;
    --callout-why: #332b14;
    --callout-why-edge: #d9b01c;
    --ok: #4fbe93;
    --warn: #ddb44a;
    --bad: #ee8579;
    --scrim: rgba(0, 0, 0, 0.55);
    --accent-fill: #3a6391;
    --accent-text: #8db6e3;
    --accent-soft: rgba(134, 177, 224, 0.16);
  }
  :root:not([data-theme="light"])[data-accent="blue"] { --accent-fill: #2f6fd0; --accent-text: #6aa8ff; --accent-soft: rgba(106, 168, 255, 0.16); }
  :root:not([data-theme="light"])[data-accent="purple"] { --accent-fill: #7d4fc9; --accent-text: #c9a4ff; --accent-soft: rgba(201, 164, 255, 0.16); }
  :root:not([data-theme="light"])[data-accent="graphite"] { --accent-fill: #5d6168; --accent-text: #c9ccd2; --accent-soft: rgba(201, 204, 210, 0.14); }
  :root:not([data-theme="light"])[data-accent="green"] { --accent-fill: #2a7d53; --accent-text: #74d6a1; --accent-soft: rgba(116, 214, 161, 0.14); }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --wallpaper-a: #2a3f54;
  --wallpaper-b: #16212e;
  --wallpaper-c: #0b1119;
  --wallpaper-d: #4a3b2a;
  --menubar-bg: rgba(22, 23, 25, 0.62);
  --menubar-ink: #ececee;
  --window-bg: #1e1f22;
  --window-edge: rgba(255, 255, 255, 0.14);
  --window-shadow: 0 30px 80px rgba(0, 0, 0, 0.6), 0 0 0 0.5px rgba(255, 255, 255, 0.16);
  --sidebar-bg: rgba(38, 40, 44, 0.84);
  --sidebar-solid: #26282c;
  --toolbar-bg: rgba(30, 31, 34, 0.8);
  --toolbar-solid: #232427;
  --surface: #1e1f22;
  --surface-2: #26282c;
  --surface-3: #2c2e33;
  --group-bg: #26282c;
  --text: #ececee;
  --text-2: #b3b7bf;
  --text-3: #a3a8b1;
  --separator: rgba(255, 255, 255, 0.1);
  --separator-strong: rgba(255, 255, 255, 0.18);
  --control-bg: rgba(255, 255, 255, 0.09);
  --control-bg-hover: rgba(255, 255, 255, 0.14);
  --control-bg-press: rgba(255, 255, 255, 0.2);
  --field-bg: rgba(255, 255, 255, 0.08);
  --hover: rgba(255, 255, 255, 0.06);
  --selection-inactive: rgba(255, 255, 255, 0.1);
  --code-bg: #1a1b1e;
  --code-head: #26282c;
  --code-ink: #e6e6e6;
  --tok-keyword: #ff7ab2;
  --tok-string: #ff8170;
  --tok-number: #d9c97c;
  --tok-comment: #8a99a6;
  --tok-type: #6bdfff;
  --tok-func: #67b7a4;
  --tok-tag: #dabaff;
  --bubble-in: #3a3b3f;
  --bubble-in-ink: #ececee;
  --callout-why: #332b14;
  --callout-why-edge: #d9b01c;
  --ok: #4fbe93;
  --warn: #ddb44a;
  --bad: #ee8579;
  --scrim: rgba(0, 0, 0, 0.55);
  --accent-fill: #3a6391;
  --accent-text: #8db6e3;
  --accent-soft: rgba(134, 177, 224, 0.16);
}
:root[data-theme="dark"][data-accent="blue"] { --accent-fill: #2f6fd0; --accent-text: #6aa8ff; --accent-soft: rgba(106, 168, 255, 0.16); }
:root[data-theme="dark"][data-accent="purple"] { --accent-fill: #7d4fc9; --accent-text: #c9a4ff; --accent-soft: rgba(201, 164, 255, 0.16); }
:root[data-theme="dark"][data-accent="graphite"] { --accent-fill: #5d6168; --accent-text: #c9ccd2; --accent-soft: rgba(201, 204, 210, 0.14); }
:root[data-theme="dark"][data-accent="green"] { --accent-fill: #2a7d53; --accent-text: #74d6a1; --accent-soft: rgba(116, 214, 161, 0.14); }

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: calc(var(--menubar-h) + var(--toolbar-h) + 16px); }
body {
  margin: 0;
  font-family: var(--font-ui);
  font-size: var(--fs-body);
  line-height: 1.5;
  color: var(--text);
  background: var(--window-bg);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
img { max-width: 100%; display: block; }
a { color: var(--accent-text); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
h1, h2, h3, h4 { font-family: var(--font-display); color: var(--text); margin: 0; letter-spacing: -0.01em; }
p { margin: 0 0 1em; }
button { font: inherit; color: inherit; }
code, kbd, pre { font-family: var(--font-mono); }
.icon { width: 1.25em; height: 1.25em; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.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: fixed; left: 12px; top: -60px; z-index: 100; background: var(--accent-fill); color: var(--on-accent); padding: 10px 16px; border-radius: var(--r-control); font-weight: 600; }
.skip:focus { top: 12px; }
:focus-visible { outline: 3px solid var(--accent-fill); outline-offset: 3px; border-radius: 6px; }
.muted { color: var(--text-2); }
.mono { font-family: var(--font-mono); }
.num { font-variant-numeric: tabular-nums; }

/* ---------- Desktop + menu bar ---------- */
.desktop { min-height: 100vh; }
.menubar { display: none; }

@media (min-width: 1100px) {
  body {
    background-color: var(--wallpaper-c);
    background-image:
      url("assets/wallpaper-light.jpg"),
      radial-gradient(120% 90% at 8% 0%, var(--wallpaper-a) 0%, transparent 55%),
      radial-gradient(90% 80% at 100% 20%, var(--wallpaper-d) 0%, transparent 50%),
      radial-gradient(140% 120% at 60% 120%, var(--wallpaper-b) 0%, var(--wallpaper-c) 70%);
    background-size: cover;
    background-attachment: fixed;
  }
  :root[data-theme="dark"] body {
    background-image:
      url("assets/wallpaper-dark.jpg"),
      radial-gradient(120% 90% at 8% 0%, var(--wallpaper-a) 0%, transparent 55%),
      radial-gradient(90% 80% at 100% 20%, var(--wallpaper-d) 0%, transparent 50%),
      radial-gradient(140% 120% at 60% 120%, var(--wallpaper-b) 0%, var(--wallpaper-c) 70%);
  }
  .menubar {
    display: flex; align-items: center; gap: 4px;
    position: sticky; top: 0; z-index: 50;
    height: var(--menubar-h); padding: 0 12px;
    background: var(--menubar-bg);
    -webkit-backdrop-filter: blur(24px) saturate(180%);
    backdrop-filter: blur(24px) saturate(180%);
    color: var(--menubar-ink);
    font-size: var(--fs-caption);
  }
  .desktop-zoomed .window { margin: 0; max-width: none; border-radius: 0; }
}
.menubar .mb-logo { display: inline-flex; align-items: center; padding: 0 8px; }
.menubar .mb-logo svg { width: 18px; height: 18px; }
.mb-item { position: relative; }
.mb-btn {
  background: none; border: 0; border-radius: 5px; padding: 3px 9px;
  font-size: var(--fs-caption); color: inherit; cursor: default; line-height: 20px;
}
.mb-btn.app { font-weight: 700; }
.mb-btn:hover, .mb-btn[aria-expanded="true"] { background: var(--control-bg-hover); }
.mb-menu {
  position: absolute; top: calc(100% + 3px); left: 0; min-width: 250px; z-index: 60;
  padding: 5px; margin: 0; list-style: none;
  background: var(--toolbar-bg); color: var(--text);
  -webkit-backdrop-filter: blur(30px) saturate(180%); backdrop-filter: blur(30px) saturate(180%);
  border-radius: 10px; box-shadow: 0 12px 40px rgba(0, 0, 0, 0.28), 0 0 0 0.5px var(--separator-strong);
}
.mb-menu[hidden] { display: none; }
.mb-menu a, .mb-menu button {
  display: flex; justify-content: space-between; gap: 24px; width: 100%;
  padding: 5px 10px; border-radius: 6px; border: 0; background: none;
  font-size: var(--fs-ui); color: var(--text); text-align: left; cursor: default;
}
.mb-menu a:hover, .mb-menu button:hover, .mb-menu a:focus-visible, .mb-menu button:focus-visible {
  background: var(--accent-fill); color: var(--on-accent); text-decoration: none; outline: none;
}
.mb-menu kbd { font-family: var(--font-ui); color: inherit; opacity: 0.75; }
.mb-menu hr { border: 0; border-top: 1px solid var(--separator); margin: 5px 8px; }
.mb-right { margin-left: auto; display: flex; align-items: center; gap: 14px; padding-right: 6px; font-variant-numeric: tabular-nums; }
.mb-right .icon { width: 16px; height: 16px; }

/* ---------- Window ---------- */
.window {
  position: relative;
  display: grid;
  grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
  background: var(--window-bg);
  min-height: 100vh;
  overflow: clip;
}
@media (min-width: 1100px) {
  .window {
    margin: 16px auto 48px;
    max-width: 1480px;
    width: calc(100% - 48px);
    min-height: calc(100vh - var(--menubar-h) - 32px);
    border-radius: var(--r-window);
    box-shadow: var(--window-shadow);
  }
}
.sidebar-collapsed .window { grid-template-columns: 0 minmax(0, 1fr); }
.sidebar-collapsed .sidebar { visibility: hidden; }

/* ---------- Sidebar (source list) ---------- */
.sidebar {
  position: sticky; top: 0; align-self: start;
  height: 100vh; overflow-y: auto; overscroll-behavior: contain;
  background: var(--sidebar-bg);
  -webkit-backdrop-filter: blur(40px) saturate(170%); backdrop-filter: blur(40px) saturate(170%);
  border-right: 1px solid var(--separator);
  padding: 0 10px 20px;
  font-size: var(--fs-ui);
  scrollbar-width: thin;
}
@media (min-width: 1100px) {
  .sidebar { top: var(--menubar-h); height: calc(100vh - var(--menubar-h)); }
}
.sidebar-head { display: flex; align-items: center; gap: 8px; height: var(--toolbar-h); padding: 0 6px; }
.traffic { display: flex; gap: 8px; }
.traffic span, .traffic button {
  width: 13px; height: 13px; border-radius: 50%; border: 0; padding: 0;
  box-shadow: inset 0 0 0 0.5px rgba(0, 0, 0, 0.2); position: relative;
}
.traffic .t-close { background: #ff5f57; }
.traffic .t-min { background: #febc2e; }
.traffic .t-zoom { background: #28c840; cursor: pointer; }
.traffic .t-zoom::after {
  content: ""; position: absolute; inset: 3px; opacity: 0;
  background: linear-gradient(135deg, #0a5a14 0 40%, transparent 40% 60%, #0a5a14 60%);
  clip-path: polygon(0 0, 70% 0, 0 70%, 30% 100%, 100% 100%, 100% 30%);
}
.traffic:hover .t-zoom::after { opacity: 0.8; }
.traffic .t-zoom:focus-visible { outline-offset: 2px; border-radius: 50%; }
.sidebar .brand { display: flex; align-items: center; gap: 10px; margin: 4px 6px 14px; color: var(--text); }
.sidebar .brand:hover { text-decoration: none; }
.app-icon {
  width: 38px; height: 38px; border-radius: 9px; flex: none;
  background: linear-gradient(160deg, #5b7ea3, #364f6a 55%, #1f2f42);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.3), inset 0 0.5px 0 rgba(255, 255, 255, 0.4);
  display: grid; place-items: center;
}
.app-icon svg { width: 70%; height: 70%; }
.brand-text strong { display: block; font-size: 1rem; line-height: 1.2; }
.brand-text span { display: block; font-size: var(--fs-caption); color: var(--text-2); }
.sb-search { display: none; }
.sb-section { margin: 0 0 14px; }
.sb-title {
  display: flex; align-items: center; justify-content: space-between;
  font-size: var(--fs-caption); font-weight: 700; color: var(--text-3);
  padding: 4px 8px; margin: 0;
}
.sb-list { list-style: none; margin: 0; padding: 0; }
.sb-link {
  display: flex; align-items: center; gap: 10px;
  min-height: 34px; padding: 5px 8px; border-radius: 7px;
  color: var(--text); line-height: 1.25;
}
.sb-link:hover { background: var(--hover); text-decoration: none; }
.sb-link .icon { color: var(--accent-text); width: 19px; height: 19px; }
.sb-link .badge { margin-left: auto; font-size: var(--fs-caption); color: var(--text-2); font-variant-numeric: tabular-nums; }
.sb-link[aria-current="page"] { background: var(--accent-fill); color: var(--on-accent); font-weight: 600; }
.sb-link[aria-current="page"] .icon, .sb-link[aria-current="page"] .badge { color: var(--on-accent); }
.sb-link .ext { margin-left: auto; width: 14px; height: 14px; color: var(--text-3); }
.tag-dot { width: 11px; height: 11px; border-radius: 50%; flex: none; margin: 0 4px; box-shadow: inset 0 0 0 0.5px rgba(0, 0, 0, 0.2); }
.sb-foot { border-top: 1px solid var(--separator); margin-top: 8px; padding: 12px 8px 0; }
.sb-foot p { font-size: var(--fs-caption); color: var(--text-2); margin: 0 0 8px; }
.accent-picker { display: flex; gap: 10px; flex-wrap: wrap; }
.accent-swatch {
  width: 24px; height: 24px; border-radius: 50%; border: 0; cursor: pointer; padding: 0;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.18); position: relative;
}
.accent-swatch[aria-pressed="true"]::after {
  content: ""; position: absolute; inset: 8px; border-radius: 50%; background: #fff;
}
.accent-swatch:focus-visible { border-radius: 50%; }

/* ---------- Main column + toolbar ---------- */
.main-col { min-width: 0; display: flex; flex-direction: column; }
.toolbar {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; gap: 6px;
  height: var(--toolbar-h); padding: 0 14px;
  background: var(--toolbar-bg);
  -webkit-backdrop-filter: blur(30px) saturate(180%); backdrop-filter: blur(30px) saturate(180%);
  border-bottom: 1px solid var(--separator);
}
@media (min-width: 1100px) { .toolbar { top: var(--menubar-h); } }
.tb-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-width: 36px; height: 34px; padding: 0 8px;
  border: 0; border-radius: var(--r-control); background: transparent; color: var(--text-2);
  cursor: pointer; transition: background 150ms var(--ease);
  font-size: var(--fs-ui);
}
.tb-btn:hover { background: var(--control-bg); color: var(--text); text-decoration: none; }
.tb-btn:active { background: var(--control-bg-press); }
.tb-btn[aria-pressed="true"] { background: var(--control-bg-hover); color: var(--text); }
.tb-btn .icon { width: 20px; height: 20px; }
.tb-group { display: inline-flex; background: var(--control-bg); border-radius: var(--r-control); }
.tb-group .tb-btn { background: none; }
.tb-group .tb-btn:hover { background: var(--control-bg); }
.tb-title { min-width: 0; margin: 0 8px 0 6px; }
.tb-title h1, .tb-title .t { font-size: 1rem; font-weight: 700; line-height: 1.2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; letter-spacing: 0; }
.tb-title .sub { display: block; font-size: var(--fs-caption); color: var(--text-2); line-height: 1.2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tb-spacer { flex: 1; }
.tb-search { position: relative; display: flex; align-items: center; }
.tb-search .icon { position: absolute; left: 9px; width: 16px; height: 16px; color: var(--text-2); pointer-events: none; }
.field {
  font: inherit; font-size: var(--fs-ui); color: var(--text);
  background: var(--field-bg); border: 1px solid transparent; border-radius: var(--r-control);
  height: 34px; padding: 0 10px;
}
.field::placeholder { color: var(--text-2); opacity: 1; }
.field:focus { outline: none; border-color: var(--accent-fill); box-shadow: 0 0 0 3px var(--accent-soft); background: var(--surface); }
.tb-search .field { width: 220px; padding-left: 32px; }
.progress { position: absolute; left: 0; bottom: -1px; height: 2px; width: 0; background: var(--accent-fill); }

/* ---------- Content ---------- */
main { flex: 1; min-width: 0; }
.content { padding: 32px 40px 48px; max-width: 1180px; }
.content.wide { max-width: none; }
.page-head { margin: 4px 0 26px; }
.page-head .eyebrow { font-size: var(--fs-caption); font-weight: 600; color: var(--text-2); text-transform: uppercase; letter-spacing: 0.06em; margin-bottom: 6px; }
.page-head h1, .large-title { font-size: var(--fs-h1); font-weight: 700; line-height: 1.15; letter-spacing: -0.02em; }
.page-head p { font-size: var(--fs-lede); color: var(--text-2); margin: 10px 0 0; max-width: 64ch; line-height: 1.45; }
.section { margin: 44px 0 0; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; margin-bottom: 14px; border-bottom: 1px solid var(--separator); padding-bottom: 10px; }
.section-head h2 { font-size: 1.5rem; font-weight: 700; letter-spacing: -0.015em; }
.section-head .sub { display: block; font-size: var(--fs-ui); color: var(--text-2); font-weight: 400; margin-top: 2px; letter-spacing: 0; }
.see-all { font-size: var(--fs-ui); white-space: nowrap; font-weight: 500; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 0 18px; border-radius: 10px;
  font-size: var(--fs-ui); font-weight: 600; cursor: pointer;
  border: 1px solid var(--separator-strong); background: var(--surface); color: var(--text);
  box-shadow: 0 1px 1px rgba(0, 0, 0, 0.06);
  transition: background 150ms var(--ease), transform 150ms var(--ease);
}
.btn:hover { background: var(--surface-2); text-decoration: none; }
.btn:active { transform: translateY(1px); background: var(--surface-3); }
.btn-primary { background: var(--accent-fill); color: var(--on-accent); border-color: transparent; box-shadow: 0 1px 2px rgba(0, 0, 0, 0.18), inset 0 0.5px 0 rgba(255, 255, 255, 0.25); }
.btn-primary:hover { background: var(--accent-fill); filter: brightness(1.08); }
.btn-plain { border-color: transparent; background: none; box-shadow: none; color: var(--accent-text); padding: 0 8px; }
.btn-plain:hover { background: var(--accent-soft); }
.btn-sm { min-height: 34px; padding: 0 12px; font-size: var(--fs-ui); border-radius: var(--r-control); }
.pill-btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 72px; min-height: 34px; padding: 0 16px; border-radius: 999px;
  background: var(--control-bg); color: var(--accent-text); font-weight: 700; font-size: var(--fs-ui);
  text-transform: uppercase; letter-spacing: 0.02em;
}
.pill-btn:hover { background: var(--control-bg-hover); text-decoration: none; }

/* Segmented control */
.segmented { display: inline-flex; padding: 2px; gap: 2px; background: var(--control-bg); border-radius: 9px; flex-wrap: wrap; }
.segmented button, .segmented a {
  border: 0; background: none; border-radius: 7px; padding: 6px 14px; min-height: 34px;
  font-size: var(--fs-ui); font-weight: 500; color: var(--text); cursor: pointer; white-space: nowrap;
  display: inline-flex; align-items: center; gap: 6px;
}
.segmented button:hover, .segmented a:hover { background: var(--hover); text-decoration: none; }
.segmented [aria-pressed="true"], .segmented [aria-selected="true"] {
  background: var(--surface); box-shadow: 0 1px 3px rgba(0, 0, 0, 0.14), 0 0 0 0.5px rgba(0, 0, 0, 0.06); font-weight: 600;
}
:root[data-theme="dark"] .segmented [aria-pressed="true"], :root[data-theme="dark"] .segmented [aria-selected="true"] { background: #55585f; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .segmented [aria-pressed="true"], :root:not([data-theme="light"]) .segmented [aria-selected="true"] { background: #55585f; }
}
.scope-bar {
  display: flex; flex-wrap: wrap; align-items: center; gap: 12px;
  padding: 10px 0 14px; margin-bottom: 18px; border-bottom: 1px solid var(--separator);
}
.scope-bar .count { font-size: var(--fs-ui); color: var(--text-2); }
.select {
  appearance: none; -webkit-appearance: none;
  font: inherit; font-size: var(--fs-ui); color: var(--text);
  height: 34px; padding: 0 30px 0 10px; border-radius: var(--r-control);
  border: 1px solid var(--separator-strong); background: var(--surface);
  background-image: linear-gradient(45deg, transparent 50%, currentColor 50%), linear-gradient(135deg, currentColor 50%, transparent 50%);
  background-position: calc(100% - 15px) 15px, calc(100% - 10px) 15px;
  background-size: 5px 5px; background-repeat: no-repeat;
}

/* Grouped inset lists (System Settings) */
.group { background: var(--group-bg); border-radius: var(--r-card); overflow: hidden; border: 1px solid var(--separator); }
.group + .group { margin-top: 16px; }
.group-title { font-size: var(--fs-ui); font-weight: 600; color: var(--text-2); margin: 0 0 8px 4px; }
.row {
  display: flex; align-items: center; gap: 14px; padding: 12px 16px; min-height: 52px;
  color: var(--text); position: relative;
}
.row + .row::before { content: ""; position: absolute; top: 0; right: 0; left: 58px; border-top: 1px solid var(--separator); }
.row.plain + .row.plain::before { left: 16px; }
a.row:hover { background: var(--hover); text-decoration: none; }
.row .r-main { min-width: 0; flex: 1; }
.row .r-title { display: block; font-weight: 600; font-size: var(--fs-body); line-height: 1.3; }
.row .r-sub { display: block; font-size: var(--fs-ui); color: var(--text-2); line-height: 1.4; margin-top: 2px; }
.row .r-meta { font-size: var(--fs-ui); color: var(--text-2); white-space: nowrap; font-variant-numeric: tabular-nums; }
.row .chev { color: var(--text-3); width: 16px; height: 16px; }
.sym {
  width: 30px; height: 30px; border-radius: 7px; display: grid; place-items: center; flex: none;
  color: #fff; background: var(--accent-fill);
}
.sym .icon { width: 18px; height: 18px; }
.sym.c-red { background: var(--tag-red); } .sym.c-orange { background: #c8691c; } .sym.c-green { background: #2f8a4a; }
.sym.c-blue { background: #2a6fdb; } .sym.c-purple { background: #8a47c7; } .sym.c-gray { background: #6e6e73; }
.sym.c-slate { background: var(--slate-700); }

/* Finder tag chips */
.tags { display: flex; flex-wrap: wrap; gap: 8px; padding: 0; margin: 0; list-style: none; }
.tag {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 11px 4px 8px; border-radius: 999px; min-height: 30px;
  background: var(--control-bg); color: var(--text); font-size: var(--fs-caption); font-weight: 500;
  border: 0; cursor: pointer;
}
a.tag:hover, button.tag:hover { background: var(--control-bg-hover); text-decoration: none; }
.tag .tag-dot { width: 9px; height: 9px; margin: 0; }
.tag[aria-pressed="true"] { background: var(--accent-fill); color: var(--on-accent); }
.tag .n { color: var(--text-2); font-variant-numeric: tabular-nums; }
.tag[aria-pressed="true"] .n { color: var(--on-accent); }

.badge-new, .badge-upd {
  display: inline-block; font-size: var(--fs-caption); font-weight: 700; line-height: 1; padding: 4px 7px; border-radius: 5px;
}
.badge-new { background: var(--accent-fill); color: var(--on-accent); }
.badge-upd { background: var(--accent-soft); color: var(--accent-text); }

/* ---------- Cards / shelves ---------- */
.shelf { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 22px; }
.shelf.four { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.card { display: flex; flex-direction: column; gap: 10px; color: var(--text); min-width: 0; }
.card:hover { text-decoration: none; }
.card .art {
  aspect-ratio: 16 / 9; border-radius: var(--r-card); overflow: hidden; background: var(--surface-3);
  box-shadow: 0 0 0 1px var(--separator), 0 6px 18px rgba(0, 0, 0, 0.08);
  transition: transform 200ms var(--ease), box-shadow 200ms var(--ease);
}
.card .art img { width: 100%; height: 100%; object-fit: cover; }
.card:hover .art { transform: translateY(-2px); box-shadow: 0 0 0 1px var(--separator), 0 12px 28px rgba(0, 0, 0, 0.16); }
.card .kicker { font-size: var(--fs-caption); color: var(--text-2); font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; }
.card h3 { font-size: 1.125rem; font-weight: 700; line-height: 1.3; }
.card:hover h3 { color: var(--accent-text); }
.card p { font-size: var(--fs-ui); color: var(--text-2); margin: 0; line-height: 1.45; }
.art.noimg { display: grid; place-items: center; background: linear-gradient(150deg, var(--slate-500), var(--slate-800)); color: rgba(255, 255, 255, 0.9); }
.art.noimg .icon { width: 44px; height: 44px; stroke-width: 1.4; }

/* ---------- Home ---------- */
.welcome {
  display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 6fr);
  border-radius: 18px; overflow: hidden; background: var(--surface-2);
  border: 1px solid var(--separator); box-shadow: 0 10px 30px rgba(0, 0, 0, 0.08);
}
.welcome .photo { position: relative; min-height: 460px; background: linear-gradient(160deg, #5b7ea3, #1f2f42); }
.welcome .photo img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: 30% 30%; }
.welcome .photo .caption {
  position: absolute; left: 14px; bottom: 14px; font-size: var(--fs-caption); color: #fff;
  background: rgba(20, 24, 30, 0.55); -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
  padding: 5px 10px; border-radius: 999px;
}
.welcome .copy { padding: 44px 48px; display: flex; flex-direction: column; justify-content: center; }
.welcome .hello { font-size: var(--fs-ui); color: var(--text-2); font-weight: 600; margin-bottom: 10px; display: flex; align-items: center; gap: 8px; }
.welcome h1 { font-size: clamp(2.25rem, 3.6vw, 3.25rem); line-height: 1.06; letter-spacing: -0.03em; font-weight: 800; }
.welcome .lede { font-size: var(--fs-lede); color: var(--text-2); margin: 18px 0 22px; line-height: 1.45; max-width: 44ch; }
.spec { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); border-top: 1px solid var(--separator); border-bottom: 1px solid var(--separator); margin: 0 0 24px; }
.spec div { padding: 12px 4px; }
.spec div + div { border-left: 1px solid var(--separator); padding-left: 16px; }
.spec dt { font-size: var(--fs-caption); color: var(--text-2); }
.spec dd { margin: 0; font-size: 1.5rem; font-weight: 700; font-variant-numeric: tabular-nums; letter-spacing: -0.02em; }
.cta-row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.cta-row .tertiary { font-size: var(--fs-ui); color: var(--text-2); padding: 0 8px; }
.cta-row .tertiary:hover { color: var(--accent-text); }

.launch { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
.launch a {
  display: flex; flex-direction: column; align-items: center; text-align: center; gap: 10px;
  padding: 22px 14px 18px; border-radius: 14px; color: var(--text);
}
.launch a:hover { background: var(--hover); text-decoration: none; }
.launch .big-icon {
  width: 76px; height: 76px; border-radius: 18px; display: grid; place-items: center; color: #fff;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2), inset 0 0.5px 0 rgba(255, 255, 255, 0.4);
}
.launch .big-icon .icon { width: 38px; height: 38px; stroke-width: 1.6; }
.launch strong { font-size: var(--fs-body); line-height: 1.25; }
.launch span.d { font-size: var(--fs-ui); color: var(--text-2); line-height: 1.4; }
.launch .kind { font-size: var(--fs-caption); color: var(--text-2); font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; }
.g-slate { background: linear-gradient(160deg, #5b7ea3, #2a3f54); }
.g-orange { background: linear-gradient(160deg, #f5a54a, #c85c14); }
.g-green { background: linear-gradient(160deg, #56c27a, #1f7a4d); }
.g-purple { background: linear-gradient(160deg, #b27ae8, #6a2fb0); }
.g-blue { background: linear-gradient(160deg, #5aa4ff, #1c5fd0); }
.g-gray { background: linear-gradient(160deg, #9ea3aa, #55595f); }
.g-red { background: linear-gradient(160deg, #ff7b6b, #c2342a); }

.trio { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; align-items: start; }
.hire {
  border-radius: var(--r-card); padding: 24px; color: #fff;
  background: linear-gradient(150deg, #3f5f82, #1f2f42);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.18);
}
.hire h3 { color: #fff; font-size: 1.375rem; margin-bottom: 8px; }
.hire p { color: #dfe7f0; font-size: var(--fs-body); }
.hire .btn { background: #fff; color: #1f2f42; border-color: transparent; }

/* ---------- Writing (Mail-style split) ---------- */
.split { display: grid; grid-template-columns: minmax(340px, 420px) minmax(0, 1fr); min-height: calc(100vh - var(--toolbar-h)); }
.list-pane { border-right: 1px solid var(--separator); min-width: 0; }
.list-pane .pane-head { position: sticky; top: var(--toolbar-h); z-index: 5; padding: 14px 16px 12px; background: var(--toolbar-bg); -webkit-backdrop-filter: blur(24px); backdrop-filter: blur(24px); border-bottom: 1px solid var(--separator); }
@media (min-width: 1100px) { .list-pane .pane-head { top: calc(var(--menubar-h) + var(--toolbar-h)); } }
.pane-head .large-title { font-size: 1.75rem; }
.pane-head p { margin: 2px 0 12px; font-size: var(--fs-ui); color: var(--text-2); }
.pane-head .field { width: 100%; }
.pane-head .segmented { margin-top: 10px; width: 100%; }
.pane-head .segmented button { flex: 1; padding: 6px 8px; }
.mail-list { list-style: none; margin: 0; padding: 6px 8px 16px; }
.mail-group { font-size: var(--fs-caption); font-weight: 700; color: var(--text-3); padding: 14px 10px 6px; list-style: none; }
.mail-row {
  display: grid; grid-template-columns: 10px minmax(0, 1fr) auto; column-gap: 10px; row-gap: 2px;
  padding: 12px 12px 12px 8px; border-radius: 9px; color: var(--text); position: relative;
}
.mail-row:hover { text-decoration: none; background: var(--hover); }
.mail-row .dot { width: 9px; height: 9px; border-radius: 50%; margin-top: 7px; grid-row: 1 / span 3; }
.mail-row .m-title { font-weight: 700; font-size: var(--fs-body); line-height: 1.3; }
.mail-row .m-date { font-size: var(--fs-caption); color: var(--text-2); white-space: nowrap; padding-top: 3px; font-variant-numeric: tabular-nums; }
.mail-row .m-coll { grid-column: 2 / span 2; font-size: var(--fs-caption); color: var(--text-2); font-weight: 600; }
.mail-row .m-desc { grid-column: 2 / span 2; font-size: var(--fs-ui); color: var(--text-2); line-height: 1.4; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.mail-row[aria-selected="true"] { background: var(--accent-fill); color: var(--on-accent); }
.mail-row[aria-selected="true"] .m-date, .mail-row[aria-selected="true"] .m-coll, .mail-row[aria-selected="true"] .m-desc { color: var(--on-accent); opacity: 0.9; }
.mail-list li + li .mail-row::before { content: ""; position: absolute; top: -1px; left: 26px; right: 12px; border-top: 1px solid var(--separator); }
.mail-row[aria-selected="true"]::before, .mail-row:hover::before { display: none; }
.empty { text-align: center; padding: 40px 20px; color: var(--text-2); }
.empty .icon { width: 40px; height: 40px; margin: 0 auto 10px; stroke-width: 1.4; }
.empty strong { display: block; color: var(--text); font-size: var(--fs-body); margin-bottom: 4px; }
.empty[hidden] { display: none; }
.preview-pane { min-width: 0; }
.preview { position: sticky; top: var(--toolbar-h); padding: 32px 44px 40px; max-width: 820px; }
@media (min-width: 1100px) { .preview { top: calc(var(--menubar-h) + var(--toolbar-h)); } }
.preview .p-head { display: flex; align-items: center; gap: 12px; padding-bottom: 16px; border-bottom: 1px solid var(--separator); margin-bottom: 20px; }
.preview .avatar { width: 44px; height: 44px; border-radius: 50%; object-fit: cover; object-position: 30% 25%; background: var(--surface-3); }
.preview .from strong { display: block; font-size: var(--fs-body); }
.preview .from span { font-size: var(--fs-ui); color: var(--text-2); }
.preview .p-date { margin-left: auto; font-size: var(--fs-ui); color: var(--text-2); }
.preview h2 { font-size: 2rem; line-height: 1.15; letter-spacing: -0.02em; margin-bottom: 12px; }
.preview .p-desc { font-family: var(--font-read); font-size: var(--fs-read); line-height: 1.6; color: var(--text); }
.preview .p-art { aspect-ratio: 16/8; border-radius: var(--r-card); overflow: hidden; margin: 22px 0; background: var(--surface-3); box-shadow: 0 0 0 1px var(--separator); }
.preview .p-art img { width: 100%; height: 100%; object-fit: cover; }
.preview .p-actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-top: 18px; }
.lower { padding: 8px 40px 48px; }

/* ---------- Table view (Finder list) ---------- */
.table-wrap { overflow-x: auto; border: 1px solid var(--separator); border-radius: var(--r-card); }
.table { width: 100%; border-collapse: collapse; font-size: var(--fs-ui); }
.table th { text-align: left; font-weight: 600; font-size: var(--fs-caption); color: var(--text-2); padding: 8px 14px; border-bottom: 1px solid var(--separator); background: var(--surface-2); white-space: nowrap; }
.table td { padding: 10px 14px; vertical-align: top; }
.table tbody tr:nth-child(even) { background: var(--surface-2); }
.table tbody tr:hover { background: var(--accent-soft); }
.table td a { color: var(--text); font-weight: 600; }
.table .num { white-space: nowrap; color: var(--text-2); }
[data-view="grid"] .view-list, [data-view="list"] .view-grid { display: none; }

/* ---------- AI ---------- */
.banner {
  display: flex; align-items: center; gap: 16px; padding: 16px 18px; border-radius: var(--r-card);
  background: var(--accent-soft); border: 1px solid var(--separator); margin-bottom: 8px;
}
.banner p { margin: 0; flex: 1; font-size: var(--fs-body); }
.banner .sym { width: 40px; height: 40px; border-radius: 10px; }
.books { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 24px; }
.book { display: flex; flex-direction: column; gap: 10px; color: var(--text); }
.book:hover { text-decoration: none; }
.book .cover {
  aspect-ratio: 2 / 3; border-radius: 4px 10px 10px 4px; overflow: hidden; position: relative;
  background: linear-gradient(160deg, #3a4a5e, #141b24);
  box-shadow: inset 5px 0 8px -4px rgba(0, 0, 0, 0.5), 0 10px 24px rgba(0, 0, 0, 0.25), 0 0 0 1px var(--separator);
  transition: transform 200ms var(--ease);
}
.book:hover .cover { transform: translateY(-3px) rotate(-0.5deg); }
.book .cover img { width: 100%; height: 100%; object-fit: cover; }
.book .cover .band {
  position: absolute; inset: auto 0 0 0; padding: 30px 12px 12px; color: #fff;
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.82));
  font-family: var(--font-read); font-size: 1.0625rem; font-weight: 700; line-height: 1.2;
}
.book .cover .band small { display: block; font-family: var(--font-ui); font-size: var(--fs-caption); font-weight: 600; opacity: 0.9; margin-bottom: 2px; }
.book.soon .cover { display: grid; place-items: center; background: repeating-linear-gradient(135deg, var(--surface-2) 0 10px, var(--surface-3) 10px 20px); box-shadow: 0 0 0 1px var(--separator); }
.book.soon .cover span { font-size: var(--fs-ui); font-weight: 700; color: var(--text-2); background: var(--surface); padding: 6px 12px; border-radius: 999px; box-shadow: 0 0 0 1px var(--separator); }
.book .b-meta { font-size: var(--fs-caption); color: var(--text-2); }
.book strong { font-size: var(--fs-ui); line-height: 1.3; }
.notice {
  display: flex; gap: 12px; align-items: flex-start; padding: 14px 16px; border-radius: var(--r-card);
  background: var(--callout-why); border: 1px solid var(--separator); margin: 0 0 20px; font-size: var(--fs-ui);
}
.notice p { margin: 0; }
.notice .icon { color: var(--warn); width: 22px; height: 22px; margin-top: 1px; }

/* ---------- Projects ---------- */
.feature {
  display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: 0; border-radius: 18px; overflow: hidden;
  background: #0f1c2b; color: #e8eef5; box-shadow: 0 16px 40px rgba(0, 0, 0, 0.22);
}
.feature .f-art { min-height: 340px; position: relative; background: linear-gradient(150deg, #20364d, #0c1520); }
.feature .f-art img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.feature .f-copy { padding: 36px 40px; display: flex; flex-direction: column; justify-content: center; }
.feature .kicker { font-size: var(--fs-caption); font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; color: #9fc3ea; }
.feature h2 { color: #fff; font-size: 2.25rem; letter-spacing: -0.02em; margin: 6px 0 12px; }
.feature p { color: #cfdae6; font-size: var(--fs-body); }
.feature .stats { display: flex; gap: 0; margin: 8px 0 22px; border-top: 1px solid rgba(255, 255, 255, 0.16); }
.feature .stats div { flex: 1; padding: 12px 0; }
.feature .stats div + div { border-left: 1px solid rgba(255, 255, 255, 0.16); padding-left: 16px; }
.feature .stats dt { font-size: var(--fs-caption); color: #a9bccf; }
.feature .stats dd { margin: 0; font-size: 1.75rem; font-weight: 700; color: #fff; font-variant-numeric: tabular-nums; }
.feature .btn-primary { background: #fff; color: #0f1c2b; }
.feature .chips { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 18px; }
.feature .chips span { font-size: var(--fs-caption); padding: 3px 10px; border-radius: 999px; background: rgba(255, 255, 255, 0.12); color: #e8eef5; }
.app-rows { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 32px; }
.app-row { display: grid; grid-template-columns: 72px minmax(0, 1fr) auto; gap: 16px; align-items: center; padding: 14px 0; border-bottom: 1px solid var(--separator); }
.app-row .thumb { width: 72px; height: 72px; border-radius: 16px; overflow: hidden; background: var(--surface-3); box-shadow: 0 0 0 1px var(--separator), 0 2px 6px rgba(0, 0, 0, 0.12); display: grid; place-items: center; color: #fff; }
.app-row .thumb img { width: 100%; height: 100%; object-fit: cover; }
.app-row .thumb .icon { width: 34px; height: 34px; stroke-width: 1.6; }
.app-row h3 { font-size: var(--fs-body); font-weight: 700; line-height: 1.3; }
.app-row p { margin: 2px 0 4px; font-size: var(--fs-ui); color: var(--text-2); line-height: 1.4; }
.app-row .meta { font-size: var(--fs-caption); color: var(--text-2); display: flex; gap: 10px; flex-wrap: wrap; }
.app-row .meta .star { color: var(--text); font-weight: 600; }
.shots { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 22px; }
.shot { color: var(--text); display: flex; flex-direction: column; gap: 8px; }
.shot:hover { text-decoration: none; }
.shot .frame { border-radius: 10px; overflow: hidden; background: #111418; box-shadow: 0 0 0 1px var(--separator), 0 8px 22px rgba(0, 0, 0, 0.14); }
.shot .frame .bar { display: flex; gap: 6px; padding: 8px 10px; background: #2a2c30; }
.shot .frame .bar i { width: 9px; height: 9px; border-radius: 50%; background: #56585d; }
.shot .frame .img { aspect-ratio: 16/10; position: relative; background: radial-gradient(circle at 30% 30%, #2a3f54, #0e141b); }
.shot .frame .img img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.shot .frame .img .label { position: absolute; left: 12px; bottom: 10px; font-family: var(--font-mono); font-size: var(--fs-caption); color: #9fd0ff; }
.shot h3 { font-size: var(--fs-body); }
.shot p { font-size: var(--fs-ui); color: var(--text-2); margin: 0; line-height: 1.45; }
.shot .tech { font-size: var(--fs-caption); color: var(--text-2); font-weight: 600; }

/* ---------- About (About This Mac) ---------- */
.about-mac { text-align: center; padding: 40px 24px 32px; border-radius: 18px; background: var(--surface-2); border: 1px solid var(--separator); }
.about-mac .portrait { width: 168px; height: 168px; border-radius: 50%; margin: 0 auto 18px; object-fit: cover; box-shadow: 0 10px 30px rgba(0, 0, 0, 0.22), 0 0 0 4px var(--surface); background: var(--surface-3); }
.about-mac h1 { font-size: 2.5rem; letter-spacing: -0.03em; font-weight: 800; }
.about-mac .role { font-size: var(--fs-lede); color: var(--text-2); margin: 6px auto 22px; max-width: 46ch; }
.kv { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 6px 16px; max-width: 480px; margin: 0 auto 24px; text-align: left; font-size: var(--fs-ui); }
.kv dt { text-align: right; font-weight: 600; }
.kv dd { margin: 0; color: var(--text-2); }
.storage { margin: 4px 0 10px; }
.storage .bar { display: flex; height: 26px; border-radius: 7px; overflow: hidden; gap: 2px; background: var(--separator); box-shadow: inset 0 0 0 1px var(--separator); }
.storage .bar span { display: block; height: 100%; }
.legend { display: flex; flex-wrap: wrap; gap: 8px 18px; margin: 12px 0 0; padding: 0; list-style: none; font-size: var(--fs-ui); }
.legend li { display: inline-flex; align-items: center; gap: 7px; }
.legend i { width: 11px; height: 11px; border-radius: 3px; display: inline-block; }
.legend .yrs { color: var(--text-2); font-variant-numeric: tabular-nums; }
details.disclose { border-top: 1px solid var(--separator); }
details.disclose:first-of-type { border-top: 0; }
details.disclose summary {
  list-style: none; cursor: pointer; display: flex; align-items: center; gap: 12px; padding: 14px 16px; min-height: 52px;
}
details.disclose summary::-webkit-details-marker { display: none; }
details.disclose summary .tri { width: 14px; height: 14px; color: var(--text-2); transition: transform 150ms var(--ease); }
details.disclose[open] summary .tri { transform: rotate(90deg); }
details.disclose summary:hover { background: var(--hover); }
details.disclose summary .r-title { font-weight: 700; }
details.disclose .body { padding: 0 16px 16px 42px; font-size: var(--fs-ui); color: var(--text-2); }
details.disclose .body p { margin: 0 0 10px; }
.roles { list-style: none; margin: 0; padding: 0; }
.roles li { padding: 10px 0; border-top: 1px solid var(--separator); color: var(--text); }
.roles li span { display: block; color: var(--text-2); font-size: var(--fs-caption); }
.roles li ul { margin: 6px 0 0; padding-left: 18px; color: var(--text-2); }
.quotes { list-style: none; margin: 0; padding: 0; counter-reset: q; }
.quotes li { counter-increment: q; display: flex; gap: 14px; align-items: baseline; padding: 14px 16px; font-family: var(--font-read); font-size: 1.1875rem; font-style: italic; }
.quotes li + li { border-top: 1px solid var(--separator); }
.quotes li::before { content: counter(q, decimal-leading-zero); font-family: var(--font-mono); font-style: normal; font-size: var(--fs-caption); color: var(--accent-text); }
.two-col { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px; }
.cap-list { list-style: none; margin: 0; padding: 0 16px 14px; display: flex; flex-wrap: wrap; gap: 8px; }
.cap-list li { font-size: var(--fs-caption); font-weight: 500; padding: 5px 10px; border-radius: 6px; background: var(--surface); box-shadow: 0 0 0 1px var(--separator); }
.hiker { border-radius: var(--r-card); overflow: hidden; aspect-ratio: 4 / 3; background: linear-gradient(160deg, #5b7ea3, #2a3f54); box-shadow: 0 0 0 1px var(--separator); }
.hiker img { width: 100%; height: 100%; object-fit: cover; }

/* ---------- Article (Reader) ---------- */
.reader-wrap { display: grid; grid-template-columns: minmax(0, 1fr) 280px; }
.inspector-hidden .reader-wrap { grid-template-columns: minmax(0, 1fr) 0; }
.inspector-hidden .inspector { display: none; }
.reader { padding: 36px 40px 56px; min-width: 0; }
.reader-inner { max-width: 700px; margin: 0 auto; }
.crumbs { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; font-size: var(--fs-ui); color: var(--text-2); margin-bottom: 18px; }
.crumbs .icon { width: 14px; height: 14px; }
.reader h1 { font-family: var(--font-read); font-size: clamp(2.25rem, 4vw, 3.25rem); line-height: 1.08; letter-spacing: -0.02em; font-weight: 700; }
.reader .dek { font-family: var(--font-read); font-size: 1.375rem; color: var(--text-2); line-height: 1.4; margin: 14px 0 18px; }
.byline { display: flex; align-items: center; gap: 12px; font-size: var(--fs-ui); color: var(--text-2); padding: 14px 0; border-top: 1px solid var(--separator); border-bottom: 1px solid var(--separator); margin-bottom: 28px; flex-wrap: wrap; }
.byline img { width: 40px; height: 40px; border-radius: 50%; object-fit: cover; object-position: 30% 25%; background: var(--surface-3); }
.byline strong { color: var(--text); }
.hero-img { margin: 0 -60px 34px; border-radius: 14px; overflow: hidden; aspect-ratio: 2 / 1; background: linear-gradient(150deg, #20364d, #0c1520); box-shadow: 0 0 0 1px var(--separator), 0 14px 36px rgba(0, 0, 0, 0.16); }
.hero-img img { width: 100%; height: 100%; object-fit: cover; }
.prose { font-family: var(--font-read); font-size: var(--fs-read); line-height: 1.68; }
.prose.size-l { font-size: 1.3125rem; }
.prose.size-s { font-size: 1.0625rem; }
.prose h2 { font-family: var(--font-display); font-size: var(--fs-h2); margin: 2.1em 0 0.6em; letter-spacing: -0.02em; }
.prose p, .prose ol, .prose ul { margin: 0 0 1.1em; }
.prose li { margin: 0.3em 0; }
.prose a { text-decoration: underline; text-decoration-color: color-mix(in srgb, var(--accent-text) 45%, transparent); text-underline-offset: 3px; }
.prose code:not(pre code) { font-size: 0.84em; background: var(--control-bg); padding: 0.12em 0.38em; border-radius: 5px; }
.codewin { margin: 1.6em -60px; border-radius: 12px; overflow: hidden; background: var(--code-bg); box-shadow: 0 0 0 1px var(--separator), 0 8px 24px rgba(0, 0, 0, 0.1); }
.codewin .c-head { display: flex; align-items: center; gap: 10px; padding: 6px 8px 6px 14px; background: var(--code-head); border-bottom: 1px solid var(--separator); font-family: var(--font-ui); font-size: var(--fs-caption); color: var(--text-2); }
.codewin .c-head .file { display: inline-flex; align-items: center; gap: 6px; color: var(--text); font-weight: 600; }
.codewin .c-head .file .icon { width: 15px; height: 15px; color: #3178c6; }
.codewin .c-head .lang { margin-left: auto; }
.codewin .copy-btn { min-height: 30px; height: 30px; font-size: var(--fs-caption); }
.codewin pre { margin: 0; padding: 16px 20px; overflow-x: auto; font-size: 0.9375rem; line-height: 1.6; color: var(--code-ink); tab-size: 2; }
.tk-k { color: var(--tok-keyword); font-weight: 600; } .tk-s { color: var(--tok-string); } .tk-n { color: var(--tok-number); }
.tk-c { color: var(--tok-comment); font-style: italic; } .tk-t { color: var(--tok-type); } .tk-f { color: var(--tok-func); } .tk-g { color: var(--tok-tag); }
.callout { display: grid; grid-template-columns: 32px minmax(0, 1fr); gap: 12px; padding: 16px 18px; border-radius: 12px; margin: 1.4em 0; font-family: var(--font-ui); font-size: var(--fs-body); line-height: 1.55; }
.callout p { margin: 0; }
.callout .sym { width: 32px; height: 32px; }
.callout.why { background: var(--callout-why); box-shadow: inset 3px 0 0 var(--callout-why-edge); }
.callout.why .sym { background: #b8860b; }
.callout.note { background: var(--surface-2); box-shadow: 0 0 0 1px var(--separator); }
.callout.skill { background: var(--accent-soft); box-shadow: 0 0 0 1px var(--separator); }
.callout .lbl { font-weight: 700; display: block; margin-bottom: 2px; }
.ask { margin: 1.6em 0; font-family: var(--font-ui); }
.ask .who { font-size: var(--fs-caption); color: var(--text-2); margin: 0 0 6px 12px; }
.ask .bubble {
  position: relative; max-width: 88%; padding: 12px 16px; border-radius: 20px; font-size: var(--fs-body); line-height: 1.45;
  background: var(--accent-fill); color: var(--on-accent); margin-left: auto;
}
.ask .bubble p { margin: 0; }
.ask .reply { display: flex; align-items: center; gap: 8px; margin-top: 10px; }
.ask .reply span { flex: 1; min-height: 40px; display: flex; align-items: center; border-radius: 20px; padding: 0 16px; background: var(--surface); box-shadow: inset 0 0 0 1px var(--separator-strong); color: var(--text-2); font-size: var(--fs-ui); }
.ask .reply a { font-size: var(--fs-ui); font-weight: 600; }
.filed { margin: 40px 0 0; padding-top: 20px; border-top: 1px solid var(--separator); }
.filed h2 { font-size: var(--fs-ui); color: var(--text-2); font-weight: 600; margin-bottom: 10px; }
.share-sheet { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 28px; }
.share-sheet a, .share-sheet button {
  display: flex; flex-direction: column; align-items: center; gap: 6px; width: 92px; padding: 10px 4px; border-radius: 12px; border: 0; background: none; cursor: pointer;
  font-size: var(--fs-caption); color: var(--text);
}
.share-sheet a:hover, .share-sheet button:hover { background: var(--hover); text-decoration: none; }
.share-sheet .sym { width: 52px; height: 52px; border-radius: 14px; }
.share-sheet .sym .icon { width: 24px; height: 24px; }
.sheet { margin-top: 36px; border-radius: 16px; padding: 26px 28px; background: var(--surface-2); border: 1px solid var(--separator); box-shadow: 0 12px 30px rgba(0, 0, 0, 0.08); }
.sheet h2 { font-size: 1.375rem; margin-bottom: 4px; }
.sheet p { color: var(--text-2); font-size: var(--fs-body); }
.nl-form { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.nl-form .field { flex: 1; min-width: 220px; height: 44px; font-size: var(--fs-body); }
.nl-form .consent { flex-basis: 100%; display: flex; gap: 8px; align-items: center; font-size: var(--fs-ui); color: var(--text-2); }
.nl-form .consent input { width: 18px; height: 18px; accent-color: var(--accent-fill); }
.form-msg { flex-basis: 100%; font-size: var(--fs-ui); margin: 4px 0 0; }
.form-msg.ok { color: var(--ok); } .form-msg.err { color: var(--bad); }
.related { margin-top: 40px; }
.inspector {
  position: sticky; top: var(--toolbar-h); align-self: start; height: calc(100vh - var(--toolbar-h)); overflow-y: auto;
  border-left: 1px solid var(--separator); background: var(--surface-2); padding: 18px 16px 30px; font-size: var(--fs-ui);
}
@media (min-width: 1100px) { .inspector { top: calc(var(--menubar-h) + var(--toolbar-h)); height: calc(100vh - var(--menubar-h) - var(--toolbar-h)); } }
.inspector h2 { font-size: var(--fs-caption); font-weight: 700; color: var(--text-3); margin: 18px 0 8px; }
.inspector h2:first-child { margin-top: 0; }
.toc { list-style: none; margin: 0; padding: 0; }
.toc a { display: block; padding: 6px 10px; border-radius: 7px; color: var(--text); line-height: 1.3; }
.toc a:hover { background: var(--hover); text-decoration: none; }
.toc a[aria-current="true"] { background: var(--accent-soft); color: var(--accent-text); font-weight: 600; }
.info-kv { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 6px 12px; margin: 0; }
.info-kv dt { color: var(--text-2); }
.info-kv dd { margin: 0; text-align: right; }
.series-note { font-size: var(--fs-ui); color: var(--text-2); }
.toc-mobile { display: none; }

/* ---------- Patterns (Finder icon view) ---------- */
.threeways { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; margin: 0 0 14px; }
.threeways .row { align-items: flex-start; }
.fine { font-size: var(--fs-ui); color: var(--text-2); max-width: 80ch; }
.finder-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px 18px; list-style: none; margin: 0; padding: 0; }
.finder-item { display: flex; flex-direction: column; gap: 8px; padding: 12px; border-radius: 12px; color: var(--text); height: 100%; }
.finder-item:hover { background: var(--hover); text-decoration: none; }
.finder-item:focus-visible { background: var(--accent-soft); }
.doc-thumb {
  aspect-ratio: 4 / 3; border-radius: 10px; position: relative; overflow: hidden;
  background: var(--surface); box-shadow: 0 0 0 1px var(--separator-strong), 0 6px 16px rgba(0, 0, 0, 0.1);
  padding: 14px; display: flex; flex-direction: column; gap: 8px; justify-content: center;
}
.finder-item .f-cat { font-size: var(--fs-caption); color: var(--text-2); font-weight: 600; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.finder-item h2 { font-size: var(--fs-body); font-weight: 700; line-height: 1.3; }
.finder-item p { font-size: var(--fs-ui); color: var(--text-2); margin: 0; line-height: 1.45; }
.finder-item .good { font-size: var(--fs-caption); color: var(--text-2); }
.finder-item .good b { color: var(--text); }
/* CSS-drawn thumbnails, one grammar per category */
.th-bars { display: flex; align-items: flex-end; gap: 6px; height: 60%; }
.th-bars i { flex: 1; background: var(--c); border-radius: 3px 3px 0 0; opacity: 0.85; }
.th-strip { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1px; background: var(--separator-strong); border-radius: 6px; overflow: hidden; }
.th-strip i { background: var(--surface-2); height: 34px; }
.th-strip i:nth-child(2) { background: color-mix(in srgb, var(--c) 22%, var(--surface)); }
.th-line { height: 8px; border-radius: 4px; background: var(--surface-3); }
.th-line.c { background: var(--c); width: 55%; }
.th-line.s { width: 75%; }
.th-cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.th-cards i { aspect-ratio: 3/4; border-radius: 5px; background: var(--surface-3); box-shadow: 0 0 0 1px var(--separator); }
.th-cards i:first-child { background: color-mix(in srgb, var(--c) 30%, var(--surface)); }
.th-btns { display: flex; gap: 8px; }
.th-btns i { height: 26px; flex: 1; border-radius: 7px; background: var(--surface-3); box-shadow: 0 2px 0 var(--separator-strong); }
.th-btns i:first-child { background: var(--c); }
.th-field { height: 28px; border-radius: 7px; box-shadow: inset 0 0 0 1.5px var(--separator-strong); display: flex; align-items: center; gap: 6px; padding: 0 8px; }
.th-field i { height: 14px; width: 40px; border-radius: 999px; background: color-mix(in srgb, var(--c) 30%, var(--surface)); }
.th-swatches { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
.th-swatches i { aspect-ratio: 1; border-radius: 50%; background: var(--c); }
.th-swatches i:nth-child(2) { opacity: 0.75; } .th-swatches i:nth-child(3) { opacity: 0.55; } .th-swatches i:nth-child(4) { opacity: 0.35; } .th-swatches i:nth-child(5) { opacity: 0.18; }
.cat-data { --c: #2a6fdb; } .cat-layout { --c: #2f8a4a; } .cat-interaction { --c: #c8691c; } .cat-forms { --c: #8a47c7; } .cat-color { --c: #d6453d; }

/* ---------- Pattern detail ---------- */
.detail-wrap { display: grid; grid-template-columns: minmax(0, 1fr) 300px; }
.detail { padding: 30px 40px 56px; min-width: 0; }
.panes { border: 1px solid var(--separator-strong); border-radius: 14px; overflow: hidden; margin-top: 24px; background: var(--surface); }
.panes .p-bar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: space-between; padding: 10px 12px; border-bottom: 1px solid var(--separator); background: var(--surface-2); }
.panes .p-bar .actions { display: flex; gap: 8px; flex-wrap: wrap; }
.pane { padding: 24px; }
.pane[hidden] { display: none; }
.pane pre { margin: 0; overflow-x: auto; font-size: 0.9375rem; line-height: 1.6; color: var(--code-ink); background: var(--code-bg); padding: 16px; border-radius: 10px; box-shadow: 0 0 0 1px var(--separator); }
.pane .note { font-size: var(--fs-ui); color: var(--text-2); margin: 0 0 12px; }
.prompt { font-family: var(--font-read); font-size: 1.125rem; line-height: 1.65; max-width: 70ch; }
.prompt h3 { font-family: var(--font-display); font-size: var(--fs-body); margin: 1.4em 0 0.4em; }
.stage { background: var(--surface-2); border-radius: 10px; padding: 22px; box-shadow: inset 0 0 0 1px var(--separator); }
.stage .cap { font-size: var(--fs-ui); color: var(--text-2); margin: 0 0 12px; }
.stage .cap + .hss-strip { margin-bottom: 26px; }
/* The pattern itself: gap-as-hairline */
.hss-strip { display: grid; gap: 1px; background: var(--separator-strong); border: 1px solid var(--separator-strong); border-radius: 10px; overflow: hidden; 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(auto-fit, minmax(8.5rem, 1fr)); }
.hss-tile { background: var(--surface); padding: 12px 14px; min-width: 0; text-align: left; border: 0; font: inherit; color: inherit; }
.hss-tile .l { display: block; font-family: var(--font-mono); font-size: 0.8125rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--text-2); }
.hss-tile .v { display: block; font-size: 1.6rem; font-weight: 700; font-variant-numeric: tabular-nums; line-height: 1.2; margin: 4px 0 2px; }
.hss-tile .v.dim { color: var(--text-3); }
.hss-tile .u { display: block; font-size: 0.8125rem; color: var(--text-2); }
button.hss-tile { cursor: pointer; }
button.hss-tile:hover { background: var(--surface-2); }
button.hss-tile[aria-pressed="true"] { background: color-mix(in srgb, var(--accent-fill) 14%, var(--surface)); box-shadow: inset 0 -3px 0 var(--accent-fill); }
button.hss-tile:focus-visible { outline-offset: -3px; }
.dl-list { list-style: none; margin: 14px 0 0; padding: 0; border: 1px solid var(--separator); border-radius: 10px; background: var(--surface); }
.dl-list li { display: flex; justify-content: space-between; gap: 12px; padding: 10px 14px; font-size: var(--fs-ui); }
.dl-list li + li { border-top: 1px solid var(--separator); }
.dl-list li[hidden] { display: none; }
.st { font-size: var(--fs-caption); font-weight: 600; display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.st::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.st.done { color: var(--ok); } .st.dl { color: var(--accent-text); } .st.q { color: var(--text-2); } .st.fail { color: var(--bad); }
.status-line { font-size: var(--fs-ui); color: var(--text-2); margin: 10px 0 0; }
.uses { columns: 2; column-gap: 28px; padding-left: 20px; margin: 8px 0 16px; font-size: var(--fs-ui); }
.uses li { break-inside: avoid; margin-bottom: 4px; }
.getinfo .gi-head { display: flex; gap: 12px; align-items: center; margin-bottom: 14px; }
.getinfo .gi-icon { width: 54px; height: 54px; border-radius: 10px; background: var(--surface); box-shadow: 0 0 0 1px var(--separator-strong); display: grid; place-items: center; padding: 8px; }
.getinfo .gi-icon .th-strip i { height: 14px; }
.getinfo strong { display: block; line-height: 1.25; }
.getinfo span { font-size: var(--fs-caption); color: var(--text-2); }

/* ---------- Window footer + status bar ---------- */
.statusbar {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  padding: 8px 20px; font-size: var(--fs-caption); color: var(--text-2);
  border-top: 1px solid var(--separator); background: var(--surface-2);
}
.statusbar .path { display: inline-flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.statusbar .path .icon { width: 13px; height: 13px; }
.statusbar .right { margin-left: auto; }
.site-foot { border-top: 1px solid var(--separator); padding: 30px 40px 26px; background: var(--surface-2); font-size: var(--fs-ui); }
.site-foot .cols { display: grid; grid-template-columns: 1.3fr 1fr 1fr 1.6fr; gap: 28px; }
.site-foot h2 { font-size: var(--fs-caption); font-weight: 700; color: var(--text-3); margin-bottom: 8px; }
.site-foot ul { list-style: none; padding: 0; margin: 0; }
.site-foot li a { display: inline-block; padding: 3px 0; color: var(--text); }
.site-foot .blurb { color: var(--text-2); margin-top: 10px; }
.site-foot .copy { margin-top: 24px; padding-top: 14px; border-top: 1px solid var(--separator); color: var(--text-2); font-size: var(--fs-caption); display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.site-foot .nl-form .field { min-width: 160px; height: 40px; }
.site-foot .nl-form .btn { min-height: 40px; }

/* ---------- Mobile: tab bar + drawer ---------- */
.tabbar { display: none; }
.scrim { display: none; }
@media (max-width: 899px) {
  .window { grid-template-columns: minmax(0, 1fr); }
  .sidebar {
    position: fixed; z-index: 70; top: 0; left: 0; bottom: 0; width: min(320px, 86vw); height: 100%;
    transform: translateX(-102%); transition: transform 220ms var(--ease); visibility: hidden;
    background: var(--sidebar-solid); box-shadow: 0 0 40px rgba(0, 0, 0, 0.3);
  }
  .drawer-open .sidebar { transform: none; visibility: visible; }
  .drawer-open .scrim { display: block; position: fixed; inset: 0; background: var(--scrim); z-index: 65; }
  .sidebar-collapsed .window { grid-template-columns: minmax(0, 1fr); }
  .sb-search { display: block; margin: 0 4px 14px; }
  .sb-search .field { width: 100%; height: 40px; }
  .toolbar { padding: 0 8px; }
  .tb-hide-m { display: none !important; }
  .content, .detail, .reader { padding: 22px 16px 36px; }
  .lower { padding: 8px 16px 36px; }
  .tabbar {
    display: grid; grid-template-columns: repeat(5, 1fr);
    position: fixed; z-index: 40; left: 0; right: 0; bottom: 0;
    padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
    background: var(--toolbar-bg); -webkit-backdrop-filter: blur(30px) saturate(180%); backdrop-filter: blur(30px) saturate(180%);
    border-top: 1px solid var(--separator);
  }
  .tabbar a { display: flex; flex-direction: column; align-items: center; gap: 2px; min-height: 48px; justify-content: center; color: var(--text-2); font-size: var(--fs-caption); font-weight: 500; border-radius: 10px; }
  .tabbar a:hover { text-decoration: none; }
  .tabbar a .icon { width: 24px; height: 24px; }
  .tabbar a[aria-current="page"] { color: var(--accent-text); font-weight: 700; }
  body { padding-bottom: 74px; }
  .split { grid-template-columns: minmax(0, 1fr); }
  .list-pane { border-right: 0; }
  .list-pane .pane-head { top: var(--toolbar-h); }
  .preview-pane { display: none; }
  .reader-wrap, .detail-wrap { grid-template-columns: minmax(0, 1fr); }
  .inspector { display: none; }
  .toc-mobile { display: block; margin: 0 0 24px; border: 1px solid var(--separator); border-radius: 12px; background: var(--surface-2); }
  .toc-mobile summary { padding: 12px 14px; font-weight: 600; font-size: var(--fs-ui); cursor: pointer; min-height: 44px; }
  .toc-mobile .toc { padding: 0 8px 10px; }
  .hero-img, .codewin { margin-left: -16px; margin-right: -16px; border-radius: 0; }
  .site-foot { padding: 24px 16px; }
  .site-foot .cols { grid-template-columns: 1fr 1fr; }
  .site-foot .cols > :first-child, .site-foot .cols > :last-child { grid-column: 1 / -1; }
}
@media (min-width: 900px) and (max-width: 1099px) {
  :root { --sidebar-w: 232px; }
  .tb-search .field { width: 170px; }
  .content, .detail, .reader { padding: 28px 28px 44px; }
  .reader-wrap { grid-template-columns: minmax(0, 1fr); }
  .reader-wrap .inspector { display: none; }
  .reader-wrap .toc-mobile { display: block; margin: 0 0 24px; border: 1px solid var(--separator); border-radius: 12px; background: var(--surface-2); }
  .toc-mobile summary { padding: 12px 14px; font-weight: 600; cursor: pointer; }
  .hero-img, .codewin { margin-left: 0; margin-right: 0; }
  .detail-wrap { grid-template-columns: minmax(0, 1fr); }
  .detail-wrap .inspector { position: static; height: auto; border-left: 0; border-top: 1px solid var(--separator); }
}
@media (max-width: 1199px) {
  .shelf { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .shelf.four, .launch { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .books { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .welcome { grid-template-columns: 1fr; }
  .welcome .photo { min-height: 340px; }
  .trio { grid-template-columns: 1fr 1fr; }
  .trio .hire { grid-column: 1 / -1; }
  .app-rows { grid-template-columns: 1fr; }
  .shots { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .feature { grid-template-columns: 1fr; }
  .feature .f-art { min-height: 240px; }
  .threeways { grid-template-columns: 1fr; }
  .hero-img, .codewin { margin-left: 0; margin-right: 0; }
  .split { grid-template-columns: minmax(300px, 380px) minmax(0, 1fr); }
  .preview { padding: 28px; }
}
@media (max-width: 1199px) and (min-width: 900px) {
  .detail-wrap { grid-template-columns: minmax(0, 1fr) 260px; }
}
@media (max-width: 640px) {
  .shelf, .shelf.four, .trio, .two-col, .shots { grid-template-columns: 1fr; }
  .shelf.scroll { display: flex; overflow-x: auto; scroll-snap-type: x mandatory; gap: 14px; margin: 0 -16px; padding: 0 16px 8px; }
  .shelf.scroll > * { flex: 0 0 78%; scroll-snap-align: start; }
  .launch { grid-template-columns: 1fr 1fr; gap: 8px; }
  .launch a { padding: 14px 6px; }
  .launch .big-icon { width: 64px; height: 64px; border-radius: 15px; }
  .welcome .copy { padding: 26px 20px 24px; }
  .welcome .photo { min-height: 300px; }
  .spec dd { font-size: 1.25rem; }
  .spec div + div { padding-left: 10px; }
  .books { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
  .feature .f-copy { padding: 24px 20px; }
  .feature h2 { font-size: 1.75rem; }
  .app-row { grid-template-columns: 60px minmax(0, 1fr); }
  .app-row .thumb { width: 60px; height: 60px; border-radius: 14px; }
  .app-row .pill-btn { grid-column: 2; justify-self: start; }
  .section-head { flex-wrap: wrap; }
  .about-mac { padding: 28px 16px; }
  .about-mac h1 { font-size: 2rem; }
  .kv { grid-template-columns: 1fr; gap: 0; }
  .kv dt { text-align: left; margin-top: 8px; }
  .uses { columns: 1; }
  .banner { flex-wrap: wrap; }
  .pane { padding: 14px; }
  .stage { padding: 14px; }
  .finder-grid { grid-template-columns: 1fr; }
  .page-head h1, .large-title { font-size: 1.875rem; }
  .preview h2 { font-size: 1.5rem; }
  .ask .bubble { max-width: 100%; }
  .table .hide-s { display: none; }
}

/* ---------- Motion + transparency preferences ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; scroll-behavior: auto !important; }
}
@media (prefers-reduced-transparency: reduce) {
  .menubar, .sidebar, .toolbar, .tabbar, .mb-menu, .list-pane .pane-head { -webkit-backdrop-filter: none; backdrop-filter: none; }
  .sidebar { background: var(--sidebar-solid); }
  .toolbar, .tabbar, .list-pane .pane-head { background: var(--toolbar-solid); }
}
:root[data-transparency="off"] .sidebar { background: var(--sidebar-solid); -webkit-backdrop-filter: none; backdrop-filter: none; }
:root[data-transparency="off"] .toolbar, :root[data-transparency="off"] .tabbar, :root[data-transparency="off"] .list-pane .pane-head { background: var(--toolbar-solid); -webkit-backdrop-filter: none; backdrop-filter: none; }
@media print {
  .menubar, .sidebar, .toolbar, .tabbar, .inspector, .statusbar { display: none !important; }
  .window { display: block; box-shadow: none; margin: 0; }
}

/* Drawer close button only exists in the narrow drawer */
.sb-close { display: none; margin-left: auto; }
@media (max-width: 899px) {
  .traffic { display: none; }
  .sb-close { display: inline-flex; }
}

/* Paint the sidebar and inspector columns on their containers, so the
   material runs the full window height even where the sticky pane ends. */
.window { background: linear-gradient(to right, var(--sidebar-bg) 0 var(--sidebar-w), var(--window-bg) var(--sidebar-w)); }
.sidebar { background: transparent; }
.sidebar-collapsed .window { background: var(--window-bg); }
.reader-wrap { background: linear-gradient(to left, var(--surface-2) 0 280px, transparent 280px); }
.detail-wrap { background: linear-gradient(to left, var(--surface-2) 0 300px, transparent 300px); }
.inspector-hidden .reader-wrap { background: none; }
:root:not([data-theme="dark"]) { --sidebar-bg: rgba(232, 236, 241, 0.9); --text-3: #50555d; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --sidebar-bg: rgba(38, 40, 44, 0.86); --text-3: #a3a8b1; } }
:root[data-transparency="off"] .window { background: linear-gradient(to right, var(--sidebar-solid) 0 var(--sidebar-w), var(--window-bg) var(--sidebar-w)); }
@media (max-width: 1099px) and (min-width: 900px) {
  .reader-wrap { background: none; }
  .detail-wrap { background: linear-gradient(to left, var(--surface-2) 0 260px, transparent 260px); }
}
@media (max-width: 899px) {
  .window { background: var(--window-bg); }
  .sidebar { background: var(--sidebar-solid); }
  .reader-wrap, .detail-wrap { background: none; }
}
@media (max-width: 640px) {
  .hide-s { display: none; }
  .shelf.scroll { scroll-padding-inline: 16px; }
}

[hidden] { display: none !important; }
.threeways > .group, .two-col > .group { margin-top: 0; }
/* Five filter tiles: flex-wrap so a wrapped row grows to fill, never leaving an empty cell */
.hss-strip.five { display: flex; flex-wrap: wrap; }
.hss-strip.five .hss-tile { flex: 1 1 7rem; }

.prose-fig { margin: 1.4em 0; border-radius: 12px; overflow: hidden; box-shadow: 0 0 0 1px var(--separator); }
.prose-fig img { display: block; width: 100%; height: auto; }
.prose blockquote.callout { margin-inline: 0; }
.callout > div > p + p { margin-top: .7em; }
.prose code { overflow-wrap: anywhere; }
