/* ---------- base ---------- */
:root {
  --ink: #1a1420;
  --paper: #f2e8d8;
  --teal: #0f8383;
  --grey: #c6c6c6;
  --grey-dk: #808080;
  --grey-dkr: #404040;
  --navy: #000080;
  --navy-2: #1084d0;
  --phos: #62ff8f;
  --pixel: "Press Start 2P", "Courier New", monospace;
  --mono: "VT323", "Courier New", monospace;
  --menubar-h: clamp(44px, 7vh, 68px);
}

* { box-sizing: border-box; }
html { scroll-behavior: auto; }
body {
  margin: 0;
  background: var(--ink);
  color: var(--paper);
  font-family: var(--mono);
  overflow-x: hidden;
}

.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;
}
.skip {
  position: absolute; left: 8px; top: -60px; z-index: 50;
  background: var(--paper); color: var(--ink); padding: 8px 12px;
  font: 10px/1 var(--pixel); text-decoration: none;
}
.skip:focus { top: 8px; }

/* ---------- pinned stage ---------- */
.stage { height: 340vh; position: relative; }
.pin {
  position: sticky; top: 0;
  height: 100vh; height: 100dvh;
  overflow: hidden;
  background: var(--ink);
}
#scene {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  display: block;
  image-rendering: pixelated;
}

/* scroll hint */
.hint {
  position: absolute; left: 50%; bottom: 26px;
  transform: translateX(-50%);
  font: 10px/1 var(--pixel);
  letter-spacing: 1px;
  color: var(--paper);
  text-shadow: 2px 2px 0 var(--ink);
  white-space: nowrap;
  transition: opacity .35s ease;
  display: flex; gap: 10px; align-items: center;
  padding: 10px 14px;
  background: rgba(26, 20, 32, .72);
  box-shadow: 0 0 0 2px var(--ink);
}
.hint span { display: inline-block; animation: bob 1.1s ease-in-out infinite; }
.hint.is-hidden { opacity: 0; }
@keyframes bob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(5px); } }


/* ---------- the screen (HTML overlay) ---------- */
.crt {
  position: absolute; inset: 0;
  opacity: 0; visibility: hidden;
  transform-origin: 50% 50%;
  pointer-events: none;
  will-change: transform, opacity;
  background: var(--teal);
}
.crt.is-live { pointer-events: auto; }

.os {
  position: absolute; inset: 0;
  display: flex; flex-direction: column;
  color: #111;
}

/* menubar = the navbar */
.menubar {
  height: var(--menubar-h);
  flex: 0 0 auto;
  display: flex; align-items: center; gap: 0 22px;
  padding: 0 18px;
  background: var(--grey);
  border-bottom: 2px solid var(--grey-dk);
  box-shadow: inset 0 2px 0 #fff, 0 2px 0 rgba(0, 0, 0, .35);
  font: 11px/1 var(--pixel);
  text-transform: uppercase;
  user-select: none;
}
.logo { display: inline-flex; align-items: center; gap: 8px; color: var(--navy); }
.logo-gem { font-size: 12px; }
.menu {
  list-style: none; margin: 0; padding: 0;
  display: flex; gap: 2px;
}
.menu a {
  display: inline-block;
  padding: 9px 11px;
  color: #111; text-decoration: none;
  border: 2px solid transparent;
}
.menu a:hover, .menu a:focus-visible, .menu a.is-active {
  background: var(--navy); color: #fff; outline: none;
}
.menu a:active { border-color: var(--grey-dkr) #fff #fff var(--grey-dkr); }
.clock { margin-left: auto; color: #222; font-size: 10px; }

/* desktop area */
.desktop {
  flex: 1 1 auto;
  display: grid; place-items: center;
  padding: 4vh 4vw;
  background:
    radial-gradient(ellipse at 50% 40%, rgba(255, 255, 255, .06), transparent 60%),
    var(--teal);
}

/* Win95-style window with a DOS-style body */
.window {
  width: min(62vw, 760px);
  background: var(--grey);
  padding: 3px;
  border: 2px solid;
  border-color: #fff var(--grey-dkr) var(--grey-dkr) #fff;
  box-shadow: 0 0 0 1px #000, 10px 10px 0 rgba(0, 0, 0, .35);
}
.titlebar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 7px 8px;
  background: linear-gradient(90deg, var(--navy), var(--navy-2));
  color: #fff;
  font: 10px/1 var(--pixel);
}
.titlebar-buttons { display: inline-flex; gap: 3px; }
.titlebar-buttons b, .tb-x {
  width: 16px; height: 14px; padding: 0; margin: 0;
  display: inline-grid; place-items: center;
  background: var(--grey); color: #111;
  font: 9px/1 var(--pixel);
  border: 1px solid; border-color: #fff var(--grey-dkr) var(--grey-dkr) #fff;
}
.tb-x { cursor: pointer; width: 22px; height: 18px; font-size: 11px; }
.tb-x:hover { background: #e6e6e6; }
.tb-x:active { border-color: var(--grey-dkr) #fff #fff var(--grey-dkr); }
.tb-x:focus-visible { outline: 2px dotted #111; outline-offset: -3px; }
.win-body {
  margin-top: 3px;
  min-height: min(38vh, 280px);
  padding: 18px 22px 22px;
  background: #060806;
  color: var(--phos);
  font: 26px/1.25 var(--mono);
  text-shadow: 0 0 6px rgba(98, 255, 143, .55);
  border: 2px solid; border-color: var(--grey-dkr) #fff #fff var(--grey-dkr);
}
.line { margin: 0 0 .35em; }
.line.big { font-size: 1.35em; margin-bottom: .45em; }
.line.big strong { color: #fff; font-weight: 400; text-shadow: 0 0 10px rgba(255, 255, 255, .5); }
.line.dim { color: #3fae61; }

/* program list inside the terminal */
.prog-menu { margin-top: .9em; }
.progs { list-style: none; margin: .25em 0 .6em; padding: 0; }
.prog {
  display: flex; align-items: baseline; gap: .7em;
  width: 100%;
  margin: 0; padding: 1px 10px;
  background: none; border: 0;
  color: var(--phos);
  font: inherit; text-shadow: inherit; text-align: left;
  cursor: pointer;
}
.prog .key { color: #3fae61; }
.prog .name { min-width: 7.5em; }
.prog .desc { color: #3fae61; }
.prog:hover, .prog:focus-visible, .prog.is-active {
  background: var(--phos); color: #060806; text-shadow: none; outline: none;
}
.prog:hover .key, .prog:hover .desc, .prog:focus-visible .key, .prog:focus-visible .desc, .prog.is-active .key, .prog.is-active .desc { color: #0d3a1d; }
.prog::before { content: "  "; white-space: pre; }
.prog:hover::before, .prog:focus-visible::before, .prog.is-active::before { content: "> "; }

/* the prompt you can type at */
.term-log .line { color: #9fe8b4; }
.term-line { display: flex; align-items: baseline; flex-wrap: wrap; margin-bottom: 0; }
.term-line label { cursor: text; }
.term-wrap { position: relative; display: inline-flex; align-items: baseline; flex: 1 1 auto; min-width: 0; }
.term-input {
  width: 6px; min-width: 6px; max-width: 100%;
  margin: 0; padding: 0;
  background: none; border: 0; outline: none;
  color: var(--phos);
  font: inherit; text-shadow: inherit;
  caret-color: transparent;
}
.measure { position: absolute; left: 0; top: 0; visibility: hidden; white-space: pre; font: inherit; }

/* radio switch (the boombox itself is clickable on wide screens; phones get this pill) */
.radio-btn {
  position: absolute; left: 14px; top: 14px; z-index: 4;
  padding: 9px 12px;
  font: 9px/1 var(--pixel); letter-spacing: 1px;
  color: var(--paper); background: rgba(26, 20, 32, .72);
  border: 0; box-shadow: 0 0 0 2px var(--ink);
  cursor: pointer;
  transition: opacity .35s ease;
  opacity: 0; pointer-events: none;
}
.radio-btn:focus-visible { opacity: 1; pointer-events: auto; outline: 2px solid var(--paper); outline-offset: 2px; }
.radio-btn[aria-pressed="true"] { color: #f7c948; }
@media (max-aspect-ratio: 6/5) { .radio-btn { opacity: 1; pointer-events: auto; } }
.radio-btn.is-hidden { opacity: 0 !important; pointer-events: none !important; }

/* the sticky note on the monitor */
.sr-focus {
  position: absolute; left: 8px; top: -60px; z-index: 6;
  background: var(--paper); color: var(--ink); padding: 8px 12px;
  font: 10px/1 var(--pixel); border: 0;
}
.sr-focus:focus { top: 48px; }
.note-pop { position: absolute; inset: 0; z-index: 5; background: rgba(26, 20, 32, .35); }
.note-paper {
  position: absolute; left: 50%; top: 50%;
  width: 270px; padding: 30px 24px 30px;
  background: #f7e26b; color: #3a2f10;
  font: 30px/1.12 var(--mono);
  transform: translate(-50%, -50%) rotate(-3deg);
  box-shadow: 5px 7px 0 rgba(0, 0, 0, .35);
  transform-origin: 50% 0;
  animation: note-in .18s ease-out;
  outline: none;
}
.note-paper p { margin: 0; }
.note-paper::after {            /* curled corner */
  content: ""; position: absolute; right: 0; bottom: 0;
  border-style: solid; border-width: 0 0 26px 26px;
  border-color: transparent transparent #f7e26b transparent;
  box-shadow: -3px -3px 0 rgba(0, 0, 0, .12);
  background: #c9b13a;
}
.note-tape {
  position: absolute; left: 50%; top: -12px; width: 90px; height: 24px;
  transform: translateX(-50%) rotate(2deg);
  background: rgba(255, 255, 255, .55);
  box-shadow: 0 0 0 1px rgba(0, 0, 0, .08);
}
.note-close {
  position: absolute; right: 6px; top: 4px;
  background: none; border: 0; color: #7a6a25;
  font: 26px/1 var(--mono); cursor: pointer;
}
.note-close:hover { color: #3a2f10; }
.note-heart { color: #d2455f; }
@keyframes note-in { from { transform: translate(-50%, -50%) rotate(-3deg) scale(.6); opacity: 0; } }

/* ABOUT.EXE (document window) */
.doc-window { width: min(72vw, 780px); }
.doc-body {
  margin-top: 3px; padding: 18px 24px 20px;
  max-height: min(64vh, 600px); overflow-y: auto;
  background: #060806; color: var(--phos);
  font: 22px/1.3 var(--mono);
  text-shadow: 0 0 6px rgba(98, 255, 143, .45);
  border: 2px solid; border-color: var(--grey-dkr) #fff #fff var(--grey-dkr);
  outline: none;
  scrollbar-color: #e0e0e0 #c6c6c6;
}
.doc-body::-webkit-scrollbar { width: 14px; }
.doc-body::-webkit-scrollbar-track { background: #c6c6c6; }
.doc-body::-webkit-scrollbar-thumb { background: #e0e0e0; border: 2px solid; border-color: #fff #7a7a7a #7a7a7a #fff; }
.doc-body p { margin: 0 0 .55em; }
.doc-body strong { color: #fff; font-weight: 400; }
.doc-body .dim { color: #3fae61; }
.doc-h { margin: .4em 0 .1em; font: 15px/1.6 var(--pixel); color: #fff; text-transform: uppercase; }
.doc-sub { color: #9fe8b4; margin-bottom: .9em; }
.doc-sec { margin: 1.1em 0 .3em; font: 10px/2 var(--pixel); color: #f7c948; }
.doc-body ul { margin: 0 0 .6em; padding-left: 1.3em; }
.doc-body li { margin: .12em 0; }
/* CONTACT.MSG + the SKILLS.SYS loading line */
.contact-list { list-style: none; margin: .4em 0 1em; padding: 0; }
.contact-list li { margin: .25em 0; white-space: pre-wrap; }
.contact-list a { color: #fff; text-decoration: underline; text-decoration-color: #3fae61; text-underline-offset: 3px; }
.contact-list a:hover, .contact-list a:focus-visible { background: var(--phos); color: #060806; text-shadow: none; outline: none; }
.load-line .bar { letter-spacing: -1px; }
.load-line.is-stuck .pct { color: #ff6b6b; animation: blink .45s steps(1, end) infinite; }
.err-line { color: #ff6b6b !important; text-shadow: 0 0 6px rgba(255, 107, 107, .5) !important; }

/* WORK.DIR project cards */
.projects { display: grid; grid-template-columns: 1fr 1fr; gap: 18px 24px; margin: .4em 0 .8em; }
.proj { min-width: 0; }
.proj-title { margin: 0 0 .35em; font: 11px/1.7 var(--pixel); color: #f7c948; display: flex; flex-wrap: wrap; align-items: baseline; gap: 0 12px; }
.proj-title a { color: #fff; text-decoration: none; }
.proj-title a:hover, .proj-title a:focus-visible { text-decoration: underline; outline: none; }
.proj-title .dim { font: 18px/1.2 var(--mono); }
.proj-shot {
  position: relative; display: block;
  margin: 0 0 .5em;
  border: 3px solid #c6c6c6; box-shadow: 0 0 0 1px #000, 4px 4px 0 rgba(0, 0, 0, .35);
  background: #000; overflow: hidden;
}
.proj-shot img { display: block; width: 100%; height: auto; image-rendering: auto; filter: saturate(.9); transition: filter .2s, transform .2s; }
.proj-shot::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: repeating-linear-gradient(0deg, rgba(0, 0, 0, .22) 0 1px, transparent 1px 3px);
}
.proj-visit {
  position: absolute; right: 8px; bottom: 8px;
  padding: 5px 8px;
  background: var(--grey); color: #111;
  font: 8px/1 var(--pixel);
  border: 2px solid; border-color: #fff var(--grey-dkr) var(--grey-dkr) #fff;
}
.proj-shot:hover img, .proj-shot:focus-visible img { filter: saturate(1.05) brightness(1.06); transform: scale(1.02); }
.proj-shot:focus-visible { outline: 2px solid var(--phos); }
.proj p { margin: 0 0 .35em; }

/* INVADERS.EXE */
.game-window { width: min(72vw, 720px); }
.tb-back {
  margin-left: auto; padding: 5px 9px;
  font: 9px/1 var(--pixel);
  background: var(--grey); color: #111;
  border: 2px solid; border-color: #fff var(--grey-dkr) var(--grey-dkr) #fff;
  cursor: pointer;
}
.tb-back:active { border-color: var(--grey-dkr) #fff #fff var(--grey-dkr); }
.tb-back:focus-visible { outline: 2px dotted #111; outline-offset: -4px; }
.game-body {
  margin-top: 3px; padding: 6px;
  background: #000;
  border: 2px solid; border-color: var(--grey-dkr) #fff #fff var(--grey-dkr);
}
#game {
  display: block; width: 100%; aspect-ratio: 4 / 3;
  background: #000;
  image-rendering: pixelated;
  outline: none;
}
.game-help { padding: 8px 0 2px; font: 9px/1.6 var(--pixel); color: #3fae61; text-align: center; }
.touch-controls { display: none; gap: 8px; justify-content: center; padding: 8px 0 2px; }
.touch-controls button {
  flex: 1 1 0; max-width: 140px; padding: 14px 0;
  font: 11px/1 var(--pixel);
  background: var(--grey); color: #111;
  border: 2px solid; border-color: #fff var(--grey-dkr) var(--grey-dkr) #fff;
  touch-action: none; user-select: none; -webkit-user-select: none;
}
.touch-controls button:active { border-color: var(--grey-dkr) #fff #fff var(--grey-dkr); }
@media (pointer: coarse) {
  .touch-controls { display: flex; }
  .game-help { display: none; }
}
.caret {
  display: inline-block; width: .55em; height: 1em;
  vertical-align: -.15em; margin-left: 2px;
  background: var(--phos);
  animation: blink 1s steps(1, end) infinite;
}
.caret[hidden] { display: none; }
@keyframes blink { 50% { opacity: 0; } }

.statusbar {
  flex: 0 0 auto;
  display: flex; gap: 6px;
  padding: 5px 6px;
  background: var(--grey);
  border-top: 2px solid #fff;
  box-shadow: 0 -2px 0 var(--grey-dk);
  font: 9px/1 var(--pixel);
  text-transform: uppercase;
}
.status-cell {
  padding: 6px 10px;
  border: 1px solid; border-color: var(--grey-dk) #fff #fff var(--grey-dk);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.status-right { margin-left: auto; color: #333; }

/* CRT texture on top of the UI */
.scanlines {
  position: absolute; inset: 0; pointer-events: none;
  background: repeating-linear-gradient(0deg, rgba(0, 0, 0, .16) 0 1px, transparent 1px 3px);
  mix-blend-mode: multiply;
}
.vignette {
  position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(ellipse at center, transparent 55%, rgba(0, 0, 0, .5) 100%);
}

/* ---------- responsive ---------- */
@media (max-width: 760px) {
  .menubar { gap: 0 10px; padding: 0 10px; font-size: 9px; }
  .logo-text { display: none; }
  .menu a { padding: 9px 7px; }
  .clock { display: none; }
  .window { width: min(92vw, 560px); }
  .win-body { font-size: 21px; padding: 14px 14px 18px; min-height: 34vh; }
  .status-right { display: none; }
}
@media (max-width: 380px) {
  .menubar { font-size: 8px; }
  .menu a { padding: 9px 5px; }
}

@media (max-width: 760px) {
  .prog .desc { display: none; }
  .prog .name { min-width: 0; }
  .game-window { width: min(92vw, 560px); }
  .doc-window { width: min(92vw, 560px); }
  .doc-body { font-size: 19px; padding: 14px 14px 16px; max-height: 62vh; }
  .projects { grid-template-columns: 1fr; gap: 20px; }
  .note-paper { width: min(270px, 84vw); font-size: 27px; }
}

@media (prefers-reduced-motion: reduce) {
  .hint span, .caret { animation: none; }
}
