/* ============================================================
   gcuh — gothic personal site stylesheet
   palette: blood & candlelight
   ============================================================ */

/* ---------- fonts ---------- */
@font-face {
  font-family: "VinylGeorge";
  src: url("Vinyl_George.ttf") format("truetype");
  font-weight: normal;
  font-display: swap;
}

/* ---------- theme variables (night / default) ---------- */
:root,
html[data-theme="night"] {
  --bg: #0a0505;
  --bg-deep: #050202;
  --panel: #150a09;
  --panel-2: #1d0e0c;
  --border: #3a1d1d;
  --border-bright: #6b2a30;
  --text: #e6d9c3;
  --text-dim: #9c8371;
  --blood: #8e1420;
  --blood-bright: #c11f30;
  --candle: #e8a45a;
  --candle-dim: #a86a34;
  --glow: rgba(232, 164, 90, 0.28);
  --link: #e0b98a;
  --link-hover: #ffd9a0;
  --shadow: 0 0 18px rgba(0, 0, 0, 0.7);
  --font-display: "VinylGeorge", "Lucida Blackletter", "Old English Text MT", Georgia, serif;
  --font-body: Georgia, "Times New Roman", serif;
  --font-mono: "Courier New", Courier, monospace;
}

/* ---------- theme variables (day) ---------- */
html[data-theme="day"] {
  --bg: #26140e;
  --bg-deep: #180b07;
  --panel: #2e1b12;
  --panel-2: #362015;
  --border: #5a3226;
  --border-bright: #8a4a38;
  --text: #f2e3c9;
  --text-dim: #bfa084;
  --blood: #b22634;
  --blood-bright: #e03644;
  --candle: #ffc27a;
  --candle-dim: #d68a3a;
  --glow: rgba(255, 170, 90, 0.35);
  --link: #f0c49a;
  --link-hover: #ffe0b8;
  --shadow: 0 0 14px rgba(0, 0, 0, 0.5);
}

/* ---------- base ---------- */
* { box-sizing: border-box; }

html {
  background: var(--bg-deep);
  color-scheme: dark;
}

body {
  margin: 0;
  font-family: var(--font-body);
  font-size: 17px;
  line-height: 1.65;
  color: var(--text);
  background:
    radial-gradient(ellipse at 50% -10%, rgba(142, 20, 32, 0.22), transparent 60%),
    radial-gradient(ellipse at 50% 115%, rgba(232, 164, 90, 0.10), transparent 55%),
    var(--bg);
  min-height: 100vh;
}

/* ---------- CRT overlay ---------- */
.crt-overlay {
  position: fixed;
  inset: 0;
  z-index: 9998;
  pointer-events: none;
  background:
    repeating-linear-gradient(
      to bottom,
      rgba(0, 0, 0, 0) 0,
      rgba(0, 0, 0, 0) 2px,
      rgba(0, 0, 0, 0.22) 3px
    );
  box-shadow: inset 0 0 120px rgba(0, 0, 0, 0.75);
  mix-blend-mode: multiply;
  animation: crt-flicker 4s infinite;
}

.crt-overlay::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: -20%;
  height: 12%;
  background: linear-gradient(
    to bottom,
    transparent,
    rgba(232, 164, 90, 0.05),
    rgba(255, 255, 255, 0.03),
    transparent
  );
  animation: crt-sweep 9s linear infinite;
}

body.crt-off .crt-overlay { display: none; }

@keyframes crt-flicker {
  0%, 100% { opacity: 1; }
  92% { opacity: 1; }
  93% { opacity: 0.86; }
  94% { opacity: 1; }
  96% { opacity: 0.94; }
}

@keyframes crt-sweep {
  0% { top: -20%; }
  100% { top: 120%; }
}

/* ---------- header ---------- */
.site-header {
  position: relative;
  max-width: 1000px;
  margin: 0 auto;
  padding: 26px 18px 14px;
  text-align: center;
}

.brand {
  font-family: var(--font-display);
  font-size: clamp(3rem, 9vw, 5.5rem);
  line-height: 1;
  color: var(--candle);
  text-decoration: none;
  letter-spacing: 0.06em;
  text-shadow:
    0 0 8px var(--glow),
    0 0 30px rgba(232, 164, 90, 0.25);
  animation: candle-flicker 3.2s ease-in-out infinite;
  display: inline-block;
}

@keyframes candle-flicker {
  0%, 100% { text-shadow: 0 0 8px var(--glow), 0 0 26px rgba(232, 164, 90, 0.22); }
  25% { text-shadow: 0 0 10px var(--glow), 0 0 34px rgba(232, 164, 90, 0.3); }
  50% { text-shadow: 0 0 6px var(--glow), 0 0 20px rgba(232, 164, 90, 0.18); }
  75% { text-shadow: 0 0 12px var(--glow), 0 0 38px rgba(232, 164, 90, 0.32); }
}

.tagline {
  margin: 6px 0 18px;
  font-style: italic;
  color: var(--text-dim);
  font-size: 0.95rem;
}

/* pixel bats drifting around the header */
.bats { position: absolute; inset: 0; pointer-events: none; }
.bat {
  position: absolute;
  width: 26px;
  height: 15px;
  background: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 15 8' shape-rendering='crispEdges'><path fill='%236e1220' d='M3 1h1v1h1v1h-1v1H3V2H2V1h1zm7 0h1v1h1v1h-1v1h-1V2H8V1h2zM0 4h1v1h1v2h1V4h1v1h1v1h1V5h1v1h1v1h1V6h1V5h1V4h1V3H10v1H9v1H8V4H7V3H6v1H5V4H4v1H3V3H0v1z' transform='translate(2 0)'/></svg>")
    no-repeat center / contain;
  opacity: 0.55;
}
.bat-1 { top: 8px; left: 6%; animation: bat-hover 7s ease-in-out infinite; }
.bat-2 { top: 22px; right: 8%; animation: bat-hover 9s ease-in-out 1.5s infinite; }
.bat-3 { top: 60px; left: 16%; animation: bat-hover 8s ease-in-out 3s infinite; }

@keyframes bat-hover {
  0%, 100% { transform: translateY(0) rotate(-3deg); }
  50% { transform: translateY(-9px) rotate(3deg); }
}

/* ---------- nav ---------- */
.nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px 10px;
  margin: 0 0 16px;
}

.nav a {
  font-family: var(--font-display);
  font-size: 1.35rem;
  color: var(--link);
  text-decoration: none;
  padding: 4px 10px 2px;
  border: 1px solid transparent;
  border-radius: 4px;
  transition: color 0.15s ease, text-shadow 0.15s ease, border-color 0.15s ease;
}

.nav a::before { content: "[ "; color: var(--blood-bright); font-family: var(--font-mono); font-size: 0.8rem; }
.nav a::after { content: " ]"; color: var(--blood-bright); font-family: var(--font-mono); font-size: 0.8rem; }

.nav a:hover,
.nav a:focus-visible {
  color: var(--link-hover);
  text-shadow: 0 0 10px var(--glow);
  border-color: var(--border-bright);
}

/* ---------- content ---------- */
.content {
  max-width: 1000px;
  margin: 0 auto;
  padding: 10px 18px 30px;
}

/* page title */
.page-title {
  font-family: var(--font-display);
  font-size: clamp(2rem, 6vw, 3rem);
  color: var(--blood-bright);
  text-align: center;
  margin: 6px 0 4px;
  text-shadow: 0 0 12px rgba(193, 31, 48, 0.35);
}

.page-subtitle {
  text-align: center;
  color: var(--text-dim);
  font-style: italic;
  margin: 0 0 22px;
  font-size: 0.95rem;
}

/* ---------- panels / boxes ---------- */
.box {
  background: var(--panel);
  border: 2px solid var(--border);
  outline: 1px solid var(--border-bright);
  outline-offset: 3px;
  padding: 18px;
  margin: 0 0 24px;
  box-shadow: var(--shadow);
}

.box-title {
  font-family: var(--font-display);
  font-size: 1.6rem;
  color: var(--candle);
  margin: 0 0 12px;
  text-shadow: 0 0 8px var(--glow);
}

.box-title::before { content: "❧ "; color: var(--blood-bright); }
.box-title::after { content: " ❧"; color: var(--blood-bright); }

/* ---------- typography ---------- */
.text-dim { color: var(--text-dim); }
.candle { color: var(--candle); }
h2 { color: var(--candle); font-family: var(--font-display); font-weight: normal; }
h3 { color: var(--blood-bright); font-family: var(--font-display); font-weight: normal; }
a { color: var(--link); }
a:hover, a:focus-visible { color: var(--link-hover); }
em { color: var(--candle); }
::selection { background: var(--blood); color: var(--text); }

/* ---------- buttons ---------- */
.btn {
  font-family: var(--font-display);
  font-size: 1.1rem;
  color: var(--candle);
  background: var(--panel-2);
  border: 2px solid var(--border-bright);
  padding: 6px 14px 3px;
  cursor: pointer;
  border-radius: 4px;
  transition: background 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}
.btn:hover, .btn:focus-visible {
  background: var(--blood);
  color: var(--text);
  box-shadow: 0 0 14px rgba(142, 20, 32, 0.6);
}

/* ---------- marquee ---------- */
.top-marquee {
  margin-top: 6px;
  color: var(--text-dim);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  padding: 4px 0;
  font-family: var(--font-mono);
  font-size: 0.9rem;
  letter-spacing: 0.08em;
  background: rgba(0, 0, 0, 0.25);
}

/* ---------- footer ---------- */
.site-footer {
  border-top: 2px solid var(--border);
  background: linear-gradient(to top, rgba(142, 20, 32, 0.14), transparent);
  padding: 22px 18px 30px;
  text-align: center;
  color: var(--text-dim);
  font-size: 0.9rem;
}

.counter-row {
  margin-bottom: 10px;
}
.counter-row img {
  height: 20px;
  width: auto;
  image-rendering: pixelated;
  vertical-align: middle;
  margin: 0 1px;
}

.footer-buttons {
  margin-top: 14px;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
}
.footer-buttons img {
  width: 88px;
  height: 31px;
  image-rendering: pixelated;
  image-rendering: auto;
}

.footer-toggles {
  margin-top: 14px;
  display: flex;
  gap: 10px;
  justify-content: center;
}

.footer-meta { margin-top: 12px; font-family: var(--font-mono); font-size: 0.8rem; }

/* ---------- misc decorations ---------- */
.divider {
  text-align: center;
  color: var(--blood-bright);
  font-family: var(--font-mono);
  letter-spacing: 0.4em;
  margin: 6px 0 18px;
  user-select: none;
}

.blink { animation: blink 1.1s steps(2, start) infinite; }
@keyframes blink { to { visibility: hidden; } }

.hidden { display: none !important; }

/* ---------- fake windows (terminal, easter eggs) ---------- */
.window {
  position: fixed;
  min-width: 280px;
  max-width: min(560px, calc(100vw - 24px));
  background: var(--panel);
  border: 2px solid var(--border-bright);
  box-shadow: 0 10px 34px rgba(0, 0, 0, 0.75);
  z-index: 9999;
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--text);
}
.window-titlebar {
  display: flex;
  align-items: center;
  gap: 8px;
  background: linear-gradient(to bottom, var(--border-bright), var(--blood));
  color: var(--text);
  padding: 5px 8px;
  cursor: grab;
  user-select: none;
  font-family: var(--font-mono);
  font-size: 12px;
}
.window-titlebar:active { cursor: grabbing; }
.window-close {
  margin-left: auto;
  background: #2a0d10;
  border: 1px solid #000;
  color: var(--blood-bright);
  font-family: var(--font-mono);
  cursor: pointer;
  width: 22px;
  height: 22px;
  line-height: 1;
  flex: none;
}
.window-close:hover { background: var(--blood); color: var(--text); }
.window-body { padding: 10px 12px; max-height: 60vh; overflow-y: auto; }

.terminal-body {
  min-height: 160px;
  white-space: pre-wrap;
  word-break: break-word;
}
.terminal-body .dim { color: var(--text-dim); }
.terminal-body .err { color: var(--blood-bright); }
.terminal-prompt {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-top: 6px;
}
.terminal-prompt input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: var(--candle);
  font-family: var(--font-mono);
  font-size: 13px;
}

/* launcher button (bottom right) */
.launcher {
  position: fixed;
  right: 14px;
  bottom: 14px;
  z-index: 9997;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--candle);
  background: var(--panel-2);
  border: 2px solid var(--border-bright);
  padding: 6px 10px;
  cursor: pointer;
  box-shadow: var(--shadow);
}
.launcher:hover, .launcher:focus-visible {
  background: var(--blood);
  color: var(--text);
}

/* bats are clickable easter eggs */
.bat { pointer-events: auto; cursor: pointer; }
.bat:hover { opacity: 0.95; }

/* ---------- skip link (a11y) ---------- */
.skip-link {
  position: absolute;
  left: -999px;
  top: 0;
  background: var(--blood);
  color: var(--text);
  padding: 8px 12px;
  z-index: 10000;
}
.skip-link:focus { left: 8px; top: 8px; }

/* ---------- responsive ---------- */
@media (max-width: 640px) {
  body { font-size: 16px; }
  .box { padding: 14px; }
  .nav a { font-size: 1.15rem; }
  .bats { display: none; }
}

/* ---------- reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
  .crt-overlay { animation: none; }
}
