@import url('https://fonts.googleapis.com/css2?family=Cinzel:wght@400..900&display=swap');
/* ================================
   Cântări — stili comuni (index + pagine singole)
   ================================ */

.cantari-hero {
  padding: 6.2rem 0 2rem;
  border-bottom: 1px solid var(--border);
}

.cantari-hero h1 {
  margin: 0.2rem 0 0.5rem;
  font-size: clamp(2.2rem, 5vw, 3.5rem);
}

/* ── Index alfabetic rapid ── */
.search-wrap {
  display: flex;
  justify-content: center;
  margin-bottom: 1.5rem;
}

.search-wrap input {
  width: 100%;
  max-width: 480px;
  padding: 0.7rem 1rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  font-family: inherit;
  font-size: 0.95rem;
  background: var(--surface);
  color: var(--text);
  outline: none;
  transition: border-color 0.18s, box-shadow 0.18s;
}

.search-wrap input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(122, 92, 62, 0.12);
}

.alpha-nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.4rem;
  margin-bottom: 2.5rem;
}

@media (min-width: 901px) {
  .alpha-nav {
    position: sticky;
    top: 84px;
    z-index: 900;
    background: var(--bg);
    padding: 0.45rem 0 0.7rem;
    margin-bottom: 1.6rem;
    border-bottom: 1px solid var(--border);
  }
}

.alpha-nav a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border: 1px solid var(--border);
  border-radius: 20px 0px;
  font-family: Inter, system-ui, sans-serif;
  font-weight: 700;
  font-size: 1rem;
  color: var(--text);
  text-decoration: none;
  background: var(--surface);
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.alpha-nav a:hover {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

/* ── Grupuri litere ── */
.alpha-group {
  margin-bottom: 2.2rem;
}

.alpha-letter {
  font-size: 1.6rem;
  color: var(--primary);
  border-bottom: 2px solid var(--border);
  padding-bottom: 0.4rem;
  margin: 0 0 0.85rem;
}

.song-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.5rem;
}

.song-list-item a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.85rem 1rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  text-decoration: none;
  color: var(--text);
  background: var(--surface);
  font-weight: 600;
  font-size: 0.97rem;
  transition: background 0.15s, border-color 0.15s, transform 0.15s;
}

.song-list-item a::after {
  content: "→";
  color: var(--muted);
  font-size: 1rem;
  transition: transform 0.15s;
}

.song-list-item a:hover {
  background: var(--surface-alt);
  border-color: var(--primary);
  transform: translateX(3px);
}

.song-list-item a:hover::after {
  transform: translateX(4px);
}

.no-results {
  color: var(--muted);
  font-size: 0.95rem;
  padding: 1rem 0;
}

.cantari-index-section {
  padding-top: 2.5rem;
}

/* ================================
   Pagina singolo cântec
   ================================ */

.song-page-hero {
  padding: 6.2rem 0 2rem;
  border-bottom: 1px solid var(--border);
}

@media (min-width: 901px) {
  .song-page-hero .container,
  .cantari-hero .container {
    display: grid;
    gap: 0.32rem;
  }

  .song-body-page,
  .song-pdf-actions {
    margin-left: auto;
    margin-right: auto;
  }

  .song-body-page {
    text-align: center;
  }

  .song-stanza p,
  .stanza-label {
    text-align: center;
  }

  .song-pdf-actions {
    text-align: center;
  }

  .back-link {
    margin-bottom: 0.42rem;
  }

  .song-page-hero h1 {
    margin-bottom: 0.2rem;
  }
}

.song-page-hero .container {
  text-align: center;
}

.song-page-hero .back-link {
  display: flex;
  justify-content: flex-start;
}

.song-page-logo {
  display: block;
  width: clamp(86px, 11vw, 126px);
  height: auto;
  margin: 0 auto 0.5rem;
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--muted);
  text-decoration: none;
  margin-bottom: 1.2rem;
  transition: color 0.15s;
}

.back-link-icon {
  flex-shrink: 0;
  margin-left: -0.2rem;
}

.back-link:hover { color: var(--primary); }

.song-page-hero h1 {
  margin: 0 0 0.5rem;
  font-size: clamp(1.9rem, 4vw, 3rem);
  line-height: 1.15;
}

.song-meta {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-top: 0.75rem;
}

.song-tag {
  display: inline-block;
  padding: 0.25rem 0.7rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--muted);
  background: var(--surface);
}

.song-video-top {
  margin-top: 1.4rem;
  margin-bottom: 0.8rem;
  border: 1px solid var(--border);
  border-radius: 14px;
  overflow: hidden;
  aspect-ratio: 16 / 9;
  background: #000;
}

.song-video-top iframe {
  width: 100%;
  height: 100%;
  border: 0;
  display: block;
}

/* ── Corpo testo lirica ── */
.song-body-page {
  padding: 0.6rem 0 1.4rem;
  max-width: 680px;
}

.song-stanza {
  margin-bottom: 1.65rem;
}

.song-stanza p {
  margin: 0;
  line-height: 1.66;
  font-size: 1.06rem;
  color: var(--text);
  white-space: pre-line;
  text-wrap: pretty;
  overflow-wrap: normal;
}

.stanza-label {
  display: block;
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--primary);
  margin-bottom: 0.5rem;
}

/* ── Navigare prev/next ── */
.song-nav {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  padding: 2rem 0 3rem;
  border-top: 1px solid var(--border);
}

.snav-link {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  padding: 0.9rem 1rem;
  border: 1px solid var(--border);
  border-radius: 14px;
  text-decoration: none;
  color: var(--text);
  background: var(--surface);
  transition: border-color 0.15s, background 0.15s;
}

.snav-link:hover {
  border-color: var(--primary);
  background: var(--surface-alt);
}

.snav-link.next { text-align: right; }

.snav-dir {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--muted);
}

.snav-title {
  font-family: Inter, system-ui, sans-serif;
  font-weight: 700;
  font-size: 0.95rem;
}

/* ── Export PDF ── */
.song-pdf-actions {
  max-width: 680px;
  padding: 0 0 2.2rem;
  display: flex;
  gap: 0.7rem;
  flex-wrap: wrap;
  justify-content: center;
  margin-left: auto;
  margin-right: auto;
}

.song-pdf-btn,
.song-slide-btn,
.song-delete-btn {
  appearance: none;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  border-radius: 999px;
  padding: 0.7rem 1rem;
  font-family: Inter, system-ui, sans-serif;
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.15s, opacity 0.15s, filter 0.15s;
}

.song-pdf-btn {
  border: 1px solid var(--primary);
  background: var(--primary);
  color: #fff;
}

.song-slide-btn {
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
}

.song-delete-btn {
  border: 1px solid #dc2626;
  background: #dc2626;
  color: #fff;
}

.btn-icon {
  width: 1.1rem;
  height: 1.1rem;
  flex-shrink: 0;
}

.btn-icon-white {
  filter: brightness(0) invert(1);
}

.song-pdf-btn:hover,
.song-slide-btn:hover,
.song-delete-btn:hover {
  transform: translateY(-1px);
  filter: brightness(0.95);
}

.song-pdf-btn:disabled,
.song-slide-btn:disabled,
.song-delete-btn:disabled {
  opacity: 0.7;
  cursor: wait;
  transform: none;
}

/* ── Active nav ── */
.nav-active {
  color: var(--primary) !important;
  font-weight: 700 !important;
}

@media (max-width: 900px) {
  .cantari-hero,
  .song-page-hero {
    padding-top: 5.6rem;
  }

  .search-wrap input {
    max-width: 100%;
  }

  .song-body-page,
  .song-pdf-actions {
    max-width: 100%;
  }
}

@media (max-width: 600px) {
  .cantari-hero,
  .song-page-hero {
    padding-top: 5.25rem;
    padding-bottom: 1.1rem;
  }

  .cantari-index-section {
    padding-top: 1.35rem;
    padding-bottom: 1.8rem;
  }

  .search-wrap {
    margin-bottom: 0.9rem;
  }

  .cantari-hero h1,
  .song-page-hero h1 {
    line-height: 1.2;
  }

  .alpha-nav {
    gap: 0.34rem;
    margin-bottom: 0.95rem;
  }

  .alpha-group {
    margin-bottom: 1.15rem;
  }

  .alpha-letter {
    margin-bottom: 0.55rem;
    padding-bottom: 0.25rem;
  }

  .alpha-nav a {
    width: 34px;
    height: 34px;
    font-size: 0.92rem;
  }

  .song-list-item a {
    padding: 0.78rem 0.86rem;
    font-size: 0.93rem;
  }

  .song-stanza p {
    font-size: 1rem;
    line-height: 1.52;
  }

  .song-nav {
    grid-template-columns: 1fr;
    padding: 1.6rem 0 2.4rem;
  }

  .snav-link.next {
    text-align: left;
  }

  .song-pdf-btn,
  .song-slide-btn {
    flex: 1 1 0;
    min-width: 0;
    width: auto;
    justify-content: center;
    padding-left: 0.5rem;
    padding-right: 0.5rem;
    font-size: 0.88rem;
  }

  .song-slide-btn { display: none; }
  .song-wa-btn { display: inline-flex; order: 1; }
  .song-pdf-btn { order: 2; justify-content: center; text-align: center; }
}

/* ── Song hero: title only (back button lives in the header) ── */
.song-page-hero .back-link,
.song-page-hero .song-page-logo {
  display: none;
}

.song-page-hero .container {
  display: block;
  text-align: center;
}

.song-page-hero {
  border-bottom: none;
  padding-bottom: 0.5rem;
}

.song-page-hero h1 {
  margin: 0;
  font-size: clamp(1.5rem, 3.2vw, 2.3rem);
}

/* ── Song page background image (semi-transparent) ── */
body {
  position: relative;
  background: transparent;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  background: url("../images/sfondo-cantari.jpg") center / cover no-repeat;
  opacity: 0.4;
  pointer-events: none;
}

/* Soft fade over the background photo: photo on the sides, clean in the center */
body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  background: linear-gradient(
    to right,
    rgba(250, 248, 245, 0) 0%,
    rgba(250, 248, 245, 0) 12%,
    rgba(250, 248, 245, 0.93) 35%,
    rgba(250, 248, 245, 0.97) 50%,
    rgba(250, 248, 245, 0.93) 65%,
    rgba(250, 248, 245, 0) 88%,
    rgba(250, 248, 245, 0) 100%
  );
  pointer-events: none;
}

/* ── YouTube embed in song hero (smaller, centered) ── */
.song-youtube-wrap {
  width: 100%;
  max-width: 400px;
  margin: 1.2rem auto 0;
}

.song-youtube-aspect {
  position: relative;
  width: 100%;
  padding-bottom: 56.25%; /* 16:9 */
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.15);
}

.song-youtube-aspect iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: none;
}

/* ── Mobile: no background photo, centered lyrics ── */
@media (max-width: 900px) {
  body::before,
  body::after {
    display: none;
  }

  body {
    background: var(--bg, #faf8f4);
  }

  .song-body-page,
  .song-pdf-actions,
  .song-stanza p,
  .stanza-label {
    text-align: center;
  }

  .song-body-page {
    margin-left: auto;
    margin-right: auto;
  }
}

/* Nelle pagine dei canti il pulsante donazioni non serve */
.donate-fab { display: none !important; }
/* ── Selettore dimensione testo (locale) ── */
.song-fs-picker {
  display: inline-flex;
  gap: 0.25rem;
  padding: 0.2rem;
  margin: 0 auto 0.5rem;
  border-radius: 12px;
  background: var(--surface-alt);
  border: 1px solid var(--border);
}

.song-fs-wrap {
  display: flex;
  justify-content: center;
  align-items: stretch;
  gap: 0.6rem;
  margin-bottom: 0.5rem;
}
.song-fs-wrap .song-fs-picker { margin: 0; border-radius: 999px; }
.song-fs-wrap .song-fs-picker button { border-radius: 999px; }
.song-fs-wrap .song-edit-btn { margin: 0; box-sizing: border-box; justify-content: center; border-radius: 999px; }

.song-tonality-text {
  display: inline-flex;
  align-items: center;
  font-family: Inter, system-ui, sans-serif;
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--primary);
  white-space: nowrap;
}

.song-fav-btn {
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  width: 2.6rem;
  flex-shrink: 0;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface-alt);
  cursor: pointer;
}

.song-fav-btn svg {
  width: 1.2rem;
  height: 1.2rem;
  fill: none;
  stroke: var(--muted);
  stroke-width: 1.6;
  transition: fill 0.2s, stroke 0.2s, transform 0.2s;
}

.song-fav-btn:hover svg { stroke: #e0b542; transform: scale(1.12); }

.song-share-btn svg { stroke: var(--primary); }
.song-share-btn:hover svg { stroke: var(--primary); }
.song-share-btn.is-copied svg { stroke: #1fa855; stroke-width: 2.2; }

.song-fav-btn.is-fav svg {
  fill: #e0b542;
  stroke: #d4a62e;
}

.song-fs-picker button {
  min-width: 2.1rem;
  height: 1.9rem;
  padding: 0 0.45rem;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--primary);
  font-family: Inter, system-ui, sans-serif;
  font-weight: 600;
  cursor: pointer;
}

.song-fs-picker button[aria-pressed="true"] {
  background: var(--surface);
  box-shadow: 0 0 0 1.5px var(--primary) inset;
}

.song-body-page .song-stanza p { font-size: calc(1.06rem * var(--song-fs, 1)); }
.song-body-page .stanza-label { font-size: calc(0.78rem * var(--song-fs, 1)); }

@media (max-width: 600px) {
  .song-body-page .song-stanza p { font-size: calc(1rem * var(--song-fs, 1)); }
}

/* Tasto WhatsApp: solo mobile */
.song-wa-btn {
  display: none;
  appearance: none;
  align-items: center;
  border: 1px solid #3f6f55;
  background: #4a7c61;
  color: #fff;
  border-radius: 999px;
  padding: 0.7rem 0.5rem;
  font-family: Inter, system-ui, sans-serif;
  font-size: 0.88rem;
  font-weight: 700;
  text-decoration: none;
  justify-content: center;
  text-align: center;
  flex: 0 0 auto;
  width: 3rem;
  height: 3rem;
  padding: 0;
  min-width: 0;
}

.song-wa-btn svg {
  width: 1.5rem;
  height: 1.5rem;
}

@media (max-width: 600px) {
  .song-wa-btn { display: inline-flex; order: 1; }
}

/* Titolo canto: font Cinzel */
.song-page-hero h1 {
  font-family: 'Cinzel', serif;
  font-weight: 600;
}

/* Mobile: anche con un canto corto, i tasti WhatsApp/PDF stanno in fondo, vicino al footer */
@media (max-width: 900px) {
  body.page-song main {
    display: flex;
    flex-direction: column;
  }

  body.page-song main > .container {
    flex: 1 0 auto;
    display: flex;
    flex-direction: column;
  }

  body.page-song .song-body-page,
  body.page-song .song-pdf-actions {
    width: 100%;
  }

  body.page-song .song-pdf-actions {
    margin-top: auto;
    padding-top: 1.6rem;
  }
}

/* Titoli dei canti: a capo bilanciato */
.song-page-hero h1 {
  text-wrap: balance;
}

/* ── Texture leggera a foglio di carta ── */
main {
  position: relative;
}

main::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  opacity: 0.2;
  mix-blend-mode: multiply;
  background-image:
    url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='300' height='300'><filter id='p' x='0' y='0' width='100%' height='100%'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='3' seed='7' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 0.45  0 0 0 0 0.38  0 0 0 0 0.28  1.4 0 0 0 -0.45'/></filter><rect width='100%' height='100%' filter='url(%23p)'/></svg>"),
    url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='600' height='600'><filter id='f' x='0' y='0' width='100%' height='100%'><feTurbulence type='fractalNoise' baseFrequency='0.012 0.02' numOctaves='2' seed='3' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 0.6  0 0 0 0 0.5  0 0 0 0 0.35  0.5 0 0 0 -0.12'/></filter><rect width='100%' height='100%' filter='url(%23f)'/></svg>");
}

/* Mobile: WhatsApp + PDF nello stesso gruppo, centrato; il tondo WhatsApp è alto quanto il tasto PDF */
@media (max-width: 600px) {
  body.page-song .song-pdf-actions {
    justify-content: center;
    align-items: center;
    flex-wrap: nowrap;
  }

  body.page-song .song-pdf-actions .song-pdf-btn {
    flex: 0 0 auto;
    width: 11rem;
    height: 2.9rem;
    padding-top: 0;
    padding-bottom: 0;
    justify-content: center;
  }

  body.page-song .song-pdf-actions .song-wa-btn {
    flex: 0 0 auto;
    width: 2.9rem;
    height: 2.9rem;
    padding: 0;
    order: 3;
  }

  body.page-song .song-pdf-actions .song-wa-btn svg {
    width: 1.45rem;
    height: 1.45rem;
  }
}
