/* RobotiSTory — stacked story deck */
.story-page {
  --story-a: #ff6b2b;
  --story-b: #ff3d57;
  position: relative;
  isolation: isolate;
  overflow: hidden;
  min-height: 100vh;
  padding: 11rem 6% 5rem;
  background: var(--bg-secondary);
}

.story-page::before,
.story-page::after {
  content: "";
  position: absolute;
  pointer-events: none;
}

.story-page::before {
  inset: -35%;
  z-index: -2;
  background:
    radial-gradient(ellipse 46% 38% at 18% 16%, color-mix(in srgb, var(--story-a) 28%, transparent), transparent 58%),
    radial-gradient(ellipse 42% 36% at 86% 78%, color-mix(in srgb, var(--story-b) 22%, transparent), transparent 55%),
    radial-gradient(ellipse 38% 34% at 72% 14%, rgba(168, 85, 247, 0.16), transparent 52%),
    radial-gradient(ellipse 34% 30% at 30% 88%, rgba(77, 141, 255, 0.12), transparent 50%);
  animation: storyWash 26s ease-in-out infinite;
  transition: background 0.8s ease;
}

.story-page::after {
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(circle at 50% 120%, color-mix(in srgb, var(--story-a) 12%, transparent), transparent 42%);
  opacity: 0.9;
}

@keyframes storyWash {
  0%,
  100% {
    transform: translate3d(0, 0, 0) scale(1);
    filter: hue-rotate(0deg);
  }

  40% {
    transform: translate3d(5%, -4%, 0) scale(1.08);
    filter: hue-rotate(18deg);
  }

  70% {
    transform: translate3d(-4%, 5%, 0) scale(1.05);
    filter: hue-rotate(-14deg);
  }
}

.story-hero {
  text-align: center;
  max-width: 46rem;
  margin: 0 auto 2.4rem;
}

.story-page .heading {
  margin-bottom: 1.2rem;
}

.story-page .heading-icon {
  animation: none;
  color: var(--accent-orange);
}

.story-lead {
  color: var(--text-secondary);
  font-size: 1.55rem;
  line-height: 1.45;
}

/* Eski önbellekte kalırsa görünmesin */
.story-credit {
  display: none !important;
}

.story-stage {
  position: relative;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 1.6rem;
  max-width: 1280px;
  margin: 0 auto;
}

.story-nav {
  width: 4.6rem;
  height: 4.6rem;
  border: 1px solid var(--border-subtle);
  border-radius: 50%;
  background: var(--bg-card);
  color: var(--text-primary);
  cursor: pointer;
  display: grid;
  place-items: center;
  font-size: 1.5rem;
  transition: transform 0.25s ease, border-color 0.25s ease, box-shadow 0.25s ease;
  z-index: 8;
}

.story-nav:hover {
  transform: translateY(-2px);
  border-color: color-mix(in srgb, var(--story-a) 55%, transparent);
  box-shadow: 0 0 22px color-mix(in srgb, var(--story-a) 28%, transparent);
}

.story-stack {
  position: relative;
  height: min(72vh, 52rem);
  min-height: 42rem;
}

.story-card {
  --tone-a: #ff6b2b;
  --tone-b: #ff3d57;
  --card-face: #14141c;
  position: absolute;
  left: 50%;
  top: 50%;
  width: min(100%, 52rem);
  display: flex;
  flex-direction: column;
  border-radius: 1.7rem;
  overflow: hidden;
  background: var(--card-face);
  border: 1px solid color-mix(in srgb, var(--tone-a) 38%, #2a2a33);
  box-shadow:
    0 18px 40px rgba(0, 0, 0, 0.38),
    0 0 0 1px rgba(255, 255, 255, 0.04) inset;
  transform: translate(-50%, -50%);
  transform-origin: 70% 80%;
  transition:
    transform 0.7s cubic-bezier(0.22, 1, 0.36, 1),
    opacity 0.5s ease,
    filter 0.5s ease,
    box-shadow 0.5s ease;
  cursor: pointer;
  isolation: isolate;
  will-change: transform, opacity;
}

.story-card.is-active {
  cursor: default;
  z-index: 50;
  background: var(--card-face);
  box-shadow:
    0 22px 50px rgba(0, 0, 0, 0.42),
    0 0 28px color-mix(in srgb, var(--tone-a) 32%, transparent);
}

.story-card:not(.is-active) .card-meta,
.story-card:not(.is-active) .flip-hint {
  display: none;
}

.story-card:not(.is-active) a {
  pointer-events: none;
}

.story-card.is-away {
  opacity: 0;
  pointer-events: none;
}

.story-card-link {
  display: block;
  text-decoration: none;
  color: inherit;
}

.story-card .flip-stage {
  position: relative;
  aspect-ratio: 16 / 10;
  background: #111214;
  overflow: hidden;
}

.story-card .flip-frame {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.story-card .flip-hint {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 0.7rem 1rem;
  font-size: 1.15rem;
  font-weight: 600;
  color: #fff;
  background: linear-gradient(transparent, rgba(10, 10, 15, 0.72));
  opacity: 0;
  transition: opacity 0.25s ease;
}

.story-card.is-active:hover .flip-hint {
  opacity: 1;
}

.story-card .card-meta {
  padding: 1.15rem 1.25rem 1.3rem;
  position: relative;
  background: var(--card-face);
}

.story-card .card-meta::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(180deg, color-mix(in srgb, var(--tone-a) 14%, var(--card-face)), var(--card-face) 70%);
}

.story-card .badge {
  display: inline-block;
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 0.28rem 0.65rem;
  border-radius: 999px;
  margin-bottom: 0.45rem;
  background: color-mix(in srgb, var(--tone-a) 18%, transparent);
  color: var(--tone-a);
}

.story-card h3 {
  font-family: var(--font-display);
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  margin-bottom: 0.3rem;
  position: relative;
}

.story-card .card-meta p {
  color: var(--text-secondary);
  font-size: 1.25rem;
  position: relative;
}

.story-card .card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  margin-top: 0.95rem;
  position: relative;
}

.story-card .btn-open,
.story-card .btn-pdf {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.55rem 1.05rem;
  border-radius: 999px;
  font-size: 1.2rem;
  font-weight: 700;
  text-decoration: none;
}

.story-card .btn-open {
  background: color-mix(in srgb, var(--tone-a) 22%, #1c1c24);
  color: var(--tone-a);
}

.story-card .btn-pdf {
  background: linear-gradient(135deg, var(--tone-a), var(--tone-b));
  color: #fff;
  box-shadow: 0 6px 16px color-mix(in srgb, var(--tone-a) 32%, transparent);
}

.story-card--zaman {
  --tone-a: #e8a14a;
  --tone-b: #c45d2b;
  border-radius: 1.1rem 2.2rem;
}
.story-card--say {
  --tone-a: #f2c14e;
  --tone-b: #d97706;
}
.story-card--ev {
  --tone-a: #d4a574;
  --tone-b: #8b5e34;
  border-radius: 2.4rem 2.4rem 1.1rem 1.1rem;
}
.story-card--bilim {
  --tone-a: #7dd3fc;
  --tone-b: #1d4ed8;
  box-shadow: 0 0 0 1px rgba(125, 211, 252, 0.18), 0 18px 40px rgba(0, 0, 0, 0.38);
}
.story-card--hayvan {
  --tone-a: #86efac;
  --tone-b: #b45309;
  border-radius: 1.9rem;
}
.story-card--su {
  --tone-a: #22d3ee;
  --tone-b: #0e7490;
  border-radius: 2rem 2rem 3rem 3rem;
}
.story-card--gulumse {
  --tone-a: #fb7185;
  --tone-b: #fb923c;
  border-radius: 2.6rem 1.2rem 2.6rem 1.2rem;
}
.story-card--cicek {
  --tone-a: #e879f9;
  --tone-b: #65a30d;
  border-radius: 46% 16px 28px 18px;
}
.story-card--esik {
  --tone-a: #818cf8;
  --tone-b: #5b21b6;
  border-radius: 1.4rem;
}

.story-card--zaman .flip-stage { filter: saturate(1.08) contrast(1.04); }
.story-card--say .flip-stage { filter: saturate(0.92) sepia(0.12); }
.story-card--ev .flip-stage { filter: sepia(0.18) contrast(1.05); }
.story-card--bilim .flip-stage { filter: saturate(1.15) hue-rotate(-6deg); }
.story-card--hayvan .flip-stage { filter: saturate(1.12); }
.story-card--su .flip-stage { filter: saturate(1.2) contrast(1.04); }
.story-card--gulumse .flip-stage { filter: saturate(1.08) contrast(0.98); }
.story-card--cicek .flip-stage { filter: saturate(1.14); }
.story-card--esik .flip-stage { filter: saturate(0.95) contrast(1.08); }

.story-pager {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.85rem;
  margin-top: 1.8rem;
}

.story-dots {
  display: flex;
  gap: 0.45rem;
  flex-wrap: wrap;
  justify-content: center;
  max-width: 28rem;
}

.story-dot {
  width: 0.7rem;
  height: 0.7rem;
  border: 0;
  border-radius: 999px;
  padding: 0;
  background: rgba(255, 255, 255, 0.22);
  cursor: pointer;
}

.story-dot.is-on {
  width: 1.7rem;
  background: var(--story-a);
  box-shadow: 0 0 12px color-mix(in srgb, var(--story-a) 50%, transparent);
}

.story-count {
  font-size: 1.2rem;
  color: var(--text-muted);
  font-weight: 700;
  min-width: 4.5rem;
  text-align: center;
}

body.kitap-needs-auth .btn-open::after,
body.kitap-needs-auth .btn-pdf::after {
  content: " · giriş";
  font-weight: 700;
  opacity: 0.8;
  font-size: 0.78em;
}

[data-story-home] .btn-pdf {
  display: none !important;
}

[data-story-home] .btn-open::after {
  content: none;
}

@media (max-width: 800px) {
  .story-page {
    padding: 10rem 4% 4rem;
  }

  .story-stage {
    grid-template-columns: 1fr;
    gap: 1rem;
  }

  .story-nav {
    position: absolute;
    top: 38%;
    z-index: 9;
  }

  .story-nav--prev { left: 0; }
  .story-nav--next { right: 0; }

  .story-stack {
    height: min(62vh, 44rem);
    min-height: 36rem;
  }

  .story-card {
    width: min(92%, 40rem);
  }
}

@media (prefers-reduced-motion: reduce) {
  .story-page::before {
    animation: none;
  }

  .story-card {
    transition: none;
  }
}
