/* ==========================================================
   AmbarOS — a modern desktop with a 98 soul
   ========================================================== */

:root {
  --face: #c6c6c6;
  --face-hi: #ffffff;
  --face-lt: #e3e3e3;
  --face-lo: #808080;
  --face-dk: #0a0a0a;
  --text: #0b0b0b;
  --text-dim: #4b4b4b;
  --field: #ffffff;
  --link: #0a3fd1;
  --select: #000080;
  --select-text: #ffffff;
  --title-a: #000080;
  --title-b: #1084d0;
  --title-text: #ffffff;
  --title-ia: #7b7b7b;
  --title-ib: #b9b9b9;
  --accent: #ff2e88;
  --shadow: 0 22px 60px -18px rgba(0, 0, 0, 0.55), 0 6px 16px -6px rgba(0, 0, 0, 0.3);

  --font-ui: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, Menlo, monospace;
  --font-pixel: "Pixelify Sans", "IBM Plex Mono", monospace;
  --font-hand: "Kalam", "Comic Neue", cursive;

  --taskbar-h: 42px;

  --bevel-out: inset -1px -1px var(--face-dk), inset 1px 1px var(--face-lt), inset -2px -2px var(--face-lo), inset 2px 2px var(--face-hi);
  --bevel-in: inset 1px 1px var(--face-lo), inset -1px -1px var(--face-hi), inset 2px 2px var(--face-dk), inset -2px -2px var(--face-lt);
  --bevel-thin-out: inset -1px -1px var(--face-lo), inset 1px 1px var(--face-hi);
  --bevel-thin-in: inset 1px 1px var(--face-lo), inset -1px -1px var(--face-hi);
}

[data-scheme="bubblegum"] {
  --title-a: #b0135a;
  --title-b: #ff6fae;
  --select: #b0135a;
  --link: #c0106a;
}

[data-scheme="night"] {
  --face: #2e3039;
  --face-hi: #5a5d6b;
  --face-lt: #434654;
  --face-lo: #17181d;
  --face-dk: #000000;
  --text: #ecebf3;
  --text-dim: #a9a8b8;
  --field: #1d1e25;
  --link: #9db8ff;
  --select: #5b54e0;
  --title-a: #2a1f63;
  --title-b: #6c4bd8;
  --title-ia: #2b2c33;
  --title-ib: #45474f;
}

*, *::before, *::after { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  overscroll-behavior: none;
}

body {
  font: 14px/1.5 var(--font-ui);
  color: var(--text);
  background: #007878;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
img { display: block; max-width: 100%; }
a { color: var(--link); text-underline-offset: 2px; }
a:hover { color: var(--accent); }
::selection { background: var(--select); color: var(--select-text); }

svg.pix { width: 100%; height: 100%; display: block; image-rendering: pixelated; }

/* ---------- Wallpapers ---------- */

#desktop {
  position: fixed;
  inset: 0 0 var(--taskbar-h) 0;
  overflow: hidden;
  isolation: isolate;
}

#desktop::before,
#desktop::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  pointer-events: none;
}

/* subtle 1-bit dither over every wallpaper */
#desktop::after {
  background-image: radial-gradient(rgba(0, 0, 0, 0.09) 1px, transparent 1.2px);
  background-size: 3px 3px;
  mix-blend-mode: multiply;
}

[data-wall="teal"] #desktop::before {
  background:
    radial-gradient(900px 600px at 78% 12%, rgba(120, 255, 235, 0.28), transparent 65%),
    radial-gradient(700px 500px at 10% 100%, rgba(0, 40, 60, 0.45), transparent 70%),
    #007878;
}

[data-wall="dusk"] #desktop::before {
  background:
    repeating-linear-gradient(180deg, transparent 0 14px, rgba(46, 16, 72, 0.9) 14px 18px) 50% 72% / 260px 120px no-repeat,
    radial-gradient(circle at 50% 76%, #ffd76b 0 128px, #ff9a6b 129px 130px, transparent 131px),
    linear-gradient(180deg, #170f3a 0%, #3a1a6b 38%, #b0407e 68%, #ff8a6b 86%, #ffc070 100%);
}
[data-wall="dusk"] #desktop::after { mix-blend-mode: normal; }

[data-wall="blueprint"] #desktop::before {
  background:
    linear-gradient(rgba(255, 255, 255, 0.16) 1px, transparent 1px) 0 0 / 120px 120px,
    linear-gradient(90deg, rgba(255, 255, 255, 0.16) 1px, transparent 1px) 0 0 / 120px 120px,
    linear-gradient(rgba(255, 255, 255, 0.07) 1px, transparent 1px) 0 0 / 24px 24px,
    linear-gradient(90deg, rgba(255, 255, 255, 0.07) 1px, transparent 1px) 0 0 / 24px 24px,
    radial-gradient(1200px 800px at 70% 20%, #1e5bc6, transparent 70%),
    #0c3a8a;
}

[data-wall="clouds"] #desktop::before {
  background:
    radial-gradient(120px 46px at 18% 22%, #fff 60%, transparent 62%),
    radial-gradient(90px 40px at 24% 18%, #fff 60%, transparent 62%),
    radial-gradient(160px 54px at 70% 36%, #ffffffe6 60%, transparent 62%),
    radial-gradient(100px 44px at 77% 31%, #ffffffe6 60%, transparent 62%),
    radial-gradient(140px 40px at 42% 70%, #ffffffcc 60%, transparent 62%),
    radial-gradient(90px 34px at 47% 66%, #ffffffcc 60%, transparent 62%),
    linear-gradient(180deg, #2f7fd6 0%, #64aef0 55%, #bfe2ff 100%);
}

/* ---------- Desktop icons ---------- */

#icons { position: absolute; inset: 0; }

.dicon {
  position: absolute;
  width: 88px;
  padding: 6px 2px 4px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  background: none;
  border: 0;
  cursor: default;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  outline: none;
}
.dicon .img {
  width: 42px;
  height: 42px;
  filter: drop-shadow(1px 2px 0 rgba(0, 0, 0, 0.25));
  transition: transform 140ms cubic-bezier(.2, .8, .2, 1);
}
.dicon .label {
  color: #fff;
  font-size: 12.5px;
  font-weight: 500;
  line-height: 1.25;
  text-align: center;
  padding: 1px 4px;
  max-width: 88px;
  overflow-wrap: anywhere;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.75), 0 0 6px rgba(0, 0, 0, 0.35);
}
[data-wall="clouds"] .dicon .label { text-shadow: 0 1px 2px rgba(0, 30, 80, 0.9), 0 0 8px rgba(0, 30, 80, 0.5); }
.dicon.selected .img { filter: drop-shadow(1px 2px 0 rgba(0, 0, 0, 0.25)) brightness(0.75) sepia(1) hue-rotate(185deg) saturate(3); }
.dicon.selected .label { background: var(--select); text-shadow: none; outline: 1px dotted rgba(255, 255, 255, 0.85); }
.dicon:focus-visible .label { outline: 1px dotted #fff; }
.dicon.dragging { opacity: 0.75; z-index: 2; }
.dicon .badge {
  position: absolute;
  top: 2px;
  right: 18px;
  font: 600 10px/1 var(--font-ui);
  color: #fff;
  background: var(--accent);
  padding: 3px 4px;
  border-radius: 99px;
}
.dicon.react .img { animation: hop 420ms cubic-bezier(.3, .7, .3, 1); }
@keyframes hop {
  0% { transform: none; }
  25% { transform: scale(1.15, .85) translateY(2px); }
  50% { transform: scale(.94, 1.08) translateY(-5px); }
  75% { transform: scale(1.03, .97) translateY(0); }
  100% { transform: none; }
}

#marquee {
  position: absolute;
  border: 1px dotted #fff;
  background: rgba(255, 255, 255, 0.12);
  pointer-events: none;
  z-index: 3;
}

/* ---------- Windows ---------- */

#windows { position: absolute; inset: 0; pointer-events: none; z-index: 5; }

.win {
  position: absolute;
  display: flex;
  flex-direction: column;
  padding: 3px;
  min-width: 260px;
  min-height: 150px;
  background: var(--face);
  color: var(--text);
  box-shadow: var(--bevel-out), var(--shadow);
  pointer-events: auto;
  outline: none;
}
.win.auto-h { min-height: 0; }
.win.opening { animation: win-in 260ms cubic-bezier(.2, .9, .3, 1.2); }
.win.closing { animation: win-out 100ms ease-in forwards; pointer-events: none; }
/* after the zoom outlines land, the window pops in with a little overshoot */
@keyframes win-in {
  0% { opacity: 0.6; transform: scale(.97, .95); }
  60% { opacity: 1; transform: scale(1.008, 1.012); }
  100% { transform: none; }
}
@keyframes win-out { to { opacity: 0; transform: scale(.97); } }

.win.max {
  left: 0 !important;
  top: 0 !important;
  width: 100% !important;
  height: 100% !important;
  box-shadow: var(--bevel-out);
}
.win.max .grip { display: none; }

.titlebar {
  display: flex;
  align-items: center;
  gap: 6px;
  height: 26px;
  flex: none;
  padding: 0 3px 0 5px;
  position: relative;
  overflow: hidden;
  background: var(--title-a);
  color: var(--title-text);
  font-weight: 600;
  font-size: 13px;
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;
}
.win:not(.active) .titlebar { background: var(--title-ia); color: #e6e6e6; }
/* a light sweep runs across the title bar whenever a window gains focus */
.win.active .titlebar::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(105deg, transparent 38%, rgba(255, 255, 255, 0.45) 49%, rgba(255, 255, 255, 0.15) 53%, transparent 62%);
  transform: translateX(-110%);
  animation: sheen 750ms 60ms cubic-bezier(.3, .6, .2, 1);
}
@keyframes sheen { to { transform: translateX(110%); } }
.ticon { width: 16px; height: 16px; flex: none; }
.ttext { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; letter-spacing: 0.01em; }
.tbtns { display: flex; gap: 2px; flex: none; }
.tbtn {
  width: 22px;
  height: 20px;
  padding: 0;
  border: 0;
  display: grid;
  place-items: center;
  background: var(--face);
  color: var(--text);
  box-shadow: var(--bevel-out);
}
.tbtn svg { width: 10px; height: 10px; }
.tbtn:active { box-shadow: var(--bevel-in); }
.tbtn:active svg { translate: 1px 1px; }
.tbtn[data-act="close"] { margin-left: 3px; }
.tbtn:focus-visible { outline: 1px dotted var(--text); outline-offset: -4px; }

.menubar { display: flex; flex-wrap: wrap; flex: none; padding: 2px 0; font-size: 13px; }
.menubar button { background: none; border: 0; padding: 2px 8px; }
.menubar button:hover, .menubar button:focus-visible { box-shadow: var(--bevel-thin-out); outline: none; }
.menubar button:active { box-shadow: var(--bevel-thin-in); }
.menubar u { text-decoration-thickness: 1px; }

.wbody {
  position: relative;
  flex: 1;
  min-height: 0;
  margin-top: 3px;
  overflow: auto;
  display: flex;
  flex-direction: column;
}

.statusbar { display: flex; gap: 3px; flex: none; margin-top: 3px; font-size: 12px; color: var(--text); }
.statusbar > * { padding: 2px 8px; box-shadow: var(--bevel-thin-in); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.statusbar > .grow { flex: 1; }

.grip {
  position: absolute;
  right: 3px;
  bottom: 3px;
  width: 15px;
  height: 15px;
  cursor: nwse-resize;
  touch-action: none;
  background:
    linear-gradient(135deg, transparent 0 45%, var(--face-hi) 45% 52%, var(--face-lo) 52% 60%, transparent 60% 68%, var(--face-hi) 68% 75%, var(--face-lo) 75% 83%, transparent 83%);
}

/* ---------- Controls ---------- */

.btn {
  min-width: 88px;
  min-height: 32px;
  padding: 5px 14px;
  border: 0;
  background: var(--face);
  color: var(--text);
  box-shadow: var(--bevel-out);
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  text-decoration: none;
  user-select: none;
}
.btn:hover { color: var(--text); }
.btn:active { box-shadow: var(--bevel-in); }
.btn:active > * { translate: 1px 1px; }
.btn:focus-visible { outline: 1px dotted var(--text); outline-offset: -5px; }
.btn.default { box-shadow: 0 0 0 1px var(--face-dk), var(--bevel-out); }
.btn.default:active { box-shadow: 0 0 0 1px var(--face-dk), var(--bevel-in); }
.btn.sm { min-width: 0; min-height: 26px; padding: 2px 10px; font-size: 13px; }
.btn .ic { width: 18px; height: 18px; flex: none; }
.btn[disabled] { color: var(--face-lo); text-shadow: 1px 1px var(--face-hi); cursor: default; }

.field {
  width: 100%;
  padding: 7px 9px;
  border: 0;
  background: var(--field);
  color: var(--text);
  box-shadow: var(--bevel-in);
  font-size: 16px;
  border-radius: 0;
  outline: none;
}
.field:focus-visible { outline: 1px dotted var(--text); outline-offset: 2px; }
textarea.field { resize: vertical; min-height: 120px; line-height: 1.5; }

.sunken { background: var(--field); box-shadow: var(--bevel-in); padding: 2px; }
.groove { border: 0; height: 2px; margin: 6px 2px; box-shadow: inset 0 1px var(--face-lo), inset 0 -1px var(--face-hi); }

.check { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; }
.check input {
  appearance: none;
  width: 15px;
  height: 15px;
  margin: 0;
  flex: none;
  background: var(--field);
  box-shadow: var(--bevel-in);
  display: grid;
  place-items: center;
}
.check input:checked::after {
  content: "";
  width: 9px;
  height: 7px;
  background: var(--text);
  clip-path: polygon(0 45%, 18% 30%, 38% 55%, 82% 0, 100% 18%, 38% 100%);
}
.check input[type="radio"] { border-radius: 50%; }
.check input[type="radio"]:checked::after { width: 5px; height: 5px; border-radius: 50%; clip-path: none; }
.check input:focus-visible + span { outline: 1px dotted var(--text); }

/* tabs */
.tabs { display: flex; padding: 0 4px; position: relative; z-index: 1; flex: none; }
.tab {
  border: 0;
  background: var(--face);
  padding: 5px 14px 4px;
  margin-top: 3px;
  box-shadow: inset 1px 1px var(--face-hi), inset -1px 0 var(--face-dk), inset -2px 0 var(--face-lo);
  font-size: 13px;
}
.tab[aria-selected="true"] { margin: 0 -2px -2px; padding: 7px 16px 7px; position: relative; z-index: 2; font-weight: 600; }
.tab:focus-visible { outline: 1px dotted var(--text); outline-offset: -4px; }
.tabpanel { box-shadow: var(--bevel-out); padding: 16px; flex: 1; overflow: auto; }
.tabpanel[hidden] { display: none; }

/* ---------- Start & context menus ---------- */

#start-menu {
  position: fixed;
  left: 4px;
  bottom: calc(var(--taskbar-h) - 3px);
  width: 268px;
  max-height: calc(100dvh - var(--taskbar-h) - 8px);
  display: flex;
  padding: 3px;
  background: var(--face);
  box-shadow: var(--bevel-out), var(--shadow);
  z-index: 9500;
  transform-origin: bottom left;
  animation: menu-in 140ms cubic-bezier(.2, .8, .2, 1);
}
@keyframes menu-in { from { opacity: 0; transform: translateY(6px); } }
#start-menu[hidden], #ctx-menu[hidden] { display: none; }

.sm-band {
  width: 32px;
  flex: none;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  padding: 12px 0;
  writing-mode: vertical-rl;
  transform: rotate(180deg);
  background: var(--title-a);
  color: #ffffffcc;
  font: 400 20px/1 var(--font-pixel);
  letter-spacing: 0.02em;
}
.sm-band b { color: #fff; font-weight: 600; }
.sm-items { flex: 1; display: flex; flex-direction: column; padding: 2px 0 2px 2px; overflow: auto; }

.mi {
  display: flex;
  align-items: center;
  gap: 11px;
  width: 100%;
  padding: 6px 10px;
  border: 0;
  background: none;
  color: var(--text);
  text-align: left;
  font-size: 14px;
  text-decoration: none;
}
.mi .ic { width: 26px; height: 26px; flex: none; }
.mi .ext { margin-left: auto; font-size: 11px; opacity: 0.6; }
.mi:hover, .mi:focus-visible { background: var(--select); color: var(--select-text); outline: none; }
.mi u { text-decoration-thickness: 1px; }

#ctx-menu {
  position: fixed;
  min-width: 200px;
  padding: 3px;
  background: var(--face);
  box-shadow: var(--bevel-out), 0 10px 24px -8px rgba(0, 0, 0, 0.5);
  z-index: 9600;
}
#ctx-menu .mi { padding: 4px 22px; font-size: 13px; }

/* ---------- Boot, shutdown, screensaver ---------- */

#boot {
  position: fixed;
  inset: 0;
  z-index: 10000;
  background: #000;
  color: #c9c9c9;
  font: 14px/1.6 var(--font-mono);
  padding: max(24px, 4vw);
  cursor: pointer;
}
#boot[hidden], #off[hidden], #saver[hidden] { display: none; }
#boot-text { margin: 0; white-space: pre-wrap; font: inherit; }
#boot-text .ok { color: #5cff8a; }
#boot-text .hl { color: #ffd23f; }
#boot-skip { position: absolute; left: 0; right: 0; bottom: 22px; margin: 0; text-align: center; font-size: 12px; color: #6d6d6d; }

#splash {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 10px;
  background: radial-gradient(600px 400px at 50% 45%, #0c4d78, #020b1a 70%);
  color: #fff;
  animation: fade-in 300ms ease-out;
}
@keyframes fade-in { from { opacity: 0; } }
.splash-logo { width: 84px; height: 84px; margin-bottom: 6px; }
.splash-name { font: 400 52px/1 var(--font-pixel); letter-spacing: 0.02em; }
.splash-name b { font-weight: 600; color: #ffd23f; }
.splash-sub { font: 500 13px var(--font-ui); letter-spacing: 0.2em; text-transform: uppercase; opacity: 0.7; }
.splash-bar {
  width: 220px;
  height: 18px;
  margin-top: 26px;
  padding: 3px;
  overflow: hidden;
  box-shadow: inset 1px 1px #000, inset -1px -1px #3a5a7a;
}
.splash-bar span {
  display: block;
  width: 60px;
  height: 100%;
  background: repeating-linear-gradient(90deg, #2b8cff 0 10px, transparent 10px 13px);
  animation: slide 1.1s linear infinite;
}
@keyframes slide { from { transform: translateX(-60px); } to { transform: translateX(220px); } }

#off {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: grid;
  place-content: center;
  text-align: center;
  gap: 14px;
  background: #000;
  color: #ff9d2e;
  cursor: pointer;
  padding: 24px;
}
#off p { margin: 0; font: 400 clamp(22px, 4vw, 40px)/1.2 var(--font-pixel); }
#off small { color: #7a5a30; font: 13px var(--font-mono); }

body.crt-off #desktop, body.crt-off #menubar, body.crt-off #dock { animation: crt-off 520ms cubic-bezier(.6, 0, .9, .3) forwards; }
@keyframes crt-off {
  0% { transform: none; filter: brightness(1); }
  55% { transform: scale(1, 0.006); filter: brightness(3); }
  100% { transform: scale(0, 0.006); filter: brightness(6); }
}

#saver { position: fixed; inset: 0; width: 100%; height: 100%; z-index: 9900; background: #000; cursor: none; }

/* ---------- App: shared content ---------- */

.pad { padding: 18px 20px; }
.paper { background: var(--field); box-shadow: var(--bevel-in); flex: 1; overflow: auto; }
.h-pixel { font: 600 26px/1.1 var(--font-pixel); margin: 0 0 6px; letter-spacing: 0.01em; }
.eyebrow { font: 600 11px/1 var(--font-ui); letter-spacing: 0.14em; text-transform: uppercase; color: var(--text-dim); margin: 0 0 8px; }
.muted { color: var(--text-dim); }
.row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.toolbar { display: flex; gap: 4px; align-items: center; flex: none; padding: 3px 2px 5px; flex-wrap: wrap; }
.address { display: flex; align-items: center; gap: 8px; flex: none; padding: 0 2px 5px; font-size: 13px; }
.address .field { padding: 3px 8px; font-size: 13px; font-family: var(--font-mono); }

/* About */
.about { display: grid; grid-template-columns: minmax(200px, 38%) 1fr; gap: 20px; padding: 18px; background: var(--field); box-shadow: var(--bevel-in); flex: 1; overflow: auto; }
.about-photo { background: var(--face); padding: 4px; box-shadow: var(--bevel-out); align-self: start; position: sticky; top: 0; }
.about-photo img { width: 100%; height: auto; aspect-ratio: 4 / 5; object-fit: cover; object-position: 50% 30%; }
.about-photo figcaption { font: 12px var(--font-mono); padding: 6px 4px 2px; color: var(--text-dim); }
.about h1 { font: 600 32px/1.05 var(--font-pixel); margin: 0; }
.about .role { font-size: 17px; color: var(--text-dim); margin: 4px 0 14px; }
.about p { margin: 0 0 12px; font-size: 15px; text-wrap: pretty; max-width: 62ch; }
.beliefs { list-style: none; padding: 0; margin: 10px 0 18px; display: grid; gap: 8px; counter-reset: b; }
.beliefs li { counter-increment: b; display: grid; grid-template-columns: 30px 1fr; gap: 6px; font-size: 14px; }
.beliefs li::before {
  content: counter(b, decimal-leading-zero);
  font: 600 13px/1.7 var(--font-pixel);
  color: var(--accent);
}

/* Explorer (projects & bin) */
.files {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(168px, 1fr));
  gap: 18px 14px;
  padding: 16px;
  align-content: start;
}
.file {
  display: flex;
  flex-direction: column;
  gap: 7px;
  padding: 6px;
  border: 0;
  background: none;
  text-align: left;
  color: var(--text);
}
.file .thumb { position: relative; background: var(--face); padding: 3px; box-shadow: var(--bevel-out); }
.file .thumb img { width: 100%; height: auto; aspect-ratio: 3 / 2; object-fit: cover; background: #ddd; }
.file .count {
  position: absolute;
  right: 8px;
  bottom: 8px;
  font: 600 10.5px/1 var(--font-ui);
  background: rgba(0, 0, 0, 0.72);
  color: #fff;
  padding: 4px 6px;
}
.file .name { font-weight: 600; font-size: 13.5px; line-height: 1.3; padding: 1px 3px; align-self: start; }
.file .meta { font-size: 12px; color: var(--text-dim); padding: 0 3px; margin-top: -4px; }
.file:focus-visible { outline: none; }
.file:focus-visible .name { background: var(--select); color: var(--select-text); outline: 1px dotted var(--select-text); }
@media (hover: hover) {
  .file .thumb img { transition: filter 150ms; }
  .file:hover .thumb img { filter: saturate(1.15) brightness(1.04); }
  .file:hover .name { text-decoration: underline; text-underline-offset: 2px; }
}

.details { width: 100%; border-collapse: collapse; font-size: 13px; }
.details th {
  position: sticky;
  top: 0;
  text-align: left;
  font-weight: 500;
  padding: 4px 10px;
  background: var(--face);
  box-shadow: var(--bevel-thin-out);
  white-space: nowrap;
}
.details td { padding: 5px 10px; vertical-align: middle; }
.details tr.rowbtn { cursor: pointer; }
.details tr.rowbtn:hover td, .details tr.rowbtn:focus-visible td { background: var(--select); color: var(--select-text); outline: none; }
.details .nm { display: flex; align-items: center; gap: 8px; font-weight: 500; }
.details .nm img { width: 36px; height: 24px; object-fit: cover; }
.details .nm .ic { width: 18px; height: 18px; flex: none; }

.bin-files { grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); }
.bin-files .file { align-items: center; text-align: center; }
.bin-files .file .ic { width: 36px; height: 36px; }
.bin-files .file .name { align-self: center; font-weight: 500; font-size: 12.5px; overflow-wrap: anywhere; }

/* Viewer */
.viewer { display: flex; flex-direction: column; flex: 1; min-height: 0; }
.viewer-stage {
  flex: 1;
  min-height: 180px;
  display: grid;
  place-items: center;
  padding: 14px;
  overflow: hidden;
  background:
    repeating-conic-gradient(#2a2a2e 0 25%, #232327 0 50%) 0 0 / 16px 16px;
  box-shadow: var(--bevel-in);
  position: relative;
}
.viewer-stage img {
  position: absolute;
  inset: 14px;
  width: calc(100% - 28px);
  height: calc(100% - 28px);
  max-width: none;
  object-fit: contain;
  filter: drop-shadow(0 10px 24px rgba(0, 0, 0, 0.5));
  transition: opacity 150ms;
}
.viewer-stage img.loading { opacity: 0.4; }
.viewer-info { display: grid; grid-template-columns: 1fr auto; gap: 6px 16px; padding: 10px 4px 2px; align-items: center; flex: none; }
.viewer-info h2 { margin: 0; font: 600 18px/1.2 var(--font-pixel); }
.viewer-info p { margin: 0; grid-column: 1 / -1; font-size: 14px; max-width: 80ch; text-wrap: pretty; }
.viewer-nav { display: flex; gap: 4px; }

/* Experience doc */
.doc { background: #8a8a8a; box-shadow: var(--bevel-in); flex: 1; overflow: auto; padding: 18px; }
[data-scheme="night"] .doc { background: #101116; }
.doc-page {
  max-width: 680px;
  margin: 0 auto;
  background: var(--field);
  padding: 40px 46px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.3);
}
.doc-page h1 { font: 600 28px/1.1 var(--font-pixel); margin: 0; }
.doc-page .sub { color: var(--text-dim); margin: 4px 0 24px; }
.job { display: grid; grid-template-columns: 12px 1fr; gap: 14px; padding-bottom: 22px; position: relative; }
.job::before { content: ""; width: 10px; height: 10px; background: var(--accent); margin-top: 8px; box-shadow: 2px 2px 0 var(--face-dk); }
.job:not(:last-child)::after { content: ""; position: absolute; left: 4px; top: 22px; bottom: 2px; width: 2px; background: repeating-linear-gradient(180deg, var(--face-lo) 0 4px, transparent 4px 8px); }
.job h2 { margin: 0; font-size: 17px; line-height: 1.3; }
.job .at { font-weight: 500; }
.job .when { font: 12.5px var(--font-mono); color: var(--text-dim); margin: 2px 0 6px; }
.job p { margin: 0; font-size: 14.5px; text-wrap: pretty; }

/* Toolbox */
.skills-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 16px 20px; }
.skills-grid fieldset { margin: 0; padding: 10px 12px 12px; border: 0; box-shadow: inset 1px 1px var(--face-lo), inset -1px -1px var(--face-hi), inset 2px 2px var(--face-hi), inset -2px -2px var(--face-lo); }
.skills-grid legend { padding: 0 4px; font-weight: 600; font-size: 13px; }
.skills-grid .check { display: flex; padding: 3px 0; font-size: 14px; cursor: default; }
.tools-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; list-style: none; padding: 0; margin: 0; }
.tools-list li { display: flex; align-items: center; gap: 10px; padding: 8px 10px; background: var(--field); box-shadow: var(--bevel-in); font-size: 14px; }
.tools-list .dot { width: 10px; height: 10px; flex: none; box-shadow: 1px 1px 0 var(--face-dk); }
.certs { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.certs li { display: grid; grid-template-columns: 22px 1fr; gap: 10px; padding: 10px 12px; background: var(--field); box-shadow: var(--bevel-in); }
.certs .ic { width: 22px; height: 22px; }
.certs b { display: block; font-size: 14px; }
.certs span { font-size: 13px; color: var(--text-dim); }

/* Contact */
.mail { display: flex; flex-direction: column; gap: 8px; flex: 1; min-height: 0; overflow: auto; padding: 2px; }
.mail-row { display: grid; grid-template-columns: 70px 1fr; align-items: center; gap: 8px; font-size: 13px; }
.mail-row label { text-align: right; }
.mail textarea { flex: 1; min-height: 140px; }
.reach { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 6px; margin-top: 4px; }
.reach .btn { justify-content: flex-start; width: 100%; font-size: 13px; }

/* Doodle */
.doodle-main { display: flex; gap: 6px; flex: 1; min-height: 0; }
.dd-tools { display: flex; flex-direction: column; gap: 3px; flex: none; overflow: auto; }
.dd-tools .tool {
  width: 58px;
  padding: 6px 2px;
  border: 0;
  background: var(--face);
  box-shadow: var(--bevel-out);
  font: 500 12px/1.2 var(--font-ui);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
}
.dd-tools .tool .ic { width: 22px; height: 22px; }
.dd-tools .tool[aria-pressed="true"] { box-shadow: var(--bevel-in); background: repeating-conic-gradient(var(--face-hi) 0 25%, var(--face) 0 50%) 0 0 / 2px 2px; }
.dd-canvas { flex: 1; min-width: 0; display: grid; place-items: center; background: #7b7b7b; box-shadow: var(--bevel-in); padding: 10px; overflow: hidden; }
.dd-canvas canvas {
  width: 100%;
  max-height: 100%;
  aspect-ratio: 3 / 2;
  object-fit: contain;
  image-rendering: pixelated;
  background: #fff;
  cursor: crosshair;
  touch-action: none;
  box-shadow: 2px 2px 0 rgba(0, 0, 0, 0.35);
}
.dd-palette { display: flex; gap: 6px; align-items: center; flex: none; padding: 6px 2px 0; flex-wrap: wrap; }
.dd-current { width: 34px; height: 34px; padding: 3px; box-shadow: var(--bevel-in); background: var(--field); flex: none; }
.dd-current span { display: block; width: 100%; height: 100%; }
.swatches { display: grid; grid-template-columns: repeat(8, 18px); gap: 2px; }
.sw { width: 18px; height: 16px; padding: 0; border: 0; background: var(--c); box-shadow: var(--bevel-thin-in); }
.sw[aria-pressed="true"] { outline: 2px solid var(--text); outline-offset: 1px; }

/* Settings */
.monitor { width: 200px; margin: 4px auto 16px; }
.monitor-screen { height: 128px; padding: 8px; background: var(--face); box-shadow: var(--bevel-out); }
.monitor-screen div { height: 100%; box-shadow: var(--bevel-in); position: relative; overflow: hidden; isolation: isolate; }
.monitor-stand { width: 70px; height: 12px; margin: 0 auto; background: var(--face); box-shadow: var(--bevel-out); }
.monitor-foot { width: 120px; height: 8px; margin: 0 auto; background: var(--face); box-shadow: var(--bevel-out); }
.listbox { list-style: none; margin: 0; padding: 2px; background: var(--field); box-shadow: var(--bevel-in); }
.listbox li { padding: 4px 8px; cursor: default; font-size: 14px; }
.listbox li[aria-selected="true"] { background: var(--select); color: var(--select-text); }
.listbox:focus-visible { outline: 1px dotted var(--text); outline-offset: 2px; }
.schemes { display: grid; gap: 10px; }
.scheme-opt { display: grid; grid-template-columns: auto 1fr; gap: 12px; align-items: center; padding: 8px; background: var(--field); box-shadow: var(--bevel-in); cursor: pointer; }
.scheme-opt .swatch { width: 120px; height: 34px; padding: 3px; background: var(--sf, #c6c6c6); box-shadow: inset -1px -1px #000, inset 1px 1px #fff; }
.scheme-opt .swatch i { display: block; height: 10px; background: linear-gradient(90deg, var(--sa), var(--sb)); }
.settings-foot { display: flex; justify-content: flex-end; gap: 6px; padding: 8px 2px 2px; flex: none; }

/* Message box */
.msg { display: flex; gap: 16px; padding: 18px 18px 8px; align-items: flex-start; }
.msg .ic { width: 34px; height: 34px; flex: none; }
.msg p { margin: 4px 0 0; font-size: 14px; max-width: 40ch; text-wrap: pretty; }
.msg-actions { display: flex; justify-content: center; gap: 8px; padding: 10px 12px 12px; }

.noscript { position: fixed; inset: 0; background: #008080; color: #fff; padding: 40px; font-family: system-ui, sans-serif; z-index: 20000; }
.noscript a { color: #fff; }

.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; }

/* ==========================================================
   Design-canvas wallpaper, zoom outlines, icon physics
   ========================================================== */

#dots { position: absolute; inset: 0; width: 100%; height: 100%; z-index: -1; display: none; }
[data-wall="canvas"] #dots { display: block; }
[data-wall="canvas"] #desktop::before {
  background:
    radial-gradient(900px 600px at 78% 10%, rgba(120, 255, 235, 0.2), transparent 65%),
    radial-gradient(700px 500px at 8% 100%, rgba(0, 40, 60, 0.4), transparent 70%),
    #007878;
}
[data-wall="canvas"] #desktop::after { display: none; }
[data-wall="canvas"] #marquee { border: 1px solid #0d99ff; background: rgba(13, 153, 255, 0.12); }

/* Figma-style selection box with handles + size readout on the canvas */
[data-wall="canvas"] .dicon.selected .label { background: none; outline: none; text-shadow: 0 1px 2px rgba(0, 0, 0, 0.75); }
[data-wall="canvas"] .dicon.selected .img { filter: drop-shadow(1px 2px 0 rgba(0, 0, 0, 0.25)); }
[data-wall="canvas"] .dicon.selected::before {
  content: "";
  position: absolute;
  inset: 0;
  border: 1px solid #0d99ff;
  pointer-events: none;
  background:
    linear-gradient(#fff, #fff) -3px -3px / 7px 7px no-repeat,
    linear-gradient(#fff, #fff) calc(100% + 3px) -3px / 7px 7px no-repeat,
    linear-gradient(#fff, #fff) -3px calc(100% + 3px) / 7px 7px no-repeat,
    linear-gradient(#fff, #fff) calc(100% + 3px) calc(100% + 3px) / 7px 7px no-repeat;
  box-shadow: 0 0 0 0.5px rgba(13, 153, 255, 0.4);
  outline: none;
}
[data-wall="canvas"] .dicon.selected::after {
  content: attr(data-size);
  position: absolute;
  top: calc(100% + 6px);
  left: 50%;
  translate: -50% 0;
  padding: 1px 5px;
  background: #0d99ff;
  color: #fff;
  font: 500 10.5px/1.5 var(--font-ui);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  border-radius: 2px;
  pointer-events: none;
}
[data-wall="canvas"] .dicon.dragging::after { display: none; }

/* zoom rectangles (open / close / minimize) */
.zoomfx { position: fixed; inset: 0; pointer-events: none; z-index: 9700; }
.zoomrect {
  position: absolute;
  border: 2px dashed rgba(255, 255, 255, 0.95);
  outline: 1px solid rgba(0, 0, 0, 0.35);
  outline-offset: -3px;
}

/* icon life: nudged neighbours spring, picked-up icons lift */
.dicon { transition: translate 260ms cubic-bezier(.3, 1.6, .5, 1); }
.dicon.dragging { transition: none; opacity: 1; }
.dicon .img { transition: scale 160ms cubic-bezier(.3, 1.6, .5, 1), filter 160ms; }
.dicon.picked .img { scale: 1.14; filter: drop-shadow(3px 8px 4px rgba(0, 0, 0, 0.35)); }
.dicon.hungry .img { scale: 1.2; }
.dicon.fidget .img { animation: fidget 420ms cubic-bezier(.3, .7, .3, 1); }
@keyframes fidget {
  0%, 100% { transform: none; }
  25% { transform: rotate(-7deg) translateY(-2px); }
  50% { transform: rotate(6deg); }
  75% { transform: rotate(-3deg); }
}
.dicon.chewing .img { animation: chew 110ms steps(2) 6; }
@keyframes chew { 50% { transform: translateX(2px) scale(1.06, .94); } }

.float-txt {
  position: absolute;
  left: 50%;
  top: -6px;
  padding: 2px 7px;
  background: #ffffe1;
  color: #0b0b0b;
  border: 1px solid #0b0b0b;
  font: 600 12px/1.4 var(--font-pixel);
  white-space: nowrap;
  pointer-events: none;
  box-shadow: 2px 2px 0 rgba(0, 0, 0, 0.25);
  animation: float-up 1300ms cubic-bezier(.2, .8, .3, 1) forwards;
  z-index: 5;
}
@keyframes float-up {
  0% { opacity: 0; transform: translate(-50%, 6px) scale(.6); }
  15% { opacity: 1; transform: translate(-50%, -6px) scale(1.05); }
  75% { opacity: 1; transform: translate(-50%, -16px) scale(1); }
  100% { opacity: 0; transform: translate(-50%, -24px) scale(.96); }
}


/* ---------- Responsive ---------- */

@media (max-width: 1000px) {
}

@media (max-width: 700px) {
  .win { min-width: 0; }
  .win .grip { display: none; }
  .win:not(.dialog) { left: 0 !important; top: 0 !important; width: 100% !important; height: 100% !important; box-shadow: var(--bevel-out); }
  .win.dialog { left: 12px !important; right: 12px; width: auto !important; }
  .tbtn[data-act="max"] { display: none; }
  .titlebar { height: 34px; font-size: 14px; }
  .tbtn { width: 30px; height: 26px; }
  .tbtn svg { width: 12px; height: 12px; }
  .mi { padding: 10px 14px; font-size: 15px; }

  .about { grid-template-columns: 1fr; padding: 14px; }
  .about-photo { position: static; max-width: 280px; }
  .doc { padding: 8px; }
  .doc-page { padding: 24px 20px; }
  .files { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 12px 8px; padding: 10px; }
  .viewer-info { grid-template-columns: 1fr; }
  .mail-row { grid-template-columns: 1fr; gap: 4px; }
  .mail-row label { text-align: left; }
  .dd-tools { flex-direction: row; }
  .doodle-main { flex-direction: column; }
  .dd-tools .tool { flex: 1; width: auto; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* ==========================================================
   v3: macOS layout, Windows 98 materials
   ========================================================== */

:root { --menu-h: 34px; --dock-h: 82px; }

#desktop { inset: var(--menu-h) 0 0 0; }
.win.max { height: calc(100% - var(--dock-h)) !important; }

/* menu bar */
#menubar {
  position: fixed; inset: 0 0 auto 0; height: var(--menu-h); z-index: 9000;
  display: flex; align-items: center; gap: 4px; padding: 0 8px;
  background: var(--face); box-shadow: inset 0 -1px var(--face-dk), inset 0 -2px var(--face-lo), inset 0 1px var(--face-hi);
  font-size: 13.5px; white-space: nowrap; user-select: none; -webkit-user-select: none;
}
#menubar button, #menubar a { height: 26px; padding: 0 10px; border: 0; background: none; color: var(--text); text-decoration: none; display: inline-flex; align-items: center; gap: 6px; }
#menubar button:hover, #menubar a:hover { box-shadow: var(--bevel-thin-out); color: var(--text); }
#menubar button:active, #menubar a:active { box-shadow: var(--bevel-thin-in); }
#menubar :focus-visible { outline: 1px dotted var(--text); outline-offset: -3px; }
#menubar #start-btn { padding: 0 7px; }
#menubar #start-btn[aria-expanded="true"] { box-shadow: var(--bevel-thin-in); }
.start-logo { width: 19px; height: 19px; }
#menubar .mb-name { font-weight: 700; }
.mb-nav { display: flex; margin-left: 6px; }
.mb-space { flex: 1; }
#available { display: inline-flex; align-items: center; gap: 7px; font-weight: 500; margin-right: 8px; }
#available[hidden] { display: none; }
#available i { width: 9px; height: 9px; border-radius: 50%; background: #17a34a; box-shadow: 0 0 0 3px rgba(23, 163, 74, 0.25); }
#search-btn kbd { font: 11px var(--font-mono); padding: 0 4px; box-shadow: var(--bevel-thin-in); background: var(--field); }
#menubar #resume { background: var(--select); color: var(--select-text); font-weight: 600; box-shadow: var(--bevel-thin-out); }
#menubar #sound-btn { width: 26px; padding: 4px; }
#clock { padding: 0 6px; font-variant-numeric: tabular-nums; }

#start-menu { top: var(--menu-h); bottom: auto; left: 4px; max-height: calc(100dvh - var(--menu-h) - 8px); transform-origin: top left; }

/* dock */
#dock { position: fixed; left: 0; right: 0; bottom: max(8px, env(safe-area-inset-bottom)); display: flex; justify-content: center; z-index: 8900; pointer-events: none; }
.dock-bar { display: flex; align-items: flex-end; padding: 6px 8px; background: var(--face); box-shadow: var(--bevel-out), var(--shadow); pointer-events: auto; max-width: calc(100vw - 16px); }
#dock-apps, #tasks { display: flex; align-items: flex-end; gap: 4px; }
#tasks:not(:empty) { margin-left: 8px; padding-left: 8px; box-shadow: inset 1px 0 var(--face-lo), inset 2px 0 var(--face-hi); }
.dock-item { position: relative; width: 52px; height: 52px; padding: 7px 7px 9px; border: 0; background: none; flex: none; }
.dock-item .img { display: block; width: 36px; height: 36px; scale: var(--mag, 1); transform-origin: 50% 100%; transition: scale 90ms ease-out; }
.dock-item .tip {
  position: absolute; left: 50%; bottom: calc(100% + 24px); translate: -50% 0; padding: 2px 8px;
  background: #ffffe1; color: #0b0b0b; border: 1px solid #0b0b0b; font-size: 12.5px; white-space: nowrap;
  opacity: 0; pointer-events: none; max-width: 240px; overflow: hidden; text-overflow: ellipsis;
}
.dock-item:hover .tip, .dock-item:focus-visible .tip { opacity: 1; }
.dock-item:focus-visible { outline: 1px dotted var(--text); }
.dock-item.running::after { content: ""; position: absolute; left: 50%; bottom: 1px; translate: -50% 0; width: 5px; height: 5px; background: var(--text); }
.dock-item.active { box-shadow: var(--bevel-thin-in); }

/* pixel traffic lights */
.titlebar { padding: 0 6px; gap: 8px; height: 28px; }
.tbtns { gap: 5px; }
.tbtn { width: 15px; height: 15px; color: #3a0b0b; box-shadow: inset -1px -1px rgba(0,0,0,.55), inset 1px 1px rgba(255,255,255,.7), 0 0 0 1px #000; }
.tbtn[data-act="close"] { margin: 0; background: #ff5f57; }
.tbtn[data-act="min"] { background: #febc2e; }
.tbtn[data-act="max"] { background: #28c840; }
.tbtn svg { width: 9px; height: 9px; opacity: 0; }
.tbtns:hover svg, .tbtn:focus-visible svg { opacity: 1; }
.tbtn:active { box-shadow: inset 1px 1px rgba(0,0,0,.55), 0 0 0 1px #000; }
.win:not(.active) .tbtn { background: var(--face-lt); }
.ttext { text-align: center; }

/* home: name card and selected work */
#home { position: absolute; inset: 0 0 var(--dock-h) 0; overflow-y: auto; overflow-x: hidden; display: flex; padding: 24px 112px 12px 24px; pointer-events: none; }
.home-wrap { margin: auto; width: 100%; max-width: 1180px; display: grid; grid-template-columns: 320px minmax(0, 1fr); gap: 28px; align-items: center; }
.card, .work { pointer-events: auto; }
.card { background: var(--face); box-shadow: var(--bevel-out), var(--shadow); padding: 3px; }
.card-bar { display: flex; align-items: center; gap: 10px; height: 28px; padding: 0 7px; background: var(--title-a); color: var(--title-text); font-size: 12.5px; font-weight: 600; }
.lights { display: flex; gap: 5px; }
.lights i { width: 11px; height: 11px; background: #ff5f57; box-shadow: 0 0 0 1px #000; }
.lights i:nth-child(2) { background: #febc2e; }
.lights i:nth-child(3) { background: #28c840; }
.card-body { background: var(--field); box-shadow: var(--bevel-in); margin-top: 3px; padding: 20px; }
.card-body img { width: 92px; height: 92px; object-fit: cover; padding: 3px; background: var(--face); box-shadow: var(--bevel-out); margin-bottom: 14px; }
.card-body h1 { margin: 0; font: 600 34px/1.05 var(--font-pixel); }
.card-body p { margin: 0 0 12px; font-size: 14.5px; text-wrap: pretty; }
.card-body .card-role { font-size: 17px; font-weight: 600; margin: 8px 0; }
.card-prev { display: flex; flex-wrap: wrap; gap: 5px; align-items: center; }
.card-prev span { width: 100%; font-size: 11px; letter-spacing: .12em; text-transform: uppercase; color: var(--text-dim); }
.card-prev b { font-size: 12.5px; padding: 2px 8px; background: var(--face); color: var(--text); box-shadow: var(--bevel-thin-out); }
.card-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 4px; }
.card-actions .btn { flex: 1; white-space: nowrap; }
.work-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 12px; }
.work-head h2 { margin: 0; color: #fff; font: 600 24px/1.1 var(--font-pixel); text-shadow: 2px 2px 0 rgba(0,0,0,.35); }
.work-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.shot { display: flex; flex-direction: column; text-align: left; padding: 4px 4px 8px; border: 0; background: var(--face); color: var(--text); box-shadow: var(--bevel-out), 0 10px 24px -12px rgba(0,0,0,.6); transition: translate 180ms cubic-bezier(.3,1.5,.5,1); }
.shot img { width: 100%; height: auto; aspect-ratio: 3 / 2; object-fit: cover; margin-bottom: 7px; }
.shot-name { font-weight: 600; font-size: 13.5px; line-height: 1.3; padding: 0 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.shot-kind { font-size: 12px; color: var(--text-dim); padding: 0 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.shot:hover, .shot.demo { translate: 0 -5px; }
.shot.demo { outline: 2px solid #fff; }
.shot:focus-visible { outline: 2px dashed #fff; outline-offset: 2px; }
.apps-grid { display: none; }
[data-wall="clouds"] .work-head h2 { text-shadow: 2px 2px 0 rgba(0,40,100,.6); }

#icons { pointer-events: none; }
.dicon { pointer-events: auto; cursor: pointer; }

/* spotlight */
#spotlight { position: fixed; inset: 0; z-index: 9650; background: rgba(0,0,0,.25); display: flex; justify-content: center; align-items: flex-start; padding: 14vh 14px 0; }
.sp-box { width: min(560px, 100%); background: var(--face); box-shadow: var(--bevel-out), var(--shadow); padding: 6px; }
#sp-input { width: 100%; border: 0; background: var(--field); color: var(--text); box-shadow: var(--bevel-in); padding: 11px 12px; font-size: 17px; outline: none; }
#sp-list { list-style: none; margin: 6px 0 0; padding: 0; }
#sp-list li { display: flex; align-items: center; gap: 10px; padding: 6px 8px; cursor: pointer; font-size: 14px; }
#sp-list li > span:last-child { margin-left: auto; font-size: 12px; opacity: .75; text-align: right; }
#sp-list li[aria-selected="true"], #sp-list li[data-i]:hover { background: var(--select); color: var(--select-text); }
.sp-img { width: 34px; height: 24px; display: grid; place-items: center; flex: none; }
.sp-img img { width: 34px; height: 23px; object-fit: cover; }
.sp-img svg { width: 22px; height: 22px; }

/* quick look */
#quicklook { position: fixed; inset: 0; z-index: 9640; background: rgba(0,0,0,.55); display: grid; place-items: center; padding: 24px; cursor: zoom-out; }
#quicklook figure { margin: 0; padding: 5px; background: var(--face); box-shadow: var(--bevel-out), var(--shadow); animation: win-in 200ms ease-out; }
#quicklook img { max-width: min(1000px, 86vw); max-height: 74vh; }
#quicklook figcaption { padding: 6px 4px 1px; font-size: 13px; text-align: center; }

/* notification */
#toast { position: fixed; top: calc(var(--menu-h) + 10px); right: 10px; z-index: 9100; display: flex; align-items: center; gap: 12px; padding: 10px 34px 10px 12px; max-width: calc(100vw - 20px); background: var(--face); color: var(--text); box-shadow: var(--bevel-out), var(--shadow); font-size: 13px; animation: toast-in 360ms cubic-bezier(.2,.9,.3,1.2); }
#toast .img { width: 30px; height: 30px; flex: none; }
#toast b { display: block; }
.toast-x { position: absolute; top: 5px; right: 5px; width: 18px; height: 18px; padding: 4px; border: 0; background: none; color: var(--text); }
.toast-x svg { display: block; width: 100%; height: 100%; }
@keyframes toast-in { from { opacity: 0; transform: translateX(110%); } }

/* first-visit ghost cursor */
.ghost { position: fixed; left: 0; top: 0; z-index: 9800; pointer-events: none; display: flex; align-items: flex-start; gap: 4px; }
.ghost svg { width: 24px; height: 36px; filter: drop-shadow(2px 2px 0 rgba(0,0,0,.3)); transition: scale 120ms; }
.ghost span { margin-top: 24px; padding: 2px 8px; background: #ffffe1; color: #0b0b0b; border: 1px solid #000; font-size: 12.5px; white-space: nowrap; }
.ghost.press svg { scale: .75; }

#spotlight[hidden], #quicklook[hidden], #toast[hidden] { display: none; }

@media (max-width: 1100px) {
  #available, #search-btn kbd { display: none; }
  .home-wrap { grid-template-columns: 280px minmax(0, 1fr); gap: 20px; }
  .work-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 860px) {
  .home-wrap { grid-template-columns: 1fr; max-width: 560px; }
  #clock { display: none; }
}

/* phone: a home screen */
@media (max-width: 700px) {
  :root { --menu-h: 44px; --dock-h: 78px; }
  #menubar button, #menubar a { height: 34px; padding: 0 8px; }
  .mb-nav, #sound-btn, #search-btn kbd { display: none; }
  #menubar #sound-btn { display: none; }
  #icons, #tasks { display: none; }
  .dock-item { width: 56px; height: 54px; }
  #home { padding: 14px 14px 8px; }
  .home-wrap { margin: 0 auto; gap: 18px; align-content: start; }
  .card-body { padding: 16px; display: block; }
  .card-body img { float: right; width: 72px; height: 72px; margin: 0 0 8px 10px; }
  .card-body h1 { font-size: 28px; }
  .apps-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px 4px; pointer-events: auto; }
  .apps-grid button { display: flex; flex-direction: column; align-items: center; gap: 5px; padding: 6px 0; border: 0; background: none; color: #fff; font-size: 12px; text-shadow: 0 1px 2px rgba(0,0,0,.7); }
  .apps-grid .img { width: 40px; height: 40px; }
  .work-grid { grid-template-columns: 1fr; }
  .win:not(.dialog) { height: calc(100% - var(--dock-h)) !important; }
  .tbtn[data-act="min"] { display: none; }
  .tbtn { width: 22px; height: 22px; }
  .tbtn svg { width: 12px; height: 12px; opacity: 1; }
  .titlebar { height: 38px; }
  #start-menu { left: 0; right: 0; width: auto; bottom: auto; }
}

/* pinned dock apps keep their label visible; open windows show it on hover */
:root { --dock-h: 94px; }
#dock-apps .dock-item { width: 74px; height: 62px; padding: 3px 2px 4px; display: flex; flex-direction: column; align-items: center; gap: 3px; }
#dock-apps .dock-item .img { width: 34px; height: 34px; }
#dock-apps .dock-item .tip { position: static; translate: none; opacity: 1; background: none; border: 0; padding: 0; color: var(--text); font-size: 11.5px; line-height: 1.3; }
@media (max-width: 700px) {
  :root { --dock-h: 88px; }
  #dock-apps .dock-item { width: 68px; }
}
@media (max-width: 700px) {
  .dock-bar { width: calc(100vw - 16px); padding: 6px 4px; }
  #dock-apps { width: 100%; gap: 0; }
  #dock-apps .dock-item { width: auto; flex: 1; min-width: 0; padding-inline: 0; }
}

/* keep the name card and its buttons fully visible on mid-size and short screens */
@media (min-width: 701px) and (max-width: 1100px) {
  #home .home-wrap { align-items: start; }
  .work-grid .shot:nth-child(n + 5) { display: none; }
}
@media (min-width: 701px) and (max-height: 760px) {
  #home { padding-top: 12px; }
  .card-body { padding: 14px 18px; }
  .card-body img { width: 64px; height: 64px; margin-bottom: 8px; }
  .card-body h1 { font-size: 28px; }
  .card-body p { margin-bottom: 8px; font-size: 13.5px; }
  .shot img { aspect-ratio: 16 / 9; }
}

/* availability on the name card, wherever the menu bar has no room for it */
.card-body .card-open { display: none; align-items: center; gap: 8px; font-weight: 600; font-size: 13.5px; }
.card-open i { width: 9px; height: 9px; flex: none; border-radius: 50%; background: #17a34a; box-shadow: 0 0 0 3px rgba(23, 163, 74, 0.25); }
@media (max-width: 1100px) { .card-body .card-open { display: flex; } }

/* movable landing tiles and a working name-card window */
.card, .shot { position: relative; }
.shot img { -webkit-user-drag: none; pointer-events: none; }
.shot { user-select: none; -webkit-user-select: none; }
.card.moving, .shot.moving { box-shadow: var(--bevel-out), 0 30px 50px -16px rgba(0, 0, 0, 0.65); cursor: grabbing; }
.shot.moving { transition: none; translate: none; }
.card-bar { cursor: grab; user-select: none; -webkit-user-select: none; }
.card-bar .tbtn { padding: 0; border: 0; display: grid; place-items: center; }
.card.parked { visibility: hidden; }
.card.max { position: fixed; inset: var(--menu-h) 0 var(--dock-h) 0 !important; z-index: 900 !important; display: flex; flex-direction: column; animation: win-in 220ms ease-out; }
.card.max .card-bar { cursor: default; flex: none; }
.card.max .card-body { flex: 1; overflow: auto; display: flex; flex-direction: column; align-items: center; justify-content: safe center; text-align: center; }
.card.max .card-body > * { max-width: 560px; flex: none; }
.card.max .card-body img { width: 140px; height: 140px; }
.card.max .card-body h1 { font-size: 48px; }
.card.max .card-body p { font-size: 17px; }
.card.max .card-prev { justify-content: center; }
.card.max .card-actions .btn { min-width: 160px; }
@media (max-width: 700px) {
  .card-bar .tbtns { pointer-events: none; }
  .card-bar .tbtn svg { opacity: 0; }
  .card-bar .tbtn[data-act="min"] { display: grid; }
}

/* bigger click targets than the 15px lights suggest */
.tbtns { gap: 7px; }
.tbtn { position: relative; width: 16px; height: 16px; }
.tbtn::before { content: ""; position: absolute; inset: -7px -3.5px; }
@media (max-width: 700px) { .tbtn { width: 22px; height: 22px; } }

/* without this, display:flex overrides the hidden attribute and minimize does nothing */
.win[hidden] { display: none; }
@media (max-width: 700px) { .card-bar .tbtns { display: none; } }

/* the landing page is its own layer: however often a tile is dragged, windows stay above it */
#home { z-index: 0; }
#home:has(.card.max) { z-index: 4; }

/* ==========================================================
   E-ink theme: paper, black ink, hard lines, no motion
   ========================================================== */

#eink-btn i { width: 13px; height: 13px; border-radius: 50%; border: 1.5px solid currentColor; background: linear-gradient(90deg, currentColor 50%, transparent 50%); }
#menubar #eink-btn[aria-pressed="true"] { box-shadow: var(--bevel-thin-in); }
@media (max-width: 1100px) { #eink-btn span { display: none; } }

body[data-scheme="eink"] {
  --ink: #141414;
  --paper: #e9e7df;
  --face: #e9e7df;
  --face-hi: #f4f2ea;
  --face-lt: #dedbd1;
  --face-lo: #77746c;
  --face-dk: #141414;
  --field: #f4f2ea;
  --text: #141414;
  --text-dim: #47453f;
  --link: #141414;
  --accent: #141414;
  --select: #141414;
  --select-text: #f4f2ea;
  --title-a: #141414;
  --title-b: #141414;
  --title-text: #f4f2ea;
  --title-ia: #cfccc2;
  --title-ib: #cfccc2;
  --bevel-out: inset 0 0 0 1px #141414;
  --bevel-in: inset 0 0 0 1px #141414;
  --bevel-thin-out: inset 0 0 0 1px #141414;
  --bevel-thin-in: inset 0 0 0 2px #141414;
  --shadow: 4px 4px 0 rgba(20, 20, 20, 0.85);
  --font-ui: "Literata", Georgia, serif;
  background: var(--paper);
}

/* paper wallpaper with a fine grain, whatever wallpaper is picked */
body[data-scheme="eink"] #desktop::before { background: var(--paper); }
body[data-scheme="eink"] #desktop::after { display: block; mix-blend-mode: multiply; background: radial-gradient(rgba(20, 20, 20, 0.13) 0.6px, transparent 0.8px) 0 0 / 4px 4px; }
body[data-scheme="eink"] #dots { display: none; }

/* ink only; project thumbnails show their colour when you point at them */
body[data-scheme="eink"] svg.pix { filter: grayscale(1) contrast(1.25); }
body[data-scheme="eink"] :is(#home, #dock, #toast, #spotlight, .about, .files, .details) img { filter: grayscale(1) contrast(1.08); }
body[data-scheme="eink"] :is(.shot:hover, .shot:focus-visible, .shot.demo, .file:hover, .file:focus-visible) img { filter: none; }

/* text that was white on the coloured wallpaper */
body[data-scheme="eink"] :is(.work-head h2, .apps-grid button) { color: var(--ink); text-shadow: none; }
body[data-scheme="eink"] .dicon .label { color: var(--ink); text-shadow: none; background: none; }
body[data-scheme="eink"] .dicon.selected .label { background: var(--ink); color: var(--paper); }
body[data-scheme="eink"] .dicon .img,
body[data-scheme="eink"] .viewer-stage img { filter: none; }
body[data-scheme="eink"] .dicon.selected::before { border-color: var(--ink); box-shadow: none; }
body[data-scheme="eink"] .dicon.selected::after { background: var(--ink); color: var(--paper); }
body[data-scheme="eink"] .win:not(.active) .titlebar { color: var(--ink); }
body[data-scheme="eink"] .shot:focus-visible { outline-color: var(--ink); }
body[data-scheme="eink"] .shot.demo { outline-color: var(--ink); }
body[data-scheme="eink"] .zoomrect { border-color: var(--ink); outline-color: transparent; }
body[data-scheme="eink"] #marquee { border: 1px dashed var(--ink); background: rgba(20, 20, 20, 0.08); }
body[data-scheme="eink"] .viewer-stage { background: var(--field); }

/* window lights become white, grey and black */
body[data-scheme="eink"] :is(.win, .card) .tbtn { background: #f4f2ea; color: #141414; box-shadow: 0 0 0 1px #77746c; }
body[data-scheme="eink"] :is(.win, .card) .tbtn[data-act="min"] { background: #aaa79e; }
body[data-scheme="eink"] :is(.win, .card) .tbtn[data-act="max"] { background: #77746c; }
body[data-scheme="eink"] .card-open i,
body[data-scheme="eink"] #available i { background: var(--ink); box-shadow: 0 0 0 3px rgba(20, 20, 20, 0.2); }

/* e-ink holds still */
body[data-scheme="eink"] .titlebar::after { display: none; }
body[data-scheme="eink"] :is(.shot, .dicon, .dicon .img, .dock-item .img, .btn) { transition: none; animation: none; }
body[data-scheme="eink"] .dock-item .img { scale: 1; }
body[data-scheme="eink"] .win.opening { animation: none; }

.eink-flash { position: fixed; inset: 0; z-index: 10001; pointer-events: none; animation: eink-flash 360ms steps(1) forwards; }
@keyframes eink-flash { 0% { background: #141414; } 45% { background: #f4f2ea; } 100% { background: transparent; } }

#menubar #resume { gap: 0; }
@media (max-width: 700px) { .rs-long { display: none; } }
