/* ─── CSS Variables ─── */
:root {
  --cyan:   #7ecfcf;
  --pink:   #c47fbe;
  --green:  #7abf6a;
  --yellow: #c4b96a;
  --bg:     #1a1a1a;
  --text:   #d4d4d4;
}

/* ─── Reset & Base ─── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

select, option {
  font-family: 'Share Tech Mono', 'Courier New', monospace;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: 60px;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Share Tech Mono', 'Courier New', monospace;
  font-size: 1.05rem;
  line-height: 1.75;
  padding-bottom: 0;
  overflow-x: hidden;
}

/* ─── Grid Background ─── */
.grid-bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(0,255,255,0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0,255,255,0.03) 1px, transparent 1px);
  background-size: 40px 40px;
}

.subpage .grid-bg {
  background-image:
    linear-gradient(rgba(0,255,255,0.012) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0,255,255,0.012) 1px, transparent 1px);
}

/* ─── Matrix Canvas ─── */
#matrix-canvas {
  position: fixed;
  inset: 0;
  z-index: 0;
  opacity: 0.07;
  pointer-events: none;
}

/* ─── CRT Overlay ─── */
.crt-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  pointer-events: none;
  background: repeating-linear-gradient(
    0deg,
    rgba(0,0,0,0.15) 0px,
    rgba(0,0,0,0.15) 1px,
    transparent 1px,
    transparent 4px
  );
  animation: crt-flicker 8s step-end infinite;
}

.crt-overlay::after {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at center, transparent 60%, rgba(0,0,0,0.6) 100%);
}

@keyframes crt-flicker {
  0%, 100% { opacity: 1; }
  92%       { opacity: 1; }
  93%       { opacity: 0.97; }
  94%       { opacity: 1; }
  96%       { opacity: 0.98; }
  97%       { opacity: 1; }
}

/* ─── Boot Screen ─── */
#boot-screen {
  position: fixed;
  inset: 0;
  z-index: 10000;
  background: var(--bg);
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 2rem 3rem;
  font-family: 'Share Tech Mono', monospace;
  font-size: 0.95rem;
  cursor: pointer;
  transition: opacity 0.8s ease;
}

#boot-screen.fade-out {
  opacity: 0;
  pointer-events: none;
}

.boot-line      { color: var(--green); white-space: pre; }
.boot-line.ok   { color: var(--cyan); }
.boot-line.warn { color: var(--yellow); }
.boot-line.err  { color: var(--pink); }

#boot-skip {
  position: absolute;
  bottom: 2rem;
  right: 3rem;
  color: var(--text);
  font-size: 0.75rem;
  opacity: 0.5;
}

/* ─── Site Wrapper ─── */
#site-wrapper {
  position: relative;
  visibility: hidden;
}

#site-wrapper.visible { visibility: visible; }

/* ─── Top Nav Bar ─── */
#topbar {
  position: sticky;
  top: 0;
  z-index: 1000;
  background: rgba(26,26,26,0.92);
  backdrop-filter: blur(4px);
  border-bottom: 1px solid rgba(126,207,207,0.25);
}

.topbar-inner {
  max-width: 960px;
  margin: 0 auto;
  padding: 0.5rem 1.5rem;
  display: flex;
  align-items: center;
  gap: 1.5rem;
  flex-wrap: wrap;
}

.topbar-logo {
  display: flex;
  align-items: center;
  flex-shrink: 0;
  opacity: 0.9;
  transition: opacity 0.2s;
  cursor: pointer;
}

.topbar-logo:hover { opacity: 1; }

nav { display: flex; gap: 1rem; flex-wrap: wrap; }

nav a {
  font-family: 'Share Tech Mono', monospace;
  font-size: 0.95rem;
  color: var(--text);
  text-decoration: none;
  padding: 4px 8px;
  border: 1px solid transparent;
  transition: color 0.2s, border-color 0.2s;
  white-space: nowrap;
}

nav a:hover,
nav a.active {
  color: var(--pink);
  border-color: var(--pink);
}

/* ─── Main ─── */
main {
  max-width: 960px;
  margin: 0 auto;
  padding: 2rem 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 4rem;
}

/* ─── Terminal Windows ─── */
.terminal-window {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

.terminal-window.visible {
  opacity: 1;
  transform: translateY(0);
}

.window-body { padding: 1.5rem; }

/* ─── HOME ─── */
#home .window-body { padding: 2rem 1.5rem; }

#hero-text {
  font-family: 'Press Start 2P', monospace;
  font-size: clamp(1rem, 3.5vw, 2rem);
  font-weight: 400;
  letter-spacing: 0.06em;
  -webkit-text-stroke: 0px;
  color: var(--cyan);
  text-shadow: none;
  animation: neon-pulse 3s ease-in-out infinite;
  line-height: 1.4;
  margin-bottom: 1rem;
  min-height: 1.5em;
}

@keyframes neon-pulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.85; }
}

.cursor {
  display: inline-block;
  width: 0.8em;
  height: 1em;
  background: var(--cyan);
  vertical-align: text-bottom;
  animation: blink 1s step-end infinite;
  margin-left: 2px;
}

@keyframes blink {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0; }
}

.hero-subtitle {
  font-family: 'Share Tech Mono', monospace;
  font-size: 1rem;
  color: var(--pink);
  margin-bottom: 2rem;
}

.skill-block {
  background: rgba(126,207,207,0.03);
  border: 1px solid rgba(126,207,207,0.15);
  padding: 1rem;
  margin-bottom: 2rem;
  font-family: 'Share Tech Mono', monospace;
  font-size: 0.875rem;
}

.skill-block .cmd { color: var(--yellow); margin-bottom: 0.5rem; }
.skill-block .out { color: var(--green); }
.skill-block .out span { color: var(--text); }

.cta-btn {
  display: inline-block;
  font-family: 'Share Tech Mono', monospace;
  font-size: 1rem;
  font-weight: 700;
  color: var(--bg);
  background: var(--cyan);
  padding: 12px 20px;
  text-decoration: none;
  border: none;
  cursor: pointer;
  transition: background 0.2s;
  letter-spacing: 0.08em;
}

.cta-btn:hover { background: var(--pink); }

/* ─── Section Header ─── */
.section-header {
  margin-bottom: 1.8rem;
  border-bottom: 1px solid rgba(126,207,207,0.2);
  padding-bottom: 1rem;
}

.section-name {
  font-family: 'Share Tech', sans-serif;
  font-size: clamp(1rem, 2.5vw, 1.4rem);
  color: var(--cyan);
  line-height: 1.4;
  margin-bottom: 0.35rem;
}

.section-kind {
  font-family: 'Share Tech Mono', monospace;
  font-size: 0.95rem;
  color: var(--yellow);
  letter-spacing: 0.05em;
}

.section-kind::before { content: '// '; color: rgba(196,185,106,0.5); }

.section-desc {
  font-family: 'Share Tech Mono', monospace;
  font-size: 0.95rem;
  color: rgba(212,212,212,0.75);
  margin-top: 0.4rem;
}

/* ─── Article listing (Dispatches + Transmissions) ─── */
.article-list { display: flex; flex-direction: column; gap: 0; }

.article-item {
  border-bottom: 1px solid rgba(126,207,207,0.1);
  padding: 1rem 0;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.5rem 1.5rem;
  align-items: start;
  transition: background 0.15s;
}

.article-item:first-child { padding-top: 0; }
.article-item:last-child  { border-bottom: none; }
.article-item:hover { background: rgba(126,207,207,0.03); }

.article-title {
  font-family: 'Share Tech Mono', monospace;
  font-size: 1.15rem;
  color: var(--cyan);
  text-decoration: none;
  display: block;
  margin-bottom: 0.2rem;
  transition: color 0.15s;
}

.article-title:hover { color: var(--pink); }

.article-meta {
  font-family: 'Share Tech Mono', monospace;
  font-size: 0.9rem;
  color: rgba(212,212,212,0.65);
  margin-bottom: 0.4rem;
}

.article-meta .author { color: var(--yellow); }

.article-excerpt {
  font-family: 'Share Tech Mono', monospace;
  font-size: 1rem;
  color: rgba(212,212,212,0.9);
  line-height: 1.5;
  grid-column: 1;
}

.article-read {
  font-family: 'Share Tech', sans-serif;
  font-size: 0.75rem;
  color: var(--green);
  text-decoration: none;
  border: 1px solid var(--green);
  padding: 4px 8px;
  white-space: nowrap;
  align-self: center;
  transition: background 0.2s, color 0.2s;
}

.article-read:hover { background: var(--green); color: var(--bg); }

/* ─── Cartoon grid (Static) ─── */
.cartoon-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 1rem;
}

.cartoon-card {
  border: 1px solid rgba(126,207,207,0.25);
  border-top: 3px solid var(--pink);
  background: rgba(196,127,190,0.04);
  transition: border-color 0.2s, background 0.2s;
  cursor: default;
}

.cartoon-card:hover {
  border-color: var(--yellow);
  border-top-color: var(--yellow);
  background: rgba(196,185,106,0.05);
}

.cartoon-thumb {
  width: 100%;
  aspect-ratio: 4/3;
  background: rgba(0,0,0,0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Share Tech Mono', monospace;
  font-size: 3rem;
  color: rgba(126,207,207,0.15);
  border-bottom: 1px solid rgba(126,207,207,0.1);
  user-select: none;
}

.cartoon-info { padding: 0.8rem; }

.cartoon-title {
  font-family: 'Share Tech Mono', monospace;
  font-size: 1rem;
  color: var(--text);
  margin-bottom: 0.2rem;
}

.cartoon-artist {
  font-family: 'Share Tech Mono', monospace;
  font-size: 0.9rem;
  color: var(--pink);
}

.cartoon-artist::before { content: 'by '; color: rgba(212,212,212,0.55); }

.cartoon-link {
  display: inline-block;
  margin-top: 0.5rem;
  font-family: 'Share Tech', sans-serif;
  font-size: 0.75rem;
  color: var(--pink);
  text-decoration: none;
  border: 1px solid var(--pink);
  padding: 3px 7px;
  transition: background 0.2s, color 0.2s;
}

.cartoon-link:hover { background: var(--pink); color: var(--bg); }

/* ─── Games grid (Executables) ─── */
.games-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1rem;
}

.game-card {
  border: 1px solid rgba(122,191,106,0.3);
  border-left: 3px solid var(--green);
  background: rgba(122,191,106,0.04);
  padding: 1.2rem;
  transition: border-color 0.2s, background 0.2s;
  cursor: default;
}

.game-card:hover {
  border-color: var(--cyan);
  border-left-color: var(--cyan);
  background: rgba(126,207,207,0.05);
}

.game-title {
  font-family: 'Share Tech', sans-serif;
  font-size: 0.95rem;
  color: var(--green);
  margin-bottom: 0.6rem;
  transition: color 0.2s;
}

.game-card:hover .game-title { color: var(--cyan); }

.game-desc {
  font-family: 'Share Tech Mono', monospace;
  font-size: 1rem;
  color: var(--text);
  line-height: 1.5;
  margin-bottom: 0.8rem;
}

.game-tags { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-bottom: 0.8rem; }

.game-tag {
  font-family: 'Share Tech Mono', monospace;
  font-size: 0.85rem;
  color: var(--yellow);
  background: rgba(196,185,106,0.08);
  border: 1px solid rgba(196,185,106,0.3);
  padding: 1px 6px;
}

.game-play {
  font-family: 'Share Tech', sans-serif;
  font-size: 0.8rem;
  color: var(--green);
  text-decoration: none;
  border: 1px solid var(--green);
  padding: 4px 8px;
  transition: background 0.2s, color 0.2s;
}

.game-play:hover { background: var(--green); color: var(--bg); }

/* ─── Hamburger toggle button ─── */
.nav-toggle {
  display: none;
  margin-left: auto;
  background: none;
  border: 1px solid transparent;
  color: var(--text);
  font-family: 'Share Tech Mono', monospace;
  font-size: 1.1rem;
  padding: 4px 8px;
  cursor: pointer;
  line-height: 1;
  transition: color 0.2s, border-color 0.2s;
  flex-shrink: 0;
}

.nav-toggle:hover {
  color: var(--cyan);
  border-color: var(--cyan);
}

/* ─── Search button (topbar) ─── */
.search-btn {
  margin-left: auto;
  background: none;
  border: 1px solid transparent;
  color: var(--text);
  font-family: 'Share Tech Mono', monospace;
  font-size: 0.85rem;
  padding: 4px 8px;
  cursor: pointer;
  transition: color 0.2s, border-color 0.2s;
  white-space: nowrap;
  flex-shrink: 0;
}

.search-btn:hover {
  color: var(--cyan);
  border-color: var(--cyan);
}

/* ─── Search overlay ─── */
#search-overlay {
  position: fixed;
  inset: 0;
  z-index: 9998;
  background: rgba(26,26,26,0.97);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 6rem 1.5rem 2rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s ease;
}

#search-overlay.open {
  opacity: 1;
  pointer-events: all;
}

#search-box {
  width: 100%;
  max-width: 640px;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.search-prompt {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  border-bottom: 1px solid rgba(126,207,207,0.4);
  padding-bottom: 0.6rem;
}

.search-prefix {
  font-family: 'Share Tech Mono', monospace;
  font-size: 1.3rem;
  color: var(--yellow);
  white-space: nowrap;
  flex-shrink: 0;
}

#search-input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: var(--cyan);
  font-family: 'Share Tech Mono', monospace;
  font-size: 1.4rem;
  caret-color: var(--cyan);
  caret-shape: block;
}

#search-input::placeholder {
  color: rgba(192,192,192,0.25);
}

#search-close {
  background: none;
  border: none;
  color: rgba(212,212,212,0.5);
  font-family: 'Share Tech', sans-serif;
  font-size: 0.4rem;
  cursor: pointer;
  padding: 4px;
  transition: color 0.15s;
  flex-shrink: 0;
}

#search-close:hover { color: var(--pink); }

#search-results {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.search-result {
  display: grid;
  grid-template-columns: auto 1fr;
  grid-template-rows: auto auto auto;
  column-gap: 0.8rem;
  row-gap: 0.15rem;
  padding: 0.85rem 0;
  border-bottom: 1px solid rgba(126,207,207,0.08);
  text-decoration: none;
  transition: background 0.15s;
}

.search-result:hover { background: rgba(126,207,207,0.04); }
.search-result:last-child { border-bottom: none; }

.search-result-channel {
  font-family: 'Share Tech', sans-serif;
  font-size: 0.38rem;
  color: var(--yellow);
  grid-column: 1;
  grid-row: 1;
  align-self: center;
  white-space: nowrap;
  padding: 2px 5px;
  border: 1px solid rgba(196,185,106,0.3);
  background: rgba(196,185,106,0.06);
}

.search-result-title {
  font-family: 'Share Tech Mono', monospace;
  font-size: 1.3rem;
  color: var(--cyan);
  grid-column: 2;
  grid-row: 1;
}

.search-result-meta {
  font-family: 'Share Tech Mono', monospace;
  font-size: 1rem;
  color: rgba(212,212,212,0.6);
  grid-column: 2;
  grid-row: 2;
}

.search-result-excerpt {
  font-family: 'Share Tech Mono', monospace;
  font-size: 1rem;
  color: rgba(212,212,212,0.75);
  grid-column: 1 / -1;
  grid-row: 3;
  line-height: 1.4;
  padding-top: 0.2rem;
}

.search-empty {
  font-family: 'Share Tech Mono', monospace;
  font-size: 1.1rem;
  color: rgba(212,212,212,0.5);
  padding: 1rem 0;
}

/* ─── Glitch hover ─── */
.glitchable { position: relative; }

.glitchable.glitching {
  animation: glitch 0.18s steps(2) 1;
}

@keyframes glitch {
  0%   { clip-path: inset(20% 0 75% 0); transform: translate(-2px, 0);   color: var(--pink); }
  40%  { clip-path: inset(55% 0 30% 0); transform: translate(2px, 0);    color: var(--cyan); }
  100% { clip-path: inset(0);           transform: translate(0); }
}

/* ─── Footer ─── */
footer {
  text-align: center;
  padding: 1.5rem;
  font-family: 'Share Tech Mono', monospace;
  font-size: 0.8rem;
  color: rgba(212,212,212,0.55);
  max-width: 960px;
  margin: 0 auto;
}

footer span { color: var(--cyan); }

.footer-tagline {
  margin-top: 2rem;
  font-size: 0.95rem;
  font-weight: 700;
  color: rgba(196,127,190,0.85);
  font-style: italic;
  letter-spacing: 0.05em;
}

/* ─── Ticker ─── */
#ticker {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 100;
  background: rgba(26,26,26,0.95);
  border-top: 1px solid var(--cyan);
  overflow: hidden;
  height: 28px;
  display: flex;
  align-items: center;
}

.ticker-inner {
  white-space: nowrap;
  font-family: 'Share Tech', sans-serif;
  font-size: 0.45rem;
  color: var(--cyan);
  animation: marquee 60s linear infinite;
  padding-left: 100vw;
}

.ticker-inner .sep { color: var(--pink); margin: 0 0.8em; }

@keyframes marquee {
  from { transform: translateX(0); }
  to   { transform: translateX(-100%); }
}

/* ─── Mobile (≤768px) ─── */
@media (max-width: 768px) {

  /* Hamburger — show on mobile */
  .nav-toggle { display: flex; align-items: center; }

  /* Nav — hidden by default, full-width dropdown when open */
  .topbar-inner {
    padding: 0.5rem 1rem;
    gap: 0.5rem;
    flex-wrap: wrap;
  }

  nav {
    display: none;
    flex-direction: column;
    width: 100%;
    gap: 0;
    border-top: 1px solid rgba(126,207,207,0.15);
    padding: 0.4rem 0;
  }

  nav.open { display: flex; }

  nav a {
    font-size: 0.9rem;
    padding: 0.55rem 0.25rem;
    border: none;
    border-bottom: 1px solid rgba(126,207,207,0.08);
  }

  nav a:last-child { border-bottom: none; }

  /* Boot screen — reduce side padding */
  #boot-screen {
    padding: 2rem 1.25rem;
    font-size: 0.82rem;
  }

  /* Main layout — less padding, tighter section gaps */
  main {
    padding: 1.25rem 1rem;
    gap: 2rem;
  }

  /* Terminal window body */
  .window-body { padding: 1rem; }
  #home .window-body { padding: 1.25rem 1rem; }

  /* Article list — stack [READ] button below text */
  .article-item {
    grid-template-columns: 1fr;
  }

  .article-read {
    justify-self: start;
    margin-top: 0.35rem;
  }

  .article-title { font-size: 1rem; }

  /* Games grid — single column */
  .games-grid {
    grid-template-columns: 1fr;
  }

  /* Cartoon grid — single column */
  .cartoon-grid {
    grid-template-columns: 1fr;
  }

  /* Skill block — allow horizontal scroll if content overflows */
  .skill-block {
    overflow-x: auto;
    font-size: 0.8rem;
  }

  /* Search overlay — less top padding */
  #search-overlay {
    padding: 4rem 1rem 2rem;
  }

  /* ── Game pages: near-fullscreen canvas ── */
  .game-page main {
    padding: 0;
    gap: 0;
  }

  .game-page .window-body {
    padding: 0;
  }

  .game-page footer,
  .game-page .ctrl-hint {
    display: none;
  }
}
