/* JorgeOS — macOS Catalina (10.15) inspired desktop.
   Tokens resolve the DESIGN.md contradictions in one place (see docs/decisions.md). */

/* ============================================================ tokens */
:root {
  color-scheme: light;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;

  --accent: #007aff;
  --accent-press: #0062cc;
  --accent-text: #0060d6;          /* accent used as text on white: 5.3:1 */
  --focus-ring: 0 0 0 3px rgba(0, 122, 255, .45);

  --canvas: #ffffff;
  --text: rgba(0, 0, 0, .87);
  --text-2: #5c5c62;               /* 6.4:1 on white */
  --separator: rgba(0, 0, 0, .1);
  --chrome: rgba(246, 246, 246, .82);
  --chrome-solid: #ececec;
  --chrome-top: #f6f6f6;
  --chrome-bottom: #e4e4e4;
  --chrome-inactive: #f6f6f6;
  --sidebar: rgba(238, 238, 241, .72);
  --sidebar-solid: #e9e9ec;
  --menubar: rgba(246, 246, 248, .78);
  --menubar-solid: #ececee;
  --dock: rgba(246, 246, 248, .5);
  --dock-solid: #e4e6ea;
  --dock-rim: rgba(255, 255, 255, .55);
  --stage: #d6d7db;                 /* Preview grey behind the paper */
  --row-alt: #f4f5f5;
  --selection-soft: #dcdce0;
  --btn-top: #ffffff;
  --btn-bottom: #f0f0f0;
  --btn-border: rgba(0, 0, 0, .2);
  --field: #ffffff;
  --field-border: rgba(0, 0, 0, .2);
  --popover: rgba(246, 246, 248, .94);
  --popover-solid: #f4f4f6;
  --wallpaper-tint: none;

  --tl-close: #ff5f56; --tl-close-rim: #e0443e;
  --tl-min: #ffbd2e;   --tl-min-rim: #dea123;
  --tl-zoom: #27c93f;  --tl-zoom-rim: #1aab29;
  --tl-off: #d0d0d2;

  --r-window: 9px;
  --r-control: 5px;
  --r-popover: 6px;
  --menubar-h: 26px;
  --titlebar-h: 30px;
  --toolbar-h: 42px;
  --row-h: 30px;
  --sidebar-w: 212px;

  --shadow-active: 0 0 0 .5px rgba(0, 0, 0, .22), 0 22px 46px rgba(0, 0, 0, .3), 0 6px 14px rgba(0, 0, 0, .14);
  --shadow-inactive: 0 0 0 .5px rgba(0, 0, 0, .14), 0 10px 22px rgba(0, 0, 0, .16);
  --shadow-pop: 0 10px 28px rgba(0, 0, 0, .2), 0 0 0 .5px rgba(0, 0, 0, .14);

  --dur-quick: 150ms;
  --dur-fast: 200ms;
  --ease-out: cubic-bezier(.22, 1, .36, 1);

  --z-wall: 0; --z-icons: 1; --z-windows: 10; --z-dock: 1000; --z-menubar: 1010; --z-menu: 1020;
}

:root[data-theme="dark"] { color-scheme: dark; }
@media (prefers-color-scheme: dark) { :root[data-theme="system"] { color-scheme: dark; } }

/* Dark tokens: applied by explicit choice or by system when no choice. */
@media (prefers-color-scheme: dark) {
  :root[data-theme="system"] {
    --accent: #0a84ff; --accent-press: #0071e3; --accent-text: #4aa3ff;
    --canvas: #1e1e1e; --text: rgba(255, 255, 255, .88); --text-2: #a8a8ad;
    --separator: rgba(255, 255, 255, .12);
    --chrome: rgba(52, 52, 54, .84); --chrome-solid: #333335; --chrome-top: #3a3a3c; --chrome-bottom: #2f2f31; --chrome-inactive: #2c2c2e;
    --sidebar: rgba(40, 40, 42, .74); --sidebar-solid: #29292b;
    --menubar: rgba(30, 30, 32, .7); --menubar-solid: #222224;
    --dock: rgba(40, 40, 42, .52); --dock-solid: #2b2b2e; --dock-rim: rgba(255, 255, 255, .14);
    --stage: #2a2a2c; --row-alt: #252527; --selection-soft: #3a3a3d;
    --btn-top: #5a5a5d; --btn-bottom: #4a4a4d; --btn-border: rgba(0, 0, 0, .45);
    --field: #2a2a2c; --field-border: rgba(255, 255, 255, .16);
    --popover: rgba(44, 44, 46, .94); --popover-solid: #2c2c2e;
    --tl-off: #4c4c4f;
    --wallpaper-tint: brightness(.62) saturate(.9);
  }
}
:root[data-theme="dark"] {
  --accent: #0a84ff; --accent-press: #0071e3; --accent-text: #4aa3ff;
  --canvas: #1e1e1e; --text: rgba(255, 255, 255, .88); --text-2: #a8a8ad;
  --separator: rgba(255, 255, 255, .12);
  --chrome: rgba(52, 52, 54, .84); --chrome-solid: #333335; --chrome-top: #3a3a3c; --chrome-bottom: #2f2f31; --chrome-inactive: #2c2c2e;
  --sidebar: rgba(40, 40, 42, .74); --sidebar-solid: #29292b;
  --menubar: rgba(30, 30, 32, .7); --menubar-solid: #222224;
  --dock: rgba(40, 40, 42, .52); --dock-solid: #2b2b2e; --dock-rim: rgba(255, 255, 255, .14);
  --stage: #2a2a2c; --row-alt: #252527; --selection-soft: #3a3a3d;
  --btn-top: #5a5a5d; --btn-bottom: #4a4a4d; --btn-border: rgba(0, 0, 0, .45);
  --field: #2a2a2c; --field-border: rgba(255, 255, 255, .16);
  --popover: rgba(44, 44, 46, .94); --popover-solid: #2c2c2e;
  --tl-off: #4c4c4f;
  --wallpaper-tint: brightness(.62) saturate(.9);
}

/* ============================================================ base */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0;
  font: 14px/1.5 var(--font);
  color: var(--text);
  background: #c9d6df linear-gradient(180deg, #a9c6dd 0%, #d9d6cf 60%, #6c8193 100%);
  -webkit-font-smoothing: antialiased;
}
:root[data-theme="dark"] body { background: #1a1d22; }
@media (prefers-color-scheme: dark) { :root[data-theme="system"] body { background: #1a1d22; } }
img { max-width: 100%; height: auto; }
a { color: var(--accent-text); text-underline-offset: .18em; }
button, input, select, textarea { font: inherit; color: inherit; }
::selection { background: color-mix(in srgb, var(--accent) 32%, transparent); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.sr-only { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.icon-sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
[hidden] { display: none !important; }
.muted { color: var(--text-2); }
.glyph { width: 16px; height: 16px; flex: none; }
.app-icon { width: 48px; height: 48px; flex: none; }

.skip-link { position: fixed; left: 12px; top: -60px; z-index: 2000; padding: 8px 14px; background: var(--canvas); color: var(--text); border-radius: var(--r-control); box-shadow: var(--shadow-pop); }
.skip-link:focus { top: 34px; }

/* Buttons: Catalina push buttons, compact and silver. */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 28px; padding: 3px 12px;
  border: .5px solid var(--btn-border); border-radius: var(--r-control);
  background: linear-gradient(var(--btn-top), var(--btn-bottom));
  box-shadow: 0 .5px 1px rgba(0, 0, 0, .12);
  color: var(--text); font-size: 13px; line-height: 1.2; text-decoration: none; cursor: pointer; white-space: nowrap;
}
.btn:active { filter: brightness(.94); }
.btn-primary { background: linear-gradient(#0a72e6, #0060d6); border-color: rgba(0, 60, 140, .5); color: #fff; box-shadow: inset 0 .5px 0 rgba(255, 255, 255, .3), 0 .5px 1px rgba(0, 0, 0, .15); }
.btn-primary:active { background: #0055c0; filter: none; }
.btn-small { min-height: 24px; padding: 2px 9px; font-size: 12px; }
.btn .ext { width: 12px; height: 12px; opacity: .7; }
.link-button { background: none; border: 0; padding: 0; color: var(--accent-text); text-decoration: underline; text-underline-offset: .18em; cursor: pointer; }

.segmented { display: inline-flex; padding: 1px; gap: 1px; border-radius: calc(var(--r-control) + 1px); background: linear-gradient(#e9e9eb, #dcdcde); box-shadow: inset 0 0 0 .5px rgba(0, 0, 0, .14); }
:root[data-theme="dark"] .segmented { background: #2a2a2c; }
@media (prefers-color-scheme: dark) { :root[data-theme="system"] .segmented { background: #2a2a2c; } }

/* ============================================================ desktop shell */
html.js:not(.show-linear) body { overflow: hidden; }
html.js:not(.show-linear) .linear { display: none; }
#os { position: fixed; inset: 0; overflow: hidden; }
.desk { position: absolute; inset: 0; }

.wallpaper {
  position: absolute; inset: 0; z-index: var(--z-wall);
  background: #e9c9a3 url("../assets/img/wallpaper.webp") 58% 62% / cover no-repeat;
  filter: var(--wallpaper-tint);
}

/* Menu bar */
.menubar {
  position: absolute; inset: 0 0 auto; z-index: var(--z-menubar);
  height: var(--menubar-h); display: flex; align-items: center; justify-content: space-between;
  padding: 0 8px; font-size: 13px;
  background: var(--menubar); -webkit-backdrop-filter: saturate(180%) blur(20px); backdrop-filter: saturate(180%) blur(20px);
  box-shadow: 0 .5px 0 rgba(0, 0, 0, .14);
}
.menubar-left, .menubar-right, .menu-list { display: flex; align-items: center; height: 100%; margin: 0; padding: 0; list-style: none; }
.menubar-right { gap: 2px; }
.menu { position: relative; height: 100%; display: flex; align-items: center; }
.menu-button, .mb-btn {
  height: 24px; min-width: 24px; padding: 0 9px; display: inline-flex; align-items: center; gap: 4px;
  border: 0; border-radius: 4px; background: none; cursor: default; font-size: 13px;
}
.menu-button[aria-expanded="true"], .menu-button:hover, .mb-btn:hover { background: color-mix(in srgb, var(--text) 10%, transparent); }
.menu-button[aria-expanded="true"] { background: var(--accent); color: #fff; }
.menu-system .menu-button { padding: 0 10px; }
.logo { width: 15px; height: 15px; stroke-width: 2; }
.menubar-app { font-weight: 700; padding: 0 9px 0 4px; white-space: nowrap; }
.mb-text { font-size: 12.5px; }
.mb-btn b { font-weight: 700; }
.clock { padding: 0 8px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.menu-pop {
  position: absolute; top: calc(100% + 1px); left: 0; z-index: var(--z-menu);
  min-width: 220px; margin: 0; padding: 5px; list-style: none;
  background: var(--popover); -webkit-backdrop-filter: blur(24px) saturate(160%); backdrop-filter: blur(24px) saturate(160%);
  border-radius: var(--r-popover); box-shadow: var(--shadow-pop);
  animation: pop-in var(--dur-quick) var(--ease-out);
}
.menu-pop button {
  display: flex; width: 100%; min-height: 24px; align-items: center; padding: 2px 10px 2px 22px; position: relative;
  border: 0; border-radius: 4px; background: none; text-align: left; font-size: 13px; cursor: default;
}
.menu-pop button:focus { background: var(--accent); color: #fff; outline: none; }
.menu-pop button[aria-disabled="true"] { color: var(--text-2); opacity: .7; }
.menu-pop button[aria-disabled="true"]:focus { background: var(--selection-soft); color: var(--text); }
.menu-pop [aria-checked="true"]::before { content: "✓"; position: absolute; left: 7px; }
.menu-sep { height: 1px; margin: 5px 8px; background: var(--separator); }
.context-menu { position: fixed; top: 0; left: 0; z-index: var(--z-menu); min-width: 230px; }

/* Desktop selection rectangle */
.marquee { position: fixed; z-index: 5; pointer-events: none; border: 1px solid rgba(255, 255, 255, .75); background: rgba(160, 170, 185, .28); border-radius: 2px; }
.desk-icon.is-selected:focus-visible { outline-color: #fff; }

/* HUD: short confirmations such as "Link copied" */
.hud {
  position: fixed; left: 50%; bottom: 110px; z-index: var(--z-menu); translate: -50% 8px;
  padding: 10px 18px; border-radius: 12px; font-size: 14px; font-weight: 500; color: #fff;
  background: rgba(40, 40, 44, .82); -webkit-backdrop-filter: blur(20px); backdrop-filter: blur(20px);
  opacity: 0; pointer-events: none; transition: opacity var(--dur-fast) var(--ease-out), translate var(--dur-fast) var(--ease-out);
}
.hud.is-on { opacity: 1; translate: -50% 0; }

/* Desktop icons, right column like the Stitch home screen */
.desktop-icons {
  position: absolute; z-index: var(--z-icons); top: calc(var(--menubar-h) + 14px); right: 14px; bottom: 96px;
  margin: 0; padding: 0; list-style: none;
  display: flex; flex-direction: column; flex-wrap: wrap-reverse; align-content: flex-start; gap: 6px 4px;
}
.desk-icon {
  width: 96px; padding: 6px 4px 4px; display: flex; flex-direction: column; align-items: center; gap: 4px;
  border: 0; border-radius: 6px; background: none; cursor: default; color: #fff;
}
.desk-icon .app-icon { width: 56px; height: 56px; padding: 2px; border-radius: 6px; }
.desk-label { font-size: 12px; line-height: 1.25; font-weight: 500; text-align: center; padding: 1px 5px; border-radius: 4px; text-shadow: 0 1px 2px rgba(0, 0, 0, .9), 0 0 3px rgba(0, 0, 0, .7), 0 0 8px rgba(0, 0, 0, .45); overflow-wrap: anywhere; }
.desk-icon.is-selected .app-icon { background: rgba(0, 0, 0, .28); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .25); }
.desk-icon.is-selected .desk-label { background: var(--accent); text-shadow: none; }
.desk-icon:focus-visible { outline: 2px solid #fff; outline-offset: 0; }

/* Dock */
.dock {
  position: absolute; z-index: var(--z-dock); left: 50%; bottom: max(6px, env(safe-area-inset-bottom)); transform: translateX(-50%);
  padding: 4px 6px 3px; border-radius: 16px;
  background: var(--dock); -webkit-backdrop-filter: blur(28px) saturate(170%); backdrop-filter: blur(28px) saturate(170%);
  box-shadow: 0 10px 30px rgba(0, 0, 0, .22), inset 0 0 0 .5px var(--dock-rim), 0 0 0 .5px rgba(0, 0, 0, .14);
}
.dock ul { display: flex; align-items: flex-end; gap: 4px; margin: 0; padding: 0; list-style: none; }
.dock button {
  --mag: 1;
  position: relative; display: grid; place-items: center; width: 56px; height: 62px; padding: 2px 0 8px;
  border: 0; background: none; cursor: default; border-radius: 10px;
}
.dock .dock-icon, .dock .dock-tile {
  width: 52px; height: 52px; transform: scale(var(--mag)); transform-origin: 50% 100%;
  transition: transform 90ms linear;
}
.dock-tile { display: grid; place-items: center; border-radius: 12px; background: linear-gradient(#fdfdfd, #d9dce1); box-shadow: 0 1px 2px rgba(0, 0, 0, .3); color: #3b3f46; }
.dock-glyph { width: 26px; height: 26px; }
.dock-dot { position: absolute; bottom: 1px; width: 4px; height: 4px; border-radius: 50%; background: transparent; }
.dock-dot.on { background: color-mix(in srgb, var(--text) 80%, transparent); }
.dock-sep { width: 1px; align-self: stretch; margin: 6px 3px 10px; background: color-mix(in srgb, var(--text) 25%, transparent); }
.dock-label {
  position: absolute; bottom: calc(100% + 10px); left: 50%; transform: translateX(-50%);
  padding: 3px 10px; border-radius: 5px; white-space: nowrap; font-size: 13px;
  background: var(--popover-solid); color: var(--text); box-shadow: var(--shadow-pop);
  opacity: 0; pointer-events: none; transition: opacity var(--dur-quick) ease-out;
}
.dock button:hover .dock-label, .dock button:focus-visible .dock-label { opacity: 1; }
.dock button:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }

/* ============================================================ windows */
.windows { position: absolute; inset: 0; z-index: var(--z-windows); pointer-events: none; }
.window {
  position: absolute; top: 0; left: 0; pointer-events: auto;
  display: flex; flex-direction: column; min-width: 0;
  background: var(--canvas); border-radius: var(--r-window); box-shadow: var(--shadow-inactive);
  transition: opacity var(--dur-fast) var(--ease-out), scale var(--dur-fast) var(--ease-out), translate var(--dur-fast) var(--ease-out);
}
.window.is-focused { box-shadow: var(--shadow-active); }
.window:focus { outline: none; }
.window:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.window { animation: win-open var(--dur-fast) var(--ease-out); }
@keyframes win-open { from { opacity: 0; scale: .96; } }
.window.is-closing { opacity: 0; scale: .97; transition-duration: var(--dur-quick); pointer-events: none; }
.window.is-dragging { transition: none; user-select: none; }
.window.is-maximized { border-radius: 0; }

.win-chrome {
  flex: none; display: grid; grid-template-columns: auto 1fr auto; grid-template-areas: "traffic title end"; align-items: center;
  height: var(--titlebar-h); padding: 0 8px; position: relative;
  border-radius: var(--r-window) var(--r-window) 0 0;
  background: linear-gradient(var(--chrome-top), var(--chrome-bottom));
  box-shadow: inset 0 .5px 0 rgba(255, 255, 255, .7), inset 0 -.5px 0 rgba(0, 0, 0, .14);
  cursor: default; user-select: none; touch-action: none;
}
.window:not(.is-focused) .win-chrome { background: var(--chrome-inactive); }
.window.is-maximized .win-chrome { border-radius: 0; }
.traffic { grid-area: traffic; display: flex; }
.tl { width: 24px; height: 24px; display: grid; place-items: center; padding: 0; border: 0; background: none; cursor: default; }
.tl span { width: 12px; height: 12px; border-radius: 50%; position: relative; }
.tl-close span { background: var(--tl-close); box-shadow: inset 0 0 0 .5px var(--tl-close-rim); }
.tl-min span { background: var(--tl-min); box-shadow: inset 0 0 0 .5px var(--tl-min-rim); }
.tl-zoom span { background: var(--tl-zoom); box-shadow: inset 0 0 0 .5px var(--tl-zoom-rim); }
.window:not(.is-focused) .traffic:not(:hover) .tl span { background: var(--tl-off); box-shadow: inset 0 0 0 .5px rgba(0, 0, 0, .12); }
.tl span::before, .tl span::after { content: ""; position: absolute; inset: 0; margin: auto; opacity: 0; background: rgba(0, 0, 0, .55); border-radius: 1px; }
.traffic:hover .tl span::before, .traffic:hover .tl span::after, .tl:focus-visible span::before, .tl:focus-visible span::after { opacity: 1; }
.tl-close span::before, .tl-close span::after { width: 7px; height: 1.2px; }
.tl-close span::before { rotate: 45deg; } .tl-close span::after { rotate: -45deg; }
.tl-min span::before { width: 7px; height: 1.2px; } .tl-min span::after { display: none; }
/* Zoom: two small triangles pointing to opposite corners (Catalina's full-screen glyph). */
.tl-zoom span::before, .tl-zoom span::after { width: 3.4px; height: 3.4px; margin: 0; border-radius: 0; background: rgba(0, 0, 0, .55); }
.tl-zoom span::before { inset: 3px auto auto 3px; clip-path: polygon(0 0, 100% 0, 0 100%); }
.tl-zoom span::after { inset: auto 3px 3px auto; clip-path: polygon(100% 0, 100% 100%, 0 100%); }
.tl:focus-visible { outline-offset: -3px; border-radius: 50%; }
.win-title { grid-area: title; margin: 0; padding: 0 8px; font-size: 13px; font-weight: 600; text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--text); }
.window:not(.is-focused) .win-title { color: var(--text-2); }
.win-toolbar { display: none; }

/* Unified title + toolbar for Finder and Preview */
.window.has-toolbar .win-chrome {
  height: auto; min-height: calc(var(--titlebar-h) + var(--toolbar-h) - 6px);
  grid-template-columns: auto 1fr; grid-template-areas: "traffic title" "tools tools"; row-gap: 2px; padding-bottom: 7px;
}
.window.has-toolbar .win-title { padding-right: 80px; }
.window.has-toolbar .win-toolbar { grid-area: tools; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 0 2px; }
.tb-group { display: flex; gap: 2px; align-items: center; }
.tb-end { margin-left: auto; }
.tb-btn {
  height: 26px; min-width: 32px; padding: 0 8px; display: inline-flex; align-items: center; justify-content: center; gap: 5px;
  border: .5px solid var(--btn-border); border-radius: var(--r-control);
  background: linear-gradient(var(--btn-top), var(--btn-bottom)); box-shadow: 0 .5px 1px rgba(0, 0, 0, .1);
  font-size: 12.5px; text-decoration: none; color: var(--text); cursor: default;
}
.tb-btn:disabled { opacity: .45; }
.segmented .tb-btn { border: 0; box-shadow: none; background: transparent; border-radius: var(--r-control); }
.segmented .tb-btn[aria-pressed="true"] { background: var(--btn-top); box-shadow: 0 .5px 1.5px rgba(0, 0, 0, .2); }
.tb-text { font-weight: 500; }
.tb-search { position: relative; margin-left: auto; flex: 0 1 230px; min-width: 140px; }
.tb-search .glyph { position: absolute; left: 7px; top: 50%; translate: 0 -50%; width: 13px; height: 13px; color: var(--text-2); pointer-events: none; }
.tb-search input, .field input, .field textarea {
  width: 100%; height: 26px; padding: 0 8px 0 26px; border: .5px solid var(--field-border); border-radius: var(--r-control);
  background: var(--field); font-size: 13px;
}
.tb-search input:focus, .field input:focus, .field textarea:focus { outline: none; box-shadow: var(--focus-ring); border-color: var(--accent); }
.tb-sidebar { display: none; }

.window { container-type: inline-size; }
.win-body { flex: 1; min-height: 0; display: flex; flex-direction: column; border-radius: 0 0 var(--r-window) var(--r-window); overflow: hidden; }
.window.is-maximized .win-body { border-radius: 0; }
.doc-scroll { overflow: auto; overscroll-behavior: contain; }
.statusbar { flex: none; margin: 0; padding: 4px 12px; display: flex; gap: 10px; align-items: center; border-top: .5px solid var(--separator); background: var(--chrome-solid); font-size: 12px; color: var(--text-2); white-space: nowrap; overflow: hidden; }
.statusbar .muted { overflow: hidden; text-overflow: ellipsis; }
.sb-icon { width: 13px; height: 13px; }

/* Resize handles */
.rz { position: absolute; z-index: 2; touch-action: none; }
.rz-n, .rz-s { left: 8px; right: 8px; height: 8px; cursor: ns-resize; }
.rz-n { top: -4px; } .rz-s { bottom: -4px; }
.rz-e, .rz-w { top: 8px; bottom: 8px; width: 8px; cursor: ew-resize; }
.rz-e { right: -4px; } .rz-w { left: -4px; }
.rz-ne, .rz-nw, .rz-se, .rz-sw { width: 14px; height: 14px; }
.rz-ne { top: -5px; right: -5px; cursor: nesw-resize; } .rz-sw { bottom: -5px; left: -5px; cursor: nesw-resize; }
.rz-nw { top: -5px; left: -5px; cursor: nwse-resize; } .rz-se { bottom: -5px; right: -5px; cursor: nwse-resize; }
.window.is-maximized .rz { display: none; }

/* ============================================================ shared app pieces */
.sidebar { background: var(--sidebar); -webkit-backdrop-filter: blur(20px); backdrop-filter: blur(20px); border-right: .5px solid var(--separator); padding: 8px 8px; overflow: auto; }
.sidebar ul { margin: 0; padding: 0; list-style: none; }
.side-head { margin: 12px 8px 4px; font-size: 11px; font-weight: 700; letter-spacing: .02em; color: var(--text-2); }
.side-item {
  width: 100%; min-height: 28px; display: flex; align-items: center; gap: 8px; padding: 3px 8px;
  border: 0; border-radius: 5px; background: none; font-size: 13px; text-align: left; cursor: default;
}
.side-item .glyph { color: var(--accent); width: 15px; height: 15px; }
.side-item:hover { background: color-mix(in srgb, var(--text) 6%, transparent); }
.side-item.is-active { background: var(--selection-soft); font-weight: 600; }
.window.is-focused .side-item.is-active { background: var(--accent); color: #fff; }
.window.is-focused .side-item.is-active .glyph, .window.is-focused .side-item.is-active .count { color: #fff; }
.count { margin-left: auto; font-size: 12px; color: var(--text-2); font-variant-numeric: tabular-nums; }
.tool-dot { width: 8px; height: 8px; border-radius: 50%; background: color-mix(in srgb, var(--text) 35%, transparent); margin: 0 3px; flex: none; }
.chips { display: flex; flex-wrap: wrap; gap: 5px; margin: 0; padding: 0; list-style: none; }
.chips li { padding: 1px 8px; border-radius: 4px; font-size: 12px; background: color-mix(in srgb, var(--accent) 11%, var(--canvas)); color: var(--text); border: .5px solid color-mix(in srgb, var(--accent) 25%, transparent); }

/* Finder */
.finder { flex: 1; min-height: 0; display: grid; grid-template-columns: var(--sidebar-w) minmax(0, 1fr) 300px; }
.finder.show-page { grid-template-columns: var(--sidebar-w) minmax(0, 1fr); }
.finder-main { min-width: 0; display: flex; flex-direction: column; min-height: 0; }
.finder-list { flex: 1; overflow: auto; }
.list-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.list-table th { position: sticky; top: 0; z-index: 1; background: var(--canvas); text-align: left; font-weight: 400; border-bottom: .5px solid var(--separator); padding: 0; }
.th-btn { width: 100%; height: 26px; display: flex; align-items: center; gap: 4px; padding: 0 10px; border: 0; border-right: .5px solid var(--separator); background: none; font-size: 12px; color: var(--text-2); cursor: default; }
th[aria-sort="ascending"] .th-btn, th[aria-sort="descending"] .th-btn { color: var(--text); font-weight: 600; }
.th-btn .glyph { width: 11px; height: 11px; }
.sort-desc { rotate: 180deg; }
.list-table td { padding: 0 10px; height: var(--row-h); white-space: nowrap; color: var(--text-2); }
.list-table td:first-child { padding: 0 2px; color: var(--text); }
.list-table tbody tr:nth-child(even) { background: var(--row-alt); }
.list-table tr.is-selected { background: var(--selection-soft) !important; }
.window.is-focused .list-table tr.is-selected { background: var(--accent) !important; }
.window.is-focused .list-table tr.is-selected td { color: #fff; }
.num { font-variant-numeric: tabular-nums; }
.row-btn { width: 100%; height: 28px; display: flex; align-items: center; gap: 7px; padding: 0 8px; border: 0; background: none; font-size: 13px; text-align: left; cursor: default; color: inherit; }
.row-icon { width: 20px; height: 20px; }
.row-btn:focus-visible { outline-offset: -2px; border-radius: 4px; }
.window.is-focused .is-selected .row-btn:focus-visible { outline-color: #fff; }
.icon-grid { display: flex; flex-wrap: wrap; gap: 8px; margin: 0; padding: 18px; list-style: none; }
.icon-grid .item { width: 128px; padding: 10px 6px; display: flex; flex-direction: column; align-items: center; gap: 6px; border: 0; border-radius: 6px; background: none; font-size: 12.5px; text-align: center; cursor: default; }
.icon-grid .app-icon { width: 64px; height: 64px; }
.icon-grid .item.is-selected { background: var(--selection-soft); }
.window.is-focused .icon-grid .item.is-selected span { background: var(--accent); color: #fff; border-radius: 4px; padding: 0 5px; }
.empty { display: grid; place-items: center; align-content: center; gap: 10px; height: 100%; min-height: 200px; padding: 24px; text-align: center; color: var(--text-2); }
.inspector { border-left: .5px solid var(--separator); padding: 14px 16px 18px; background: var(--canvas); }
.inspector-empty { padding-top: 40px; text-align: center; }
.insp-thumb { margin: 0 0 12px; border-radius: 6px; overflow: hidden; box-shadow: 0 0 0 .5px var(--separator), 0 2px 8px rgba(0, 0, 0, .12); background: var(--row-alt); }
.insp-thumb img { display: block; width: 100%; }
.insp-name { margin: 0; font-size: 16px; font-weight: 600; line-height: 1.3; }
.insp-kind { margin: 2px 0 10px; font-size: 12.5px; }
.insp-summary { margin: 0 0 12px; font-size: 13.5px; }
.insp-actions { display: grid; gap: 7px; margin-top: 14px; }
.insp-actions .btn { justify-content: flex-start; }
.insp-actions .btn-primary { justify-content: center; }

.project-page { flex: 1; padding: 24px max(clamp(18px, 4cqi, 40px), calc((100% - 900px) / 2)) 40px; }
.project-page > * { max-width: 70ch; }
.pp-head { display: flex; gap: 14px; align-items: center; }
.pp-icon { width: 52px; height: 52px; }
.pp-head h3 { margin: 0; font-size: 22px; line-height: 1.2; font-weight: 700; letter-spacing: -.01em; }
.pp-head p { margin: 2px 0 0; font-size: 13px; }
.pp-lead { font-size: 16px; margin: 16px 0 14px; }
.pp-links { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.pp-figure { margin: 22px 0; max-width: none; }
.pp-figure img { display: block; width: 100%; max-width: 900px; border-radius: 6px; box-shadow: 0 0 0 .5px var(--separator), 0 3px 12px rgba(0, 0, 0, .14); background: #fff; }
.pp-figure figcaption { margin-top: 6px; font-size: 12.5px; color: var(--text-2); }
.pp-section h4 { margin: 22px 0 4px; font-size: 15px; font-weight: 650; }
.pp-section p { margin: 0; font-size: 15px; line-height: 1.6; }

/* About */
.about { flex: 1; padding: 26px max(30px, calc((100% - 720px) / 2)); }
.window.is-maximized .about { padding-top: max(26px, 6vh); }
.about-top { display: grid; grid-template-columns: 148px 1fr; gap: 28px; align-items: start; }
.about-portrait { width: 148px; height: 148px; border-radius: 50%; object-fit: cover; box-shadow: 0 0 0 .5px var(--separator), 0 4px 14px rgba(0, 0, 0, .16); }
.about-name { margin: 0; font-size: 28px; font-weight: 700; line-height: 1.1; letter-spacing: -.015em; }
.about-role { margin: 4px 0 14px; color: var(--text-2); font-size: 14px; }
.about-facts { display: grid; grid-template-columns: max-content 1fr; gap: 3px 12px; margin: 0 0 18px; font-size: 13px; }
.about-facts dt { font-weight: 600; text-align: right; }
.about-facts dd { margin: 0; }
.about-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.about-bio { margin-top: 22px; padding-top: 16px; border-top: .5px solid var(--separator); font-size: 14.5px; }
.about-bio p { margin: 0 0 10px; }
.about-now { font-size: 13.5px; }

/* Experience / Education documents */
.doc { flex: 1; padding: 22px max(28px, calc((100% - 680px) / 2)) 26px; }
.window.is-maximized .doc { padding-top: max(22px, 5vh); }
.timeline { margin: 0; padding: 0; list-style: none; }
.timeline li { display: grid; grid-template-columns: 150px 1fr; gap: 18px; padding: 14px 0; border-bottom: .5px solid var(--separator); }
.timeline li:last-child { border-bottom: 0; }
.tl-dates { font-size: 12.5px; color: var(--text-2); font-variant-numeric: tabular-nums; padding-top: 2px; }
.timeline h3 { margin: 0; font-size: 15px; font-weight: 650; }
.tl-role { margin: 0 0 4px; font-size: 13px; color: var(--text-2); }
.timeline p { margin: 0; font-size: 14px; max-width: 62ch; }
.doc-foot { margin: 16px 0 0; font-size: 13px; }

/* Experience & Education: LinkedIn-style rows. The logo is centred on the heading block. */
.jobs { margin: 0; padding: 0; list-style: none; }
.jobs li { display: grid; grid-template-columns: 56px 1fr; column-gap: 16px; align-items: center; padding: 14px 0; border-bottom: .5px solid var(--separator); }
.jobs li:first-child { padding-top: 4px; }
.jobs li:last-child { border-bottom: 0; }
.job-logo { display: block; width: 56px; height: 56px; border-radius: 10px; background: #fff; box-shadow: 0 0 0 .5px rgba(0, 0, 0, .16), 0 1px 3px rgba(0, 0, 0, .1); }
.job-head h3 { margin: 0; font-size: 15px; font-weight: 650; line-height: 1.3; }
.job-role { margin: 1px 0 0; font-size: 14px; line-height: 1.35; }
.job-dates { margin: 2px 0 0; font-size: 12.5px; color: var(--text-2); font-variant-numeric: tabular-nums; }
.job-body { grid-column: 2; margin: 8px 0 0; font-size: 14px; max-width: 62ch; }
.doc-section { margin: 4px 0 6px; font-size: 12px; font-weight: 700; letter-spacing: .02em; text-transform: uppercase; color: var(--text-2); }
section + section .doc-section { margin-top: 22px; }

/* Skills (System Information) */
.split { flex: 1; min-height: 0; display: grid; grid-template-columns: 220px minmax(0, 1fr); }
.pane { padding: 16px 20px; }
.pane > * { max-width: 760px; }
.pane-title { margin: 0 0 10px; font-size: 15px; font-weight: 650; }
.data-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.data-table th, .data-table td { text-align: left; vertical-align: top; padding: 7px 10px; border-bottom: .5px solid var(--separator); }
.data-table thead th { font-size: 12px; font-weight: 500; color: var(--text-2); }
.data-table tbody th { font-weight: 600; white-space: nowrap; }
.data-table tbody tr:nth-child(even) { background: var(--row-alt); }

/* Preview */
.preview { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.preview-stage { flex: 1; background: var(--stage); padding: 18px; display: flex; justify-content: center; }
.pdf-frame { position: relative; width: 100%; max-width: 860px; min-height: 100%; display: flex; flex-direction: column; }
.pdf-frame iframe { flex: 1; width: 100%; min-height: 520px; border: 0; background: #fff; box-shadow: 0 0 0 .5px rgba(0, 0, 0, .2), 0 4px 18px rgba(0, 0, 0, .2); }
.pdf-status { position: absolute; top: 40%; left: 0; right: 0; text-align: center; margin: 0; }
.pdf-error { color: var(--text); background: var(--canvas); padding: 14px; border-radius: 6px; max-width: 420px; margin: auto; box-shadow: var(--shadow-pop); }
.pdf-fallback { align-self: center; max-width: 420px; text-align: center; background: var(--canvas); padding: 20px; border-radius: 8px; box-shadow: var(--shadow-pop); }
.paper { width: 100%; max-width: 760px; align-self: flex-start; background: #fff; color: #1d1d1f; padding: 40px clamp(20px, 6cqi, 56px); box-shadow: 0 0 0 .5px rgba(0, 0, 0, .2), 0 4px 18px rgba(0, 0, 0, .2); }
.paper .muted { color: #5c5c62; }
.paper a { color: #0060d6; }
.cv-text h3 { margin: 0; font-size: 24px; }
.cv-text h4 { margin: 22px 0 6px; font-size: 13px; text-transform: uppercase; letter-spacing: .04em; color: #1d4f8c; }
.cv-text ul { margin: 0; padding-left: 18px; font-size: 14px; }
.cv-text li { margin-bottom: 6px; }

/* Mail · Contact: Catalina compose window */
.mail { flex: 1; min-height: 0; display: flex; flex-direction: column; background: var(--canvas); }
.mail { --mail-pad: max(16px, calc((100% - 760px) / 2)); }
.mail-from { display: flex; gap: 12px; align-items: center; padding: 12px var(--mail-pad); border-bottom: .5px solid var(--separator); }
.mail-avatar { width: 40px; height: 40px; border-radius: 50%; object-fit: cover; flex: none; box-shadow: 0 0 0 .5px var(--separator); }
.mail-name { margin: 0; font-size: 13.5px; font-weight: 600; }
.mail-name .muted { font-weight: 400; }
.mail-intro { margin: 2px 0 0; font-size: 13px; color: var(--text-2); }
.compose-row { display: flex; align-items: center; gap: 8px; min-height: 34px; padding: 0 var(--mail-pad); border-bottom: .5px solid var(--separator); font-size: 13.5px; }
.compose-label { width: 58px; flex: none; text-align: right; color: var(--text-2); }
.addr-pill { padding: 0 8px; border-radius: 4px; line-height: 20px; background: color-mix(in srgb, var(--accent) 16%, var(--canvas)); color: var(--text); font-size: 13px; text-decoration: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.addr-pill:hover { background: color-mix(in srgb, var(--accent) 26%, var(--canvas)); }
.compose-row input { flex: 1; min-width: 0; height: 32px; border: 0; background: none; font-size: 13.5px; }
.mail textarea { flex: 1; min-height: 120px; padding: 12px var(--mail-pad) 12px calc(var(--mail-pad) + 66px); border: 0; background: none; resize: none; font-size: 14px; line-height: 1.55; }
.compose-row input:focus, .mail textarea:focus { outline: none; }
.compose-row:focus-within { box-shadow: inset 0 -2px 0 var(--accent); }
.mail textarea:focus-visible { box-shadow: inset 0 0 0 2px color-mix(in srgb, var(--accent) 45%, transparent); }
.mail textarea::placeholder { color: var(--text-2); }
.mail .statusbar { white-space: normal; }
.mail-feedback:empty { display: none; }
.mail-feedback.is-ok { color: #1f7a33; font-weight: 600; }
.mail-feedback.is-error { color: #b42318; }
.tb-send .glyph { width: 15px; height: 15px; }
.g-li rect { fill: #0a66c2; }
@container (max-width: 560px) {
  .mail textarea { padding-left: var(--mail-pad); }
  .win-toolbar .tb-end .tb-labeled span { display: none; }
}

/* Terminal */
.term { flex: 1; min-height: 0; display: flex; flex-direction: column; background: #1c1d20; color: #e6e6e6; font: 13px/1.5 var(--mono); padding: 10px 12px; }
.term-out { flex: 1; overflow: auto; white-space: pre-wrap; overflow-wrap: anywhere; }
.term-out:focus-visible { outline-offset: -2px; }
.term-line { display: flex; gap: 8px; align-items: center; }
.term-line label { color: #8fd18f; white-space: nowrap; }
.term-line input { flex: 1; min-width: 0; background: none; border: 0; color: inherit; font: inherit; padding: 2px 0; caret-color: #8fd18f; }
.term-line input:focus-visible { outline: none; }
.term:focus-within { box-shadow: inset 0 0 0 2px rgba(10, 132, 255, .55); }

/* Settings */
.prefs { flex: 1; padding: 18px max(22px, calc((100% - 560px) / 2)); display: flex; flex-direction: column; gap: 16px; }
.window.is-maximized .prefs { padding-top: max(18px, 5vh); }
.pref { border: 0; margin: 0; padding: 0; }
.pref legend { font-weight: 600; font-size: 13px; margin-bottom: 6px; padding: 0; }
.pref .segmented { flex-wrap: wrap; }
.pref .segmented label { position: relative; }
.pref .segmented input { position: absolute; opacity: 0; inset: 0; margin: 0; }
.pref .segmented span { display: block; min-height: 26px; padding: 3px 12px; border-radius: var(--r-control); font-size: 13px; }
.pref .segmented input:checked + span { background: var(--btn-top); box-shadow: 0 .5px 1.5px rgba(0, 0, 0, .2); font-weight: 600; }
.pref .segmented input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 1px; }
.pref p { margin: 6px 0 0; font-size: 12.5px; }
.pref-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ============================================================ modals: Spotlight & Quick Look */
dialog { padding: 0; border: 0; color: var(--text); }
dialog::backdrop { background: rgba(0, 0, 0, .18); }
.spotlight { width: min(640px, calc(100vw - 32px)); margin: 18vh auto auto; border-radius: 10px; background: var(--popover); -webkit-backdrop-filter: blur(30px) saturate(170%); backdrop-filter: blur(30px) saturate(170%); box-shadow: var(--shadow-pop); overflow: hidden; }
.spotlight[open] { animation: pop-in var(--dur-fast) var(--ease-out); }
.sl-box { display: flex; align-items: center; gap: 10px; padding: 10px 14px; }
.sl-glass { width: 22px; height: 22px; color: var(--text-2); }
.sl-box input { flex: 1; border: 0; background: none; font-size: 22px; font-weight: 300; padding: 4px 0; }
.sl-box input:focus { outline: none; }
#sl-list { list-style: none; margin: 0; padding: 4px; max-height: 50vh; overflow: auto; border-top: .5px solid var(--separator); }
#sl-list:empty { display: none; }
[role="option"] { display: flex; align-items: center; gap: 10px; padding: 5px 10px; border-radius: 6px; cursor: default; }
[role="option"][aria-selected="true"] { background: var(--accent); color: #fff; }
[role="option"][aria-selected="true"] .sl-sub { color: rgba(255, 255, 255, .85); }
.sl-icon { width: 28px; height: 28px; }
.sl-label { font-size: 14px; }
.sl-sub { margin-left: auto; font-size: 12px; color: var(--text-2); }
.sl-empty { padding: 10px 14px; color: var(--text-2); }

.quicklook { width: min(860px, calc(100vw - 32px)); max-height: calc(100dvh - 48px); border-radius: 10px; background: var(--popover-solid); box-shadow: var(--shadow-pop); overflow: auto; }
.quicklook[open] { animation: pop-in var(--dur-fast) var(--ease-out); }
.ql-head { position: sticky; top: 0; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 12px; background: var(--chrome-solid); border-bottom: .5px solid var(--separator); }
.ql-head h2 { margin: 0; font-size: 14px; font-weight: 600; }
.ql-figure { margin: 0; padding: 16px; background: var(--stage); }
.ql-figure img { display: block; margin: auto; max-height: 60dvh; width: auto; background: #fff; }
.ql-figure figcaption { text-align: center; font-size: 12.5px; color: var(--text-2); margin-top: 6px; }
.ql-summary { margin: 14px 18px 8px; font-size: 15px; max-width: 70ch; }
.ql-actions { display: flex; flex-wrap: wrap; gap: 8px; padding: 6px 18px 18px; }

@keyframes pop-in { from { opacity: 0; transform: scale(.97); } }

/* ============================================================ medium windows (container queries) */
@container (max-width: 900px) {
  .finder { grid-template-columns: minmax(0, 1fr) 280px; position: relative; }
  .finder.show-page { grid-template-columns: minmax(0, 1fr); }
  .finder .sidebar { display: none; }
  .finder.sidebar-open .sidebar { display: block; position: absolute; z-index: 3; inset: 0 auto 0 0; width: min(260px, 85%); box-shadow: var(--shadow-pop); background: var(--sidebar-solid); }
}
@container (max-width: 640px) {
  .finder { grid-template-columns: minmax(0, 1fr); }
  .finder .inspector { display: none; }
}
@container (max-width: 760px) {
  .split { grid-template-columns: 170px minmax(0, 1fr); }
}
@container (max-width: 560px) {
  .about { padding: 20px 18px; }
  .about-top { grid-template-columns: 1fr; gap: 14px; justify-items: start; }
  .about-portrait { width: 104px; height: 104px; }
  .timeline li { grid-template-columns: 1fr; gap: 2px; }
  .doc { padding: 16px 18px; }
  .split { grid-template-columns: 1fr; grid-template-rows: auto 1fr; }
  .split .sidebar { border-right: 0; border-bottom: .5px solid var(--separator); }
  .split .sidebar ul { display: flex; flex-wrap: wrap; gap: 4px; }
  .split .side-item { width: auto; }
  .split .count { display: none; }
}
@container (max-width: 900px) { .tb-sidebar { display: inline-flex; } }
@container (max-width: 560px) {
  .list-table th:not(:first-child), .list-table td:not(:first-child) { display: none; }
  .tb-search { flex: 1 1 160px; }
}

/* ============================================================ compact mode: one app at a time */
#os[data-mode="compact"] .desktop-icons,
#os[data-mode="compact"] .menubar-slot { display: none; }
#os[data-mode="compact"] .wallpaper { filter: var(--wallpaper-tint) blur(0); }
#os[data-mode="compact"] .windows { inset: 0; }
#os[data-mode="compact"] .window {
  position: fixed; inset: calc(48px + env(safe-area-inset-top)) 0 calc(70px + env(safe-area-inset-bottom)); transform: none !important;
  width: auto !important; height: auto !important; border-radius: 0; box-shadow: none;
}
#os[data-mode="compact"] .window:not(.has-toolbar) .win-chrome { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); }
#os[data-mode="compact"] .window.has-toolbar .win-chrome { display: flex; height: auto; min-height: 0; padding: 8px 12px; border-radius: 0; touch-action: auto; }
#os[data-mode="compact"] .window.has-toolbar .traffic { display: none; }
#os[data-mode="compact"] .window.has-toolbar .win-title { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); }
#os[data-mode="compact"] .window.has-toolbar .win-toolbar { display: flex; width: 100%; }
#os[data-mode="compact"] .rz { display: none; }
#os[data-mode="compact"] .win-body { border-radius: 0; }
#os[data-mode="compact"] { font-size: 16px; }

.compact-bar { display: none; }
#os[data-mode="compact"].has-app .compact-bar {
  position: fixed; inset: 0 0 auto; z-index: var(--z-menubar); display: flex; align-items: center; gap: 8px;
  height: calc(48px + env(safe-area-inset-top)); padding: env(safe-area-inset-top) 8px 0;
  background: var(--chrome-solid); border-bottom: .5px solid var(--separator);
}
.cb-home, .cb-lang { min-height: 44px; min-width: 44px; display: inline-flex; align-items: center; gap: 2px; padding: 0 8px; border: 0; background: none; color: var(--accent-text); font-size: 16px; }
.cb-title { flex: 1; text-align: center; font-weight: 600; font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cb-lang { font-weight: 600; }

.launcher { display: none; }
#os[data-mode="compact"]:not(.has-app) .launcher {
  position: absolute; inset: 0; z-index: 5; display: block; overflow: auto;
  padding: calc(20px + env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) calc(100px + env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
}
.launcher > * { max-width: 560px; margin-left: auto; margin-right: auto; }
.launcher-head { display: flex; gap: 14px; align-items: center; padding: 16px; border-radius: 14px; background: var(--canvas); box-shadow: 0 6px 20px rgba(0, 0, 0, .18); }
.launcher-head img { border-radius: 50%; width: 72px; height: 72px; object-fit: cover; }
.launcher-head h1 { margin: 0; font-size: 24px; line-height: 1.15; letter-spacing: -.01em; }
.launcher-head p { margin: 2px 0 0; font-size: 15px; color: var(--text-2); }
.launcher-lead { margin-top: 10px; padding: 12px 16px; border-radius: 12px; background: color-mix(in srgb, var(--canvas) 92%, transparent); font-size: 16px; }
.launcher-main { list-style: none; padding: 0; margin-top: 12px; border-radius: 12px; overflow: hidden; background: var(--canvas); box-shadow: 0 6px 20px rgba(0, 0, 0, .16); }
.launcher-main li + li { border-top: .5px solid var(--separator); }
.launcher-main a { display: flex; align-items: center; gap: 12px; min-height: 60px; padding: 8px 14px; color: var(--text); text-decoration: none; font-size: 17px; font-weight: 600; }
.launcher-main .app-icon { width: 40px; height: 40px; }
.launcher-main .glyph { margin-left: auto; color: var(--text-2); }
.launcher-grid { list-style: none; padding: 0; margin-top: 14px; display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.launcher-grid a { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 12px 4px; min-height: 92px; border-radius: 12px; text-decoration: none; color: #fff; font-size: 14px; font-weight: 500; text-shadow: 0 1px 2px rgba(0, 0, 0, .7); }
.launcher-grid a:active { background: rgba(255, 255, 255, .18); }
.launcher-grid .app-icon { width: 52px; height: 52px; }
.launcher-foot { text-align: center; font-size: 15px; padding: 10px; border-radius: 10px; background: color-mix(in srgb, var(--canvas) 88%, transparent); }

#os[data-mode="compact"] .dock { left: 0; right: 0; transform: none; bottom: 0; border-radius: 0; padding: 4px max(8px, env(safe-area-inset-right)) calc(4px + env(safe-area-inset-bottom)) max(8px, env(safe-area-inset-left)); background: var(--chrome-solid); -webkit-backdrop-filter: none; backdrop-filter: none; box-shadow: 0 -.5px 0 var(--separator); }
#os[data-mode="compact"] .dock ul { justify-content: space-around; gap: 0; }
#os[data-mode="compact"] .dock li { flex: 1; }
#os[data-mode="compact"] .dock button { width: 100%; height: 60px; padding: 4px 0; grid-template-rows: 34px auto; gap: 2px; }
#os[data-mode="compact"] .dock .dock-icon, #os[data-mode="compact"] .dock .dock-tile { width: 32px; height: 32px; transform: none; }
#os[data-mode="compact"] .dock-glyph { width: 20px; height: 20px; }
#os[data-mode="compact"] .dock-tile { border-radius: 8px; }
#os[data-mode="compact"] .dock-label { position: static; transform: none; opacity: 1; padding: 0; background: none; box-shadow: none; font-size: 11.5px; color: var(--text-2); }
#os[data-mode="compact"] .dock .is-current .dock-label { color: var(--accent-text); font-weight: 600; }
#os[data-mode="compact"] .dock-dot { display: none; }
#os[data-mode="compact"] .tb-btn { height: 44px; min-width: 44px; font-size: 14px; }
#os[data-mode="compact"] .tb-search input { height: 44px; font-size: 16px; }
#os[data-mode="compact"] .btn { min-height: 44px; font-size: 15px; padding: 6px 14px; }
#os[data-mode="compact"] .field input, #os[data-mode="compact"] .field textarea { font-size: 16px; }
#os[data-mode="compact"] .field input { height: 44px; }
#os[data-mode="compact"] .compose-row input, #os[data-mode="compact"] .mail textarea { font-size: 16px; }
#os[data-mode="compact"] .row-btn, #os[data-mode="compact"] .side-item { min-height: 44px; font-size: 16px; }
#os[data-mode="compact"] .list-table td { height: 48px; font-size: 14px; }
#os[data-mode="compact"] .project-page { padding: 18px 16px 32px; }
#os[data-mode="compact"] .pp-section p, #os[data-mode="compact"] .about-bio, #os[data-mode="compact"] .timeline p { font-size: 16px; }
#os[data-mode="compact"] .term-line input { font-size: 16px; }
#os[data-mode="compact"] .preview-stage { padding: 10px; }
#os[data-mode="compact"] .tb-labeled span { display: none; }
#os[data-mode="compact"] .menu-pop button { min-height: 44px; }

/* ============================================================ linear view (also the no-JS page) */
.linear { max-width: 760px; margin: 0 auto; padding: 32px 16px 64px; background: var(--canvas); min-height: 100dvh; font-size: 16px; line-height: 1.6; }
.linear:focus { outline: none; }
html.show-linear body { background: var(--canvas); }
.ln-hero { display: grid; grid-template-columns: 120px 1fr; gap: 22px; align-items: start; padding-bottom: 28px; border-bottom: .5px solid var(--separator); }
.ln-portrait { width: 120px; height: 120px; border-radius: 50%; object-fit: cover; }
.linear h1 { margin: 0; font-size: 34px; line-height: 1.1; letter-spacing: -.02em; }
.ln-role { margin: 6px 0 0; color: var(--text-2); }
.ln-lead { font-size: 18px; margin: 12px 0; }
.ln-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.ln-actions .btn { min-height: 40px; font-size: 15px; }
.ln-switch { margin: 14px 0 0; }
.linear section { padding: 28px 0; border-bottom: .5px solid var(--separator); }
.linear h2 { font-size: 24px; line-height: 1.25; margin: 0 0 8px; letter-spacing: -.01em; }
.linear h3 { font-size: 19px; margin: 24px 0 4px; }
.ln-intro { color: var(--text-2); }
.ln-meta { color: var(--text-2); font-size: 14px; margin: 0; }
.ln-project figure { margin: 18px 0; }
.ln-project img { border-radius: 6px; box-shadow: 0 0 0 .5px var(--separator); }
.ln-project figcaption { font-size: 13px; color: var(--text-2); }
.ln-notes dt { font-weight: 650; margin-top: 12px; }
.ln-notes dd { margin: 0; }
.ln-timeline { list-style: none; padding: 0; margin: 0; }
.ln-timeline h3 { margin-top: 18px; }
.ln-timeline p { margin: 2px 0 0; }
.ln-job { display: grid; grid-template-columns: 48px 1fr; column-gap: 14px; align-items: center; margin-top: 18px; }
.ln-job h3 { margin: 0; }
.ln-logo { border-radius: 8px; box-shadow: 0 0 0 .5px rgba(0, 0, 0, .16); }
.ln-body { grid-column: 2; margin: 6px 0 0; }
.ln-skills { padding-left: 20px; }
.ln-contact { padding-left: 20px; }
.ln-footer { padding: 24px 0; color: var(--text-2); font-size: 14px; }
.ln-footer p { margin: 0; }
@media (max-width: 560px) {
  .ln-hero { grid-template-columns: 1fr; }
  .ln-portrait { width: 96px; height: 96px; }
  .linear h1 { font-size: 30px; }
}

/* ============================================================ accessibility fallbacks */
@media (max-width: 1100px) { .wallpaper { background-image: url("../assets/img/wallpaper-1440.webp"); } }

@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .menubar { background: var(--menubar-solid); }
  .dock { background: var(--dock-solid); }
  .sidebar { background: var(--sidebar-solid); }
  .menu-pop, .spotlight { background: var(--popover-solid); }
}
@media (prefers-reduced-transparency: reduce) {
  .menubar { background: var(--menubar-solid); -webkit-backdrop-filter: none; backdrop-filter: none; }
  .dock { background: var(--dock-solid); -webkit-backdrop-filter: none; backdrop-filter: none; }
  .sidebar { background: var(--sidebar-solid); -webkit-backdrop-filter: none; backdrop-filter: none; }
  .menu-pop, .spotlight { background: var(--popover-solid); -webkit-backdrop-filter: none; backdrop-filter: none; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
@media (forced-colors: active) {
  .window { border: 1px solid CanvasText; }
  .tl span { forced-color-adjust: none; }
}
