/*
  The Bible's stories as a film (public/story-film.js; owner, 2026-11-01:
  "the text should be like subtitles with supporting images slideshow",
  "also it should be fullscreen-able"). The painting fills a 16:9 frame and
  drifts while it stands; the words sit low in the frame in the house's
  serif, cream on a deepened ground; the title stands over the painting
  until the first words; the doors are the house's gold on ink.
*/
.sf {
  --sf-gold: #d8b86a;
  --sf-gold-deep: #c99b45;
  --sf-cream: #fbf3df;
  --sf-ink: rgba(8, 10, 12, 0.62);
  position: relative;
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  isolation: isolate;
  border-radius: 6px;
  background: #050708;
  color: var(--sf-cream);
  font-family: 'Cormorant Garamond', Georgia, 'Times New Roman', serif;
  -webkit-tap-highlight-color: transparent;
  outline: none;
}
@supports not (aspect-ratio: 16 / 9) {
  .sf { height: 0; padding-top: 56.25%; }
}
.sf-stage { position: absolute; inset: 0; cursor: pointer; }
.sf-art {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  transition: opacity 1.3s ease;
  transform-origin: 50% 50%;
  animation-timing-function: cubic-bezier(0.3, 0, 0.7, 1);
  animation-fill-mode: both;
  will-change: transform, opacity;
  user-select: none;
  -webkit-user-select: none;
}
.sf-art.is-in { opacity: 1; }
.sf-drift--0 { animation-name: sf-drift-0; }
.sf-drift--1 { animation-name: sf-drift-1; }
.sf-drift--2 { animation-name: sf-drift-2; }
.sf-drift--3 { animation-name: sf-drift-3; }
.sf-drift--back { animation-name: sf-drift-back; }
@keyframes sf-drift-0 { from { transform: scale(1.03) translate(0, 0); } to { transform: scale(1.12) translate(-1.6%, -1%); } }
@keyframes sf-drift-1 { from { transform: scale(1.12) translate(1.6%, 0.8%); } to { transform: scale(1.04) translate(-0.8%, 0); } }
@keyframes sf-drift-2 { from { transform: scale(1.07) translate(-2.2%, 0.8%); } to { transform: scale(1.1) translate(2%, -0.6%); } }
@keyframes sf-drift-3 { from { transform: scale(1.1) translate(2%, -1%); } to { transform: scale(1.05) translate(-1.6%, 0.6%); } }
@keyframes sf-drift-back { from { transform: scale(1.14); } to { transform: scale(1.02); } }
.sf:not(.is-playing) .sf-art { animation-play-state: paused; }

.sf-shade {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(to top, rgba(5, 7, 8, 0.9) 0%, rgba(5, 7, 8, 0.58) 24%, rgba(5, 7, 8, 0) 50%),
    radial-gradient(ellipse at 50% 45%, rgba(5, 7, 8, 0) 58%, rgba(5, 7, 8, 0.38) 100%);
}

/* The title, over the painting until the story's first words. */
.sf-title {
  position: absolute;
  left: 6%;
  right: 6%;
  bottom: 54px;
  margin: 0;
  text-align: center;
  pointer-events: none;
  opacity: 0;
  transform: translateY(6px);
  transition: opacity 0.9s ease, transform 0.9s ease;
}
.sf.is-titled .sf-title { opacity: 1; transform: none; }
/* The title gives way at once to the first words, so the two never stand together. */
.sf:not(.is-titled) .sf-title { transition-duration: 0.25s; }
.sf.is-titled .sf-sub { opacity: 0; }
.sf-title p { margin: 0; text-shadow: 0 1px 2px rgba(0, 0, 0, 0.95), 0 0 12px rgba(0, 0, 0, 0.85), 0 0 26px rgba(0, 0, 0, 0.6); }
.sf-title__chapter {
  font-family: 'Cinzel', Georgia, serif;
  font-size: 12px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: #ecd28f;
}
.sf-title__words {
  margin-top: 4px !important;
  font-size: clamp(22px, 4.4vw, 44px);
  font-weight: 400;
  line-height: 1.08;
  color: var(--sf-cream);
}
.sf-title__where {
  margin-top: 4px !important;
  font-size: clamp(13px, 1.7vw, 17px);
  font-style: italic;
  color: #eadbb6;
}

/* The words, as the narrator says them. */
.sf-sub {
  position: absolute;
  left: 50%;
  bottom: 54px;
  width: max-content;
  max-width: 88%;
  margin: 0;
  transform: translateX(-50%);
  text-align: center;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.22s ease;
}
.sf-sub.is-on { opacity: 1; }
.sf-sub__words {
  display: block;
  font-size: clamp(15px, 2.15vw, 25px);
  font-weight: 400;
  line-height: 1.3;
  color: var(--sf-cream);
  text-wrap: balance;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.95), 0 0 14px rgba(0, 0, 0, 0.75);
}
.sf-sub.is-verse .sf-sub__words { font-style: italic; color: #f5e3b0; }
.sf-sub__cite {
  display: block;
  margin-top: 5px;
  font-family: 'Cinzel', Georgia, serif;
  font-size: 11px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--sf-gold);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.9);
}
.sf-sub__cite:empty { display: none; }

/* The first door: one press, and the story begins. */
.sf-begin {
  position: absolute;
  left: 50%;
  top: 38%;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 46px;
  padding: 10px 20px 10px 14px;
  border: 1px solid rgba(216, 184, 106, 0.9);
  border-radius: 999px;
  background: rgba(8, 10, 12, 0.58);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  color: #f6e7bf;
  font-family: 'Cinzel', Georgia, serif;
  font-size: 13px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  white-space: nowrap;
  cursor: pointer;
  transform: translate(-50%, -50%);
  transition: opacity 0.35s ease, background-color 0.2s ease, border-color 0.2s ease;
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.35);
}
.sf-begin svg { width: 22px; height: 22px; color: var(--sf-gold); flex: none; }
.sf-begin:hover { background: rgba(8, 10, 12, 0.74); border-color: #f0d590; }
.sf-begin__length {
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-size: 15px;
  font-style: italic;
  letter-spacing: 0;
  text-transform: none;
  color: #eadbb6;
}
.sf.is-started .sf-begin { opacity: 0; pointer-events: none; }

/* The end of a story the reader is not carried on from. */
.sf-end {
  position: absolute;
  left: 50%;
  top: 40%;
  display: none;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  width: 90%;
  transform: translate(-50%, -50%);
}
.sf.is-ended .sf-end { display: flex; }
.sf-end button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  padding: 9px 18px;
  border-radius: 999px;
  font-family: 'Cinzel', Georgia, serif;
  font-size: 12px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  cursor: pointer;
}
.sf-end button[hidden] { display: none; }
.sf-end svg { width: 18px; height: 18px; }
.sf-end__again { border: 1px solid rgba(234, 219, 182, 0.55); background: rgba(8, 10, 12, 0.62); color: #f1e3c0; }
.sf-end__next { border: 1px solid #f0d590; background: linear-gradient(180deg, #e2c27a, #b98d3e); color: #1b1712; box-shadow: 0 6px 22px rgba(0, 0, 0, 0.35); }
.sf-end__kicker { opacity: 0.8; }
.sf-end__title { font-family: 'Cormorant Garamond', Georgia, serif; font-size: 16px; font-weight: 600; letter-spacing: 0; text-transform: none; }

/* The doors along the bottom: shown while the film stands, and at a touch while it plays. */
.sf-bar {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 0 8px 4px;
  background: linear-gradient(to top, rgba(5, 7, 8, 0.7), rgba(5, 7, 8, 0));
  opacity: 0;
  transition: opacity 0.3s ease;
}
.sf.is-awake .sf-bar,
.sf:not(.is-playing) .sf-bar,
.sf:focus-within .sf-bar { opacity: 1; }
.sf.is-playing:not(.is-awake):not(:focus-within) .sf-bar { pointer-events: none; }
.sf-track { position: relative; height: 16px; margin: 0 6px; cursor: pointer; touch-action: none; outline: none; }
.sf-track::before,
.sf-track__fill { position: absolute; left: 0; top: 7px; height: 3px; border-radius: 2px; }
.sf-track::before { content: ''; right: 0; background: rgba(251, 243, 223, 0.28); }
.sf-track__fill { width: 0; background: var(--sf-gold); }
.sf-track__knob {
  position: absolute;
  top: 3px;
  left: 0;
  width: 11px;
  height: 11px;
  margin-left: -5.5px;
  border-radius: 50%;
  background: #f0d590;
  box-shadow: 0 0 0 3px rgba(5, 7, 8, 0.45);
  transform: scale(0);
  transition: transform 0.15s ease;
}
.sf-track:hover .sf-track__knob,
.sf-track:focus-visible .sf-track__knob { transform: none; }
.sf-track:focus-visible::before { box-shadow: 0 0 0 2px var(--sf-gold); }
.sf-row { display: flex; align-items: center; gap: 2px; height: 36px; }
.sf-tool {
  display: inline-grid;
  place-items: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: #f1e3c0;
  cursor: pointer;
  transition: background-color 0.2s ease, color 0.2s ease;
}
.sf-tool svg { width: 20px; height: 20px; }
.sf-tool:hover { background: rgba(251, 243, 223, 0.12); color: #fff6dc; }
.sf-tool:disabled { opacity: 0.35; cursor: default; background: transparent; }
.sf-tool:focus-visible,
.sf-begin:focus-visible,
.sf-end button:focus-visible { outline: 2px solid var(--sf-gold); outline-offset: 2px; }
.sf-time {
  margin-left: 6px;
  font-size: 14px;
  font-variant-numeric: tabular-nums lining-nums;
  color: #e9dcbc;
  white-space: nowrap;
}
.sf-gap { flex: 1; }

/* The whole screen, or on a phone that will not lend it, the whole window. */
.sf.is-full {
  width: 100vw;
  height: 100vh;
  border-radius: 0;
  aspect-ratio: auto;
}
.sf.is-theater {
  position: fixed;
  inset: 0;
  z-index: 2147483000;
  height: 100vh;
  height: 100dvh;
  padding-top: 0;
}
html.sf-theater,
html.sf-theater body { overflow: hidden !important; }
.sf:fullscreen { width: 100vw; height: 100vh; border-radius: 0; aspect-ratio: auto; }
.sf.is-full .sf-title { bottom: 11vh; }
.sf.is-full .sf-sub { bottom: 10vh; max-width: 80%; }
.sf.is-full .sf-sub__words { font-size: clamp(20px, 2.7vw, 40px); }
.sf.is-full .sf-sub__cite,
.sf.is-full .sf-title__chapter { font-size: clamp(11px, 1.1vw, 15px); }
.sf.is-full .sf-title__words { font-size: clamp(30px, 4.6vw, 68px); }
.sf.is-full .sf-title__where { font-size: clamp(15px, 1.6vw, 22px); }
.sf.is-full .sf-bar { padding: 0 max(14px, env(safe-area-inset-right)) max(10px, env(safe-area-inset-bottom)) max(14px, env(safe-area-inset-left)); }
.sf.is-full .sf-row { height: 46px; gap: 6px; }
.sf.is-full .sf-tool { width: 44px; height: 44px; }
.sf.is-full .sf-tool svg { width: 24px; height: 24px; }
.sf.is-full.is-playing:not(.is-awake) { cursor: none; }
.sf.is-full.is-playing:not(.is-awake) .sf-stage { cursor: none; }
@media (orientation: portrait) {
  /* A phone held upright keeps the whole painting, with the words beneath it. */
  .sf.is-full .sf-art { object-fit: contain; }
  .sf.is-full .sf-sub { bottom: 14vh; }
  .sf.is-full .sf-title { bottom: 15vh; }
}

/*
  A phone's frame is small: the painting stands whole, and the title and the
  words sit in a band of their own beneath it, never over it.
*/
@media (max-width: 520px) {
  .sf:not(.is-full) { height: auto; aspect-ratio: auto; padding: 0 0 78px; }
  .sf:not(.is-full) .sf-stage { position: relative; inset: auto; height: 0; padding-top: 56.25%; }
  .sf:not(.is-full) .sf-shade { bottom: 78px; background: radial-gradient(ellipse at 50% 45%, rgba(5, 7, 8, 0) 60%, rgba(5, 7, 8, 0.32) 100%), linear-gradient(to top, rgba(5, 7, 8, 0.55) 0%, rgba(5, 7, 8, 0) 30%); }
  .sf:not(.is-full) .sf-bar { bottom: 78px; }
  .sf:not(.is-full) .sf-title,
  .sf:not(.is-full) .sf-sub {
    top: auto;
    bottom: 0;
    left: 0;
    right: 0;
    width: auto;
    max-width: none;
    height: 78px;
    padding: 0 14px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    transform: none;
  }
  .sf:not(.is-full) .sf-title p,
  .sf:not(.is-full) .sf-sub__words,
  .sf:not(.is-full) .sf-sub__cite { text-shadow: none; }
  .sf:not(.is-full) .sf-title__chapter { font-size: 10px; letter-spacing: 0.2em; }
  .sf:not(.is-full) .sf-title__words { margin-top: 3px !important; font-size: 21px; }
  .sf:not(.is-full) .sf-title__where { margin-top: 2px !important; font-size: 13px; }
  .sf:not(.is-full) .sf-sub__words { font-size: 16px; line-height: 1.28; }
  .sf:not(.is-full) .sf-sub__cite { font-size: 10px; margin-top: 3px; }
  .sf:not(.is-full) .sf-begin,
  .sf:not(.is-full) .sf-end { top: calc((100% - 78px) / 2); }
  .sf-begin { min-height: 44px; padding: 8px 16px 8px 12px; font-size: 12px; }
  .sf-time { font-size: 13px; margin-left: 2px; }
  .sf-row { height: 34px; }
  .sf-tool { width: 34px; height: 34px; }
  .sf:not(.is-full) .sf-tool--back,
  .sf:not(.is-full) .sf-tool--next { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .sf-art { animation: none !important; transform: none !important; transition: opacity 0.6s ease; }
  .sf-title { transition: opacity 0.4s ease; transform: none; }
}
@media (forced-colors: active) {
  .sf-tool, .sf-begin, .sf-end button { border: 1px solid ButtonText; color: ButtonText; background: ButtonFace; }
  .sf-sub__words, .sf-title p { color: CanvasText; }
}
