/* ═══════════════════════════════════════════════════════════════
   Stories — long-form story pages (stories_draft.html)
   Video hero with a transparent white nav over it, then a single
   readable column with circular and paired photos.
═══════════════════════════════════════════════════════════════ */

/* ─── Hero ─── */
.story-hero {
  position: relative;
  min-height: clamp(360px, 49.12vw, 560px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: #222;
}

/* The mobile menu drops below the hero, so it must not be clipped. */
@media (max-width: 960px) {
  .story-hero { overflow: visible; }
}

.story-hero__video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Mirrored left-to-right within the frame */
.story-hero__video--flop { transform: scaleX(-1); }

/* Darkens the top (nav) and bottom-left (title) so white type stays legible
   over any frame of the video. */
.story-hero__shade {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(to bottom, rgba(0, 0, 0, 0.45) 0%, rgba(0, 0, 0, 0) 28%),
    linear-gradient(to top right, rgba(0, 0, 0, 0.4) 0%, rgba(0, 0, 0, 0) 55%);
  pointer-events: none;
}

/* The site's gray corner triangle (same shape as .hero-block__bg), laid over
   the video and multiplied so the footage shows through it. */
/* Trims the oversized triangle to the hero on its own, so the hero itself
   can let the mobile menu hang below it. */
.story-hero__clip {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
}

.story-hero__triangle {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: var(--hero-gray-height);
  /* Darker than the site's --gray-bg: that near-white barely registers when
     multiplied over footage. */
  background: #c8cacd;
  clip-path: var(--hero-gray-clip);
  mix-blend-mode: multiply;
  pointer-events: none;
}

@media (max-width: 960px) {
  .story-hero__triangle {
    width: 200%;
    height: 74.8vw;
  }
}

.story-hero__inner {
  position: relative;
  z-index: 1;
  flex: 1;
  display: flex;
  align-items: flex-end;
  /* .container margins, so the title lines up with the nav and the story
     below. width keeps the flex column from shrinking it to the title. */
  width: 100%;
  padding-bottom: clamp(32px, 4.21vw, 48px);
}

.story-hero__title {
  font-family: var(--font-display);
  /* Regular, not the homepage's 500: white on video reads a step heavier. */
  font-weight: 400;
  font-size: clamp(3.25rem, 9.82vw, 7rem);
  /* Leading matches the homepage "Check Your Balance" headline.
     White-on-dark renders heavier than the homepage's blue-on-white, so
     smoothing is antialiased and the shadow kept soft. */
  line-height: 0.9;
  letter-spacing: -1px;
  color: #fff;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-shadow: 0 1px 12px rgba(0, 0, 0, 0.25);
  margin: 0;
}

/* ─── Stories nav: transparent with white links over the video ─── */
.stories-header {
  background: transparent;
  border-bottom: none;
}

.stories-header .stories-header__logo--dark { display: none; }

/* Once scrolled it becomes the site's standard solid white bar. */
.stories-header.is-sticky .stories-header__logo--light { display: none; }
.stories-header.is-sticky .stories-header__logo--dark  { display: block; }

.stories-header .nav__hamburger span { background: #fff; }
.stories-header.is-sticky .nav__hamburger span { background: var(--ink); }

@media (min-width: 961px) {
  .stories-header .nav__link { color: #fff; }
  .stories-header .nav__link::after,
  .stories-header .nav__link:hover::after { background: #fff; }
  .stories-header .nav__link:hover { color: #fff; }

  /* The Download Free App menu opens on a white panel: keep its links dark. */
  .stories-header .nav__dropdown-link { color: var(--nav-text); }
  .stories-header .nav__dropdown-link:hover { color: var(--brand); }

  .stories-header.is-sticky .nav__link { color: var(--nav-text); }
  .stories-header.is-sticky .nav__link:hover { color: var(--brand); }
  .stories-header.is-sticky .nav__link::after,
  .stories-header.is-sticky .nav__link:hover::after { background: var(--brand); }
}

/* ─── Story body ─── */
.story {
  background: #fff;
  padding-bottom: clamp(48px, 6.32vw, 72px);
}

.story__container {
  width: 100%;
}

.story p {
  font-family: var(--font-body);
  font-weight: 300;
  font-size: clamp(1rem, 2.46vw, 1.75rem);
  line-height: 1.55;
  color: #555;
  margin: 0 0 0.6em;
}

/* Lede beside the circle that overlaps the bottom edge of the hero */
.story__intro {
  /* Shared by the lede and the top circle, which lines its bottom up with the
     lede's third line */
  --lede-size: clamp(1.25rem, 3vw, 2.125rem);
  --lede-top: 18px;
  --circle-size: clamp(180px, 30vw, 342px);
  display: flex;
  align-items: flex-start;
  gap: 24px;
  margin-bottom: 24px;
}

.story .story__lede {
  flex: 1;
  font-size: var(--lede-size);
  line-height: 1.4;
  color: #444;
  margin: var(--lede-top) 0 0;
}

.story__circle {
  border-radius: 50%;
  /* Same ring weight as the circle photos on the other pages */
  border: 8px solid var(--brand);
  object-fit: cover;
  aspect-ratio: 1;
  flex-shrink: 0;
}

.story__circle--hero {
  width: var(--circle-size);
  /* Bottom edge on the baseline of the lede's third line: two 1.4 lines plus
     the first-line baseline (Roboto: 0.114em half-leading + 0.927em ascent) */
  margin-top: calc(var(--lede-top) + var(--lede-size) * 3.84 - var(--circle-size));
  margin-right: clamp(0px, 3.51vw, 40px);
  position: relative;
  z-index: 2;
  border-color: var(--cta-sun);
  /* Flopped (mirrored) to face into the page, as in the layout */
  transform: scaleX(-1);
}

/* Two photos side by side, edge to edge */
.story__pair {
  display: grid;
  grid-template-columns: 1fr 1fr;
  /* White gap between the two photos */
  gap: 8px;
  margin: 28px 0;
}

.story__pair img {
  width: 100%;
  height: 100%;
  aspect-ratio: 1169 / 755;
  object-fit: cover;
  display: block;
  border-radius: var(--radius-lg);
}

/* A top circle photo that should not be mirrored */
.story__circle--hero.story__circle--noflop { transform: none; }

/* Mirrored left-to-right */
.story__img--flop { transform: scaleX(-1); }

/* Circle left, closing paragraphs right */
.story__aside {
  display: flex;
  align-items: flex-start;
  gap: 36px;
  margin-top: 12px;
}

.story__circle--aside {
  width: clamp(198px, 31.58vw, 360px);
}

.story__aside-copy { flex: 1; }

/* ─── Back / Next pager ─── */
.story__pager {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin-top: 36px;
  padding: 0 12px;
}

.story__pager-link {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
}

.story__pager-btn {
  font-family: var(--font-body);
  font-weight: 700;
  font-size: clamp(1rem, 1.93vw, 1.375rem);
  color: #fff;
  background: var(--cta-sun);
  border-radius: 8px;
  padding: 0.3em 0.65em;
  white-space: nowrap;
  transition: background var(--transition);
}

/* Keeps Next on the right when a story has no Back */
.story__pager-link--next { margin-left: auto; }

.story__pager-link:hover .story__pager-btn { background: var(--orange-dark); }

.story__pager-title {
  font-family: var(--font-body);
  font-weight: 300;
  font-size: clamp(1rem, 2.11vw, 1.5rem);
  color: #555;
}

/* ─── Mobile ─── */
@media (max-width: 640px) {
  .story__pair { gap: 4px; }

  /* Leave room for the circle that rises into the hero */
  .story-hero__inner { padding-bottom: 110px; }

  .story__intro {
    flex-direction: column-reverse;
    align-items: center;
    gap: 0;
  }
  .story .story__lede { margin-top: 20px; }
  .story__circle--hero {
    margin-top: calc(var(--circle-size) * -0.5);
    margin-right: 0;
  }

  .story__aside {
    flex-direction: column;
    align-items: center;
    gap: 20px;
  }

  .story__pager { padding: 0; }
  .story__pager-title { font-size: 1rem; }
}

/* ═══════════════════════════════════════════════════════════════
   Stories directory (stories.html) — a banner per story with its
   looping hero video and the title over the bottom left.
═══════════════════════════════════════════════════════════════ */
.stories-index__hero { border-bottom: none; padding-bottom: 8px; }

/* Sized to the layout: a larger headline and intro than the news-style hero */
.stories-index__hero .page-hero__title {
  font-size: clamp(3.5rem, 10.18vw, 7.25rem);
  letter-spacing: -0.03em;
  /* Same leading and headline-to-intro space as the homepage hero */
  line-height: 0.9;
  margin-bottom: 28px;
}

.stories-index__hero .page-hero__sub {
  font-size: clamp(1.25rem, 2.81vw, 2rem);
  line-height: 1.4;
  max-width: none;
}

/* The email invitation reads at the /for-everyone body size — see
   .fe-story__copy p in for-everyone-v2.css */
.stories-index__hero .page-hero__sub + .page-hero__sub {
  font-size: 1.25rem;
  line-height: 1.35;
}
.stories-index__invite { font-weight: 500; }


.stories-index {
  position: relative;
  padding: 32px 0 clamp(56px, 7.72vw, 88px);
}

.stories-index__list {
  /* Banner heights are set from this width (cqw) so they can animate */
  container-type: inline-size;
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: clamp(24px, 4.21vw, 48px);
}

.story-card {
  position: relative;
  display: flex;
  align-items: flex-end;
  /* 15% shorter than the original 4.5:1 */
  height: calc(100cqw / 4.5 * 0.85);
  transition: height 0.45s ease;
  overflow: hidden;
  /* Same corners as the photos on the rest of the site */
  border-radius: var(--radius-lg);
  background: #222;
  text-decoration: none;
}

.story-card__video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  /* Rounded itself too: Safari can let video corners escape a clipping parent */
  border-radius: inherit;
}

/* Darkens the bottom left so the white title stays legible */
.story-card::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(to top right, rgba(0, 0, 0, 0.45) 0%, rgba(0, 0, 0, 0) 60%);
  pointer-events: none;
}

.story-card__title {
  position: relative;
  z-index: 1;
  /* Room for the arrow circle that follows the headline */
  display: inline-flex;
  align-items: center;
  gap: clamp(12px, 1.75vw, 20px);
  padding: 0 clamp(20px, 3.51vw, 40px) clamp(14px, 2vw, 22px);
  font-family: var(--font-display);
  font-weight: 400;
  font-size: clamp(2rem, 5.26vw, 3.75rem);
  line-height: 1.1;
  letter-spacing: -1px;
  color: #fff;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-shadow: 0 1px 12px rgba(0, 0, 0, 0.25);
}

a.story-card .story-card__video { transition: transform 0.6s ease; }
a.story-card:hover .story-card__video:not(.story-hero__video--flop) { transform: scale(1.03); }
a.story-card:hover .story-hero__video--flop { transform: scaleX(-1) scale(1.03); }

@media (max-width: 640px) {
  .story-card { height: calc(100cqw / 3 * 0.85); }
}


/* ─── Accordion: a banner opens its story right below it ─── */
/* Scrolled-to banners clear the sticky nav bar */
.story-card { scroll-margin-top: 110px; }

.story-card__chevron {
  position: relative;
  flex-shrink: 0;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  color: #fff;
  background: var(--cta-sun);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.25);
  transition: background var(--transition), color var(--transition);
}

.story-card__chevron::before {
  content: '';
  position: absolute;
  left: 50%;
  top: 50%;
  width: 11px;
  height: 11px;
  border-right: 2.5px solid currentColor;
  border-bottom: 2.5px solid currentColor;
  transform: translate(-50%, -70%) rotate(45deg);
  transition: transform 0.3s ease;
}

a.story-card:hover .story-card__chevron {
  background: #fff;
  color: var(--cta-sun);
}

.story-card[aria-expanded="true"] .story-card__chevron::before {
  transform: translate(-50%, -30%) rotate(-135deg);
}

/* The story itself: same type and layout as the story pages, set inside the
   directory's container (so no second set of gutters). */
.story-panel .story {
  padding-bottom: clamp(16px, 3vw, 32px);
  background: transparent;
}

.story-panel .story__pager { display: none; }

.story-panel__close {
  display: flex;
  align-items: center;
  gap: 8px;
  /* Right-aligned at the end of the story */
  margin: 8px 0 0 auto;
  padding: 0;
  border: none;
  background: none;
  font-family: var(--font-body);
  font-weight: 500;
  font-size: 1.05rem;
  color: var(--brand);
  cursor: pointer;
}

.story-panel__close::after {
  content: '';
  width: 8px;
  height: 8px;
  border-left: 2px solid currentColor;
  border-top: 2px solid currentColor;
  transform: translateY(2px) rotate(45deg);
}

.story-panel__close:hover { color: var(--brand-deep); }

.story-panel.is-entering { animation: story-panel-in 0.35s ease both; }

@keyframes story-panel-in {
  from { opacity: 0; transform: translateY(-8px); }
  to   { opacity: 1; transform: none; }
}

@media (prefers-reduced-motion: reduce) {
  .story-panel.is-entering { animation: none; }
}

/* An open story's banner doubles in height */
.story-card[aria-expanded="true"] { height: calc(100cqw / 2.25 * 0.85); }

/* Phone-only copy of the top circle (added by js/stories.js) */
.story__circle--inline { display: none; }

/* The panel's top circle comes first in the markup (js/stories.js moves it)
   so phones can float it; row-reverse keeps it on the right on desktop. */
.story-panel .story__intro { flex-direction: row-reverse; }

/* Phones: shorter banners, the arrow in the right corner, and smaller photo
   circles floated right with the text wrapping around them on the left. */
@media (max-width: 640px) {
  .story-card[aria-expanded="true"] { height: calc(100cqw / 1.75 * 0.85); }

  .story-card__title {
    width: 100%;
    justify-content: space-between;
  }

  .story-panel .story__intro,
  .story-panel .story__aside {
    display: flow-root;
  }

  .story-panel .story__circle {
    float: right;
    width: clamp(110px, 38vw, 150px);
    margin: 6px 0 10px 16px;
  }

  /* The top circle moves down into the story text, with a thinner ring */
  .story-panel .story__intro .story__circle--hero { display: none; }

  .story-panel .story__circle--inline {
    display: block;
    margin-top: 6px;
    border-width: 4px;
  }

  .story-panel .story__circle--aside { border-width: 4px; }
}
