/* Ausschließlich auf der Geschichten-Unterseite geladen. */
html { scroll-behavior: auto; }
body {
  color: #23365d;
  background-color: #76b8e9;
  background-image: url("geschichten-himmel-v2.png?v=clouds-20260917");
  background-size: cover;
  background-position: center top;
  background-repeat: no-repeat;
  background-attachment: fixed;
}
.stories-page { padding-top: 12px; padding-bottom: 76px; }
.back-home {
  position: relative;
  left: -12px;
  top: 6px;
  display: inline-block;
  padding: 11px 24px;
  border-radius: 30px;
  background: linear-gradient(180deg, #edf7ff, #d4e8f6);
  color: #3e3857;
  border: 1px solid #b58d813d;
  box-shadow: inset 0 1px 0 #ffffffb0, 0 4px 12px #75544412;
  transition: transform .25s ease, box-shadow .25s ease, background-color .25s ease;
  font-size: 1rem;
  text-decoration: none;
}
.back-home:hover { box-shadow: 0 6px 16px #75544420; transform: translateY(-2px); }
.stories-intro { max-width: 760px; margin: 30px auto 34px; text-align: center; }
.stories-page .stories-intro h1 {
  margin: 0 auto 30px; font-weight: 600; line-height: 1.18;
  color: #10194f; font-size: clamp(2.8rem, 5.5vw, 4.9rem);
  text-align: center; text-shadow: 0 3px 12px #3c567c30, 0 0 24px #ffffffb0;
}
.stories-intro p { max-width: 680px; margin: 0 auto; color: #253d66; font-size: 1.075rem; line-height: 1.7; }
.grid-hint { max-width: 720px; margin: 0 auto 24px; text-align: center; color: #30486b; font-size: 1rem; line-height: 1.7; }
.stories-page .story-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 34px 28px;
  align-items: start;
}
.story-entry { min-width: 0; padding: 12px; border-radius: 26px; background: #fffdf9; box-shadow: 0 7px 24px #3b60821c; border: 1px solid #ffffffcc; }
.story-entry summary { display: block; cursor: pointer; list-style: none; }
.story-entry summary::-webkit-details-marker { display: none; }
.story-entry summary:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 6px;
  border-radius: 10px;
}
/* Ein identischer quadratischer Rahmen für alle Originalformate.
   Das absolut positionierte Bild beeinflusst die Rahmengröße nicht. */
.story-picture {
  position: relative;
  display: block;
  width: 100%;
  height: 0;
  padding-bottom: 100%;
  background: #f0e9df;
  border-radius: 12px;
  overflow: hidden;
}
.story-picture img {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center;
}
.story-cover-focus-source {
  background: transparent;
  border-color: transparent;
  box-shadow: none;
}
.story-cover-focus-source .story-picture { background: transparent; }
.story-cover-focus-source .story-picture > * { opacity: 0; }
.story-cover-focus-source .story-title { visibility: hidden; }
.story-detail-focus-panel {
  position: fixed;
  z-index: 1000;
  margin: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
  padding: 20px;
  overflow: auto;
  pointer-events: auto;
  border-radius: 18px;
  background: transparent;
  box-shadow: none;
  cursor: pointer;
}
.story-detail-focus-surface {
  position: absolute;
  inset: 0;
  z-index: 0;
  border-radius: 18px;
  background: rgba(180, 225, 245, .70);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  box-shadow: 0 20px 46px #1d315c66, 0 4px 14px #ffffff9e;
}
.story-detail-focus-media {
  position: relative;
  z-index: 1;
  flex: 0 0 auto;
  overflow: hidden;
  border-radius: 12px;
  background: #fffdf9;
}
.story-detail-focus-panel .story-picture {
  flex: 0 0 auto;
  width: 100%;
  height: auto;
  padding-bottom: 0;
  aspect-ratio: 1;
}
.story-detail-focus-panel img,
.story-detail-focus-panel .story-image-pending {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}
.story-detail-focus-panel .story-title {
  min-height: 0;
  margin: 14px 16px 16px;
  font-family: var(--serif);
  font-size: 1.2rem;
  font-weight: 400;
  line-height: 1.35;
  text-align: center;
  color: #18274f;
}
.story-detail-focus-panel .story-description {
  position: relative;
  z-index: 1;
  display: block;
  width: 100%;
  margin: 0;
  min-height: 160px;
  padding: 26px 32px;
  border-radius: 12px;
  background: #fffdf9;
  font-size: 1.05rem;
  line-height: 1.75;
  text-align: left;
  text-align: justify;
  hyphens: none;
  -webkit-hyphens: none;
  -ms-hyphens: none;
  word-break: normal;
  overflow-wrap: normal;
}
.story-image-pending {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 16px;
  background: #eee8de;
  color: var(--muted);
  text-align: center;
  font-size: 1rem;
}
.stories-page .story-title {
  /* Für kurze und zweizeilige Titel denselben Platz reservieren. */
  min-height: 2.7em;
  font-family: var(--serif);
  font-weight: 400;
  font-size: 1.2rem;
  line-height: 1.35;
  letter-spacing: normal;
  margin: 12px 0 0;
  width: 100%;
  text-align: center;
  overflow-wrap: break-word;
  hyphens: auto;
}
.story-entry summary:hover .story-title { text-decoration: underline; text-underline-offset: 4px; }
.story-entry[open] .story-title { color: var(--accent); }
.story-description {
  margin: 16px 0 0; padding: 16px 14px;
  background: #f8efe8; border-radius: 12px;
  color: #574c45; font-size: .975rem; line-height: 1.8;
  overflow-wrap: break-word; hyphens: auto;
}
.collection-platforms {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  max-width: 1080px;
  margin: 0 auto 30px;
}
.collection-platforms button,
.collection-platforms a {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-width: 0;
  min-height: 54px;
  gap: 10px;
  border: 1px solid #b58d813d;
  border-radius: 20px;
  padding: 12px 14px;
  background: linear-gradient(180deg, #faece9, #eed9d5);
  color: #62473f;
  box-shadow: inset 0 1px 0 #ffffffb0, 0 4px 12px #75544412;
  transition: background-color .25s ease, box-shadow .25s ease, transform .25s ease;
  font-family: var(--sans);
  font-size: .95rem;
  font-weight: 500;
  line-height: 1.5;
  text-align: center;
  text-decoration: none;
  overflow-wrap: break-word;
}
.collection-platforms button:disabled { background: #825451; color: white; opacity: 1; cursor: not-allowed; }
@media (max-width: 1000px) {
  .stories-page .story-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .collection-platforms { grid-template-columns: 1fr; max-width: 480px; margin-inline: auto; }
}
@media (max-width: 600px) {
  .stories-page .story-grid { grid-template-columns: minmax(0, 1fr); }
  .stories-intro { margin-bottom: 28px; }
  .story-detail-focus-panel { gap: 14px; padding: 14px; }
  .story-detail-focus-surface { border-radius: 14px; }
  .story-detail-focus-panel .story-description { min-height: 0; padding: 20px; }
}

.collection-platforms a::before {
  content: ""; width: 20px; height: 20px; flex: 0 0 20px;
  background-color: currentColor; opacity: .85;
  -webkit-mask: var(--platform-icon) center / contain no-repeat;
  mask: var(--platform-icon) center / contain no-repeat;
}
@media (hover: hover) {
  .collection-platforms a:hover {
    background: #fff1ec;
    box-shadow: inset 0 1px 0 #fff, 0 7px 18px #a6746529;
    transform: translateY(-2px);
  }
}
@media (prefers-reduced-motion: reduce) {
  .back-home, .collection-platforms a { transition: none; }
  .back-home:hover, .collection-platforms a:hover { transform: none; }
}
.collection-platforms a[href*="open.spotify.com"] { --platform-icon: url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%2024%2024%22%3E%3Ccircle%20cx%3D%2212%22%20cy%3D%2212%22%20r%3D%2210%22%20fill%3D%22none%22%20stroke%3D%22currentColor%22%20stroke-width%3D%221.5%22%2F%3E%3Cpath%20d%3D%22M6%209c4-1.5%208-1%2012%201M7%2012c3-1%207-.7%2010%201M8%2015c2-.6%205-.3%208%201%22%20fill%3D%22none%22%20stroke%3D%22currentColor%22%20stroke-width%3D%221.6%22%20stroke-linecap%3D%22round%22%2F%3E%3C%2Fsvg%3E"); }
.collection-platforms a[href*="youtube.com"] { --platform-icon: url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%2024%2024%22%3E%3Crect%20x%3D%222%22%20y%3D%225%22%20width%3D%2220%22%20height%3D%2214%22%20rx%3D%225%22%20fill%3D%22none%22%20stroke%3D%22currentColor%22%20stroke-width%3D%221.6%22%2F%3E%3Cpath%20d%3D%22m10%209%206%203-6%203Z%22%20fill%3D%22currentColor%22%2F%3E%3C%2Fsvg%3E"); }
.collection-platforms a[href*="music.amazon.com"] { --platform-icon: url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%2024%2024%22%3E%3Cpath%20d%3D%22M10%2016V6l9-2v10M10%209l9-2%22%20fill%3D%22none%22%20stroke%3D%22currentColor%22%20stroke-width%3D%221.7%22%20stroke-linecap%3D%22round%22%2F%3E%3Cellipse%20cx%3D%227.5%22%20cy%3D%2216.5%22%20rx%3D%222.5%22%20ry%3D%222%22%20fill%3D%22currentColor%22%2F%3E%3Cellipse%20cx%3D%2216.5%22%20cy%3D%2214.5%22%20rx%3D%222.5%22%20ry%3D%222%22%20fill%3D%22currentColor%22%2F%3E%3Cpath%20d%3D%22M4%2021c5%202%2011%201%2015-1%22%20fill%3D%22none%22%20stroke%3D%22currentColor%22%20stroke-width%3D%221.3%22%20stroke-linecap%3D%22round%22%2F%3E%3C%2Fsvg%3E"); }

/* Sternenlicht nur am Kopf dieser Unterseite. */
.stories-page .stories-intro h1 { position: relative; isolation: isolate; }
.stories-page .stories-intro h1::before {
  content: ""; position: absolute; inset: -24px -8px;
  background: radial-gradient(ellipse, #ffffff80, transparent 72%);
  z-index: -1; pointer-events: none;
}
.stories-title-lights { position: absolute; inset: 0; pointer-events: none; }
.stories-title-star {
  position: absolute; left: var(--x); top: var(--y);
  width: var(--size); height: var(--size);
  animation: stories-soft-light calc(var(--time) * .42) var(--delay) ease-in-out infinite;
  filter: drop-shadow(0 0 5px #fff1b8) drop-shadow(0 0 12px #ffe5a580);
}
.stories-title-star::before {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(135deg, #e7cb97, #fffdf0 48%, #ebd4aa);
  clip-path: polygon(50% 0,60% 39%,100% 50%,60% 61%,50% 100%,40% 61%,0 50%,40% 39%);
}
.stories-title-star.is-point::before { border-radius: 50%; clip-path: none; }
@keyframes stories-soft-light {
  0%,100% { opacity: .6; transform: translate(-50%, -50%) scale(.92); filter: drop-shadow(0 0 3px #ffe3a4a0); }
  50% { opacity: var(--star-peak, 1); transform: translate(-50%, -50%) scale(var(--star-scale, 1.2)); filter: brightness(1.3) drop-shadow(0 0 6px #fff1bd) drop-shadow(0 0 12px #ffdc8d99); }
}
@media (max-width: 600px) {
  .stories-title-star { width: calc(var(--size) * .7); height: calc(var(--size) * .7); }
  .stories-title-lights { top: -14px; bottom: -4px; }
}
@media (prefers-reduced-motion: reduce) {
  .stories-title-star { animation: none; opacity: .7; transform: translate(-50%, -50%); }
}

body { position: relative; isolation: isolate; }
.stories-title-star:not(.is-point) { width: calc(var(--size) * 1.35); height: calc(var(--size) * 1.35); }
@media (max-width: 600px) {
  .stories-title-star:not(.is-point) { width: var(--size); height: var(--size); }
}

/* Referenz: luftiger Kopf, einheitliche helle Fenster und roséfarbene Hörbuttons. */
.stories-page .story-title { color: #18274f; }

@media (max-width: 600px) {
  body { background-position: center top; }
  .stories-page .stories-intro h1 { font-size: 2.8rem; }
}

/* Lichtakzente nur auf den vorhandenen Sternen, passend zum festen Hintergrund. */
.stories-sky-lights {
  position: fixed; inset: 0; width: 100%; height: 100%;
  z-index: -1; pointer-events: none;
}
.stories-sky-pulse {
  fill: #fff5ce;
  animation: stories-sky-breathe var(--beat) var(--offset) ease-in-out infinite;
}
@keyframes stories-sky-breathe {
  0%,100% { opacity: .18; transform: scale(.86); filter: drop-shadow(0 0 2px #ffd88a60); }
  50% { opacity: var(--bright); transform: scale(var(--swell)); filter: drop-shadow(0 0 var(--glow) #ffe8a8) brightness(1.3); }
}
.stories-title-star:nth-child(2n) { --star-peak: .88; --star-scale: 1.14; }
.stories-title-star:nth-child(3n) { --star-peak: .96; --star-scale: 1.28; }
.stories-title-star.is-point { --star-scale: 1.1; --star-peak: .78; }
@media (prefers-reduced-motion: reduce) {
  .stories-sky-pulse { animation: none; opacity: .35; }
}

/* Nur der störende Titelstern unter dem D; andere Sternpositionen bleiben erhalten. */
.stories-title-lights > .stories-title-star:nth-child(2) { display: none; }
/* Einzelne zufällige Sternschnuppen, gesteuert durch geschichten-sternschnuppen.js. */
.stories-comet-sky {
  position: fixed; top: 0; left: 0; width: 100%; height: 100vh;
  z-index: -1; pointer-events: none; overflow: hidden;
}
.stories-comet {
  opacity: 0;
  transform-origin: 0 0;
  filter: drop-shadow(0 0 3px #fff6d9) drop-shadow(0 0 8px #ffd78ba0);
}
/* Auf schmalen Displays bleiben die Bahnen oberhalb der Textbereiche. */
@media (max-width: 1000px) {
  .stories-comet-sky { height: 100vh; }
}
@media (prefers-reduced-motion: reduce) {
  .stories-comet-sky { display: none; }
}

/* Bisherigen Platzbedarf erhalten, damit das Geschichtenraster nicht wandert. */
.collection-platforms { grid-auto-rows: minmax(76px, auto); align-items: start; }
.collection-platforms a[href*="open.spotify.com"],
.collection-platforms a[href*="youtube.com"] { color: #78625a; }
.collection-platforms a[href*="open.spotify.com"]::before { background-color: #1a9850; }
.collection-platforms a[href*="youtube.com"]::before { background-color: #d63c3c; }
.collection-platforms a[href*="music.amazon.com"]::before { background-color: #278999; }

/* Nur das breite Desktop-Geschichtenraster verbreitern; Kopfbereich bleibt unverändert. */
@media (min-width: 1101px) {
  .stories-page .story-grid {
    width: min(109.3%, calc(100vw - 32px));
    position: relative;
    left: 50%;
    transform: translateX(-50%);
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

/* Bei mittlerer Desktopbreite bleiben die Karten lesbar in drei Spalten.
   Die große Desktopansicht oberhalb von 1100px bleibt davon unberührt. */
@media (min-width: 901px) and (max-width: 1100px) {
  .stories-page .story-grid {
    width: 100%;
    position: static;
    transform: none;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 34px 28px;
  }
}

/* Unterhalb davon folgen zwei und auf sehr schmalen Ansichten eine Karte pro Reihe.
   Detailtexte erweitern dabei weiterhin ausschließlich ihre eigene Karte. */
@media (min-width: 601px) and (max-width: 900px) {
  .stories-page .story-grid {
    width: 100%;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 600px) {
  .stories-page .story-grid {
    width: 100%;
    grid-template-columns: minmax(0, 1fr);
  }
}

/* iPadOS rendert einen fixierten, mit `cover` skalierten body-Hintergrund
   in einer eigenen Viewport-Fläche und schneidet dadurch die Seiten des
   Motivs ab. Am tatsächlich zeichnenden body wird das Bild daher bei iPadOS
   mit voller Breite und ohne Fixed-Compositing dargestellt. */
@supports (-webkit-touch-callout: none) {
  @media (min-width: 601px) and (max-width: 1366px) {
    body {
      background-attachment: scroll;
      background-size: 100% auto;
      background-position: center top;
      background-repeat: no-repeat;
    }
  }
}
