/* ================================================================
   chillangochillout — style.css
   Palette:
     terracotta  #C94B2C
     electric yellow  #F5D300
     deep teal   #0B7C7C
   ================================================================ */


/* ----------------------------------------------------------------
   RESET
   ---------------------------------------------------------------- */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}


/* ----------------------------------------------------------------
   CUSTOM PROPERTIES (design tokens)
   ---------------------------------------------------------------- */
:root {
  --terracotta:   #C94B2C;
  --yellow:       #F5D300;
  --teal:         #0B7C7C;
  --electric-blue: #0025f9;

  /* Player card background — violet/royal blue at 30% opacity (70% transparent) */
  --card-bg: rgba(70, 45, 210, 0.30);

  /* Subtle yellow for secondary text */
  --yellow-dim: rgba(245, 211, 0, 0.55);
}


/* ----------------------------------------------------------------
   BASE
   ---------------------------------------------------------------- */
html {
  height: 100%;
}

body {
  min-height: 100vh;
  font-family: 'Barlow Condensed', 'Arial Narrow', Arial, sans-serif;
  color: var(--yellow);

  /* Player sits on the right side, slightly above vertical center */
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding-right: 5vw;

  overflow-x: hidden;
}


/* ================================================================
   BACKGROUND
   ================================================================ */

/* Fixed container so the bg doesn't scroll with content */
.bg-container {
  position: fixed;
  inset: 0;          /* shorthand for top:0 right:0 bottom:0 left:0 */
  z-index: 0;
  overflow: hidden;
}

/*
  Each .bg-layer holds one photo as a background-image.
  They stack on top of each other via absolute positioning.

  Color treatment:
    saturate(2.1)   → punches up the color vibrancy (feria poster feel)
    contrast(1.45)  → crunches the tones, makes darks darker / brights brighter
    brightness(0.75) → pull overall exposure down slightly so the overlay reads

  image-rendering: pixelate + scale(1.04):
    The slight upscale forces the browser to use the pixelate algorithm
    on sub-pixel boundaries, adding a barely-there blocky texture without
    looking like generic pixel art. (Subtle — exactly as requested.)

  Opacity transition creates the crossfade when JS toggles .active.
*/
.bg-layer {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;

  filter: saturate(2.1) contrast(1.45) brightness(0.75);
  image-rendering: pixelate;
  transform: scale(1.04);   /* slight overdraw hides edge artifacts from scale */

  opacity: 0;
  transition: opacity 2.4s ease-in-out;
}

/* The active layer is fully visible */
.bg-layer.active {
  opacity: 1;
}

/*
  Dark overlay with horizontal scanlines.
  The repeating-linear-gradient adds a CRT/early-internet texture:
  every 4px, one pixel is slightly darker.
*/
.bg-overlay {
  position: absolute;
  inset: 0;
  background-color: rgba(10, 5, 28, 0.54);
  background-image: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 3px,
    rgba(0, 0, 0, 0.07) 3px,
    rgba(0, 0, 0, 0.07) 4px
  );
}


/* ================================================================
   PLAYER WRAPPER + TITLE
   ================================================================ */

/*
  Title is fixed to the top-left corner, independent of the player's position.
  Smaller than the original hero size — acts as a persistent brand mark.
*/
.site-title {
  position: fixed;
  top: 1.75rem;
  left: 2rem;
  z-index: 2;

  font-family: 'Bebas Neue', Impact, 'Arial Narrow', sans-serif;
  font-size: clamp(1.5rem, 3.5vw, 2.5rem);
  letter-spacing: 0.07em;
  line-height: 0.92;
  color: var(--yellow);
  text-align: left;
  text-transform: uppercase;
  /* Same 3-layer poster shadow, proportionally tighter */
  text-shadow:
    2px  2px 0   var(--terracotta),
    4px  4px 0   var(--teal),
    5px  5px 0   rgba(0, 0, 0, 0.45);
}

.player-wrapper {
  position: relative;
  z-index: 1;             /* sits above the fixed background */
  width: 100%;
  max-width: 390px;       /* 25% smaller than the original 520px */
  padding: 1rem 0.75rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  /* Nudge slightly above vertical center */
  margin-top: -8vh;
}


/* ================================================================
   PLAYER CARD
   ================================================================ */

.player-card {
  width: 100%;
  background: var(--card-bg);
  border: 2px solid var(--electric-blue);
  border-radius: 3px;
  padding: 1.1rem 1.1rem 0.75rem;

  /*
    backdrop-filter blurs whatever is rendered behind this element
    (the photos + overlay), creating a frosted-glass effect.
  */
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}


/* ----------------------------------------------------------------
   Track info
   ---------------------------------------------------------------- */

.track-info {
  margin-bottom: 0.9rem;
}

/* Small label above the track name */
.now-playing-label {
  display: flex;
  align-items: center;
  gap: 0.75em;   /* ~two characters width at this font size + letter-spacing */
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.22em;
  color: var(--terracotta);
  text-transform: uppercase;
  margin-bottom: 0.3rem;
}

/*
  Pixel-art play icon — three columns of crisp rectangles.
  shape-rendering: crispEdges disables anti-aliasing so the
  pixel blocks stay sharp at any size.
*/
.pixel-play {
  fill: currentColor;
  shape-rendering: crispEdges;
  image-rendering: pixelate;
  /* Desktop: small, unobtrusive — 20% smaller than previous 6×10 */
  width: 5px;
  height: 8px;
  flex-shrink: 0;
}

.track-name {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 1.3rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  color: #ffffff;
  line-height: 1.1;
  /* Prevent very long names from breaking the layout */
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}


/* ----------------------------------------------------------------
   Progress bar
   ---------------------------------------------------------------- */

.progress-area {
  margin-bottom: 0.4rem;
}

/*
  Clickable progress bar container.
  height: 6px is the visible track.
  We use position: relative so the fill and thumb can be positioned inside.
  No overflow:hidden — that would clip the thumb dot on hover.
*/
.progress-container {
  width: 100%;
  height: 6px;
  background: rgba(245, 211, 0, 0.15);
  border-radius: 3px;
  cursor: pointer;
  position: relative;
}

/* Yellow fill — width is updated by JS as the track plays */
.progress-fill {
  height: 100%;
  width: 0%;
  background: var(--yellow);
  border-radius: 3px;
  pointer-events: none;    /* clicks should hit the container, not the fill */
  transition: width 0.1s linear;
}

/*
  Scrub-handle dot — sits at the playhead position.
  Invisible by default, fades in when the user hovers the bar.
  position: absolute + transform: translate(-50%, -50%) keeps it
  centered on the bar at exactly the current playback percentage.
*/
.progress-thumb {
  position: absolute;
  top: 50%;
  left: 0%;
  transform: translate(-50%, -50%);
  width: 13px;
  height: 13px;
  border-radius: 50%;
  background: var(--yellow);
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.progress-container:hover .progress-thumb {
  opacity: 1;
}

/* Elapsed / total time display */
.time-row {
  display: flex;
  justify-content: space-between;
  font-size: 0.72rem;
  color: var(--yellow-dim);
  margin-top: 0.45rem;
  letter-spacing: 0.06em;
}


/* ----------------------------------------------------------------
   Playback controls
   ---------------------------------------------------------------- */

.controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1.5rem;
  margin: 0.9rem 0 0.75rem;
}

/* Base button style — no browser default styles */
.ctrl-btn {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--yellow);
  display: flex;
  align-items: center;
  justify-content: center;

  /* 44×44px minimum touch target (WCAG 2.5.5 recommendation) */
  min-width: 44px;
  min-height: 44px;
  border-radius: 50%;

  transition: color 0.18s ease, transform 0.15s ease, background 0.18s ease;
}

.ctrl-btn svg {
  width: 21px;
  height: 21px;
  pointer-events: none;   /* let clicks pass through to the button */
}

.ctrl-btn:hover {
  color: var(--terracotta);
  transform: scale(1.12);
}

.ctrl-btn:active {
  transform: scale(0.95);
}

/*
  Play button — larger, filled circle to signal it's the primary action.
  Terracotta background with yellow icon and yellow border.
*/
.btn-play {
  width: 48px;
  height: 48px;
  background: var(--terracotta);
  border: 2px solid var(--yellow);
  color: var(--yellow);
}

.btn-play svg {
  width: 22px;
  height: 22px;
}

.btn-play:hover {
  background: var(--yellow);
  color: var(--terracotta);
  transform: scale(1.07);
}

/*
  Pulse ring animation — plays while audio is playing.
  Gives a subtle heartbeat feel to the play button.
*/
@keyframes pulse-ring {
  0%   { box-shadow: 0 0 0 0   rgba(201, 75, 44, 0.55); }
  65%  { box-shadow: 0 0 0 12px rgba(201, 75, 44, 0);    }
  100% { box-shadow: 0 0 0 0   rgba(201, 75, 44, 0);     }
}

/* JS adds .is-playing to btn-play when audio is active */
.btn-play.is-playing {
  animation: pulse-ring 2.2s ease-out infinite;
}


/* ----------------------------------------------------------------
   Track list
   ---------------------------------------------------------------- */

.track-list {
  border-top: 1px solid rgba(201, 75, 44, 0.32);
  padding-top: 0.5rem;
  max-height: 162px;
  overflow-y: auto;
}

/* Custom scrollbar — thin, terracotta */
.track-list::-webkit-scrollbar        { width: 3px; }
.track-list::-webkit-scrollbar-track  { background: transparent; }
.track-list::-webkit-scrollbar-thumb  { background: var(--terracotta); border-radius: 2px; }

/* Individual track row */
.track-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.33rem 0.5rem;
  border-radius: 2px;
  cursor: pointer;
  font-size: 0.78rem;
  letter-spacing: 0.03em;
  color: rgba(245, 211, 0, 0.58);
  transition: color 0.14s, background 0.14s;
  user-select: none;
}

/* Track number — slightly dimmer than the name */
.track-num {
  font-size: 0.72rem;
  color: rgba(245, 211, 0, 0.28);
  min-width: 20px;
  text-align: right;
  flex-shrink: 0;
}

.track-item:hover {
  color: #fff;
  background: rgba(201, 75, 44, 0.18);
}

/* Currently playing track — highlighted in yellow */
.track-item.active {
  color: var(--yellow);
  background: rgba(201, 75, 44, 0.25);
  font-weight: 700;
}

.track-item.active .track-num {
  color: var(--terracotta);
}


/* ================================================================
   RESPONSIVE — mobile adjustments
   ================================================================ */
@media (max-width: 480px) {
  /* On small screens, drop the right-alignment and center everything */
  body {
    justify-content: center;
    padding-right: 0;
  }

  /* Title: 20% larger than the base mobile size */
  .site-title {
    font-size: 1.44rem;   /* 1.2rem × 1.2 */
    top: 1rem;
    left: 1rem;
  }

  /* Player: 75% smaller — scale the wrapper to 25% of desktop width */
  .player-wrapper {
    max-width: 71vw;      /* 95vw × 0.75 */
    margin-top: -5vh;
  }

  .player-card {
    padding: 0.75rem 0.65rem 0.5rem;
  }

  .track-info {
    margin-bottom: 0.6rem;
  }

  .track-name {
    font-size: 0.82rem;
  }

  .now-playing-label {
    font-size: 0.52rem;
  }

  /* Mobile pixel-play icon — 20% smaller than previous 9×15 */
  .pixel-play {
    width: 7px;
    height: 12px;
  }

  .controls {
    gap: 1rem;
    margin: 0.6rem 0 0.5rem;
  }

  .ctrl-btn svg {
    width: 16px;
    height: 16px;
  }

  .btn-play {
    width: 34px;
    height: 34px;
  }

  .btn-play svg {
    width: 16px;
    height: 16px;
  }

  .time-row {
    font-size: 0.6rem;
  }

  .track-list {
    max-height: 120px;
  }

  .track-item {
    font-size: 0.65rem;
    padding: 0.25rem 0.4rem;
  }
}
