/* Second landing screen: a carousel of short reader videos. */
.features {
  --frame: #14231b;
  --panel: #1a2d23;
  --line: rgba(248, 243, 232, .14);
  position: relative;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100dvh;
  color: var(--ivory);
  background:
    radial-gradient(120% 80% at 50% 0%, rgba(83, 124, 100, .35), transparent 60%),
    linear-gradient(180deg, #20362b, var(--frame) 70%);
}
.features-head {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: max(22px, env(safe-area-inset-top)) max(var(--gutter), env(safe-area-inset-right)) 0 max(var(--gutter), env(safe-area-inset-left));
}
.features-back {
  align-self: flex-start;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  color: var(--muted);
  font-size: 12px;
  text-decoration: none;
}
.features-back:hover { color: var(--ivory); }
.features-title { margin: 0; font: inherit; font-size: clamp(26px, 3.4vw, 44px); line-height: 1.2; letter-spacing: -.03em; }
.features-lede { margin: 0; max-width: 520px; color: var(--muted); font-size: 15px; line-height: 1.6; }

.carousel {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding: 24px 0 8px;
  min-height: 0;
}
/* Desktop: the frame takes the height left between the heading and the caption. */
.carousel-viewport {
  position: relative;
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: 56px minmax(0, 1fr) 56px;
  align-items: stretch;
  padding: 0 max(calc(var(--gutter) - 56px), env(safe-area-inset-right)) 0 max(calc(var(--gutter) - 56px), env(safe-area-inset-left));
}
.carousel-track {
  display: flex;
  height: 100%;
  margin: 0;
  padding: 0;
  list-style: none;
  overflow-x: auto;
  overflow-y: hidden;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-x: contain;
}
.carousel-track::-webkit-scrollbar { display: none; }
.feature {
  flex: 0 0 100%;
  width: 100%;
  height: 100%;
  scroll-snap-align: center;
  scroll-snap-stop: always;
  padding: 0 4px;
}
.feature-figure { margin: 0; height: 100%; display: flex; flex-direction: column; gap: 16px; align-items: center; }
.feature-media {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  width: auto;
  max-width: min(100%, 980px);
  margin: 0 auto;
  aspect-ratio: 16 / 10;
  container-type: inline-size;
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
  background: var(--panel);
  box-shadow: 0 30px 80px rgba(0, 0, 0, .35);
  transform: scale(.96);
  opacity: .55;
  transition: transform .5s cubic-bezier(.2, .7, .2, 1), opacity .5s ease;
}
.feature.is-active .feature-media { transform: none; opacity: 1; }
.feature-video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: transparent;
}
.feature-media[data-video="missing"] .feature-video { display: none; }
.feature-media[data-video="ready"] .feature-placeholder { display: none; }
.feature-placeholder {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 1em;
  padding: 8% 10%;
  font-size: clamp(9px, 2.3cqw, 20px);
  line-height: 1.7;
  background: linear-gradient(160deg, #f4f2ed, #e9e6dd);
  color: #1e1d1b;
}
.feature-placeholder .placeholder-verse { margin: 0; }
.feature-placeholder mark { padding: 0 .1em; border-radius: 2px; color: inherit; background: transparent; }
.feature-placeholder .placeholder-highlight { background: #f2de7e; }
.feature-placeholder .placeholder-original-language { text-decoration: underline dotted #6b3832; text-underline-offset: .2em; }
.feature-placeholder .placeholder-original-language::after { content: " יְהוָה"; color: #6b3832; font-size: .9em; }
.feature-placeholder .placeholder-translation-uses { background: #a6cbee; }
.feature-placeholder .placeholder-listen { box-shadow: inset 0 -.5em #b9de9f; }
.feature-placeholder .placeholder-notes { border-bottom: 2px solid #aeabe6; }
.feature-placeholder .placeholder-bookmarks { border-left: 3px solid #6e4828; padding-left: .3em; }
.feature-placeholder .placeholder-chat { background: #d7ade6; }
.feature-caption { flex: none; max-width: 560px; text-align: center; }
.feature-title { margin: 0; font: inherit; font-size: 18px; letter-spacing: -.01em; }
.feature-copy { margin: 6px 0 0; color: var(--muted); font-size: 14px; line-height: 1.6; }

.carousel-arrow {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  margin: 0 auto;
  align-self: center;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 50%;
  color: var(--ivory);
  background: rgba(20, 35, 27, .6);
  cursor: pointer;
}
.carousel-arrow:hover { background: rgba(248, 243, 232, .12); }
.carousel-arrow:focus-visible { outline: 2px solid var(--ivory); outline-offset: 3px; }
.carousel-dots { display: flex; justify-content: center; gap: 10px; margin: 0; padding: 0; }
.feature-dot {
  width: 28px;
  height: 28px;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
  position: relative;
}
.feature-dot::before {
  content: "";
  position: absolute;
  inset: 50% auto auto 50%;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--muted);
  opacity: .45;
  transform: translate(-50%, -50%);
  transition: opacity .25s, transform .25s;
}
.feature-dot[aria-selected="true"]::before { opacity: 1; transform: translate(-50%, -50%) scale(1.5); background: var(--ivory); }
.feature-dot:focus-visible { outline: 2px solid var(--ivory); outline-offset: -4px; border-radius: 50%; }

.features-cta {
  display: flex;
  justify-content: center;
  padding: 8px var(--gutter) 0;
}
.features .start-reading { margin-top: 0; }
.features .footer { justify-content: center; }

@media (max-width: 700px) {
  .features-head { gap: 6px; padding-top: max(10px, env(safe-area-inset-top)); }
  .features-title { font-size: 24px; }
  .features-lede { font-size: 13px; }
  .carousel { gap: 12px; padding-top: 14px; justify-content: center; }
  .carousel-viewport { flex: none; grid-template-columns: minmax(0, 1fr); padding: 0 12px; }
  .carousel-arrow { display: none; }
  .carousel-track, .feature, .feature-figure { height: auto; }
  .feature-media { flex: none; width: 100%; transform: scale(.94); border-radius: 8px; }
  .feature-title { font-size: 16px; }
  .feature-copy { font-size: 13px; }
  .features-cta { padding-top: 4px; }
  .features .start-reading { margin-top: 0; }
}

@media (max-height: 760px) {
  .features-head { gap: 2px; padding-top: max(8px, env(safe-area-inset-top)); }
  .features-back { min-height: 36px; }
  .features-title { font-size: clamp(22px, 2.6vw, 30px); }
  .features-lede { display: none; }
  .carousel { gap: 12px; padding: 12px 0 4px; }
  .feature-figure { gap: 10px; }
  .features .footer { padding-top: 4px; }
}

@media (max-height: 560px) {
  .feature-copy { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .carousel-track { scroll-behavior: auto; }
  .feature-media, .feature-dot::before { transition: none; }
}
