/* Aux Swap, skin v2: "gold-plated jack".
   Loaded after style.css. Night-blue ground, warm text, one gold accent for
   the plugs and the button. Two families: a tall display face for the
   headlines and prompt card, a plain sans for everything else. Dark only. */

@font-face {
  font-family: "Big Shoulders";
  src: url("/static/fonts/big-shoulders-display.woff2") format("woff2");
  font-weight: 100 900;
  font-display: swap;
}
@font-face {
  font-family: "Instrument Sans";
  src: url("/static/fonts/instrument-sans.woff2") format("woff2");
  font-weight: 400 700;
  font-display: swap;
}

body.v2 {
  --paper: #0d1220;
  --ink: #f2ecdf;
  --cord: #e8b84a;          /* gold: plugs, primary button, spark */
  --cord-ink: #1a1305;
  --gold-deep: #b8862b;
  --spark: #fff2c4;
  --ash: #8b90a3;
  --line: #262c42;
  --tile: #141a2e;
  --theirs: #1b2238;
  --mine: #e8b84a;
  --cable: #2b3148;
  --cable-hi: #4a5274;
  --danger: #ff8a7a;

  font-family: "Instrument Sans", "Helvetica Neue", Arial, sans-serif;
  font-size: 17px;
  background: radial-gradient(120% 80% at 50% 0%, #17203a 0%, var(--paper) 55%);
  min-height: 100vh;
}
body.v2 .wrap { position: relative; z-index: 2; }
body.v2 h1, body.v2 h2 { font-family: "Big Shoulders", "Instrument Sans", sans-serif; font-stretch: 100%; letter-spacing: 0.005em; }
body.v2 h1 { font-weight: 800; font-size: clamp(2.6rem, 9vw, 4rem); line-height: 0.95; }
body.v2 .display { text-align: center; }
body.v2 .dim { color: var(--ash); }
body.v2 .center-text { text-align: center; }
body.v2 .lead { text-align: center; max-width: 36ch; margin: 0 auto 1rem; color: var(--ash); }
body.v2 .brand { font-family: "Big Shoulders", sans-serif; font-weight: 900; font-size: 1.5rem; letter-spacing: 0.02em; }
body.v2 .masthead nav a.skin-link { border: 1px solid var(--line); border-radius: 4px; padding: 0 0.4rem; font-size: 0.8rem; }
body.v2 .actions.center { justify-content: center; }
body.v2 .primary { box-shadow: 0 0 0 1px var(--gold-deep) inset; }

/* --- texture and depth ----------------------------------------------------- */

.grain {
  position: fixed; inset: 0; z-index: 1; pointer-events: none;
  opacity: 0.16;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='160' height='160'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
}
.backdrop { position: fixed; inset: 0; z-index: 0; overflow: hidden; pointer-events: none; }
.backdrop img {
  width: 100%; height: 100%; object-fit: cover;
  filter: blur(48px) saturate(1.2) brightness(0.45);
  transform: scale(1.2);
  animation: backdrop-in 1.2s ease-out both;
}
@keyframes backdrop-in { from { opacity: 0; } to { opacity: 1; } }

/* --- the stage: two devices and the cable ----------------------------------- */

.stage {
  display: grid;
  grid-template-columns: 52px 1fr 52px;
  align-items: center;
  gap: 0.25rem;
  margin: 0.5rem auto 1.75rem;
  max-width: 420px;
}
.device {
  width: 52px; height: 96px;
  border-radius: 10px;
  background: #0a0e1a;
  border: 2px solid var(--cable-hi);
  padding: 8px 5px;
  box-shadow: 0 8px 30px rgba(0,0,0,0.5);
  transition: border-color 0.5s, opacity 0.5s;
}
.device-screen {
  width: 100%; height: 100%;
  border-radius: 5px;
  background: linear-gradient(160deg, #1b2238, #10162a);
  overflow: hidden;
}
.device-screen img { width: 100%; height: 100%; object-fit: cover; }
.device.them { opacity: 0.35; border-style: dashed; }
.stage-plugged .device.them { opacity: 1; border-style: solid; border-color: var(--cord); }
.stage-plugged .device.me { border-color: var(--cord); }
.stage-searching .device.them { animation: device-blink 1.6s ease-in-out infinite; }
@keyframes device-blink { 50% { opacity: 0.7; } }

.cable { width: 100%; height: 80px; overflow: visible; }
.cable .wire {
  fill: none;
  stroke: var(--cable);
  stroke-width: 7;
  stroke-linecap: round;
  stroke-dasharray: 100;      /* pathLength=100, so these are percentages */
  stroke-dashoffset: 78;      /* idle: a short stub at your end */
  transition: stroke-dashoffset 1s cubic-bezier(0.3, 0, 0.2, 1);
}
.stage-searching .wire { animation: reach 2.6s ease-in-out infinite alternate; }
@keyframes reach { from { stroke-dashoffset: 55; } to { stroke-dashoffset: 20; } }
.stage-plugged .wire { stroke-dashoffset: 0; stroke: var(--cable-hi); }
.cable .jack { fill: var(--cord); }
.cable .jack-them { opacity: 0; transition: opacity 0.4s 0.6s; }
.stage-plugged .jack-them { opacity: 1; animation: plug-flash 0.8s ease-out 0.6s both; }
@keyframes plug-flash {
  0% { filter: drop-shadow(0 0 0 var(--spark)); }
  40% { filter: drop-shadow(0 0 14px var(--spark)); }
  100% { filter: drop-shadow(0 0 0 transparent); }
}

/* --- the big button -------------------------------------------------------- */

.hero-button {
  display: block;
  width: 100%;
  margin: 1.25rem 0 0.25rem;
  padding: 1.15rem 1.5rem;
  font-family: "Big Shoulders", sans-serif;
  font-weight: 800;
  font-size: 1.9rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--cord-ink);
  background: linear-gradient(180deg, #f3cc6a, var(--cord) 55%, var(--gold-deep));
  border: 0;
  border-radius: 10px;
  box-shadow: 0 0 0 1px rgba(255,255,255,0.08) inset, 0 12px 40px rgba(232,184,74,0.28);
  transition: transform 0.12s, box-shadow 0.2s;
}
.hero-button:hover { box-shadow: 0 0 0 1px rgba(255,255,255,0.12) inset, 0 14px 50px rgba(232,184,74,0.42); }
.hero-button:active { transform: translateY(2px) scale(0.995); }
.hero-button .spinner { border-color: rgba(0,0,0,0.25); border-top-color: var(--cord-ink); }

.live { display: flex; justify-content: center; align-items: center; gap: 0.5rem; color: var(--ash); font-size: 0.95rem; margin: 0 0 0.5rem; }
.live-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--cord); box-shadow: 0 0 10px var(--cord); animation: live-pulse 2s ease-in-out infinite; }
@keyframes live-pulse { 50% { opacity: 0.4; } }

body.v2 .timer { text-align: center; font-family: "Big Shoulders", sans-serif; font-weight: 700; font-size: 3rem; letter-spacing: 0.04em; }
body.v2 .v2-queue .dim { text-align: center; max-width: 36ch; margin: 0 auto 1rem; }

/* --- the prompt card, dealt from a deck ------------------------------------- */

.deck { perspective: 1200px; margin: 0.25rem 0 1.25rem; }
.prompt-card {
  position: relative;
  display: flex; flex-direction: column; justify-content: space-between;
  min-height: 190px;
  padding: 1.1rem 1.25rem;
  background: linear-gradient(165deg, #f6efe0, #e5dbc3);
  color: #1a1305;
  border-radius: 14px;
  box-shadow: 0 30px 60px rgba(0,0,0,0.55), 0 0 0 1px rgba(255,255,255,0.35) inset;
  animation: deal 0.75s cubic-bezier(0.2, 0.9, 0.2, 1) both;
}
.prompt-card::before, .prompt-card::after {
  /* the rest of the deck underneath */
  content: ""; position: absolute; inset: 0; z-index: -1;
  border-radius: 14px; background: #d9cfb5;
  transform: translate(4px, 6px) rotate(1.5deg);
}
.prompt-card::after { background: #c8bd9f; transform: translate(8px, 12px) rotate(3deg); }
.prompt-card-label { font-size: 0.8rem; font-weight: 600; letter-spacing: 0.02em; color: #7a6a3d; }
.prompt-card-text { font-family: "Big Shoulders", sans-serif; font-weight: 800; font-size: clamp(2rem, 7vw, 2.9rem); line-height: 0.98; }
@keyframes deal {
  from { transform: translate(0, -70px) rotate(-7deg) scale(0.92); opacity: 0; }
  to { transform: none; opacity: 1; }
}

.link-input {
  width: 100%;
  padding: 0.95rem 1rem;
  font: inherit;
  color: var(--ink);
  background: rgba(10, 14, 26, 0.7);
  border: 1.5px solid var(--line);
  border-radius: 10px;
}
.link-input:focus { outline: none; border-color: var(--cord); box-shadow: 0 0 0 3px rgba(232,184,74,0.2); }
.link-input::placeholder { color: var(--ash); }
.preview { min-height: 0.5rem; margin-top: 0.75rem; }
.preview-busy { display: none; align-items: center; gap: 0.5rem; margin: 0.75rem 0 0; font-size: 0.9rem; color: var(--ash); }
.preview-busy.htmx-request { display: flex; }
.preview-busy .thinking-dots { height: auto; }
.hero-button .when-busy { display: none; }
.hero-button:disabled { opacity: 0.75; cursor: wait; }
.htmx-request.hero-button .when-idle, .htmx-request .hero-button .when-idle { display: none; }
.htmx-request.hero-button .when-busy, .htmx-request .hero-button .when-busy { display: inline; }
.preview-error { color: var(--danger); font-size: 0.9rem; margin: 0.25rem 0 0; }
.preview-note { margin: 0.6rem 0 0.2rem; font-size: 0.85rem; color: var(--ash); }
.preview-toggle { display: flex; align-items: center; gap: 0.5rem; font-size: 0.85rem; color: var(--ash); }
.preview-toggle input { accent-color: var(--cord); }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* --- song cards ------------------------------------------------------------ */

.song-card {
  display: grid;
  grid-template-columns: 76px 1fr;
  gap: 0.9rem;
  align-items: center;
  padding: 0.7rem;
  background: rgba(20, 26, 46, 0.85);
  border: 1px solid var(--line);
  border-radius: 12px;
  backdrop-filter: blur(6px);
  box-shadow: 0 16px 40px rgba(0,0,0,0.4);
}
.song-card img, .song-card .no-art { width: 76px; height: 76px; border-radius: 8px; object-fit: cover; background: var(--tile); }
.song-card-text { display: flex; flex-direction: column; min-width: 0; }
.song-title { font-weight: 700; line-height: 1.2; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.song-artist { color: var(--ash); }
.song-platform { font-size: 0.8rem; color: var(--gold-deep); margin-top: 0.15rem; }
.song-card.dealt { animation: card-in 0.5s cubic-bezier(0.2, 0.9, 0.2, 1) both; }
@keyframes card-in { from { transform: translateY(12px); opacity: 0; } to { transform: none; opacity: 1; } }
.song-card.pulse { margin: 1rem 0; animation: card-pulse 2.4s ease-in-out infinite; }
@keyframes card-pulse { 50% { box-shadow: 0 16px 40px rgba(0,0,0,0.4), 0 0 24px rgba(232,184,74,0.25); } }

/* --- reveal: the cards cross the cable -------------------------------------- */

.swap-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; margin: 1rem 0 1.5rem; }
.swap-row .song-card { grid-template-columns: 1fr; text-align: center; padding: 0.9rem; }
.swap-row .song-card img, .swap-row .song-card .no-art { width: 100%; height: auto; aspect-ratio: 1; margin: 0 auto 0.5rem; }
.swap-row .song-card-text { align-items: center; }
.cross-right { animation: cross-right 1s cubic-bezier(0.4, 0, 0.2, 1) 0.7s both; }
.cross-left { animation: cross-left 1s cubic-bezier(0.4, 0, 0.2, 1) 0.7s both; }
@keyframes cross-right { from { transform: translateX(0); } to { transform: translateX(calc(100% + 1rem)); } }
@keyframes cross-left { from { transform: translateX(0); } to { transform: translateX(calc(-100% - 1rem)); } }
@media (max-width: 430px) {
  .swap-row { grid-template-columns: 1fr; }
  @keyframes cross-right { from { transform: none; } to { transform: translateY(calc(100% + 1rem)); } }
  @keyframes cross-left { from { transform: none; } to { transform: translateY(calc(-100% - 1rem)); } }
}

body.v2 .v2-reveal .hero-button { margin-top: 0.5rem; }

@media (prefers-reduced-motion: reduce) {
  .cross-right { transform: translateX(calc(100% + 1rem)); }
  .cross-left { transform: translateX(calc(-100% - 1rem)); }
}

/* --- what the other person is doing ------------------------------------------ */

.partner-status {
  display: flex; align-items: center; justify-content: center; gap: 0.5rem;
  margin: 0 0 1rem; font-size: 0.95rem; color: var(--ash); text-align: center;
}
.partner-status.ready { color: var(--ink); }
.partner-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--cord); box-shadow: 0 0 10px var(--cord); }
.partner-dot.thinking { animation: live-pulse 1.4s ease-in-out infinite; }

.thinking-dots { display: flex; gap: 3px; align-items: center; justify-content: center; height: 100%; }
.thinking-dots i { width: 5px; height: 5px; border-radius: 50%; background: var(--cord); animation: think 1.2s ease-in-out infinite; }
.thinking-dots i:nth-child(2) { animation-delay: 0.2s; }
.thinking-dots i:nth-child(3) { animation-delay: 0.4s; }
@keyframes think { 0%, 80%, 100% { opacity: 0.25; transform: translateY(0); } 40% { opacity: 1; transform: translateY(-3px); } }
