/* Sudohuman DE — visual layer. Palette from assets/design-tokens.css. */
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  background: var(--sh-bg);
  color: var(--sh-text);
  font-family: var(--sh-font-mono);
  overflow: hidden;
}
[hidden] { display: none !important; }
button { font: inherit; color: inherit; cursor: pointer; }

/* ── Boot console ──────────────────────────────────────────────────────── */
.boot {
  position: fixed; inset: 0; background: #030a0d; color: var(--sh-text);
  padding: clamp(14px, 4vw, 48px); font-size: clamp(11px, 1.6vw, 13px);
  line-height: 1.6; overflow: hidden; z-index: 100;
}
.boot-inner { white-space: pre-wrap; }
.boot .ps1 { color: var(--sh-green); font-weight: 700; }
.boot .ps1b { color: var(--sh-cyan); }
.boot-line { min-height: 1.6em; }
#boot-out .line { min-height: 1.6em; white-space: pre; }
.boot-skip {
  position: fixed; bottom: 16px; right: 18px; background: none; border: none;
  color: var(--sh-border-dim); font-size: 11px; letter-spacing: .5px;
}
.boot-skip kbd {
  border: 1px solid var(--sh-border-dim); border-radius: 3px; padding: 0 5px;
  color: var(--sh-muted);
}
.cursor {
  display: inline-block; width: .55em; height: 1em; background: var(--sh-green);
  vertical-align: text-bottom; animation: blink 1s step-end infinite;
}
@keyframes blink { 0%, 100% { opacity: 1 } 50% { opacity: 0 } }

/* ── Desktop environment ───────────────────────────────────────────────── */
.de { position: fixed; inset: 0; display: flex; flex-direction: column; z-index: 10; }
.panel {
  height: 30px; flex: none; display: flex; align-items: center; justify-content: space-between;
  padding: 0 12px; background: linear-gradient(var(--sh-panel-2), var(--sh-panel));
  border-bottom: 1px solid var(--sh-border-dim); font-size: 12px;
}
.panel-left { display: flex; align-items: baseline; gap: 8px; }
.panel-brand { color: var(--sh-cyan); font-weight: 700; letter-spacing: 1px; }
.panel-ver { color: var(--sh-muted); font-size: 11px; }
.panel-right { display: flex; align-items: center; gap: 14px; color: var(--sh-muted); }
.panel-glyph { font-size: 11px; opacity: .8; }
.panel-clock { color: var(--sh-text); font-variant-numeric: tabular-nums; }

.desk {
  position: relative; flex: 1; overflow: hidden;
  background:
    radial-gradient(120% 90% at 50% 0%, rgba(67,212,232,.05), transparent 55%),
    var(--sh-bg);
}
.desk::before { /* wallpaper */
  content: ""; position: absolute; inset: 0; z-index: 0;
  background: url("assets/wallpaper/sudohuman-wallpaper-2560x1440.png") center/cover no-repeat;
  opacity: .9;
}
.icons {
  position: relative; z-index: 1; list-style: none;
  display: flex; flex-direction: column; flex-wrap: wrap; align-content: flex-start;
  gap: 4px; padding: 16px 12px; max-height: 100%;
}
.icon-btn {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  width: 92px; padding: 10px 6px 8px; border: 1px solid transparent; border-radius: 8px;
  background: none; text-align: center; color: var(--sh-text);
}
.icon-btn img { width: 46px; height: 46px; pointer-events: none; filter: drop-shadow(0 1px 2px rgba(0,0,0,.5)); }
.icon-btn .label { font-size: 11px; line-height: 1.25; color: var(--sh-text); text-shadow: 0 1px 3px rgba(0,0,0,.9); }
.icon-btn:hover { background: rgba(127,200,255,.08); border-color: var(--sh-border-dim); }
.icon-btn.selected { background: rgba(67,212,232,.16); border-color: var(--sh-cyan); }
.icon-btn:focus-visible { outline: 2px solid var(--sh-cyan); outline-offset: 1px; }

/* ── Windows (explorer + viewer) ───────────────────────────────────────── */
.windows { position: fixed; inset: 30px 0 0 0; z-index: 20; pointer-events: none; }
.win {
  position: absolute; pointer-events: auto; display: flex; flex-direction: column;
  background: var(--sh-panel); border: 1px solid var(--sh-border);
  border-radius: 6px; box-shadow: 0 18px 50px rgba(0,0,0,.6);
  width: min(760px, calc(100vw - 24px)); max-height: 80vh; overflow: hidden;
}
.win.viewer { width: min(820px, calc(100vw - 24px)); }
.win.explorer { width: min(490px, calc(100vw - 24px)); } /* four 104px icons per row */
.win-title {
  flex: none; display: flex; align-items: center; gap: 8px; padding: 6px 8px 6px 10px;
  background: linear-gradient(var(--sh-panel-2), var(--sh-panel));
  border-bottom: 1px solid var(--sh-border-dim); cursor: grab; user-select: none;
}
.win-title.grabbing { cursor: grabbing; }
.win-title img { width: 18px; height: 18px; }
.win-title .t { flex: 1; font-size: 12px; font-weight: 700; color: var(--sh-text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.win-x {
  flex: none; width: 22px; height: 20px; display: grid; place-items: center;
  background: none; border: 1px solid transparent; border-radius: 4px; color: var(--sh-muted);
}
.win-x:hover { background: rgba(255,91,88,.16); border-color: var(--sh-red); color: var(--sh-red); }
.win-x img { width: 12px; height: 12px; }

/* KDE-ish explorer chrome */
.win-locbar {
  flex: none; padding: 4px 12px; font-size: 11px; color: var(--sh-blue);
  background: var(--sh-bg); border-bottom: 1px solid var(--sh-border-dim);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.win-body { flex: 1; overflow-y: auto; padding: 16px; }

.explorer-grid { display: flex; flex-wrap: wrap; gap: 6px; align-content: flex-start; }
.exp-item {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  width: 104px; padding: 12px 6px; border: 1px solid transparent; border-radius: 8px;
  background: none; color: var(--sh-text); text-align: center;
}
.exp-item img { width: 44px; height: 44px; pointer-events: none; }
.exp-item .label { font-size: 11px; line-height: 1.25; }
.exp-item:hover { background: rgba(127,200,255,.08); border-color: var(--sh-border-dim); }
.exp-item.selected { background: rgba(67,212,232,.16); border-color: var(--sh-cyan); }
.exp-item:focus-visible { outline: 2px solid var(--sh-cyan); outline-offset: 1px; }
/* discarded junk in the Trash: greyed out and inert */
.exp-item.trashed { cursor: default; opacity: .5; }
.exp-item.trashed img { filter: grayscale(1) brightness(.85); }
.exp-item.trashed .label { color: var(--sh-muted); word-break: break-word; }
.exp-item.trashed:hover { background: none; border-color: transparent; }

/* Markdown viewer — hierarchy lives here so content.md stays plain Markdown.
   Text width is capped near ~90 characters even when the window is wider. */
.md { color: var(--sh-text); font-size: 13px; line-height: 1.75; max-width: 92ch; }
.md h1 { font-size: 20px; font-weight: 700; letter-spacing: .3px; color: var(--sh-cyan); margin: 0 0 12px; }
.md h2 { font-size: 15px; color: var(--sh-green); margin: 22px 0 8px; border-bottom: 1px solid var(--sh-border-dim); padding-bottom: 4px; }
.md h3 { font-size: 13px; font-weight: 600; font-style: italic; color: var(--sh-amber); margin: 16px 0 6px; }
.md p { margin: 0 0 15px; }
.md ol { margin: 0 0 12px; padding-left: 22px; }
.md li { margin: 4px 0; }
/* top-level unordered lists render as checklists; nested lists keep normal bullets */
.md > ul { list-style: none; margin: 0 0 12px; padding-left: 2px; }
.md > ul > li { position: relative; padding-left: 26px; }
.md > ul > li::before { content: "\2713"; position: absolute; left: 2px; color: var(--sh-green); font-weight: 700; }
.md > ul ul { list-style: disc; margin: 4px 0; padding-left: 22px; }
.md > ul ul > li { position: static; padding-left: 0; }
.md > ul ul > li::before { content: none; }
.md a { color: var(--sh-blue); text-decoration: none; }
.md a:hover { text-decoration: underline; }
.md code { background: var(--sh-panel-2); padding: 1px 5px; border-radius: 3px; color: var(--sh-amber); font-size: 12px; }
.md pre { background: var(--sh-bg); border: 1px solid var(--sh-border-dim); border-radius: 5px; padding: 12px; overflow-x: auto; margin: 0 0 12px; }
.md pre code { background: none; padding: 0; color: var(--sh-text); }
/* short key statements: cyan prompt-style rule, brighter text, no quote marks */
.md blockquote { border-left: 2px solid var(--sh-cyan); padding: 2px 0 2px 12px; margin: 4px 0 15px; color: #eef6f4; background: transparent; }
.md blockquote p { margin: 0; }
/* subtle terminal-style divider, no text needed */
.md hr { border: none; height: 0; border-top: 1px dashed var(--sh-border-dim); margin: 20px 0; }
.md .stub { color: var(--sh-border-dim); font-style: italic; }

/* ── Terminal mode ─────────────────────────────────────────────────────── */
.term { position: fixed; inset: 0; z-index: 30; background: #000; display: grid; place-items: center; --term-green: #4fe6a0; }
.scene {
  position: relative; width: min(100vw, calc(100vh * 1672 / 941));
  aspect-ratio: 1672 / 941;
}
.scene-img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; }
.screen {
  position: absolute;
  left: 19.68%; top: 14.03%; width: 59.45%; height: 47.5%;
  background: #030a06; overflow: hidden; cursor: text;
  box-shadow: inset 0 0 40px rgba(0,0,0,.7);
}
.tbody {
  position: absolute; inset: 0; overflow-y: auto;
  padding: 3.5% 4%; color: #b7f7cf; font-family: var(--sh-font-mono);
  font-size: var(--term-fs, 12px); line-height: 1.55;
}
.tbody .line { min-height: 1.55em; white-space: pre; margin: 0; }
/* monochrome phosphor terminal: one green, overriding every inline colour */
.tbody, .tbody .line, .tbody .line * { color: var(--term-green) !important; }
.tbody .cursor { background: var(--term-green); }
.ps1g { color: var(--sh-green); }
.screen::after { /* faint scanlines + glow */
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background:
    repeating-linear-gradient(rgba(0,0,0,0) 0 2px, rgba(0,0,0,.18) 2px 3px),
    radial-gradient(120% 130% at 50% 40%, transparent 60%, rgba(0,0,0,.45));
}
.hotspot {
  position: absolute; left: 87.3%; top: 60.2%; width: 9.7%; height: 14.2%;
  background: none; border: 0; border-radius: 6px;
}
.hotspot:focus-visible { outline: 2px solid var(--sh-cyan); outline-offset: 2px; }
#hidden-input { position: absolute; opacity: 0; pointer-events: none; width: 1px; height: 1px; top: 0; left: 0; }

/* ── Fade transition ───────────────────────────────────────────────────── */
.fade {
  position: fixed; inset: 0; background: var(--sh-bg); z-index: 200;
  opacity: 0; pointer-events: none; transition: opacity .3s ease;
}
.fade.on { opacity: 1; }

/* scrollbars */
* { scrollbar-width: thin; scrollbar-color: var(--sh-border-dim) transparent; }
::-webkit-scrollbar { width: 7px; height: 7px; }
::-webkit-scrollbar-thumb { background: var(--sh-border-dim); border-radius: 3px; }
::-webkit-scrollbar-track { background: transparent; }

/* mobile */
@media (max-width: 620px) {
  .icons { flex-direction: row; flex-wrap: wrap; max-height: none; }
  .win { width: calc(100vw - 12px) !important; max-height: calc(100vh - 42px); top: 6px !important; left: 6px !important; }
}
@media (prefers-reduced-motion: reduce) {
  .cursor { animation: none; }
  .fade { transition: none; }
}
