/* ===== RESET & VARS ===== */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --bar-h:     3.5rem;
  --bg:        #161618;
  --bg-card:   #19191c;
  --surface:   #1d1d20;
  --border:    #2a2a2d;
  --text:      #b8b8bc;
  --text-dim:  #58585f;
  --accent:    #4a6480;
  --accent2:   #3a5270;
  --accent3:   #6a8498;
  --glow:      rgba(74, 100, 128, 0.10);
  --font-mono: 'JetBrains Mono', monospace;
  --font-sans: 'Space Grotesk', sans-serif;

  /* Terminal theming */
  --terminal-bg:      #0d0d0d;
  --terminal-bar-bg:  #1a1a1d;
  --terminal-bar-border: #1f1f25;
  --terminal-text:    #c8c8c8;
  --terminal-border:  #1a1a1a;
  --terminal-radius:  0;
  --terminal-shadow:  0 8px 32px rgba(0, 0, 0, 0.5);
}

/* ===== THEME: Windows XP ===== */
[data-theme="winxp"] {
  --bg:        #3a6ea5;
  --bg-card:   #ece9d8;
  --surface:   #ece9d8;
  --border:    #aca899;
  --text:      #000000;
  --text-dim:  #555555;
  --accent:    #003399;
  --accent2:   #0054e3;
  --accent3:   #316ac5;
  --glow:      rgba(0, 84, 227, 0.10);

  --terminal-bg:      #000000;
  --terminal-bar-bg:  linear-gradient(180deg, #0054e3, #002d96, #0054e3);
  --terminal-bar-border: #0054e3;
  --terminal-text:    #c0c0c0;
  --terminal-border:  #0054e3;
  --terminal-radius:  8px 8px 0 0;
  --terminal-shadow:  none;

}

/* ===== THEME: Windows Vista ===== */
[data-theme="vista"] {
  --bg:        #1b3a5c;
  --bg-card:   rgba(20, 30, 48, 0.7);
  --surface:   rgba(30, 45, 65, 0.6);
  --border:    rgba(100, 140, 190, 0.3);
  --text:      #e0e6ee;
  --text-dim:  #8a9bb0;
  --accent:    #4a90d9;
  --accent2:   #3070b8;
  --accent3:   #6aace0;
  --glow:      rgba(74, 144, 217, 0.12);

  --terminal-bg:      rgba(0, 0, 0, 0.75);
  --terminal-bar-bg:  linear-gradient(180deg, rgba(80, 120, 180, 0.7), rgba(40, 70, 120, 0.8));
  --terminal-bar-border: rgba(100, 150, 210, 0.4);
  --terminal-text:    #e0e0e0;
  --terminal-border:  rgba(100, 150, 210, 0.4);
  --terminal-radius:  8px 8px 0 0;
  --terminal-shadow:  0 6px 30px rgba(0, 0, 0, 0.5);

}

html {
  scroll-behavior: smooth;
  scrollbar-width: none;
}

html::-webkit-scrollbar {
  display: none;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  overflow: hidden;
  height: 100vh;
  line-height: 1.6;
}

[data-theme="winxp"] body {
  background: #3a6ea5 url('assets/themes/winxp/bg.jpg') center/cover no-repeat fixed;
}

[data-theme="vista"] body {
  background: #1b3a5c url('assets/themes/vista/bg.jpg') center/cover no-repeat fixed;
}

a { color: var(--accent); text-decoration: none; transition: all 0.2s; }
a:hover { text-shadow: 0 0 8px var(--glow); }

/* ===== SECRET THEME OVERLAY ===== */
.secret-bg-overlay {
  position: fixed;
  inset: 0;
  z-index: -2;
  background: url('assets/themes/secret/bg.jpg') center/cover no-repeat fixed;
  opacity: 0;
  transition: opacity 2s ease;
  pointer-events: none;
}
.secret-bg-overlay.active {
  opacity: 1;
}

/* Secret mode: rainbow hue sweep on logo */
@keyframes rainbow-hue {
  from { filter: hue-rotate(0deg); }
  to   { filter: hue-rotate(360deg); }
}
.secret-mode .nav-logo-img {
  animation: rainbow-hue 3s linear infinite;
}

/* ===== SCANLINES OVERLAY ===== */
.scanlines {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: -1;
  /* Vignette darkening edges + very subtle static lines */
  background:
    radial-gradient(ellipse 110% 100% at 50% 50%, transparent 45%, rgba(0,0,0,0.5) 100%),
    repeating-linear-gradient(
      0deg,
      rgba(0, 0, 0, 0.07) 0px,
      rgba(0, 0, 0, 0.07) 1px,
      transparent 1px,
      transparent 4px
    );
}

/* Slow glowing sweep band, like a CRT beam */
.scanlines::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  top: -150px;
  height: 150px;
  background: linear-gradient(
    to bottom,
    transparent 0%,
    rgba(150, 170, 195, 0.02) 30%,
    rgba(150, 170, 195, 0.05) 50%,
    rgba(150, 170, 195, 0.02) 70%,
    transparent 100%
  );
  animation: scan-sweep 14s linear infinite;
}

@keyframes scan-sweep {
  0%   { transform: translateY(0); }
  100% { transform: translateY(calc(100vh + 150px)); }
}

/* ===== PARTICLE CANVAS ===== */
#particles {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
}

/* ===== NAVIGATION ===== */
#nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  height: var(--bar-h);
  padding: 0;
  background: linear-gradient(to bottom, rgba(50, 60, 75, 0.92), rgba(30, 30, 33, 0.92));
  backdrop-filter: blur(12px);
  border-bottom: 1px solid #000;
  overflow: visible;
}

.nav-logo {
  position: relative;
  top: -3px;
  cursor: pointer;
  padding: 0;
  margin-left: 2rem;
  display: inline-block;
  line-height: 0;
}
.nav-logo-img {
  height: 2.6rem;
  width: auto;
  display: block;
  pointer-events: none;
}


.nav-status {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: #58585f;
  margin-left: auto;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #4a6480;
  box-shadow: 0 0 8px #4a6480;
  animation: pulse-dot 2s ease-in-out infinite;
}

.nav-sep {
  color: #2a2a2d;
  font-size: 0.7rem;
  margin: 0 0.25rem;
}

/* Lock nav styling against theme library globals (XP.css / vista.css) */
#nav, #nav * {
  font-family: var(--font-mono);
}
#nav a,
#nav a:link,
#nav a:visited,
#nav a:hover,
#nav a:focus {
  text-decoration: none;
  outline: none;
}
#nav a.nav-logo,
#nav a.nav-logo:link,
#nav a.nav-logo:visited,
#nav a.nav-logo:hover {
  border: none;
}
#nav button.nav-btn-projects,
#nav button.nav-btn-lounge,
#nav button.nav-btn-gadgets {
  width: 24px !important;
  height: 100% !important;
  min-width: unset !important;
  min-height: unset !important;
  padding: 0 !important;
  border: none !important;
  border-radius: 0 !important;
  background: transparent !important;
  background-image: none !important;
  box-shadow: none !important;
  cursor: pointer !important;
  opacity: 1 !important;
  -webkit-appearance: none !important;
  appearance: none !important;
  outline: none !important;
  transition: none !important;
  position: relative !important;
  align-self: flex-end !important;
  overflow: visible !important;
}
#nav button.nav-btn-projects::before,
#nav button.nav-btn-lounge::before,
#nav button.nav-btn-gadgets::before {
  content: '' !important;
  display: block !important;
  position: absolute !important;
  left: 0 !important;
  right: 0 !important;
  top: 0 !important;
  bottom: 0 !important;
  width: auto !important;
  height: auto !important;
  margin: 0 !important;
  padding: 0 !important;
  opacity: 1 !important;
  z-index: auto !important;
  border-left: 1px solid rgba(100, 110, 130, 0.45) !important;
  border-right: 1px solid rgba(100, 110, 130, 0.45) !important;
  border-top: none !important;
  border-bottom: 1px solid rgba(100, 110, 130, 0.45) !important;
  border-radius: 0 !important;
  background: none !important;
  box-shadow: none !important;
  -webkit-mask-image: linear-gradient(to top, rgba(0,0,0,1) 0%, rgba(0,0,0,0) 100%) !important;
  mask-image: linear-gradient(to top, rgba(0,0,0,1) 0%, rgba(0,0,0,0) 100%) !important;
  pointer-events: none !important;
  transition: border-color 0.2s ease-in, bottom 0.2s ease-in !important;
}
#nav button.nav-btn-projects::after {
  content: '' !important;
  display: block !important;
  position: absolute !important;
  left: 0 !important;
  right: 0 !important;
  top: 0 !important;
  bottom: 0 !important;
  width: auto !important;
  height: auto !important;
  margin: 0 !important;
  padding: 0 !important;
  opacity: 0 !important;
  z-index: auto !important;
  border: none !important;
  border-radius: 0 !important;
  box-shadow: none !important;
  background: linear-gradient(to top, rgba(224, 160, 0, 0.35) 0%, transparent 100%) !important;
  transition: opacity 0.2s ease-in, bottom 0.2s ease-in !important;
  pointer-events: none !important;
}
#nav button.nav-btn-lounge::after {
  content: '' !important;
  display: block !important;
  position: absolute !important;
  left: 0 !important;
  right: 0 !important;
  top: 0 !important;
  bottom: 0 !important;
  width: auto !important;
  height: auto !important;
  margin: 0 !important;
  padding: 0 !important;
  opacity: 0 !important;
  z-index: auto !important;
  border: none !important;
  border-radius: 0 !important;
  box-shadow: none !important;
  background: linear-gradient(to top, rgba(168, 76, 224, 0.35) 0%, transparent 100%) !important;
  transition: opacity 0.2s ease-in, bottom 0.2s ease-in !important;
  pointer-events: none !important;
}
#nav button.nav-btn-gadgets::after {
  content: '' !important;
  display: block !important;
  position: absolute !important;
  left: 0 !important;
  right: 0 !important;
  top: 0 !important;
  bottom: 0 !important;
  width: auto !important;
  height: auto !important;
  margin: 0 !important;
  padding: 0 !important;
  opacity: 0 !important;
  z-index: auto !important;
  border: none !important;
  border-radius: 0 !important;
  box-shadow: none !important;
  background: linear-gradient(to top, rgba(0, 224, 64, 0.35) 0%, transparent 100%) !important;
  transition: opacity 0.2s ease-in, bottom 0.2s ease-in !important;
  pointer-events: none !important;
}
#nav button.nav-btn-projects:hover::before {
  border-left-color: #e0a000 !important;
  border-right-color: #e0a000 !important;
  border-bottom-color: #e0a000 !important;
  bottom: -7px !important;
  transition: border-color 0.5s linear, bottom 0.4s ease-out !important;
}
#nav button.nav-btn-projects:hover::after {
  opacity: 1 !important;
  bottom: -7px !important;
  transition: opacity 0.5s linear, bottom 0.4s ease-out !important;
}
#nav button.nav-btn-lounge:hover::before {
  border-left-color: #a84ce0 !important;
  border-right-color: #a84ce0 !important;
  border-bottom-color: #a84ce0 !important;
  bottom: -7px !important;
  transition: border-color 0.5s linear, bottom 0.4s ease-out !important;
}
#nav button.nav-btn-lounge:hover::after {
  opacity: 1 !important;
  bottom: -7px !important;
  transition: opacity 0.5s linear, bottom 0.4s ease-out !important;
}
#nav button.nav-btn-projects:active,
#nav button.nav-btn-lounge:active,
#nav button.nav-btn-gadgets:active {
  opacity: 1 !important;
}
#nav button.nav-btn-gadgets:hover::before {
  border-left-color: #00e040 !important;
  border-right-color: #00e040 !important;
  border-bottom-color: #00e040 !important;
  bottom: -7px !important;
  transition: border-color 0.5s linear, bottom 0.4s ease-out !important;
}
#nav button.nav-btn-gadgets:hover::after {
  opacity: 1 !important;
  bottom: -7px !important;
  transition: opacity 0.5s linear, bottom 0.4s ease-out !important;
}

.server-load {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: #8a9bb0;
}

@keyframes pulse-dot {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

/* ===== HERO / TERMINAL ===== */
#hero {
  position: relative;
  z-index: 1;
  height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--bar-h) 2rem var(--bar-h);
  overflow: hidden;
}

.terminal {
  width: min(760px, 90vw);
  background: var(--terminal-bg);
  border: 1px solid var(--terminal-border);
  border-radius: var(--terminal-radius);
  overflow: hidden;
  position: relative;
  box-shadow: var(--terminal-shadow);
}

/* ===== LINUX FRAME (default theme) ===== */
.terminal.linux-frame {
  border-radius: 6px 6px 0 0;
  border: 1px solid #333;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
}

.linux-titlebar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 38px;
  padding: 0 14px;
  background: #2b2b2e;
  border-bottom: 1px solid #222;
  border-radius: 6px 6px 0 0;
  user-select: none;
}

.linux-controls {
  display: flex;
  gap: 8px;
  min-width: 60px;
}

.linux-controls-spacer {
  min-width: 60px;
}

.linux-dot {
  width: 13px;
  height: 13px;
  border-radius: 50%;
  border: 1px solid rgba(0, 0, 0, 0.2);
}

.linux-dot--close    { background: #555; }
.linux-dot--minimize { background: #555; }
.linux-dot--maximize { background: #555; }

.linux-title {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: #888;
  text-align: center;
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}



.terminal-body {
  padding: 1rem 1.25rem 1.25rem;
  font-family: var(--font-mono);
  font-size: 0.875rem;
  line-height: 1.55;
  height: calc(25 * 16px + 8px);
  min-height: unset;
  overflow-y: auto;
  overflow-x: hidden;
  background: var(--terminal-bg);
  color: var(--terminal-text);
}

.terminal-output {
  white-space: pre-wrap;
  word-break: break-word;
}

.terminal-output .cmd       { color: #8aad6e; }
.terminal-output .cmd-text  { color: #b0b3ba; }
.terminal-output .info      { color: #666; }
.terminal-output .highlight { color: #a0b8d0; }
.terminal-output .warn      { color: #9999aa; }
.terminal-output .caret     { color: #8aad6e; }

/* Hidden keyboard-capture textarea */
#terminal-input,
.terminal-hidden-input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
  width: 1px;
  height: 1px;
  overflow: hidden;
  resize: none;
  border: none;
  padding: 0;
}

/* Terminal clickable to focus */
.terminal-body {
  position: relative;
  cursor: text;
}

/* Cursor brightens when terminal is focused */
.terminal-focused .cursor {
  background: #e0e0e0;
}

.terminal-input-line {
  display: flex;
  align-items: baseline;
  gap: 0;
  margin-top: 0;
}

[data-theme="winxp"] .terminal-input-line,
[data-theme="vista"] .terminal-input-line {
  display: block;
  margin-top: 0;
}

#terminal-typed {
  color: #b0b3ba;
  font-family: var(--font-mono);
  font-size: 0.875rem;
  white-space: pre;
}

[data-theme="winxp"] #terminal-typed,
[data-theme="vista"] #terminal-typed {
  font-family: "Perfect DOS VGA 437 Win", monospace;
  font-size: 16px;
  color: #c0c0c0;
}

.prompt {
  color: #8aad6e;
  font-weight: 400;
  white-space: pre;
}

/* Block cursor like a real terminal */
.cursor {
  display: inline-block;
  width: 0.55em;
  height: 1em;
  background: #c8c8c8;
  vertical-align: text-bottom;
  position: relative;
  top: 4px;
  animation: blink 1.1s step-end infinite;
}
@keyframes blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0; }
}

/* XP / Vista: underline cursor */
[data-theme="winxp"] .cursor,
[data-theme="vista"] .cursor {
  width: 10px;
  height: 16px;
  background: transparent;
  border-bottom: 2px solid #c0c0c0;
  vertical-align: text-bottom;
  position: relative;
  top: 0;
  box-sizing: border-box;
  font-size: 0;
  overflow: hidden;
}

.hero-scroll-hint {
  position: absolute;
  bottom: 2rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--text-dim);
  animation: fade-bob 3s ease-in-out infinite;
}
.scroll-arrow {
  width: 16px;
  height: 16px;
  border-right: 2px solid var(--text-dim);
  border-bottom: 2px solid var(--text-dim);
  transform: rotate(45deg);
}
@keyframes fade-bob {
  0%, 100% { opacity: 0.4; transform: translateY(0); }
  50% { opacity: 1; transform: translateY(6px); }
}


/* ===== FOOTER ===== */
footer {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 100;
  height: var(--bar-h);
  display: flex;
  align-items: center;
  padding: 0 2rem;
  border-top: 1px solid #000;
  background: linear-gradient(to bottom, rgba(30, 30, 33, 0.92), rgba(50, 60, 75, 0.92));
  backdrop-filter: blur(12px);
}

.footer-content {
  max-width: none;
  width: 100%;
  margin: 0;
  padding: 0 1.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-dim);
  height: 100%;
}

/* ===== SPA VIEW TRANSITIONS ===== */
#hero, #gadgets-view, #projects-view {
  transition: opacity 0.5s ease;
}
#hero.view-fading, #gadgets-view.view-fading, #projects-view.view-fading {
  opacity: 0;
}

/* ===== GADGETS PAGE ===== */
.gadgets-page {
  position: relative;
  z-index: 1;
  max-width: 1400px;
  margin: 0 auto;
  padding: 5rem 1.5rem calc(var(--bar-h) + 1.5rem);
}

.gadgets-header {
  padding-top: 2rem;
  margin-bottom: 2rem;
}

.gadgets-header h1 {
  font-size: 2.5rem;
  font-weight: 700;
  margin-top: 0.5rem;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.gadgets-subtitle {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--text-dim);
  margin-top: 0.25rem;
}

.gadgets-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
}

.gadget-cell {
  aspect-ratio: 2 / 1;
}

.gadget-inner {
  width: 100%;
  height: 100%;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: border-color 0.3s, box-shadow 0.3s;
}

.gadget-inner:hover {
  border-color: var(--accent2);
  box-shadow: 0 0 20px rgba(50, 60, 70, 0.08);
}

.gadget-empty {
  align-items: center;
  justify-content: center;
}

.gadget-coming {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--text-dim);
  opacity: 0.35;
  text-transform: lowercase;
}

.gadget-title {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--accent);
  padding: 0.5rem 0.75rem;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.gadget-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* -- YouTube Roulette gadget -- */
.yt-layout {
  flex-direction: row;
}

.yt-embed-wrap {
  aspect-ratio: 16 / 9;
  height: 100%;
  position: relative;
  background: #000;
  flex-shrink: 0;
}

.yt-embed-wrap iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: none;
}

.yt-placeholder {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  color: var(--text-dim);
}

.yt-placeholder-icon {
  font-size: 2rem;
  opacity: 0.3;
}

.yt-placeholder-text {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  opacity: 0.4;
}

.yt-sidebar {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding: 0.5rem 0.75rem;
  min-width: 0;
  overflow: hidden;
}

.gadget-btn {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  padding: 0.3rem 0.75rem;
  background: var(--surface);
  color: var(--accent);
  border: 1px solid var(--border);
  border-radius: 4px;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s;
}

.gadget-btn:hover {
  background: var(--accent2);
  border-color: var(--accent);
  color: #d0d0d4;
}

.yt-status {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-dim);
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  word-break: break-word;
  min-height: 0;
}

/* -- API Roulette gadget -- */
.api-layout {
  flex-direction: row;
}

.api-display {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  min-height: 0;
  padding: 0.5rem 0.75rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

.api-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.4rem;
  color: var(--text-dim);
}

.api-placeholder-icon {
  font-size: 1.8rem;
  opacity: 0.3;
}

.api-placeholder-text {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  opacity: 0.4;
}

.api-sidebar {
  width: 120px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  padding: 0.5rem 0.6rem;
  border-left: 1px solid var(--border);
}

.api-source {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  color: var(--text-dim);
  opacity: 0.6;
  word-break: break-all;
}

.api-loading, .api-error {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--text-dim);
  text-align: center;
  padding: 1rem;
}

.api-error {
  color: #aa6666;
}

.api-result {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.api-result--img {
  align-items: center;
}

.api-result--pokemon,
.api-result--cocktail {
  flex-direction: row;
  align-items: center;
  gap: 0.6rem;
}

.api-label {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.api-text {
  font-family: var(--font-sans);
  font-size: 0.85rem;
  color: var(--text);
  line-height: 1.5;
  white-space: pre-wrap;
}

.api-img {
  max-height: 100%;
  max-width: 100%;
  object-fit: contain;
  border-radius: 4px;
}

.api-img--pixel {
  image-rendering: pixelated;
  width: 80px;
  height: 80px;
  flex-shrink: 0;
}

.api-img--thumb {
  width: 64px;
  height: 64px;
  object-fit: cover;
  flex-shrink: 0;
  border-radius: 4px;
}

.api-img--round {
  border-radius: 50%;
}

.api-caption {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--text-dim);
  text-align: center;
}

.api-pairs {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  min-width: 0;
}

.api-pair {
  font-size: 0.8rem;
  line-height: 1.4;
}

.api-key {
  font-family: var(--font-mono);
  color: var(--accent);
  font-size: 0.7rem;
}

.api-val {
  color: var(--text);
  word-break: break-word;
}

/* -- Archery gadget -- */
.archery-layout {
  flex-direction: row;
  overflow: hidden;
}

.archery-canvas-wrap {
  flex: 1;
  min-width: 0;
  position: relative;
}

#archery-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  cursor: crosshair;
}

.archery-sidebar {
  width: 78px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  padding: 0.35rem 0.45rem;
  border-left: 1px solid var(--border);
  font-family: var(--font-mono);
}

.archery-level {
  font-size: 0.65rem;
  color: var(--accent);
  font-weight: 500;
}

.archery-timer {
  font-size: 0.6rem;
  color: var(--text-dim);
  font-variant-numeric: tabular-nums;
}

.archery-msg {
  font-size: 0.5rem;
  color: var(--text-dim);
  opacity: 0.6;
  line-height: 1.3;
  margin-top: auto;
}

.archery-lb-btn {
  font-size: 0.55rem !important;
  padding: 0.2rem 0.3rem !important;
  white-space: nowrap;
  min-height: unset !important;
  min-width: unset !important;
  height: auto !important;
}

/* ===== OSRS GOLD GENERATOR ===== */
#gadget-osrs {
  background: url('assets/gadgets/osrsgoldgen/rs_bg.jpg') center/cover no-repeat;
}
#gadget-osrs .gadget-title {
  background: #2a2a2d;
}
.osrs-layout {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  height: 100%;
}
.osrs-form {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.45rem;
  width: 80%;
}
.osrs-input {
  width: 100%;
  padding: 0.3rem 0.4rem;
  font-size: 0.7rem;
  font-family: inherit;
  background: rgba(0,0,0,0.55);
  border: 1px solid #5a5a40;
  color: inherit;
  border-radius: 2px;
  outline: none;
  box-sizing: border-box;
}
.osrs-input::placeholder {
  color: #b8a040;
  opacity: 0.7;
}
.osrs-input:focus {
  border-color: #ffd700;
}
.osrs-label {
  font-size: 0.6rem;
  color: #ffd700;
  text-shadow: 1px 1px 2px #000;
  align-self: flex-start;
}
.osrs-gold-row {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  width: 100%;
}
.osrs-select-wrap {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}
/* Minimal base: only flex + font */
.osrs-select {
  flex: 1;
  font-size: 0.7rem;
  font-family: inherit;
  color: inherit;
}
/* XP: dark text on the library's white background */
[data-theme="winxp"] .osrs-select {
  color: #3a2e0f;
}
[data-theme="winxp"] .osrs-select:focus {
  background-color: #fff;
  color: #3a2e0f;
}
/* Default theme: full custom styling */
[data-theme="default"] .osrs-select {
  padding: 0.25rem 1.4rem 0.25rem 0.3rem;
  background: rgba(0,0,0,0.55);
  border: 1px solid #5a5a40;
  border-radius: 2px;
  outline: none;
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%23ffd700'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.35rem center;
  background-size: 10px 6px;
  height: auto;
  box-shadow: none;
}
[data-theme="default"] .osrs-select:focus {
  border-color: #ffd700;
}
.osrs-coins {
  width: 22px;
  height: 22px;
  image-rendering: pixelated;
}
.osrs-btn {
  padding: 0.3rem 0.8rem;
  font-size: 0.65rem;
  font-family: inherit;
  background: linear-gradient(180deg, #5b4a1a 0%, #3a2e0f 100%);
  border: 1px solid #ffd700;
  color: #ffd700;
  border-radius: 2px;
  cursor: pointer;
  text-shadow: 1px 1px 2px #000;
  transition: background 0.15s;
}
.osrs-btn:hover {
  background: linear-gradient(180deg, #7a6420 0%, #4e3c14 100%);
}
.osrs-progress-wrap {
  width: 80%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.3rem;
}
.osrs-progress-bar {
  width: 100%;
  height: 14px;
  background: rgba(0,0,0,0.55);
  border: 1px solid #5a5a40;
  border-radius: 2px;
  overflow: hidden;
}
.osrs-progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #228b22, #32cd32);
  transition: width 0.3s linear;
}
/* Native progress: hidden by default, shown on XP */
.osrs-progress-xp {
  display: none;
  width: 100%;
}
/* Vista role=progressbar: hidden by default */
.osrs-progress-vista {
  display: none;
  width: 100%;
}
.osrs-progress-vista > div {
  height: 100%;
  transition: width 0.3s linear;
}
/* XP: show native <progress> */
[data-theme="winxp"] .osrs-progress-div {
  display: none;
}
[data-theme="winxp"] .osrs-progress-xp {
  display: block;
}
/* Vista: show role=progressbar div */
[data-theme="vista"] .osrs-progress-div {
  display: none;
}
[data-theme="vista"] .osrs-progress-vista {
  display: block;
}
.osrs-success {
  font-size: 0.7rem;
  color: #32cd32;
  text-shadow: 1px 1px 3px #000;
  text-align: center;
}

/* ===== XP GADGET TEXT OVERRIDES ===== */
[data-theme="winxp"] .gadget-inner {
  --text:      #e0e6ee;
  --text-dim:  #8a9bb0;
  --accent:    #4a90d9;
  --accent2:   #3070b8;
  --accent3:   #6aace0;
  --border:    rgba(100, 140, 190, 0.3);
  --surface:   rgba(30, 45, 65, 0.6);
  --bg-card:   rgba(20, 30, 48, 0.7);
  background: rgba(20, 30, 48, 0.7);
  border-color: rgba(100, 140, 190, 0.3);
}
[data-theme="winxp"] .gadget-title {
  color: #4a90d9;
  border-bottom-color: rgba(100, 140, 190, 0.3);
}
[data-theme="winxp"] .gadget-coming {
  color: #8a9bb0;
}
[data-theme="winxp"] .gadget-btn {
  background: rgba(30, 45, 65, 0.6);
  color: #4a90d9;
  border-color: rgba(100, 140, 190, 0.3);
}

/* ===== VISTA OSRS GADGET OVERRIDES ===== */
[data-theme="vista"] .osrs-input,
[data-theme="vista"] .osrs-select {
  color: #222 !important;
}
[data-theme="vista"] .osrs-btn {
  background: linear-gradient(180deg, #5b4a1a 0%, #3a2e0f 100%) !important;
  border: 1px solid #ffd700 !important;
  color: #ffd700 !important;
  text-shadow: 1px 1px 2px #000;
}
[data-theme="vista"] .osrs-btn:hover {
  background: linear-gradient(180deg, #7a6420 0%, #4e3c14 100%) !important;
}
[data-theme="vista"] .osrs-btn::before,
[data-theme="vista"] .osrs-btn::after {
  display: none !important;
}

/* ===== THEME TOGGLE ===== */
.nav-logo-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 100%;
  padding: 0 0.5rem;
  flex-shrink: 0;
}

.nav-btn-projects {
  width: 24px;
  height: 100%;
  padding: 0;
  border: none;
  background: transparent;
  cursor: pointer;
  opacity: 1;
  flex-shrink: 0;
  position: relative;
  align-self: flex-end;
  -webkit-appearance: none;
  appearance: none;
}

.nav-btn-projects:hover { opacity: 1; }
.nav-btn-projects:active { opacity: 1; }

.nav-btn-lounge {
  width: 24px;
  height: 100%;
  padding: 0;
  border: none;
  background: transparent;
  cursor: pointer;
  opacity: 1;
  flex-shrink: 0;
  position: relative;
  align-self: flex-end;
  -webkit-appearance: none;
  appearance: none;
}

.nav-btn-lounge:hover { opacity: 1; }
.nav-btn-lounge:active { opacity: 1; }

/* Tab buttons container */
.nav-btns {
  display: flex;
  align-items: flex-end;
  gap: 5px;
  margin-left: 0;
  height: 100%;
  justify-self: center;
}

.nav-btn-wrap {
  position: relative;
  display: flex;
  align-items: flex-end;
  height: 50%;
}

.nav-tooltip {
  position: fixed;
  background: rgba(0, 0, 0, 0.78);
  color: #fff;
  font-family: 'Press Start 2P', monospace;
  font-size: 9px;
  letter-spacing: 0;
  white-space: nowrap;
  padding: 2px 5px;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.12s;
  z-index: 200;
  top: 0;
  left: 0;
  transform: none;
}

.nav-btn-wrap:hover .nav-tooltip {
  opacity: 1;
}

.nav-btn-gadgets {
  width: 24px;
  height: 100%;
  padding: 0;
  border: none;
  background: transparent;
  cursor: pointer;
  opacity: 1;
  flex-shrink: 0;
  position: relative;
  align-self: flex-end;
  -webkit-appearance: none;
  appearance: none;
}

.nav-btn-gadgets:hover {
  opacity: 1;
}

.nav-btn-gadgets:active {
  opacity: 1;
}

/* ===== NEUTRALISE LIBRARY GLOBALS (XP.css / vista.css) ===== */
/* These libraries set body/h/pre/a/select/scrollbar rules globally.
   We re-declare our own values so the site layout is unaffected. */
[data-theme="winxp"] body {
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 1rem;
  margin: 0;
  line-height: 1.6;
}

[data-theme="winxp"] h1 { font-size: 2.5rem; }
[data-theme="winxp"] h2 { font-size: 2.5rem; }
[data-theme="winxp"] h3 { font-size: 2rem; }
[data-theme="winxp"] h4 { font-size: 1.5rem; }

[data-theme="winxp"] a {
  color: var(--accent);
  text-decoration: none;
}
[data-theme="winxp"] a:focus { outline: none; }

[data-theme="winxp"] pre {
  background: transparent;
  box-shadow: none;
  margin: 0;
  padding: 0;
}

[data-theme="winxp"] select:focus {
  background-color: inherit;
  color: inherit;
}

/* ===== LIBRARY WINDOW FRAME OVERRIDES ===== */
/* Reset base .terminal styles that conflict with library window chrome.
   Libraries use box-shadow (XP) or border (vista.css) for the window frame,
   and .window-body margin to create the visible chrome gap. */

/* All windowed themes: stop clipping library chrome */
.terminal.window {
  overflow: visible;
}

/* XP: remove our base border and drop shadow —
   uses custom 3D beveled frame via box-shadow */
[data-theme="winxp"] .terminal.window {
  border: none;
  box-shadow: none;
  border-radius: 0;
}

/* ──── XP CMD: Windows Classic style ──── */

/* Flat silver frame with 3D beveled edges — no rounded corners, no gradients */
[data-theme="winxp"] .terminal.window {
  background: #E0E9D7;
  padding: 3px;
  /* Classic 3D raised outer bevel */
  box-shadow:
    inset -1px -1px #0a0a0a,
    inset 1px 1px #ffffff,
    inset -2px -2px #808080,
    inset 2px 2px #E0E9D7 !important;
}

/* Classic title bar: XP Classic gradient — darker navy base, brighter blue end */
[data-theme="winxp"] .terminal .title-bar {
  background: linear-gradient(90deg, #0258e1, #3c91ff);
  border: none;
  border-radius: 0;
  height: auto;
  min-height: 27px;
  padding: 3px 4px 3px 3px;
  font-size: 14px;
  font-family: "Pixelated MS Sans Serif", Arial, sans-serif;
  font-weight: 700;
  text-shadow: none;
  box-shadow: none;
}

[data-theme="winxp"] .terminal .title-bar-text {
  display: flex;
  align-items: center;
  gap: 4px;
  font-family: inherit;
  font-size: inherit;
  font-weight: inherit;
  margin-left: 0;
}

[data-theme="winxp"] .terminal .title-bar-icon {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  image-rendering: pixelated;
}

/* Classic control buttons: taller, 3D beveled, with icon glyphs */
[data-theme="winxp"] .terminal .title-bar-controls {
  gap: 0;
  display: flex;
  align-items: center;
  margin-right: -2px;
}
[data-theme="winxp"] .terminal .title-bar-controls button {
  width: 20px;
  height: 25px;
  min-width: unset;
  min-height: unset;
  background-color: #E0E9D7;
  background-image: none !important;
  border-radius: 0;
  border: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 !important;
  margin: 0;
  box-sizing: border-box;
  -webkit-appearance: none;
  appearance: none;
  box-shadow:
    inset -1px -1px #0a0a0a,
    inset 1px 1px #ffffff,
    inset -2px -2px #808080,
    inset 2px 2px #E0E9D7 !important;
}
[data-theme="winxp"] .terminal .title-bar-controls button svg {
  display: block;
  width: 12px;
  height: 12px;
  flex-shrink: 0;
}
[data-theme="winxp"] .terminal .title-bar-controls button::after {
  content: none !important;
}

/* Sunken 3D inset around terminal content — zero margin so no extra silver gap */
[data-theme="winxp"] .terminal.window .window-body {
  margin: 1px;
  border: none;
  box-shadow:
    inset -1px -1px #ffffff,
    inset 1px 1px #808080,
    inset -2px -2px #E0E9D7,
    inset 2px 2px #0a0a0a;
  background: #000;
}

/* Terminal text area */
[data-theme="winxp"] .terminal.window .terminal-body {
  background: #000;
  padding: 1px !important;
}

/* Vista: transparent window so backdrop-filter blurs the real page content behind it.
   The glass tint comes from ::before; the window itself must be transparent. */
[data-theme="vista"] .terminal.window {
  background: transparent;
}

[data-theme="vista"] .terminal.window.glass::after {
  -webkit-backdrop-filter: blur(14px) saturate(1.4);
  backdrop-filter: blur(14px) saturate(1.4);
}

/* Replace ::before's solid blue fill with a barely-there tint, keep opacity:1,
   and match its inset white edge to the title bar's brightness */
[data-theme="vista"] .terminal.window.glass::before {
  background: rgba(69, 128, 196, 0.1);
  opacity: 1;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.87);
}

/* Fix: library uses background-attachment:fixed on the title bar glass texture,
   which makes the shine/glare stay fixed in viewport coords while dragging.
   Override to scroll so the effect moves with the window. */
[data-theme="vista"] .terminal.window.glass > .title-bar {
  background-attachment: scroll;
}

/* Restore title-bar padding that the universal reset (* {padding:0}) clobbers
   from the layered library. Gives the bar proper height and breathing room. */
[data-theme="vista"] .terminal .title-bar {
  padding: 0 6px 6px;
}

/* Round the bottom corners of the controls container so they don't cause
   a sharp edge against the window's rounded top-right corner.
   Pin to top so it sits flush against the title-bar edge. */
[data-theme="vista"] .terminal .title-bar-controls {
  border-radius: 0 0 5px 5px;
}
[data-theme="vista"] .terminal .title-bar-controls button {
  min-height: 17px;
  height: 17px;
}

/* Title bar: draggable cursor */
.terminal .title-bar,
.terminal .linux-titlebar {
  cursor: grab;
  user-select: none;
}
.terminal .title-bar:active,
.terminal .linux-titlebar:active {
  cursor: grabbing;
}
.terminal-dragging,
.terminal-dragging .title-bar,
.terminal-dragging .linux-titlebar {
  cursor: grabbing !important;
}

/* Disable the title-bar control buttons (purely decorative) */
.terminal .title-bar-controls button {
  pointer-events: none;
}

/* The .window-body wraps .terminal-body.
   Keep the library's margin (creates the visible chrome gap) —
   only override background and padding. */
.terminal.window .window-body {
  padding: 0;
  background: var(--terminal-bg);
}

/* Terminal content inside the window */
.terminal.window .terminal-body {
  background: var(--terminal-bg);
  color: var(--terminal-text);
  font-family: var(--font-mono);
  font-size: 0.875rem;
  line-height: 1.55;
}

/* XP: CP437 DOS font — crisp pixel rendering, classic cmd.exe sizing */
[data-theme="winxp"] .terminal.window .terminal-body {
  font-family: "Perfect DOS VGA 437 Win", monospace;
  font-size: 16px;  /* native bitmap size for PerfectDOSVGA437 (8x16 cell) */
  line-height: 1.0;
  letter-spacing: 0;
  padding: 4px 8px;
  -webkit-font-smoothing: none;
  -moz-osx-font-smoothing: unset;
  font-smooth: never;
  text-rendering: optimizeSpeed;
  height: calc(25 * 16px + 8px); /* 25 rows + padding */
  min-height: unset;
  overflow-y: scroll;
  overflow-x: hidden;
}

/* XP scrollbar: custom HTML scrollbar (native overlay scrollbars ignore webkit pseudos) */
[data-theme="winxp"] .terminal.window .terminal-body {
  scrollbar-width: none;     /* Firefox: hide native */
}
[data-theme="winxp"] .terminal.window .terminal-body::-webkit-scrollbar {
  display: none;             /* Chrome: hide native */
}

/* XP custom scrollbar container */
.xp-scrollbar {
  display: none;
  position: absolute;
  top: 0;
  right: 0;
  width: 16px;
  height: 100%;
  flex-shrink: 0;
  z-index: 10;
}
[data-theme="winxp"] .xp-scrollbar { display: flex; flex-direction: column; }

/* Checkerboard track */
.xp-scrollbar-track {
  flex: 1;
  position: relative;
  background: #dfdfdf;
}

/* 3D raised beveled button base */
.xp-scrollbar-btn,
.xp-scrollbar-thumb {
  width: 16px;
  background-color: #E0E9D7;
  box-shadow: inset -1px -1px #0a0a0a, inset 1px 1px #fff, inset -2px -2px grey, inset 2px 2px #E0E9D7;
  flex-shrink: 0;
}
.xp-scrollbar-btn:active,
.xp-scrollbar-thumb:active {
  box-shadow: inset 1px 1px #0a0a0a, inset -1px -1px #fff;
}

.xp-scrollbar-btn {
  height: 17px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: default;
}

/* Arrows drawn via CSS borders */
.xp-scrollbar-btn-up .xp-arrow {
  width: 0; height: 0;
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  border-bottom: 4px solid #000;
  margin-top: 1px;
}
.xp-scrollbar-btn-down .xp-arrow {
  width: 0; height: 0;
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  border-top: 4px solid #000;
  margin-bottom: 1px;
}

.xp-scrollbar-thumb {
  position: absolute;
  left: 0;
  min-height: 20px;
  cursor: default;
}

/* Adjust terminal-body to leave room for the custom scrollbar */
[data-theme="winxp"] .terminal.window .window-body {
  position: relative;
}
[data-theme="winxp"] .terminal.window .terminal-body {
  padding-right: 24px; /* 8px original + 16px scrollbar */
}

/* XP: classic cmd.exe light gray, no color coding */
[data-theme="winxp"] .terminal.window .terminal-body,
[data-theme="winxp"] .terminal.window .terminal-body * {
  color: #c0c0c0 !important;
}

/* Vista: slightly larger terminal font */
[data-theme="vista"] .terminal.window .terminal-body {
  font-size: 0.925rem;
}

/* Default: tighter padding inside linux frame */
[data-theme="default"] .terminal.linux-frame .terminal-body {
  padding: 6px 10px;
  overflow-y: scroll;
  line-height: 22px;
}

/* Vista: same fixed-size, scrollable, DOS-font terminal body as XP */
[data-theme="vista"] .terminal.window .terminal-body {
  font-family: "Perfect DOS VGA 437 Win", monospace;
  font-size: 16px;
  line-height: 1.0;
  letter-spacing: 0;
  padding: 4px 8px 4px 0;
  -webkit-font-smoothing: none;
  -moz-osx-font-smoothing: unset;
  font-smooth: never;
  text-rendering: optimizeSpeed;
  height: calc(25 * 16px + 8px);
  min-height: unset;
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: none;
}
[data-theme="vista"] .terminal.window .terminal-body::-webkit-scrollbar {
  display: none;
}

/* Vista: classic cmd.exe silver-gray text */
[data-theme="vista"] .terminal.window .terminal-body,
[data-theme="vista"] .terminal.window .terminal-body * {
  color: #c0c0c0 !important;
}

/* Vista scrollbar: custom HTML scrollbar matching 7.css aesthetic */
.vista-scrollbar {
  display: none;
  position: absolute;
  top: 0;
  right: 0;
  width: 16px;
  height: 100%;
  flex-shrink: 0;
  z-index: 10;
}
[data-theme="vista"] .vista-scrollbar { display: flex; flex-direction: column; }

[data-theme="vista"] .terminal.window .window-body {
  position: relative;
  margin: 0 6px 6px;    /* restore glass chrome gap (layer reset clobbers library margin) */
}
[data-theme="vista"] .terminal.window .terminal-body {
  padding-right: 24px; /* 8px original + 16px scrollbar */
}

/* Vista scrollbar track */
.vista-scrollbar-track {
  flex: 1;
  position: relative;
  background: linear-gradient(to right, #e5e5e5, #f0f0f0 20%);
}

/* Vista scrollbar buttons & thumb – 7.css / Win 7 style */
.vista-scrollbar-btn,
.vista-scrollbar-thumb {
  width: 16px;
  background-color: #f2f2f2;
  background-image: linear-gradient(to right, #f2f2f2 45%, #ebebeb 45%, #cfcfcf);
  border: 1px solid #8e8f8f;
  border-radius: 3px;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.8);
  box-sizing: border-box;
  flex-shrink: 0;
}
.vista-scrollbar-btn:hover,
.vista-scrollbar-thumb:hover {
  background-image: linear-gradient(to right, #eaf6fd 45%, #bee6fd 45%, #a7d9f5);
  border-color: #3c7fb1;
}
.vista-scrollbar-btn:active,
.vista-scrollbar-thumb:active,
.vista-scrollbar-thumb.dragging {
  background-image: linear-gradient(to right, #c4e5f6 45%, #98d1ef 45%);
  border-color: #6d91ab;
  box-shadow: inset 1px 1px 0 rgba(0, 0, 0, 0.2), inset -1px 1px 0 rgba(0, 0, 0, 0.07);
}

.vista-scrollbar-btn {
  height: 17px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: default;
}

/* Vista arrow buttons use the same SVG arrows as 7.css */
.vista-scrollbar-btn-up {
  background-image: url("data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTYiIGhlaWdodD0iMTciIGZpbGw9Im5vbmUiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PGRlZnM+PGxpbmVhckdyYWRpZW50IGlkPSJhIiB4MT0iMCUiIHkxPSIwJSIgeDI9IjEwMCUiIHkyPSIwJSI+PHN0b3Agb2Zmc2V0PSIwJSIgc3R5bGU9InN0b3AtY29sb3I6IzMzMztzdG9wLW9wYWNpdHk6MSIvPjxzdG9wIG9mZnNldD0iMTAwJSIgc3R5bGU9InN0b3AtY29sb3I6I2FhYTtzdG9wLW9wYWNpdHk6MSIvPjwvbGluZWFyR3JhZGllbnQ+PC9kZWZzPjxwYXRoIGQ9Ik04IDZIN3YxSDZ2MUg1djFINHYxaDdWOWgtMVY4SDlWN0g4VjZaIiBmaWxsPSJ1cmwoI2EpIi8+PC9zdmc+"), linear-gradient(to right, #f2f2f2 45%, #ebebeb 45%, #cfcfcf);
  background-repeat: no-repeat;
  background-position: center, 0 0;
  background-size: auto, 100% 100%;
}
.vista-scrollbar-btn-up:hover {
  background-image: url("data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTYiIGhlaWdodD0iMTciIGZpbGw9Im5vbmUiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PGRlZnM+PGxpbmVhckdyYWRpZW50IGlkPSJhIiB4MT0iMCUiIHkxPSIwJSIgeDI9IjEwMCUiIHkyPSIwJSI+PHN0b3Agb2Zmc2V0PSIwJSIgc3R5bGU9InN0b3AtY29sb3I6IzMzMztzdG9wLW9wYWNpdHk6MSIvPjxzdG9wIG9mZnNldD0iMTAwJSIgc3R5bGU9InN0b3AtY29sb3I6I2FhYTtzdG9wLW9wYWNpdHk6MSIvPjwvbGluZWFyR3JhZGllbnQ+PC9kZWZzPjxwYXRoIGQ9Ik04IDZIN3YxSDZ2MUg1djFINHYxaDdWOWgtMVY4SDlWN0g4VjZaIiBmaWxsPSJ1cmwoI2EpIi8+PC9zdmc+"), linear-gradient(to right, #eaf6fd 45%, #bee6fd 45%, #a7d9f5);
}
.vista-scrollbar-btn-up:active {
  background-image: url("data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTYiIGhlaWdodD0iMTciIGZpbGw9Im5vbmUiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PGRlZnM+PGxpbmVhckdyYWRpZW50IGlkPSJhIiB4MT0iMCUiIHkxPSIwJSIgeDI9IjEwMCUiIHkyPSIwJSI+PHN0b3Agb2Zmc2V0PSIwJSIgc3R5bGU9InN0b3AtY29sb3I6IzMzMztzdG9wLW9wYWNpdHk6MSIvPjxzdG9wIG9mZnNldD0iMTAwJSIgc3R5bGU9InN0b3AtY29sb3I6I2FhYTtzdG9wLW9wYWNpdHk6MSIvPjwvbGluZWFyR3JhZGllbnQ+PC9kZWZzPjxwYXRoIGQ9Ik04IDZIN3YxSDZ2MUg1djFINHYxaDdWOWgtMVY4SDlWN0g4VjZaIiBmaWxsPSJ1cmwoI2EpIi8+PC9zdmc+"), linear-gradient(to right, #c4e5f6 45%, #98d1ef 45%);
}

.vista-scrollbar-btn-down {
  background-image: url("data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTYiIGhlaWdodD0iMTciIGZpbGw9Im5vbmUiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PGRlZnM+PGxpbmVhckdyYWRpZW50IGlkPSJhIiB4MT0iMCUiIHkxPSIwJSIgeDI9IjEwMCUiIHkyPSIwJSI+PHN0b3Agb2Zmc2V0PSIwJSIgc3R5bGU9InN0b3AtY29sb3I6IzMzMztzdG9wLW9wYWNpdHk6MSIvPjxzdG9wIG9mZnNldD0iMTAwJSIgc3R5bGU9InN0b3AtY29sb3I6I2FhYTtzdG9wLW9wYWNpdHk6MSIvPjwvbGluZWFyR3JhZGllbnQ+PC9kZWZzPjxwYXRoIGQ9Ik0xMSA2SDR2MWgxdjFoMXYxaDF2MWgxVjloMVY4aDFWN2gxVjZaIiBmaWxsPSJ1cmwoI2EpIi8+PC9zdmc+"), linear-gradient(to right, #f2f2f2 45%, #ebebeb 45%, #cfcfcf);
  background-repeat: no-repeat;
  background-position: center, 0 0;
  background-size: auto, 100% 100%;
}
.vista-scrollbar-btn-down:hover {
  background-image: url("data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTYiIGhlaWdodD0iMTciIGZpbGw9Im5vbmUiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PGRlZnM+PGxpbmVhckdyYWRpZW50IGlkPSJhIiB4MT0iMCUiIHkxPSIwJSIgeDI9IjEwMCUiIHkyPSIwJSI+PHN0b3Agb2Zmc2V0PSIwJSIgc3R5bGU9InN0b3AtY29sb3I6IzMzMztzdG9wLW9wYWNpdHk6MSIvPjxzdG9wIG9mZnNldD0iMTAwJSIgc3R5bGU9InN0b3AtY29sb3I6I2FhYTtzdG9wLW9wYWNpdHk6MSIvPjwvbGluZWFyR3JhZGllbnQ+PC9kZWZzPjxwYXRoIGQ9Ik0xMSA2SDR2MWgxdjFoMXYxaDF2MWgxVjloMVY4aDFWN2gxVjZaIiBmaWxsPSJ1cmwoI2EpIi8+PC9zdmc+"), linear-gradient(to right, #eaf6fd 45%, #bee6fd 45%, #a7d9f5);
}
.vista-scrollbar-btn-down:active {
  background-image: url("data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTYiIGhlaWdodD0iMTciIGZpbGw9Im5vbmUiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PGRlZnM+PGxpbmVhckdyYWRpZW50IGlkPSJhIiB4MT0iMCUiIHkxPSIwJSIgeDI9IjEwMCUiIHkyPSIwJSI+PHN0b3Agb2Zmc2V0PSIwJSIgc3R5bGU9InN0b3AtY29sb3I6IzMzMztzdG9wLW9wYWNpdHk6MSIvPjxzdG9wIG9mZnNldD0iMTAwJSIgc3R5bGU9InN0b3AtY29sb3I6I2FhYTtzdG9wLW9wYWNpdHk6MSIvPjwvbGluZWFyR3JhZGllbnQ+PC9kZWZzPjxwYXRoIGQ9Ik0xMSA2SDR2MWgxdjFoMXYxaDF2MWgxVjloMVY4aDFWN2gxVjZaIiBmaWxsPSJ1cmwoI2EpIi8+PC9zdmc+"), linear-gradient(to right, #c4e5f6 45%, #98d1ef 45%);
}

/* Vista scrollbar thumb */
.vista-scrollbar-thumb {
  position: absolute;
  left: 0;
  min-height: 20px;
  cursor: default;
}

/* Vista: nudge title bar text away from left edge */
[data-theme="vista"] .terminal .title-bar-text {
  padding-left: 4px;
  padding-top: 6px;
  display: flex;
  align-items: center;
  gap: 4px;
}

[data-theme="vista"] .terminal .title-bar-icon {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  image-rendering: pixelated;
}

/* Hide CRT effects (scanlines, sweep, snow) on all OS themes */
[data-theme="winxp"] .scanlines,
[data-theme="vista"] .scanlines { display: none; }

[data-theme="winxp"] #particles,
[data-theme="vista"] #particles { display: none; }

[data-theme="vista"] .gadgets-header h1 {
  background: linear-gradient(135deg, #4a90d9, #3070b8);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* ===== TERMINAL CONTEXT MENU ===== */
.terminal-ctx-menu {
  position: absolute;
  z-index: 9999;
  background: #1e1e21;
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 0.25rem 0;
  min-width: 180px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.5);
  font-family: var(--font-mono);
  font-size: 0.75rem;
}

.terminal-ctx-item {
  padding: 0.4rem 0.75rem;
  color: #c8c8cc;
  cursor: pointer;
  transition: background 0.15s;
}

.terminal-ctx-item:hover {
  background: var(--accent2);
  color: #d0d0d4;
}

/* ===== RESPONSIVE ===== */
/* ===== PROJECTS PAGE ===== */
.projects-page {
  position: relative;
  z-index: 1;
  height: 100vh;
  padding: var(--bar-h) 0 var(--bar-h);
  box-sizing: border-box;
}

.projects-layout {
  display: flex;
  height: 100%;
  overflow: hidden;
}

.projects-sidebar {
  width: 240px;
  min-width: 240px;
  height: 100%;
  overflow-y: auto;
  border-right: 1px solid rgba(255,255,255,0.08);
  background: rgba(20, 22, 28, 0.6);
  padding: 1.5rem 0;
  font-family: var(--font-mono);
  font-size: 0.8rem;
}

.projects-sidebar-heading {
  padding: 0.4rem 1.2rem;
  color: var(--text-dim);
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  user-select: none;
}

.projects-sidebar-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.45rem 1.2rem;
  color: #8a9bb0;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  user-select: none;
}
.projects-sidebar-item:hover {
  background: rgba(255,255,255,0.04);
  color: #c0d0e0;
}
.projects-sidebar-item.active {
  background: rgba(100, 140, 200, 0.12);
  color: #c8daf0;
}

.projects-sidebar-icon {
  font-size: 0.75rem;
  width: 1rem;
  text-align: center;
  flex-shrink: 0;
}

.projects-sidebar-sub {
  padding-left: 1rem;
}
.projects-sidebar-sub .projects-sidebar-item {
  padding-left: 2rem;
  font-size: 0.75rem;
}

.projects-content {
  flex: 1;
  height: 100%;
  overflow-y: auto;
  padding: 2rem 2.5rem;
  position: relative;
}

.project-divider {
  border: none;
  border-top: 1px solid rgba(255,255,255,0.08);
  margin: 2.5rem 0;
}

.projects-scroll-hint {
  position: sticky;
  bottom: 0;
  left: 0;
  right: 0;
  display: flex;
  justify-content: center;
  padding: 1.2rem 0;
  pointer-events: none;
}
.projects-scroll-hint .scroll-arrow {
  width: 24px;
  height: 14px;
  background: none;
  border: none;
  position: relative;
  animation: fade-bob 3s ease-in-out infinite;
}
.projects-scroll-hint .scroll-arrow::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 14'%3E%3Cpolyline points='2,2 12,12 22,2' fill='none' stroke='rgba(180,195,215,0.6)' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-size: contain;
  background-repeat: no-repeat;
}


.projects-placeholder {
  color: var(--text-dim);
  font-family: var(--font-mono);
  font-size: 0.85rem;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.project-slide {
  animation: projectFadeIn 0.3s ease;
}
@keyframes projectFadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

.project-slide h2 {
  font-size: 1.5rem;
  font-weight: 600;
  margin: 0 0 0.3rem;
  color: #d0dce8;
}

.project-slide .project-subtitle {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-dim);
  margin-bottom: 1.5rem;
}

.project-slide .project-desc {
  font-family: var(--font-mono);
  font-size: 0.82rem;
  color: #9aacbe;
  line-height: 1.6;
  margin-bottom: 1.5rem;
  max-width: 700px;
}

.project-images {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(600px, 1fr));
  gap: 1rem;
}

/* Comparison slider + side stack layout */
.project-compare-layout {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.project-compare-wrap {
  overflow: hidden;
  border-radius: 6px;
}

.project-compare {
  position: relative;
  width: 100%;
  overflow: hidden;
  cursor: ew-resize;
  user-select: none;
  container-type: inline-size;
}

.project-compare-after {
  display: block;
  width: 100%;
  transform: scale(1.22);
}

.project-compare-before {
  position: absolute;
  top: 0;
  left: 0;
  width: 5%;
  height: 100%;
  overflow: hidden;
}
.project-compare-before img {
  display: block;
  width: 100cqi;
  height: 100%;
  object-fit: cover;
  object-position: center;
  position: absolute;
  top: 0;
  left: 0;
  transform: scale(1.22);
}

.project-compare-slider {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 5%;
  width: 3px;
  background: rgba(255,255,255,0.7);
  cursor: ew-resize;
  z-index: 2;
  transform: translateX(-50%);
}
.project-compare-handle {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(30,35,45,0.85);
  border: 2px solid rgba(255,255,255,0.6);
  display: flex;
  align-items: center;
  justify-content: center;
}
.project-compare-handle::before {
  content: '\25C0\25B6';
  font-size: 9px;
  color: rgba(255,255,255,0.7);
  letter-spacing: 2px;
}



.project-side-stack {
  display: grid;
  grid-template-rows: 1fr 1fr;
  gap: 1rem;
  overflow: hidden;
  height: 0;
  min-height: 100%;
}
.project-side-stack .project-img-wrap {
  min-height: 0;
  overflow: hidden;
  border: none;
  background: none;
}
.project-side-stack .project-img-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 6px;
}

.project-img-wrap {
  border-radius: 6px;
  overflow: hidden;
  border: 1px solid rgba(255,255,255,0.06);
  background: rgba(0,0,0,0.3);
}

.project-img-wrap img {
  width: 100%;
  display: block;
  cursor: pointer;
  transition: transform 0.2s ease;
}
.project-img-wrap img:hover {
  transform: scale(1.02);
}

.project-img-caption {
  display: none;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--text-dim);
  padding: 0.4rem 0.6rem;
}

/* Projects lightbox */
.project-lightbox {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: rgba(0,0,0,0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: zoom-out;
  animation: projectFadeIn 0.2s ease;
}
.project-lightbox img {
  max-width: 90vw;
  max-height: 90vh;
  border-radius: 4px;
  box-shadow: 0 4px 40px rgba(0,0,0,0.6);
}

@media (max-width: 768px) {
  .projects-sidebar { width: 180px; min-width: 180px; }
  .projects-content { padding: 1.5rem 1rem; }
  .project-images { grid-template-columns: 1fr; }
  .project-compare-layout { grid-template-columns: 1fr; }
  .nav-status { display: none; }
}

@media (max-width: 480px) {
  :root { --bar-h: 3rem; }
  .projects-layout { flex-direction: column; }
  .projects-sidebar {
    width: 100%; min-width: unset;
    height: auto; max-height: 35vh;
    border-right: none;
    border-bottom: 1px solid rgba(255,255,255,0.08);
  }
  #nav { padding: 0 1rem; }
  .nav-logo-img { height: 1.2rem; }
  .terminal { width: 95vw; }
  .terminal-body { font-size: 0.8rem; padding: 1rem; }
}

/* ===== WEBAMP ISOLATION ===== */
/* Theme CSS libraries (XP.css, vista.css) are loaded inside
   @layer(theme-lib), giving them lowest author priority.
   These :where() resets (unlayered, zero-ID specificity) neutralise
   residual library properties on Webamp elements without fighting
   Webamp's own higher-specificity #webamp-scoped rules. */
:where(#webamp) .window {
  box-shadow: none;
  background: transparent;
  padding: 0;
  border-radius: 0;
  font-size: inherit;
  -webkit-font-smoothing: auto;
}
:where(#webamp) .title-bar {
  font-family: inherit;
  background: none;
  border: none;
  border-radius: 0;
  padding: 0;
  height: auto;
  text-shadow: none;
  display: block;
}
:where(#webamp) button {
  font-family: inherit;
  font-size: inherit;
  box-sizing: content-box;
  border: none;
  background: none;
  box-shadow: none;
  border-radius: 0;
  -webkit-font-smoothing: auto;
}
:where(#webamp) select {
  border: none;
  background-image: none;
  height: auto;
  -webkit-font-smoothing: auto;
}
:where(#webamp) input {
  border: none;
  height: auto;
  -webkit-font-smoothing: auto;
}

/* ===== PLAY MODE (3D) ===== */
.play-overlay {
  position: absolute;
  inset: 0;
  background: #000;
  opacity: 0;
  z-index: 9999;
  transition: opacity 1.2s ease;
  pointer-events: none;
}
.play-overlay.active {
  opacity: 1;
}
.play-canvas {
  position: absolute;
  inset: 0;
  width: 100% !important;
  height: 100% !important;
  z-index: 100;
  outline: none;
}

