/* ==========================================================
   Kingdom Harvester shared mission-story panel system

   Used by:
     trips/tanzania-2025.html
     kids-vbs.html
     pure-religion.html

   Desktop:
     measured viewport panels with scroll snapping

   Tablet/mobile:
     natural scrolling with stacked content
   ========================================================== */

body.kh-story-page {
  background: var(--kh-cream-light);
}

/* ==========================================================
   Story hero
   ========================================================== */

.kh-story-hero {
  overflow: hidden;
  background: var(--kh-green-950);
  color: var(--kh-white);
}

.kh-story-hero-shell {
  width: min(
    var(--kh-content-width),
    calc(100% - 56px)
  );
  height: 100%;
  margin: 0 auto;
  padding: clamp(26px, 3.5vh, 38px) 0;
  display: grid;
  grid-template-columns:
    minmax(360px, 0.78fr)
    minmax(0, 1.22fr);
  gap: clamp(38px, 5vw, 72px);
  align-items: center;
}

.kh-story-hero-content {
  min-width: 0;
}

.kh-story-hero .kh-eyebrow {
  color: var(--kh-gold);
}

.kh-story-title {
  max-width: 620px;
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(3rem, 4.4vw, 4.5rem);
  font-weight: 500;
  letter-spacing: -0.045em;
  line-height: 0.96;
  text-wrap: balance;
}

.kh-story-lead {
  max-width: 525px;
  margin: 22px 0 0;
  color: rgba(255, 255, 255, 0.77);
  font-size: 0.96rem;
  line-height: 1.62;
}

.kh-story-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 27px;
}

.kh-story-button-outline {
  border-color: rgba(255, 255, 255, 0.62);
  color: var(--kh-white);
}

.kh-story-media {
  position: relative;
  width: min(100%, 800px);
  height: min(64vh, 560px);
  max-height:
    calc(
      100dvh
      - var(--kh-header-height)
      - 62px
    );
  min-height: 0;
  justify-self: end;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: var(--kh-green-900);
  box-shadow: 0 20px 46px rgba(0, 0, 0, 0.24);
}

.kh-story-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.kh-story-media-caption {
  position: absolute;
  right: 18px;
  bottom: 18px;
  left: 18px;
  margin: 0;
  padding: 11px 14px;
  background: rgba(6, 19, 12, 0.8);
  color: rgba(255, 255, 255, 0.82);
  font-size: 0.72rem;
  line-height: 1.4;
  backdrop-filter: blur(8px);
}

/* ==========================================================
   Measured article panels
   ========================================================== */

.kh-story-section {
  padding: 0;
}

.kh-story-section--cream {
  background: var(--kh-cream);
}

.kh-story-section--white {
  background: var(--kh-white);
}

.kh-story-shell {
  width: min(
    var(--kh-content-width),
    calc(100% - 56px)
  );
  margin: 0 auto;
}

.kh-story-section > .kh-story-shell {
  height: 100%;
  padding: clamp(30px, 4vh, 46px) 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  overflow: hidden;
}

.kh-story-heading {
  max-width: 920px;
  margin-bottom: clamp(22px, 3vh, 32px);
}

.kh-story-heading .kh-section-title {
  font-size: clamp(2.35rem, 3.6vw, 3.65rem);
  line-height: 0.99;
  text-wrap: balance;
}

.kh-story-grid {
  display: grid;
  grid-template-columns:
    minmax(0, 1fr)
    minmax(330px, 0.76fr);
  gap: clamp(38px, 5vw, 68px);
  align-items: center;
}

.kh-story-copy {
  max-width: 760px;
}

.kh-story-copy p {
  margin: 0 0 16px;
  color: var(--kh-muted);
  font-size: 0.91rem;
  line-height: 1.58;
}

.kh-story-copy p:last-child {
  margin-bottom: 0;
}

.kh-story-card {
  padding: clamp(25px, 3vw, 36px);
  border: 1px solid var(--kh-line);
  background: var(--kh-white);
  box-shadow: var(--kh-shadow);
}

.kh-story-card h2,
.kh-story-card h3 {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-weight: 500;
  line-height: 1.08;
}

.kh-story-card h2 {
  font-size: clamp(1.9rem, 2.5vw, 2.55rem);
}

.kh-story-card h3 {
  font-size: clamp(1.4rem, 1.8vw, 1.75rem);
}

.kh-story-card p {
  margin: 14px 0 0;
  color: var(--kh-muted);
  font-size: 0.9rem;
  line-height: 1.54;
}

.kh-story-card .kh-button {
  margin-top: 22px;
}

.kh-story-list {
  display: grid;
  gap: 12px;
  margin: 20px 0 0;
  padding: 0;
  list-style: none;
}

.kh-story-list li {
  position: relative;
  padding-left: 26px;
  color: var(--kh-muted);
  font-size: 0.91rem;
  line-height: 1.48;
}

.kh-story-list li::before {
  content: "◆";
  position: absolute;
  top: 0.28em;
  left: 0;
  color: var(--kh-gold-dark);
  font-size: 0.63rem;
}

/* ==========================================================
   Narrative panels

   Long text and Scripture sit side by side on desktop so
   neither overflows a measured viewport.
   ========================================================== */

.kh-story-section--narrative
  > .kh-story-shell {
  display: grid;
  grid-template-columns:
    minmax(0, 1.08fr)
    minmax(330px, 0.72fr);
  grid-template-rows: auto 1fr;
  column-gap: clamp(42px, 6vw, 76px);
  align-content: center;
}

.kh-story-section--narrative
  .kh-story-heading {
  grid-column: 1 / -1;
}

.kh-story-section--narrative
  .kh-story-copy {
  grid-column: 1;
}

.kh-story-quote {
  margin: 0;
  padding: clamp(25px, 3.5vw, 38px);
  border-left: 5px solid var(--kh-gold);
  background: rgba(217, 173, 78, 0.12);
  align-self: start;
}

.kh-story-section--narrative
  .kh-story-quote {
  grid-column: 2;
}

.kh-story-quote p {
  margin: 0;
  color: #514831;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(1.22rem, 1.9vw, 1.7rem);
  font-style: italic;
  line-height: 1.42;
}

.kh-story-quote cite {
  display: block;
  margin-top: 15px;
  color: var(--kh-gold-dark);
  font-family: Arial, Helvetica, sans-serif;
  font-size: 0.68rem;
  font-style: normal;
  font-weight: 850;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

/* ==========================================================
   Gallery panel
   ========================================================== */

.kh-story-gallery {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 24px;
}

.kh-story-gallery figure {
  margin: 0;
  overflow: hidden;
  background: var(--kh-white);
  box-shadow: var(--kh-shadow);
}

.kh-story-gallery img {
  width: 100%;
  height: min(39vh, 340px);
  object-fit: cover;
}

.kh-story-gallery figcaption {
  padding: 14px 18px;
  color: var(--kh-muted);
  font-size: 0.75rem;
  line-height: 1.45;
}

/* ==========================================================
   Closing panel
   ========================================================== */

.kh-story-closing {
  display: flex;
  flex-direction: column;
  background:
    linear-gradient(
      135deg,
      var(--kh-green-900),
      var(--kh-green-950)
    );
  color: var(--kh-white);
}

.kh-story-closing-main {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  align-items: center;
}

.kh-story-closing-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 52px;
  align-items: center;
}

.kh-story-closing-copy {
  max-width: 780px;
}

.kh-story-closing .kh-eyebrow {
  color: var(--kh-gold);
}

.kh-story-closing .kh-section-title {
  max-width: 760px;
  color: var(--kh-white);
  font-size: clamp(2.3rem, 3.5vw, 3.6rem);
  line-height: 1;
}

.kh-story-closing-copy
  > p:not(.kh-eyebrow) {
  max-width: 670px;
  margin: 18px 0 0;
  color: rgba(255, 255, 255, 0.69);
  font-size: 0.92rem;
  line-height: 1.58;
}

.kh-story-closing-actions {
  display: grid;
  gap: 12px;
  min-width: 230px;
}

.kh-story-closing-actions .kh-button {
  width: 100%;
}

/* ==========================================================
   Page-specific image positioning
   ========================================================== */

.kh-story-page--tanzania
  .kh-story-media img {
  object-position: center;
}

.kh-story-page--children
  .kh-story-media {
  width: min(100%, 760px);
}

.kh-story-page--children
  .kh-story-media img {
  object-position: center 28%;
}

.kh-story-page--pure-religion
  .kh-story-media {
  width: min(100%, 760px);
}

.kh-story-page--pure-religion
  .kh-story-media img {
  object-position: center 27%;
}

.kh-story-page--children
  .kh-story-gallery figure:last-child img {
  object-position: center 20%;
}

/* ==========================================================
   Tablet and mobile — natural scrolling
   ========================================================== */

@media (max-width: 999px) {
  .kh-story-hero-shell {
    height: auto;
    grid-template-columns: 1fr;
    padding: 0;
  }

  .kh-story-media {
    order: -1;
    width: 100%;
    max-width: none;
    height: min(52vh, 500px);
    max-height: none;
    box-shadow: none;
  }

  .kh-story-hero-content {
    padding: 58px 0 66px;
  }

  .kh-story-section {
    padding: 0;
  }

  .kh-story-section > .kh-story-shell,
  .kh-story-section--narrative
    > .kh-story-shell {
    height: auto;
    display: block;
    padding: 68px 0;
    overflow: visible;
  }

  .kh-story-grid,
  .kh-story-closing-grid {
    grid-template-columns: 1fr;
  }

  .kh-story-copy p {
    font-size: 0.98rem;
    line-height: 1.7;
  }

  .kh-story-quote {
    margin-top: 34px;
  }

  .kh-story-closing-main {
    display: block;
  }

  .kh-story-closing-grid {
    gap: 32px;
    padding: 70px 0;
  }

  .kh-story-closing-actions {
    width: min(100%, 420px);
  }
}

@media (max-width: 700px) {
  .kh-story-hero-shell,
  .kh-story-shell {
    width: calc(100% - 38px);
  }

  .kh-story-gallery {
    grid-template-columns: 1fr;
  }

  .kh-story-gallery img {
    height: min(68vh, 460px);
  }
}

@media (max-width: 620px) {
  .kh-story-media {
    height: 40vh;
    min-height: 270px;
  }

  .kh-story-hero-content {
    padding: 48px 0 58px;
  }

  .kh-story-title {
    font-size: clamp(2.85rem, 14vw, 4.1rem);
  }

  .kh-story-actions {
    display: grid;
  }

  .kh-story-actions .kh-button {
    width: 100%;
  }

  .kh-story-card {
    padding: 24px 20px;
  }

  .kh-story-closing-actions {
    width: 100%;
  }
}
