/* =========================================================
   CantaPorMi — sistema de diseño "regalo cálido"
   Papel crema, tinta, coral, ciruela y oro.
   ========================================================= */

:root {
  /* Color */
  --paper: #faf5ec;
  --paper-deep: #f3ebdd;
  --card: #fffdf9;
  --ink: #1f1a17;
  --ink-soft: #4a423c;
  --muted: #7a7068;
  --line: #e6dccd;
  --line-strong: #d6c8b4;

  --coral: #e0533d;
  --coral-dark: #c4402c;
  --coral-soft: #fbe3dc;
  --plum: #3a1d38;
  --plum-soft: #5b3557;
  --gold: #e8b64a;
  --gold-soft: #fbefd2;
  --sage: #5f7c64;
  --sage-soft: #e3ecdf;
  --warn-bg: #fdf3d8;
  --warn-line: #ecd393;
  --error: #b42318;
  --error-bg: #fde8e6;

  /* Tipografía */
  --font-display: "Fraunces", Georgia, "Times New Roman", serif;
  --font-body: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-hand: "Caveat", "Comic Sans MS", cursive;

  /* Forma */
  --radius-sm: 10px;
  --radius: 16px;
  --radius-lg: 24px;
  --shadow-sm: 0 1px 2px rgba(31, 26, 23, 0.06), 0 1px 1px rgba(31, 26, 23, 0.04);
  --shadow: 0 10px 30px -12px rgba(58, 29, 56, 0.25), 0 2px 6px rgba(31, 26, 23, 0.05);
  --shadow-lg: 0 30px 60px -20px rgba(58, 29, 56, 0.35), 0 8px 20px -8px rgba(31, 26, 23, 0.12);
  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);

  --wrap: 1160px;
  --gutter: clamp(16px, 4vw, 32px);
}

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

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

img, svg { max-width: 100%; }

a { color: inherit; }

h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 600;
  line-height: 1.1;
  letter-spacing: -0.015em;
  margin: 0 0 0.5em;
  font-variation-settings: "SOFT" 50, "opsz" 96;
}

h1 { font-size: clamp(2.4rem, 5.4vw, 4.2rem); }
h2 { font-size: clamp(1.9rem, 3.6vw, 2.8rem); }
h3 { font-size: 1.35rem; }

p { margin: 0 0 1em; }

em.hand, .hand {
  font-family: var(--font-hand);
  font-style: normal;
  font-weight: 600;
}

::selection { background: var(--gold-soft); }

:focus-visible {
  outline: 3px solid var(--coral);
  outline-offset: 3px;
  border-radius: 6px;
}

.wrap {
  width: 100%;
  max-width: var(--wrap);
  margin: 0 auto;
  padding-inline: var(--gutter);
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--coral);
  margin-bottom: 14px;
}

.lead {
  font-size: clamp(1.05rem, 1.6vw, 1.25rem);
  color: var(--ink-soft);
  max-width: 60ch;
}

.muted { color: var(--muted); }
.hidden, [hidden] { display: none !important; }
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}

/* ---------- Botones ---------- */
.btn {
  --btn-bg: var(--coral);
  --btn-fg: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 14px 26px;
  border: 0;
  border-radius: 999px;
  background: var(--btn-bg);
  color: var(--btn-fg);
  font: 600 1rem/1 var(--font-body);
  text-decoration: none;
  cursor: pointer;
  transition: transform 0.2s var(--ease), box-shadow 0.2s var(--ease), background 0.2s;
  box-shadow: 0 8px 20px -8px rgba(224, 83, 61, 0.7);
  white-space: nowrap;
}
.btn:hover { background: var(--coral-dark); transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn[disabled] { opacity: 0.55; cursor: not-allowed; transform: none; }

.btn-lg { padding: 18px 32px; font-size: 1.08rem; }
.btn-sm { padding: 10px 18px; font-size: 0.92rem; }

.btn-ghost {
  background: transparent;
  color: var(--ink);
  box-shadow: inset 0 0 0 1.5px var(--line-strong);
}
.btn-ghost:hover { background: var(--card); box-shadow: inset 0 0 0 1.5px var(--ink); }

.btn-dark {
  background: var(--plum);
  box-shadow: 0 8px 20px -8px rgba(58, 29, 56, 0.6);
}
.btn-dark:hover { background: var(--plum-soft); }

.btn-light {
  background: var(--paper);
  color: var(--plum);
  box-shadow: none;
}
.btn-light:hover { background: #fff; }

.link-btn {
  background: none;
  border: 0;
  padding: 0;
  color: var(--ink-soft);
  font: inherit;
  font-weight: 500;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}
.link-btn:hover { color: var(--coral); }

.arrow { transition: transform 0.2s var(--ease); }
.btn:hover .arrow { transform: translateX(3px); }

/* ---------- Cabecera ---------- */
.site-header {
  position: sticky;
  top: env(safe-area-inset-top, 0px);
  z-index: 50;
  background: rgba(250, 245, 236, 0.86);
  backdrop-filter: saturate(1.4) blur(12px);
  -webkit-backdrop-filter: saturate(1.4) blur(12px);
  border-bottom: 1px solid transparent;
  transition: border-color 0.2s;
}
.site-header.scrolled { border-bottom-color: var(--line); }

.site-header .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  height: 72px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--ink);
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.35rem;
  letter-spacing: -0.02em;
}
.brand svg { width: 34px; height: 34px; flex: none; }
.brand span b { color: var(--coral); font-weight: 600; }

.nav {
  display: flex;
  align-items: center;
  gap: 6px;
}
.nav a:not(.btn) {
  text-decoration: none;
  color: var(--ink-soft);
  font-weight: 500;
  font-size: 0.95rem;
  padding: 8px 12px;
  border-radius: 999px;
  transition: background 0.2s, color 0.2s;
}
.nav a:not(.btn):hover { background: var(--paper-deep); color: var(--ink); }
.nav .btn { margin-left: 6px; }

.nav a { white-space: nowrap; }

@media (max-width: 760px) {
  .nav .nav-hide-sm { display: none; }
}
@media (max-width: 480px) {
  .site-header .wrap { height: 64px; }
  .brand { font-size: 1.15rem; gap: 8px; }
  .brand svg { width: 28px; height: 28px; }
  .nav { gap: 0; }
  .nav a:not(.btn) { padding: 8px 8px; font-size: 0.9rem; }
  .nav .btn { padding: 9px 14px; font-size: 0.85rem; margin-left: 4px; }
  .nav .nav-hide-xs { display: none; }
}

/* ---------- Avisos flash ---------- */
.flash {
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  background: var(--error-bg);
  color: var(--error);
  font-size: 0.95rem;
  margin-bottom: 18px;
}
.flash.ok { background: var(--sage-soft); color: var(--sage); }

/* ---------- Formularios ---------- */
.field { margin-bottom: 22px; }
.field > label,
.label {
  display: block;
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--ink);
  margin-bottom: 8px;
}
.field .hint {
  display: block;
  font-size: 0.86rem;
  color: var(--muted);
  margin-top: -4px;
  margin-bottom: 10px;
}
.optional { font-weight: 400; color: var(--muted); }

.input,
textarea.input,
select.input {
  width: 100%;
  padding: 14px 16px;
  border: 1.5px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--card);
  color: var(--ink);
  font: 400 1rem/1.5 var(--font-body);
  transition: border-color 0.2s, box-shadow 0.2s;
}
.input::placeholder { color: #aca196; }
.input:hover { border-color: var(--line-strong); }
.input:focus {
  outline: none;
  border-color: var(--coral);
  box-shadow: 0 0 0 4px var(--coral-soft);
}
textarea.input { resize: vertical; min-height: 96px; }

/* ---------- Tarjetas ---------- */
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}

/* ---------- Vinilo ---------- */
.vinyl {
  /* El color de la etiqueta se hereda (--label) para poder fijarlo desde la tarjeta contenedora */
  position: relative;
  aspect-ratio: 1;
  border-radius: 50%;
  background:
    radial-gradient(circle at 50% 50%, var(--label, var(--coral)) 0 17%, transparent 17.5%),
    repeating-radial-gradient(circle at 50% 50%, #1b1517 0 1.2%, #2a2124 1.4% 2.2%);
  box-shadow: var(--shadow-lg), inset 0 0 0 2px rgba(255, 255, 255, 0.04);
}
.vinyl::before {
  /* reflejo */
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: conic-gradient(from 210deg, transparent 0 8%, rgba(255, 255, 255, 0.10) 12%, transparent 18% 58%, rgba(255, 255, 255, 0.07) 62%, transparent 68%);
}
.vinyl::after {
  /* agujero */
  content: "";
  position: absolute;
  inset: 48.6%;
  border-radius: 50%;
  background: var(--paper);
}
.vinyl.spin { animation: spin 3.2s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Tarjeta de letra (papel) ---------- */
.lyric-card {
  position: relative;
  background:
    repeating-linear-gradient(to bottom, transparent 0 31px, rgba(214, 200, 180, 0.45) 31px 32px),
    var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  /* padding superior múltiplo de 32px para que el texto caiga sobre las rayas */
  padding: 32px 30px 26px;
  box-shadow: var(--shadow);
  font-family: var(--font-display);
  font-size: 1.12rem;
  line-height: 32px;
  color: var(--ink);
}
.lyric-card .tag {
  display: block;
  font-family: var(--font-body);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--coral);
  line-height: 32px;
}

/* ---------- Pie ---------- */
.site-footer {
  background: var(--plum);
  color: rgba(255, 255, 255, 0.72);
  padding-block: 48px;
  font-size: 0.92rem;
}
.site-footer .wrap {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}
.site-footer .brand { color: #fff; }
.site-footer .brand span b { color: var(--gold); }
.site-footer a { color: rgba(255, 255, 255, 0.85); text-decoration: none; }
.site-footer a:hover { color: #fff; text-decoration: underline; }
.footer-links { display: flex; flex-wrap: wrap; gap: 20px; }

/* ---------- Animación de entrada ---------- */
.reveal { opacity: 0; transform: translateY(18px); transition: opacity 0.7s var(--ease), transform 0.7s var(--ease); }
.reveal.in { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .reveal { opacity: 1; transform: none; }
  html { scroll-behavior: auto; }
}

/* =========== Login / registro =========== */
.auth {
  display: grid;
  grid-template-columns: 1fr 1fr;
  min-height: 100vh;
}
.auth-art {
  position: relative;
  background: var(--plum);
  color: #fff;
  display: grid;
  place-items: center;
  padding: 48px;
  overflow: hidden;
}
.auth-art-inner { position: relative; width: min(440px, 100%); }
.auth-vinyl { width: 300px; margin-left: auto; --label: var(--gold); }
.auth-vinyl::after { background: var(--plum); }
.auth-lyric {
  width: 300px;
  margin-top: -140px;
  transform: rotate(-4deg);
}
.auth-quote {
  margin: 48px 0 0;
  font-family: var(--font-display);
  font-size: 1.6rem;
  line-height: 1.3;
}
.auth-quote .hand { color: var(--gold); font-size: 1.9rem; }

.auth-panel {
  display: flex;
  flex-direction: column;
  padding: 32px var(--gutter) 48px;
}
.auth-top { margin-bottom: auto; }
.auth-form {
  width: 100%;
  max-width: 420px;
  margin: 48px auto auto;
}
.auth-form h1 { font-size: clamp(2rem, 4vw, 2.6rem); }
.auth-form .lead { margin-bottom: 28px; }
.auth-submit { width: 100%; margin-top: 8px; }
.auth-switch { margin-top: 24px; text-align: center; color: var(--ink-soft); }
.auth-switch a { color: var(--coral); font-weight: 600; }

@media (max-width: 860px) {
  .auth { grid-template-columns: 1fr; }
  .auth-art { display: none; }
}

/* =========== Mis canciones =========== */
.library { padding-block: 40px 96px; min-height: calc(100vh - 72px - 140px); }
.library-head {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: flex-end;
  gap: 20px;
  margin-bottom: 36px;
}
.library-head .lead { margin: 0; }

.songs { list-style: none; padding: 0; margin: 0; display: grid; gap: 18px; }
.song {
  display: grid;
  grid-template-columns: 110px 1fr;
  gap: 26px;
  align-items: start;
  padding: 24px;
}
.song-vinyl { width: 110px; }
.song-vinyl::after { background: var(--card); }
.song.playing .song-vinyl { animation: spin 3.2s linear infinite; }
.song-title { font-size: 1.5rem; margin-bottom: 6px; }
.song-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; color: var(--muted); font-size: 0.92rem; margin-bottom: 14px; }
.pill { padding: 3px 12px; border-radius: 999px; background: var(--paper-deep); color: var(--ink-soft); font-weight: 500; }
.song audio { width: 100%; max-width: 560px; height: 40px; }
.song-actions { margin-top: 8px; font-size: 0.92rem; }
.song-actions a { color: var(--ink-soft); }
.song-lyrics { margin-top: 14px; }
.song-lyrics summary { cursor: pointer; font-weight: 600; color: var(--coral); }
.song-lyrics .lyric-card { margin-top: 14px; box-shadow: none; max-width: 560px; }
/* Una línea en blanco (32px, una raya del papel) antes de cada sección */
.song-lyrics .lyric-card .tag:not(:first-child) { margin-top: 32px; }

@media (max-width: 600px) {
  .song { grid-template-columns: 1fr; }
  .song-vinyl { width: 80px; }
}

.library-empty { text-align: center; padding: clamp(40px, 8vw, 80px) 24px; }
.library-empty-vinyl { width: 140px; margin: 0 auto 28px; --label: var(--gold); }
.library-empty-vinyl::after { background: var(--card); }
.library-empty .lead { margin-inline: auto; margin-bottom: 28px; }
