/* ============================================================
   nathanlindberg//OS  —  retro-cyberpunk desktop theme
   ============================================================ */

@font-face {
  font-family: "DOS";
  src: url("../assets/fonts/PerfectDOSVGA437Win.woff2") format("woff2");
  font-display: swap;
}

:root {
  --bg:        #050807;
  --bg-grid:   #0c1512;
  --panel:     #0a1311;
  --ink:       #c8ffe0;
  --neon:      #19f7c2;   /* primary phosphor cyan-green */
  --neon-dim:  #0e8f73;
  --magenta:   #ff2a6d;
  --amber:     #ffb000;
  --violet:    #b967ff;
  --line:      #154b40;
  --scan:      rgba(0,0,0,0.28);
  --glow:      0 0 4px var(--neon), 0 0 11px rgba(25,247,194,0.45);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: var(--bg);
  color: var(--ink);
  font-family: "DOS", "ms_sans_serif", monospace;
  font-size: 16px;
  -webkit-font-smoothing: none;
  text-rendering: geometricPrecision;
}

.visually-hidden {
  position: absolute !important; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* ---- background field ---------------------------------------------------- */
body::before {
  content: "";
  position: fixed; inset: 0; z-index: 0;
  background:
    radial-gradient(ellipse at 50% 0%, rgba(25,247,194,0.10), transparent 60%),
    linear-gradient(var(--bg-grid) 1px, transparent 1px) 0 0 / 100% 38px,
    linear-gradient(90deg, var(--bg-grid) 1px, transparent 1px) 0 0 / 38px 100%,
    var(--bg);
  background-blend-mode: screen, normal, normal, normal;
  animation: grid-drift 40s linear infinite;
}
@keyframes grid-drift { from { background-position: 50% 0, 0 0, 0 0, 0 0; }
                        to   { background-position: 50% 0, 0 38px, 38px 0, 0 0; } }

/* ---- CRT overlays -------------------------------------------------------- */
#crt-overlay {
  position: fixed; inset: 0; z-index: 9000; pointer-events: none;
  background: repeating-linear-gradient(0deg, var(--scan) 0, var(--scan) 1px, transparent 1px, transparent 3px);
  mix-blend-mode: multiply;
}
#crt-overlay::after {
  content: ""; position: absolute; inset: 0;
  background: radial-gradient(ellipse at center, transparent 55%, rgba(0,0,0,0.55) 100%);
}
#crt-flicker {
  position: fixed; inset: 0; z-index: 9001; pointer-events: none;
  background: rgba(25,247,194,0.02); animation: flicker 6s infinite steps(1);
}
@keyframes flicker { 0%,97%,100% { opacity: .15; } 98% { opacity: .35; } 99% { opacity: .05; } }

/* ---- boot screen --------------------------------------------------------- */
#boot-screen {
  position: fixed; inset: 0; z-index: 8000;
  background: var(--bg); color: var(--neon);
  padding: 6vh 6vw; overflow: hidden;
}
#boot-log { margin: 0; font-family: "DOS", monospace; font-size: 17px; line-height: 1.5; text-shadow: var(--glow); white-space: pre-wrap; }
.boot-cursor::after { content: "_"; animation: blink 1s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0; } }

/* ---- desktop ------------------------------------------------------------- */
#desktop { position: fixed; inset: 0 0 42px 0; z-index: 10; }
/* the window layer spans the desktop but must not eat clicks on the icons
   beneath it; only actual windows capture pointer events. */
#window-layer { position: absolute; inset: 0; pointer-events: none; }
#window-layer .winbox { pointer-events: auto; }

#desktop-icons {
  position: absolute; top: 14px; left: 14px;
  display: grid; grid-auto-flow: column; grid-template-rows: repeat(6, 92px);
  gap: 6px 10px;
}
.desk-icon {
  width: 86px; padding: 8px 4px; border: 1px solid transparent;
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  cursor: pointer; user-select: none; text-align: center;
  color: var(--ink); background: transparent;
}
.desk-icon:hover  { border-color: var(--neon-dim); background: rgba(25,247,194,0.06); }
.desk-icon:focus-visible,
.desk-icon.selected { outline: none; border: 1px dashed var(--neon); background: rgba(25,247,194,0.12); }
.desk-icon .glyph { font-size: 30px; line-height: 1; text-shadow: var(--glow); }
.desk-icon .label { font-size: 13px; word-break: break-word; }

/* ---- taskbar ------------------------------------------------------------- */
#taskbar {
  position: fixed; bottom: 0; left: 0; right: 0; height: 42px; z-index: 7000;
  display: flex; align-items: stretch; gap: 4px; padding: 4px;
  background: linear-gradient(180deg, #0d1b18, #060b0a);
  border-top: 1px solid var(--neon-dim);
  box-shadow: 0 -1px 0 rgba(25,247,194,0.25), 0 -8px 24px rgba(0,0,0,0.6);
}
#start-button {
  display: flex; align-items: center; gap: 8px; padding: 0 16px;
  font-family: "DOS", monospace; font-size: 16px; letter-spacing: 2px;
  color: #04140f; background: var(--neon); border: 0; cursor: pointer;
  text-shadow: none; box-shadow: 0 0 12px rgba(25,247,194,0.6);
}
#start-button:hover { background: #5cffd8; }
#start-button[aria-expanded="true"] { background: var(--magenta); color: #fff; box-shadow: 0 0 14px rgba(255,42,109,0.7); }
.start-glyph { font-size: 12px; }

#task-buttons { display: flex; gap: 4px; flex: 1; overflow: hidden; }
.task-btn {
  max-width: 200px; min-width: 120px; padding: 0 12px;
  display: flex; align-items: center; gap: 8px;
  background: var(--panel); color: var(--ink);
  border: 1px solid var(--line); cursor: pointer; font-size: 13px;
  overflow: hidden; white-space: nowrap; text-overflow: ellipsis;
}
.task-btn.active { border-color: var(--neon); box-shadow: inset 0 0 10px rgba(25,247,194,0.25); }
.task-btn .tdot { color: var(--neon); }

#tray { display: flex; align-items: center; gap: 12px; padding: 0 14px; border-left: 1px solid var(--line); }
#tray #tray-net { color: var(--neon); font-size: 12px; }
#clock { color: var(--amber); font-size: 15px; text-shadow: 0 0 6px rgba(255,176,0,0.5); }

/* ---- start menu ---------------------------------------------------------- */
#start-menu {
  position: fixed; bottom: 46px; left: 4px; z-index: 7500;
  width: 360px; max-width: 92vw; height: 440px; max-height: 70vh;
  display: flex; background: var(--panel);
  border: 1px solid var(--neon); box-shadow: 0 0 24px rgba(25,247,194,0.35), 0 8px 40px rgba(0,0,0,0.7);
}
/* the explicit display:flex above outranks the UA [hidden]{display:none};
   re-assert hiding at equal-or-higher specificity so the menu truly hides. */
#start-menu[hidden] { display: none; }
#start-rail {
  width: 34px; flex: 0 0 34px;
  background: linear-gradient(180deg, var(--magenta), var(--violet));
  display: flex; align-items: flex-end; justify-content: center; padding-bottom: 14px;
}
#start-rail-text { writing-mode: vertical-rl; transform: rotate(180deg); color: #fff; letter-spacing: 3px; font-size: 14px; text-shadow: 0 0 6px rgba(0,0,0,0.6); }
#start-body { flex: 1; display: flex; flex-direction: column; padding: 12px; min-width: 0; }
#launch-search {
  width: 100%; padding: 10px 12px; margin-bottom: 10px;
  background: #04100d; color: var(--neon); border: 1px solid var(--neon-dim);
  font-family: "DOS", monospace; font-size: 16px; outline: none;
}
#launch-search:focus { border-color: var(--neon); box-shadow: var(--glow); }
#launch-search::placeholder { color: var(--neon-dim); }
#launch-list { list-style: none; margin: 0; padding: 0; overflow-y: auto; flex: 1; }
.launch-item {
  display: flex; align-items: center; gap: 12px; padding: 9px 10px; cursor: pointer; border: 1px solid transparent;
}
.launch-item .glyph { font-size: 22px; width: 28px; text-align: center; text-shadow: var(--glow); }
.launch-item .meta b { display: block; font-size: 15px; color: var(--ink); }
.launch-item .meta small { color: var(--neon-dim); font-size: 12px; }
.launch-item:hover, .launch-item.active { border-color: var(--neon); background: rgba(25,247,194,0.10); }
.launch-empty { padding: 14px; color: var(--magenta); }

/* ---- WinBox cyberpunk reskin --------------------------------------------- */
.winbox {
  background: var(--neon-dim);
  box-shadow: 0 0 0 1px var(--neon), 0 0 22px rgba(25,247,194,0.25), 0 12px 40px rgba(0,0,0,0.6);
  border-radius: 0;
}
.winbox .wb-header { background: linear-gradient(90deg, #0e8f73, #0a5f4d); height: 30px; }
.winbox .wb-title  { font-family: "DOS", monospace; font-size: 14px; letter-spacing: 1px; color: #03130e; }
.winbox .wb-body   { background: var(--panel); color: var(--ink); border: 1px solid var(--neon-dim); }
.winbox.focus .wb-header { background: linear-gradient(90deg, var(--neon), #0e8f73); }
.winbox.focus { box-shadow: 0 0 0 1px var(--neon), 0 0 30px rgba(25,247,194,0.45), 0 12px 50px rgba(0,0,0,0.7); }
.wb-body { padding: 14px; overflow: auto; }

/* app window content */
.app-doc h1, .app-doc h2 { color: var(--neon); text-shadow: var(--glow); margin-top: 0; }
.app-doc a { color: var(--amber); }
.app-doc code, .app-doc pre { background: #04100d; color: var(--neon); padding: 2px 5px; }
.app-doc hr { border: 0; border-top: 1px dashed var(--neon-dim); }
.app-doc .tag { color: var(--magenta); }

/* Internet Explorer icon — the lone XP-blue "e" on a neon desktop */
.desk-icon[data-app="iexplorer"] .glyph {
  color: #39a0e5;
  font-family: "Times New Roman", serif;
  font-style: italic;
  font-weight: bold;
  text-shadow: 0 0 4px #39a0e5, 0 0 11px rgba(57, 160, 229, 0.55);
}

/* strangewebsites folder */
.sw-note { color: var(--amber); font-size: 12px; border: 1px dashed var(--neon-dim); padding: 6px 10px; margin-bottom: 14px; }
.sw-grid { display: flex; flex-wrap: wrap; gap: 14px; }
.sw-item { width: 110px; display: flex; flex-direction: column; align-items: center; text-align: center; gap: 6px; padding: 8px 4px; cursor: pointer; -webkit-user-select: none; user-select: none; border: 1px solid transparent; }
.sw-item:hover { border-color: var(--neon-dim); background: rgba(25,247,194,0.06); }
.sw-item.sel { border: 1px dashed var(--neon); background: rgba(25,247,194,0.12); }
.sw-ico { position: relative; width: 48px; height: 48px; }
.sw-face { font-size: 40px; line-height: 48px; color: #ffe14d; text-shadow: 0 0 6px rgba(255,225,77,0.7); }
.sw-arrow { position: absolute; left: -2px; bottom: -2px; width: 16px; height: 16px; font-size: 11px; line-height: 15px; color: #04140f; background: #fff; border: 1px solid #555; }
.sw-name { font-size: 12px; color: var(--ink); word-break: break-all; }

/* certs window */
.cert-list { margin-top: 14px; display: flex; flex-direction: column; gap: 8px; }
.cert-row { display: flex; align-items: center; gap: 8px; border: 1px solid var(--line); background: #04100d; padding: 8px 10px; }
.cert-row:hover { border-color: var(--neon); box-shadow: inset 0 0 12px rgba(25,247,194,0.2); }
.cert-info { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.cert-info b { color: var(--neon); font-size: 14px; }
.cert-info small { color: var(--neon-dim); font-size: 11px; }
.cert-btn { font: inherit; font-size: 12px; color: var(--amber); background: transparent; border: 1px solid var(--neon-dim); padding: 3px 8px; cursor: pointer; white-space: nowrap; }
.cert-btn:hover { border-color: var(--amber); box-shadow: 0 0 8px rgba(255,176,0,0.4); }
.cert-btn:active { color: #04140f; background: var(--amber); }

/* terminal app */
.term-host { width: 100%; height: 100%; background: #02100c; padding: 6px; }
.term-host .xterm { height: 100%; }

/* projects grid */
.proj-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px,1fr)); gap: 12px; }
.proj-card { border: 1px solid var(--line); padding: 12px; background: #04100d; }
.proj-card:hover { border-color: var(--neon); box-shadow: inset 0 0 12px rgba(25,247,194,0.2); }
.proj-card h3 { color: var(--neon); margin: 0 0 6px; font-size: 16px; }
.proj-card p { margin: 0 0 8px; font-size: 13px; }
.proj-card .stack span { display: inline-block; border: 1px solid var(--neon-dim); color: var(--neon); padding: 1px 6px; margin: 2px 2px 0 0; font-size: 11px; }

/* ---- XP "Gold Edition" — active while Internet Explorer is open --------- */
/* Luna chrome in olive-gold: title bars, taskbar, START, icons. Applied as
   body.xp-gold by iexplorer.js; everything reverts when IE closes. */
body.xp-gold #taskbar {
  background: linear-gradient(#f0e0a8, #d8bf72 8%, #bb9c48 55%, #a8893a 90%, #8f7430);
  border-top: 1px solid #f8f0cf;
  box-shadow: 0 -1px 6px rgba(80, 60, 10, 0.5);
}
body.xp-gold #start-button {
  background: linear-gradient(#e7d491, #b89a45 45%, #97762d);
  color: #fff;
  font-style: italic;
  font-weight: bold;
  text-shadow: 1px 1px 2px rgba(60, 45, 5, 0.8);
  border-radius: 0 9px 9px 0;
  box-shadow: inset 0 1px 0 #f8f0cf, 1px 0 3px rgba(80, 60, 10, 0.5);
}
body.xp-gold #start-button:hover { background: linear-gradient(#f3e3a8, #c9ad5d 45%, #a8893a); }
body.xp-gold #start-button[aria-expanded="true"] {
  background: linear-gradient(#97762d, #b89a45);
  color: #fff; box-shadow: inset 0 2px 4px rgba(60, 45, 5, 0.6);
}
body.xp-gold .task-btn {
  background: linear-gradient(#f3e8c2, #ddc887 50%, #c9ad5d);
  color: #3a2f0e;
  border: 1px solid #8f7430;
  border-radius: 3px;
  box-shadow: inset 0 1px 0 #f8f0cf;
}
body.xp-gold .task-btn .tdot { color: #6b5516; }
body.xp-gold .task-btn.active {
  background: linear-gradient(#c9ad5d, #ddc887);
  border-color: #6b5516;
  box-shadow: inset 0 2px 4px rgba(60, 45, 5, 0.45);
}
body.xp-gold #tray { border-left: 1px solid #8f7430; box-shadow: inset 1px 0 0 #f0e0a8; }
body.xp-gold #tray #tray-net { color: #3a2f0e; }
body.xp-gold #clock { color: #fff; text-shadow: 1px 1px 2px rgba(60, 45, 5, 0.8); }

body.xp-gold .winbox {
  border: 1px solid #8f7430;
  border-radius: 8px 8px 0 0;
  box-shadow: 0 0 0 1px #c9ad5d, 0 10px 34px rgba(40, 30, 5, 0.65);
}
body.xp-gold .winbox .wb-header {
  background: linear-gradient(#f3e3a8, #d9bd6b 14%, #c3a04a 52%, #b08c38 86%, #97762d);
  border-radius: 7px 7px 0 0;
}
body.xp-gold .winbox .wb-title {
  color: #fff; font-weight: bold;
  text-shadow: 1px 1px 2px rgba(60, 45, 5, 0.85);
}
body.xp-gold .winbox.focus { box-shadow: 0 0 0 1px #f0e0a8, 0 12px 40px rgba(40, 30, 5, 0.75); }
body.xp-gold .winbox.focus .wb-header {
  background: linear-gradient(#fdf3c4, #e7d491 14%, #d0ad55 52%, #bb9c48 86%, #a8893a);
}
body.xp-gold .winbox .wb-body { border-color: #c9ad5d; }

body.xp-gold .desk-icon { color: #fff; text-shadow: 1px 1px 2px #000, 0 0 4px rgba(0, 0, 0, 0.8); }
body.xp-gold .desk-icon .glyph { text-shadow: 1px 1px 2px #000; }
body.xp-gold .desk-icon:hover { border-color: rgba(248, 240, 207, 0.7); background: rgba(232, 200, 90, 0.16); }
body.xp-gold .desk-icon.selected { border: 1px dashed #f0e0a8; background: rgba(232, 200, 90, 0.28); }

body.xp-gold #start-menu { border: 1px solid #8f7430; box-shadow: 0 0 0 1px #c9ad5d, 0 12px 40px rgba(40, 30, 5, 0.7); }
body.xp-gold #start-rail { background: linear-gradient(#d9bd6b, #97762d); }
body.xp-gold #launch-search { border-color: #b89a45; }
body.xp-gold #launch-search:focus { border-color: #f0e0a8; box-shadow: 0 0 8px rgba(232, 200, 90, 0.5); }
body.xp-gold .launch-item:hover, body.xp-gold .launch-item.active {
  border-color: #c9ad5d; background: rgba(232, 200, 90, 0.14);
}

/* ---- responsive: phones become a stacked app launcher ------------------- */
@media (max-width: 768px) {
  #desktop-icons { grid-auto-flow: row; grid-template-rows: none; grid-template-columns: repeat(auto-fill, 86px); }
  #start-menu { width: 100vw; max-width: 100vw; left: 0; height: calc(100vh - 46px); max-height: none; }
  .winbox { left: 0 !important; top: 0 !important; }
}
