.theme-dark {
  --background-color: #1a1b26;
  --surface-color: #20212e;
  --accent-color: #7dcfff;
  --text-color: #c0caf5;
  --muted-text: #7a82ad;
  --ascii-color: #bb9af7;
  --footer-color: #c0caf5;
  --prompt-color: #9ece6a;
  --link-color: #7aa2f7;
  --suggestion-color: #7a82ad;
  --border-color: rgba(125, 207, 255, 0.25);
  --pill-bg: rgba(125, 207, 255, 0.08);
  --pill-hover-text: var(--background-color);
}

.theme-light {
  /* Solarized-light inspired palette: warm parchment background, not plain white */
  --background-color: #fdf6e3;
  --surface-color: #f3ecd8;
  --accent-color: #2272b4;
  --text-color: #43525a;
  --muted-text: #8a9597;
  --ascii-color: #6c4fc4;
  --footer-color: #43525a;
  --prompt-color: #5a7a00;
  --link-color: #1f95a3;
  --suggestion-color: #8a9597;
  --border-color: rgba(34, 114, 180, 0.3);
  --pill-bg: rgba(34, 114, 180, 0.07);
  --pill-hover-text: #fdf6e3;
}

* {
  box-sizing: border-box;
}
html,
body {
  height: 100%;
  margin: 0;
  font-family: "JetBrains Mono", monospace;
  color: var(--text-color);
  overflow: hidden;
  user-select: none;
  transition:
    background-color 0.3s ease,
    color 0.3s ease;
}

html {
  background: var(--background-color);
}

body {
  display: flex;
  flex-direction: column;
  background: var(--background-color);
}

/* THREE DEMO 2: ambient particle field. A solid opaque body background sits
   behind all themed content, so instead of fighting that stacking order the
   canvas renders on top at very low opacity with pointer-events disabled —
   dust drifting over the page rather than a true background layer. */
#three-bg-canvas {
  position: fixed;
  inset: 0;
  z-index: 5000;
  display: block;
  width: 100%;
  height: 100%;
  opacity: 0.35;
  pointer-events: none;
}

a {
  color: var(--link-color);
  text-decoration: none;
}
a:hover {
  text-decoration: underline;
}

.header {
  border-bottom: 1px solid var(--border-color);
  color: var(--accent-color);
}

.headerContainer {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 16px;
  width: 100%;
}

.header-left,
.header-right {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
  flex: 0 0 auto;
}

.icon-btn {
  border: 0;
  background: transparent;
  color: inherit;
  padding: 0;
  cursor: pointer;
  opacity: 0.75;
  font: inherit;
  font-size: 16px;
  transition:
    opacity 0.15s ease,
    transform 0.15s ease;
}

.icon-btn:hover {
  opacity: 1;
}

.theme-toggle:hover {
  transform: rotate(15deg);
}
.fullscreen-toggle:hover {
  transform: scale(1.1);
}

.hamburger-toggle {
  display: none;
  font-size: 18px;
}

#datetime {
  font-size: 13px;
  opacity: 0.65;
  white-space: nowrap;
  cursor: pointer;
}

.info-content h1 {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

/* Nav: sits centered in the header on desktop, collapses to a dropdown on small screens */
.pill-nav {
  display: flex;
  flex: 1 1 auto;
  justify-content: center;
  padding-top: 10px;
  flex-wrap: wrap;
  gap: 0.5rem;
  min-width: 0;
}

.pill-nav-btn {
  font: inherit;
  font-size: 13px;
  letter-spacing: 0.02em;
  cursor: pointer;
  padding: 0.45rem 1rem;
  border-radius: 7px;
  border: 1px solid var(--border-color);
  background: transparent;
  color: var(--text-color);
  transition:
    background-color 0.15s ease,
    border-color 0.15s ease,
    color 0.15s ease,
    transform 0.1s ease;
}

.pill-nav-btn:hover {
  border-color: var(--accent-color);
  color: var(--accent-color);
  background: var(--pill-bg);
}

.pill-nav-btn:active {
  transform: scale(0.97);
}

main {
  flex: 1;
  overflow-y: auto;
  padding: 25px;
  margin: 3px;
}

main::-webkit-scrollbar {
  width: 8px;
}
main::-webkit-scrollbar-thumb {
  background: var(--accent-color);
  border-radius: 4px;
}

.neofetch-panel {
  display: flex;
  flex-wrap: wrap;
  gap: 36px;
  align-items: center;
  padding: 10px 0 24px;
  width: 100%;
}

.ascii-logo {
  font-size: 2.8px;
  line-height: 1;
  margin: 0;
  white-space: pre;
  overflow: auto;
  color: var(--ascii-color);
  flex: 0 0 auto;
}

/* THREE DEMO 1: rotating wireframe H, swapped in for .ascii-logo once
   three.js loads — same flex slot, fixed pixel size. */
.ascii-logo-3d {
  width: 160px;
  height: 160px;
  flex: 0 0 auto;
}

.neofetch-info {
  display: grid;
  grid-template-columns: 1fr;
  gap: 4px 32px;
  font-size: 14px;
  line-height: 1.6;
  flex: 1 1 280px;
  min-width: 0;
}

.neofetch-headline,
.neofetch-sep,
.neofetch-swatches {
  grid-column: 1 / -1;
}
.neofetch-headline {
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 2px;
}
.nf-user {
  color: var(--prompt-color);
}
.nf-at {
  color: var(--muted-text);
}
.nf-host {
  color: var(--link-color);
}
.nf-key {
  color: var(--accent-color);
  font-weight: 700;
}
.neofetch-sep {
  color: var(--muted-text);
}

.neofetch-swatches {
  display: flex;
  gap: 6px;
  margin-top: 10px;
}

.swatch {
  width: 22px;
  height: 14px;
  border-radius: 3px;
  display: inline-block;
}

.command-terminal,
.command-terminal * {
  font-family: "JetBrains Mono", monospace;
}

.command-terminal {
  margin: 20px;
  font-size: 14px;
  user-select: text;
}

.command-line {
  display: flex;
  gap: 6px;
  white-space: pre-wrap;
  word-break: break-word;
}

.prompt {
  color: var(--prompt-color);
  font-weight: 700;
}
.user-input {
  outline: none;
  flex: 1;
  min-width: 1px;
  user-select: text;
  color: var(--text-color);
}

.terminal-output-line {
  margin-bottom: 14px;
  overflow-x: auto;
  white-space: pre-wrap;
}

.terminal-output-line pre {
  margin: 1px 3px;
  line-height: 1.4;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.suggestion-output {
  color: var(--suggestion-color);
  font-style: italic;
  white-space: pre;
}

.response-title {
  display: block;
  font-weight: 700;
  margin-bottom: 2px;
  color: var(--accent-color);
}
.response-subtitle {
  display: block;
  font-size: 13px;
  margin: 6px 0;
  text-decoration: underline;
  color: var(--ascii-color);
}

.tech-tag {
  display: inline-block;
  border: 1px solid var(--border-color);
  background: var(--pill-bg);
  color: var(--link-color);
  border-radius: 999px;
  padding: 1px 8px;
  font-size: 12px;
  margin: 2px 3px 2px 0;
}

/* help command output — flat list spread horizontally, wrapping on narrow screens */
.help-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 1rem;
  margin: 0.4rem 3px 0;
}

.help-item {
  color: var(--accent-color);
  font-weight: 700;
}

/* ls command output — spread across the full width like a real ls -C grid */
.ls-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 0.5rem 1.5rem;
  margin: 0.4rem 3px 0;
}

.ls-item {
  color: var(--link-color);
}

/* fzf command — interactive project finder: query bar, list + preview, key hints */
.terminal-output-line.fzf {
  white-space: normal;
  overflow: hidden;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  background: var(--surface-color);
}

.fzf-query {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-bottom: 1px solid var(--border-color);
}

.fzf-input {
  flex: 1;
  min-width: 0;
  border: 0;
  outline: none;
  background: transparent;
  color: var(--text-color);
  font: inherit;
  caret-color: var(--accent-color);
}

.fzf-count,
.fzf-help,
.fzf-empty {
  color: var(--muted-text);
  font-size: 12px;
}

.fzf-body {
  display: grid;
  grid-template-columns: minmax(180px, 32%) 1fr;
  height: 17rem;
}

.fzf-list {
  list-style: none;
  margin: 0;
  padding: 6px 0;
  overflow-y: auto;
  border-right: 1px solid var(--border-color);
}

.fzf-item {
  padding: 3px 12px 3px 10px;
  border-left: 2px solid transparent;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: pointer;
}

.fzf-item.is-selected {
  border-left-color: var(--accent-color);
  background: var(--pill-bg);
  color: var(--accent-color);
}

.fzf-hit {
  background: none;
  color: var(--prompt-color);
  font-weight: 700;
}

.fzf-preview {
  padding: 10px 14px;
  overflow-y: auto;
  line-height: 1.5;
}

.fzf-preview .response-subtitle {
  margin-top: 0;
}

.fzf-desc {
  margin: 0 0 10px;
}

.fzf-links {
  margin-top: 10px;
}

.fzf-help {
  padding: 6px 12px;
  border-top: 1px solid var(--border-color);
}

.footer {
  border-top: 1px solid var(--border-color);
  color: var(--footer-color);
  text-align: center;
  font-size: 13px;
}

.copyright {
  margin: 5px;
}
.copyright-symbol {
  font-size: 20px;
  vertical-align: middle;
}

.hidden {
  display: none !important;
}

#cursor-morph {
  position: fixed;
  top: 0;
  left: 0;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--accent-color);
  pointer-events: none;
  z-index: 100001;
  transform: translate(-50%, -50%);
  transition:
    width 0.15s ease,
    height 0.15s ease,
    background-color 0.15s ease,
    border-color 0.15s ease;
  opacity: 0;
}

body.has-cursor-morph #cursor-morph {
  opacity: 1;
}

body.has-cursor-morph,
body.has-cursor-morph * {
  cursor: none !important;
}

#cursor-morph.cursor-morph-hover {
  width: 28px;
  height: 28px;
  background: transparent;
  border: 2px solid var(--accent-color);
}

#power-overlay {
  position: fixed;
  inset: 0;
  z-index: 100000;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--background-color);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.5s ease;
  overflow: hidden;
}

#power-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

/* THREE DEMO 4: particle sphere behind the shutdown/poweron sequence —
   collapses to a flickering point on shutdown, explodes back outward on
   poweron. Sits behind the text, which gets lifted onto its own layer. */
#power-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
}

#shutdown-messages,
#resume-messages {
  position: relative;
  z-index: 1;
}

#sleep-message,
#power-button-big,
#startup-bar {
  z-index: 1;
}

#shutdown-messages,
#resume-messages {
  white-space: pre-line;
  font-size: 1rem;
  line-height: 1.3;
  width: min(90%, 900px);
  color: var(--text-color);
}

#sleep-message {
  position: absolute;
  bottom: 40%;
  width: 100%;
  text-align: center;
  font-size: 1.3rem;
  letter-spacing: 2px;
  color: var(--ascii-color);
  white-space: pre-line;
}

#cursor,
.type-cursor {
  animation: blink 1s step-start infinite;
}

.proj-desc-more {
  cursor: pointer;
  opacity: 0.6;
  text-decoration: underline;
}

/* THREE DEMO 3: full-screen overlay for the "matrix" command's tunnel-fly
   scene, dismisses itself after a few seconds. */
.matrix-overlay {
  position: fixed;
  inset: 0;
  z-index: 100002;
  background: var(--background-color);
}
.matrix-overlay canvas {
  display: block;
  width: 100%;
  height: 100%;
}

#power-button-big {
  position: absolute;
  bottom: 20%;
  border: 0;
  background: transparent;
  color: var(--ascii-color);
  font-size: clamp(4rem, 8vw, 7rem);
  cursor: pointer;
  text-shadow:
    0 0 5px currentColor,
    0 0 10px currentColor;
}

#startup-bar {
  position: absolute;
  bottom: 12vh;
  width: min(80%, 680px);
  height: 10px;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  overflow: hidden;
}

#startup-bar .bar {
  width: 0;
  height: 100%;
  background: var(--ascii-color);
  transition: width 3s ease-out;
}

.slide-up {
  animation: slideUp 1s ease forwards;
}

@keyframes blink {
  50% {
    opacity: 0;
  }
}
@keyframes slideUp {
  from {
    transform: translateY(0);
    opacity: 1;
  }
  to {
    transform: translateY(-100%);
    opacity: 0;
  }
}

/* Desktop: spread the neofetch info across two columns to use the extra width */
@media (min-width: 993px) {
  .neofetch-info {
    grid-template-columns: repeat(2, minmax(240px, 1fr));
  }
}

@media (min-width: 1400px) {
  .ascii-logo {
    font-size: 3.1px;
  }
  .neofetch-info {
    grid-template-columns: repeat(3, minmax(220px, 1fr));
  }
}

@media (max-width: 992px) {
  .ascii-logo {
    font-size: 2.3px;
  }
  .neofetch-headline {
    font-size: 14px;
  }
}

/* Tablet/mobile: collapse the nav into a hamburger-triggered dropdown */
@media (max-width: 768px) {
  main {
    padding: 15px;
  }
  .command-terminal {
    margin: 15px;
  }
  .ascii-logo {
    font-size: 1.8px;
  }
  .neofetch-info {
    font-size: 12px;
  }
  #datetime {
    display: none;
  }

  .hamburger-toggle {
    display: inline-flex;
  }

  .pill-nav {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    flex-direction: column;
    align-items: stretch;
    background: var(--surface-color);
    border-bottom: 1px solid var(--border-color);
    padding: 0.75rem 1rem;
    gap: 0.4rem;
    z-index: 40;
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.25);
  }

  .pill-nav.nav-open {
    display: flex;
  }
  .pill-nav-btn {
    width: 100%;
    text-align: left;
  }
}

@media (min-width: 769px) {
  .hamburger-toggle {
    display: none;
  }
}

@media (max-width: 576px) {
  main {
    padding: 10px;
  }
  .command-terminal {
    margin: 10px;
  }
  .neofetch-panel {
    gap: 15px;
  }
  .ascii-logo {
    display: none;
  }
  .fullscreen-toggle {
    display: none;
  }
  .help-list {
    flex-direction: column;
  }
  .ls-grid {
    grid-template-columns: 1fr;
  }
  .fzf-body {
    grid-template-columns: 1fr;
    grid-template-rows: 9rem 1fr;
    height: 22rem;
  }
  .fzf-list {
    border-right: 0;
    border-bottom: 1px solid var(--border-color);
  }
}

@media (max-width: 420px) {
  .neofetch-info {
    font-size: 11px;
  }
}
