/* Layout: one full-screen 3D stage, thin UI chrome pinned to the edges, BIOS overlay on top. Single light look by choice; the BIOS stays dark. */
:root {
  color-scheme: light;
  --bg: #dcd8d1;
  --ink: #1f2826;
  --muted: #5d6865;
  --accent: #0f766e;
  --warm: #b4532a;
  --panel: #fbfaf7;
  --line: #cfc9bf;
  --chip: #efebe4;
  --bios-bg: #050807;
  --bios-ink: #c9d6d2;
  --os-bg: #1d4744;
  --os-win: #ece9df;
  --os-ink: #172321;
  --os-bar: #0f2624;
  --pixel: "VT323", ui-monospace, "Courier New", monospace;
  --sans: "IBM Plex Sans", system-ui, -apple-system, sans-serif;
}
[hidden] { display: none !important; }
html, body { height: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font-family: var(--sans); overflow: hidden; }
#stage { position: fixed; inset: 0; }
#stage > * { position: absolute !important; inset: 0; pointer-events: none; }
#stage canvas { z-index: 1; }

/* ---------- BIOS ---------- */
#bios {
  position: fixed; inset: 0; z-index: 20; background: var(--bios-bg); color: var(--bios-ink);
  font-family: var(--pixel); font-size: clamp(18px, 2.4vw, 24px); line-height: 1.25;
  padding: max(24px, env(safe-area-inset-top, 0px)) 24px 24px; display: flex; flex-direction: column; gap: 4px;
  transition: opacity .6s ease;
}
#bios .hdr { color: var(--accent); }
#bios pre { margin: 0; font: inherit; white-space: pre-wrap; }
#bios .ok { color: var(--accent); }
#bios .err { color: #ef6f5e; }
#bios a { color: var(--accent); }
#boot {
  margin-top: 18px; align-self: flex-start; font: inherit; color: var(--bios-bg); background: var(--bios-ink);
  border: 0; padding: 4px 14px; cursor: pointer;
}
#boot:disabled { opacity: .35; cursor: default; }
#boot:not(:disabled) { animation: blink 1.1s steps(2) infinite; }
#boot:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
@keyframes blink { 50% { background: var(--accent); } }
#bios.gone { opacity: 0; pointer-events: none; }
#bios .plain { margin-top: 22px; align-self: flex-start; color: var(--bios-ink); opacity: .7; font-size: .8em; }
#bios .plain:hover, #bios .plain:focus-visible { opacity: 1; color: var(--accent); }
/* visible intro for visitors and search engines, pinned to the bottom of the BIOS screen */
#bios { overflow-y: auto; }
#bios .sysinfo { margin-top: auto; padding-top: 24px; max-width: 64ch; font-size: .82em; line-height: 1.3; color: var(--bios-ink); opacity: .75; }
#bios .sysinfo p { margin: 0 0 6px; }
#bios .sysinfo strong { font-weight: 400; color: var(--accent); }
#bios .sysinfo a { color: inherit; }
#bios .sysinfo a:hover, #bios .sysinfo a:focus-visible { color: var(--accent); }
.noscript { position: fixed; inset: auto 16px 16px; z-index: 30; margin: 0; padding: 12px 14px; background: var(--panel); color: var(--ink); border: 1px solid var(--accent); font: 15px var(--sans); }

/* ---------- Chrome ---------- */
.ui { position: fixed; z-index: 5; }
#brand { top: calc(16px + env(safe-area-inset-top, 0px)); left: 16px; }
#brand h1 { margin: 0; font-family: var(--pixel); font-weight: 400; font-size: 34px; line-height: 1; letter-spacing: .02em; }
body.zoomed #brand, body.zoomed #credit { display: none; }
#brand p { margin: 4px 0 0; color: var(--muted); font-size: 13px; }
#topright { top: calc(16px + env(safe-area-inset-top, 0px)); right: 16px; display: flex; gap: 8px; }
#topright button {
  font: 600 14px var(--sans); background: var(--panel); color: var(--ink);
  border: 1px solid var(--line); border-radius: 6px; padding: 9px 14px; cursor: pointer;
}
#soundBtn[aria-pressed="false"] { color: var(--muted); }
#soundBtn::before { content: ""; display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--accent); margin-right: 8px; vertical-align: 1px; }
#soundBtn[aria-pressed="false"]::before { background: var(--line); }
#explore {
  left: 16px; right: 16px; bottom: calc(16px + env(safe-area-inset-bottom, 0px));
  display: flex; flex-wrap: wrap; align-items: center; gap: 6px;
}
#explore span { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .08em; margin-right: 4px; }
#explore button {
  font: 600 13px var(--sans); color: var(--ink); background: color-mix(in srgb, var(--panel) 85%, transparent);
  border: 1px solid var(--line); border-radius: 999px; padding: 7px 12px; cursor: pointer;
}
#explore button:hover, #explore button[aria-pressed="true"] { border-color: var(--accent); color: var(--accent); }
button:focus-visible, a:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
#credit { right: 16px; bottom: calc(18px + env(safe-area-inset-bottom, 0px)); color: var(--muted); font-size: 11px; }
#tip {
  position: fixed; z-index: 6; pointer-events: none; background: var(--panel); border: 1px solid var(--accent);
  color: var(--ink); font: 600 13px var(--sans); padding: 5px 9px; border-radius: 4px; transform: translate(14px, 14px);
}
#tip small { display: block; color: var(--muted); font-weight: 400; }

#card {
  right: 16px; top: 72px; width: min(360px, calc(100% - 32px)); background: var(--panel);
  border: 1px solid var(--line); border-radius: 8px; padding: 20px; box-shadow: 0 18px 40px rgba(60,50,35,.18);
}
#card .tag { font-family: var(--pixel); color: var(--warm); font-size: 18px; }
#card h2 { margin: 6px 0 0; font-family: var(--pixel); font-weight: 400; font-size: 34px; line-height: 1; }
#card p { margin: 12px 0 0; color: var(--muted); font-size: 14px; line-height: 1.55; }
#card ul { display: flex; flex-wrap: wrap; gap: 6px; list-style: none; padding: 0; margin: 14px 0 0; }
#card li { font-family: var(--pixel); font-size: 17px; background: var(--chip); border: 1px solid var(--line); padding: 1px 7px; }
#card .card-links { display: flex; flex-wrap: wrap; gap: 6px 18px; margin-top: 16px; }
#card .card-links a, #cMore { color: var(--accent); font-weight: 600; font-size: 14px; }
#cMore { font-family: var(--sans); background: none; border: 0; padding: 0; text-decoration: underline; cursor: pointer; }
#card .card-links:not(:has(:not([hidden]))) { display: none; }
/* preview of the project's first image or video; opens its window in AlexOS */
#cThumb { display: block; width: 100%; padding: 0; cursor: pointer; margin-top: 14px; border: 1px solid var(--line); border-radius: 6px; overflow: hidden; background: #111; }
#cThumb img { display: block; width: 100%; aspect-ratio: 16 / 9; object-fit: cover; object-position: top; }
#cThumb:hover { border-color: var(--accent); }
#cardClose { position: absolute; top: 10px; right: 10px; background: none; border: 0; color: var(--muted); font-size: 22px; cursor: pointer; }

.short { display: none; }
#hint {
  left: 50%; top: calc(18px + env(safe-area-inset-top, 0px)); transform: translateX(-50%);
  background: var(--panel); border: 1px solid var(--accent); color: var(--ink); border-radius: 999px;
  padding: 8px 14px; font: 600 13px var(--sans); white-space: nowrap; transition: opacity .6s ease;
}
#hint i { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); margin-right: 8px; box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 25%, transparent); }
#hint.fade { opacity: 0; }
@media (max-width: 700px) { #hint { top: auto; bottom: calc(66px + env(safe-area-inset-bottom, 0px)); } }

/* AlexOS as a full-screen panel on phones, where the 3D monitor is too small to read */
#mos {
  left: 12px; right: 12px; top: calc(64px + env(safe-area-inset-top, 0px)); bottom: calc(66px + env(safe-area-inset-bottom, 0px));
  background: var(--os-bg); color: #eaf6f3; font-family: var(--pixel); display: flex; flex-direction: column;
  background-image: radial-gradient(rgba(255,255,255,.05) 1px, transparent 1px); background-size: 6px 6px;
  border: 2px solid var(--os-ink); box-shadow: 0 18px 40px rgba(60,50,35,.25);
}
#mos .mos-bar { display: flex; justify-content: space-between; align-items: center; background: var(--os-bar); color: #cfe7e2; padding: 4px 6px 4px 12px; font-size: 22px; }
#mos .mos-bar button { font: 22px var(--pixel); background: var(--os-win); color: var(--os-ink); border: 0; width: 36px; height: 32px; cursor: pointer; }
#mos .mos-tabs { display: flex; gap: 6px; padding: 10px; overflow-x: auto; flex: none; }
#mos .mos-tabs button { font: 20px var(--pixel); background: rgba(255,255,255,.1); color: #eaf6f3; border: 1px solid rgba(255,255,255,.25); padding: 4px 10px; cursor: pointer; white-space: nowrap; }
#mos .mos-tabs button[aria-pressed="true"] { background: var(--os-win); color: var(--os-ink); }
#mos .os-body { flex: 1; min-height: 0; margin: 0 10px 10px; background: var(--os-win); color: var(--os-ink); font-size: 21px; padding: 14px 16px; overflow-y: auto; }
#mos .os-body h3 { font-size: 26px; }

@media (max-width: 700px) {
  #card {
    top: auto; bottom: calc(62px + env(safe-area-inset-bottom, 0px)); left: 12px; right: 12px; width: auto;
    max-height: 46vh; overflow-y: auto; padding: 16px;
  }
  #card h2 { font-size: 28px; }
  /* keep "Read more" in view: links above a shorter preview */
  #card:not([hidden]) { display: flex; flex-direction: column; }
  #cThumb, #cTech { order: 1; }
  #cThumb img { aspect-ratio: 5 / 2; }
  #credit { display: none; }
  #brand { left: 12px; }
  #brand h1 { font-size: 26px; }
  #brand p { font-size: 12px; max-width: 170px; }
  #topright { right: 12px; gap: 6px; }
  #topright button { padding: 8px 11px; font-size: 13px; }
  #soundBtn::before { margin-right: 6px; }
  .long { display: none; }
  .short { display: inline; }
  #explore { left: 0; right: 0; padding: 0 12px; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
  #explore::-webkit-scrollbar { display: none; }
  #explore span { display: none; }
  #explore button { flex: none; }
}

/* ---------- AlexOS (lives on the 3D monitor, 960 x 600 px) ---------- */
.os {
  width: 960px; height: 600px; background: var(--os-bg); color: var(--os-ink); font-family: var(--pixel);
  position: relative; overflow: hidden; pointer-events: none;
  background-image: radial-gradient(rgba(255,255,255,.05) 1px, transparent 1px); background-size: 6px 6px;
}
.os.live { pointer-events: auto; }
.os-bar {
  height: 40px; background: var(--os-bar); color: #cfe7e2; display: flex; align-items: center; justify-content: space-between;
  padding: 0 16px; font-size: 26px;
}
.os-icons { position: absolute; top: 64px; left: 28px; display: grid; gap: 22px; }
.os-icon {
  width: 108px; background: none; border: 0; color: #eaf6f3; font: 24px var(--pixel); cursor: pointer;
  display: grid; justify-items: center; gap: 6px; padding: 6px; border-radius: 4px;
}
.os-icon:hover, .os-icon:focus-visible { background: rgba(255,255,255,.12); outline: none; }
.os-glyph {
  width: 56px; height: 56px; background: var(--os-win); color: var(--os-ink); display: grid; place-items: center;
  font-size: 34px; box-shadow: 4px 4px 0 rgba(0,0,0,.35);
}
.os-hello { position: absolute; right: 36px; bottom: 30px; color: rgba(234,246,243,.75); font-size: 26px; text-align: right; }
.os-win {
  position: absolute; left: 190px; top: 70px; width: 720px; height: 490px; background: var(--os-win);
  box-shadow: 8px 8px 0 rgba(0,0,0,.35); display: flex; flex-direction: column; border: 2px solid var(--os-ink);
}
.os-title {
  background: var(--os-ink); color: var(--os-win); display: flex; justify-content: space-between; align-items: center;
  padding: 4px 6px 4px 14px; font-size: 26px;
}
.os-title button { font: 24px var(--pixel); background: var(--os-win); color: var(--os-ink); border: 0; width: 34px; height: 30px; cursor: pointer; }
.os-body { padding: 18px 24px; overflow-y: auto; font-size: 25px; line-height: 1.2; }
.os-body h3 { margin: 0 0 4px; font-weight: 400; font-size: 32px; }
.os-body p { margin: 0 0 16px; }
.os-body .meta { color: #6b4a2f; }
.os-body a { color: #0f5d56; }
.os-body .item { padding-bottom: 14px; margin-bottom: 14px; border-bottom: 2px dashed rgba(23,35,33,.25); }
.os-body .item:last-child { border-bottom: 0; }
.os-body button.copy { font: 22px var(--pixel); background: var(--os-ink); color: var(--os-win); border: 0; padding: 2px 10px; cursor: pointer; margin-left: 8px; }
.os-title .os-wt { flex: 1; }
.os-title .os-back { margin-right: 10px; }
.os-body button.more { font: inherit; background: none; border: 0; padding: 0; color: #0f5d56; text-decoration: underline; cursor: pointer; }

/* project windows ("Read more"): maximized over the icons */
.os-win.max { left: 14px; top: 52px; width: 932px; height: 534px; }
.os-body .page h3 { font-size: 40px; }
.os-body .page h4 { margin: 22px 0 8px; font-weight: 400; font-size: 30px; }
.os-body .page ul { margin: 0 0 8px; padding-left: 26px; }
.os-body .page figure { margin: 4px 0 14px; }
.os-body .page video, .os-body .page img { display: block; width: 100%; height: auto; background: #111; border: 2px solid var(--os-ink); }
.os-body .page figcaption { margin-top: 4px; font-size: 21px; color: #6b4a2f; }
.os-body .flow { list-style: none; margin: 0; padding: 0; display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 24px; }
.os-body .flow li { position: relative; border: 2px solid var(--os-ink); background: rgba(255,255,255,.45); padding: 6px 8px; font-size: 21px; line-height: 1.05; }
.os-body .flow li + li::before { content: "→"; position: absolute; left: -21px; top: 50%; transform: translateY(-50%); color: #0f5d56; }
.os-body .flow .n { display: block; color: #0f5d56; font-size: 26px; }
.os-body .chips { display: flex; flex-wrap: wrap; gap: 8px; list-style: none; padding: 0 !important; }
.os-body .chips li { background: var(--os-ink); color: var(--os-win); padding: 0 8px; }
.os-body .page .links { margin-top: 18px; }
#mos .os-body button.back { display: block; margin-bottom: 12px; }
#mos .os-body .page h3 { font-size: 32px; }
#mos .os-body .page h4 { font-size: 26px; }
#mos .os-body .flow { grid-auto-flow: row; gap: 18px; }
#mos .os-body .flow li { display: flex; gap: 8px; align-items: baseline; }
#mos .os-body .flow li + li::before { content: "↓"; left: 14px; top: -19px; transform: none; }

@media (prefers-reduced-motion: reduce) { #boot:not(:disabled) { animation: none; } #bios { transition: none; } }
