/* ==========================================================
   JAY'S BACKEND: AN EXTENSIVELY UNNECESSARY STYLESHEET
   ========================================================== */

/* ---------- Variables ---------- */
:root {
  --bg: #050505;
  --fg: #f2f2f2;
  --dim: #8a8a8a;
  --red: #ff1a1a;
  --red-dark: #b30000;
  --cyan: #00e5ff;
  --magenta: #ff00e6;
  --font-main: "Helvetica Neue", Helvetica, Arial, system-ui, sans-serif;
  --font-mono: "Courier New", Courier, monospace;
}

/* ---------- Reset-ish ---------- */
* { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  background: var(--bg);
}

/* ---------- Body ---------- */
body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  font-family: var(--font-main);
  line-height: 1.7;
  letter-spacing: 0.02em;
  color: var(--fg);
  background:
    radial-gradient(ellipse at center, #1a1a1a 0%, var(--bg) 70%),
    var(--bg);
  background-attachment: fixed;
  cursor: crosshair;
  overflow-x: hidden;
  animation: crt-flicker 6s infinite;
}

/* ---------- CRT scanlines ---------- */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 9998;
  background: repeating-linear-gradient(
    to bottom,
    rgba(255, 255, 255, 0.03) 0px,
    rgba(255, 255, 255, 0.03) 1px,
    transparent 1px,
    transparent 3px
  );
  mix-blend-mode: overlay;
}

/* ---------- Blinking REC light ---------- */
body::after {
  content: "● REC";
  position: fixed;
  top: 12px;
  left: 16px;
  z-index: 9999;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  letter-spacing: 0.15em;
  color: var(--red);
  pointer-events: none;
  animation: blink 1.2s steps(1) infinite;
}

/* ---------- Layout ---------- */
main, footer {
  width: 100%;
  max-width: 720px;
  margin: 0 auto;
  padding: 2rem 1.5rem;
}

main { flex: 1; }

.center { text-align: center; }

main.center {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
}

/* ---------- Headings ---------- */
h1 {
  margin: 0 0 0.5rem;
  font-size: clamp(2.2rem, 8vw, 4.5rem);
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: -0.03em;
  line-height: 1;
  color: var(--fg);
  text-shadow:
    2px 0 var(--cyan),
    -2px 0 var(--magenta);
  animation: glitch 3s infinite;
}

h2 {
  margin: 0 0 1.5rem;
  font-family: var(--font-mono);
  font-size: clamp(1rem, 3vw, 1.4rem);
  font-weight: normal;
  color: var(--red);
  animation: neon-pulse 2.5s ease-in-out infinite;
}

h2::before { content: "> "; }
h2::after {
  content: "_";
  animation: blink 1s steps(1) infinite;
}

h3 {
  margin-top: 2rem;
  font-family: var(--font-mono);
  font-size: 1rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--red);
  border-bottom: 1px dashed var(--red-dark);
  padding-bottom: 0.25rem;
}

/* ---------- Text ---------- */
p { margin: 0.75rem 0; }

em { color: var(--dim); }

strong { color: #fff; }

::selection {
  background: var(--red);
  color: #000;
}

/* ---------- Links ---------- */
a {
  color: var(--cyan);
  text-decoration: none;
  background-image: linear-gradient(var(--cyan), var(--cyan));
  background-size: 0% 1px;
  background-position: 0 100%;
  background-repeat: no-repeat;
  transition: background-size 0.3s ease, color 0.2s ease;
  cursor: pointer;
}

a:hover,
a:focus-visible {
  background-size: 100% 1px;
  color: #fff;
}

a:focus-visible {
  outline: 2px dashed var(--red);
  outline-offset: 4px;
}

/* ---------- The Button ---------- */
.button {
  position: relative;
  display: inline-block;
  overflow: hidden;
  padding: 0.9rem 1.8rem;
  margin-top: 0.5rem;
  font-family: var(--font-mono);
  font-weight: bold;
  font-size: 1rem;
  letter-spacing: 0.05em;
  color: #fff;
  background: var(--red);
  background-image: none;
  border: 2px solid #fff;
  border-radius: 4px;
  box-shadow:
    4px 4px 0 var(--red-dark),
    0 0 20px rgba(255, 26, 26, 0.4);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

/* shine sweep */
.button::before {
  content: "";
  position: absolute;
  top: 0;
  left: -75%;
  width: 50%;
  height: 100%;
  background: linear-gradient(
    120deg,
    transparent,
    rgba(255, 255, 255, 0.6),
    transparent
  );
  transform: skewX(-20deg);
}

.button:hover {
  color: #fff;
  transform: translate(-2px, -2px) rotate(-1deg);
  box-shadow:
    6px 6px 0 var(--red-dark),
    0 0 35px rgba(255, 26, 26, 0.8);
  animation: wobble 0.4s ease-in-out;
}

.button:hover::before {
  animation: shine 0.7s ease-in-out;
}

.button:active {
  transform: translate(3px, 3px);
  box-shadow: 1px 1px 0 var(--red-dark);
}

/* ---------- Footer ---------- */
footer {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--dim);
  border-top: 1px solid #222;
}

footer p::before { content: "// "; color: var(--red-dark); }

/* ---------- Scrollbar ---------- */
::-webkit-scrollbar { width: 12px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb {
  background: var(--red-dark);
  border: 2px solid var(--bg);
  border-radius: 6px;
}
::-webkit-scrollbar-thumb:hover { background: var(--red); }

/* ---------- Animations ---------- */
@keyframes blink {
  0%, 49%  { opacity: 1; }
  50%, 100% { opacity: 0; }
}

@keyframes crt-flicker {
  0%, 100% { opacity: 1; }
  92%      { opacity: 1; }
  93%      { opacity: 0.92; }
  94%      { opacity: 1; }
  97%      { opacity: 0.95; }
}

@keyframes neon-pulse {
  0%, 100% { text-shadow: 0 0 4px var(--red), 0 0 10px var(--red-dark); }
  50%      { text-shadow: 0 0 8px var(--red), 0 0 22px var(--red); }
}

@keyframes glitch {
  0%, 90%, 100% {
    transform: translate(0);
    text-shadow: 2px 0 var(--cyan), -2px 0 var(--magenta);
  }
  92% {
    transform: translate(-3px, 1px) skewX(4deg);
    text-shadow: 5px 0 var(--cyan), -5px 0 var(--magenta);
  }
  94% {
    transform: translate(3px, -1px) skewX(-4deg);
    text-shadow: -5px 0 var(--cyan), 5px 0 var(--magenta);
  }
  96% {
    transform: translate(-1px, 2px);
    text-shadow: 3px 2px var(--cyan), -3px -2px var(--magenta);
  }
}

@keyframes shine {
  from { left: -75%; }
  to   { left: 150%; }
}

@keyframes wobble {
  0%, 100% { transform: translate(-2px, -2px) rotate(-1deg); }
  25%      { transform: translate(-2px, -2px) rotate(1.5deg); }
  50%      { transform: translate(-2px, -2px) rotate(-1.5deg); }
  75%      { transform: translate(-2px, -2px) rotate(1deg); }
}

/* ---------- Mobile ---------- */
@media (max-width: 480px) {
  body::after { font-size: 0.65rem; top: 8px; left: 10px; }
  .button { padding: 0.8rem 1.2rem; font-size: 0.9rem; }
}

/* ---------- Respect people who don't want motion ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation: none !important;
    transition: none !important;
  }
}
/* ==========================================================
   EASTER EGG STYLES
   ========================================================== */

/* Toast message */
#toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  z-index: 10000;
  max-width: 90vw;
  padding: 0.7rem 1.2rem;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: #fff;
  background: #000;
  border: 1px solid var(--red);
  box-shadow: 0 0 18px rgba(255, 26, 26, 0.5);
  transform: translate(-50%, 150%);
  opacity: 0;
  pointer-events: none;
  transition: transform 0.3s ease, opacity 0.3s ease;
}

#toast.show {
  transform: translate(-50%, 0);
  opacity: 1;
}

/* TV static burst */
#static {
  position: fixed;
  inset: 0;
  z-index: 9997;
  pointer-events: none;
  background:
    repeating-conic-gradient(#fff 0% 25%, #000 0% 50%) 0 0 / 6px 6px;
  opacity: 0.55;
  animation: static-shake 0.15s steps(2) infinite;
}

@keyframes static-shake {
  0%   { background-position: 0 0; }
  25%  { background-position: 3px -2px; }
  50%  { background-position: -4px 3px; }
  75%  { background-position: 2px 4px; }
  100% { background-position: -3px -3px; }
}

/* White mode */
html.inverted {
  filter: invert(1) hue-rotate(180deg);
}

/* The secret © key */
#key {
  cursor: default;
  user-select: none;
}

/* Secret page and 404 */
.terminal {
  font-family: var(--font-mono);
  text-align: left;
}

.terminal p {
  margin: 0.4rem 0;
  opacity: 0;
  animation: type-in 0.4s ease forwards;
}

.terminal p:nth-child(1) { animation-delay: 0.3s; }
.terminal p:nth-child(2) { animation-delay: 1.2s; }
.terminal p:nth-child(3) { animation-delay: 2.1s; }
.terminal p:nth-child(4) { animation-delay: 3.0s; }
.terminal p:nth-child(5) { animation-delay: 3.9s; }
.terminal p:nth-child(6) { animation-delay: 4.8s; }

.terminal .ok  { color: #3dff7a; }
.terminal .bad { color: var(--red); }

@keyframes type-in {
  from { opacity: 0; transform: translateX(-8px); }
  to   { opacity: 1; transform: translateX(0); }
}
/* ==========================================================
   EXTRA PAGES
   ========================================================== */

.page-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 1.25rem;
  margin-bottom: 1.5rem;
  font-family: var(--font-mono);
  font-size: 0.85rem;
}

.listing {
  width: 100%;
  border-collapse: collapse;
  font-family: var(--font-mono);
  font-size: 0.9rem;
}

.listing th,
.listing td {
  padding: 0.5rem 0.6rem;
  text-align: left;
  border-bottom: 1px dashed #222;
}

.listing th {
  color: var(--dim);
  text-transform: uppercase;
  font-size: 0.75rem;
  letter-spacing: 0.1em;
}

.listing .note { color: var(--dim); }

.status-row {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.7rem 0;
  border-bottom: 1px dashed #222;
  font-family: var(--font-mono);
  font-size: 0.9rem;
}

.dot::before { content: "●"; margin-right: 0.5rem; }
.up   { color: #3dff7a; }
.warn { color: #ffcc00; }
.down { color: var(--red); }

.log {
  margin: 1rem 0;
  padding: 1rem;
  overflow-x: auto;
  white-space: pre-wrap;
  text-align: left;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  line-height: 1.8;
  background: #000;
  border: 1px solid #222;
}

.log .t { color: var(--dim); }
.log .i { color: #3dff7a; }
.log .w { color: #ffcc00; }
.log .e { color: var(--red); }

.terminal p:nth-child(7) { animation-delay: 5.7s; }
