/* Visually hidden but still indexable / readable by assistive tech */
.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;
}

/* ─── macOS desktop · Bjorn Byrne ─────────────────────────────────────── */

@import url('https://fonts.googleapis.com/css2?family=Instrument+Serif:ital@0;1&family=Geist:wght@300;400;500;600;700&family=Geist+Mono:wght@400;500&display=swap');

:root {
  --font-system: 'Geist', -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Helvetica Neue', sans-serif;
  --font-mono: 'Geist Mono', 'SF Mono', Menlo, monospace;
  --font-serif: 'Instrument Serif', 'New York', Georgia, serif;

  --window-bg: rgba(246, 246, 248, 0.78);
  --window-bg-solid: #f6f6f8;
  --window-header: rgba(232, 232, 235, 0.82);
  --window-border: rgba(0, 0, 0, 0.12);
  --window-shadow:
    0 0 0 0.5px rgba(0, 0, 0, 0.18),
    0 18px 50px -10px rgba(0, 0, 0, 0.35),
    0 50px 100px -20px rgba(0, 0, 0, 0.25);

  --text-primary: #0c0c0e;
  --text-secondary: rgba(60, 60, 67, 0.72);
  --text-tertiary: rgba(60, 60, 67, 0.45);
  --separator: rgba(60, 60, 67, 0.18);

  --accent: #007aff;
  --accent-hover: #0066d6;

  --widget-bg: rgba(255, 255, 255, 0.55);
  --widget-border: rgba(255, 255, 255, 0.6);
  --widget-shadow:
    0 0 0 0.5px rgba(0, 0, 0, 0.12),
    0 10px 30px -8px rgba(0, 0, 0, 0.22),
    0 30px 60px -20px rgba(0, 0, 0, 0.18);

  --traffic-red: #ff5f57;
  --traffic-yellow: #febc2e;
  --traffic-green: #28c840;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html,
body,
#root {
  height: 100%;
  width: 100%;
  overflow: hidden;
  font-family: var(--font-system);
  color: var(--text-primary);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  user-select: none;
}

button {
  font-family: inherit;
  cursor: default;
  border: none;
  background: none;
  color: inherit;
}

a {
  color: inherit;
  text-decoration: none;
  cursor: default;
}

/* ─── Wallpaper ─────────────────────────────────────────────────────── */
.desktop {
  position: fixed;
  inset: 0;
  background-image: var(--wallpaper, linear-gradient(180deg, #1f2552 0%, #3e3170 30%, #7b3f6e 55%, #c75d6b 75%, #f5a45e 100%));
  background-size: cover;
  background-position: center center;
  overflow: hidden;
}

.desktop::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.18) 0%, transparent 35%, transparent 65%, rgba(0, 0, 0, 0.28) 100%);
  pointer-events: none;
}

.desktop {
  isolation: isolate;
}

.window {
  will-change: transform, opacity;
}

/* ─── Menu bar ──────────────────────────────────────────────────────── */
.menubar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 28px;
  display: flex;
  align-items: center;
  padding: 0 14px;
  gap: 10px;
  background: transparent;
  color: rgba(255, 255, 255, 0.95);
  font-size: 13px;
  z-index: 9000;
}

.menubar .apple {
  font-size: 16px;
  line-height: 1;
  padding-bottom: 2px;
}

.menubar .apple.avatar {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background-size: cover;
  background-position: center;
  padding: 0;
  box-shadow: 0 0 0 0.5px rgba(255, 255, 255, 0.5), 0 1px 2px rgba(0, 0, 0, 0.3);
  cursor: default;
  margin-right: 8px;
}

.menubar .app-name {
  font-weight: 600;
  margin-right: 6px;
}

.menubar .menu-item {
  font-weight: 400;
  opacity: 0.95;
  padding: 2px 8px;
  border-radius: 4px;
  cursor: default;
}

.menubar .menu-item:hover {
  background: rgba(255, 255, 255, 0.18);
}

.menubar .right {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 400;
}

.menubar .icon-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  cursor: default;
  padding: 2px 6px;
  border-radius: 4px;
}

.menubar .icon-btn:hover {
  background: rgba(255, 255, 255, 0.18);
}

/* Menubar dropdown menus */
.menu-trigger { position: relative; display: inline-flex; align-items: center; }
.menubar .menu-item.active,
.menubar .icon-btn.active { background: rgba(255, 255, 255, 0.28); }

.menu-dropdown {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  width: 240px;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  background: rgba(245, 245, 247, 0.92);
  backdrop-filter: blur(28px) saturate(180%);
  -webkit-backdrop-filter: blur(28px) saturate(180%);
  border-radius: 8px;
  padding: 5px;
  box-shadow: 0 0 0 0.5px rgba(0, 0, 0, 0.18), 0 12px 36px rgba(0, 0, 0, 0.28);
  color: #111;
  font-size: 13px;
  font-weight: 400;
  z-index: 10000;
}
.menu-dropdown.right { left: auto; right: 0; }

.menu-dd-item {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px 4px 6px;
  border-radius: 5px;
  white-space: nowrap;
  cursor: default;
}
.menu-dd-item:hover:not(.disabled) { background: #1469e8; color: white; }
.menu-dd-item.disabled { color: rgba(0,0,0,0.35); }
.menu-dd-check { width: 14px; font-size: 11px; opacity: 0.85; display: inline-flex; justify-content: center; }
.menu-dd-label { flex: 1; }
.menu-dd-shortcut { font-size: 12px; color: rgba(0,0,0,0.55); margin-left: 18px; }
.menu-dd-right { margin-left: 10px; font-size: 11px; opacity: 0.8; }
.menu-dd-item:hover:not(.disabled) .menu-dd-shortcut,
.menu-dd-item:hover:not(.disabled) .menu-dd-right { color: rgba(255,255,255,0.85); }
.menu-dd-divider { height: 1px; background: rgba(0,0,0,0.10); margin: 4px 8px; }

/* Desktop right-click context menu — reuses the menubar dropdown chrome,
   anchored at the cursor instead of under a trigger. Spacing/sizing tuned
   to match the real macOS desktop context menu. */
.ctx-menu { position: fixed; z-index: 10000; }
.ctx-menu .menu-dropdown {
  position: static;
  width: 252px;
  padding: 6px;
  border-radius: 12px;
  font-size: 13.5px;
}
.ctx-menu .menu-dd-item {
  gap: 10px;
  padding: 7px 10px;
  border-radius: 7px;
}
.ctx-menu .menu-dd-divider { margin: 5px 10px; }
.menu-dd-icon {
  display: inline-flex;
  width: 18px;
  justify-content: center;
  align-items: center;
  color: rgba(0, 0, 0, 0.72);
  flex: 0 0 18px;
}
.menu-dd-item.disabled .menu-dd-icon { color: rgba(0, 0, 0, 0.30); }
.menu-dd-item:hover:not(.disabled) .menu-dd-icon { color: white; }
.menu-dd-chev { margin-left: 8px; color: rgba(0, 0, 0, 0.45); display: inline-flex; }
.menu-dd-item.disabled .menu-dd-chev { color: rgba(0, 0, 0, 0.25); }
.menu-dd-item:hover:not(.disabled) .menu-dd-chev { color: rgba(255, 255, 255, 0.85); }

/* Wallpaper crossfade layer — prepended (first child) so every positioned
   sibling paints above it; fades in, then the base --wallpaper takes over. */
.wallpaper-fade {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
  opacity: 0;
  transition: opacity 0.7s ease-in-out;
  pointer-events: none;
}

/* "Clean Up" gag — desktop icons shake briefly */
@keyframes files-cleanup {
  0%, 100% { transform: translateX(0) rotate(0); }
  20% { transform: translateX(-4px) rotate(-1.5deg); }
  40% { transform: translateX(4px) rotate(1.5deg); }
  60% { transform: translateX(-3px) rotate(-1deg); }
  80% { transform: translateX(3px) rotate(1deg); }
}
.desktop-files.cleaning .desktop-file { animation: files-cleanup 0.55s ease-in-out; }
.menu-dd-header { padding: 4px 10px 2px; font-size: 11px; font-weight: 600; color: rgba(0,0,0,0.5); text-transform: uppercase; letter-spacing: 0.04em; }

/* Wi-Fi panel — macOS Control Center style */
.wifi-panel {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  width: 280px;
  background: rgba(245, 245, 247, 0.94);
  backdrop-filter: blur(28px) saturate(180%);
  -webkit-backdrop-filter: blur(28px) saturate(180%);
  border-radius: 12px;
  padding: 8px;
  box-shadow: 0 0 0 0.5px rgba(0,0,0,0.18), 0 16px 44px rgba(0,0,0,0.30);
  color: #111;
  font-size: 13px;
  z-index: 10000;
  display: flex;
  flex-direction: column;
}
.wifi-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 10px;
  border-radius: 8px;
  cursor: default;
}
.wifi-head { font-weight: 600; font-size: 15px; }
.wifi-toggle {
  position: relative;
  width: 38px;
  height: 22px;
  border-radius: 12px;
  background: rgba(120, 120, 128, 0.32);
  transition: background 0.18s ease;
  flex: 0 0 38px;
  padding: 0;
  cursor: default;
}
.wifi-toggle.on { background: #34c759; }
.wifi-toggle-knob {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: white;
  box-shadow: 0 1px 3px rgba(0,0,0,0.25);
  transition: transform 0.18s cubic-bezier(0.22, 0.61, 0.36, 1);
}
.wifi-toggle.on .wifi-toggle-knob { transform: translateX(16px); }
.wifi-toggle.on { background: #0a84ff; }

.wifi-section-label {
  padding: 8px 10px 4px;
  font-size: 12px;
  font-weight: 600;
  color: rgba(0,0,0,0.55);
}
.wifi-net {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 8px;
  cursor: default;
}
.wifi-net:hover { background: rgba(0,0,0,0.05); }
.wifi-net-connected { background: transparent; }
.wifi-net-name { flex: 1; font-size: 14px; color: #111; }
.wifi-lock { color: rgba(0,0,0,0.55); flex: 0 0 auto; }
.wifi-others-row { cursor: default; }
.wifi-others-row:hover { background: rgba(0,0,0,0.05); }
.wifi-others-label { font-size: 14px; color: #d35a3a; font-weight: 500; }
.wifi-chev { color: rgba(0,0,0,0.4); transition: transform 0.18s ease; }
.wifi-others.open .wifi-chev { transform: rotate(90deg); }
.wifi-others-list { padding-left: 6px; }
.wifi-divider { height: 1px; background: rgba(0,0,0,0.10); margin: 4px 8px; }
.wifi-settings { font-size: 14px; color: rgba(0,0,0,0.85); }
.wifi-settings:hover { background: rgba(0,0,0,0.05); }

/* Battery panel — shares the wifi-panel chrome */
.batt-pct {
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  opacity: 0.9;
}
.batt-head-pct { font-weight: 600; font-size: 14px; color: rgba(0,0,0,0.75); }
.batt-status {
  padding: 0 10px 8px;
  font-size: 12px;
  color: rgba(0,0,0,0.55);
}
.batt-panel .wifi-net:hover { background: transparent; }

/* "Battery Settings…" pulses the coffee widget (battery is coffee-powered) */
@keyframes brew-pulse {
  0%, 100% { box-shadow: var(--widget-shadow); transform: scale(1); }
  35% { box-shadow: var(--widget-shadow), 0 0 0 5px rgba(200, 147, 104, 0.6); transform: scale(1.045); }
}
.widget-coffee.brew-pulse { animation: brew-pulse 0.85s ease-in-out 2; }

/* About this Mac modal */
.about-overlay {
  position: fixed;
  inset: 0;
  z-index: 12000;
  background: rgba(0, 0, 0, 0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  animation: aboutIn 0.25s ease;
}
@keyframes aboutIn { from { opacity: 0; } to { opacity: 1; } }

.about-card {
  position: relative;
  width: 420px;
  max-width: 92vw;
  background: rgba(246, 246, 248, 0.96);
  border-radius: 14px;
  box-shadow: 0 0 0 0.5px rgba(0,0,0,0.18), 0 30px 90px rgba(0,0,0,0.45);
  padding: 28px 28px 22px;
  color: #111;
  font-size: 13px;
  text-align: center;
}
.about-close {
  position: absolute;
  top: 10px;
  left: 10px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #ff5f57;
  color: rgba(0,0,0,0.65);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: default;
}
.about-avatar {
  width: 110px;
  height: 110px;
  border-radius: 50%;
  background-size: cover;
  background-position: center;
  margin: 6px auto 16px;
  box-shadow: 0 0 0 3px rgba(255,255,255,0.95), 0 0 0 4px rgba(0,0,0,0.10), 0 10px 28px rgba(0,0,0,0.22);
}
.about-title { font-size: 20px; font-weight: 600; letter-spacing: -0.01em; }
.about-sub { font-size: 12px; color: rgba(0,0,0,0.55); margin-top: 2px; margin-bottom: 18px; }
.about-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 6px 0;
  border-top: 0.5px solid rgba(0,0,0,0.08);
  text-align: left;
}
.about-row:first-of-type { border-top: none; }
.about-row span { color: rgba(0,0,0,0.55); font-size: 12px; }
.about-row b { font-weight: 600; font-size: 13px; }
.about-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 18px; }
.about-btn {
  padding: 6px 14px;
  border-radius: 6px;
  background: rgba(0,0,0,0.06);
  font-size: 13px;
  cursor: default;
}
.about-btn:hover { background: rgba(0,0,0,0.10); }
.about-btn.primary { background: var(--accent); color: white; }
.about-btn.primary:hover { background: var(--accent-hover); }

body.dragging .menubar .menu-item:hover,
body.dragging .menubar .icon-btn:hover {
  background: transparent;
}

body.dragging * {
  pointer-events: none;
}

body.dragging .window-header,
body.dragging .window-resize,
body.dragging .window-resize-edge {
  pointer-events: auto;
}

/* ─── Widgets ───────────────────────────────────────────────────────── */
.widgets {
  position: absolute;
  top: 56px;
  right: 24px;
  display: grid;
  grid-template-columns: 168px 168px;
  gap: 16px;
  z-index: 10;
}

.widget {
  background: var(--widget-bg);
  backdrop-filter: blur(28px) saturate(180%);
  -webkit-backdrop-filter: blur(28px) saturate(180%);
  border-radius: 22px;
  padding: 16px;
  box-shadow: var(--widget-shadow);
  border: 0.5px solid rgba(255, 255, 255, 0.4);
  color: var(--text-primary);
  position: relative;
  overflow: hidden;
}

.widget.small {
  height: 168px;
}

.widget.wide {
  grid-column: span 2;
  height: 168px;
}

.widget-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.widget-label .dot {
  width: 14px;
  height: 14px;
  border-radius: 4px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 9px;
  color: white;
}

/* Clock widget — analog face filling the tile */
.widget-clock {
  padding: 10px;
  background: linear-gradient(160deg, #ff7a59 0%, #f25149 55%, #d2362f 100%);
}

.widget-clock .face {
  position: relative;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: #fafafa;
  box-shadow: inset 0 0 0 1px rgba(0,0,0,0.06), 0 4px 12px rgba(0,0,0,0.18);
}

.widget-clock .numeral {
  position: absolute;
  transform: translate(-50%, -50%);
  font-family: 'Helvetica Neue', 'SF Pro Display', sans-serif;
  font-size: 12px;
  font-weight: 500;
  color: #111;
  line-height: 1;
}

.widget-clock .hand {
  position: absolute;
  top: 50%;
  left: 50%;
  transform-origin: 0 50%;
  background: #111;
  border-radius: 1.5px;
}

.widget-clock .hand.hour { width: 32%; height: 3px; background: #111; }
.widget-clock .hand.min  { width: 42%; height: 2.5px; background: #111; }
.widget-clock .hand.sec  { width: 46%; height: 1.5px; background: #f25149; border-radius: 1px; }

.widget-clock .pin {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 7px;
  height: 7px;
  background: #111;
  border-radius: 50%;
  transform: translate(-50%, -50%);
  z-index: 1;
}

/* Weather widget — iOS-style */
.widget-weather {
  background: linear-gradient(170deg, #6fb4ea 0%, #4a8fd6 55%, #3266b5 100%);
  color: white;
  padding: 14px;
  display: flex;
  flex-direction: column;
}

.widget-weather .loc {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 14px;
  font-weight: 600;
  color: white;
}

.widget-weather .loc svg { opacity: 0.95; }

.widget-weather .temp {
  font-size: 50px;
  font-weight: 300;
  letter-spacing: -0.03em;
  line-height: 1;
  margin-top: 6px;
}

.widget-weather .meta {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: auto;
}

.widget-weather .meta .sun {
  position: static;
  width: 16px;
  height: 16px;
  background: radial-gradient(circle, #ffeb8a 0%, #ffd24a 60%, #ffb73b 100%);
  border-radius: 50%;
  box-shadow: 0 0 10px rgba(255, 220, 120, 0.55);
  flex: 0 0 16px;
}

.widget-weather .cond {
  font-size: 13px;
  font-weight: 500;
  opacity: 0.95;
}

.widget-weather .lo-hi {
  font-size: 12px;
  font-weight: 500;
  opacity: 0.85;
  margin-top: 4px;
}

/* Stats widget — Notes-style with yellow header */
.widget-stats {
  display: flex;
  flex-direction: column;
  padding: 0;
  background: #fff;
}

.widget-stats .stats-header {
  background: linear-gradient(180deg, #ffd76a 0%, #f5b94d 100%);
  color: #fff;
  padding: 10px 14px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: -0.01em;
  border-bottom: 1px dashed rgba(0,0,0,0.10);
}

.widget-stats .stats-body {
  flex: 1;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 10px;
}

.widget-stats .stat .v {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1;
  color: var(--text-primary);
}

.widget-stats .stat .v .unit {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
  margin-left: 3px;
}

.widget-stats .stat .l {
  font-size: 11px;
  color: var(--text-secondary);
  margin-top: 3px;
}

/* Coffee widget */
.widget-coffee {
  background: linear-gradient(160deg, #3d2317 0%, #5b3422 50%, #2a1810 100%);
  color: #f5e6d3;
}

.widget-coffee .widget-label {
  color: rgba(245, 230, 211, 0.7);
}

.widget-coffee .count {
  font-size: 48px;
  font-weight: 300;
  letter-spacing: -0.03em;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.widget-coffee .label {
  font-size: 12px;
  opacity: 0.7;
  margin-top: 4px;
}

.widget-coffee .beans {
  position: absolute;
  bottom: -8px;
  right: -8px;
  font-size: 60px;
  opacity: 0.15;
  transform: rotate(15deg);
}

.widget-coffee .ring {
  display: flex;
  gap: 3px;
  margin-top: 10px;
}

.widget-coffee .ring span {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: rgba(245, 230, 211, 0.2);
}

.widget-coffee .ring span.on {
  background: #c89368;
}

/* Quote widget — iOS journaling style */
.widget-quote {
  display: flex;
  flex-direction: column;
  background: linear-gradient(180deg, #2a2d3a 0%, #1f2230 100%);
  color: #fff;
  padding: 14px;
}

.widget-quote .q-date {
  font-size: 12px;
  font-weight: 600;
  color: rgba(255,255,255,0.85);
  letter-spacing: -0.005em;
}

.widget-quote .body {
  font-family: var(--font-system);
  font-size: 19px;
  font-weight: 700;
  line-height: 1.18;
  letter-spacing: -0.015em;
  color: #d9b9ff;
  margin-top: 8px;
}

.widget-quote .body i { font-style: italic; }

.widget-quote .q-actions {
  margin-top: auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.widget-quote .q-btn {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: rgba(255,255,255,0.10);
  color: rgba(255,255,255,0.85);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: default;
  transition: background 0.15s ease;
}

.widget-quote .q-btn:hover { background: rgba(255,255,255,0.18); }

/* Contact widget */
.widget-contact {
  display: flex;
  flex-direction: column;
  gap: 10px;
  cursor: default;
}

.widget-contact .avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background-size: cover;
  background-position: center;
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.7), 0 2px 8px rgba(0, 0, 0, 0.15);
}

.widget-contact .name {
  font-size: 16px;
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: -0.01em;
}

.widget-contact .role {
  font-size: 11px;
  color: var(--text-secondary);
  line-height: 1.3;
}

.widget-contact .email {
  font-size: 12px;
  color: var(--accent);
  margin-top: auto;
  font-weight: 500;
  word-break: break-all;
}

.widget-contact .contact-rows {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-top: 2px;
}
.widget-contact .contact-row {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11.5px;
  /* dark navy, not accent blue — blue washed out on the translucent widget */
  color: #1f2552;
  font-weight: 500;
  text-decoration: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: default;
}
.widget-contact .contact-row > i { color: var(--accent); flex: 0 0 auto; }
.widget-contact .contact-row:hover { text-decoration: underline; }

/* ─── Dock ──────────────────────────────────────────────────────────── */
.dock-wrap {
  position: fixed;
  bottom: 8px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 8000;
  padding: 0 12px 8px;
  perspective: 600px;
}

.dock {
  display: flex;
  align-items: end;
  gap: 4px;
  padding: 6px 8px;
  background: rgba(255, 255, 255, 0.22);
  backdrop-filter: blur(28px) saturate(180%);
  -webkit-backdrop-filter: blur(28px) saturate(180%);
  border-radius: 22px;
  border: 0.5px solid rgba(255, 255, 255, 0.4);
  box-shadow:
    0 0 0 0.5px rgba(0, 0, 0, 0.18),
    0 14px 30px -6px rgba(0, 0, 0, 0.3),
    inset 0 1px 0 rgba(255, 255, 255, 0.4);
}

.dock-item {
  position: relative;
  width: 52px;
  height: 52px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.18s cubic-bezier(0.34, 1.56, 0.64, 1), margin 0.18s;
  cursor: default;
  transform-origin: bottom center;
}

.dock-item .dock-icon {
  width: 100%;
  height: 100%;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow:
    0 0 0 0.5px rgba(0, 0, 0, 0.12),
    0 4px 10px -2px rgba(0, 0, 0, 0.25);
  overflow: hidden;
  position: relative;
}

.dock-item .tooltip {
  position: absolute;
  bottom: calc(100% + 14px);
  left: 50%;
  transform: translateX(-50%) translateY(4px);
  background: rgba(40, 40, 40, 0.88);
  color: white;
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 12px;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s, transform 0.15s;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
}

.dock-item:hover .tooltip {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.dock-item .indicator {
  position: absolute;
  bottom: -6px;
  left: 50%;
  transform: translateX(-50%);
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: 0 0 0 0.5px rgba(0, 0, 0, 0.2);
  opacity: 0;
}

.dock-item.open .indicator {
  opacity: 1;
}

.dock-divider {
  width: 1px;
  height: 38px;
  background: rgba(0, 0, 0, 0.18);
  box-shadow: 1px 0 0 rgba(255, 255, 255, 0.35);
  margin: 0 6px;
  align-self: center;
}

.dock-trash {
  background: linear-gradient(160deg, rgba(255, 255, 255, 0.6), rgba(220, 220, 230, 0.6));
}

/* ─── Window ────────────────────────────────────────────────────────── */
.window {
  position: absolute;
  background: var(--window-bg);
  backdrop-filter: blur(40px) saturate(180%);
  -webkit-backdrop-filter: blur(40px) saturate(180%);
  border-radius: 11px;
  box-shadow: var(--window-shadow);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  border: 0.5px solid rgba(0, 0, 0, 0.18);
  transition:
    opacity 0.22s ease,
    transform 0.42s cubic-bezier(0.34, 1.18, 0.5, 1);
  transform-origin: 50% 50%;
}

.window.minimized {
  transform: translate(var(--min-x, 0), var(--min-y, 60vh)) scale(0.06);
  opacity: 0;
  pointer-events: none;
  transition:
    transform 0.5s cubic-bezier(0.5, 0, 0.75, 0),
    opacity 0.45s ease-in 0.05s;
}

.window.maximized {
  border-radius: 0;
}

.window.animating {
  transition:
    opacity 0.22s ease,
    transform 0.42s cubic-bezier(0.34, 1.18, 0.5, 1),
    left 0.34s cubic-bezier(0.32, 0.72, 0, 1),
    top 0.34s cubic-bezier(0.32, 0.72, 0, 1),
    width 0.34s cubic-bezier(0.32, 0.72, 0, 1),
    height 0.34s cubic-bezier(0.32, 0.72, 0, 1);
}

.window.opening {
  animation: windowOpen 0.34s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes windowOpen {
  0% {
    transform: scale(0.88) translateY(14px);
    opacity: 0;
  }

  60% {
    opacity: 1;
  }

  100% {
    transform: scale(1) translateY(0);
    opacity: 1;
  }
}

.window-header {
  height: 38px;
  flex-shrink: 0;
  background: var(--window-header);
  border-bottom: 0.5px solid var(--separator);
  display: flex;
  align-items: center;
  padding: 0 12px;
  gap: 8px;
  cursor: default;
  user-select: none;
  position: relative;
}

.window-header:active {
  cursor: default;
}

.window-header .traffic-lights {
  display: flex;
  gap: 8px;
  align-items: center;
}

.tl {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 8px;
  line-height: 1;
  color: rgba(0, 0, 0, 0.55);
  font-weight: 700;
  border: 0.5px solid rgba(0, 0, 0, 0.15);
  cursor: default;
}

.tl > i,
.tl svg {
  opacity: 0;
  transition: opacity 0.12s ease;
}

.traffic-lights:hover .tl > i,
.traffic-lights:hover .tl svg {
  opacity: 1;
}

.tl.red {
  background: var(--traffic-red);
}

.tl.yellow {
  background: var(--traffic-yellow);
}

.tl.green {
  background: var(--traffic-green);
}

.tl.disabled {
  background: #d6d6d6;
  cursor: default;
}

.window-header .title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  pointer-events: none;
  white-space: nowrap;
  max-width: 60%;
  overflow: hidden;
  text-overflow: ellipsis;
}

.window-toolbar {
  padding: 0 12px;
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: 12px;
}

.window-body {
  flex: 1;
  overflow: auto;
  position: relative;
}

.window-body::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

.window-body::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, 0.18);
  border-radius: 4px;
}

.window-body::-webkit-scrollbar-track {
  background: transparent;
}

.window-resize {
  position: absolute;
  bottom: 0;
  right: 0;
  width: 16px;
  height: 16px;
  cursor: nwse-resize;
  z-index: 10;
}

.window-resize.left {
  left: 0;
  right: auto;
  cursor: nesw-resize;
}

.window-resize.top {
  top: 0;
  bottom: auto;
}

.window-resize.bottom {
  bottom: 0;
}

.window-resize-edge {
  position: absolute;
}

.window-resize-edge.l {
  left: -2px;
  top: 0;
  bottom: 0;
  width: 4px;
  cursor: ew-resize;
}

.window-resize-edge.r {
  right: -2px;
  top: 0;
  bottom: 0;
  width: 4px;
  cursor: ew-resize;
}

.window-resize-edge.t {
  top: -2px;
  left: 0;
  right: 0;
  height: 4px;
  cursor: ns-resize;
}

.window-resize-edge.b {
  bottom: -2px;
  left: 0;
  right: 0;
  height: 4px;
  cursor: ns-resize;
}

/* ─── Finder-style sidebar layout ──────────────────────────────────── */
.finder-layout {
  display: flex;
  height: 100%;
}

.finder-sidebar {
  width: 180px;
  background: rgba(232, 232, 235, 0.5);
  border-right: 0.5px solid var(--separator);
  padding: 12px 8px;
  overflow-y: auto;
  font-size: 13px;
  flex-shrink: 0;
}

.finder-sidebar .group-label {
  font-size: 11px;
  color: var(--text-tertiary);
  font-weight: 600;
  padding: 10px 8px 4px;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.finder-sidebar .item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 8px;
  border-radius: 6px;
  cursor: default;
  color: var(--text-primary);
}

.finder-sidebar .item:hover {
  background: rgba(0, 0, 0, 0.04);
}

.finder-sidebar .item.active {
  background: rgba(0, 0, 0, 0.08);
}

.finder-sidebar .item .ic {
  width: 16px;
  height: 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.finder-main {
  flex: 1;
  overflow: auto;
  background: var(--window-bg-solid);
}

/* ─── About window content ─────────────────────────────────────────── */
.about-hero {
  padding: 40px 36px 28px;
  display: grid;
  grid-template-columns: 140px 1fr;
  gap: 28px;
  align-items: center;
}

.about-hero .portrait {
  width: 140px;
  height: 140px;
  border-radius: 50%;
  background-size: cover;
  background-position: center;
  box-shadow: 0 0 0 3px white, 0 8px 24px rgba(0, 0, 0, 0.18);
}

.about-hero h1 {
  font-family: var(--font-serif);
  font-size: 48px;
  font-weight: 400;
  letter-spacing: -0.02em;
  line-height: 1;
}

.about-hero h1 i {
  font-style: italic;
}

.about-hero .sub {
  font-size: 15px;
  color: var(--text-secondary);
  margin-top: 8px;
  max-width: 38ch;
  line-height: 1.45;
}

.about-hero .pill-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 14px;
}

.pill {
  font-size: 11px;
  padding: 3px 9px;
  border-radius: 99px;
  background: rgba(0, 0, 0, 0.06);
  color: var(--text-secondary);
  font-weight: 500;
}

/* Solid-colored pill (Writing tags) — strong contrast for accessibility.
   Note: text is white, set inline along with the bg color. */
.pill.solid {
  font-weight: 600;
  font-size: 10.5px;
  letter-spacing: 0.02em;
  text-shadow: 0 1px 0 rgba(0, 0, 0, 0.08);
}

.about-section {
  padding: 24px 36px;
  border-top: 0.5px solid var(--separator);
}

.about-section h2 {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-tertiary);
  font-weight: 600;
  margin-bottom: 14px;
}

.about-section p {
  font-size: 14px;
  line-height: 1.6;
  color: var(--text-primary);
  margin-bottom: 12px;
}

.about-section p:last-child {
  margin-bottom: 0;
}

.about-section em {
  font-family: var(--font-serif);
  font-style: italic;
  font-size: 1.05em;
  font-weight: 400;
}

.fact-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px 24px;
}

.fact {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 12px 14px;
  background: rgba(0, 0, 0, 0.03);
  border-radius: 8px;
}

.fact .k {
  font-size: 11px;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: 600;
}

.fact .v {
  font-size: 14px;
  color: var(--text-primary);
  font-weight: 500;
}

/* ─── Work window content ─────────────────────────────────────────── */
.work-empty {
  height: 100%;
  min-height: 320px; /* mobile sheet: parent height isn't definite */
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 40px 36px;
  gap: 6px;
}

.work-empty-icon {
  color: var(--text-primary);
  opacity: 0.85;
  margin-bottom: 10px;
}

.work-empty-title {
  font-size: 17px;
  font-weight: 600;
  color: var(--text-primary);
}

.work-empty-copy {
  font-size: 13px;
  line-height: 1.55;
  color: var(--text-secondary);
  max-width: 380px;
  margin: 4px 0 0;
}

.work-empty-hint {
  font-size: 12px;
  color: var(--text-secondary);
  opacity: 0.75;
  margin: 10px 0 0;
}

.work-grid {
  padding: 22px 24px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 18px;
}

.work-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
  cursor: default;
  transition: transform 0.15s;
}

.work-card:hover {
  transform: translateY(-3px);
}

.work-card .thumb {
  aspect-ratio: 16/10;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 0 0 0.5px rgba(0, 0, 0, 0.1), 0 4px 14px -4px rgba(0, 0, 0, 0.2);
  position: relative;
}

.work-card .title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
}

.work-card .meta {
  font-size: 12px;
  color: var(--text-secondary);
}

.work-card .badge {
  position: absolute;
  top: 10px;
  left: 10px;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(10px);
  /* Explicit dark text so the badge reads regardless of the ambient color
     it's being dropped into (was inheriting white on mobile sheets). */
  color: var(--text-primary);
  font-size: 10px;
  padding: 3px 8px;
  border-radius: 99px;
  font-weight: 600;
}

/* ─── Resume / preview window content ─────────────────────────────── */
.resume-toolbar {
  height: 44px;
  background: rgba(232, 232, 235, 0.6);
  border-bottom: 0.5px solid var(--separator);
  display: flex;
  align-items: center;
  padding: 0 14px;
  gap: 14px;
  font-size: 12px;
  color: var(--text-secondary);
}

.resume-toolbar .tb-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 8px;
  border-radius: 6px;
  cursor: default;
}

.resume-toolbar .tb-btn:hover {
  background: rgba(0, 0, 0, 0.06);
}

.resume-toolbar .spacer {
  flex: 1;
}

.resume-toolbar .page-num {
  font-variant-numeric: tabular-nums;
  font-size: 11px;
}

.resume-page-wrap {
  padding: 30px;
  background: #c7c9cd;
  min-height: 100%;
}

.resume-page {
  background: white;
  width: 100%;
  max-width: 720px;
  margin: 0 auto;
  padding: 56px 64px;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.18), 0 2px 6px rgba(0, 0, 0, 0.12);
  font-size: 12.5px;
  line-height: 1.55;
  color: #1a1a1a;
  user-select: text;
}

.resume-page h1 {
  font-family: var(--font-serif);
  font-size: 38px;
  font-weight: 400;
  letter-spacing: -0.01em;
  line-height: 1;
}

.resume-page .sub {
  color: #555;
  font-size: 13px;
  margin-top: 4px;
}

.resume-page .meta-line {
  display: flex;
  gap: 14px;
  font-size: 11.5px;
  color: #555;
  margin-top: 8px;
  flex-wrap: wrap;
}

.resume-page h2 {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #888;
  font-weight: 600;
  margin: 24px 0 10px;
  border-bottom: 1px solid #e5e5e5;
  padding-bottom: 4px;
}

.resume-page .job {
  margin-bottom: 14px;
}

.resume-page .job-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 14px;
}

.resume-page .job-head .role {
  font-weight: 600;
}

.resume-page .job-head .date {
  font-size: 11px;
  color: #888;
  font-variant-numeric: tabular-nums;
}

.resume-page .job .co {
  font-size: 11.5px;
  color: #555;
  font-style: italic;
}

.resume-page .job ul {
  margin-top: 6px;
  padding-left: 18px;
}

.resume-page .job li {
  font-size: 12px;
  color: #333;
  margin-bottom: 3px;
}

.resume-page .skill-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px 18px;
  font-size: 12px;
}

/* ─── Writing window content ──────────────────────────────────────── */
.writing-list {
  padding: 0;
}

.writing-item {
  padding: 18px 28px;
  border-bottom: 0.5px solid var(--separator);
  cursor: default;
  transition: background 0.15s;
}

.writing-item:hover {
  background: rgba(0, 0, 0, 0.03);
}

.writing-item .tag-row {
  display: flex;
  gap: 6px;
  margin-bottom: 8px;
}

.writing-item h3 {
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -0.01em;
  line-height: 1.2;
  margin-bottom: 6px;
}

.writing-item .preview {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.45;
}

.writing-item .meta {
  font-size: 11px;
  color: var(--text-tertiary);
  margin-top: 8px;
  display: flex;
  gap: 10px;
}

/* ─── Reader window (iframes /writing/<slug>.html) ───────────────── */
.reader-wrap {
  display: flex;
  flex-direction: column;
  height: 100%;
  background: #f7f5f0;
}
.reader-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 14px;
  background: rgba(244, 244, 247, 0.8);
  border-bottom: 0.5px solid var(--separator);
  flex-shrink: 0;
}
.reader-url {
  flex: 1;
  font-family: 'Geist Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 11.5px;
  color: var(--text-secondary);
  padding: 5px 12px;
  background: rgba(0, 0, 0, 0.04);
  border-radius: 6px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.reader-open {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-primary);
  background: rgba(0, 0, 0, 0.06);
  border: 0;
  padding: 6px 12px;
  border-radius: 6px;
  cursor: default;
  flex-shrink: 0;
  transition: background 120ms ease;
}
.reader-open:hover { background: rgba(0, 0, 0, 0.1); }
.reader-frame {
  flex: 1;
  width: 100%;
  border: 0;
  background: #f7f5f0;
}
body.dragging .reader-frame { pointer-events: none; }

/* ─── Contact / Mail window content ──────────────────────────────── */
.mail-layout {
  display: flex;
  height: 100%;
}

.mail-side {
  width: 240px;
  background: rgba(244, 244, 247, 0.6);
  border-right: 0.5px solid var(--separator);
  overflow-y: auto;
}

.mail-side .header {
  padding: 14px 14px 8px;
  font-size: 12px;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 600;
}

.mail-item {
  padding: 10px 14px;
  border-bottom: 0.5px solid var(--separator);
  cursor: default;
}

.mail-item:hover {
  background: rgba(0, 0, 0, 0.03);
}

.mail-item.active {
  background: var(--accent);
  color: white;
}
.mail-item.active .from,
.mail-item.active .subj,
.mail-item.active .when { color: rgba(255, 255, 255, 0.92); }

/* Email reading view */
.email-header {
  display: flex;
  gap: 14px;
  padding-bottom: 18px;
  border-bottom: 0.5px solid var(--separator);
  align-items: flex-start;
}
.email-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.02em;
  flex: 0 0 44px;
  box-shadow: 0 0 0 1px rgba(0,0,0,0.05);
}
.email-from-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 10px;
}
.email-from-name { font-size: 15px; font-weight: 600; color: var(--text-primary); }
.email-when { font-size: 12px; color: var(--text-tertiary); white-space: nowrap; }
.email-from-addr { font-size: 12px; color: var(--text-tertiary); margin-top: 2px; }
.email-subject { font-size: 17px; font-weight: 600; margin-top: 8px; letter-spacing: -0.01em; }
.email-body {
  padding-top: 18px;
  font-size: 14px;
  line-height: 1.6;
  color: var(--text-primary);
  user-select: text;
}
.email-body p { margin-bottom: 14px; }

.mail-item .from {
  font-size: 13px;
  font-weight: 600;
}

.mail-item .subj {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 1px;
}

.mail-item .when {
  font-size: 11px;
  color: var(--text-tertiary);
  float: right;
}

.mail-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: white;
}

.mail-compose {
  padding: 20px 28px;
  overflow-y: auto;
  flex: 1;
  user-select: text;
}

.mail-compose .field {
  display: flex;
  align-items: center;
  padding: 8px 0;
  border-bottom: 0.5px solid var(--separator);
  font-size: 13px;
}

.mail-compose .field .lbl {
  width: 60px;
  color: var(--text-tertiary);
  font-weight: 500;
}

.mail-compose .field input {
  flex: 1;
  border: none;
  outline: none;
  font-size: 13px;
  font-family: inherit;
  background: transparent;
  color: var(--text-primary);
}

.mail-compose .body-area {
  margin-top: 12px;
  min-height: 170px;
  font-size: 14px;
  line-height: 1.6;
  color: var(--text-primary);
}

.mail-compose .body-area p {
  margin-bottom: 14px;
}

.mail-compose .send-row {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-top: 20px;
  padding-top: 16px;
  border-top: 0.5px solid var(--separator);
}

.mail-btn {
  background: var(--accent);
  color: white;
  font-weight: 500;
  font-size: 13px;
  padding: 7px 18px;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.mail-btn:hover {
  background: var(--accent-hover);
}

.mail-btn.ghost {
  background: rgba(0, 0, 0, 0.06);
  color: var(--text-primary);
}

.mail-btn.ghost:hover {
  background: rgba(0, 0, 0, 0.10);
}

.mail-btn[disabled],
.mail-btn[disabled]:hover {
  background: rgba(0, 122, 255, 0.55);
  cursor: default;
}

/* readOnly inputs in the compose form keep the primary text color — they're
   not "disabled," just non-editable. */
.mail-compose .field input[readonly] {
  cursor: default;
  caret-color: transparent;
}

/* ─── Terminal ────────────────────────────────────────────────────── */
.term {
  background: rgba(28, 28, 30, 0.92);
  color: #e8e8ea;
  font-family: var(--font-mono);
  font-size: 13px;
  height: 100%;
  display: flex;
  flex-direction: column;
}

.term-body {
  flex: 1;
  overflow-y: auto;
  padding: 14px 16px;
  user-select: text;
}

.term-line {
  white-space: pre-wrap;
  line-height: 1.45;
}

.term-line.in {
  color: #e8e8ea;
}

.term-line.out {
  color: #c8c8ca;
}

.term-line.err {
  color: #ff6b6b;
}

.term-line.warn {
  color: #ffd866;
}

.term-line.accent {
  color: #62d2a2;
}

.term-prompt-line {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 16px 14px;
}

.term-prompt {
  color: #62d2a2;
  font-family: var(--font-mono);
  font-size: 13px;
  flex-shrink: 0;
}

.term-input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: #e8e8ea;
  font-family: var(--font-mono);
  font-size: 13px;
  caret-color: #62d2a2;
}

.term .window-header {
  background: rgba(50, 50, 52, 0.9);
  color: #ddd;
  border-bottom: 0.5px solid rgba(255, 255, 255, 0.08);
}

.term .window-header .title {
  color: #ddd;
}

/* ─── Calendar ────────────────────────────────────────────────────── */
.cal {
  display: flex;
  height: 100%;
}

.cal-side {
  width: 220px;
  background: rgba(244, 244, 247, 0.7);
  border-right: 0.5px solid var(--separator);
  padding: 18px 16px;
  overflow-y: auto;
}

.cal-side h3 {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-tertiary);
  font-weight: 600;
  margin-bottom: 12px;
}

.cal-mini {
  font-size: 11px;
}

.cal-mini .head {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  text-align: center;
  color: var(--text-tertiary);
  font-weight: 600;
  padding: 4px 0;
}

.cal-mini .days {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
  text-align: center;
}

.cal-mini .day {
  padding: 4px 0;
  border-radius: 4px;
  cursor: default;
  font-variant-numeric: tabular-nums;
}

.cal-mini .day:hover {
  background: rgba(0, 0, 0, 0.06);
}

.cal-mini .day.today {
  background: #ff5a5a;
  color: white;
  font-weight: 600;
}

.cal-mini .day.muted {
  color: var(--text-tertiary);
  opacity: 0.5;
}

.cal-availability {
  margin-top: 20px;
  font-size: 12px;
}

.cal-availability .slot {
  display: flex;
  justify-content: space-between;
  padding: 6px 0;
  border-bottom: 0.5px solid var(--separator);
}

.cal-availability .slot .day {
  font-weight: 500;
}

.cal-availability .slot .hours {
  color: var(--text-secondary);
}

.cal-main {
  flex: 1;
  background: white;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.cal-head {
  display: flex;
  align-items: center;
  padding: 14px 18px;
  border-bottom: 0.5px solid var(--separator);
  gap: 14px;
}

.cal-head h2 {
  font-size: 18px;
  font-weight: 600;
}

.cal-head .today-btn {
  font-size: 12px;
  padding: 5px 12px;
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.06);
  cursor: default;
}

.cal-grid {
  flex: 1;
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  grid-template-rows: 30px repeat(5, 1fr);
  overflow: hidden;
}

.cal-grid .h {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-tertiary);
  font-weight: 600;
  padding: 8px;
  border-bottom: 0.5px solid var(--separator);
  border-right: 0.5px solid var(--separator);
  background: #fafafb;
}

.cal-grid .h:last-child {
  border-right: none;
}

.cal-grid .cell {
  border-right: 0.5px solid var(--separator);
  border-bottom: 0.5px solid var(--separator);
  padding: 6px 8px;
  font-size: 11.5px;
  color: var(--text-primary);
  overflow: hidden;
  position: relative;
  min-height: 0;
}

.cal-grid .cell.muted {
  color: var(--text-tertiary);
  background: #fafafb;
}

.cal-grid .cell .num {
  font-variant-numeric: tabular-nums;
}

.cal-grid .cell .num.today {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #ff5a5a;
  color: white;
  font-weight: 600;
}

.cal-grid .cell .ev {
  font-size: 10.5px;
  padding: 2px 6px;
  border-radius: 4px;
  margin-top: 4px;
  color: white;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cal-grid .cell .ev.blue {
  background: #5b8def;
}

.cal-grid .cell .ev.purple {
  background: #a47bd6;
}

.cal-grid .cell .ev.teal {
  background: #4dbbb1;
}

.cal-grid .cell .ev.orange {
  background: #f0934d;
}

.cal-grid .cell .ev {
  cursor: default;
  transition: filter 120ms ease;
}
.cal-grid .cell .ev:hover {
  filter: brightness(1.08);
}

/* Mini-cal event-dot indicator */
.cal-mini .day.has-ev {
  position: relative;
}
.cal-mini .day.has-ev::after {
  content: "";
  position: absolute;
  bottom: 2px;
  left: 50%;
  transform: translateX(-50%);
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: #5b8def;
}
.cal-mini .day.today.has-ev::after {
  background: #fff;
}

/* Event-detail popover */
.cal-pop-backdrop {
  position: fixed;
  inset: 0;
  z-index: 5000;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.32);
}
.cal-pop-centered {
  position: relative;
}
.cal-pop {
  width: 340px;
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border-radius: 12px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.22), 0 0 0 0.5px rgba(0, 0, 0, 0.12);
  overflow: hidden;
  font-family: 'Geist', system-ui, -apple-system, sans-serif;
  animation: cal-pop-in 140ms ease-out;
}
@keyframes cal-pop-in {
  from { opacity: 0; transform: translateY(-4px) scale(0.98); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
.cal-pop-bar {
  height: 3px;
  width: 100%;
}
.cal-pop-bar.blue   { background: #5b8def; }
.cal-pop-bar.purple { background: #a47bd6; }
.cal-pop-bar.teal   { background: #4dbbb1; }
.cal-pop-bar.orange { background: #f0934d; }
.cal-pop-body {
  padding: 12px 14px 14px;
}
.cal-pop-head {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin-bottom: 10px;
}
.cal-pop-title {
  flex: 1;
  font-size: 14px;
  font-weight: 600;
  color: #1d1d1f;
  line-height: 1.3;
}
.cal-pop-x {
  background: transparent;
  border: 0;
  font-size: 18px;
  line-height: 1;
  color: #888;
  cursor: default;
  padding: 0 2px;
}
.cal-pop-x:hover { color: #333; }
.cal-pop-row {
  display: flex;
  font-size: 12px;
  color: #1d1d1f;
  margin-top: 6px;
  line-height: 1.4;
}
.cal-pop-row .lbl {
  width: 50px;
  flex-shrink: 0;
  color: #888;
}
.cal-pop-note {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid rgba(0, 0, 0, 0.08);
  font-size: 12px;
  color: #555;
  font-style: italic;
  line-height: 1.45;
}

/* ─── Spotlight ───────────────────────────────────────────────────── */
.spotlight-backdrop {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: 22vh;
  z-index: 10000;
  background: rgba(0, 0, 0, 0.04);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  animation: fadeIn 0.15s;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

.spotlight {
  width: 620px;
  max-width: 90vw;
  background: rgba(255, 255, 255, 0.78);
  backdrop-filter: blur(40px) saturate(180%);
  -webkit-backdrop-filter: blur(40px) saturate(180%);
  border-radius: 14px;
  box-shadow: 0 0 0 0.5px rgba(0, 0, 0, 0.18), 0 30px 60px rgba(0, 0, 0, 0.3);
  overflow: hidden;
  animation: spotIn 0.22s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes spotIn {
  from {
    transform: scale(0.96);
    opacity: 0;
  }

  to {
    transform: scale(1);
    opacity: 1;
  }
}

.spotlight-input-row {
  display: flex;
  align-items: center;
  padding: 14px 18px;
  gap: 12px;
}

.spotlight-input-row input {
  flex: 1;
  border: none;
  outline: none;
  background: transparent;
  font-size: 24px;
  font-weight: 300;
  font-family: inherit;
  color: var(--text-primary);
  letter-spacing: -0.01em;
}

.spotlight-input-row input::placeholder {
  color: var(--text-tertiary);
}

.spotlight-results {
  border-top: 0.5px solid var(--separator);
  max-height: 380px;
  overflow-y: auto;
}

.spotlight-section-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-tertiary);
  font-weight: 600;
  padding: 10px 18px 4px;
}

.spotlight-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 18px;
  cursor: default;
}

.spotlight-item.active {
  background: rgba(0, 122, 255, 0.18);
}

.spotlight-item .ic {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 14px;
}

.spotlight-item .label {
  font-size: 13.5px;
}

.spotlight-item .desc {
  font-size: 11px;
  color: var(--text-secondary);
  margin-top: 1px;
}

/* ─── Lock screen ─────────────────────────────────────────────────── */
.lockscreen {
  position: fixed;
  inset: 0;
  background: #000;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 20000;
  transition: opacity 0.5s, transform 0.5s;
  color: white;
}

@keyframes kenburns {
  0% {
    transform: scale(1.05) translate(0%, 0%);
  }

  100% {
    transform: scale(1.20) translate(-2.5%, -1.5%);
  }
}

.lockscreen .bg {
  position: absolute;
  inset: 0;
  background-image: var(--wallpaper, linear-gradient(180deg, #1f2552 0%, #3e3170 30%, #7b3f6e 55%, #c75d6b 75%, #f5a45e 100%));
  background-size: cover;
  background-position: center center;
  will-change: transform;
  z-index: 0;
  animation: kenburns 22s ease-in-out infinite alternate;
}

.lockscreen::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.35) 0%, rgba(0, 0, 0, 0.15) 40%, rgba(0, 0, 0, 0.45) 100%);
  pointer-events: none;
  z-index: 1;
}

.lockscreen>*:not(.bg) {
  position: relative;
  z-index: 2;
}

.lockscreen.exiting {
  opacity: 0;
  transform: scale(1.06);
  pointer-events: none;
}

.lockscreen .clock-display {
  font-family: var(--font-system);
  font-weight: 200;
  font-size: 96px;
  letter-spacing: -0.04em;
  text-shadow: 0 2px 30px rgba(0, 0, 0, 0.3);
  line-height: 1;
}

.lockscreen .date-display {
  font-size: 18px;
  font-weight: 500;
  margin-top: 6px;
  opacity: 0.95;
  text-shadow: 0 1px 10px rgba(0, 0, 0, 0.3);
}

.lockscreen .spacer {
  flex: 1;
}

.lockscreen .logo-block {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 30px;
  margin-bottom: 56px;
}

.lockscreen .logo-btn {
  position: relative;
  width: 110px;
  height: 110px;
  border-radius: 50%;
  background-size: cover;
  background-position: center;
  box-shadow:
    0 0 0 3px rgba(255, 255, 255, 0.85),
    0 8px 30px rgba(0, 0, 0, 0.35);
  cursor: default;
  transition: transform 0.2s, box-shadow 0.2s;
  isolation: isolate;
}
.lockscreen .logo-btn::before,
.lockscreen .logo-btn::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 1.5px solid rgba(255, 255, 255, 0.55);
  pointer-events: none;
  z-index: -1;
  animation: avatarRipple 3.2s cubic-bezier(0.22, 0.61, 0.36, 1) infinite;
}
.lockscreen .logo-btn::after { animation-delay: 1.6s; }
@keyframes avatarRipple {
  0%   { transform: scale(1);    opacity: 0.55; }
  70%  { transform: scale(1.5);  opacity: 0;    }
  100% { transform: scale(1.5);  opacity: 0;    }
}

.lockscreen .logo-btn:hover {
  transform: scale(1.04);
  box-shadow: 0 0 0 4px rgba(255, 255, 255, 0.95), 0 12px 40px rgba(0, 0, 0, 0.4);
}

.lockscreen .name {
  height: 50px;
  width: auto;
  display: block;
  filter: drop-shadow(0 1px 10px rgba(0, 0, 0, 0.3));
}

.lockscreen .hint {
  font-size: 13px;
  opacity: 0.8;
  margin-top: 4px;
  text-shadow: 0 1px 6px rgba(0, 0, 0, 0.3);
}

.lockscreen .top-bar {
  position: absolute;
  top: 20px;
  left: 0;
  right: 0;
  display: flex;
  justify-content: center;
  gap: 24px;
  font-size: 13px;
  opacity: 0.85;
}

/* ─── Desktop file icons (corner)  ────────────────────────────────── */
.desktop-files {
  position: absolute;
  top: 50px;
  left: 24px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  z-index: 5;
}

.desktop-file {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  width: 90px;
  cursor: default;
  padding: 6px;
  border-radius: 6px;
}

.desktop-file:hover {
  background: rgba(255, 255, 255, 0.15);
}

.desktop-file .file-icon {
  width: 56px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: center;
  filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.35));
}
.desktop-file .file-icon img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  user-select: none;
  -webkit-user-drag: none;
}

/* Glyph tiles for .webloc-style desktop shortcuts (free tools) —
   white rounded tile + Phosphor glyph, echoing macOS internet shortcuts. */
.desktop-file .file-icon-glyph {
  width: 50px;
  height: 50px;
  margin: 3px;
  border-radius: 11px;
  background: linear-gradient(180deg, #fdfdfd, #e7e7ee);
  color: #1f2552;
  box-shadow: inset 0 0 0 0.5px rgba(0, 0, 0, 0.08);
}

.desktop-file .file-name {
  font-size: 12px;
  color: white;
  text-align: center;
  line-height: 1.2;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
  padding: 1px 4px;
  border-radius: 3px;
}

/* ─── Misc helpers ─────────────────────────────────────────────────── */
.kbd {
  font-family: var(--font-mono);
  font-size: 10.5px;
  padding: 1px 5px;
  border-radius: 4px;
  background: rgba(0, 0, 0, 0.08);
  color: var(--text-secondary);
  border: 0.5px solid rgba(0, 0, 0, 0.06);
}

/* ─── Phosphor-based dock tiles ──────────────────────────────────── */
.dock-tile {
  width: 100%;
  height: 100%;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.22), inset 0 -1px 0 rgba(0, 0, 0, 0.18);
}

.dock-tile i {
  display: block;
}

.dock-tile-img {
  padding: 0;
  overflow: hidden;
}
.dock-tile-img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  user-select: none;
  -webkit-user-drag: none;
}

/* Phosphor glyph alignment fix inside any container */
i[class^="ph"],
i[class*=" ph"] {
  font-style: normal;
  vertical-align: middle;
}

/* ============================================================
   MOBILE — iOS-style home screen + app sheets
   ============================================================
   Active below 820px. Replaces the macOS desktop UI entirely
   (no scaling — different platform metaphor for different form
   factor, same designer's hand).
*/

@media (max-width: 820px) {
  /* Hide desktop chrome — the mobile shell takes over.
     The static lockscreen stays visible while locked. */
  body:not([data-locked="true"]) .menubar,
  body:not([data-locked="true"]) .widgets,
  body:not([data-locked="true"]) .desktop-files,
  body:not([data-locked="true"]) .dock-wrap {
    display: none !important;
  }

  /* Mobile-tune the static lockscreen */
  .lockscreen .top-bar { padding: 14px 20px 8px; font-size: 13px; }
  .lockscreen .clock-display { font-size: 80px; }
  .lockscreen .date-display { font-size: 19px; margin-top: 4px; }
  .lockscreen .logo-block { padding-bottom: 32px; }
  .lockscreen .logo-btn { width: 84px; height: 84px; }
  .lockscreen .name { height: 36px; }
  .lockscreen .hint { font-size: 13px; }
}

/* Mobile root stays at the full layout viewport — the wallpaper + home
   screen should NOT resize when the keyboard opens. Only the open sheet
   (which contains the focused input) reacts via --m-vh. */
.m-app-root {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 100vh;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--wallpaper) center/cover no-repeat;
  font-family: 'Geist', system-ui, -apple-system, sans-serif;
  color: white;
}

/* ── Status bar ───────────────────────────────────────────── */
.m-status {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 22px 6px;
  font-size: 15px;
  font-weight: 600;
  color: white;
  /* Double-stack shadow: tight inner + soft outer halo. Keeps white text
     legible against bright wallpaper patches without looking heavy. */
  text-shadow:
    0 1px 1px rgba(0, 0, 0, 0.55),
    0 0 6px rgba(0, 0, 0, 0.35);
  flex-shrink: 0;
  z-index: 5;
}
.m-status.light { color: white; }
.m-status-time { font-variant-numeric: tabular-nums; }
.m-status-right {
  display: flex;
  align-items: center;
  gap: 6px;
}
.m-status-mr {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.04em;
  padding: 1px 5px;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.18);
}
.m-status-bat {
  display: inline-flex;
  align-items: center;
  margin-left: 2px;
}
.m-status-bat-shell {
  display: inline-block;
  width: 22px;
  height: 11px;
  border: 1px solid rgba(255, 255, 255, 0.85);
  border-radius: 3px;
  padding: 1px;
}
.m-status-bat-fill {
  display: block;
  width: 75%;
  height: 100%;
  background: white;
  border-radius: 1px;
}
.m-status-bat-tip {
  display: inline-block;
  width: 2px;
  height: 5px;
  background: rgba(255, 255, 255, 0.85);
  border-radius: 0 2px 2px 0;
  margin-left: 1px;
}

/* ── Home screen ──────────────────────────────────────────── */
.m-home {
  flex: 1;
  overflow: hidden;
  position: relative;
  display: flex;
  flex-direction: column;
}
.m-home-rail {
  display: flex;
  flex: 1;
  width: 100%;
  will-change: transform;
}
.m-home-slide {
  flex: 0 0 100%;
  width: 100%;
  overflow-y: auto;
  padding: 12px 18px 8px;
  -webkit-overflow-scrolling: touch;
}
.m-home-page {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

/* Page dots — sit just above the dock. m-home ends at the top of the
   dock (it's flex: 1 in a column that includes the dock below), so a
   small bottom offset within m-home is right above the dock. */
.m-page-dots {
  position: absolute;
  bottom: 8px;
  left: 0;
  right: 0;
  display: flex;
  justify-content: center;
  gap: 6px;
  pointer-events: none;
  z-index: 4;
}
.m-page-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.4);
  transition: background 180ms ease;
}
.m-page-dot.active { background: rgba(255, 255, 255, 0.95); }

/* ── Widgets on mobile ────────────────────────────────────── */
.m-widgets {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-bottom: 4px;
}
/* Square tiles — iOS small widget aspect. */
.m-widget-slot {
  aspect-ratio: 1 / 1;
}
/* Override the desktop widget's absolute-positioned shell when nested in
   a mobile widget slot — let it fill the square tile. */
.m-widget-slot > .widget,
.m-widget-slot .widget {
  position: relative;
  inset: auto;
  height: 100%;
  width: 100%;
  min-height: 0;
}

/* ── App icon grid ────────────────────────────────────────── */
.m-app-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px 14px;
  padding: 4px 0 24px;
}
.m-app {
  appearance: none;
  background: transparent;
  border: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 0;
  cursor: default;
  -webkit-tap-highlight-color: transparent;
}
.m-app:active .m-app-icon { transform: scale(0.92); }
.m-app-icon {
  display: block;
  width: 64px;
  height: 64px;
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.22);
  transition: transform 120ms ease;
}
.m-app-icon .dock-tile { border-radius: 16px; }
.m-app-icon .dock-tile-img img { border-radius: 16px; }
.m-app-label {
  font-size: 11.5px;
  color: white;
  font-weight: 500;
  /* Stronger halo so app labels stay legible over light wallpaper patches. */
  text-shadow:
    0 1px 2px rgba(0, 0, 0, 0.7),
    0 0 8px rgba(0, 0, 0, 0.45);
  letter-spacing: 0.01em;
  white-space: nowrap;
  max-width: 72px;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ── Bottom dock ──────────────────────────────────────────── */
.m-dock {
  position: relative;
  display: flex;
  justify-content: space-around;
  align-items: center;
  margin: 0 14px 22px;
  padding: 12px 12px;
  border-radius: 28px;
  background: rgba(255, 255, 255, 0.16);
  backdrop-filter: blur(28px) saturate(180%);
  -webkit-backdrop-filter: blur(28px) saturate(180%);
  border: 0.5px solid rgba(255, 255, 255, 0.28);
  z-index: 3;
}
.m-dock-bg { display: none; }
.m-dock-item {
  appearance: none;
  background: transparent;
  border: 0;
  padding: 0;
  cursor: default;
  -webkit-tap-highlight-color: transparent;
}
.m-dock-item:active .m-dock-icon { transform: scale(0.92); }
.m-dock-icon {
  display: block;
  width: 56px;
  height: 56px;
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.2);
  transition: transform 120ms ease;
}
.m-dock-icon .dock-tile { border-radius: 14px; }
.m-dock-icon .dock-tile-img img { border-radius: 14px; }

/* ── App sheet — styled as a macOS window on mobile ───────── */
/* The backdrop fills the viewport (catches taps for dismiss in future,
   plus a subtle dim) and centers the inset window card. */
.m-sheet-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 100vh;
  height: 100dvh;
  height: var(--m-vh, 100dvh);
  z-index: 100;
  display: flex;
  align-items: stretch;
  justify-content: stretch;
  padding: 16px 12px 16px;
  pointer-events: none;
  opacity: 0;
  transition: opacity 200ms ease;
}
.m-sheet-backdrop.entering { opacity: 1; pointer-events: auto; }
.m-sheet-backdrop.exiting  { opacity: 0; pointer-events: none; }

.m-sheet {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: var(--window-bg, rgba(245, 245, 247, 0.94));
  backdrop-filter: blur(40px) saturate(180%);
  -webkit-backdrop-filter: blur(40px) saturate(180%);
  border-radius: 14px;
  box-shadow:
    0 24px 60px rgba(0, 0, 0, 0.35),
    0 0 0 0.5px rgba(0, 0, 0, 0.2);
  overflow: hidden;
  border: 0.5px solid rgba(0, 0, 0, 0.18);
  transform: translateY(18px) scale(0.985);
  opacity: 0;
  transition:
    transform 240ms cubic-bezier(0.16, 1, 0.3, 1),
    opacity 200ms ease;
}
.m-sheet-backdrop.entering .m-sheet { transform: translateY(0) scale(1); opacity: 1; }
.m-sheet-backdrop.exiting .m-sheet  { transform: translateY(18px) scale(0.985); opacity: 0; }

.m-sheet-header {
  height: 52px;
  flex-shrink: 0;
  background: var(--window-header, rgba(236, 236, 238, 0.85));
  border-bottom: 0.5px solid var(--separator);
  display: flex;
  align-items: center;
  padding: 0 16px;
  gap: 16px;
  position: relative;
}
/* Mobile traffic lights — 2× desktop size for finger-friendly tap target. */
.m-sheet-header .traffic-lights {
  display: flex;
  gap: 16px;
  align-items: center;
}
.m-sheet-header .traffic-lights .tl {
  width: 24px;
  height: 24px;
  font-size: 16px;
}
.m-sheet-header .traffic-lights .tl > i {
  font-size: 14px !important;
}
/* Reveal the close-X glyph at rest on mobile (no hover state on touch). */
.m-sheet-header .traffic-lights .tl.red > i { opacity: 1; }
.m-sheet-header .tl.disabled {
  cursor: default;
  opacity: 0.55;
}
.m-sheet-title {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary, #1d1d1f);
  white-space: nowrap;
  max-width: 60%;
  overflow: hidden;
  text-overflow: ellipsis;
}
.m-sheet-body {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  background: var(--surface, #f5f5f7);
  /* Reset the inherited white text from .m-app-root — sheet content lives
     on a light surface, dark text is the default; white is opt-in (e.g.
     buttons, active states). Fixes invisible h1/h3/badge/etc. */
  color: var(--text-primary);
}
.m-sheet-header {
  color: var(--text-primary);
}

/* ============================================================
   Mobile content overrides — desktop content components were designed
   for fixed-width windows; here we re-flow each one for narrow viewports.
   Scoped to .m-sheet-body so desktop stays untouched.
   ============================================================ */

/* Universal: any content using a finder-style 2-col layout (Writing) →
   stack the sidebar as a horizontal scrollable pill row on top. */
.m-sheet-body .finder-layout {
  flex-direction: column;
  height: auto;
  min-height: 100%;
}
.m-sheet-body .finder-sidebar {
  width: 100%;
  border-right: 0;
  border-bottom: 0.5px solid var(--separator);
  display: flex;
  overflow-x: auto;
  gap: 6px;
  padding: 10px 12px;
  flex-shrink: 0;
  -webkit-overflow-scrolling: touch;
}
.m-sheet-body .finder-sidebar .group-label { display: none; }
.m-sheet-body .finder-sidebar .item {
  flex-shrink: 0;
  padding: 6px 12px;
  border-radius: 14px;
  background: rgba(0, 0, 0, 0.05);
  white-space: nowrap;
}
.m-sheet-body .finder-sidebar .item.active {
  background: rgba(91, 141, 239, 0.15);
  color: #5b8def;
}

/* About — hero stacks (portrait then text), sections get tighter padding. */
.m-sheet-body .about-hero {
  grid-template-columns: 1fr;
  padding: 24px 20px 18px;
  gap: 18px;
  text-align: center;
}
.m-sheet-body .about-hero .portrait {
  width: 110px;
  height: 110px;
  margin: 0 auto;
}
.m-sheet-body .about-hero h1 { font-size: 38px; }
.m-sheet-body .about-hero .sub { margin-left: auto; margin-right: auto; }
.m-sheet-body .about-hero .pill-row { justify-content: center; }
.m-sheet-body .about-section { padding: 20px !important; }

/* Work — 1-col on phones; cards are clear and tappable. */
.m-sheet-body .work-grid {
  grid-template-columns: 1fr;
  padding: 16px 18px 32px;
  gap: 16px;
}

/* Resume — let the page fit the sheet width instead of fixed 820px. */
.m-sheet-body .resume-page {
  width: 100%;
  padding: 28px 22px;
}
.m-sheet-body .resume-page h1 { font-size: 28px; }
.m-sheet-body .resume-page .skill-grid { grid-template-columns: 1fr; gap: 6px; }
.m-sheet-body .resume-page .job-head {
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
}
.m-sheet-body .resume-toolbar { padding: 0 14px; }

/* Mail / Contact — the inbox side rail becomes a horizontally-scrollable
   strip of mail items above the compose form. Group headers ("Drafts",
   "Inbox") stay inline as section labels in the strip. */
.m-sheet-body .mail-layout {
  flex-direction: column;
  height: auto;
  min-height: 100%;
}
.m-sheet-body .mail-side {
  width: 100%;
  max-height: 140px;
  border-right: 0;
  border-bottom: 0.5px solid var(--separator);
  display: flex;
  gap: 8px;
  overflow-x: auto;
  overflow-y: hidden;
  padding: 10px 12px;
  flex-shrink: 0;
  -webkit-overflow-scrolling: touch;
  align-items: stretch;
}
.m-sheet-body .mail-side .header {
  flex-shrink: 0;
  padding: 0;
  align-self: center;
  font-size: 10px;
  white-space: nowrap;
}
.m-sheet-body .mail-side .mail-item {
  flex: 0 0 180px;
  border-bottom: 0;
  border-right: 0.5px solid var(--separator);
  padding: 8px 12px;
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.03);
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 12px;
}
.m-sheet-body .mail-side .mail-item .subj {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 11.5px;
}
.m-sheet-body .mail-side .mail-item .from { font-size: 12px; font-weight: 600; }
.m-sheet-body .mail-side .mail-item .when { font-size: 10px; opacity: 0.6; }
.m-sheet-body .mail-side .mail-item.active {
  background: var(--accent);
  color: white;
}
.m-sheet-body .mail-side .mail-item.active .when { color: rgba(255,255,255,0.8); }

/* Compose form — stack labels above inputs so values aren't pinched. */
.m-sheet-body .mail-compose { padding: 18px 18px 28px; }
.m-sheet-body .mail-compose .field {
  flex-direction: column;
  align-items: stretch;
  padding: 6px 0;
}
.m-sheet-body .mail-compose .field .lbl {
  width: auto;
  margin-bottom: 4px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.m-sheet-body .mail-compose .field input { font-size: 15px; padding: 4px 0; }
.m-sheet-body .mail-compose .body-area textarea,
.m-sheet-body .mail-compose .body-area {
  font-size: 15px;
  min-height: 140px;
}
.m-sheet-body .mail-compose .send-row {
  flex-wrap: wrap;
  gap: 10px 14px;
}
.m-sheet-body .mail-compose .send-row > span,
.m-sheet-body .mail-compose .send-row .quip {
  flex-basis: 100%;
  font-size: 12px;
}

/* Email-view (when reading a fake inbox email) — let it own the full width. */
.m-sheet-body .email-view { padding: 18px; }

/* Calendar — mobile layout:
   1. Main calendar grid (with month nav header)
   2. Availability summary
   3. Book a slot button
   The mini calendar is redundant on mobile (the main grid is right there),
   so it's hidden along with the duplicate month/year heading. */
.m-sheet-body .cal {
  flex-direction: column;
  height: auto;
  min-height: 100%;
}
.m-sheet-body .cal-main {
  order: 1;
  width: 100%;
  padding: 10px 0 4px;
  border-bottom: 0.5px solid var(--separator);
}
.m-sheet-body .cal-side {
  order: 2;
  width: 100%;
  border-right: 0;
  padding: 18px 18px 22px;
}
/* Hide the redundant mini-cal block (first <h3> = month/year heading,
   and the .cal-mini grid that follows). Keep the "Availability" h3 and
   list and Book-a-slot button visible. */
.m-sheet-body .cal-side > h3:first-of-type { display: none; }
.m-sheet-body .cal-mini { display: none; }
.m-sheet-body .cal-side h3 { font-size: 13px; margin-top: 0 !important; }
.m-sheet-body .cal-head { padding: 10px 16px; }
.m-sheet-body .cal-head h2 { font-size: 18px; }
.m-sheet-body .cal-grid { font-size: 10px; padding: 0 8px 16px; }
.m-sheet-body .cal-grid .cell { min-height: 64px; padding: 4px; }
.m-sheet-body .cal-grid .cell .ev { font-size: 9px; padding: 1px 4px; }
.m-sheet-body .cal-pop { width: 86vw; max-width: 360px; }

/* Reader / article iframe — fill the sheet body cleanly. */
.m-sheet-body .reader-wrap { background: #f7f5f0; height: 100%; }
.m-sheet-body .reader-bar { padding: 8px 12px; }
.m-sheet-body .reader-url { font-size: 10px; padding: 4px 10px; }

/* Terminal — bump the cell sizing down so a usable line count fits. */
.m-sheet-body .terminal-screen { font-size: 12.5px; padding: 12px 14px; }

/* ExternalLink (Dynamite / Media Rocket) — stack content; soften padding. */
.m-sheet-body .external-link-body { padding: 24px 20px; }

/* The window toolbar inside Mail compose was sized for desktop — slim down */
.m-sheet-body .window-toolbar { padding: 0 14px !important; height: 38px !important; }

/* ── Mobile accessibility pass ──────────────────────────────
   Mobile screens see smaller text in more varied lighting than desktop.
   Apple's iOS bumps tertiary text contrast (~0.62 alpha vs ~0.45 desktop)
   in similar contexts. Scoped to sheets — desktop is untouched. */
.m-sheet-body {
  --text-tertiary: rgba(60, 60, 67, 0.65);
}
/* Form labels — bump to secondary weight + slight up-tick in size so
   "TO:", "FROM:", etc. read clearly even with reading glasses off. */
.m-sheet-body .mail-compose .field .lbl {
  color: var(--text-secondary);
  font-weight: 600;
  font-size: 11.5px;
}
/* Input values + placeholders — readable at arm's length. */
.m-sheet-body .mail-compose .field input,
.m-sheet-body .mail-compose .body-area textarea {
  color: var(--text-primary);
}
.m-sheet-body input::placeholder,
.m-sheet-body textarea::placeholder {
  color: rgba(60, 60, 67, 0.55);
}
/* Active pills in the horizontal sidebar — clearer "selected" state. */
.m-sheet-body .finder-sidebar .item.active {
  background: rgba(91, 141, 239, 0.18);
  color: #1d68d6;
  font-weight: 600;
}
.m-sheet-body .mail-side .mail-item.active {
  font-weight: 600;
}
.m-sheet-body .mail-side .header {
  color: var(--text-secondary);
  font-weight: 700;
}
/* Buttons — touch-target + contrast bump. Apple HIG recommends 44pt min. */
.m-sheet-body .mail-btn {
  font-weight: 600;
  padding: 10px 22px;
  min-height: 44px;
}
.m-sheet-body .mail-btn.ghost {
  background: rgba(0, 0, 0, 0.08);
  color: var(--text-primary);
}
.m-sheet-body .today-btn,
.m-sheet-body .cal-head .today-btn {
  min-height: 32px;
  font-weight: 600;
  color: var(--text-primary);
  background: rgba(0, 0, 0, 0.08);
}
.m-sheet-body .cal-head button.today-btn {
  /* Prev / next chevron buttons share the today-btn class; bump readability. */
  color: var(--text-primary);
}
/* Mail-strip card inner text — these were inheriting white from the
   mobile root. Force the desktop hierarchy: from = primary, subj =
   secondary, when = tertiary. Active state inverts to white-on-blue. */
.m-sheet-body .mail-side .mail-item .from {
  color: var(--text-primary);
}
.m-sheet-body .mail-side .mail-item .subj {
  color: var(--text-secondary);
}
.m-sheet-body .mail-side .mail-item .when {
  color: var(--text-tertiary);
}
.m-sheet-body .mail-side .mail-item.active .from,
.m-sheet-body .mail-side .mail-item.active .subj {
  color: #fff;
}
.m-sheet-body .mail-side .mail-item.active .when {
  color: rgba(255, 255, 255, 0.92);
}
/* Send-row tertiary note ("or just email me directly") + draft quip —
   bump up so it doesn't disappear against the white form bg. */
.m-sheet-body .mail-compose .send-row > span,
.m-sheet-body .mail-compose .quip,
.m-sheet-body .mail-compose .notice {
  color: var(--text-secondary);
}

/* Hide the static lockscreen's "click" hint phrasing on touch devices
   without going over to "tap" — the word "click" reads fine on iOS Safari
   too, but the cursor styling looks off. */
@media (max-width: 820px) and (pointer: coarse) {
  .lockscreen .hint { letter-spacing: 0.02em; }
}

/* ─── Delight & easter eggs ───────────────────────────────────────── */

/* Trash window */
.trash-wrap { height: 100%; display: flex; flex-direction: column; }
.trash-toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  border-bottom: 0.5px solid var(--separator, rgba(0,0,0,0.12));
}
.trash-toolbar .spacer { flex: 1; }
.trash-count { font-size: 12px; color: var(--text-secondary); }
.trash-empty-btn {
  font: inherit;
  font-size: 12.5px;
  font-weight: 500;
  padding: 5px 12px;
  border-radius: 7px;
  border: 0.5px solid rgba(0,0,0,0.15);
  background: linear-gradient(180deg, #fdfdfd, #f0f0f3);
  color: var(--text-primary);
  cursor: default;
}
.trash-empty-btn:disabled { opacity: 0.5; }
.trash-list { padding: 8px 10px; overflow-y: auto; transition: opacity 0.5s ease, transform 0.5s ease; }
.trash-list.poofing { opacity: 0; transform: scale(0.86); }
.trash-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 10px;
  border-radius: 7px;
  font-size: 13px;
}
.trash-row:nth-child(odd) { background: rgba(0,0,0,0.03); }
.trash-row .ic { flex: 0 0 auto; display: inline-flex; }
.trash-row .nm { color: var(--text-primary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.trash-row .sz { flex: 0 0 auto; color: var(--text-secondary); font-size: 12px; margin-left: auto; }
.trash-row .nt { flex: 0 0 38%; color: var(--text-secondary); font-size: 12px; font-style: italic; text-align: right; }
.trash-empty-state {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  color: var(--text-secondary);
}
.trash-empty-state .t { font-size: 15px; font-weight: 600; color: var(--text-primary); margin-top: 10px; }
.trash-empty-state .s { font-size: 12.5px; }

/* Resume toolbar quip + print */
.tb-quip { font-size: 12px; color: var(--text-secondary); font-style: italic; margin-left: 6px; }
/* Print: isolate the resume page. Scoped with :has() so that printing the
   site WITHOUT the Resume window open doesn't hide everything and emit a
   blank sheet. */
@media print {
  body:has(.resume-page) * { visibility: hidden !important; }
  body:has(.resume-page) .resume-page,
  body:has(.resume-page) .resume-page * { visibility: visible !important; }
  body:has(.resume-page) .resume-page {
    position: fixed !important;
    inset: 0 !important;
    transform: none !important;
    box-shadow: none !important;
    margin: 0 !important;
  }
}

/* Clock widget elapsed pill */
.widget-clock { position: relative; }
.clock-elapsed {
  position: absolute;
  bottom: 8px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0,0,0,0.65);
  color: #fff;
  font-size: 10.5px;
  font-weight: 500;
  padding: 3px 9px;
  border-radius: 999px;
  white-space: nowrap;
  z-index: 2;
}

/* Wi-Fi rescan status */
.wifi-scan-status {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 6px 10px;
  font-size: 12px;
  color: rgba(0,0,0,0.55);
}
.wifi-scan-status i { animation: wifi-spin 0.9s linear infinite; display: inline-flex; }
@keyframes wifi-spin { to { transform: rotate(360deg); } }

/* Spotlight empty state */
.spotlight-empty {
  padding: 14px 16px;
  font-size: 13px;
  color: var(--text-secondary, rgba(60,60,67,0.7));
}

/* Matrix rain overlay (terminal `matrix` command) — transparent canvas,
   green glyphs with a soft glow so they read over bright wallpapers. */
.matrix-overlay {
  position: fixed;
  inset: 0;
  z-index: 100000;
  pointer-events: none;
  animation: matrix-in 0.25s ease;
  transition: opacity 0.85s ease;
  opacity: 1;
  filter: drop-shadow(0 0 3px rgba(0, 255, 65, 0.55));
}
.matrix-overlay.fading { opacity: 0; }
@keyframes matrix-in { from { opacity: 0; } to { opacity: 1; } }

/* "bjorn" signature flourish — logo reveals left-to-right, then fades */
.signature-overlay {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  z-index: 99999;
}
.signature-overlay img {
  height: 110px;
  filter: drop-shadow(0 6px 24px rgba(0,0,0,0.5));
  animation: sig-write 2.4s ease forwards;
}
@keyframes sig-write {
  0%   { clip-path: inset(0 100% 0 0); opacity: 1; }
  55%  { clip-path: inset(0 0% 0 0); opacity: 1; }
  80%  { clip-path: inset(0 0% 0 0); opacity: 1; }
  100% { clip-path: inset(0 0% 0 0); opacity: 0; }
}
