/* ==========================================================================
   RavnFall — page publique (mobile-first)
   Les variables --accent, --accent-rgb, --accent-bright et --on-accent sont
   injectées par le serveur (couleur choisie dans l'admin).
   ========================================================================== */

:root {
  --accent: #C1121F;
  --accent-rgb: 193, 18, 31;
  --accent-bright: #D4595F;
  --on-accent: #FFFFFF;

  --bg: #0A0A0A;
  --surface: rgba(20, 20, 20, .88);
  --line: #2A2A2A;
  --field-line: #666666;      /* contraste ≥ 3:1 sur le fond des champs */
  --text: #F2F2F2;
  --text-soft: #C8C8C8;
  --muted: #A3A3A3;
  --dim: #8A8A8A;

  --font-body: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  /* "RavnDisplay" = police optionnelle déposée dans static/fonts (voir README) */
  --font-display: "RavnDisplay", Oswald, "Bebas Neue", "Avenir Next Condensed", "Roboto Condensed",
                  "Arial Narrow", sans-serif-condensed, Impact, sans-serif;
  color-scheme: dark;
}

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

html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font: 400 1rem/1.5 var(--font-body);
  -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; }
p { margin: 0; }
[hidden] { display: none !important; }

.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }

.icon {
  width: 22px; height: 22px; flex: none;
  fill: none; stroke: currentColor; stroke-width: 2;
  stroke-linecap: round; stroke-linejoin: round;
}

.sr-only {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

:focus-visible { outline: 2px solid #FFFFFF; outline-offset: 3px; }

/* --------------------------------------------------------------------------
   Fond : lueur, braises (canvas) et grain. Couches fixes, composées par le GPU.
   -------------------------------------------------------------------------- */
.bg-glow {
  position: fixed; left: 0; right: 0; bottom: 0; height: 75vh; z-index: 0;
  pointer-events: none;
  background: radial-gradient(ellipse 90% 60% at 50% 100%, rgba(var(--accent-rgb), .22), transparent 72%);
}
.embers {
  position: fixed; top: 0; left: 0; right: 0; height: 100vh; width: 100%; z-index: 0;
  pointer-events: none;
}
.grain {
  position: fixed; inset: -8%; z-index: 1; pointer-events: none;
  background: url("/static/img/grain.svg") repeat;
  background-size: 180px 180px;
  opacity: .06;
  animation: grain 1.2s steps(5) infinite;
  will-change: transform;
}
@keyframes grain {
  0%   { transform: translate(0, 0); }
  20%  { transform: translate(-3%, 2%); }
  40%  { transform: translate(2%, -3%); }
  60%  { transform: translate(-2%, -1%); }
  80%  { transform: translate(3%, 3%); }
  100% { transform: translate(0, 0); }
}

/* --------------------------------------------------------------------------
   Mise en page
   -------------------------------------------------------------------------- */
.page {
  position: relative; z-index: 2;
  width: 100%; max-width: 480px; margin: 0 auto;
  padding: max(56px, env(safe-area-inset-top)) 20px calc(32px + env(safe-area-inset-bottom));
  display: flex; flex-direction: column; gap: 28px;
}

.preview-banner {
  position: sticky; top: 0; z-index: 5;
  padding: 6px 12px; text-align: center;
  background: #F5B651; color: #111111; font-size: .8125rem; font-weight: 600;
}

/* --- En-tête --- */
.profile { display: flex; flex-direction: column; align-items: center; gap: 14px; text-align: center; }
.avatar {
  width: 120px; height: 120px; border-radius: 50%; object-fit: cover;
  border: 2px solid var(--accent);
  background: #161616;
  box-shadow: 0 0 0 6px rgba(var(--accent-rgb), .18), 0 0 48px rgba(var(--accent-rgb), .35);
}
.band-name {
  margin: 0; padding-left: .16em;          /* compense l'espacement après la dernière lettre */
  font-family: var(--font-display); font-weight: 600;
  font-size: clamp(2.125rem, 10vw, 2.75rem); line-height: 1.1;
  letter-spacing: .16em; text-transform: uppercase;
  overflow-wrap: anywhere;
}
.tagline {
  padding-left: .24em;
  font-size: .75rem; letter-spacing: .24em; text-transform: uppercase; color: var(--muted);
}
.bio { max-width: 34ch; color: var(--text-soft); font-size: .9375rem; white-space: pre-line; }

/* --- Liens --- */
.links { display: flex; flex-direction: column; gap: 12px; }
.link {
  display: flex; align-items: center; gap: 14px;
  min-height: 56px; padding: 0 18px;
  border: 1px solid var(--line); border-radius: 12px;
  background: var(--surface);
  color: var(--text); text-decoration: none; font-weight: 600;
  -webkit-tap-highlight-color: transparent;
  transition: border-color .2s, background-color .2s, transform .15s;
}
.link:hover { border-color: var(--accent); background-color: rgba(var(--accent-rgb), .12); }
.link:active { transform: scale(.98); }
.link-label { flex: 1; text-align: center; overflow-wrap: anywhere; padding: 8px 0; }
.icon-arrow { width: 18px; height: 18px; color: var(--dim); }

/* --------------------------------------------------------------------------
   Lecteur
   -------------------------------------------------------------------------- */
.player { display: flex; flex-direction: column; gap: 12px; }

.player-hint {
  align-self: center;
  display: inline-flex; align-items: center; gap: 10px;
  padding: 9px 16px; border-radius: 999px;
  border: 1px solid var(--accent); background: rgba(var(--accent-rgb), .14);
  font-size: .8125rem; text-align: center;
}
.pulse { width: 8px; height: 8px; flex: none; border-radius: 50%; background: var(--accent-bright); animation: pulse 1.6s ease-in-out infinite; }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: .3; } }

.player-card, .contact {
  border: 1px solid var(--line); border-radius: 16px; background: var(--surface);
}
.player-card { display: flex; flex-direction: column; gap: 14px; padding: 16px; }

.player-main { display: flex; align-items: center; gap: 14px; }
.cover {
  position: relative; flex: none; width: 64px; height: 64px; border-radius: 10px; overflow: hidden;
  border: 1px solid var(--line); background: #1E1E1E;
  display: flex; align-items: center; justify-content: center; color: #6E6E6E;
}
.cover-placeholder { width: 26px; height: 26px; stroke-width: 1.8; }
.cover-img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }

.track { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.track-status {
  display: flex; align-items: center; gap: 8px;
  font-size: .6875rem; letter-spacing: .16em; text-transform: uppercase; color: var(--muted);
}
.track-title, .track-artist { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.track-title { font-weight: 600; }
.track-artist { font-size: .8125rem; color: var(--muted); }

.eq { display: none; align-items: flex-end; gap: 2px; height: 12px; }
.eq span { display: block; width: 3px; height: 12px; background: var(--accent-bright); transform-origin: bottom; animation: eq .9s ease-in-out infinite; }
.eq span:nth-child(2) { animation-delay: .2s; }
.eq span:nth-child(3) { animation-delay: .4s; }
@keyframes eq { 0%, 100% { transform: scaleY(.3); } 50% { transform: scaleY(1); } }
.player[data-state="playing"] .eq { display: inline-flex; }

.progress {
  display: flex; align-items: center; gap: 10px;
  font-size: .75rem; color: var(--dim); font-variant-numeric: tabular-nums;
}
.time { min-width: 2.6em; }
.time-duration { text-align: right; }

/* Barre de progression : <input type="range"> stylé (accessible au clavier) */
.seek {
  --pct: 0%;
  flex: 1; min-width: 0; height: 24px; margin: 0;
  -webkit-appearance: none; appearance: none; background: transparent; cursor: pointer;
}
.seek::-webkit-slider-runnable-track {
  height: 4px; border-radius: 2px;
  background: linear-gradient(to right, var(--accent) var(--pct), #2E2E2E var(--pct));
}
.seek::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  width: 14px; height: 14px; margin-top: -5px; border: 0; border-radius: 50%; background: #FFFFFF;
}
.seek::-moz-range-track { height: 4px; border-radius: 2px; background: #2E2E2E; }
.seek::-moz-range-progress { height: 4px; border-radius: 2px; background: var(--accent); }
.seek::-moz-range-thumb { width: 14px; height: 14px; border: 0; border-radius: 50%; background: #FFFFFF; }
.seek:disabled { cursor: default; opacity: .5; }

.controls { display: flex; align-items: center; justify-content: center; gap: 28px; }
.ctl {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 0; border: 0; border-radius: 50%; cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: background-color .2s, transform .15s;
}
.ctl-side { width: 48px; height: 48px; background: transparent; color: var(--text); }
.ctl-side:hover { background: #222222; }
.ctl-play {
  width: 64px; height: 64px; background: var(--accent); color: var(--on-accent);
  box-shadow: 0 6px 28px rgba(var(--accent-rgb), .35);
}
.ctl-play .icon { width: 28px; height: 28px; }
.ctl:active { transform: scale(.94); }
.ctl:disabled { cursor: not-allowed; background: #262626; color: #6E6E6E; box-shadow: none; }
.ctl-play .i-pause { display: none; }
.player[data-state="playing"] .ctl-play .i-play { display: none; }
.player[data-state="playing"] .ctl-play .i-pause { display: block; }

/* Navidrome injoignable : message à la place des contrôles */
.player[data-state="unavailable"] .progress,
.player[data-state="unavailable"] .ctl-side { display: none; }
.player[data-state="unavailable"] .track-artist { white-space: normal; }

/* --------------------------------------------------------------------------
   Contact
   -------------------------------------------------------------------------- */
.contact { display: flex; flex-direction: column; gap: 18px; padding: 20px; scroll-margin-top: 24px; }
.contact-head { display: flex; flex-direction: column; gap: 6px; }
.contact-head h2 {
  margin: 0; font-family: var(--font-display); font-weight: 500;
  font-size: 1.5rem; letter-spacing: .12em; text-transform: uppercase;
}
.contact-head p { font-size: .875rem; color: var(--muted); }

.contact-form { display: flex; flex-direction: column; gap: 16px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: .8125rem; font-weight: 500; color: #D4D4D4; }
.field input, .field textarea {
  width: 100%; padding: 0 14px;
  border: 1px solid var(--field-line); border-radius: 10px;
  background: #0E0E0E; color: var(--text);
  font: inherit; font-size: 1rem;    /* 16px : évite le zoom automatique sur iOS */
}
.field input { height: 48px; }
.field textarea { min-height: 128px; padding-top: 12px; padding-bottom: 12px; resize: vertical; }
.field input:focus, .field textarea:focus { border-color: var(--accent); }
.field [aria-invalid="true"] { border: 2px solid #FF6B6B; }
.field-error { font-size: .8125rem; color: #FF8A8A; }

/* Pot de miel : hors écran (pas display:none, que certains robots détectent) */
.hp { position: absolute !important; left: -10000px; top: auto; width: 1px; height: 1px; overflow: hidden; }

.status {
  display: flex; align-items: flex-start; gap: 12px;
  padding: 14px 16px; border-radius: 12px; border: 1px solid var(--line);
  font-size: .875rem; line-height: 1.45;
}
.status .icon { width: 20px; height: 20px; margin-top: 1px; }
.status--ok { border-color: #2F6F4E; background: #0F1F17; color: #D7F5E5; }
.status--ok .icon { color: #6EE7A8; }
.status--warn { border-color: #8A5A12; background: #1F170A; color: #FBE7C6; }
.status--warn .icon { color: #F5B651; }
.status--error { border-color: #7A1F24; background: #1F0D0F; color: #FFD9D9; }
.status--error .icon { color: #FF6B6B; }
.status--pending { color: var(--text-soft); }

.btn-send {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  height: 52px; border: 0; border-radius: 12px; cursor: pointer;
  background: var(--accent); color: var(--on-accent);
  font: inherit; font-weight: 600; letter-spacing: .04em;
  transition: filter .2s, transform .15s;
}
.btn-send .icon { width: 18px; height: 18px; }
.btn-send:hover { filter: brightness(1.12); }
.btn-send:active { transform: scale(.98); }
.btn-send:disabled { cursor: progress; opacity: .7; }
.preview-note { font-size: .8125rem; color: var(--dim); text-align: center; }

.footer { padding-top: 4px; text-align: center; font-size: .75rem; color: var(--dim); }

/* Pages d'erreur (404…) */
.error-page { min-height: 100vh; justify-content: center; }
.error-page .band-name { font-size: 1.75rem; letter-spacing: .08em; padding-left: .08em; }

/* --------------------------------------------------------------------------
   Écrans plus larges : même colonne, plus d'air
   -------------------------------------------------------------------------- */
@media (min-width: 768px) {
  .page { padding-top: 80px; gap: 32px; }
}

/* --------------------------------------------------------------------------
   Mouvement réduit : plus d'animations (embers.js s'arrête aussi de lui-même)
   -------------------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  .grain, .pulse, .eq span { animation: none; }
  .link, .ctl, .btn-send { transition: none; }
}
