/* The Chronicle — the story index at /story.
 *
 * Rendered by views/story/storiesPage.jsx. A card is either a watchable scene
 * (poster, title, summary) or a locked placeholder that deliberately shows
 * nothing but its place in the order; the server withholds the rest, so there
 * is no "blur the text" trick here to defeat.
 *
 * Colours come from the app's theme tokens so the page follows light/dark like
 * every other page. The posters are the only saturated thing on it.
 */

.chronicle-page {
  max-width: 1180px;
  margin: 0 auto;
  padding: 28px 30px 44px;
  color: var(--text);
  /* The same parchment surface the card pages sit on. Without it the app's sky
     and grass show straight through the cards and the gold labels stop being
     readable. */
  background-color: var(--cloud-bg);
  background-image: var(--dirt-texture-url);
  background-repeat: repeat;
  border: 1px solid var(--surface-border);
  border-radius: 2px;
}

.chronicle-header h1 {
  font-family: "Cinzel", serif;
  font-size: clamp(1.4rem, 3vw, 2rem);
  margin: 0 0 8px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.chronicle-header h1 i {
  color: #c8960c;
}

.chronicle-intro {
  margin: 0 0 6px;
  max-width: 62ch;
  opacity: 0.8;
  line-height: 1.5;
}

.chronicle-count {
  margin: 0 0 24px;
  font-family: "Cinzel", serif;
  font-size: 0.8rem;
  letter-spacing: 0.08em;
  /* --papyrus-text, not the gold accent: gold is a dark-theme colour and sits at
     about 2.5:1 on the light parchment this page uses. The token is #3d2000 on
     light and #c8a060 on dark, so it reads in both. */
  color: var(--papyrus-text);
}

.chronicle-grid {
  display: grid;
  /* auto-fill, not auto-fit: with a handful of cards auto-fit stretches them to
     billboard width and the posters lose their 16:9 framing. */
  grid-template-columns: repeat(auto-fill, minmax(248px, 1fr));
  gap: 18px;
}

.chronicle-card {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--surface-border);
  border-radius: 3px;
  overflow: hidden;
  background: rgba(0, 0, 0, 0.16);
  text-decoration: none;
  color: inherit;
  transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
}

a.chronicle-card:hover {
  transform: translateY(-3px);
  border-color: #c8960c;
  box-shadow: 0 10px 26px rgba(0, 0, 0, 0.32);
}

a.chronicle-card:focus-visible {
  outline: 2px solid #e6ce6a;
  outline-offset: 3px;
}

.chronicle-poster {
  position: relative;
  aspect-ratio: 16 / 9;
  background-color: #1b2620;
  background-size: cover;
  background-position: center;
  display: flex;
  align-items: center;
  justify-content: center;
}

.chronicle-play,
.chronicle-lock {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.45);
  background: rgba(10, 18, 14, 0.62);
  color: #f2ead4;
  backdrop-filter: blur(4px);
  transition: transform 0.18s ease, background 0.18s ease;
}

.chronicle-play {
  /* Nudged right so the triangle reads as centred inside the circle. */
  padding-left: 3px;
}

a.chronicle-card:hover .chronicle-play {
  transform: scale(1.08);
  background: rgba(200, 150, 12, 0.85);
}

.chronicle-duration {
  position: absolute;
  right: 8px;
  bottom: 8px;
  padding: 2px 7px;
  border-radius: 2px;
  background: rgba(8, 14, 11, 0.74);
  color: #e7e2d2;
  font-size: 0.7rem;
  font-variant-numeric: tabular-nums;
}

.chronicle-body {
  padding: 12px 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 5px;
  flex: 1;
}

.chronicle-label {
  margin: 0;
  font-family: "Cinzel", serif;
  font-size: 0.66rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--papyrus-text);
  opacity: 0.72;
}

.chronicle-title {
  margin: 0;
  font-family: "Cinzel", serif;
  font-size: 1rem;
  line-height: 1.25;
}

.chronicle-summary {
  margin: 0;
  font-size: 0.83rem;
  line-height: 1.45;
  opacity: 0.78;
}

/* ── Locked ───────────────────────────────────────────────────────────────
   Dimmed rather than hidden: the shape of what is still to come is part of
   wanting to play on. Only the poster is dimmed — fading the whole card took
   the unlock hint with it, which is the one thing a locked card exists to say. */
.chronicle-locked {
  cursor: default;
}

.chronicle-locked .chronicle-poster {
  opacity: 0.5;
}

.chronicle-locked .chronicle-poster {
  background-image: repeating-linear-gradient(
    135deg,
    rgba(255, 255, 255, 0.03) 0 10px,
    transparent 10px 20px
  );
}

.chronicle-title-locked {
  font-style: italic;
  opacity: 0.75;
}

.chronicle-hint {
  color: var(--papyrus-text);
  opacity: 1;
  font-size: 0.78rem;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.chronicle-footer {
  margin-top: 28px;
}

.chronicle-back {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  border: 1px solid var(--surface-border);
  border-radius: 2px;
  color: var(--text);
  text-decoration: none;
  font-family: "Cinzel", serif;
  font-size: 0.85rem;
}

.chronicle-back:hover {
  border-color: #c8960c;
  color: #e6ce6a;
}

@media (max-width: 560px) {
  .chronicle-grid {
    grid-template-columns: 1fr;
  }

  .chronicle-page {
    padding: 18px 14px 36px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .chronicle-card,
  .chronicle-play {
    transition: none;
  }

  a.chronicle-card:hover {
    transform: none;
  }
}
