/* ===========================
   Base Layout & Typography
   =========================== */
canvas#starfield {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: -1;
}
body {
  margin: 0;
  padding: 0;
  background: #000 url("https://pingpeppy.neocities.org/images/alt-bg.gif")
    repeat;
  font-family: "VT323", "Fira Mono", "Consolas", monospace;
  color: #00ff99;
  min-height: 100vh;
}
a:link,
a:visited {
  color: #00ff00;
  text-decoration: underline;
}
h1 {
  margin: 10px 0;
  font-size: 24px;
  color: #ff66cc;
}
h2 {
  color: #fff;
  font-size: 24px;
  margin: 14px 0 6px;
}
h2 small {
  font-style: italic;
  font-size: 14px;
  color: #99ffcc;
}
h3 {
  color: #ffcc00;
  font-size: 18px;
  cursor: pointer;
  margin: 10px 0 0 0;
}

/* ===========================
   Table Layout
   =========================== */
table {
  border-collapse: collapse;
  width: 900px;
  max-width: 98vw;
  margin: auto;
  background-color: #000;
}
td {
  vertical-align: top;
  padding: 10px;
}
td:first-child {
  width: 20%;
  background-color: #111;
}
td:last-child {
  width: 80%;
  background-color: #000;
}

/* ===========================
   Terminal Blog
   =========================== */
.terminal {
  background: #000;
  color: #00ff99;
  font-family: monospace;
  padding: 10px;
  width: 80%;
  max-width: 600px;
  margin: 10px auto;
  overflow: hidden;
  cursor: default;
}
.cmd-line,
.info-line {
  margin: 4px 0;
}
.cmd-line::after,
.info-line::after {
  content: "";
  display: inline-block;
  width: 8px;
  height: 1em;
  background: #00ff99;
  margin-left: 2px;
  animation: blink 1s step-start infinite;
}

/* Hide cursors in changelog containers unless .cursor-line is present */
#changelog-entries .cmd-line::after,
#changelog .cmd-line::after,
#terminal-blog .cmd-line::after {
  display: none;
}

#changelog-entries .cursor-line::after,
#changelog .cursor-line::after,
#terminal-blog .cursor-line::after {
  display: inline-block;
}

/* Glow effect and alternating colors for changelog */
#changelog-entries,
#changelog {
  text-shadow:
    0 0 4px #00ff99,
    0 0 8px #00ff99;
}
#changelog-entries .cmd-line:nth-child(even) {
  color: #99ffcc;
}
.info-line {
  cursor: pointer;
  text-decoration: underline;
}

/* ===========================
   Modal Styles
   =========================== */
.modal {
  display: none;
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.8);
  z-index: 1000;
}
.modal-content {
  background: #111;
  color: #00ff99;
  font-family: monospace;
  padding: 20px;
  max-width: 700px;
  margin: 60px auto;
  max-height: 80%;
  overflow-y: auto;
  white-space: pre-wrap;
  position: relative;
}
.modal-close {
  position: absolute;
  top: 10px;
  right: 20px;
  font-size: 18px;
  cursor: pointer;
}

/* ===========================
   Art Thumbnails & Modal
   =========================== */
.art-thumb {
  width: 100%;
  max-width: 200px;
  aspect-ratio: 1 / 1;
  margin: 10px;
  object-fit: cover;
  cursor: pointer;
  border: 2px solid #004466;
  transition: transform 0.2s;
}
.art-thumb:hover {
  transform: scale(1.1);
}
.art-modal {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.9);
  z-index: 1001;
  padding-top: 60px;
}
.art-modal-content {
  margin: auto;
  display: block;
  max-width: 90%;
  max-height: 80%;
  border: 2px solid #00ff99;
}
.art-modal-close {
  position: absolute;
  top: 20px;
  right: 35px;
  font-size: 30px;
  font-weight: bold;
  color: #00ff99;
  cursor: pointer;
}

/* ===========================
   Heading & Content Boxes
   =========================== */
.content-box {
  background: #000;
  width: 900px;
  max-width: 90%;
  margin: 40px auto;
  padding: 20px;
  text-align: center;
}
.heading-box {
  background: #000;
  display: inline-block;
  padding: 12px;
  margin-bottom: 30px;
  text-align: center;
}
.heading-box h1 {
  margin: 0;
  font-size: 32px;
}
.subhead {
  margin: 4px 0 0;
  font-size: 14px;
  color: #99ff99;
}
/* RGB color-cycle for header */
.header-rainbow {
  /* initial color matches your existing h1 */
  color: #ff66cc;
  /* animate through red, green, blue, then back */
  animation: header-rgb-cycle 6s linear infinite;
}
/* ===========================
   Header RGB Cycle
   =========================== */
/* 2) Make the actual <h1> and subtitle inherit from that */
.header-rainbow h1,
.header-rainbow .subhead {
  color: inherit;
}

/* 3) Define the keyframes to cycle red→green→blue→red */
@keyframes header-rgb-cycle {
  0%,
  100% {
    color: #ff66cc;
  } /* start/end pink */
  33% {
    color: #00ff00;
  } /* green */
  66% {
    color: #0000ff;
  } /* blue */
}

/* ===========================
   Collapsible Post Content
   =========================== */
.post-content {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.4s ease;
  padding: 0 0;
}
.post-content.open {
  max-height: 2000px;
  padding: 10px 0;
  transition: max-height 0.4s ease;
}

/* ===========================
   About Me Modal (Window)
   =========================== */
#about-modal {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.8);
  z-index: 10000; /* above CRT overlay */
  display: flex;
  align-items: center;
  justify-content: center;
}
#about-modal-content {
  position: relative;
  background: #111;
  color: #00ff99;
  border: 2px solid #00ff99;
  padding: 16px;
  max-width: 90%;
  max-height: 90%;
  overflow: auto;
  box-shadow:
    0 0 10px #00ff99,
    0 0 2px #00ff99 inset;
  z-index: 10001; /* above modal backdrop */
}
#about-modal-content-header {
  cursor: move;
  background: #222;
  padding: 6px;
  font-weight: bold;
  user-select: none;
}
#about-modal-content-header .modal-close {
  float: right;
  cursor: pointer;
  color: #ff6666;
}
#about-modal-content img {
  float: right;
  width: 150px;
  height: auto;
  margin: 0 0 8px 12px;
  border: 2px solid #00ff99;
}
#about-modal-content .clearfix::after {
  content: "";
  display: block;
  clear: both;
}

/* ===========================
   Responsive Layout (Mobile)
   =========================== */
@media (max-width: 700px) {
  /* Stack table layout */
  table,
  tr,
  td {
    display: block;
    width: 100% !important;
    box-sizing: border-box;
  }
  td {
    border-width: 1px;
    padding: 6px;
  }

  /* Terminal adjustments */
  .terminal {
    width: 98vw;
    max-width: 100vw;
    font-size: 16px;
    padding: 6px;
  }

  /* Modals full width */
  .modal-content,
  #about-modal-content {
    max-width: 98vw !important;
    width: 98vw !important;
    left: 1vw !important;
    transform: none !important;
    font-size: 16px;
    padding: 10px;
  }
  #about-modal-content img {
    width: 90px;
    margin: 0 0 8px 8px;
  }

  /* Pre and ASCII art scrollable */
  pre,
  #ascii-art {
    font-size: 12px;
    max-width: 100vw;
    overflow-x: auto;
    white-space: pre;
  }

  /* Gallery and posts */
  #gallery,
  .gallery {
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  }

  /* Responsive layout for art gallery */
  .content-flex {
    flex-direction: column;
    align-items: stretch;
  }
  #nav-container {
    max-width: 100%;
    width: 100%;
    margin-right: 0;
    margin-bottom: 20px;
  }
  .main-art-content {
    width: 100%;
  }
  .content-box {
    width: 100vw;
    max-width: 100vw;
    padding: 5vw 2vw;
    box-sizing: border-box;
  }
  .art-thumb {
    max-width: 100vw !important;
    width: 100% !important;
    height: auto !important;
  }
  .ascii-thumb {
    max-width: 100vw !important;
    width: 100% !important;
    font-size: 14px !important;
  }

  /* Hide Bonzi Buddy on small screens */
  #bonzi-container,
  #bonzi-show {
    display: none;
  }
}

/* ===========================
   ASCII Art & Terminal Cursor
   =========================== */
pre,
#ascii-art {
  overflow-x: auto;
  white-space: pre;
  display: block;
  max-width: 100%;
}
.ascii-thumb {
  font-family: monospace;
  white-space: pre;
  cursor: pointer;
  font-size: clamp(14px, 4vw, 18px);
}
.ascii-glow {
  color: #00ff99;
  text-shadow:
    0 0 3px #00ff99,
    0 0 4px #00ff99,
    0 0 6px #00ff99;
  font-family: "Consolas", monospace;
}
.terminal-cursor {
  animation: terminal-blink 1s steps(1) infinite;
}
@keyframes terminal-blink {
  0%,
  49% {
    opacity: 1;
  }
  50%,
  100% {
    opacity: 0;
  }
}

/* ===========================
   Miscellaneous
   =========================== */
.blink {
  animation: blinker 1s step-start infinite;
}
@keyframes blinker {
  50% {
    opacity: 0;
  }
}
#gallery,
.gallery {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 20px;
  justify-items: center;
  padding-bottom: 20px;
}

/* ===========================
   Navigation Styles
   =========================== */
nav ul {
  list-style: none;
  padding: 0;
  margin: 0;
}
nav li {
  margin-bottom: 12px;
}
nav a {
  color: #00ff99;
  text-decoration: none;
  font-family: monospace;
  font-size: 1.1em;
  font-weight: bold;
  transition: color 0.2s;
}
nav a:hover {
  color: #ffcc00;
}

/* ===========================
   Sidebar Navigation
   =========================== */
.sidebar-nav {
  width: 180px;
  min-width: 180px;
  max-width: 180px;
  box-sizing: border-box;
  background: #111;
  padding: 0;
  margin: 0;
  overflow-x: hidden;
}
.sidebar-nav ul {
  list-style: none;
  padding: 0;
  margin: 0;
}
.sidebar-nav li {
  margin-bottom: 8px;
}
.sidebar-nav a {
  display: block;
  color: #008318;
  text-decoration: none;
  padding: 8px 12px;
  border-radius: 4px;
  transition: background 0.2s;
}
.sidebar-nav a:hover {
  background: #222;
}
.sidebar-nav a.active {
  background: #222;
  color: #0f0;
  font-weight: bold;
}
.sidebar-nav iframe {
  width: 100%;
  min-width: 0;
  border: none;
  margin: 0;
  display: block;
}

/* ===========================
   Art Gallery Layout
   =========================== */
.main-art-content {
  flex: 1 1 0;
}
#nav-container {
  min-width: 180px;
  max-width: 180px;
  width: 180px;
  margin-right: 32px;
  margin-left: 0;
  box-sizing: border-box;
  background: #111;
  padding: 0 0 10px 0;
}
/* Start https://www.cursors-4u.com */
* {
  cursor:
    url(https://cur.cursors-4u.net/games/gam-4/gam372.cur), auto !important;
} /* End https://www.cursors-4u.com */

/* ===========================
   Footer Styles
   =========================== */
.footer-earth {
  display: flex;
  justify-content: center;
  margin-top: 8px;
}
.footer-earth img {
  image-rendering: pixelated;
}
.site-footer {
  background: transparent;
  padding: 16px 0 8px 0;
  text-align: center;
  margin-top: 0;
  color: #00ff99;
}
.footer-message {
  font-family: "Fira Mono", "Consolas", monospace;
  font-size: 1em;
  margin-top: 8px;
  color: #39ff14;
}
.flicker {
  animation: flicker 1.5s infinite alternate;
}
@keyframes flicker {
  0%,
  100% {
    opacity: 1;
    text-shadow:
      0 0 8px #39ff14,
      0 0 16px #39ff14;
  }
  50% {
    opacity: 0.7;
    text-shadow:
      0 0 16px #39ff14,
      0 0 32px #39ff14;
  }
}
.footer-heart {
  color: #ff66cc;
  text-shadow:
    0 0 8px #ff66cc,
    0 0 16px #ff66cc;
  font-size: 1.2em;
  vertical-align: middle;
}
.footer-copyright {
  color: #666;
  font-size: 0.85em;
  margin-top: 6px;
}

/* ===========================
   End of Stylesheet
   =========================== */
.ascii-modal-content-glow {
  color: #39ff14;
  text-shadow:
    0 0 8px #39ff14,
    0 0 16px #39ff14,
    0 0 32px #39ff14;
  background: none;
  font-size: 1rem;
  margin: 0;
  white-space: pre;
  text-align: left;
  max-width: 100%;
  overflow-x: auto;
}
.content-flex {
  display: flex;
  flex-direction: row;
  justify-content: space-between;
  align-items: flex-start;
  width: 100%;
  gap: 24px;
}

/* Draggable Bonzi Buddy iframe */
#bonzi-container {
  position: fixed;
  bottom: 0;
  right: 0;
  width: 200px;
  z-index: 9998; /* Below CRT overlay */
  display: flex;
  flex-direction: column; /* Ensure handle is above iframe */
  border: 2px solid transparent; /* Transparent border */
  background: transparent; /* Transparent background */
}

#bonzi-iframe {
  width: 100%;
  height: 600px;
  border: none;
  background: transparent; /* Transparent iframe */
}

/* ===========================
   CRT Overlay & Toggle
   =========================== */
#crt-overlay {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 9999;
  mix-blend-mode: multiply;
  opacity: 0.55;
  background:
    repeating-linear-gradient(
      0deg,
      rgba(0, 0, 0, 0.3) 0,
      rgba(0, 0, 0, 0.3) 4px,
      rgba(0, 0, 0, 0) 4px,
      rgba(0, 0, 0, 0) 8px
    ),
    repeating-linear-gradient(
      90deg,
      rgba(255, 255, 255, 0.03) 0,
      rgba(255, 255, 255, 0.03) 4px,
      rgba(0, 0, 0, 0.03) 4px,
      rgba(0, 0, 0, 0.03) 8px
    );
  animation: crtFlicker 0.3s infinite;
}

@keyframes crtFlicker {
  0%,
  100% {
    opacity: 0.55;
  }
  50% {
    opacity: 0.5;
  }
}
#crt-toggle {
  position: fixed;
  top: 8px;
  left: 8px;
  z-index: 10000;
  background: #111;
  color: #00ff99;
  border: 1px solid #00ff99;
  padding: 2px 6px;
  font-family: monospace;
  cursor: pointer;
}

@media (max-width: 600px) {
  #crt-overlay,
  #crt-toggle {
    display: none !important;
  }
}

/* ===========================
   MST3K Corner Image
   =========================== */
#msk3k-container {
  position: fixed;
  bottom: 8px;
  left: 8px;
  z-index: 10001;
  text-decoration: none;
  cursor: pointer;
}
#msk3k-container img {
  display: block;
  width: 80px;
  height: auto;
}
#msk3k-tooltip {
  display: none;
  position: absolute;
  bottom: 100%;
  left: 0;
  margin-bottom: 4px;
  background: #111;
  color: #00ff99;
  border: 1px solid #00ff99;
  padding: 4px 8px;
  font-family: "VT323", "Fira Mono", "Consolas", monospace;
  white-space: nowrap;
}
#msk3k-container:hover #msk3k-tooltip {
  display: block;
}
@media (max-width: 700px) {
  #msk3k-container {
    display: none;
  }
}

/* Retro terminal glow button style for changelog controls */
#skip-typing,
#toggle-speed {
  font-family: "VT323", "Fira Mono", "Consolas", monospace;
  font-size: 12px;
  padding: 2px 10px;
  margin: 0 2px;
  background: #000;
  color: #00ff99;
  border: 1.5px solid #00ff99;
  border-radius: 3px;
  box-shadow:
    0 0 3px #00ff99,
    0 0 1px #00ff99 inset;
  text-shadow:
    0 0 2px #00ff99,
    0 0 1px #fff;
  cursor: pointer;
  transition:
    box-shadow 0.2s,
    background 0.2s,
    color 0.2s;
  line-height: 1.2;
  min-width: 0;
  min-height: 0;
}
#skip-typing:hover,
#toggle-speed:hover {
  background: #002d1a;
  color: #fff;
  box-shadow:
    0 0 6px #00ff99,
    0 0 2px #00ff99 inset;
  text-shadow:
    0 0 4px #00ff99,
    0 0 2px #fff;
}
.rgb-cycle {
  animation: footer-rgb-cycle 2s linear infinite;
  background: none !important;
  color: #ff66cc;
}
@keyframes footer-rgb-cycle {
  0%   { color: #ff0000; }
  16%  { color: #ff9900; }
  33%  { color: #ffff00; }
  50%  { color: #00ff00; }
  66%  { color: #00ffff; }
  83%  { color: #0000ff; }
  100% { color: #ff00ff; }
}

/* ===========================   CRT Effects
   =========================== */
/* Turn-on animation removed */

@keyframes flicker {
  0% { opacity: 0.97; }
  5% { opacity: 0.95; }
  10% { opacity: 0.9; }
  15% { opacity: 0.95; }
  20% { opacity: 0.98; }
  25% { opacity: 0.95; }
  30% { opacity: 0.9; }
  35% { opacity: 0.95; }
  40% { opacity: 0.98; }
  45% { opacity: 0.95; }
  50% { opacity: 0.94; }
  55% { opacity: 0.95; }
  60% { opacity: 0.97; }
  65% { opacity: 0.95; }
  70% { opacity: 0.93; }
  75% { opacity: 0.95; }
  80% { opacity: 0.96; }
  85% { opacity: 0.95; }
  90% { opacity: 0.94; }
  95% { opacity: 0.95; }
  100% { opacity: 0.97; }
}

#crt-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(
    rgba(18, 16, 16, 0) 50%,
    rgba(0, 0, 0, 0.25) 50%
  );
  background-size: 100% 4px;
  z-index: 1000;
  pointer-events: none;
  animation: flicker 0.15s infinite;
}

#crt-overlay::before {
  content: "";
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: radial-gradient(
    circle at center,
    rgba(0, 0, 0, 0) 0%,
    rgba(0, 0, 0, 0.2) 80%,
    rgba(0, 0, 0, 0.4) 100%
  );
  pointer-events: none;
}

#crt-overlay::after {
  content: "";
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgb(0, 255, 153, 0.03);
  opacity: 0;
  z-index: 1000;
  pointer-events: none;
  animation: flicker 0.3s infinite;
}

/* CRT-on class and animation completely removed */

#crt-toggle {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 1001;
  background: #222;
  color: #00ff99;
  border: 2px solid #00ff99;
  padding: 8px 16px;
  font-family: "VT323", monospace;
  cursor: pointer;
  transition: all 0.3s ease;
}

#crt-toggle:hover {
  background: #00ff99;
  color: #222;
}

/* ===========================
   Navigation CRT Toggle
   =========================== */
.nav-spacer {
  flex-grow: 1;
  min-height: 20px;
}

.crt-nav-toggle {
  display: flex !important;
  align-items: center;
  justify-content: center;
  padding: 8px !important;
  margin-top: 10px;
  border: 1px solid #00ff99;
  border-radius: 4px;
  transition: all 0.3s ease;
}

.crt-nav-toggle:hover {
  background: #00ff99 !important;
  color: #000 !important;
  text-decoration: none !important;
}

.crt-nav-toggle .toggle-icon {
  margin-right: 8px;
  font-size: 1.2em;
}

.bonzi-nav-toggle {
  display: flex !important;
  align-items: center;
  justify-content: center;
  padding: 8px !important;
  margin-top: 5px;
  border: 1px solid #ffcc00;
  border-radius: 4px;
  transition: all 0.3s ease;
}

.bonzi-nav-toggle:hover {
  background: #ffcc00 !important;
  color: #000 !important;
  text-decoration: none !important;
}

.bonzi-nav-toggle .toggle-icon {
  margin-right: 8px;
  font-size: 1.2em;
}

/* Hide the original CRT toggle button and Bonzi show button when using nav toggle */
#crt-toggle,
#bonzi-show {
  display: none !important;
}
