/* ziqiaodai.dev, a cosy little desktop. No build step, no dependencies. */

/* ---------- Tokens ---------- */
:root {
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display", Inter, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --serif: "New York", "Iowan Old Style", "Charter", "Bitstream Charter", "Source Serif Pro", Georgia, Cambria, serif;
  --mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Monaco, "Cascadia Mono", "Roboto Mono", Consolas, monospace;

  --mb-h: 30px;
  --dock-h: 78px;
  --radius: 12px;
  --spring: cubic-bezier(.2, 1.28, .38, 1);
  --ease-out: cubic-bezier(.22, .8, .3, 1);

  /* light (warm dusk cream) */
  --text: #2b211c;
  --text-2: #64544a;
  --text-3: #79685e;
  --accent: #b14f20;
  --accent-ink: #fff;
  --accent-soft: rgba(196, 98, 45, .14);
  --link: #a8461a;

  --win-bg: rgba(255, 250, 245, .94);
  --win-solid: #fffaf5;
  --win-side: rgba(246, 236, 227, .82);
  --win-border: rgba(80, 45, 25, .12);
  --win-line: rgba(80, 45, 25, .10);
  --win-title: #4a3a31;
  --win-shadow: 0 24px 70px rgba(70, 35, 20, .28), 0 4px 14px rgba(70, 35, 20, .12);
  --win-shadow-inactive: 0 14px 40px rgba(70, 35, 20, .18), 0 2px 8px rgba(70, 35, 20, .08);
  --hover: rgba(90, 50, 25, .07);
  --select: rgba(177, 79, 32, .14);

  --mb-bg: rgba(255, 246, 238, .58);
  --mb-text: #2b211c;
  --dd-bg: rgba(255, 249, 243, .9);
  --dock-bg: rgba(255, 245, 236, .42);
  --dock-border: rgba(255, 255, 255, .55);

  --icon-label: #2b211c;
  --icon-label-shadow: none;

  --wall-tint: #ffffff;
  --wall-pos: 50% 60%;
  --wall-fallback: #695943;
  --label-pill: rgba(255,250,245,.62);
  --top-scrim: rgba(255,250,245,.62);

  --note-bg: #fff3c2;
  --note-text: #4a3b1a;
  --note-text-2: #6b5a2f;

  color-scheme: light;
}

html[data-theme="dark"] {
  --text: #f3eae2;
  --text-2: #c2b3a8;
  --text-3: #9d8f86;
  --accent: #f09a5f;
  --accent-ink: #26160c;
  --accent-soft: rgba(240, 154, 95, .16);
  --link: #f4a872;

  --win-bg: rgba(40, 32, 46, .93);
  --win-solid: #2a2230;
  --win-side: rgba(52, 42, 58, .8);
  --win-border: rgba(255, 230, 210, .12);
  --win-line: rgba(255, 230, 210, .09);
  --win-title: #e6dad0;
  --win-shadow: 0 24px 70px rgba(5, 2, 10, .6), 0 4px 14px rgba(5, 2, 10, .35);
  --win-shadow-inactive: 0 14px 40px rgba(5, 2, 10, .45), 0 2px 8px rgba(5, 2, 10, .25);
  --hover: rgba(255, 235, 220, .07);
  --select: rgba(240, 154, 95, .18);

  --mb-bg: rgba(32, 23, 40, .55);
  --mb-text: #f3eae2;
  --dd-bg: rgba(44, 35, 52, .92);
  --dock-bg: rgba(48, 36, 56, .45);
  --dock-border: rgba(255, 230, 210, .14);

  --icon-label: #fff8f1;
  --icon-label-shadow: 0 1px 3px rgba(0, 0, 0, .7);

  --wall-tint: #80624a;
  --label-pill: rgba(28,20,34,.35);
  --top-scrim: rgba(28,20,34,.35);

  --note-bg: #e8d48e;
  --note-text: #3a2e12;
  --note-text-2: #54461f;

  color-scheme: dark;
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font: 14px/1.45 var(--font);
  color: var(--text);
  background: #695943;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  -webkit-tap-highlight-color: transparent;
}
html[data-theme="dark"] body { background: #352213; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: default; }
a { color: var(--link); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
.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; }
.defs { position: absolute; width: 0; height: 0; overflow: hidden; }
[hidden] { display: none !important; }

/* gradient stops */
.s-amber-1 { stop-color: #f7c27a; } .s-amber-2 { stop-color: #e79a4a; }
.s-plum-1  { stop-color: #d9a3c4; } .s-plum-2  { stop-color: #b0739d; }
.s-sage-1  { stop-color: #b9cfa2; } .s-sage-2  { stop-color: #87a675; }
.s-paper-1 { stop-color: #fffdf9; } .s-paper-2 { stop-color: #f1e7dc; }
.s-finder-1{ stop-color: #7cc0f5; } .s-finder-2{ stop-color: #2f86e0; }
.s-notes-1 { stop-color: #ffd65c; } .s-notes-2 { stop-color: #f6b928; }
.s-book-1  { stop-color: #b46e4f; } .s-book-2  { stop-color: #7f4330; }
.s-term-1  { stop-color: #3b3540; } .s-term-2  { stop-color: #1b171f; }
.s-mail-1  { stop-color: #6fb6ff; } .s-mail-2  { stop-color: #2c7be5; }
.s-cv-1    { stop-color: #f4ece4; } .s-cv-2    { stop-color: #d9cabd; }

/* ---------- Wallpaper ---------- */
body::before {
  content: ""; position: fixed; inset: 0; z-index: -2;
  background-color: var(--wall-fallback);
  background-image: none, linear-gradient(var(--wall-tint), var(--wall-tint)), url("/assets/img/wallpaper-desktop.webp");
  background-position: 0 0, 0 0, var(--wall-pos);
  background-size: 100% 100%, 100% 100%, cover;
  background-repeat: no-repeat;
  background-blend-mode: normal, multiply, normal;
}
@supports (background-image: image-set(url("x.webp") 1x)) {
  body::before {
    background-image: none, linear-gradient(var(--wall-tint), var(--wall-tint)), image-set(url("/assets/img/wallpaper-desktop.webp") 1x, url("/assets/img/wallpaper-desktop-2x.webp") 2x);
  }
}

/* ---------- Menu bar ---------- */
.menubar {
  position: fixed; top: 0; left: 0; right: 0; height: var(--mb-h); z-index: 5000;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 10px 0 12px;
  background: var(--mb-bg);
  -webkit-backdrop-filter: blur(24px) saturate(1.6); backdrop-filter: blur(24px) saturate(1.6);
  border-bottom: 1px solid rgba(255, 255, 255, .18);
  color: var(--mb-text); font-size: 13px; user-select: none;
}
.mb-left, .mb-right, .mb-menus { display: flex; align-items: center; gap: 2px; height: 100%; }
.mb-logo { width: 28px; height: 22px; display: grid; place-items: center; border-radius: 5px; }
.mb-logo svg { width: 17px; height: 17px; }
.logo-bg { fill: currentColor; }
.logo-z { fill: none; stroke: var(--mb-bg-solid, #f6dcc8); stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
html[data-theme="dark"] .logo-z { stroke: #2b2040; }
.mb-name { font-weight: 700; padding: 0 8px 0 4px; letter-spacing: -.01em; white-space: nowrap; }
.mb-item, .mb-icon, .mb-clock { height: 22px; padding: 0 9px; border-radius: 5px; display: inline-flex; align-items: center; white-space: nowrap; }
.mb-item:hover, .mb-item[aria-expanded="true"], .mb-logo:hover, .mb-icon:hover { background: rgba(255, 255, 255, .32); }
html[data-theme="dark"] .mb-item:hover, html[data-theme="dark"] .mb-item[aria-expanded="true"], html[data-theme="dark"] .mb-logo:hover, html[data-theme="dark"] .mb-icon:hover { background: rgba(255, 255, 255, .12); }
.mb-icon svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; }
.mb-icon .ic-moon { fill: currentColor; stroke: none; }
.ic-sun { display: none; }
html[data-theme="dark"] .ic-sun { display: block; }
html[data-theme="dark"] .ic-moon { display: none; }
.mb-clock { font-variant-numeric: tabular-nums; font-weight: 500; }
.mb-menu { position: relative; height: 100%; display: flex; align-items: center; }
.dropdown {
  position: absolute; top: calc(var(--mb-h) - 3px); left: 0; min-width: 180px; padding: 5px;
  background: var(--dd-bg); color: var(--text);
  -webkit-backdrop-filter: blur(30px) saturate(1.6); backdrop-filter: blur(30px) saturate(1.6);
  border: 1px solid var(--win-border); border-radius: 9px;
  box-shadow: 0 12px 34px rgba(40, 20, 10, .22);
  animation: dd-in .14s var(--ease-out);
}
.dropdown > button, .dropdown > a {
  display: block; width: 100%; text-align: left; padding: 4px 10px; border-radius: 5px;
  color: inherit; text-decoration: none; font-size: 13px; line-height: 1.5;
}
.dropdown > button:hover, .dropdown > a:hover, .dropdown > button:focus-visible, .dropdown > a:focus-visible { background: var(--accent); color: var(--accent-ink); outline: none; }
.dd-sep { height: 1px; margin: 4px 8px; background: var(--win-line); }
@keyframes dd-in { from { opacity: 0; transform: translateY(-4px); } }

/* ---------- Desktop ---------- */
.desktop { position: fixed; inset: var(--mb-h) 0 0 0; }
.icons {
  list-style: none; margin: 0; padding: 0;
  position: absolute; top: 16px; right: 18px; bottom: calc(var(--dock-h) + 16px);
  display: flex; flex-direction: column; flex-wrap: wrap-reverse; align-content: flex-start; gap: 6px 4px;
}
.icon {
  width: 96px; padding: 6px 4px 5px; border-radius: 8px;
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  touch-action: manipulation;
}
.icon-img { width: 60px; height: 60px; filter: drop-shadow(0 3px 5px rgba(60, 25, 10, .22)); transition: transform .25s var(--spring); }
.icon:active .icon-img { transform: scale(.94); }
.icon-label {
  font-size: 12px; font-weight: 500; line-height: 1.25; color: var(--icon-label); text-shadow: var(--icon-label-shadow);
  background: var(--label-pill);
  padding: 1px 6px; border-radius: 4px; text-align: center; max-width: 100%; overflow-wrap: anywhere;
}
.icon.is-selected .icon-img { filter: drop-shadow(0 3px 5px rgba(60, 25, 10, .22)) brightness(.88); }
.icon.is-selected .icon-label { background: var(--accent); color: var(--accent-ink); text-shadow: none; }
.icon:focus-visible { outline: none; }
.icon:focus-visible .icon-label { outline: 2px solid var(--accent); outline-offset: 1px; }

/* folder / doc artwork */
.f-back { fill: #d98a3f; }
.f-back.f-amber { fill: #d4863b; } .f-back.f-plum { fill: #9a6189; } .f-back.f-sage { fill: #75935f; }
.f-hi { stroke: rgba(255, 255, 255, .55); stroke-width: 1.2; fill: none; }
.f-em { fill: none; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.f-em-amber { stroke: #9a5520; } .f-em-plum { stroke: #6e3e60; } .f-em-sage { stroke: #4b6a3a; }
.doc { fill: url(#g-paper); stroke: rgba(90, 55, 30, .18); }
.doc-fold { fill: #e7d9cb; }
.doc-lines { stroke: #c9b6a6; stroke-width: 2; stroke-linecap: round; fill: none; }
.doc-tag { font: 700 7px var(--font); fill: #8f7766; text-anchor: middle; letter-spacing: .5px; }
.doc-avatar { fill: #e8b48f; }
.pdf-badge { fill: #d4573a; }
.pdf-tag { font: 800 7.5px var(--font); fill: #fff; text-anchor: middle; letter-spacing: .6px; }
.card { fill: url(#g-paper); stroke: rgba(90, 55, 30, .2); }
.card-flap { fill: none; stroke: #d39a73; stroke-width: 2.2; stroke-linejoin: round; stroke-linecap: round; }
.card-stamp { fill: #e9806b; }

/* sticky note widget */
.widget {
  position: absolute; top: 22px; left: 24px; width: 236px; padding: 14px 16px 12px;
  background: var(--note-bg); color: var(--note-text);
  border-radius: 4px 4px 14px 4px; transform: rotate(-1.6deg);
  box-shadow: 0 1px 0 rgba(0, 0, 0, .04), 0 12px 26px rgba(70, 40, 10, .2);
  font-size: 13px;
}
.widget::before { content: ""; position: absolute; top: -9px; left: 50%; width: 70px; height: 18px; margin-left: -35px; background: rgba(255, 255, 255, .5); transform: rotate(2deg); border-radius: 2px; }
.widget p { margin: 0; }
.widget-kicker { font: 600 11px var(--font); text-transform: uppercase; letter-spacing: .12em; color: var(--note-text-2); margin-bottom: 4px !important; }
.widget-line { font-family: var(--serif); font-size: 14.5px; line-height: 1.35; margin-bottom: 4px !important; }
.widget-latest { margin-top: 8px !important; font-size: 12.5px; }
.widget-latest button { text-decoration: underline; text-underline-offset: 2px; text-align: left; cursor: pointer; font-weight: 600; }
.widget-tip { margin-top: 10px !important; font-size: 11.5px; color: var(--note-text-2); }
.tip-touch { display: none; }
@media (hover: none) and (pointer: coarse) { .tip-touch { display: inline; } .tip-mouse { display: none; } }

/* ---------- Windows ---------- */
.windows { position: absolute; inset: 0; pointer-events: none; }
.win {
  position: absolute; pointer-events: auto;
  display: flex; flex-direction: column;
  min-width: 300px; min-height: 200px;
  background: var(--win-bg);
  -webkit-backdrop-filter: blur(30px) saturate(1.5); backdrop-filter: blur(30px) saturate(1.5);
  border: 1px solid var(--win-border); border-radius: var(--radius);
  box-shadow: var(--win-shadow-inactive);
  overflow: hidden;
  transform-origin: 50% 50%;
  transition: transform .42s var(--spring), opacity .22s ease, box-shadow .2s ease;
  outline: none;
}
.win.is-active { box-shadow: var(--win-shadow); }
.win.is-entering { opacity: 0; transform: scale(.9) translateY(12px); }
.win.is-closing { opacity: 0; transform: scale(.94); transition: transform .2s ease-in, opacity .18s ease-in; }
.win.is-geom { transition: transform .42s var(--spring), opacity .22s ease, left .34s var(--ease-out), top .34s var(--ease-out), width .34s var(--ease-out), height .34s var(--ease-out); }
.win.is-dragging { transition: none; user-select: none; }
.win.is-minimizing { transition: transform .38s cubic-bezier(.5, 0, .75, .2), opacity .38s ease-in; }

.titlebar {
  position: relative; flex: none; height: 38px; display: flex; align-items: center;
  padding: 0 12px; gap: 8px; border-bottom: 1px solid var(--win-line);
  user-select: none; touch-action: none;
}
.win-title { position: absolute; left: 80px; right: 80px; text-align: center; font-size: 13px; font-weight: 600; color: var(--win-title); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; pointer-events: none; }
.win:not(.is-active) .win-title { opacity: .55; }
.lights { display: flex; gap: 8px; position: relative; z-index: 1; }
.light { width: 12px; height: 12px; border-radius: 50%; display: grid; place-items: center; box-shadow: inset 0 0 0 .5px rgba(0, 0, 0, .18); }
.light svg { width: 8px; height: 8px; stroke: rgba(60, 10, 0, .7); stroke-width: 1.4; fill: none; stroke-linecap: round; opacity: 0; transition: opacity .12s; }
.l-close { background: #ff5f57; } .l-min { background: #febc2e; } .l-max { background: #28c840; }
.l-min svg { stroke: rgba(90, 50, 0, .75); } .l-max svg { stroke: rgba(0, 70, 10, .7); }
.lights:hover .light svg, .light:focus-visible svg { opacity: 1; }
.win:not(.is-active) .light { background: #d7cdc6; }
html[data-theme="dark"] .win:not(.is-active) .light { background: #5d5263; }
.win:not(.is-active) .lights:hover .l-close { background: #ff5f57; }
.win:not(.is-active) .lights:hover .l-min { background: #febc2e; }
.win:not(.is-active) .lights:hover .l-max { background: #28c840; }
.light:focus-visible { outline-offset: 2px; border-radius: 50%; }
.sheet-done { display: none; }

.win-body { flex: 1; min-height: 0; overflow: auto; container-type: inline-size; overscroll-behavior: contain; }
.resize-handle { position: absolute; right: 0; bottom: 0; width: 18px; height: 18px; cursor: nwse-resize; touch-action: none; z-index: 2; }
.win.is-max { border-radius: 10px; }
.win.is-max .resize-handle { display: none; }

/* ---------- Prose ---------- */
.prose { font-family: var(--serif); font-size: 17px; line-height: 1.7; color: var(--text); }
.prose > :first-child { margin-top: 0; }
.prose p { margin: 0 0 1em; }
.prose h2, .prose h3, .prose h4 { font-family: var(--font); line-height: 1.25; letter-spacing: -.01em; margin: 1.6em 0 .55em; }
.prose h2 { font-size: 1.3em; } .prose h3 { font-size: 1.1em; } .prose h4 { font-size: 1em; }
.prose a { color: var(--link); text-underline-offset: 3px; text-decoration-thickness: 1px; }
.prose ul, .prose ol { padding-left: 1.3em; margin: 0 0 1em; }
.prose li { margin: .25em 0; }
.prose blockquote { margin: 1.2em 0; padding: .2em 0 .2em 1em; border-left: 3px solid var(--accent); color: var(--text-2); font-style: italic; }
.prose code { font-family: var(--mono); font-size: .82em; background: var(--hover); padding: .12em .35em; border-radius: 4px; }
.prose pre { font-family: var(--mono); font-size: 13.5px; line-height: 1.55; background: #2a2230; color: #f3e6da; padding: 14px 16px; border-radius: 10px; overflow-x: auto; margin: 1.2em 0; }
html[data-theme="dark"] .prose pre { background: #1d1722; }
.prose pre code { background: none; padding: 0; font-size: inherit; color: inherit; }
.prose hr { border: 0; height: 1px; background: var(--win-line); margin: 2em 0; }
.prose img { max-width: 100%; height: auto; border-radius: 8px; }
.prose strong { font-weight: 700; }

.chips { list-style: none; padding: 0 !important; margin: 0 0 1em; display: flex; flex-wrap: wrap; gap: 6px; font-family: var(--font); }
.chips li { margin: 0 !important; font-size: 12.5px; line-height: 1; padding: 6px 10px; border-radius: 999px; background: var(--accent-soft); color: var(--text); }

.btn { display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 14px; border-radius: 8px; font: 600 13px var(--font); text-decoration: none; cursor: pointer; white-space: nowrap; }
.btn svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.btn-primary { background: var(--accent); color: var(--accent-ink); box-shadow: 0 1px 2px rgba(0, 0, 0, .15); }
.btn-primary:hover { filter: brightness(1.06); }
.btn-ghost { color: var(--text-2); }
.btn-ghost:hover { background: var(--hover); color: var(--text); }

/* ---------- About (TextEdit) ---------- */
.textedit { min-height: 100%; display: flex; flex-direction: column; }
.te-ruler { display: flex; gap: 14px; padding: 6px 16px; font-size: 11.5px; color: var(--text-3); border-bottom: 1px solid var(--win-line); font-family: var(--font); }
.te-page { padding: 24px 30px 30px; max-width: 640px; }
.te-hello { font-family: var(--font); font-size: 22px; line-height: 1.3; letter-spacing: -.015em; }
.lede { color: var(--text-2); font-style: italic; }
.te-links { font-family: var(--font); font-size: 14px; }

/* ---------- Finder (writing) ---------- */
.finder { display: grid; grid-template-columns: 170px minmax(220px, 280px) 1fr; height: 100%; }
.f-side { background: var(--win-side); border-right: 1px solid var(--win-line); padding: 12px 8px; overflow: auto; }
.f-group { font-size: 11px; font-weight: 600; color: var(--text-3); padding: 10px 8px 4px; }
.f-group:first-child { padding-top: 0; }
.f-link { display: flex; align-items: center; gap: 8px; width: 100%; padding: 5px 8px; border-radius: 6px; font-size: 13px; text-align: left; }
.f-link:hover { background: var(--hover); }
.f-link[aria-current="true"], .f-link[aria-pressed="true"] { background: var(--select); font-weight: 600; }
.f-link svg { width: 15px; height: 15px; flex: none; fill: none; stroke: var(--accent); stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.f-link .tag-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); opacity: .65; flex: none; margin: 0 3px; }
.f-tabs { display: none; }

.f-list { border-right: 1px solid var(--win-line); display: flex; flex-direction: column; min-height: 0; }
.f-list-head { padding: 10px 14px; font-size: 12px; color: var(--text-3); border-bottom: 1px solid var(--win-line); display: flex; justify-content: space-between; gap: 8px; }
.f-list-head strong { color: var(--text); font-size: 13px; }
.f-entries { list-style: none; margin: 0; padding: 6px; overflow: auto; flex: 1; }
.f-entry { display: block; width: 100%; text-align: left; padding: 9px 10px; border-radius: 8px; }
.f-entry:hover { background: var(--hover); }
.f-entry[aria-current="true"] { background: var(--accent); color: var(--accent-ink); }
.f-entry[aria-current="true"] .f-date, .f-entry[aria-current="true"] .f-ex { color: inherit; opacity: .85; }
.f-title { display: block; font-weight: 600; font-size: 13.5px; line-height: 1.3; }
.f-date { display: block; font-size: 11.5px; color: var(--text-3); margin-top: 2px; font-variant-numeric: tabular-nums; }
.f-ex { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; font-size: 12.5px; color: var(--text-2); margin-top: 3px; line-height: 1.4; }
.f-empty { padding: 20px 14px; color: var(--text-3); font-size: 13px; }

.f-reader { overflow: auto; min-width: 0; background: var(--win-solid); }
.f-reader-inner { max-width: 660px; margin: 0 auto; padding: 30px 36px 48px; }
.f-backbtn { display: none; }
.post-meta { font: 12.5px var(--font); color: var(--text-3); margin: 0 0 6px; display: flex; flex-wrap: wrap; gap: 6px 12px; align-items: center; }
.post-title { font-family: var(--serif); font-size: 30px; line-height: 1.18; letter-spacing: -.015em; margin: 0 0 22px; font-weight: 700; }
.post-tags { display: flex; gap: 6px; list-style: none; padding: 0; margin: 0; }
.post-tags li { font-size: 11.5px; padding: 2px 8px; border-radius: 999px; background: var(--accent-soft); color: var(--text-2); }
.post-actions { margin-top: 30px; padding-top: 16px; border-top: 1px solid var(--win-line); display: flex; gap: 8px; align-items: center; font-family: var(--font); }
.post-actions .copied { font-size: 12.5px; color: var(--text-3); }
.reader-empty { height: 100%; display: grid; place-items: center; color: var(--text-3); font-size: 13px; text-align: center; padding: 30px; }
.reader-empty svg { width: 44px; height: 44px; display: block; margin: 0 auto 10px; fill: none; stroke: currentColor; stroke-width: 1.4; opacity: .6; }

@container (max-width: 700px) {
  .finder { grid-template-columns: 1fr; grid-template-rows: auto 1fr; }
  .f-side { display: none; }
  .f-tabs { display: flex; gap: 6px; padding: 8px 10px; border-bottom: 1px solid var(--win-line); background: var(--win-side); overflow-x: auto; }
  .f-tabs .f-link { width: auto; flex: none; padding: 5px 12px; border-radius: 999px; }
  .f-list { border-right: 0; }
  .finder.show-reader .f-list, .finder.show-reader .f-tabs { display: none; }
  .finder:not(.show-reader) .f-reader { display: none; }
  .f-backbtn { display: inline-flex; margin-bottom: 14px; margin-left: -10px; }
  .f-reader-inner { padding: 20px 22px 40px; }
  .post-title { font-size: 26px; }
}

/* ---------- Projects ---------- */
.projects { padding: 18px 20px 24px; }
.pj-sec + .pj-sec { margin-top: 24px; }
.pj-sec h3 { font-size: 12px; font-weight: 600; color: var(--text-3); margin: 0 0 10px; display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.pj-sec h3 a { font-weight: 500; font-size: 12px; text-decoration: none; }
.pj-sec h3 a:hover { text-decoration: underline; }
.cards { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.pcard { display: flex; gap: 12px; padding: 14px; border-radius: 12px; background: var(--win-solid); border: 1px solid var(--win-line); color: inherit; text-decoration: none; height: 100%; transition: transform .2s var(--spring), box-shadow .2s; }
a.pcard:hover { transform: translateY(-2px); box-shadow: 0 8px 22px rgba(70, 35, 20, .12); }
.pcard svg { width: 40px; height: 40px; flex: none; }
.pcard-body { min-width: 0; }
.pcard-name { font-weight: 650; font-size: 14px; display: block; overflow-wrap: anywhere; }
.pcard-desc { font-size: 12.5px; color: var(--text-2); margin: 3px 0 6px; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.pcard-meta { font-size: 11.5px; color: var(--text-3); display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.badge { font-size: 10.5px; font-weight: 600; padding: 2px 7px; border-radius: 999px; background: var(--accent-soft); color: var(--text-2); }
.lang-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 4px; vertical-align: 0; background: var(--text-3); }
.pcard.skeleton { min-height: 86px; background: linear-gradient(90deg, var(--hover), transparent, var(--hover)); background-size: 200% 100%; animation: shimmer 1.4s linear infinite; }
@keyframes shimmer { to { background-position: -200% 0; } }
.pj-note { font-size: 12.5px; color: var(--text-3); }

/* ---------- Resume ---------- */
.resume { padding: 28px 34px 36px; max-width: 760px; margin: 0 auto; }
.rs-head { display: flex; justify-content: space-between; gap: 16px; align-items: flex-start; padding-bottom: 18px; border-bottom: 1px solid var(--win-line); flex-wrap: wrap; }
.rs-name { font-size: 26px; letter-spacing: -.02em; margin: 0; line-height: 1.2; }
.rs-aka { font-weight: 500; color: var(--text-3); font-size: .72em; }
.rs-role { margin: 4px 0 2px; color: var(--text-2); }
.rs-links { margin: 0; font-size: 13px; }
.rs-sec { margin-top: 22px; }
.rs-sec h3 { font-size: 11.5px; text-transform: uppercase; letter-spacing: .12em; color: var(--accent); margin: 0 0 10px; }
.rs-item + .rs-item { margin-top: 14px; }
.rs-row { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.rs-when { color: var(--text-3); font-size: 13px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.rs-org { color: var(--text-2); font-size: 13.5px; }
.rs-item ul { margin: 6px 0 0; padding-left: 1.2em; }
.rs-item li { margin: 2px 0; }

/* Resume: "Request my resume" form */
.rs-req { margin-top: 18px; padding: 16px 18px 16px; border-radius: 12px; background: var(--win-solid); border: 1px solid var(--win-line); box-shadow: 0 6px 22px rgba(60, 25, 10, .08); animation: rs-req-in .28s var(--spring, cubic-bezier(.2, .9, .25, 1)); }
@keyframes rs-req-in { from { opacity: 0; transform: translateY(-6px); } }
.rs-req[hidden] { display: none; }
.rs-req-form { display: grid; gap: 10px; }
.rs-req-form[hidden] { display: none; }
.rs-req-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.rs-req-title { margin: 0; font-size: 15px; letter-spacing: -.01em; }
.rs-req-x { width: 28px; height: 28px; border-radius: 8px; display: grid; place-items: center; color: var(--text-3); cursor: pointer; }
.rs-req-x:hover { background: var(--hover); color: var(--text); }
.rs-req-x svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
.rs-req-hint { margin: -4px 0 2px; font-size: 13px; color: var(--text-2); }
.rs-field { display: grid; gap: 4px; position: relative; }
.rs-field > span { font-size: 12px; font-weight: 600; color: var(--text-2); }
.rs-field em { font-style: normal; font-weight: 500; color: var(--text-3); margin-left: 4px; }
.rs-field .adm-input { font-size: 14px; }
.rs-field textarea.adm-input { min-height: 70px; max-height: 220px; padding-bottom: 20px; }
.rs-field .adm-input[aria-invalid="true"] { border-color: #c4473a; box-shadow: 0 0 0 1px #c4473a; }
.rs-count { position: absolute; right: 9px; bottom: 6px; font-size: 11px; color: var(--text-3); font-variant-numeric: tabular-nums; pointer-events: none; }
.rs-hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.rs-req-actions { display: flex; align-items: center; justify-content: flex-end; gap: 12px; margin-top: 2px; }
.rs-req-status { flex: 1; margin: 0; font-size: 12.5px; color: var(--text-2); min-height: 1.2em; }
.rs-req-status.is-error { color: #b3261e; }
html[data-theme="dark"] .rs-req-status.is-error { color: #ff9b8f; }
.rs-req-done { text-align: center; padding: 10px 6px 4px; outline: none; }
.rs-req-done[hidden] { display: none; }
.rs-req-done svg { width: 44px; height: 44px; fill: var(--accent-soft); stroke: var(--accent); stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.rs-req-done-t { margin: 8px 0 2px; font-weight: 700; font-size: 15px; }
.rs-req-done-s { margin: 0 0 10px; font-size: 13px; color: var(--text-2); }

/* ---------- Contact ---------- */
.contact { padding: 22px 22px 18px; }
.ct-card { text-align: center; margin-bottom: 16px; }
.ct-avatar { width: 64px; height: 64px; margin: 0 auto 10px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; font-size: 20px; color: #fff; background: linear-gradient(145deg, #f0a35e, #c0607a); box-shadow: 0 6px 16px rgba(150, 60, 40, .3); }
.ct-name { margin: 0; font-size: 18px; }
.ct-sub { margin: 2px 0 0; color: var(--text-3); font-size: 13px; }
.ct-list { list-style: none; margin: 0; padding: 0; border-radius: 10px; background: var(--win-solid); border: 1px solid var(--win-line); overflow: hidden; }
.ct-list li + li { border-top: 1px solid var(--win-line); }
.ct-row { display: flex; justify-content: space-between; gap: 12px; padding: 11px 14px; text-decoration: none; color: var(--text); }
a.ct-row[href]:hover { background: var(--hover); }
.ct-k { color: var(--text-2); font-size: 13px; }
.ct-v { font-weight: 600; font-size: 13px; color: var(--link); overflow-wrap: anywhere; text-align: right; }
.ct-row:not([href]) .ct-v { color: var(--text-3); font-weight: 500; font-style: italic; }
.ct-note { text-align: center; font-size: 12px; color: var(--text-3); margin: 14px 0 0; }

/* ---------- Terminal ---------- */
.win.is-terminal { background: rgba(28, 23, 32, .94); border-color: rgba(255, 255, 255, .1); }
.win.is-terminal .titlebar { border-bottom-color: rgba(255, 255, 255, .07); }
.win.is-terminal .win-title { color: #d9cfc6; }
.term { min-height: 100%; padding: 10px 12px 14px; font: 13px/1.5 var(--mono); color: #eadfd5; cursor: text; }
.term-out { white-space: pre-wrap; overflow-wrap: anywhere; }
.term-out .t-dim { color: #a3968c; }
.term-out .t-acc { color: #f5ad73; }
.term-out .t-ok { color: #9fd89a; }
.term-out .t-err { color: #ff8f80; }
.term-out .t-dir { color: #8fc3ff; font-weight: 700; }
.term-line { display: flex; gap: 8px; }
.term-ps { color: #9fd89a; white-space: nowrap; }
.term-ps b { color: #8fc3ff; font-weight: 400; }
.term-in { flex: 1; min-width: 0; background: transparent; border: 0; outline: 0; color: inherit; font: inherit; caret-color: #f5ad73; padding: 0; }

/* ---------- Dock ---------- */
.dock { position: fixed; left: 50%; bottom: 8px; transform: translateX(-50%); z-index: 4000; }
.dock-list {
  list-style: none; margin: 0; padding: 6px 8px; display: flex; align-items: flex-end; gap: 4px; height: 66px;
  background: var(--dock-bg); border: 1px solid var(--dock-border); border-radius: 20px;
  -webkit-backdrop-filter: blur(26px) saturate(1.6); backdrop-filter: blur(26px) saturate(1.6);
  box-shadow: 0 10px 30px rgba(60, 25, 15, .18);
}
.dock-list > li { display: flex; align-items: flex-end; }
.dock-item {
  --s: 1; position: relative; width: calc(52px * var(--s)); height: calc(52px * var(--s));
  display: block; transition: width .18s var(--ease-out), height .18s var(--ease-out); touch-action: manipulation;
}
.dock-list.is-magnifying .dock-item { transition: width .06s linear, height .06s linear; }
.dock-item svg { width: 100%; height: 100%; display: block; filter: drop-shadow(0 3px 5px rgba(30, 10, 0, .25)); }
.dock-item:active svg { filter: drop-shadow(0 3px 5px rgba(30, 10, 0, .25)) brightness(.85); }
.dock-item:focus-visible { outline-offset: 3px; border-radius: 14px; }
.dock-tip {
  position: absolute; bottom: calc(100% + 10px); left: 50%; transform: translateX(-50%) translateY(4px);
  padding: 3px 10px; border-radius: 6px; font-size: 12.5px; white-space: nowrap; pointer-events: none;
  background: var(--dd-bg); color: var(--text); border: 1px solid var(--win-border); box-shadow: 0 6px 16px rgba(0, 0, 0, .15);
  opacity: 0; transition: opacity .12s, transform .12s;
}
.dock-item:hover .dock-tip, .dock-item:focus-visible .dock-tip { opacity: 1; transform: translateX(-50%); }
.dock-dot { position: absolute; bottom: -5px; left: 50%; width: 4px; height: 4px; margin-left: -2px; border-radius: 50%; background: var(--text); opacity: 0; transition: opacity .2s; }
.dock-item.is-running .dock-dot { opacity: .7; }
.dock-sep { width: 1px; align-self: stretch; margin: 4px 4px; background: var(--win-line); background: rgba(80, 45, 25, .2); }
html[data-theme="dark"] .dock-sep { background: rgba(255, 255, 255, .18); }
.dock-min .dock-item svg { border-radius: 12px; }
.dock-min .mini { width: 100%; height: 100%; border-radius: 12px; display: grid; place-items: center; background: var(--win-solid); border: 1px solid var(--win-border); box-shadow: 0 3px 8px rgba(30, 10, 0, .2); }
.dock-min .mini svg { width: 70%; height: 70%; filter: none; }
.dock-item.bounce svg { animation: bounce .6s var(--ease-out); }
@keyframes bounce { 30% { transform: translateY(-14px); } 60% { transform: translateY(0); } 80% { transform: translateY(-4px); } }

/* dock artwork */
.finder-r { fill: #e9f1fb; opacity: .95; }
.finder-eye { stroke: #1d2b3a; stroke-width: 3.2; stroke-linecap: round; }
.finder-smile { fill: none; stroke: #1d2b3a; stroke-width: 2.6; stroke-linecap: round; }
.notes-bg { fill: #fffaf0; }
.notes-lines { stroke: #e6dccb; stroke-width: 1.6; }
.notes-dots { stroke: rgba(120, 70, 0, .35); stroke-width: 3; stroke-linecap: round; }
.book-cover { fill: #f2e2c8; }
.book-spine { stroke: #c9a982; stroke-width: 2; }
.book-mark { fill: #d4573a; }
.cv-page { fill: #fff; }
.cv-avatar { fill: #e8b48f; }
.cv-lines { stroke: #cdbcad; stroke-width: 2; stroke-linecap: round; }
.term-edge { fill: none; stroke: rgba(255, 255, 255, .12); }
.term-prompt { fill: none; stroke: #f0f0f0; stroke-width: 3.2; stroke-linecap: round; stroke-linejoin: round; }
.mail-env { fill: #fff; }
.mail-flap { fill: none; stroke: #9ec5f0; stroke-width: 2.4; stroke-linejoin: round; stroke-linecap: round; }

/* ---------- noscript & 404 ---------- */
.noscript-card, .nf-card {
  position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%); width: min(420px, calc(100% - 32px));
  background: var(--win-bg); border: 1px solid var(--win-border); border-radius: var(--radius); box-shadow: var(--win-shadow);
  -webkit-backdrop-filter: blur(30px); backdrop-filter: blur(30px); z-index: 6000; overflow: hidden;
}
.noscript-card { padding: 22px 24px; }
.noscript-card h2 { margin: 0 0 8px; }
.nf-card .titlebar { cursor: default; }
.nf-body { padding: 26px 26px 24px; text-align: center; }
.nf-body svg { width: 72px; height: 72px; }
.nf-body h1 { font-size: 20px; margin: 10px 0 6px; }
.nf-body p { color: var(--text-2); margin: 0 0 18px; }
.nf-body code { font-family: var(--mono); font-size: 12.5px; background: var(--hover); padding: 2px 6px; border-radius: 4px; overflow-wrap: anywhere; }

/* ---------- Mobile: iOS-ish home screen + sheets ---------- */
@media (max-width: 767px) {
  :root { --mb-h: 34px; --wall-pos: 50% 50%; --wall-fallback: #5a4933; }
  body::before {
    background-image:
      linear-gradient(to bottom, var(--top-scrim) 0, var(--top-scrim) calc(env(safe-area-inset-top) + 30px), transparent calc(env(safe-area-inset-top) + 58px)),
      linear-gradient(var(--wall-tint), var(--wall-tint)),
      url("/assets/img/wallpaper-mobile.webp");
  }
  .menubar { padding: 0 16px; padding-top: env(safe-area-inset-top); height: calc(var(--mb-h) + env(safe-area-inset-top)); border-bottom: 0; background: transparent; -webkit-backdrop-filter: none; backdrop-filter: none; }
  .mb-menus, .mb-logo { display: none; }
  .mb-left { order: 2; }
  .mb-right { order: 1; flex: 1; justify-content: space-between; flex-direction: row-reverse; }
  .menubar { justify-content: flex-start; gap: 8px; }
  .mb-name { font-weight: 600; padding: 0; position: absolute; left: 50%; transform: translateX(-50%); }
  .mb-clock { padding: 0; font-weight: 600; font-size: 14px; }
  .mb-clock .clock-date { display: none; }

  .desktop { top: calc(var(--mb-h) + env(safe-area-inset-top)); overflow-y: auto; overflow-x: hidden; padding: 10px 18px calc(var(--dock-h) + 40px + env(safe-area-inset-bottom)); }
  .widget { position: relative; top: auto; left: auto; width: auto; transform: none; border-radius: 20px; padding: 16px 18px; margin: 6px 0 22px; box-shadow: 0 10px 24px rgba(70, 40, 10, .16); }
  .widget::before { display: none; }
  .icons { position: static; display: grid; grid-template-columns: repeat(4, 1fr); gap: 18px 8px; }
  .icon { width: 100%; padding: 0; }
  .icon-img { width: 62px; height: 62px; }
  .icon-label { font-size: 11.5px; padding: 1px 2px; }
  .icon.is-selected .icon-label { background: var(--label-pill); color: var(--icon-label); }

  .dock { bottom: calc(10px + env(safe-area-inset-bottom)); width: calc(100% - 24px); max-width: 400px; }
  .dock-list { justify-content: space-around; height: 80px; padding: 12px 14px; border-radius: 28px; gap: 0; }
  .dock-desk-only, .dock-sep, .dock-min { display: none !important; }
  .dock-item { width: 56px !important; height: 56px !important; }
  .dock-tip, .dock-dot { display: none; }

  .windows { position: fixed; inset: 0; z-index: 7000; }
  .win {
    left: 0 !important; right: 0; bottom: 0; top: calc(env(safe-area-inset-top) + 10px) !important;
    width: 100% !important; height: auto !important; min-width: 0; min-height: 0;
    border-radius: 16px 16px 0 0; border-left: 0; border-right: 0; border-bottom: 0;
    background: var(--win-solid);
    box-shadow: 0 -10px 40px rgba(40, 15, 5, .25);
    transition: transform .42s cubic-bezier(.2, .9, .25, 1), opacity .2s;
  }
  .win.is-entering { opacity: 1; transform: translateY(100%); }
  .win.is-closing { opacity: 1; transform: translateY(100%); transition: transform .3s cubic-bezier(.5, 0, .8, .4); }
  .win.is-max { border-radius: 16px 16px 0 0; }
  .titlebar { height: 50px; padding: 0 8px 0 16px; touch-action: auto; }
  .titlebar::before { content: ""; position: absolute; top: 6px; left: 50%; width: 36px; height: 5px; margin-left: -18px; border-radius: 3px; background: var(--win-line); background: rgba(127, 110, 100, .35); }
  .lights, .resize-handle { display: none; }
  .win-title { left: 70px; right: 70px; font-size: 15px; top: 16px; }
  .sheet-done { display: inline-flex; margin-left: auto; height: 36px; align-items: center; padding: 0 10px; font-weight: 600; font-size: 15px; color: var(--link); border-radius: 8px; }
  .win.is-terminal .sheet-done { color: #f5ad73; }
  .win.is-terminal { background: #1c1720; }
  .prose { font-size: 17px; }
  .te-page { padding: 20px 20px 40px; }
  .resume { padding: 20px 20px 40px; }
  .rs-name { font-size: 23px; }
  .rs-req-open { width: 100%; justify-content: center; height: 40px; font-size: 14px; }
  .rs-req { padding: 14px 14px; }
  .rs-field .adm-input { font-size: 16px; } /* prevents iOS zoom on focus */
  .rs-req-send { height: 40px; padding: 0 18px; font-size: 14px; }
  .projects { padding: 16px; }
  .cards { grid-template-columns: 1fr; }
  .term { font-size: 13px; }
  .term-in { font-size: 16px; } /* prevents iOS zoom on focus */
}

/* ---------- Motion ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; scroll-behavior: auto !important; }
  .win.is-entering { transform: none; }
}

/* ---------- Additions ---------- */
.win-title { margin: 0; }

@container (max-width: 700px) {
  .finder { display: flex; flex-direction: column; }
  .f-list, .f-reader { flex: 1; min-height: 0; }
}

/* Shared form input (used by /admin and the Resume request form) */
.adm-input {
  font: 15px/1.45 var(--font); color: var(--text); background: var(--win-bg); border: 1px solid var(--win-border);
  border-radius: 8px; padding: 8px 10px; width: 100%; resize: vertical;
}
.adm-input:focus { outline: 2px solid var(--accent); outline-offset: 0; border-color: transparent; }
.adm-input::placeholder { color: var(--text-3); }
button:disabled, input:disabled, textarea:disabled { opacity: .55; cursor: not-allowed; }
@media (max-width: 767px) {
  body.has-sheet .desktop { z-index: 6000; overflow: hidden; }
}

/* Resume: email-me link (replaces the old request form) */
a.rs-req-open { text-decoration: none; }
.rs-mail-hint { margin: 10px 0 0; color: var(--text-2); font-size: 13.5px; }
.rs-mail-hint a { color: var(--accent); }
