/* =========================================================================
   Ice1337q — macOS-inspired portfolio
   Original design. No Apple trademarks / wallpapers / logos used.
   ========================================================================= */

/* ----------------------------- Design tokens ----------------------------- */
:root {
  color-scheme: light dark;

  --ui-font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", system-ui, Roboto, Helvetica, Arial, sans-serif;
  --mono-font: "SF Mono", "JetBrains Mono", ui-monospace, "Cascadia Code", Menlo, Consolas, "Liberation Mono", monospace;

  --ease: cubic-bezier(.22, .8, .27, 1);
  --ease-out: cubic-bezier(.16, 1, .3, 1);
  --spring: cubic-bezier(.34, 1.56, .64, 1);

  --radius-win: 14px;
  --radius-sm: 9px;

  --dock-size: 54px;
  --menubar-h: 30px;

  --accent: #7c5cff;
  --accent-2: #25d0a3;

  /* terminal palette (shared) */
  --term-green: #36d399;
  --term-cyan: #38bdf8;
  --term-violet: #a78bfa;
  --term-yellow: #fbbf24;
  --term-pink: #f472b6;
  --term-red: #fb7185;
  --term-dim: #8a93a6;
}

/* ------------------------------- Themes ---------------------------------- */
/* Defaults follow the system; JS sets data-theme to force a choice.        */
[data-theme="dark"], :root {
  --bg-grad-1: #1b1140;
  --bg-grad-2: #0a1230;
  --bg-grad-3: #06212e;
  --blob-a: #7c5cff;
  --blob-b: #ff7ac6;
  --blob-c: #25d0a3;

  --text: #f3f5fb;
  --text-soft: #c5cbdd;
  --text-dim: #8b93a8;

  --win-bg: rgba(22, 24, 34, 0.72);
  --win-bg-solid: #161822;
  --win-border: rgba(255, 255, 255, 0.10);
  --win-shadow: 0 28px 70px -18px rgba(0, 0, 0, 0.65), 0 6px 18px -8px rgba(0, 0, 0, 0.5);
  --titlebar-bg: rgba(40, 43, 56, 0.55);

  --term-bg: rgba(13, 15, 22, 0.62);
  --term-text: #e7ebf4;

  --menubar-bg: rgba(28, 30, 42, 0.55);
  --menubar-text: #f2f4fb;

  --dock-bg: rgba(40, 43, 60, 0.42);
  --dock-border: rgba(255, 255, 255, 0.14);

  --chip-bg: rgba(255, 255, 255, 0.07);
  --chip-border: rgba(255, 255, 255, 0.12);
  --chip-hover: rgba(255, 255, 255, 0.14);

  --card-bg: rgba(255, 255, 255, 0.04);
  --card-border: rgba(255, 255, 255, 0.10);
}

@media (prefers-color-scheme: light) {
  :root {
    --bg-grad-1: #e9ecff;
    --bg-grad-2: #f3e9ff;
    --bg-grad-3: #e2f6ff;
    --blob-a: #9d8bff;
    --blob-b: #ffafd8;
    --blob-c: #7fe9cf;

    --text: #14161f;
    --text-soft: #34384a;
    --text-dim: #6b7185;

    --win-bg: rgba(255, 255, 255, 0.66);
    --win-bg-solid: #f6f7fb;
    --win-border: rgba(0, 0, 0, 0.08);
    --win-shadow: 0 24px 60px -20px rgba(40, 36, 90, 0.32), 0 6px 16px -8px rgba(40, 36, 90, 0.18);
    --titlebar-bg: rgba(255, 255, 255, 0.5);

    --term-bg: rgba(252, 252, 255, 0.74);
    --term-text: #1c2030;

    --menubar-bg: rgba(255, 255, 255, 0.55);
    --menubar-text: #1a1c26;

    --dock-bg: rgba(255, 255, 255, 0.46);
    --dock-border: rgba(255, 255, 255, 0.6);

    --chip-bg: rgba(20, 22, 40, 0.05);
    --chip-border: rgba(20, 22, 40, 0.10);
    --chip-hover: rgba(20, 22, 40, 0.10);

    --card-bg: rgba(255, 255, 255, 0.5);
    --card-border: rgba(20, 22, 40, 0.08);

    --term-green: #0a9d6b;
    --term-cyan: #0284c7;
    --term-violet: #7c3aed;
    --term-yellow: #b45309;
    --term-pink: #db2777;
    --term-red: #e11d48;
    --term-dim: #4a5265;
  }
}

/* Explicit overrides set by the toggle (win over media query) */
[data-theme="light"] {
  --bg-grad-1: #e9ecff; --bg-grad-2: #f3e9ff; --bg-grad-3: #e2f6ff;
  --blob-a: #9d8bff; --blob-b: #ffafd8; --blob-c: #7fe9cf;
  --text: #14161f; --text-soft: #34384a; --text-dim: #6b7185;
  --win-bg: rgba(255,255,255,.66); --win-bg-solid: #f6f7fb; --win-border: rgba(0,0,0,.08);
  --win-shadow: 0 24px 60px -20px rgba(40,36,90,.32), 0 6px 16px -8px rgba(40,36,90,.18);
  --titlebar-bg: rgba(255,255,255,.5);
  --term-bg: rgba(252,252,255,.74); --term-text: #1c2030;
  --menubar-bg: rgba(255,255,255,.55); --menubar-text: #1a1c26;
  --dock-bg: rgba(255,255,255,.46); --dock-border: rgba(255,255,255,.6);
  --chip-bg: rgba(20,22,40,.05); --chip-border: rgba(20,22,40,.10); --chip-hover: rgba(20,22,40,.10);
  --card-bg: rgba(255,255,255,.5); --card-border: rgba(20,22,40,.08);
  --term-green:#0a9d6b; --term-cyan:#0284c7; --term-violet:#7c3aed; --term-yellow:#b45309;
  --term-pink:#db2777; --term-red:#e11d48; --term-dim:#4a5265;
}

/* ------------------------------- Reset ----------------------------------- */
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; } /* ensure attribute beats .window{display:flex} */
html, body { height: 100%; }

/* Fallback for browsers without backdrop-filter (e.g. older Firefox): use solid panels
   so translucent surfaces never become unreadable over the wallpaper. */
@supports not ((backdrop-filter: blur(2px)) or (-webkit-backdrop-filter: blur(2px))) {
  .menubar, .window, .dropdown, .dock-items { background: var(--win-bg-solid); }
}
body {
  margin: 0;
  font-family: var(--ui-font);
  color: var(--text);
  background: var(--bg-grad-2);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow: hidden;
}
button { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }

.skip-link {
  position: fixed; top: 6px; left: 50%; transform: translateX(-50%) translateY(-150%);
  z-index: 999; background: var(--accent); color: #fff; padding: 8px 14px;
  border-radius: 8px; font-size: 13px; font-weight: 600; transition: transform .2s var(--ease);
}
.skip-link:focus { transform: translateX(-50%) translateY(0); }

/* Crawlable / screen-reader portfolio mirror — present in the DOM, hidden from the visual desktop. */
.sr-portfolio {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; border: 0;
}

/* No-JS fallback (CSS still loads without JS; theme follows prefers-color-scheme). */
.noscript-fallback {
  position: fixed; inset: 0; z-index: 9999; overflow: auto;
  background: var(--bg-grad-2); color: var(--text);
  padding: 7vh 6vw calc(7vh + env(safe-area-inset-bottom, 0));
  font-family: var(--ui-font); -webkit-font-smoothing: antialiased;
}
.noscript-fallback .ns-card { max-width: 720px; margin: 0 auto; line-height: 1.55; }
.noscript-fallback .ns-card > h2:first-child { font-size: clamp(22px, 5vw, 34px); margin: 0 0 8px; }
.noscript-fallback h2 { margin: 26px 0 8px; font-size: 18px; }
.noscript-fallback a { color: var(--term-cyan); } /* WCAG-AA contrast in both themes */
.noscript-fallback ul { padding-left: 20px; }
.noscript-fallback li { margin: 9px 0; }
.noscript-fallback code { font-family: var(--mono-font); font-size: .92em; }
.noscript-fallback .ns-note { margin-top: 28px; color: var(--text-dim); font-size: 13px; }

/* ------------------------------ Desktop ---------------------------------- */
#desktop {
  position: relative;
  height: 100dvh;
  width: 100%;
  overflow: hidden;
  isolation: isolate;
}

/* Original abstract wallpaper */
.wallpaper {
  position: absolute; inset: 0; z-index: 0;
  background:
    radial-gradient(120% 120% at 12% 8%, var(--bg-grad-1) 0%, transparent 55%),
    radial-gradient(120% 120% at 88% 18%, var(--bg-grad-3) 0%, transparent 50%),
    linear-gradient(160deg, var(--bg-grad-2), var(--bg-grad-3));
}
.blob {
  position: absolute; border-radius: 50%; filter: blur(70px); opacity: .55;
  will-change: transform;
}
.blob-a { width: 46vmax; height: 46vmax; left: -10vmax; top: -8vmax; background: var(--blob-a); animation: drift-a 26s var(--ease) infinite alternate; }
.blob-b { width: 40vmax; height: 40vmax; right: -12vmax; top: 6vmax; background: var(--blob-b); opacity: .42; animation: drift-b 32s var(--ease) infinite alternate; }
.blob-c { width: 38vmax; height: 38vmax; left: 30vmax; bottom: -16vmax; background: var(--blob-c); opacity: .40; animation: drift-c 30s var(--ease) infinite alternate; }
.grain {
  position: absolute; inset: 0; opacity: .05; mix-blend-mode: overlay; pointer-events: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}
@keyframes drift-a { to { transform: translate(8vmax, 6vmax) scale(1.1); } }
@keyframes drift-b { to { transform: translate(-7vmax, 8vmax) scale(1.08); } }
@keyframes drift-c { to { transform: translate(5vmax, -7vmax) scale(1.12); } }

/* ------------------------------ Menu bar --------------------------------- */
.menubar {
  position: absolute; top: 0; left: 0; right: 0; z-index: 50;
  height: var(--menubar-h);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 10px; padding-top: env(safe-area-inset-top, 0);
  height: calc(var(--menubar-h) + env(safe-area-inset-top, 0));
  background: var(--menubar-bg);
  -webkit-backdrop-filter: blur(22px) saturate(180%);
  backdrop-filter: blur(22px) saturate(180%);
  color: var(--menubar-text);
  font-size: 13px;
  border-bottom: 0.5px solid var(--win-border);
}
.menubar-left, .menubar-right { display: flex; align-items: center; gap: 2px; }
.menubar-right { gap: 8px; }
.menu-item {
  background: none; border: 0; cursor: pointer;
  padding: 3px 9px; border-radius: 6px; line-height: 1;
  color: inherit; white-space: nowrap;
  transition: background .15s var(--ease);
}
.menu-item:hover, .menu-item[aria-expanded="true"] { background: rgba(125,125,160,.22); }
.brand { display: inline-flex; align-items: center; gap: 6px; }
.brand strong { font-weight: 650; letter-spacing: .2px; }
.brand-mark {
  display: inline-grid; place-items: center; width: 19px; height: 19px; border-radius: 6px;
  color: #fff; background: linear-gradient(135deg, var(--accent), var(--accent-2));
  box-shadow: 0 1px 4px rgba(0,0,0,.25);
}

.status-icon {
  display: inline-grid; place-items: center; background: none; border: 0;
  cursor: default; color: inherit; padding: 2px; border-radius: 6px; opacity: .92;
}
button.status-icon { cursor: pointer; }
button.status-icon:hover { background: rgba(125,125,160,.22); }
.theme-toggle .icon-moon { display: none; }
[data-active-theme="light"] .theme-toggle .icon-sun { display: none; }
[data-active-theme="light"] .theme-toggle .icon-moon { display: block; }
.menu-clock { font-variant-numeric: tabular-nums; font-size: 13px; padding-left: 2px; min-width: 116px; text-align: right; }

/* Menu dropdowns */
.menu-dropdowns { position: absolute; inset: 0; pointer-events: none; }
.dropdown {
  position: absolute; top: calc(var(--menubar-h) + env(safe-area-inset-top, 0) - 2px);
  min-width: 220px; max-width: 92vw; box-sizing: border-box; pointer-events: auto;
  background: var(--win-bg);
  -webkit-backdrop-filter: blur(30px) saturate(180%);
  backdrop-filter: blur(30px) saturate(180%);
  border: 0.5px solid var(--win-border); border-radius: 10px;
  box-shadow: var(--win-shadow); padding: 5px; font-size: 13px;
  transform-origin: top left; animation: dropdown-in .14s var(--ease-out);
}
@keyframes dropdown-in { from { opacity: 0; transform: scale(.97) translateY(-4px);} }
.dropdown button {
  display: flex; width: 100%; justify-content: space-between; gap: 18px; align-items: center;
  background: none; border: 0; text-align: left; padding: 6px 10px; border-radius: 6px;
  cursor: pointer; color: var(--text); white-space: nowrap;
}
.dropdown button:hover { background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: #fff; }
.dropdown button:hover .dd-key { color: rgba(255,255,255,.8); }
.dropdown .dd-key { color: var(--text-dim); font-size: 12px; }
.dropdown hr { border: 0; border-top: 0.5px solid var(--win-border); margin: 5px 6px; }

/* ------------------------------ Windows ---------------------------------- */
#windows-layer { position: absolute; inset: 0; z-index: 20; }

.window {
  position: absolute;
  background: var(--win-bg);
  -webkit-backdrop-filter: blur(34px) saturate(170%);
  backdrop-filter: blur(34px) saturate(170%);
  border: 0.5px solid var(--win-border);
  border-radius: var(--radius-win);
  box-shadow: var(--win-shadow);
  display: flex; flex-direction: column;
  overflow: hidden;
  transform-origin: center center;
}
.window.positioned { transform: none; right: auto; } /* unified geometry model (JS) */
.window.focused { box-shadow: var(--win-shadow), 0 0 0 0.5px var(--win-border); }
.window:not(.focused) { filter: saturate(.9) brightness(.98); }

/* 8 resize handles (mouse/trackpad only — hidden on touch + small screens) */
.rz { position: absolute; z-index: 6; touch-action: none; }
.rz-n { top: 0; left: 14px; right: 14px; height: 5px; cursor: ns-resize; }
.rz-s { bottom: 0; left: 14px; right: 14px; height: 5px; cursor: ns-resize; }
.rz-w { left: 0; top: 14px; bottom: 14px; width: 5px; cursor: ew-resize; }
.rz-e { right: 0; top: 14px; bottom: 14px; width: 5px; cursor: ew-resize; }
.rz-nw { top: 0; left: 0; width: 15px; height: 15px; cursor: nwse-resize; }
.rz-se { bottom: 0; right: 0; width: 15px; height: 15px; cursor: nwse-resize; }
.rz-ne { top: 0; right: 0; width: 15px; height: 15px; cursor: nesw-resize; }
.rz-sw { bottom: 0; left: 0; width: 15px; height: 15px; cursor: nesw-resize; }
@media (pointer: coarse) { .rz { display: none; } }

/* edge-snap preview hint */
#snap-preview {
  position: absolute; z-index: 44; pointer-events: none;
  border-radius: var(--radius-win);
  background: color-mix(in srgb, var(--accent) 20%, transparent);
  border: 1.5px solid color-mix(in srgb, var(--accent) 65%, transparent);
  box-shadow: 0 10px 34px -12px rgba(0,0,0,.45);
  opacity: 0; transition: opacity .12s var(--ease), left .09s var(--ease), top .09s var(--ease), width .09s var(--ease), height .09s var(--ease);
}
#snap-preview.show { opacity: 1; }

/* terminal default geometry */
.terminal-window {
  width: min(760px, 92vw);
  height: min(520px, 70vh);
  left: 50%; top: calc(50% + 6px);
  transform: translate(-50%, -50%);
}
.projects-window {
  width: min(880px, 94vw);
  height: min(560px, 74vh);
  left: 50%; top: 50%;
  transform: translate(-50%, -50%);
}

.titlebar {
  position: relative; flex: 0 0 auto;
  height: 38px; display: flex; align-items: center;
  padding: 0 12px; gap: 8px;
  background: var(--titlebar-bg);
  border-bottom: 0.5px solid var(--win-border);
  cursor: grab; user-select: none;
}
.titlebar:active { cursor: grabbing; }
.title {
  position: absolute; left: 0; right: 0; text-align: center;
  font-size: 13px; font-weight: 550; color: var(--text-soft);
  pointer-events: none; letter-spacing: .2px;
}
.titlebar-spacer { flex: 1; }

.traffic-lights { display: flex; gap: 8px; }
.light {
  width: 13px; height: 13px; border-radius: 50%; border: 0; padding: 0; cursor: pointer;
  position: relative; display: inline-grid; place-items: center;
  z-index: 11; /* stay clickable above the corner resize handles */
}
.light.close { background: #ff5f57; }
.light.min   { background: #febc2e; }
.light.zoom  { background: #28c840; }
.light span { opacity: 0; font-size: 9px; line-height: 1; color: rgba(0,0,0,.62); font-weight: 700; transition: opacity .15s var(--ease); }
.traffic-lights:hover .light span { opacity: 1; }
.light.close span::before { content: "✕"; }
.light.min span::before { content: "–"; }
.light.zoom span::before { content: "+"; }
@media (prefers-color-scheme: light) { .light { box-shadow: inset 0 0 0 .5px rgba(0,0,0,.22), 0 1px 2px rgba(0,0,0,.12); } }

/* window state animations */
.window.closing { animation: win-close .26s var(--ease-out) forwards; pointer-events: none; }
@keyframes win-close { to { opacity: 0; transform: translate(-50%, -50%) scale(.92); } }
.window.minimizing { animation: win-min .42s var(--ease-out) forwards; pointer-events: none; }
.window.opening { animation: win-open .3s var(--spring); }
@keyframes win-open { from { opacity: 0; transform: scale(.96); } }
/* genie target offsets set inline via CSS vars by JS */
@keyframes win-min {
  to { opacity: 0; transform: translate(var(--min-x, 0), var(--min-y, 60vh)) scale(.06); border-radius: 40px; }
}

/* ------------------------------ Terminal --------------------------------- */
.terminal-body {
  flex: 1; min-height: 0;
  background: var(--term-bg);
  font-family: var(--mono-font);
  font-size: 13.5px; line-height: 1.6;
  color: var(--term-text);
  padding: 12px 14px 6px;
  overflow-y: auto; overflow-x: hidden;
  cursor: text;
  scrollbar-width: thin;
  scrollbar-color: rgba(140,140,160,.4) transparent;
}
.terminal-body::-webkit-scrollbar { width: 9px; }
.terminal-body::-webkit-scrollbar-thumb { background: rgba(140,140,160,.35); border-radius: 8px; border: 2px solid transparent; background-clip: padding-box; }
.term-output { white-space: pre-wrap; word-break: break-word; }
.term-line { white-space: pre-wrap; }
.term-line.echo { margin-top: 6px; }
.term-output .spacer { height: 6px; }

/* output color helpers */
.t-green { color: var(--term-green); }
.t-cyan { color: var(--term-cyan); }
.t-violet { color: var(--term-violet); }
.t-yellow { color: var(--term-yellow); }
.t-pink { color: var(--term-pink); }
.t-red { color: var(--term-red); }
.t-dim { color: var(--term-dim); }
.t-bold { font-weight: 700; }
.term-output a { color: var(--term-cyan); text-decoration: none; border-bottom: 1px solid color-mix(in srgb, var(--term-cyan) 40%, transparent); }
.term-output a:hover { border-bottom-color: var(--term-cyan); }
.term-output a:focus-visible { outline: 2px solid var(--term-cyan); outline-offset: 2px; }

/* prompt + input */
.prompt { white-space: nowrap; }
.p-user { color: var(--term-green); }
.p-path { color: var(--term-cyan); }
.p-sign { color: var(--term-violet); }
.input-line {
  position: relative; margin-top: 2px; padding-bottom: 6px;
  overflow-wrap: anywhere; line-height: 1.6;
}
.typed-wrap { display: inline; }
.typed-before, .typed-after { white-space: pre-wrap; }
.caret {
  display: inline-block; width: 8px; height: 1.02em; transform: translateY(2px);
  background: var(--term-green); border-radius: 1px; vertical-align: baseline;
  margin: 0 1px 0 0;
}
#input-line.focused .caret { animation: blink 1.05s steps(1) infinite; }
#input-line:not(.focused) .caret { opacity: .35; }
@keyframes blink { 50% { opacity: 0; } }
.real-input {
  position: absolute; inset: 0; width: 100%; height: 100%;
  opacity: 0; border: 0; background: none; margin: 0; padding: 0;
  font: inherit; color: transparent; caret-color: transparent;
}

/* command chips */
.cmd-chips {
  flex: 0 0 auto; display: flex; gap: 7px; overflow-x: auto; overscroll-behavior-x: contain;
  padding: 9px 12px calc(9px + env(safe-area-inset-bottom, 0));
  background: var(--titlebar-bg); border-top: 0.5px solid var(--win-border);
  scrollbar-width: none;
}
.cmd-chips::-webkit-scrollbar { display: none; }
.chip {
  flex: 0 0 auto; cursor: pointer; white-space: nowrap;
  font-family: var(--mono-font); font-size: 12.5px;
  padding: 6px 11px; border-radius: 999px;
  background: var(--chip-bg); border: 0.5px solid var(--chip-border); color: var(--text);
  transition: transform .12s var(--ease), background .15s var(--ease);
}
.chip:hover { background: var(--chip-hover); }
.chip:active { transform: scale(.94); }

/* ------------------------- Project cards (terminal) ---------------------- */
.proj-card {
  margin: 8px 0 4px; padding: 13px 15px; border-radius: 11px;
  background: var(--card-bg); border: 0.5px solid var(--card-border);
  position: relative; overflow: hidden;
}
.proj-card.is-highlight { border-color: color-mix(in srgb, var(--term-yellow) 55%, transparent); }
.proj-card.is-highlight::before {
  content: "★ FEATURED"; position: absolute; top: 10px; right: 12px;
  font-size: 10.5px; letter-spacing: .8px; color: var(--term-yellow); font-weight: 700;
}
.proj-card h3 { margin: 0 0 2px; font-size: 14.5px; font-family: var(--ui-font); }
.proj-card .pc-handle { color: var(--term-violet); font-size: 12.5px; }
.proj-card .pc-metric {
  display: inline-block; margin: 6px 0; font-size: 12px; color: var(--term-green);
  background: color-mix(in srgb, var(--term-green) 14%, transparent); padding: 2px 8px; border-radius: 999px;
}
.proj-card p { margin: 4px 0; font-family: var(--ui-font); color: var(--text-soft); font-size: 13px; line-height: 1.5; }
.proj-card ul { margin: 6px 0; padding-left: 18px; color: var(--text-soft); font-size: 12.5px; font-family: var(--ui-font); }
.proj-card .pc-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.pc-tag { font-size: 11px; padding: 2px 8px; border-radius: 6px; background: var(--chip-bg); border: 0.5px solid var(--chip-border); color: var(--text-soft); font-family: var(--mono-font); }
.proj-card .pc-links { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.pc-link {
  font-family: var(--ui-font); font-size: 12.5px; font-weight: 600; text-decoration: none;
  padding: 6px 12px; border-radius: 8px; border: 0 !important;
  background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: #fff !important;
  display: inline-flex; align-items: center; gap: 6px;
}
.pc-link.secondary { background: var(--chip-bg); color: var(--text) !important; border: 0.5px solid var(--chip-border) !important; }
.pc-link:hover { filter: brightness(1.06); }

/* ------------------------ Projects window (grid) ------------------------- */
.projects-body { flex: 1; min-height: 0; overflow-y: auto; padding: 16px; background: var(--term-bg); }
.projects-intro { font-size: 13px; color: var(--text-soft); margin: 0 0 14px; }
.proj-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 13px; }
.grid-card {
  background: var(--card-bg); border: 0.5px solid var(--card-border); border-radius: 12px;
  padding: 15px; display: flex; flex-direction: column; gap: 6px;
  transition: transform .18s var(--ease), border-color .18s var(--ease);
}
.grid-card:hover { transform: translateY(-3px); border-color: color-mix(in srgb, var(--accent) 45%, transparent); }
.grid-card.is-highlight { border-color: color-mix(in srgb, var(--term-yellow) 50%, transparent); }
.grid-card h3 { margin: 0; font-size: 15px; }
.grid-card .gc-handle { color: var(--accent); font-size: 12.5px; font-family: var(--mono-font); }
.grid-card p { margin: 2px 0 0; font-size: 13px; color: var(--text-soft); line-height: 1.45; flex: 1; }
.grid-card .gc-metric { font-size: 11.5px; color: var(--term-green); font-weight: 600; }
.grid-card .pc-tags { margin-top: 4px; }
.grid-card .pc-links { margin-top: auto; padding-top: 6px; }

/* ------------------------------- Dock ------------------------------------ */
.dock {
  position: absolute; left: 50%; bottom: max(8px, env(safe-area-inset-bottom, 0));
  transform: translateX(-50%); z-index: 60;
  max-width: 96vw;
}
.dock-items {
  display: flex; align-items: flex-end; gap: 7px; margin: 0; padding: 7px 9px; list-style: none;
  background: var(--dock-bg);
  -webkit-backdrop-filter: blur(26px) saturate(180%);
  backdrop-filter: blur(26px) saturate(180%);
  border: 0.5px solid var(--dock-border); border-radius: 20px;
  box-shadow: 0 18px 44px -16px rgba(0,0,0,.5), inset 0 0.5px 0 rgba(255,255,255,.25);
}
.dock-item { position: relative; }
.dock-item > button {
  display: block; width: var(--dock-size); height: var(--dock-size);
  padding: 0; background: none; border: 0; cursor: pointer;
  transform-origin: bottom center;
  transition: transform .22s var(--spring), margin .22s var(--spring);
}
.dock-icon { display: block; width: 100%; height: 100%; filter: drop-shadow(0 6px 10px rgba(0,0,0,.32)); }
.dock-item > button:active { transform: scale(.9) !important; }
.dock-item.bounce > button { animation: dock-bounce .6s var(--ease-out); }
@keyframes dock-bounce { 0%,100% { transform: translateY(0);} 30% { transform: translateY(-22px);} 55% { transform: translateY(0);} 72% { transform: translateY(-8px);} }
.dock-sep { width: 0.5px; align-self: stretch; margin: 6px 4px; background: var(--win-border); }
.dock-dot {
  position: absolute; bottom: -4px; left: 50%; transform: translateX(-50%);
  width: 4px; height: 4px; border-radius: 50%; background: var(--text-soft); opacity: 0;
  transition: opacity .2s var(--ease);
}
.dock-item.running .dock-dot { opacity: .8; }
.dock-tooltip {
  position: absolute; bottom: calc(100% + 12px); left: 50%; transform: translateX(-50%) translateY(6px);
  background: var(--win-bg-solid); color: var(--text); font-size: 12px; font-weight: 500;
  padding: 4px 10px; border-radius: 7px; white-space: nowrap; pointer-events: none;
  opacity: 0; transition: opacity .15s var(--ease), transform .15s var(--ease);
  box-shadow: var(--win-shadow); border: 0.5px solid var(--win-border);
}
.dock-item:hover .dock-tooltip,
.dock-item > button:focus-visible ~ .dock-tooltip { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ----------------------- GitHub warp / launch overlay -------------------- */
#warp-overlay {
  position: absolute; inset: 0; z-index: 80; pointer-events: none; opacity: 0;
  background: radial-gradient(circle at center, rgba(124,92,255,.0) 0%, rgba(6,8,20,.0) 100%);
}
#warp-overlay.active { animation: warp-bg .9s var(--ease-out) forwards; }
@keyframes warp-bg {
  0% { opacity: 0; }
  30% { opacity: 1; background: radial-gradient(circle at center, rgba(124,92,255,.25), rgba(6,8,20,.85)); }
  100% { opacity: 1; background: radial-gradient(circle at center, rgba(124,92,255,.5), rgba(6,8,20,.97)); }
}
.warp-stars {
  position: absolute; inset: 0;
  background-image:
    radial-gradient(1.6px 1.6px at 20% 30%, #fff, transparent),
    radial-gradient(1.6px 1.6px at 75% 60%, #fff, transparent),
    radial-gradient(1.4px 1.4px at 50% 80%, #cdbcff, transparent),
    radial-gradient(1.4px 1.4px at 85% 20%, #fff, transparent),
    radial-gradient(1.2px 1.2px at 35% 70%, #b9f5e6, transparent),
    radial-gradient(1.8px 1.8px at 60% 15%, #fff, transparent);
  opacity: 0;
}
#warp-overlay.active .warp-stars { animation: warp-stars 0.9s var(--ease-out) forwards; }
@keyframes warp-stars { 0% { opacity: 0; transform: scale(.2);} 40%{opacity:1;} 100% { opacity: .9; transform: scale(3.2); } }
.warp-ring {
  position: absolute; left: 50%; top: 50%; width: 10px; height: 10px; border-radius: 50%;
  border: 2px solid #cbb8ff; transform: translate(-50%,-50%); opacity: 0;
}
#warp-overlay.active .warp-ring { animation: warp-ring .9s var(--ease-out) forwards; }
@keyframes warp-ring { 0% { opacity:.9; width:10px; height:10px;} 100% { opacity:0; width:140vmax; height:140vmax; border-width:1px;} }
.window.warping { animation: win-warp .85s var(--ease-out) forwards; z-index: 81; transform-origin: center center; }
@keyframes win-warp { 0%{transform:scale(1);} 55%{transform:scale(1.04); filter:brightness(1.1);} 100%{transform:scale(.2); opacity:0; filter:brightness(2);} }

/* --------------------------------- Toast --------------------------------- */
#toast {
  position: absolute; left: 50%; bottom: calc(var(--dock-size) + 40px); transform: translateX(-50%) translateY(10px);
  z-index: 90; background: var(--win-bg-solid); color: var(--text);
  border: 0.5px solid var(--win-border); box-shadow: var(--win-shadow);
  padding: 9px 16px; border-radius: 10px; font-size: 13px; max-width: 88vw;
  opacity: 0; pointer-events: none; transition: opacity .2s var(--ease), transform .2s var(--ease);
}
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ------------------------------ Matrix egg ------------------------------- */
#matrix-canvas { position: absolute; inset: 0; z-index: 70; pointer-events: none; }

/* ----------------------------- Responsive -------------------------------- */
@media (max-width: 720px) {
  :root { --dock-size: 46px; }
  .menubar { font-size: 12px; }
  .menu-item[data-menu="file"], .menu-item[data-menu="view"], .menu-item[data-menu="go"] { display: none; }
  .menu-clock { min-width: auto; }
  .battery { display: none; }

  #windows-layer { inset: 0; }
  .terminal-window {
    width: 100%; height: auto;
    left: 0; right: 0; top: calc(var(--menubar-h) + env(safe-area-inset-top, 0));
    transform: none; border-radius: 0;
    bottom: calc(var(--dock-size) + 26px + env(safe-area-inset-bottom, 0));
    height: auto;
  }
  .terminal-window .titlebar { border-radius: 0; }
  .projects-window {
    width: 100%; height: auto; left: 0; right: 0;
    top: calc(var(--menubar-h) + env(safe-area-inset-top, 0));
    bottom: calc(var(--dock-size) + 26px + env(safe-area-inset-bottom, 0));
    transform: none; border-radius: 0;
  }
  .titlebar { cursor: default; }
  .rz, #snap-preview { display: none !important; } /* no window resizing on phones */
  .dock-item > button { transition: transform .15s var(--spring); }
  .dock-tooltip { display: none; }
  .proj-grid { grid-template-columns: 1fr; }
}

@media (max-width: 720px) and (display-mode: browser) {
  /* keep terminal tall on phones */
  .terminal-window { bottom: calc(var(--dock-size) + 22px + env(safe-area-inset-bottom, 0)); }
}

/* Larger tap targets on touch */
@media (hover: none) {
  .light { width: 14px; height: 14px; }
}

/* --------------------------- Reduced 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;
  }
  .blob { animation: none; }
  #input-line.focused .caret { animation: none; opacity: 1; }
}
