/* QuizTheme /stories — hub (stories_index.html) and player (story_view.html, story-player.js). */

:root {
  --story-accent: #b3134f;
  --story-accent-2: #8c0f3e;
  --story-ink: #1c1418;
  --story-text: #2e2a2c;
  --story-pill-bg: #fde3ec;
  --story-card: #fff7fa;
  --story-serif: 'Lora', Georgia, 'Times New Roman', serif;
}

/* ── Player stage ─────────────────────────────────────────────────────────── */
.story-stage { position: relative; overflow: hidden; padding: 28px 0 34px; background: #f3e9ec; }
.story-stage__bg {
  position: absolute; inset: -40px; background-size: cover; background-position: center;
  filter: blur(28px) saturate(.9) brightness(1.08); opacity: .55; transform: scale(1.05);
  transition: background-image .4s ease;
}
.story-stage::after { content: ''; position: absolute; inset: 0; background: rgba(255, 255, 255, .35); pointer-events: none; }
.story-container { position: relative; z-index: 1; max-width: 1240px; margin: 0 auto; padding: 0 16px; }

.story-top-ad { display: flex; justify-content: center; margin: 0 auto 18px; min-height: 50px; }
.story-top-ad:empty { display: none; }

.story-player {
  position: relative; background: #fff; border-radius: 22px; overflow: hidden;
  box-shadow: 0 18px 50px rgba(80, 20, 40, .18), 0 0 0 1px rgba(255, 255, 255, .7);
  touch-action: pan-y;
}

.story-slide { display: none; }
.story-slide.is-active { display: grid; animation: story-in .35s ease both; }
.story-slide.is-active.from-left { animation-name: story-in-left; }
@keyframes story-in { from { opacity: 0; transform: translateX(24px); } to { opacity: 1; transform: none; } }
@keyframes story-in-left { from { opacity: 0; transform: translateX(-24px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .story-slide.is-active { animation: none; } }

/* Story slide: image left, text right (desktop) */
.story-slide[data-kind="story"] { grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); min-height: 560px; }
.story-media { position: relative; background: #eadde2; min-height: 260px; }
.story-media img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.story-text {
  position: relative; padding: 34px 44px 34px 40px; display: flex; flex-direction: column; justify-content: center;
  background: linear-gradient(160deg, #fff 0%, var(--story-card) 60%, #fbeef4 100%);
}
@media (min-width: 900px) {
  /* The slanted edge between photo and text, like the reference design. */
  .story-text::before {
    content: ''; position: absolute; top: 0; bottom: 0; left: -60px; width: 90px;
    background: linear-gradient(160deg, #fff 0%, var(--story-card) 100%);
    clip-path: polygon(66% 0, 100% 0, 100% 100%, 0 100%);
  }
  .story-text > * { position: relative; }
}

.story-pill {
  align-self: flex-start; display: inline-flex; align-items: center; gap: 8px;
  background: var(--story-pill-bg); color: var(--story-accent); font-weight: 600; font-size: 15px;
  padding: 6px 16px; border-radius: 999px; margin-bottom: 18px;
}
.story-part { font-size: 13px; font-weight: 700; letter-spacing: .6px; text-transform: uppercase; color: var(--story-accent); margin-bottom: 10px; }
.story-headline {
  font-family: var(--story-serif); font-weight: 700; color: var(--story-ink);
  font-size: clamp(24px, 2.6vw, 38px); line-height: 1.18; margin: 0 0 20px;
  border-left: 4px solid var(--story-accent); padding-left: 16px;
}
.story-headline--sm { font-size: clamp(22px, 2.1vw, 30px); }
.story-highlight { color: var(--story-accent); font-weight: 600; font-size: clamp(17px, 1.45vw, 21px); line-height: 1.4; margin: 0 0 12px; }
.story-body { color: var(--story-text); font-size: 18.5px; line-height: 1.55; margin: 0 0 12px; }
.story-cta {
  align-self: center; margin-top: 14px; display: inline-flex; align-items: center; gap: 12px; cursor: pointer;
  border: 0; border-radius: 999px; padding: 13px 34px; font-family: inherit; font-weight: 600; font-size: 18px; line-height: 1.2; color: #fff;
  background: linear-gradient(180deg, var(--story-accent) 0%, var(--story-accent-2) 100%);
  box-shadow: 0 8px 20px rgba(140, 15, 62, .3); text-decoration: none; transition: transform .15s ease, box-shadow .15s ease;
}
.story-cta:hover { transform: translateY(-1px); box-shadow: 0 10px 24px rgba(140, 15, 62, .38); }

/* Ad slide */
.story-slide--ad.is-active, .story-slide--end.is-active { display: flex; }
/* Ad + end slides are requested before the reader gets there: keep them laid
   out but invisible (not display:none) so GPT can render and size the creative. */
.story-slide--ad:not(.is-active), .story-slide--end:not(.is-active) {
  display: flex; position: absolute; left: 0; right: 0; top: 0; visibility: hidden; pointer-events: none; z-index: -1;
}
.story-slide--ad { min-height: 560px; align-items: center; justify-content: center; background: #faf6f8; }
.story-ad { display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 24px 12px; max-width: 100%; }
.story-ad__label { font-size: 11px; letter-spacing: 1.2px; text-transform: uppercase; color: #8a7f84; }
.story-ad__slot { min-width: 300px; min-height: 250px; display: flex; align-items: center; justify-content: center; }
.story-ad__wait { font-size: 13px; color: #8a7f84; }

/* End card */
.story-slide--end { min-height: 560px; align-items: center; justify-content: center; background: linear-gradient(160deg, #fff, var(--story-card)); }
.story-end { width: 100%; max-width: 860px; padding: 36px 24px; text-align: center; }
.story-end__title { font-family: var(--story-serif); font-size: 38px; color: var(--story-ink); margin: 0 0 6px; }
.story-end__sub { color: var(--story-text); font-size: 17px; margin: 0 0 18px; }
.story-share { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin-bottom: 22px; }
.story-share__btn {
  border: 1.5px solid #e9c8d5; background: #fff; color: var(--story-ink); border-radius: 999px; padding: 9px 18px;
  font-family: inherit; font-weight: 600; font-size: 14px; line-height: 1; cursor: pointer; text-decoration: none;
}
.story-share__btn:hover { border-color: var(--story-accent); color: var(--story-accent); }
.story-share__btn--wa { background: #25d366; border-color: #25d366; color: #fff; }
.story-share__btn--fb { background: #1877f2; border-color: #1877f2; color: #fff; }
.story-share__btn--wa:hover, .story-share__btn--fb:hover { color: #fff; opacity: .9; }
.story-end__ad { display: flex; justify-content: center; margin: 0 0 22px; }
.story-end__grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; text-align: left; }
.story-mini { display: block; border-radius: 12px; overflow: hidden; background: #fff; box-shadow: 0 4px 14px rgba(80, 20, 40, .1); text-decoration: none; }
.story-mini img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; display: block; }
.story-mini span {
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
  padding: 8px 10px 10px; font: 600 13.5px/1.35 var(--story-serif); color: var(--story-ink);
}

/* Navigation */
.story-nav { display: flex; align-items: center; justify-content: center; gap: clamp(40px, 22vw, 480px); margin-top: 20px; }
.story-nav__btn {
  width: 60px; height: 60px; border-radius: 50%; border: 0; cursor: pointer; display: flex; align-items: center; justify-content: center;
  background: #fbd3e1; color: var(--story-accent); box-shadow: 0 6px 16px rgba(140, 15, 62, .18); transition: transform .15s ease, opacity .15s;
}
.story-nav__btn:hover:not(:disabled) { transform: scale(1.06); }
.story-nav__btn:disabled { opacity: .4; cursor: default; }
.story-nav__btn.is-waiting { opacity: .55; cursor: progress; }
.story-nav__mid { display: flex; flex-direction: column; align-items: center; gap: 10px; }
.story-nav__count { font-size: 18px; font-weight: 500; color: var(--story-ink); min-width: 70px; text-align: center; }
.story-nav__dots { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; max-width: 320px; }
.story-dot { width: 14px; height: 14px; border-radius: 50%; border: 0; padding: 0; background: #e6dde1; cursor: pointer; }
.story-dot.is-on { background: var(--story-accent); }

/* ── Mobile: image on top, text below ─────────────────────────────────────── */
@media (max-width: 899px) {
  .story-stage { padding: 12px 0 22px; }
  .story-container { padding: 0 10px; }
  .story-player { border-radius: 16px; }
  .story-slide[data-kind="story"] { grid-template-columns: 1fr; min-height: 0; }
  .story-media { aspect-ratio: 4 / 3; min-height: 0; }
  .story-text { padding: 20px 18px 22px; }
  .story-pill { font-size: 13px; margin-bottom: 12px; }
  .story-headline { margin-bottom: 14px; padding-left: 12px; }
  .story-body { font-size: 16px; }
  .story-cta { font-size: 16px; padding: 12px 24px; }
  .story-slide--ad, .story-slide--end { min-height: 420px; }
  .story-end__grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .story-end__title { font-size: 30px; }
  .story-nav { gap: 24px; margin-top: 14px; }
  .story-nav__btn { width: 50px; height: 50px; }
  .story-dot { width: 11px; height: 11px; }
  .story-nav__dots { gap: 8px; }
}

/* ── Hub + cards ──────────────────────────────────────────────────────────── */
.story-hub, .story-more { padding: 30px 0 40px; }
.story-hub .section-title, .story-more .section-title { margin-top: 34px; }
.story-empty { text-align: center; padding: 60px 0; color: #777; font-size: 17px; }

.story-lead {
  display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); border-radius: 22px; overflow: hidden;
  background: #fff; box-shadow: 0 14px 40px rgba(80, 20, 40, .14); text-decoration: none;
}
.story-lead__img { position: relative; min-height: 340px; background: #eadde2; }
.story-lead__img img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.story-lead__text { padding: 34px 40px; display: flex; flex-direction: column; justify-content: center; background: linear-gradient(160deg, #fff, var(--story-card)); }
.story-lead .story-cta { align-self: flex-start; }
@media (max-width: 899px) {
  .story-lead { grid-template-columns: 1fr; }
  .story-lead__img { min-height: 0; aspect-ratio: 4 / 3; }
  .story-lead__text { padding: 20px 18px 24px; }
}

.story-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 20px; margin-top: 18px; }
.story-card {
  display: flex; flex-direction: column; border-radius: 16px; overflow: hidden; background: #fff; text-decoration: none;
  box-shadow: 0 6px 20px rgba(80, 20, 40, .1); transition: transform .15s ease, box-shadow .15s ease;
}
.story-card:hover { transform: translateY(-3px); box-shadow: 0 12px 28px rgba(80, 20, 40, .16); }
.story-card__img { position: relative; aspect-ratio: 4 / 3; background: #eadde2; }
.story-card__img img { width: 100%; height: 100%; object-fit: cover; display: block; }
.story-card__pill {
  position: absolute; left: 12px; top: 12px; background: rgba(255, 255, 255, .92); color: var(--story-accent);
  font-size: 12px; font-weight: 700; padding: 4px 10px; border-radius: 999px;
}
.story-card__body { padding: 14px 16px 16px; display: flex; flex-direction: column; flex: 1; }
.story-card__body h3 { font: 700 18px/1.3 var(--story-serif); color: var(--story-ink); margin: 0 0 8px; }
.story-card__body p {
  color: #5a5256; font-size: 14px; line-height: 1.5; margin: 0 0 12px;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}
.story-card__cta { margin-top: auto; color: var(--story-accent); font-weight: 700; font-size: 14px; }

/* Home page row */
.stories-home-section { padding: 10px 0 30px; }
.stories-home-section .story-grid { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
.stories-home-more { text-align: center; margin-top: 18px; }
.stories-home-more a { color: var(--story-accent); font-weight: 700; text-decoration: none; }
