/* ============================================================
   declan.land — HACKER DESKTOP (GeekTyper-style fake OS)
   Only visible in hacker mode. Wallpaper, menubar, draggable
   windows, left dock (HackerTyper ⇆ Console), taskbar.
   ============================================================ */

#desktop { position: fixed; inset: 0; z-index: 5; display: flex; flex-direction: column; overflow: hidden; }
[data-mode="pro"] #desktop { display: none; }
[data-mode="hacker"] #prosite { display: none; }

/* ---------- wallpaper ---------- */
.desk-wall { position: absolute; inset: 0; z-index: 0; overflow: hidden; background: var(--bg); }
.desk-wall .grid {
  position: absolute; inset: -2px;
  background-image: radial-gradient(currentColor 1px, transparent 1.4px);
  color: color-mix(in oklch, var(--accent) 18%, transparent);
  background-size: 34px 34px;
  mask-image: radial-gradient(ellipse 90% 90% at 50% 40%, #000 25%, transparent 80%);
  -webkit-mask-image: radial-gradient(ellipse 90% 90% at 50% 40%, #000 25%, transparent 80%);
  opacity: 0.5;
}
.desk-wall .wglow { position: absolute; border-radius: 50%; filter: blur(100px); opacity: 0.3; }
.desk-wall .wglow.a { width: 620px; height: 620px; left: -8%; top: -16%; background: radial-gradient(circle, var(--accent), transparent 65%); }
.desk-wall .wglow.b { width: 520px; height: 520px; right: -10%; bottom: -16%; background: radial-gradient(circle, var(--accent-2), transparent 65%); }
.desk-wall .bigmark {
  position: absolute; right: 4%; bottom: 12%;
  font-family: var(--mono); font-weight: 700;
  font-size: clamp(3rem, 11vw, 10rem); letter-spacing: -0.04em;
  color: color-mix(in oklch, var(--text) 6%, transparent);
  user-select: none; pointer-events: none; line-height: 0.9; text-align: right;
}

/* ---------- menubar ---------- */
.menubar {
  position: relative; z-index: 20;
  display: flex; align-items: center; gap: 16px;
  height: 40px; padding: 0 14px;
  background: color-mix(in oklch, var(--bg) 70%, transparent);
  backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--line-soft);
  font-family: var(--mono); font-size: 12.5px; color: var(--text-dim);
  flex-shrink: 0;
}
.menubar .mb-brand { display: inline-flex; align-items: center; gap: 0.55em; color: var(--text); font-weight: 600; white-space: nowrap; flex-shrink: 0; }
.menubar .mb-brand .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 10px var(--accent); }
.menubar .mb-status { color: var(--text-faint); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.menubar .mb-status .live { color: var(--accent); }
.menubar .mb-spacer { flex: 1; }
.menubar .mb-clock { color: var(--text-dim); letter-spacing: 0.05em; white-space: nowrap; }
.menubar .mb-swatches { display: inline-flex; gap: 6px; flex-shrink: 0; }
.swatch { width: 15px; height: 15px; border-radius: 50%; border: 1px solid oklch(1 0 0 / 0.25); cursor: pointer; padding: 0; transition: transform 0.2s; }
.swatch:hover { transform: scale(1.18); }
.swatch.active { box-shadow: 0 0 0 2px var(--bg), 0 0 0 3px currentColor; }
.menubar .tb-win { white-space: nowrap; flex-shrink: 0; }
@media (max-width: 860px) { .menubar .mb-status { display: none; } }

/* ---------- desktop body (dock + icons) ---------- */
.desk-body { position: relative; z-index: 10; flex: 1; min-height: 0; display: flex; }

/* dock — blended directly onto the wallpaper, top-left (no window chrome) */
.dock {
  flex: 1; min-width: 0;
  margin: 14px 18px 10px 22px;
  display: flex; flex-direction: column;
  background: none; border: none; border-radius: 0; box-shadow: none;
  backdrop-filter: none; -webkit-backdrop-filter: none;
  overflow: hidden;
}
.dock-tabs { display: inline-flex; gap: 4px; flex-shrink: 0; align-self: flex-start; margin-bottom: 4px; }
.dock-tab {
  padding: 6px 12px; background: none; border: none; cursor: pointer;
  font-family: var(--mono); font-size: 12px; font-weight: 600; letter-spacing: 0.06em;
  color: var(--text-faint); text-transform: uppercase;
  border-radius: 7px; transition: color 0.25s, background 0.25s;
}
.dock-tab:hover { color: var(--text-dim); }
.dock-tab.active { color: var(--accent); background: color-mix(in oklch, var(--accent) 10%, transparent); }
.dock-body { flex: 1; min-height: 0; position: relative; max-width: clamp(420px, 52vw, 680px); }
.dock-view { position: absolute; inset: 0; display: none; flex-direction: column; }
.dock-view.active { display: flex; }

/* HackerTyper view */
.typer-head { padding: 7px 2px; font-family: var(--mono); font-size: 11px; color: var(--text-faint); flex-shrink: 0; }
.typer-out {
  flex: 1; margin: 0; padding: 6px 2px; overflow: hidden;
  font-family: var(--mono); font-size: 12.5px; line-height: 1.5;
  color: var(--accent); white-space: pre-wrap; word-break: break-word;
  text-shadow: 0 0 8px color-mix(in oklch, var(--accent) 40%, transparent);
}
.typer-out .tk { color: var(--text-dim); text-shadow: none; }
.typer-out:focus, .typer-out:focus-visible { outline: none; }
.typer-cursor { display: inline-block; width: 8px; height: 1.05em; background: var(--accent); transform: translateY(2px); animation: blink 1.1s steps(1) infinite; }
.typer-foot { padding: 7px 2px; font-family: var(--mono); font-size: 11px; color: var(--text-faint); display: flex; justify-content: space-between; flex-shrink: 0; opacity: 0.7; }

/* console view reuses .term-body / .term-input-row (hacker.css) */
.dock-view .term-body { flex: 1; padding-inline: 2px; }
.dock-view .term-input-row { padding-inline: 2px; border-top: 1px solid var(--line-soft); }

/* desktop icons — macOS-style: top-right, fill down, new columns leftward */
.desk-icons {
  position: absolute; top: 0; right: 0; bottom: 0;
  padding: 16px 16px 16px 0;
  display: grid;
  grid-auto-flow: column;
  grid-template-rows: repeat(auto-fill, 92px);
  grid-auto-columns: 96px;
  gap: 6px 4px;
  direction: rtl;            /* new columns cascade to the LEFT */
  justify-content: end; align-content: start;
  pointer-events: none;      /* let windows/desktop receive clicks in the gaps */
  z-index: 12;
}
.desk-icon {
  direction: ltr;            /* keep labels left-to-right */
  pointer-events: auto;
  width: 96px; padding: 12px 6px 10px; border-radius: 12px;
  display: flex; flex-direction: column; align-items: center; gap: 9px;
  cursor: pointer; border: 1px solid transparent; background: none;
  font-family: var(--mono); transition: background 0.2s, border-color 0.2s;
  -webkit-tap-highlight-color: transparent;
}
.desk-icon:hover, .desk-icon:focus-visible { background: color-mix(in oklch, var(--accent) 9%, transparent); border-color: var(--line); outline: none; }
.desk-icon .ic {
  width: 50px; height: 44px; border-radius: 9px; display: grid; place-items: center;
  color: var(--accent);
  background: color-mix(in oklch, var(--accent) 12%, transparent);
  border: 1px solid color-mix(in oklch, var(--accent) 30%, transparent);
  position: relative;
}
.desk-icon .ic.folder::before { content: ""; position: absolute; top: -4px; left: 8px; width: 20px; height: 6px; border-radius: 3px 3px 0 0; background: color-mix(in oklch, var(--accent) 30%, transparent); }
.desk-icon .lbl { font-size: 11.5px; color: var(--text-dim); text-align: center; line-height: 1.2; }
.desk-icon:hover .lbl { color: var(--text); }

/* ---------- windows ---------- */
#windows {
  position: absolute; inset: 0; z-index: 40;
  pointer-events: none;
}
.win {
  position: absolute; z-index: 30;
  pointer-events: auto;
  width: min(540px, 88vw); max-height: 80%;
  display: flex; flex-direction: column;
  background: color-mix(in oklch, var(--bg-1) 92%, transparent);
  backdrop-filter: blur(20px) saturate(1.3); -webkit-backdrop-filter: blur(20px) saturate(1.3);
  border: 1px solid var(--line); border-radius: 13px; overflow: hidden;
  box-shadow: 0 40px 100px -28px oklch(0 0 0 / 0.85);
  animation: win-in 0.26s var(--ease);
}
@keyframes win-in { from { transform: translateY(10px) scale(0.98); } to { transform: none; } }
.win.focused { border-color: color-mix(in oklch, var(--accent) 45%, transparent); }
.win-bar {
  display: flex; align-items: center; gap: 10px; padding: 9px 13px;
  border-bottom: 1px solid var(--line-soft); cursor: grab; user-select: none; touch-action: none;
  font-family: var(--mono); font-size: 12px; color: var(--text-faint); flex-shrink: 0;
}
.win-bar:active { cursor: grabbing; }
.win-dots { display: inline-flex; gap: 6px; }
.win-dots i { width: 11px; height: 11px; border-radius: 50%; display: block; }
.win-dots .r { background: oklch(0.68 0.2 25); cursor: pointer; }
.win-dots .y { background: oklch(0.82 0.16 78); }
.win-dots .g { background: var(--accent); }
.win-title { margin-inline: auto; letter-spacing: 0.04em; padding-right: 30px; }
.win-body { flex: 1; overflow-y: auto; padding: 22px; scrollbar-width: thin; }
.win-body::-webkit-scrollbar { width: 8px; }
.win-body::-webkit-scrollbar-thumb { background: var(--line); border-radius: 4px; }

/* window content helpers */
.win-body h3 { font-family: var(--mono); font-size: 1.25rem; letter-spacing: -0.02em; margin-bottom: 10px; color: var(--text); }
.win-body p { color: var(--text-dim); font-size: 14.5px; margin-bottom: 12px; line-height: 1.6; }
.win-body .wtag { font-family: var(--mono); font-size: 11px; color: var(--accent); letter-spacing: 0.14em; text-transform: uppercase; display: block; margin-bottom: 14px; }
.win-shot { width: 100%; border-radius: 12px; border: 1px solid var(--line); margin: 6px 0 16px; }
.win-btn {
  display: inline-flex; align-items: center; gap: 0.5em;
  font-family: var(--mono); font-size: 13px; font-weight: 600;
  padding: 0.7em 1.1em; border-radius: 10px;
  background: var(--accent); color: var(--bg); border: none; cursor: pointer;
  text-decoration: none; transition: filter 0.2s, transform 0.2s;
}
.win-btn:hover { filter: brightness(1.1); transform: translateY(-2px); }
.win-btn.ghost { background: none; border: 1px solid var(--line); color: var(--text); }
.win-btn.ghost:hover { border-color: var(--accent); color: var(--accent); }
.win-links { display: flex; flex-direction: column; gap: 9px; }
.win-links a { display: flex; align-items: center; gap: 0.7em; color: var(--text-dim); font-size: 14.5px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 9px; transition: border-color 0.2s, color 0.2s; }
.win-links a:hover { color: var(--text); border-color: var(--accent); }
.win-chips { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 6px; }
.win-chips span { font-family: var(--mono); font-size: 11.5px; color: var(--text-dim); border: 1px solid var(--line); border-radius: 8px; padding: 0.4em 0.7em; }

/* ---------- taskbar ---------- */
.taskbar {
  position: relative; z-index: 20;
  display: flex; align-items: center; gap: 8px;
  height: 44px; padding: 0 12px;
  background: color-mix(in oklch, var(--bg) 72%, transparent);
  backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
  border-top: 1px solid var(--line-soft);
  font-family: var(--mono); font-size: 12px; color: var(--text-faint);
  flex-shrink: 0; overflow-x: auto;
}
.taskbar .tb-hint { color: var(--text-faint); }
.taskbar .tb-hint b { color: var(--accent); font-weight: 600; }
.taskbar .tb-spacer { flex: 1; }
.tb-win { display: inline-flex; align-items: center; gap: 0.5em; padding: 0.45em 0.8em; border-radius: 8px; border: 1px solid var(--line); color: var(--text-dim); cursor: pointer; background: none; font-family: var(--mono); font-size: 12px; white-space: nowrap; transition: border-color 0.2s, color 0.2s; }
.tb-win:hover { color: var(--text); border-color: var(--accent); }
.tb-win .d { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); }

/* ---------- access-granted flash (hackertyper) ---------- */
.ht-flash {
  position: fixed; inset: 0; z-index: 9000; display: grid; place-items: center;
  background: oklch(0 0 0 / 0.6); pointer-events: none;
}
.ht-flash .box {
  font-family: var(--mono); font-weight: 700; font-size: clamp(1.5rem, 5vw, 3rem);
  letter-spacing: 0.1em; padding: 0.6em 1.2em; border: 2px solid var(--accent); border-radius: 10px;
  color: var(--accent); background: var(--bg); text-shadow: 0 0 24px var(--accent-soft);
}
.ht-flash.deny .box { color: oklch(0.72 0.2 22); border-color: oklch(0.72 0.2 22); text-shadow: 0 0 24px oklch(0.72 0.2 22 / 0.4); }

/* ---------- responsive ---------- */
@media (max-width: 820px) {
  .desk-body { flex-direction: column; }
  .desk-icons {
    position: static; padding: 12px 14px 0;
    grid-auto-flow: row; grid-template-rows: none;
    grid-template-columns: repeat(auto-fill, 84px); grid-auto-columns: auto;
    direction: ltr; justify-content: start;
  }
  .desk-icon { width: 84px; }
  .dock { margin: 8px 14px 4px; flex: 1; }
  .dock-body { max-width: none; }
  .win { width: min(94vw, 540px); max-height: 70%; }
}
