/* -------------------------------------------------------------------------- */
/* Theme: Cassette (1980s Tokyo City Pop Hi-Fi Stereo Walkman / Deck)        */
/* Layout: Physical Brushed Cassette Deck Chassis with Tape Well & VU Meters */
/* Contrast: WCAG AA Pass (Text on Chassis 15.4:1)                            */
/* -------------------------------------------------------------------------- */

body[data-theme-layout="cassette"],
:root[data-theme-layout="cassette"] body {
  --sky: #15101d;
  --sky-grad: linear-gradient(180deg, #181222 0%, #120d1a 100%);
  --card: #221a2e;
  --ink: #fff4ec;
  --ink-soft: #d3c4db;
  --slot: #181220;
  --shadow-1: #01cdfe;
  --shadow-2: #ff71ce;
  --gold: #ffd166;
  --chip-bg: rgba(255, 113, 206, 0.08);
  --dither: rgba(255, 113, 206, 0.03);
  background: var(--sky);
  background-image: var(--sky-grad);
  background-attachment: fixed;
  color: var(--ink);
  font-family: 'Pixelify Sans', 'Courier New', monospace, sans-serif;
}

/* Subtle background tape texture */
body[data-theme-layout="cassette"]::before,
:root[data-theme-layout="cassette"] body::before {
  opacity: 0.25;
}

/* Hi-Fi Desktop Chassis Container */
body[data-theme-layout="cassette"] main,
:root[data-theme-layout="cassette"] main {
  max-width: 42rem;
  background: linear-gradient(180deg, #2b213a 0%, #221a2e 50%, #1a1324 100%);
  border: 4px solid #3c2d4e;
  border-radius: 10px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.15), 
              inset 0 0 20px rgba(0, 0, 0, 0.6),
              0 12px 32px rgba(0, 0, 0, 0.8);
  padding: 2.2rem 1.6rem 6rem;
  margin: 2rem auto;
  position: relative;
}

/* Chassis Brand Stamp */
body[data-theme-layout="cassette"] main::before,
:root[data-theme-layout="cassette"] main::before {
  content: "AUTO REVERSE / 4-TRACK HI-FI STEREO SYSTEM / DOLBY B-C NR";
  display: block;
  text-align: center;
  font-family: 'Press Start 2P', monospace;
  font-size: 0.48rem;
  letter-spacing: 0.18em;
  color: #ffd166;
  padding-bottom: 1.2rem;
  border-bottom: 1px solid #3c2d4e;
  margin-bottom: 1.4rem;
  opacity: 0.9;
}

/* Player Section (Cassette Well Compartment) */
body[data-theme-layout="cassette"] .player,
:root[data-theme-layout="cassette"] .player {
  position: relative;
  background: linear-gradient(135deg, rgba(255, 113, 206, 0.08) 0%, rgba(1, 205, 254, 0.05) 50%, rgba(10, 8, 16, 0.9) 100%), #140e1e;
  border: 3px solid #3c2d4e;
  border-radius: 8px;
  padding: 1.6rem 1rem 1.4rem;
  margin-bottom: 2rem;
  box-shadow: inset 0 2px 10px rgba(0, 0, 0, 0.7);
}

/* Reel Spindle Animation */
@keyframes spin-reel {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

/* Centerpiece Cassette Tape Well */
body[data-theme-layout="cassette"] .avatar-slot,
:root[data-theme-layout="cassette"] .avatar-slot {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 1.2rem;
  width: auto;
  min-width: 240px;
  height: 120px;
  padding: 0 1.2rem;
  background: linear-gradient(180deg, #2f2240 0%, #1e162a 50%, #140e1c 100%);
  border: 3px solid #56416e;
  border-radius: 6px;
  box-shadow: inset 0 0 12px rgba(0, 0, 0, 0.8), 0 3px 6px rgba(0, 0, 0, 0.5);
  animation: none;
  position: relative;
}

/* Left Spinning Reel Spindle */
body[data-theme-layout="cassette"] .avatar-slot::before,
:root[data-theme-layout="cassette"] .avatar-slot::before {
  content: "";
  display: block;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 2px solid #56416e;
  background: radial-gradient(circle, #ffd166 4px, #221a2e 5px, #221a2e 9px, #3c2d4e 10px, transparent 11px),
              repeating-conic-gradient(#fff4ec 0deg 20deg, #140e1e 20deg 60deg);
  box-shadow: 0 0 4px rgba(0, 0, 0, 0.6);
  animation: spin-reel 2.4s linear infinite;
  flex-shrink: 0;
}

/* Right Spinning Reel Spindle */
body[data-theme-layout="cassette"] .avatar-slot::after,
:root[data-theme-layout="cassette"] .avatar-slot::after {
  content: "";
  display: block;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 2px solid #56416e;
  background: radial-gradient(circle, #ffd166 4px, #221a2e 5px, #221a2e 9px, #3c2d4e 10px, transparent 11px),
              repeating-conic-gradient(#fff4ec 0deg 20deg, #140e1e 20deg 60deg);
  box-shadow: 0 0 4px rgba(0, 0, 0, 0.6);
  animation: spin-reel 2.4s linear infinite;
  flex-shrink: 0;
}

/* Cassette Tape Dratini Window */
body[data-theme-layout="cassette"] .avatar-slot img,
:root[data-theme-layout="cassette"] .avatar-slot img {
  width: 72px;
  height: 72px;
  background: #140e1e;
  border: 2px solid #ff71ce;
  border-radius: 4px;
  box-shadow: inset 0 0 6px rgba(255, 113, 206, 0.4);
}

/* Player Typography */
body[data-theme-layout="cassette"] h1,
:root[data-theme-layout="cassette"] h1 {
  font-size: clamp(1.4rem, 6vw, 1.85rem);
  color: #fff4ec;
  letter-spacing: 0.1em;
  text-shadow: 0 0 10px rgba(255, 113, 206, 0.5), -2px 0 0 #01cdfe;
  margin: 0.8rem 0 0.3rem;
}

body[data-theme-layout="cassette"] .kana,
:root[data-theme-layout="cassette"] .kana {
  color: #01cdfe;
  font-size: 0.95rem;
  letter-spacing: 0.28em;
  margin-bottom: 0.4rem;
}

body[data-theme-layout="cassette"] .tagline,
:root[data-theme-layout="cassette"] .tagline {
  color: #d3c4db;
  font-size: 1.05rem;
  margin-bottom: 1.2rem;
}

/* Stereo Analog VU Meters */
@keyframes vu-sweep-left {
  0%, 100% { clip-path: inset(0 48% 0 0); }
  25% { clip-path: inset(0 18% 0 0); }
  50% { clip-path: inset(0 32% 0 0); }
  75% { clip-path: inset(0 10% 0 0); }
}

@keyframes vu-sweep-right {
  0%, 100% { clip-path: inset(0 54% 0 0); }
  25% { clip-path: inset(0 22% 0 0); }
  50% { clip-path: inset(0 40% 0 0); }
  75% { clip-path: inset(0 14% 0 0); }
}

body[data-theme-layout="cassette"] .player::after,
:root[data-theme-layout="cassette"] .player::after {
  content: "VU STEREO  [CH1 ||||||||....]  [CH2 ||||||.....]  PEAK +3dB";
  display: block;
  margin: 1.1rem auto 0;
  max-width: 380px;
  padding: 0.4rem 0.6rem;
  background: #0f0a17;
  border: 1px solid #3c2d4e;
  border-radius: 4px;
  font-family: 'Press Start 2P', monospace;
  font-size: 0.52rem;
  color: #ffd166;
  text-shadow: 0 0 6px rgba(255, 209, 102, 0.6);
  letter-spacing: 0.08em;
}

/* Mechanical Push Buttons (Deck Transport Controls) */
body[data-theme-layout="cassette"] .socials,
:root[data-theme-layout="cassette"] .socials {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.6rem;
  background: #140e1c;
  padding: 0.6rem 0.8rem;
  border-radius: 6px;
  border: 2px solid #3c2d4e;
}

body[data-theme-layout="cassette"] .slot-btn,
:root[data-theme-layout="cassette"] .slot-btn {
  width: auto;
  min-width: 52px;
  height: 44px;
  padding: 0 0.55rem;
  background: linear-gradient(180deg, #3d2e50 0%, #261c33 100%);
  border: 2px solid #56416e;
  border-radius: 4px;
  box-shadow: 0 4px 0 #120d1a, inset 0 1px 0 rgba(255, 255, 255, 0.2);
  color: #fff4ec;
  font-family: 'Press Start 2P', monospace;
  font-size: 0.5rem;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  transition: transform 0.06s ease, box-shadow 0.06s ease;
}

body[data-theme-layout="cassette"] .slot-btn canvas,
:root[data-theme-layout="cassette"] .slot-btn canvas {
  width: 24px;
  height: 24px;
}

/* Cassette Deck Button Labels */
body[data-theme-layout="cassette"] .slot-btn[href*="github"]::after { content: "▶ GH"; color: #01cdfe; }
body[data-theme-layout="cassette"] .slot-btn[href*="instagram"]::after { content: "📷 IG"; color: #ff71ce; }
body[data-theme-layout="cassette"] .slot-btn[data-copy*=".furphy"]::after { content: "⏩ DC"; color: #05ffa1; }
body[data-theme-layout="cassette"] .slot-btn[data-copy*="furphy#1270"]::after { content: "⏪ BN"; color: #01cdfe; }
body[data-theme-layout="cassette"] .slot-btn[href*="raider.io"]::after { content: "⏸ RIO"; color: #ffd166; }
body[data-theme-layout="cassette"] .slot-btn[href*="warcraftlogs"]::after { content: "■ LOG"; color: #ff71ce; }
body[data-theme-layout="cassette"] .slot-btn[href*="mailto:"]::after { content: "⏺ REC"; color: #ff4f78; }

body[data-theme-layout="cassette"] .slot-btn:hover,
:root[data-theme-layout="cassette"] .slot-btn:hover {
  background: linear-gradient(180deg, #48375e 0%, #2e223e 100%);
  border-color: #ff71ce;
}

body[data-theme-layout="cassette"] .slot-btn:active,
:root[data-theme-layout="cassette"] .slot-btn:active {
  transform: translateY(3px);
  box-shadow: 0 1px 0 #120d1a, inset 0 2px 4px rgba(0, 0, 0, 0.7);
}

/* Divider / Track Index Header */
body[data-theme-layout="cassette"] .divider,
:root[data-theme-layout="cassette"] .divider {
  color: #ffd166;
  font-size: 0.65rem;
  letter-spacing: 0.16em;
  margin: 1.8rem 0 1.2rem;
}

body[data-theme-layout="cassette"] .divider::before,
body[data-theme-layout="cassette"] .divider::after,
:root[data-theme-layout="cassette"] .divider::before,
:root[data-theme-layout="cassette"] .divider::after {
  border-top: 2px dashed #56416e;
}

/* Track Listing World Cards */
body[data-theme-layout="cassette"] .worlds,
:root[data-theme-layout="cassette"] .worlds {
  counter-reset: cassette-track;
  display: flex;
  flex-direction: column;
  gap: 1.15rem;
}

body[data-theme-layout="cassette"] .world,
:root[data-theme-layout="cassette"] .world {
  counter-increment: cassette-track;
  position: relative;
  background: #1c1526;
  border: 2px solid #3c2d4e;
  border-radius: 6px;
  box-shadow: 0 4px 0 #120d1a, inset 0 1px 0 rgba(255, 255, 255, 0.05);
  padding: 0.95rem 1.1rem;
  transition: transform 0.08s ease, border-color 0.08s ease, box-shadow 0.08s ease;
}

/* Track Number Indicator */
body[data-theme-layout="cassette"] .world .wname::before,
:root[data-theme-layout="cassette"] .world .wname::before {
  content: "[TRK " counter(cassette-track, decimal-leading-zero) "] ";
  color: #01cdfe;
  font-family: 'Press Start 2P', monospace;
  font-size: 0.68rem;
  letter-spacing: 0.04em;
}

/* Glowing LED Indicator on Hover */
body[data-theme-layout="cassette"] .world:hover,
:root[data-theme-layout="cassette"] .world:hover {
  transform: translateY(-2px);
  border-color: #ff71ce;
  background: #251c33;
  box-shadow: 0 6px 16px rgba(255, 113, 206, 0.25), 0 4px 0 #120d1a;
}

body[data-theme-layout="cassette"] .world:hover .badge::before,
:root[data-theme-layout="cassette"] .world:hover .badge::before {
  content: "";
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #05ffa1;
  box-shadow: 0 0 8px #05ffa1;
  margin-right: 5px;
  vertical-align: middle;
}

/* World Card Internals */
body[data-theme-layout="cassette"] .icon-slot,
:root[data-theme-layout="cassette"] .icon-slot {
  background: #140e1c;
  border: 2px solid #56416e;
  border-radius: 4px;
}

body[data-theme-layout="cassette"] .badge,
:root[data-theme-layout="cassette"] .badge {
  background: #2b1f3a;
  color: #ffd166;
  border: 1px solid #56416e;
  box-shadow: none;
}

body[data-theme-layout="cassette"] .blurb,
:root[data-theme-layout="cassette"] .blurb {
  color: #d3c4db;
  font-size: 1rem;
}

body[data-theme-layout="cassette"] .chip,
:root[data-theme-layout="cassette"] .chip {
  background: rgba(1, 205, 254, 0.08);
  color: #fff4ec;
  border: 1px solid #3c2d4e;
  box-shadow: none;
  font-size: 0.74rem;
}

/* Cassette Deck Footer */
body[data-theme-layout="cassette"] footer,
:root[data-theme-layout="cassette"] footer {
  margin-top: 2.4rem;
  border-top: 1px solid #3c2d4e;
  padding-top: 1.2rem;
  color: #a392ab;
  font-size: 0.95rem;
}

body[data-theme-layout="cassette"] .press,
:root[data-theme-layout="cassette"] .press {
  color: #ff71ce;
  font-size: 0.58rem;
}

/* Accessible Focus States */
body[data-theme-layout="cassette"] a:focus-visible,
body[data-theme-layout="cassette"] button:focus-visible,
:root[data-theme-layout="cassette"] a:focus-visible,
:root[data-theme-layout="cassette"] button:focus-visible {
  outline: 3px solid #ff71ce;
  outline-offset: 3px;
}

@media (prefers-reduced-motion: reduce) {
  body[data-theme-layout="cassette"] *,
  body[data-theme-layout="cassette"] *::before,
  body[data-theme-layout="cassette"] *::after {
    animation: none !important;
    transition: none !important;
  }
}
