@import url('https://fonts.googleapis.com/css2?family=Space+Mono:ital,wght@0,400;0,700;1,400&family=DM+Serif+Display:ital@0;1&display=swap');
@import url('crt.css');

:root {
  /* Surfaces */
  --bg-page:       #08090f;
  --bg-wrapper:    #0b0d18;
  --bg-panel:      #0e1020;
  --bg-panel-alt:  #0b0e1a;

  /* Borders & accents */
  --border:         #18203a;
  --border-accent:  #1a50cc;

  /* Blues */
  --blue-bright:  #60b8ff;
  --blue-mid:     #2288ff;
  --blue-muted:   #0a1a50;

  /* Text */
  --text-bright:   #ffffff;
  --text-body:     #c0ccee;
  --text-muted:    #5868a0;
  --text-label:    #3a4870;

  /* Accents */
  --green-neon:      #39ff14;
  --green-neon-dark: #1c6b09;

  /* Typography */
  --font-body:    Verdana, Tahoma, Arial, sans-serif;
  --font-mono:   'Space Mono', 'Courier New', monospace;
  --font-display: 'DM Serif Display', Georgia, 'Times New Roman', serif;

  /* Spacing scale */
  --space-xs: 4px;
  --space-sm: 8px;
  --space-md: 12px;
  --space-lg: 16px;

  /* Motion */
  --transition-fast: 0.15s ease-out;
}

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


body {
  background-color: var(--bg-page);
  background-image: url("../img/backgrounds/space.gif");
  background-size: 400px 400px;
  font-family: var(--font-body);
  font-size: 13px;
  color: var(--text-body);
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 28px 0 48px;
}

/* --- Page Wrapper --- */
#wrapper {
  width: 1350px;
  height: 800px;
  margin: 0;
  background-color: var(--bg-wrapper);
  border: 2px solid var(--border);
  box-shadow:
    0 0 0 1px var(--blue-muted),
    0 0 40px rgba(34, 136, 255, 0.1);
  position: relative;
  overflow: hidden;
  z-index: 1;
  display: flex;
  flex-direction: column;
  animation: crt-glitch 20s step-end infinite;
}

/* --- Light Leaks --- */
/* Irregular double-peak breathing: inhale at 40%, brief exhale,
   second smaller inhale at 72%, then quiet. Feels uneven/organic
   rather than a mechanical sine wave.                            */
@keyframes light-leak-breathe {
  0%   { opacity: 0.45; }
  40%  { opacity: 1.0;  }
  55%  { opacity: 0.75; }
  72%  { opacity: 0.92; }
  100% { opacity: 0.45; }
}

#wrapper::after {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 10;
  background:
    radial-gradient(ellipse 60% 45% at 0% 0%,    rgba(255, 130, 50, 0.13), transparent 70%),
    radial-gradient(ellipse 38% 53% at 100% 0%,  rgba(220, 100, 40, 0.07), transparent 70%),
    radial-gradient(ellipse 30% 30% at 100% 100%, rgba(255, 70,  20, 0.06), transparent 70%);
  mix-blend-mode: screen;
  animation: light-leak-breathe 6s ease-in-out infinite;
}

/* --- Header --- */
#header {
  display: flex;
  align-items: center;
  gap: 0;
  background-color: var(--bg-wrapper);
  padding: 12px 32px 1px 8px;
  border-bottom: 1px solid var(--border);
}

#globe-canvas {
  flex-shrink: 0;
  display: block;
  width: 160px;  /* fixes phenomenon's resize() doubling loop */
  height: 160px;
  /* fade the hard sphere boundary into the background */
  mask-image: radial-gradient(circle at center, black 48%, transparent 72%);
  -webkit-mask-image: radial-gradient(circle at center, black 48%, transparent 72%);
}

#header-text {
  margin-left: -53px;   /* overlap the rightmost 1/3 of the globe (160 / 3) */
  position: relative;
  z-index: 1;
}

#header h1 {
  font-family: var(--font-display);
  font-size: 48px;
  font-style: italic;
  font-weight: normal;
  letter-spacing: 4px;
  color: var(--text-bright);
  margin-bottom: 6px;
  text-shadow: -2px 0 rgba(255, 0, 80, 0.4), 2px 0 rgba(0, 200, 255, 0.4);
}

#header .tagline {
  font-size: 11px;
  color: var(--text-muted);
  letter-spacing: 2px;
  text-transform: uppercase;
  font-family: var(--font-mono);
}

/* --- Navigation Bar --- */
#navbar {
  background-color: var(--bg-panel);
  border-bottom: 1px solid var(--border);
  padding: 0 24px;
  display: flex;
  gap: 0;
}

#navbar a {
  display: inline-block;
  padding: 10px 18px;
  color: var(--text-muted);
  text-decoration: none;
  font-size: 10px;
  font-weight: normal;
  font-family: var(--font-mono);
  letter-spacing: 2px;
  text-transform: uppercase;
  border-right: 1px solid var(--border);
  border-bottom: 2px solid transparent;
  transition:
    color var(--transition-fast),
    border-bottom-color var(--transition-fast),
    background-color var(--transition-fast);
}

#navbar a:first-child {
  border-left: 1px solid var(--border);
}

#navbar a:hover {
  color: var(--blue-bright);
  border-bottom-color: var(--blue-mid);
  background-color: rgba(34, 136, 255, 0.05);
}

#navbar a.active {
  color: var(--blue-bright);
  border-bottom-color: var(--blue-bright);
  background-color: rgba(34, 136, 255, 0.07);
}

/* --- Marquee Strip --- */
#marquee-strip {
  background-color: var(--bg-panel-alt);
  border-bottom: 1px solid var(--border);
  padding: 6px 0;
  overflow: hidden;
  /* Prevent flexbox from squeezing the bar vertically when #content-area grows */
  flex-shrink: 0;
}

.marquee-track {
  display: flex;
  width: max-content;
  animation: marquee-scroll 90s linear infinite;
  animation-delay: -12s;
}

.marquee-content {
  white-space: nowrap;
  font-size: 10px;
  color: #ff2244;
  font-family: var(--font-mono);
  letter-spacing: 2px;
  text-transform: uppercase;
}

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

/* --- Main Content Area --- */
#content-area {
  display: flex;
  align-items: stretch;
  flex: 1;
}

/* --- Left Sidebar (Welcome) --- */
#sidebar-left {
  width: 400px;
  flex-shrink: 0;
  border-right: 1px solid var(--border);
  padding: 28px 28px;
  display: flex;
  flex-direction: column;
}

/* --- Main Column --- */
#main {
  flex: 1;
  min-width: 0;
  padding: 28px;
}


/* --- Boxes / Panels --- */
.box {
  border: 1px solid var(--border);
  margin-bottom: 20px;
  background-color: var(--bg-panel);
}

.box-title {
  color: var(--text-muted);
  padding: var(--space-sm) 14px;
  font-size: 9px;
  font-weight: normal;
  font-family: var(--font-mono);
  letter-spacing: 3px;
  text-transform: uppercase;
  border-bottom: 1px solid var(--border);
}

.box-content {
  padding: var(--space-lg);
  font-size: 12px;
  line-height: 1.9;
  color: var(--text-body);
}

.box-content p {
  margin-bottom: 10px;
}

.box-content a {
  color: var(--blue-mid);
  text-decoration: none;
  transition: color var(--transition-fast);
}

.box-content a:hover {
  color: var(--blue-bright);
}

/* --- Sidebar left specific --- */
#sidebar-left h2 {
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 3px;
  text-transform: uppercase;
  color: var(--text-label);
  margin-bottom: 16px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}

#sidebar-left p {
  font-size: 12px;
  line-height: 1.9;
  color: var(--text-body);
  margin-bottom: 14px;
}

#sidebar-left ul {
  font-size: 12px;
  line-height: 1.9;
  color: var(--text-body);
  margin-bottom: 14px;
  padding-left: 16px;
  margin-top: -10px;
}

#sidebar-left li {
  margin-bottom: 2px;
}

#sidebar-left a {
  color: var(--blue-mid);
  text-decoration: none;
  transition: color var(--transition-fast);
}

#sidebar-left a:hover {
  color: var(--blue-bright);
}

.sidebar-nav {
  list-style: none;
  margin-top: 24px;
}

.sidebar-nav li {
  padding: 6px 0;
  border-bottom: 1px solid var(--border);
  font-size: 10px;
  font-family: var(--font-mono);
  letter-spacing: 1px;
}

.sidebar-nav li:last-child {
  border-bottom: none;
}

.sidebar-nav a {
  color: var(--text-muted);
  text-decoration: none;
  text-transform: uppercase;
  transition: color var(--transition-fast);
}

.sidebar-nav a:hover {
  color: var(--blue-bright);
}

/* --- Music Player Widget --- */
#music-player {
  margin-top: auto;
}

#music-player .box {
  border-color: var(--border-accent);
  margin-bottom: 0px; /* Temporary margin to align with video player */
}

#player-body { padding: 0; }

#waveform-canvas {
  display: block;
  width: 100%;
  height: 48px;
  background-color: var(--bg-panel-alt);
  border-bottom: 1px solid var(--border);
}

#player-controls {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
}

#play-pause-btn {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  border: 1px solid var(--border-accent);
  background-color: transparent;
  color: var(--blue-mid);
  font-size: 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: inherit;
  transition:
    color var(--transition-fast),
    border-color var(--transition-fast),
    background-color var(--transition-fast);
  line-height: 1;
  padding: 0;
}

#play-pause-btn:hover {
  color: var(--blue-bright);
  border-color: var(--blue-bright);
  background-color: rgba(34, 136, 255, 0.08);
}

#play-pause-btn.is-playing {
  color: var(--blue-bright);
  border-color: var(--blue-bright);
}

#track-info {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}

#track-title {
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--text-body);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

#track-artist {
  font-family: var(--font-mono);
  font-size: 8px;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* --- Featured Video Box --- */
.featured-video {
  border: 1px solid var(--border-accent);
  background-color: var(--bg-panel);
}

.featured-video-label {
  padding: 8px 14px;
  font-size: 9px;
  font-family: var(--font-mono);
  letter-spacing: 3px;
  text-transform: uppercase;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.featured-video-label .reel-num {
  color: var(--text-label);
}

.video-thumb-link {
  display: block;
  position: relative;
  overflow: hidden;
  background-color: #000;
  max-height: 340px;
}

.video-thumb-link img {
  width: 100%;
  height: auto;
  max-height: 340px;
  object-fit: contain;
  display: block;
  opacity: 0.85;
  transition: opacity 0.2s, filter 0.2s;
  filter: saturate(0.75) contrast(1.06);
}

.video-thumb-link:hover img {
  opacity: 1;
  filter: saturate(0.9) contrast(1.05);
}

.video-play-btn {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 56px;
  height: 56px;
  border: 2px solid rgba(237, 255, 248, 0.6);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: rgba(237, 255, 248, 0.8);
  font-size: 20px;
  pointer-events: none;
  background: rgba(8, 10, 24, 0.55);
  transition: border-color 0.2s, color 0.2s;
}

.video-thumb-link:hover .video-play-btn {
  border-color: var(--blue-bright);
  color: var(--blue-bright);
  background: rgba(8, 10, 24, 0.7);
}

.featured-video-caption {
  padding: var(--space-md) 14px;
  font-size: 11px;
  font-family: var(--font-mono);
  color: var(--text-muted);
  letter-spacing: 1px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.featured-video-caption a {
  color: var(--blue-mid);
  text-decoration: none;
  font-size: 10px;
  letter-spacing: 2px;
  text-transform: uppercase;
  transition: color var(--transition-fast);
}

.featured-video-caption a:hover {
  color: var(--blue-bright);
}

/* --- Horizontal Dividers --- */
hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 16px 0;
}

hr.thick {
  border-top: 1px solid var(--border-accent);
  margin: 24px 0;
}

/* --- Headings --- */
h2 {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-muted);
  letter-spacing: 3px;
  text-transform: uppercase;
  border-bottom: 1px solid var(--border);
  padding-bottom: 8px;
  margin-bottom: 16px;
}

h3 {
  font-family: 'DM Serif Display', Georgia, serif;
  font-size: 15px;
  font-weight: normal;
  color: var(--text-bright);
  margin-bottom: 6px;
}

/* --- Tool / Shelf Cards --- */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
}

.card {
  border: 1px solid var(--border);
  background-color: var(--bg-panel);
  overflow: hidden;
  transition: border-color 0.2s;
}

.card:hover {
  border-color: var(--border-accent);
}

.card-image {
  width: 100%;
  height: 140px;
  background-color: var(--bg-panel-alt);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 9px;
  font-family: var(--font-mono);
  letter-spacing: 2px;
  color: var(--text-label);
  border-bottom: 1px solid var(--border);
  text-transform: uppercase;
}

.card-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  filter: saturate(0.75) contrast(1.05);
}

.card-body {
  padding: 12px;
}

.card-body h3 {
  font-size: 14px;
  margin-bottom: 5px;
}

.card-body p {
  font-size: 11px;
  color: var(--text-muted);
  line-height: 1.7;
}

.card-body a {
  color: var(--blue-mid);
  text-decoration: none;
  font-size: 10px;
  font-family: var(--font-mono);
  letter-spacing: 1px;
  transition: color var(--transition-fast);
}

.card-body a:hover {
  color: var(--blue-bright);
}

/* --- Guestbook --- */
.guestbook-entry {
  border: 1px solid var(--border);
  background-color: var(--bg-panel-alt);
  padding: 14px;
  margin-bottom: 14px;
}

.guestbook-entry .gb-meta {
  font-size: 9px;
  color: var(--blue-mid);
  margin-bottom: 8px;
  font-family: var(--font-mono);
  letter-spacing: 2px;
  text-transform: uppercase;
}

.guestbook-entry .gb-message {
  font-size: 12px;
  color: var(--text-body);
  line-height: 1.8;
}

/* --- About Page --- */
.profile-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

.profile-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
  line-height: 1.7;
}

.profile-table td:first-child {
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--text-muted);
  width: 140px;
  white-space: nowrap;
}

/* --- Guestbook form --- */
.gb-form label {
  display: block;
  margin-bottom: 4px;
}

.gb-form input[type="text"],
.gb-form textarea {
  width: 100%;
  border: 1px solid var(--border);
  background-color: var(--bg-panel-alt);
  padding: 8px 10px;
  font-family: var(--font-body);
  font-size: 12px;
  color: var(--text-bright);
  margin-bottom: 14px;
  box-sizing: border-box;
  outline: none;
  transition: border-color 0.15s;
}

.gb-form input[type="text"]:focus,
.gb-form textarea:focus {
  border-color: var(--blue-mid);
}

.gb-form input[type="submit"] {
  background-color: transparent;
  color: var(--blue-mid);
  border: 1px solid var(--border-accent);
  padding: 8px 24px;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 2px;
  text-transform: uppercase;
  cursor: pointer;
  transition:
    color var(--transition-fast),
    border-color var(--transition-fast);
}

.gb-form input[type="submit"]:hover {
  border-color: var(--blue-bright);
  color: var(--blue-bright);
}

/* --- Footer --- */
#footer {
  background-color: var(--bg-panel);
  border-top: 1px solid var(--border);
  padding: 0px 32px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  height: 40px;
  font-size: 9px;
  color: var(--text-label);
  font-family: var(--font-mono);
  letter-spacing: 2px;
  text-transform: uppercase;
  margin-top: auto;
  flex-shrink: 0;
}

#footer a {
  color: var(--text-label);
  text-decoration: none;
  transition: color var(--transition-fast);
}

#footer a:hover {
  color: var(--blue-mid);
}

#footer .footer-links {
  display: flex;
  gap: 20px;
}

/* --- Notice Banner --- */
.notice-banner {
  background-color: transparent;
  border: 1px solid var(--border);
  padding: 8px 14px;
  font-size: 9px;
  color: var(--text-label);
  margin-bottom: 20px;
  font-family: var(--font-mono);
  letter-spacing: 2px;
  text-transform: uppercase;
}

/* Neon green flash — used on the "latest video" banner */
@keyframes neon-flash {
  0%, 100% {
    color: var(--green-neon);
    border-color: var(--green-neon);
    box-shadow: 0 0 6px rgba(57, 255, 20, 0.5), inset 0 0 6px rgba(57, 255, 20, 0.06);
    text-shadow: 0 0 8px rgba(57, 255, 20, 0.7);
  }
  50% {
    color: var(--green-neon-dark);
    border-color: var(--green-neon-dark);
    box-shadow: none;
    text-shadow: none;
  }
}

.notice-banner.neon {
  color: var(--green-neon);
  border-color: var(--green-neon);
  animation: neon-flash 2.4s ease-in-out infinite;
}

/* --- Utility --- */
strong { color: var(--text-bright); }
em { color: var(--text-muted); font-style: italic; }
code {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--blue-mid);
}

/* Shared label + link utilities */
.label-mono {
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 2px;
  text-transform: uppercase;
   color: var(--text-muted);
}

.label-meta {
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--text-muted);
}

.link-accent {
  color: var(--blue-mid);
  text-decoration: none;
  transition: color var(--transition-fast);
}

.link-accent:hover {
  color: var(--blue-bright);
}

/* ============================================================
   Mobile Layout  (max-width: 768px)
   Home page stack order:
   Header → Navbar → Marquee → Latest Video → Welcome → Footer
   ============================================================ */
@media (max-width: 768px) {

  /* Keep horizontal centering; stop vertical centering so the
     page scrolls naturally instead of being clipped at 800px.
     Existing body padding (28px top / 48px bottom) is preserved
     so the space.gif background shows above and below the wrapper. */
  body {
    align-items: flex-start;
  }

  /* Remove fixed 1350×800 dimensions; let the wrapper grow with
     its content. calc(100% - 16px) leaves 8px of space.gif
     visible on each side. */
  #wrapper {
    width: calc(100% - 16px);
    height: auto;
    min-height: 80vh;
    overflow-x: hidden;
    overflow-y: hidden;
  }

  /* Tighten header padding; scale down h1 so it fits comfortably */
  #header {
    padding: 8px 16px 12px;
  }

  #header h1 {
    font-size: 28px;
  }

  /* Allow nav links to wrap onto a second row rather than overflow */
  #navbar {
    flex-wrap: wrap;
  }

  /* Stack the two columns vertically */
  #content-area {
    flex-direction: column;
    min-height: auto;
  }

  /* Latest Video (#main) appears first on mobile */
  #main {
    order: 1;
    width: 100%;
    padding: 16px;
  }

  /* Welcome (#sidebar-left) appears second on mobile */
  #sidebar-left {
    order: 2;
    width: 100%;
    flex-shrink: 1;
    border-right: none;
    border-top: 1px solid var(--border);
    min-height: auto;
  }

  /* Stack video caption vertically: Watch link above, channel URL below */
  .featured-video-caption {
    flex-direction: column-reverse;
    align-items: flex-start;
    gap: 4px;
  }

  /* Stack footer links and copyright vertically */
  #footer {
    flex-direction: column;
    gap: 12px;
    text-align: center;
  }

  #footer .footer-links {
    flex-wrap: wrap;
    justify-content: center;
  }
}
