/* ==========================================================================
   BITR HOME - COLLECTIVE HEADQUARTERS & 3D GLOBE ENGINE
   --------------------------------------------------------------------------
   Expressive, tactile digital HQ for 6 creative friends.
   Luminous sky room, original portraits, and a Three.js pearl locator.
   ========================================================================== */

@font-face {
  font-family: 'Bricolage';
  src: url('../assets/fonts/bricolage-grotesque-latin.woff2') format('woff2');
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
}

@font-face {
  font-family: 'Fragment';
  src: url('../assets/fonts/fragment-mono-latin.woff2') format('woff2');
  font-style: normal;
  font-weight: 400;
  font-display: swap;
}

:root {
  color-scheme: light;
  --canvas: #edf5fa;
  --canvas-card: #f6fafc;
  --ink: #293c49;
  --ink-bright: #1c303e;
  --muted: #425866;
  --line: #2d52631c;
  --line-strong: #2d52633b;
  --accent: #2d654a;
  --mono: 'Fragment', monospace;
  --sans: 'Bricolage', sans-serif;
  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
}

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

[hidden] {
  display: none !important;
}

html, body {
  margin: 0;
  padding: 0;
  width: 100%;
  min-height: 100%;
  overflow-x: clip;
  background: var(--canvas);
  color: var(--ink);
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
  letter-spacing: 0;
}

/* Emil Kowalski Tactile Physicality on Active */
button:active, a:active {
  transform: scale(0.97);
  transition: transform 160ms var(--ease-out);
}

button, a {
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
  background: none;
  border: 0;
  padding: 0;
}

a {
  text-decoration: none;
}

a:focus-visible, button:focus-visible, [tabindex="0"]:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.skip-link {
  position: fixed;
  top: -80px;
  left: 16px;
  z-index: 100;
  padding: 10px 16px;
  background: var(--ink);
  color: var(--canvas);
  font: 12px var(--mono);
  transition: top 0.2s ease;
}
.skip-link:focus {
  top: 16px;
}

/* ==========================================================================
   KINETIC MONOSPACE ASCII INTRO OVERLAY
   ========================================================================== */
.ascii-intro {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: #edf5fa;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: auto;
  opacity: 1;
  transform: scale(1);
  filter: blur(0px);
  transition: opacity 320ms var(--ease-out), filter 320ms ease, transform 320ms ease;
}

.ascii-intro.is-dissolved {
  opacity: 0;
  filter: blur(6px);
  transform: scale(1.02);
  pointer-events: none;
}

.ascii-canvas {
  font-family: var(--mono);
  font-size: 14px;
  line-height: 1.05;
  letter-spacing: 0;
  color: var(--accent);
  margin: 0;
  padding: 0;
  text-align: center;
  user-select: none;
  text-shadow: none;
}


.sky-scene { position: fixed; inset: 0; overflow: hidden; pointer-events: none; }
.sky-image {
  position: absolute;
  inset: -12px;
  width: calc(100% + 24px);
  height: calc(100% + 24px);
  object-fit: cover;
  object-position: center 58%;
}

/* Film grain stays independent of the readable surface. */
.ogl-backdrop {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 0;
  opacity: 0.22;
}

/* Portraits form the scene, not a row of profile cards. */
.collective-container {
  width: min(1400px, 100%);
  margin: 0 auto;
  padding: 0 56px 120px;
  min-height: 100svh;
  position: relative;
  z-index: 1;
}
.collective-header {
  height: 96px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.header-left, .header-right, .header-brand { display: flex; align-items: center; }
.header-brand svg { color: var(--ink); transition: color 180ms ease; }
.header-brand:hover svg { color: var(--accent); }
.header-nav-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 44px;
  color: var(--ink);
  font: 12px var(--mono);
}
.header-nav-link:hover { color: var(--accent); }
.collective-main {
  width: 100%;
  min-width: 0;
  padding-top: 28px;
  display: grid;
  gap: 44px;
}
.roster-section { width: 100%; min-width: 0; }
.arcade-roster {
  position: relative;
  isolation: isolate;
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  align-items: start;
  gap: 24px;
  min-height: 294px;
}
.crew-thread { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: -1; }
.roster-slot {
  --member-ink: #2d654a;
  position: relative;
  min-width: 0;
}
#slot-josh { --member-ink: #96373b; padding-top: 58px; }
#slot-chinny { --member-ink: #70438f; padding-top: 22px; }
#slot-qrd { --member-ink: #1d6075; padding-top: 72px; }
#slot-vince { --member-ink: #943468; padding-top: 12px; }
#slot-said { --member-ink: #70551a; padding-top: 46px; }
.slot-profile {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  min-width: 0;
  gap: 18px;
  text-align: center;
}
.slot-object {
  position: relative;
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100%;
  height: 140px;
  pointer-events: none;
  transform: perspective(700px) rotateX(var(--tilt-x, 0deg)) rotateY(var(--tilt-y, 0deg));
  transition: transform 180ms var(--ease-out);
}
.slot-avatar-wrap {
  display: block;
  width: 124px;
  max-width: 94%;
  aspect-ratio: 1;
  border-radius: 50%;
  overflow: hidden;
  padding: 4px;
  border: 1px solid #fff;
  background: #f5fbffb3;
  box-shadow: 0 12px 22px -14px #35536a80, inset 0 0 0 1px #5b7e8d1a;
  transition: transform 300ms var(--ease-out), box-shadow 300ms ease, border-color 300ms ease;
}
#slot-josh .slot-avatar-wrap, #slot-vince .slot-avatar-wrap { border-radius: 6px; width: 112px; }
#slot-chinny .slot-avatar-wrap { width: 116px; border-radius: 50% 50% 6px 6px; }
#slot-said .slot-avatar-wrap { width: 114px; border-radius: 6px 6px 50% 50%; }
.slot-avatar { display: block; width: 100%; height: 100%; object-fit: cover; border-radius: inherit; }
.roster-slot.is-active .slot-avatar-wrap {
  transform: translateY(-8px);
  border-color: var(--member-ink);
  box-shadow: 0 20px 28px -18px #35536a99, 0 0 0 4px #ffffff6b;
}
.slot-info { display: flex; flex-direction: column; align-items: center; gap: 7px; min-width: 0; width: 100%; }
.slot-name { font: 700 30px/1.1 var(--sans); color: var(--member-ink); }
.slot-meta { display: inline-flex; align-items: center; justify-content: center; gap: 5px; font: 10px/1.5 var(--mono); color: var(--muted); max-width: 100%; }
.slot-flag { width: 13px; height: 11px; opacity: 0.75; }
.member-room {
  position: relative;
  isolation: isolate;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 150px;
  align-items: start;
  gap: 56px;
  min-width: 0;
  padding: 30px 0 0;
  border-top: 1px solid var(--line-strong);
}
/* A full-width light band protects text contrast without enclosing the member. */
.member-room::before {
  content: "";
  position: absolute;
  top: 0;
  bottom: -32px;
  left: 50%;
  width: 100vw;
  transform: translateX(-50%);
  background: #f4faffd9;
  z-index: -1;
  pointer-events: none;
}
.member-panel {
  display: grid;
  grid-template-columns: minmax(180px, 0.9fr) minmax(0, 1.3fr);
  gap: 64px;
  min-height: 290px;
  min-width: 0;
  align-items: start;
  outline-offset: 8px;
}
.member-interests, .member-music { min-width: 0; }
.member-quote { white-space: pre-wrap; font: 15px/1.7 var(--sans); color: var(--ink); margin: 0 0 24px; }
.member-section-title { font: 11px/1.4 var(--mono); color: var(--muted); margin: 0 0 20px; }
.member-games { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; }
.member-games li { font: 15px/1.5 var(--sans); color: var(--ink); overflow-wrap: anywhere; }
.member-tracks {
  list-style: none;
  padding: 0 8px 0 0;
  margin: 0;
  max-height: 280px;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: #2d52632e transparent;
}
.member-track {
  display: grid;
  grid-template-columns: 14px minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 44px;
  padding: 10px 0;
  text-align: left;
  border-bottom: 1px solid var(--line);
  color: var(--ink);
  font: 12px/1.6 var(--mono);
}
.member-track:hover, .member-track.is-playing { color: var(--accent); }
.track-icon { width: 12px; height: 12px; opacity: 0.65; }
.track-title { min-width: 0; overflow-wrap: anywhere; }
.track-duration { font-size: 11px; color: var(--muted); }
.member-track.is-playing .track-icon { opacity: 1; }
.track-pause, .member-track.is-playing .track-play { display: none; }
.member-track.is-playing .track-pause { display: block; }
.member-panel:focus-visible { outline: 1px solid var(--accent); }
/* The locator is a real column, never a floating cover over the crew. */
.world-locator { width: 150px; height: 150px; justify-self: end; align-self: end; margin-bottom: 24px; }
.world-viewport { position: relative; width: 100%; height: 100%; cursor: grab; touch-action: none; user-select: none; }
.world-viewport:active { cursor: grabbing; }
.world-canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.globe-overlays { position: absolute; inset: 0; pointer-events: none; }

@media (max-width: 1200px) {
  .collective-container { padding-inline: 36px; }
  .arcade-roster { gap: 18px; min-height: 278px; }
  .slot-object { height: 120px; }
  .slot-avatar-wrap { width: 108px; }
  #slot-josh .slot-avatar-wrap, #slot-vince .slot-avatar-wrap, #slot-chinny .slot-avatar-wrap, #slot-said .slot-avatar-wrap { width: 100px; }
  .slot-name { font-size: 26px; }
  .member-room { gap: 32px; grid-template-columns: minmax(0, 1fr) 128px; }
  .member-panel { gap: 36px; }
  .world-locator { width: 128px; height: 128px; }
}
@media (max-width: 1000px) {
  .collective-container { padding-inline: 28px; }
  .collective-header { height: 84px; }
  .collective-main { padding-top: 20px; gap: 36px; }
  .arcade-roster { grid-template-columns: repeat(3, minmax(0, 1fr)); min-height: 0; gap: 28px; }
  .roster-slot:nth-child(n) { padding-top: 0; }
  .crew-thread { display: none; }
  .slot-profile { gap: 12px; }
  .slot-object { height: 116px; }
  .member-room { gap: 24px; }
  .member-panel { grid-template-columns: minmax(0, 1fr); gap: 28px; }
  .member-tracks { max-height: none; overflow: visible; padding: 0; }
  .world-locator { align-self: start; }
}
@media (max-width: 600px) {
  .collective-container { padding-inline: 22px; }
  .collective-header { height: 78px; }
  .header-brand svg { width: 96px; height: 35px; }
  .collective-main { padding-top: 18px; gap: 28px; }
  .arcade-roster { gap: 28px 12px; }
  .slot-object { height: 84px; }
  .slot-avatar-wrap { width: 80px; padding: 3px; }
  #slot-josh .slot-avatar-wrap, #slot-vince .slot-avatar-wrap, #slot-chinny .slot-avatar-wrap, #slot-said .slot-avatar-wrap { width: 74px; }
  .slot-name { font-size: 22px; }
  .slot-meta { font-size: 9px; gap: 3px; }
  .slot-flag { display: none; }
  .member-room { grid-template-columns: minmax(0, 1fr); padding-top: 24px; gap: 24px; }
  .member-panel { min-height: 280px; gap: 28px; }
  .member-quote { margin-bottom: 20px; }
  .member-games { gap: 8px; }
  .world-locator { width: 112px; height: 112px; margin-bottom: 0; }
  .sky-image { object-position: 48% center; }
}

/* ==========================================================================
   PERSISTENT BOTTOM AUDIO TRANSPORT DOCK
   ========================================================================== */
.audio-dock {
  --player-accent: #2d654a;
  position: fixed;
  bottom: 20px;
  left: 50%;
  width: min(860px, calc(100% - 40px));
  transform: translateX(-50%);
  z-index: 90;
  background: color-mix(in srgb, var(--player-accent) 4%, #f8fcff);
  color: var(--ink);
  border: 1px solid #ffffff;
  border-radius: 8px;
  height: 76px;
  display: flex;
  align-items: center;
  box-shadow: 0 8px 32px #35536a26, inset 0 0 0 1px #35536a0c;
  transition: background-color 200ms ease, border-color 200ms ease;
}

.dock-inner {
  width: min(1440px, 100%);
  margin: 0 auto;
  padding: 0 16px;
  display: grid;
  grid-template-columns: auto auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 18px;
}

.dock-artwork { display: block; width: 44px; height: 44px; border: 1px solid #fff; border-radius: 50%; overflow: hidden; box-shadow: 0 3px 8px #35536a26; }
.dock-artwork img { display: block; width: 100%; height: 100%; object-fit: cover; }

.dock-transport {
  display: flex;
  align-items: center;
  gap: 8px;
}

.dock-btn {
  width: 44px;
  height: 44px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--ink);
  border: 1px solid transparent;
  background: transparent;
  transition: all 0.2s ease;
}

.dock-btn:hover {
  border-color: color-mix(in srgb, var(--player-accent) 20%, #fff);
  color: var(--player-accent);
  background: color-mix(in srgb, var(--player-accent) 6%, #fff);
}

.dock-btn-play {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: color-mix(in srgb, var(--player-accent) 9%, #fff);
  color: var(--player-accent);
  border-color: color-mix(in srgb, var(--player-accent) 20%, #fff);
}

.dock-btn-play:hover {
  background: color-mix(in srgb, var(--player-accent) 15%, #fff);
  color: var(--player-accent);
  transform: scale(1.04);
}

.dock-track {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
  padding: 6px 0;
}

.dock-track-header {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.dock-pulse {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--player-accent);
  flex-shrink: 0;
}

.audio-dock.is-paused .dock-pulse {
  background: var(--muted);
  box-shadow: none;
}

.dock-title {
  font-weight: 700;
  color: var(--ink-bright);
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}

.dock-sep {
  color: var(--muted);
  opacity: 0.5;
}

.dock-artist {
  color: var(--player-accent);
  font: 12px var(--mono);
  overflow: hidden;
  text-overflow: ellipsis;
  flex-shrink: 0;
  max-width: 35%;
}

.dock-scrub-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
}

.dock-time {
  font: 11px var(--mono);
  color: var(--muted);
  width: 32px;
}

.dock-scrub {
  flex: 1;
  min-width: 0;
  width: 100%;
  height: 24px;
  margin: 0;
  appearance: none;
  background: transparent;
  cursor: pointer;
  --progress: 0%;
}

.dock-scrub::-webkit-slider-runnable-track {
  height: 4px;
  background: linear-gradient(to right, var(--player-accent) var(--progress), #2d526322 var(--progress));
  border-radius: 2px;
}

.dock-scrub::-moz-range-track {
  height: 4px;
  background: linear-gradient(to right, var(--player-accent) var(--progress), #2d526322 var(--progress));
  border-radius: 2px;
}

.dock-scrub::-webkit-slider-thumb {
  appearance: none;
  width: 10px;
  height: 10px;
  margin-top: -3px;
  border-radius: 50%;
  background: var(--player-accent);
}

.dock-scrub::-moz-range-thumb {
  width: 10px;
  height: 10px;
  border: 0;
  border-radius: 50%;
  background: var(--player-accent);
}

.dock-scrub:disabled {
  opacity: 0.4;
  cursor: default;
}

.dock-scrub:focus-visible, .dock-volume-slider:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

.dock-extras {
  display: flex;
  align-items: center;
  gap: clamp(14px, 2vw, 24px);
}

.dock-volume {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
}

.dock-volume-slider {
  width: 70px;
  height: 24px;
  -webkit-appearance: none;
  appearance: none;
  background: transparent;
  border-radius: 2px;
  outline: none;
  cursor: pointer;
}

.dock-volume-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 12px;
  height: 12px;
  margin-top: -4px;
  border-radius: 50%;
  background: var(--player-accent);
  cursor: pointer;
}

.dock-volume-slider::-webkit-slider-runnable-track { height: 4px; background: #2d526322; border-radius: 2px; }
.dock-volume-slider::-moz-range-track { height: 4px; background: #2d526322; border-radius: 2px; }
.dock-volume-slider::-moz-range-thumb { width: 12px; height: 12px; border: 0; border-radius: 50%; background: var(--player-accent); }


.sc-hidden-iframe {
  position: fixed;
  left: -9999px;
  top: -9999px;
  width: 320px;
  height: 166px;
  opacity: 0;
  pointer-events: none;
}

.audio-status {
  position: absolute;
  bottom: calc(100% + 8px);
  left: 16px;
  width: min(480px, calc(100% - 32px));
  margin: 0;
  padding: 12px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: var(--canvas-card);
  font: 12px/1.5 var(--mono);
}

.audio-status a {
  color: var(--accent);
  text-decoration: underline;
}

@media (max-width: 768px) {
  .dock-extras {
    display: none;
  }
  .dock-inner {
    grid-template-columns: auto auto minmax(0, 1fr);
    gap: 12px;
  }
}

@media (max-width: 480px) {
  .audio-dock {
    height: 72px;
    left: 10px;
    right: 10px;
    bottom: 10px;
    width: auto;
    transform: none;
  }
  .dock-inner { padding-inline: 10px; gap: 8px; grid-template-columns: auto minmax(0, 1fr); }
  .dock-extras { display: none; }
  .dock-artwork { display: none; }
  .dock-transport { gap: 4px; }
  .dock-btn { width: 44px; height: 44px; border-radius: 4px; }
  .dock-btn-play { border-radius: 50%; }
  .dock-track { padding: 7px 0; gap: 2px; }
  .dock-track-header { gap: 5px; font-size: 12px; }
  .dock-artist { font-size: 10px; }
  .dock-scrub-wrap {
    gap: 6px;
  }
}


@media (prefers-reduced-motion: reduce) {
  .slot-object { transform: none; }
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
