/* =============================================
   GARAGE404 — MAIN STYLESHEET
   8-bit / CRT / IndieWeb aesthetic
   ============================================= */

@import url('https://fonts.googleapis.com/css2?family=Press+Start+2P&display=swap');

:root {
  --red: #cc0000;
  --red-bright: #ff2222;
  --green: #00ff41;
  --amber: #ffb000;
  --bg: #0a0a0a;
  --bg-mid: #111111;
  --bg-panel: #1a1a1a;
  --text: #e8e8e8;
  --text-dim: #888888;
  --pixel-border: #333333;
  --tv-body: #2a2318;
  --tv-bezel: #1a160f;
  --scanline-opacity: 0.15;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html, body {
  width: 100%;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: 'Press Start 2P', monospace;
  font-size: 10px;
  line-height: 1.8;
  overflow-x: hidden;
}

.hidden {
  display: none !important;
}

.red { color: var(--red-bright); }

/* =============================================
   TV INTRO
   ============================================= */

#tv-intro {
  position: fixed;
  inset: 0;
  background: #000;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  cursor: pointer;
}

#tv-outer {
  position: relative;
  width: 380px;
  display: flex;
  flex-direction: column;
  align-items: center;
  animation: tv-zoom-in 1.2s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

@keyframes tv-zoom-in {
  from { transform: scale(0.2); opacity: 0; }
  to   { transform: scale(1);   opacity: 1; }
}

/* Bunny ears */
#antenna-left,
#antenna-right {
  position: absolute;
  bottom: 100%;
  width: 6px;
  height: 90px;
  background: #555;
  border-radius: 3px 3px 0 0;
}
#antenna-left  { left:  110px; transform: rotate(-18deg); transform-origin: bottom center; }
#antenna-right { right: 110px; transform: rotate(18deg);  transform-origin: bottom center; }

/* Ball on tips */
#antenna-left::before,
#antenna-right::before {
  content: '';
  position: absolute;
  top: -6px;
  left: 50%;
  transform: translateX(-50%);
  width: 12px;
  height: 12px;
  background: #888;
  border-radius: 50%;
}

#tv-body {
  width: 380px;
  background: var(--tv-body);
  border-radius: 16px 16px 20px 20px;
  padding: 18px 20px 20px;
  box-shadow:
    inset 0 2px 0 #4a3d2a,
    inset 0 -2px 0 #0a0807,
    0 8px 32px rgba(0,0,0,0.8),
    0 0 0 3px var(--tv-bezel);
}

#tv-screen-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 4/3;
  background: #000;
  border-radius: 8px;
  overflow: hidden;
  box-shadow:
    inset 0 0 30px rgba(0,0,0,0.9),
    0 0 0 4px #0a0807,
    0 0 0 6px #3a2e1e;
}

#static-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 1;
  transition: opacity 0.8s ease;
}

#tv-content {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.6s ease;
}

#tv-scanlines {
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 2px,
    rgba(0,0,0,0.3) 2px,
    rgba(0,0,0,0.3) 4px
  );
  pointer-events: none;
  z-index: 2;
}

#tv-text {
  text-align: center;
  z-index: 3;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 20px;
}

.channel-num {
  font-family: 'Press Start 2P', monospace;
  font-size: 9px;
  color: var(--amber);
  opacity: 0.8;
}

.tv-title {
  font-family: 'Press Start 2P', monospace;
  font-size: 22px;
  color: var(--green);
  text-shadow: 0 0 20px var(--green), 0 0 40px var(--green);
  letter-spacing: 2px;
  animation: flicker 4s infinite;
}

.tv-sub {
  font-family: 'Press Start 2P', monospace;
  font-size: 8px;
  color: var(--red-bright);
  opacity: 0.9;
}

@keyframes flicker {
  0%, 95%, 100% { opacity: 1; }
  96% { opacity: 0.4; }
  97% { opacity: 1; }
  98% { opacity: 0.2; }
  99% { opacity: 1; }
}

#tv-controls {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 12px;
  padding-right: 8px;
}

.tv-knob {
  width: 20px;
  height: 20px;
  background: radial-gradient(circle at 35% 35%, #6a5a40, #2a1e10);
  border-radius: 50%;
  box-shadow: 0 2px 4px rgba(0,0,0,0.6), inset 0 1px 0 rgba(255,255,255,0.1);
}

#tv-speaker-grille {
  display: grid;
  grid-template-columns: repeat(3, 8px);
  gap: 5px;
  margin-top: 10px;
  justify-content: center;
}

.speaker-dot {
  width: 8px;
  height: 8px;
  background: #1a1108;
  border-radius: 50%;
  box-shadow: inset 0 1px 2px rgba(0,0,0,0.8);
}

#skip-text {
  margin-top: 24px;
  font-family: 'Press Start 2P', monospace;
  font-size: 8px;
  color: #444;
  animation: blink 1.2s step-end infinite;
}

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

/* TV fade-out animation */
#tv-intro.fading {
  animation: tv-fadeout 1.2s ease forwards;
}

@keyframes tv-fadeout {
  0%   { opacity: 1; transform: scale(1); }
  40%  { opacity: 1; transform: scale(1.05); }
  100% { opacity: 0; transform: scale(0.0); }
}

/* =============================================
   CRT OVERLAY (main site)
   ============================================= */

#crt-overlay {
  position: fixed;
  inset: 0;
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 3px,
    rgba(0,0,0,0.07) 3px,
    rgba(0,0,0,0.07) 4px
  );
  pointer-events: none;
  z-index: 100;
}

/* =============================================
   HEADER
   ============================================= */

#site-header {
  background: var(--bg-mid);
  border-bottom: 3px solid var(--red);
  padding: 20px;
  text-align: center;
  position: relative;
}

#header-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

#logo-area {
  display: flex;
  align-items: center;
  gap: 14px;
}

.logo-pixel {
  color: var(--red);
  font-size: 14px;
}

h1 {
  font-size: 28px;
  letter-spacing: 4px;
  color: var(--text);
  text-shadow: 3px 3px 0 var(--red), 6px 6px 0 #660000;
}

#tagline {
  font-size: 8px;
  color: var(--text-dim);
  letter-spacing: 1px;
}

#hit-counter {
  font-size: 8px;
  color: var(--green);
  background: #000;
  border: 1px solid var(--green);
  padding: 4px 10px;
  box-shadow: 0 0 8px var(--green);
}

/* =============================================
   NAVIGATION
   ============================================= */

#main-nav {
  background: #0f0f0f;
  border-bottom: 2px solid #222;
  padding: 0 20px;
}

#main-nav ul {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 4px;
  padding: 10px 0;
}

#main-nav a {
  display: block;
  color: var(--text);
  text-decoration: none;
  font-size: 9px;
  padding: 8px 14px;
  background: var(--bg-panel);
  border: 2px solid var(--pixel-border);
  transition: all 0.1s;
  image-rendering: pixelated;
}

#main-nav a:hover {
  background: var(--red);
  border-color: var(--red-bright);
  color: #fff;
  transform: translateY(-2px);
  box-shadow: 0 4px 0 #660000;
}

/* =============================================
   MAIN CONTENT
   ============================================= */

#main-content {
  max-width: 800px;
  margin: 30px auto;
  padding: 0 20px;
  display: flex;
  flex-direction: column;
  gap: 30px;
}

.pixel-border {
  border: 3px solid var(--pixel-border);
  padding: 24px;
  background: var(--bg-panel);
  position: relative;
}

/* pixel corner decorations */
.pixel-border::before,
.pixel-border::after {
  content: '■';
  position: absolute;
  color: var(--red);
  font-size: 8px;
}
.pixel-border::before { top: -6px; left: -6px; }
.pixel-border::after  { bottom: -6px; right: -6px; }

#welcome-box h2 {
  font-size: 14px;
  color: var(--red-bright);
  margin-bottom: 16px;
  text-shadow: 2px 2px 0 #660000;
}

#welcome-box p {
  font-size: 9px;
  color: var(--text);
  margin-bottom: 12px;
  line-height: 2;
}

#welcome-box p em {
  color: var(--green);
  font-style: normal;
}

.small-text {
  font-size: 7px;
  color: var(--text-dim);
}

#latest-posts h3,
#photo-teaser h3 {
  font-size: 10px;
  color: var(--amber);
  margin-bottom: 14px;
  border-bottom: 1px solid #333;
  padding-bottom: 8px;
}

.post-preview {
  display: flex;
  gap: 16px;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px dashed #222;
}

.post-date {
  font-size: 7px;
  color: var(--text-dim);
  white-space: nowrap;
}

.post-preview a {
  font-size: 8px;
  color: var(--green);
  text-decoration: none;
}

.post-preview a:hover {
  color: var(--red-bright);
  text-decoration: underline;
}

/* =============================================
   FOOTER
   ============================================= */

#site-footer {
  background: var(--bg-mid);
  border-top: 3px solid #222;
  padding: 24px 20px;
  text-align: center;
  margin-top: 40px;
}

#footer-badges {
  display: flex;
  justify-content: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.badge {
  font-size: 7px;
  background: #000;
  border: 2px solid #444;
  padding: 6px 8px;
  line-height: 1.6;
  color: var(--text-dim);
  text-align: center;
  min-width: 60px;
}

.badge .red {
  font-size: 9px;
}

#footer-text {
  font-size: 7px;
  color: #444;
}

/* =============================================
   CR250 EASTER EGG
   ============================================= */

#cr250-wrap {
  position: fixed;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 60px;
  pointer-events: none;
  z-index: 50;
}

#cr250-canvas {
  width: 100%;
  height: 100%;
}

/* =============================================
   SCROLLBAR
   ============================================= */

::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: #0a0a0a; }
::-webkit-scrollbar-thumb { background: var(--red); }
::-webkit-scrollbar-thumb:hover { background: var(--red-bright); }

/* =============================================
   SELECTION
   ============================================= */

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

/* =============================================
   garage404 1 NEW FEATURES (session 2)
   ============================================= */

/* Programmatic cursors set in js/cursor.js */
html { cursor: var(--cursor-rag, crosshair); }
a { cursor: var(--cursor-wrench, pointer); }
button { cursor: var(--cursor-thumb, pointer); }

/* CRT warm-up effect */
#main-site.crt-warming {
  animation: crt-warmup 1.6s ease-out forwards;
  transform: translateZ(0);
}

@keyframes crt-warmup {
  0%   { filter: brightness(0.85) contrast(1.35) saturate(1.2) hue-rotate(-8deg); }
  12%  { filter: brightness(1.2)  contrast(1.6)  saturate(1.3) hue-rotate(10deg); }
  24%  { filter: brightness(0.9)  contrast(1.45) saturate(1.2) hue-rotate(-6deg); }
  38%  { filter: brightness(1.15) contrast(1.55) saturate(1.25) hue-rotate(8deg); }
  55%  { filter: brightness(0.95) contrast(1.3)  saturate(1.15) hue-rotate(-3deg); }
  72%  { filter: brightness(1.05) contrast(1.22) saturate(1.08) hue-rotate(2deg); }
  100% { filter: none; }
}

/* Header: search button */
#hit-counter {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.socket-search {
  font-family: inherit;
  font-size: 10px;
  line-height: 1;
  padding: 2px 6px;
  border: 1px solid var(--green);
  background: #000;
  color: var(--green);
  box-shadow: 0 0 8px rgba(0,255,65,0.35);
}

.socket-search:hover {
  background: #001b08;
}

/* Nav: mechanic radio strip */
.garage-radio {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 10px;
  padding: 6px 0 12px;
}

.radio-dial {
  font-size: 8px;
  color: var(--amber);
  background: #000;
  border: 1px solid #333;
  padding: 4px 10px;
  box-shadow: inset 0 0 12px rgba(255,176,0,0.15);
  animation: radio-flicker 3.5s infinite;
}

.radio-dial.is-playing {
  box-shadow: 0 0 10px rgba(255,176,0,0.28), inset 0 0 12px rgba(255,176,0,0.15);
}

@keyframes radio-flicker {
  0%, 92%, 100% { opacity: 1; }
  93% { opacity: 0.4; }
  94% { opacity: 1; }
  95% { opacity: 0.6; }
  96% { opacity: 1; }
}

.radio-toggle {
  font-family: inherit;
  font-size: 8px;
  padding: 4px 10px;
  background: var(--bg-panel);
  color: var(--text);
  border: 2px solid var(--pixel-border);
}

.radio-toggle:hover {
  background: var(--red);
  border-color: var(--red-bright);
  color: #fff;
}

/* Footer: timeclock icon and hidden socket dot */
#footer-badges {
  position: relative;
}

.timeclock-icon {
  font-family: inherit;
  font-size: 12px;
  padding: 6px 8px;
  background: #000;
  border: 2px solid #222;
  color: #555;
  opacity: 0.55;
}

.timeclock-icon:hover {
  color: var(--amber);
  border-color: var(--amber);
  opacity: 0.9;
}

#socket-find {
  font-size: 10px;
  color: #111;
  margin-left: 2px;
  user-select: none;
  cursor: pointer;
}

#socket-find.found {
  color: var(--amber);
  animation: socket-drop 900ms cubic-bezier(0.2, 0.9, 0.2, 1) both;
}

#socket-find.found a {
  color: var(--green);
  text-decoration: none;
}

#socket-find.found a:hover {
  color: var(--red-bright);
  text-decoration: underline;
}

@keyframes socket-drop {
  0%   { transform: translateY(-12px); }
  60%  { transform: translateY(10px); }
  78%  { transform: translateY(-6px); }
  92%  { transform: translateY(3px); }
  100% { transform: translateY(0px); }
}

/* Timeclock modal */
#timeclock-modal {
  position: fixed;
  inset: 0;
  display: none;
  align-items: flex-end;
  justify-content: center;
  background: rgba(0,0,0,0.65);
  z-index: 9998;
}

#timeclock-modal.open { display: flex; }

.timeclock-shell {
  width: min(560px, 92vw);
  margin: 18px;
  background: #0b0b0b;
  border: 3px solid #2a2a2a;
  box-shadow: 0 12px 40px rgba(0,0,0,0.8);
  transform: translateY(110%);
  animation: tc-slide 260ms ease-out forwards;
}

@keyframes tc-slide {
  to { transform: translateY(0%); }
}

.timeclock-screen {
  padding: 16px;
  background: radial-gradient(circle at 50% 10%, rgba(255,176,0,0.10), rgba(0,0,0,0) 50%), #050505;
}

.timeclock-text {
  font-size: 8px;
  color: var(--amber);
  text-shadow: 0 0 14px rgba(255,176,0,0.25);
  white-space: pre-wrap;
}

.timeclock-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 10px;
}

.tc-btn {
  font-family: inherit;
  font-size: 8px;
  padding: 6px 10px;
  background: #000;
  color: var(--amber);
  border: 2px solid #3a2b10;
}

.tc-btn:hover {
  border-color: var(--amber);
}

/* Socket tip modal */
#socket-tip {
  position: fixed;
  inset: 0;
  display: none;
  align-items: flex-start;
  justify-content: center;
  padding-top: 20px;
  background: rgba(0,0,0,0.45);
  z-index: 9997;
}

#socket-tip.open { display: flex; }

.socket-tip-inner {
  background: #000;
  border: 2px solid var(--green);
  box-shadow: 0 0 18px rgba(0,255,65,0.25);
  padding: 12px 14px;
  width: min(420px, 92vw);
}

.socket-tip-inner pre {
  color: var(--green);
  font-size: 8px;
  white-space: pre-wrap;
}

.socket-tip-close {
  margin-top: 10px;
  font-family: inherit;
  font-size: 8px;
  padding: 6px 10px;
  background: var(--bg-panel);
  border: 2px solid var(--pixel-border);
  color: var(--text);
}

.socket-tip-close:hover {
  background: var(--red);
  border-color: var(--red-bright);
  color: #fff;
}

/* Midnight shift mode */
body.midnight-mode {
  background: #070a12;
}

body.midnight-mode #site-header {
  border-bottom-color: #4a0a0a;
}

body.midnight-mode {
  --red: #4a0a0a;
}

/* Ghost canvas wrap */
#ghost-atc-wrap {
  position: fixed;
  left: 0;
  bottom: 0;
  width: 1px;
  height: 80px;
  pointer-events: none;
  z-index: 60;
  opacity: 0.75;
}

#ghost-atc-canvas {
  width: 320px;
  height: 80px;
}

/* Hidden parts table */
.restricted-table-wrap {
  margin-top: 16px;
  overflow-x: auto;
}

.restricted-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 8px;
}

.restricted-table th,
.restricted-table td {
  border: 2px solid #222;
  padding: 10px;
  text-align: left;
}

.restricted-table th {
  color: var(--amber);
  background: #050505;
}

.restricted-table td {
  color: var(--text);
  background: #0b0b0b;
}

.back-link {
  color: var(--green);
  text-decoration: none;
}

.back-link:hover {
  color: var(--red-bright);
  text-decoration: underline;
}
