/* CSS Reset */
*,
*::before,
*::after {
  box-sizing: border-box;
}

* {
  margin: 0;
  padding: 0;
}

:root {
  /* Screen mask custom properties - match TV bezel screen opening */
  --mask-top: 10%;
  --mask-right: 22%;
  --mask-bottom: 15%;
  --mask-left: 16%;
  --mask-radius: 6%;
}

html, body {
  margin: 0;
  padding: 0;
  background: #4425FC;
  height: 100%;
  overflow: hidden;
  font-family: "Ubuntu Sans Mono", monospace;
  color: #fff;
}

.shapeshift-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  height: 100vh;
  width: 100%;
  gap: 0.5rem;
  padding: 1.5rem 2rem 2rem;
}

.logo-section {
  display: flex;
  justify-content: center;
}

.logo {
  width: auto;
  height: auto;
  max-width: 150px;
  object-fit: contain;
}

.tagline {
  font-family: "Ubuntu Sans Mono", monospace;
  color: #fff;
  font-size: 0.9rem;
  text-align: center;
  margin: 0.25rem 0 6rem;
  letter-spacing: 0.05em;
}

.tv-container {
  position: relative;
  max-width: 680px;
  max-height: 65vh;
  overflow: hidden;
}

.tv-screen {
  position: absolute;
  top: var(--mask-top);
  left: var(--mask-left);
  right: var(--mask-right);
  bottom: var(--mask-bottom);
  z-index: 1;
  overflow: hidden;
  border-radius: var(--mask-radius);
  --ticker-height: clamp(28px, 8%, 56px);
}

.tv-screen-content {
  position: absolute;
  inset: 0;
  z-index: 1;
}

.tv-ticker {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 2;
  pointer-events: none;
  background: #000;
  height: var(--ticker-height);
  overflow: hidden;
  display: flex;
  align-items: center;
  border-radius: 0 0 var(--mask-radius) var(--mask-radius);
}

.ticker-track {
  display: flex;
  align-items: center;
  gap: 2rem;
  animation: ticker-scroll 24s linear infinite;
  white-space: nowrap;
  will-change: transform;
  transform: translateZ(0);
  backface-visibility: hidden;
}

.ticker-track img {
  height: 24px;
  width: auto;
  object-fit: contain;
  filter: brightness(0) invert(1);
}

@keyframes ticker-scroll {
  0% {
    transform: translateX(0);
  }
  100% {
    transform: translateX(-50%);
  }
}

.tv-bezel {
  display: block;
  width: 100%;
  height: auto;
  max-height: 80vh;
  object-fit: contain;
  position: relative;
  z-index: 10;
  pointer-events: none;
}

/* TV Player and Channels */
.tv-player {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: #000;
}

.channel {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: none;
}

.channel.active {
  display: block;
}

.channel-video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.channel-bio {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  background: #000;
}

/* Bio Hotspots */
.hotspot-layer {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: var(--ticker-height);
  z-index: 3;
  pointer-events: none;
}

.hotspot {
  position: absolute;
  display: block;
  cursor: pointer;
  background: transparent;
  pointer-events: auto;
  text-decoration: none;
}

.hotspot:hover {
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.25);
}

/* Navigation hitboxes */
.hitbox {
  position: absolute;
  background: transparent;
  border: none;
  cursor: pointer;
  z-index: 20;
  padding: 0;
}

.hitbox-up {
  top: 5%;
  right: 3%;
  width: 15%;
  height: 20%;
}

.hitbox-down {
  bottom: 5%;
  right: 3%;
  width: 15%;
  height: 20%;
}

/* CRT Glitch Overlay */
.crt-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 5;
  pointer-events: none;
  opacity: 0;
  background: linear-gradient(
    transparent 50%,
    rgba(0, 0, 0, 0.1) 50%
  );
  background-size: 100% 4px;
  border-radius: var(--mask-radius);
}

.mobile-links {
  display: none;
  flex-wrap: wrap;
  gap: 0.5rem;
  justify-content: center;
  margin-top: 0.75rem;
  width: min(90vw, 640px);
}

.mobile-links[aria-hidden="true"] {
  display: none;
}

.mobile-links a {
  text-decoration: none;
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.4);
  padding: 0.4rem 0.75rem;
  border-radius: 999px;
  font-size: 0.85rem;
  letter-spacing: 0.02em;
}

.crt-overlay.active {
  animation: crt-glitch var(--crt-duration, 180ms) ease-out;
}

@keyframes crt-glitch {
  0% {
    opacity: 1;
    transform: translateX(0);
  }
  20% {
    opacity: 0.8;
    transform: translateX(-2px);
  }
  40% {
    opacity: 0.9;
    transform: translateX(2px);
  }
  60% {
    opacity: 0.7;
    transform: translateX(-1px);
  }
  80% {
    opacity: 0.5;
    transform: translateX(1px);
  }
  100% {
    opacity: 0;
    transform: translateX(0);
  }
}

/* Mobile layout: Logo → TV → Tagline */
@media (max-width: 768px) {
  .shapeshift-container {
    gap: 0.5rem;
    padding: 1rem 0.5rem 1.5rem;
    justify-content: flex-start;
    min-height: 100vh;
    min-height: 100dvh;
    overflow: hidden;
  }

  .logo-section {
    order: 1;
    flex-shrink: 0;
    margin-bottom: 8rem;
  }

  .logo {
    max-width: 100px;
  }

  .tagline {
    order: 3;
    font-size: 0.85rem;
    margin: 0;
    margin-top: 5rem;
    flex-shrink: 0;
  }

  .tv-container {
    order: 2;
    max-width: 95vw;
    max-height: 60vh;
    overflow: hidden;
    flex-shrink: 0;
  }

  .tv-bezel {
    max-height: 60vh;
    max-width: 95vw;
  }

  .mobile-links {
    display: flex;
    order: 4;
    flex-shrink: 0;
  }

  .tv-screen {
    --ticker-height: clamp(20px, 6%, 32px);
  }

  .ticker-track img {
    height: 16px;
  }
}
