/* ---------- Schriften (lokal, SIL Open Font License) ---------- */
@font-face { font-family: "Fraunces"; src: url("fonts/fraunces-latin-400-normal.woff2") format("woff2"); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: "Fraunces"; src: url("fonts/fraunces-latin-400-italic.woff2") format("woff2"); font-weight: 400; font-style: italic; font-display: swap; }
@font-face { font-family: "Fraunces"; src: url("fonts/fraunces-latin-600-normal.woff2") format("woff2"); font-weight: 600; font-style: normal; font-display: swap; }
@font-face { font-family: "Source Sans 3"; src: url("fonts/source-sans-3-latin-400-normal.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Source Sans 3"; src: url("fonts/source-sans-3-latin-600-normal.woff2") format("woff2"); font-weight: 600; font-display: swap; }

/* ---------- Grundwerte ---------- */
:root {
  --nacht: #0f1c2b;
  --see: #17324a;
  --see-hell: #2b5573;
  --papier: #f4ecdf;
  --papier-dunkel: #e9dcc4;
  --tinte: #1d2a3a;
  --tinte-leise: #5d6878;
  --signal: #c0533a;     /* Backbord-Rot */
  --messing: #b08d57;
  --radius: 14px;
  --serif: "Fraunces", Georgia, "Times New Roman", serif;
  --sans: "Source Sans 3", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --spalte: 560px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.5;
  color: var(--tinte);
  background: var(--papier);
  -webkit-tap-highlight-color: transparent;
}
[hidden] { display: none !important; }
button { font: inherit; color: inherit; cursor: pointer; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.kicker {
  margin: 0 0 .4rem;
  font-family: var(--sans);
  font-weight: 600;
  font-size: .78rem;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--messing);
}

/* ---------- Versiegelt (Login) ---------- */
.siegel {
  position: fixed; inset: 0;
  display: grid; place-items: center;
  padding: 2rem 1.5rem 6rem;
  background:
    radial-gradient(120% 80% at 50% 0%, var(--see) 0%, var(--nacht) 70%);
  color: var(--papier);
  overflow: hidden;
}
.siegel__inhalt { position: relative; z-index: 2; width: 100%; max-width: 340px; text-align: center; }
.flasche { width: 74px; height: auto; margin: 0 auto 1.25rem; display: block; transform-origin: 50% 90%; animation: schaukeln 6s ease-in-out infinite; }
.flasche__glas { fill: rgba(233,220,196,.06); stroke: var(--papier-dunkel); stroke-width: 3; stroke-linejoin: round; }
.flasche__korken { fill: var(--messing); }
.flasche__rolle rect { fill: var(--papier-dunkel); }
.flasche__rolle path { stroke: var(--tinte-leise); stroke-width: 2; stroke-linecap: round; }
.flasche__rolle .flasche__band { stroke: var(--signal); stroke-width: 4; }
@keyframes schaukeln { 0%,100% { transform: rotate(-4deg); } 50% { transform: rotate(4deg); } }

.siegel__titel { font-family: var(--serif); font-weight: 400; font-size: 2.6rem; line-height: 1.1; margin: 0 0 .6rem; }
.siegel__text { margin: 0 0 1.75rem; color: rgba(244,236,223,.78); }
.siegel__form { display: grid; gap: .75rem; }
.siegel__form input[type=password] {
  width: 100%; padding: .9rem 1rem;
  font: inherit; font-size: 1.1rem; text-align: center; letter-spacing: .04em;
  color: var(--papier);
  background: rgba(255,255,255,.06);
  border: 1px solid rgba(233,220,196,.35); border-radius: var(--radius);
  outline: none;
}
.siegel__form input[type=password]:focus { border-color: var(--messing); background: rgba(255,255,255,.1); }
.siegel__form button {
  padding: .9rem 1rem; border: 0; border-radius: var(--radius);
  background: var(--papier); color: var(--nacht);
  font-weight: 600; font-size: 1.05rem; letter-spacing: .02em;
}
.siegel__form button:disabled { opacity: .6; }
.merken { font-size: .9rem; color: rgba(244,236,223,.7); display: inline-flex; gap: .5rem; align-items: center; justify-content: center; }
.merken input { accent-color: var(--messing); }
.siegel__hinweis { margin: .25rem 0 0; font-family: var(--serif); font-style: italic; color: rgba(244,236,223,.7); }
.siegel__fehler { min-height: 1.5em; margin: 0; color: #f0a48f; font-size: .95rem; }
.siegel--wackeln .siegel__form { animation: wackeln .4s; }
@keyframes wackeln { 20%,60% { transform: translateX(-8px); } 40%,80% { transform: translateX(8px); } }
.siegel--weg { animation: wegtauchen .7s ease-in forwards; }
@keyframes wegtauchen { to { opacity: 0; transform: translateY(-3%); } }

.wellen { position: absolute; left: 0; right: 0; bottom: 0; width: 100%; height: 120px; z-index: 1; }
.welle--1 { fill: rgba(43,85,115,.45); animation: wogen 9s ease-in-out infinite alternate; }
.welle--2 { fill: rgba(23,50,74,.9); animation: wogen 7s ease-in-out infinite alternate-reverse; }
@keyframes wogen { from { transform: translateX(-30px); } to { transform: translateX(30px); } }

/* ---------- Geöffnet ---------- */
.app {
  max-width: var(--spalte); margin: 0 auto;
  padding: max(2.25rem, env(safe-area-inset-top)) 1.25rem calc(6rem + env(safe-area-inset-bottom));
  animation: auftauchen .8s ease-out;
}
@keyframes auftauchen { from { opacity: 0; transform: translateY(12px); } }

.kopf { text-align: center; margin-bottom: 1.75rem; }
.kopf__titel { font-family: var(--serif); font-weight: 600; font-size: 2.3rem; line-height: 1.08; margin: 0 0 .75rem; letter-spacing: -.01em; }
.kopf__widmung { font-family: var(--serif); font-style: italic; font-size: 1.1rem; color: var(--tinte-leise); margin: 0 auto; max-width: 30ch; }

.karte {
  background: var(--nacht); color: var(--papier);
  border-radius: calc(var(--radius) + 4px);
  padding: 1.25rem 1.25rem 1rem;
  box-shadow: 0 10px 30px -12px rgba(15,28,43,.55);
}
.player__zeile { display: flex; align-items: center; gap: 1rem; }
.play {
  flex: 0 0 auto; width: 64px; height: 64px; border-radius: 50%; border: 0;
  background: var(--papier); color: var(--nacht);
  display: grid; place-items: center;
  transition: transform .15s;
}
.play:active { transform: scale(.94); }
.play:disabled { opacity: .5; }
.play svg, .mini__play svg { width: 30px; height: 30px; fill: currentColor; }
.ic-pause { display: none; }
.spielt .ic-play { display: none; }
.spielt .ic-pause { display: block; }
.player__info { min-width: 0; }
.player__titel { margin: 0; font-family: var(--serif); font-size: 1.2rem; line-height: 1.25; }
.player__status { margin: .15rem 0 0; font-size: .9rem; color: rgba(244,236,223,.65); }

.leiste { position: relative; margin: 1.1rem 0 .35rem; height: 28px; }
.leiste__spur { position: absolute; left: 0; right: 0; top: 12px; height: 4px; border-radius: 2px; background: rgba(244,236,223,.18); }
.leiste__voll { height: 100%; width: 0; border-radius: 2px; background: var(--messing); }
.leiste__marken { position: absolute; inset: -5px 0; pointer-events: none; }
.leiste__marken span { position: absolute; top: 0; width: 2px; height: 14px; margin-left: -1px; background: rgba(244,236,223,.35); border-radius: 1px; }
.leiste input[type=range] {
  position: absolute; inset: 0; width: 100%; height: 28px; margin: 0;
  -webkit-appearance: none; appearance: none; background: transparent; cursor: pointer;
}
.leiste input[type=range]::-webkit-slider-runnable-track { height: 28px; background: transparent; }
.leiste input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; width: 16px; height: 16px; margin-top: 6px; border-radius: 50%; background: var(--papier); border: 0; }
.leiste input[type=range]::-moz-range-track { background: transparent; }
.leiste input[type=range]::-moz-range-thumb { width: 16px; height: 16px; border-radius: 50%; background: var(--papier); border: 0; }
.player__zeiten { display: flex; justify-content: space-between; gap: .5rem; font-size: .85rem; font-variant-numeric: tabular-nums; color: rgba(244,236,223,.65); }
#abschnitt { font-style: italic; font-family: var(--serif); color: var(--messing); text-align: center; }

.block { margin-top: 2.5rem; }
.block__titel {
  display: flex; align-items: center; gap: .75rem;
  margin: 0 0 1rem; font-family: var(--sans); font-weight: 600;
  font-size: .78rem; letter-spacing: .18em; text-transform: uppercase; color: var(--messing);
}
.block__titel::after { content: ""; flex: 1; height: 1px; background: var(--papier-dunkel); }

/* Liedtext */
.liedtext {
  position: relative;
  max-height: 58vh; overflow-y: auto; overscroll-behavior: contain;
  padding: 1.5rem 0 40vh 1.1rem;
  -webkit-mask-image: linear-gradient(to bottom, transparent 0, #000 2.5rem, #000 calc(100% - 4rem), transparent 100%);
          mask-image: linear-gradient(to bottom, transparent 0, #000 2.5rem, #000 calc(100% - 4rem), transparent 100%);
  scroll-behavior: smooth;
}
.liedtext:focus { outline: none; }
.liedtext__teil { margin: 1.6rem 0 .5rem; font-size: .75rem; letter-spacing: .16em; text-transform: uppercase; color: var(--tinte-leise); }
.liedtext__teil:first-child { margin-top: 0; }
.liedtext__zeile {
  display: block; width: 100%; text-align: left;
  margin: 0; padding: .3rem 0; border: 0; background: none;
  font-family: var(--serif); font-size: 1.3rem; line-height: 1.35;
  color: rgba(29,42,58,.38);
  transition: color .35s, transform .35s;
  transform-origin: left center;
}
.liedtext__zeile.vorbei { color: rgba(29,42,58,.6); }
.liedtext__zeile.aktiv { color: var(--tinte); transform: scale(1.03); }
.liedtext__zeile.aktiv::before { content: ""; display: inline-block; width: .5em; height: .5em; margin: 0 .5em .12em -1em; border-radius: 50%; background: var(--signal); }
.liedtext--ohne-zeit .liedtext__zeile { color: var(--tinte); cursor: default; }

/* Galerie */
.galerie { display: grid; grid-template-columns: repeat(2, 1fr); gap: .9rem; }
.foto {
  margin: 0; padding: .55rem .55rem .7rem; border: 0;
  background: #fff; border-radius: 4px; text-align: left;
  box-shadow: 0 1px 2px rgba(29,42,58,.12), 0 8px 18px -10px rgba(29,42,58,.35);
  transform: rotate(var(--dreh, 0deg));
  transition: transform .2s;
}
.foto:nth-child(3n+1) { --dreh: -1.2deg; }
.foto:nth-child(3n+2) { --dreh: .9deg; }
.foto:nth-child(3n) { --dreh: -.4deg; }
.foto:active { transform: rotate(0) scale(.98); }
.foto__bild { aspect-ratio: 1; background: var(--papier-dunkel); overflow: hidden; border-radius: 2px; }
.foto__bild img { width: 100%; height: 100%; object-fit: cover; display: block; opacity: 0; transition: opacity .4s; }
.foto__bild img.da { opacity: 1; }
.foto__text { display: block; margin-top: .45rem; font-family: var(--serif); font-style: italic; font-size: .92rem; line-height: 1.3; color: var(--tinte-leise); }
.foto--breit { grid-column: span 2; }
.foto--breit .foto__bild { aspect-ratio: 4 / 3; }

/* Download */
.block--download { text-align: center; }
.download {
  display: inline-flex; align-items: center; gap: .6rem;
  padding: .9rem 1.4rem; border-radius: 999px;
  border: 1.5px solid var(--tinte); color: var(--tinte); text-decoration: none; font-weight: 600;
}
.download svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.download small { font-weight: 400; color: var(--tinte-leise); }
.download[aria-disabled=true] { opacity: .4; pointer-events: none; }

.fuss { margin-top: 3rem; text-align: center; font-family: var(--serif); font-style: italic; font-size: 1.15rem; color: var(--tinte-leise); white-space: pre-line; }

/* Mini-Player */
.mini {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
  display: flex; align-items: center; gap: .75rem;
  padding: .6rem 1rem calc(.6rem + env(safe-area-inset-bottom));
  background: rgba(15,28,43,.96); color: var(--papier);
  backdrop-filter: blur(8px);
  transform: translateY(110%); transition: transform .3s ease;
}
.mini.zeigen { transform: none; }
.mini__play { flex: 0 0 auto; width: 44px; height: 44px; border-radius: 50%; border: 0; background: var(--papier); color: var(--nacht); display: grid; place-items: center; }
.mini__play svg { width: 22px; height: 22px; }
.mini__zeile { flex: 1; min-width: 0; margin: 0; font-family: var(--serif); font-size: 1rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mini__fortschritt { position: absolute; left: 0; right: 0; top: 0; height: 2px; background: rgba(244,236,223,.15); }
.mini__fortschritt div { height: 100%; width: 0; background: var(--messing); }

/* Bildansicht */
.lightbox { position: fixed; inset: 0; z-index: 30; background: rgba(10,18,28,.96); display: grid; place-items: center; padding: 1rem; }
.lightbox figure { margin: 0; max-width: 100%; text-align: center; }
.lightbox img { max-width: 100%; max-height: 80vh; border-radius: 4px; display: block; margin: 0 auto; }
.lightbox figcaption { margin-top: .8rem; color: var(--papier-dunkel); font-family: var(--serif); font-style: italic; }
.lightbox button { position: absolute; border: 0; background: none; color: var(--papier); font-size: 2.4rem; line-height: 1; padding: .5rem 1rem; }
.lightbox__zu { top: max(.5rem, env(safe-area-inset-top)); right: .25rem; }
.lightbox__nav { top: 50%; transform: translateY(-50%); }
.lightbox__nav--l { left: 0; }
.lightbox__nav--r { right: 0; }

@media (min-width: 700px) {
  .kopf__titel { font-size: 3rem; }
  .galerie { grid-template-columns: repeat(3, 1fr); }
  .foto--breit { grid-column: span 3; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .liedtext { scroll-behavior: auto; }
}
