/* Scroll & Stone - story-essays player styles.
   Full-viewport card stepper (Instagram Stories grammar).
   House palette: vellum/ink for text cards, full-bleed image + legible overlay for image cards.
   Gold progress segments. */

/* ── Stage / host ─────────────────────────────────────────── */
.story-stage {
  position: fixed;
  inset: 0;
  background: var(--night);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.story-stage__inner {
  display: flex;
  flex-direction: column;
  height: 100%;
  outline: none; /* keyboard ring shown via :focus-visible only */
}

.story-stage__inner:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: -2px;
}

/* ── Header (title + progress bar) ──────────────────────────── */
.story-header {
  position: relative;
  z-index: 10;
  padding: calc(env(safe-area-inset-top, 0px) + 0.8rem) 1rem 0.6rem;
  background: linear-gradient(to bottom, rgba(19, 28, 56, 0.85) 0%, transparent 100%);
  flex-shrink: 0;
}

.story-title {
  font-family: var(--utility);
  font-size: 0.7rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--vellum);
  opacity: 0.75;
  margin-bottom: 0.5rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ── Progress bar ─────────────────────────────────────────── */
.story-progress {
  display: flex;
  gap: 0.25rem;
  list-style: none;
}

.story-progress__seg {
  flex: 1;
  height: 3px;
  border-radius: 2px;
  background: rgba(199, 162, 75, 0.28); /* gold, dim */
  transition: background 0.2s;
}

.story-progress__seg--done {
  background: var(--gold);
}

.story-progress__seg--active {
  background: var(--gold-soft);
}

/* ── Card viewport ────────────────────────────────────────── */
.story-viewport {
  flex: 1;
  position: relative;
  min-height: 0;
}

/* ── Individual card ──────────────────────────────────────── */
.story-card {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  background: var(--night);
}

/* Image card: image fills card, panel overlays bottom */
.story-card__img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
}

.story-card__panel {
  position: absolute;
  inset: auto 0 0 0;
  padding: 1.6rem 1.2rem calc(1.8rem + env(safe-area-inset-bottom, 0px));
  background: var(--vellum);
  color: var(--ink);
}

.story-card__panel--over-image {
  background: linear-gradient(to top,
    rgba(19, 28, 56, 0.93) 0%,
    rgba(19, 28, 56, 0.80) 60%,
    transparent 100%);
  color: var(--vellum);
}

.story-card__panel::before {
  content: "";
  display: block;
  width: 40px;
  height: 3px;
  background: var(--gold);
  margin-bottom: 0.75rem;
}

.story-card__text {
  font-family: var(--body);
  font-size: clamp(1.05rem, 3vw, 1.35rem);
  line-height: 1.5;
  max-width: 58ch;
}

/* Text-only card: panel fills full height with vellum */
.story-card:not(:has(.story-card__img)) .story-card__panel {
  position: relative;
  inset: unset;
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 2.5rem 1.4rem calc(2rem + env(safe-area-inset-bottom, 0px));
  background: var(--vellum);
  color: var(--ink);
}

/* ── Hit-zones (invisible tap areas) ─────────────────────── */
.story-hitzones {
  position: absolute;
  inset: 0;
  display: flex;
  pointer-events: none; /* children opt in */
  z-index: 5;
}

.story-hitzone {
  flex: 1;
  pointer-events: auto;
  cursor: pointer;
}

/* ── Screen-reader nav buttons (visually hidden) ─────────── */
.story-btn {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
  background: transparent;
}

/* ── Overlay mode (story launched from feed card) ─────────── */
.story-stage--overlay {
  position: fixed;
  inset: 0;
  z-index: 9000;
}

/* ── Close button (overlay only) ─────────────────────────── */
.story-close {
  position: absolute;
  top: calc(env(safe-area-inset-top, 0px) + 0.7rem);
  right: 1rem;
  z-index: 20;
  width: 2.2rem;
  height: 2.2rem;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: rgba(19, 28, 56, 0.55);
  color: var(--vellum);
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.story-close:hover,
.story-close:focus-visible {
  background: rgba(19, 28, 56, 0.85);
  outline: 2px solid var(--gold);
  outline-offset: 1px;
}

/* ── Gated "not open yet" panel ──────────────────────────── */
.story-gated {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100dvh;
  padding: 2rem;
  text-align: center;
  color: var(--vellum);
}

.story-gated__icon {
  font-size: 2rem;
  color: var(--gold);
  margin-bottom: 1rem;
  line-height: 1;
}

.story-gated__heading {
  font-family: var(--display);
  font-size: 1.6rem;
  font-weight: 400;
  margin-bottom: 0.6rem;
}

.story-gated__body {
  font-family: var(--body);
  font-size: 1rem;
  color: rgba(245, 237, 223, 0.65);
}
