/* FEATURE 01-04 detail sections (pattern E "Kinetic Journey").
   Content stays readable without JavaScript. js/nursing-layout.js adds .is-armed (animations paused at their first frame)
   and .is-play (animations run) per article, and flies the card illustration (.feature-flight) when a FEATURE card is clicked. */
.feature-journeys,
.feature-flight{
  --fj-ink: var(--sample-navy, #24415a);
  --fj-accent: var(--proposal-accent, #e96874);
  --fj-soft: #f9dfe7;
  --fj-orange: var(--sample-orange, #f5a623);
  --fj-text: var(--sample-text, #3f4d57);
  --fj-paper: #ffffff;
  --fj-display: "Shippori Mincho", "Yu Mincho", serif;
  --fj-ease-out: cubic-bezier(.16, 1, .3, 1);
  --fj-ease-io: cubic-bezier(.76, 0, .24, 1);
  --fj-pop: cubic-bezier(.34, 1.56, .64, 1);
}

.feature-journeys{
  position: relative;
  z-index: 3;
  /* Also cuts FEATURE 04's pink flood (.senior-flood--lead, 300vh tall) at the bottom of this area, where the senior
     messages' own flood takes over; left uncut it covers the requirements and the footer at the end of the page. */
  overflow: clip;
  padding: clamp(110px, 12vw, 190px) 0 clamp(120px, 14vw, 200px);
  color: var(--fj-text);
}

.feature-journeys__inner{
  display: grid;
  gap: clamp(140px, 16vw, 240px);
  width: min(1180px, calc(100% - 64px));
  margin: 0 auto;
}

.feature-journey{
  --fj-offset: 0s;
  display: grid;
  gap: clamp(40px, 5vw, 64px);
  scroll-margin-top: calc(var(--sample-header-height, 76px) + 24px);
}

/* Outline-only lettering in the page's display sans (the same face as the MESSAGE / FEATURE headings). */
.feature-journey__marquee{
  overflow: hidden;
  margin-inline: calc(50% - 50vw);
  padding-block: 4px;
  white-space: nowrap;
}

.feature-journey__marquee-track{
  display: inline-flex;
  animation: fj-marquee 32s linear infinite;
}

.feature-journey__marquee-track span{
  padding-right: .6em;
  color: transparent;
  font-family: "Zen Kaku Gothic New", "Yu Gothic", sans-serif;
  font-size: clamp(2.4rem, 6vw, 4.6rem);
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: -.03em;
  -webkit-text-stroke: 1.5px var(--fj-accent);
}

.feature-journey__marquee-track span:nth-child(even){
  -webkit-text-stroke-color: rgba(36, 65, 90, .45);
}

.feature-journey__hero{
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr);
  gap: 32px clamp(28px, 5vw, 72px);
  align-items: center;
}

.feature-journey__head{
  container-type: inline-size;
  display: grid;
  gap: 22px;
  min-width: 0;
}

.feature-journey__eyebrow{
  display: grid;
  gap: 4px;
  color: var(--fj-accent);
  font-size: .78rem;
  font-weight: 700;
  letter-spacing: .24em;
}

.feature-journey__eyebrow span{
  color: var(--fj-ink);
  font-size: .68rem;
  letter-spacing: .2em;
}

.feature-journey__title{
  margin: 0;
  color: var(--fj-ink);
  font-family: var(--fj-display);
  font-size: clamp(1.6rem, 9.4cqi, 3.4rem);
  font-weight: 700;
  line-height: 1.3;
}

.feature-journey__title em{
  color: var(--fj-accent);
  font-style: normal;
}

.feature-journey__line{ display: block; white-space: nowrap; }
.feature-journey__char{ display: inline-block; }

.feature-journey__lead{
  margin: 0;
  color: var(--fj-ink);
  font-size: 1.02rem;
  font-weight: 500;
  line-height: 1.9;
}

.feature-journey__visual{
  --fj-num: clamp(4.6rem, 8vw, 6.6rem);
  position: relative;
  width: min(100%, 520px);
  aspect-ratio: 1;
  justify-self: center;
}

.feature-journey__visual::before{
  content: "";
  position: absolute;
  inset: -5%;
  border: 2px dashed var(--fj-accent);
  border-radius: 50%;
  opacity: .45;
  animation: fj-spin 30s linear infinite;
}

.feature-journey__photo{
  position: absolute;
  inset: 0;
  margin: 0;
  overflow: hidden;
  border-radius: 58% 42% 46% 54% / 46% 56% 44% 54%;
  animation: fj-morph 9s ease-in-out infinite;
}

.feature-journey__photo img{
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Number and illustration sit at the photo's top right (never cut off below it on phones):
   the number as pale lettering like the FEATURE cards' numbers, the illustration in front over its lower left. */
.feature-journey__number{
  position: absolute;
  z-index: 2;
  top: -9%;
  right: -1%;
  color: rgba(216, 79, 114, .2);
  font-family: "Zen Kaku Gothic New", "Yu Gothic", sans-serif;
  font-size: var(--fj-num);
  font-weight: 700;
  line-height: .78;
  letter-spacing: -.075em;
  pointer-events: none;
}

.feature-journey__details{
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(0, 3fr);
  gap: 16px 56px;
  padding-top: clamp(28px, 4vw, 44px);
  border-top: 1px solid var(--proposal-rule, rgba(36, 65, 90, .19));
}

.feature-journey__details h4{
  margin: 0;
  color: var(--fj-ink);
  font-family: var(--fj-display);
  font-size: clamp(1.25rem, 2.2vw, 1.55rem);
  font-weight: 700;
  line-height: 1.6;
}

.feature-journey__details p{
  margin: 0;
  font-size: .98rem;
  line-height: 2.05;
}

.feature-journey__care{
  --fj-care-line1: clamp(1.15rem, 2.1vw, 1.5rem);
  --fj-care-line2: clamp(2.2rem, 4.4vw, 3.2rem);
  position: relative;
  display: grid;
  gap: 28px;
}

/* Two centred lines: the lead-in, then the keyword large on its own line at the horizontal centre. */
.feature-journey__care-title{
  margin: 0;
  color: var(--fj-ink);
  font-family: var(--fj-display);
  font-size: var(--fj-care-line1);
  font-weight: 700;
  line-height: 1.6;
  text-align: center;
}

.feature-journey__care-title span{
  display: block;
  color: var(--fj-accent);
  font-size: var(--fj-care-line2);
  line-height: 1.3;
}

.feature-journey__path{
  position: absolute;
  top: calc(var(--fj-care-line1) * 1.6 + var(--fj-care-line2) * 1.3 + 28px + 2px);
  left: 0;
  width: 100%;
  height: 80px;
  overflow: visible;
}

.feature-journey__path path{
  fill: none;
  stroke: var(--fj-accent);
  stroke-width: 3;
  stroke-linecap: round;
  stroke-dasharray: 1200;
  stroke-dashoffset: 0;
  vector-effect: non-scaling-stroke;
}

.feature-journey__nodes{
  position: relative;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 24px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.feature-journey__node{
  display: grid;
  align-content: start;
  justify-items: center;
  gap: 10px;
  text-align: center;
}

.feature-journey__dot{
  display: grid;
  place-items: center;
  width: 84px;
  height: 84px;
  border: 3px solid var(--fj-accent);
  border-radius: 50%;
  color: var(--fj-accent);
  background: var(--fj-paper);
  font-family: var(--fj-display);
  font-size: 1.7rem;
  font-weight: 700;
}

.feature-journey__node h5{
  margin: 0;
  color: var(--fj-ink);
  font-size: 1.1rem;
}

.feature-journey__node ul{
  margin: 0;
  padding: 0;
  list-style: none;
  font-size: .9rem;
  line-height: 1.9;
}

/* Touch tablets: scroll stops placed by setupFeatureSnap() so a flick pauses at each FEATURE card. */
.feature-snap{
  position: absolute;
  left: 0;
  width: 1px;
  height: 1px;
  pointer-events: none;
}

html.is-feature-snap{ scroll-snap-type: y proximity; }

html.is-feature-snap .feature-snap{
  scroll-snap-align: start;
  scroll-snap-stop: always;
}

/* Tablets: the card stack stops in the middle of the screen below the header instead of at its top (the scroll
   stops follow, as they take each card's sticky top). Short screens keep the minimum gap under the header. */
@media (min-width: 768px) and (max-width: 1024px) and (prefers-reduced-motion: no-preference) {
  .feature-section--stack .feature-card{
    --feature-card-centre: max(14px, (100svh - var(--sample-header-height) - clamp(600px, calc(100svh - var(--sample-header-height) - 52px), 680px)) / 2 - 18px);
  }

  .feature-section--stack .feature-card:nth-child(1){ top: calc(var(--sample-header-height) + var(--feature-card-centre)); }
  .feature-section--stack .feature-card:nth-child(2){ top: calc(var(--sample-header-height) + var(--feature-card-centre) + 12px); }
  .feature-section--stack .feature-card:nth-child(3){ top: calc(var(--sample-header-height) + var(--feature-card-centre) + 24px); }
  .feature-section--stack .feature-card:nth-child(4){ top: calc(var(--sample-header-height) + var(--feature-card-centre) + 36px); }
}

/* Landscape touch tablets wider than 1024px use the desktop card size. */
@media (min-width: 1025px) and (pointer: coarse) and (prefers-reduced-motion: no-preference) {
  .feature-section--stack .feature-card{
    --feature-card-centre: max(32px, (100svh - var(--sample-header-height) - clamp(650px, 74svh, 710px)) / 2 - 24px);
  }

  .feature-section--stack .feature-card:nth-child(1){ top: calc(var(--sample-header-height) + var(--feature-card-centre)); }
  .feature-section--stack .feature-card:nth-child(2){ top: calc(var(--sample-header-height) + var(--feature-card-centre) + 16px); }
  .feature-section--stack .feature-card:nth-child(3){ top: calc(var(--sample-header-height) + var(--feature-card-centre) + 32px); }
  .feature-section--stack .feature-card:nth-child(4){ top: calc(var(--sample-header-height) + var(--feature-card-centre) + 48px); }
}

/* The card's cut-out illustration floats on the detail photo and is the landing spot of the card-click flight. */
/* Placed from the number's size so the illustration's right edge covers about half of the "0". */
.feature-journey__sticker{
  position: absolute;
  z-index: 3;
  top: calc(-9% + var(--fj-num) * .05);
  right: calc(-2.5% + var(--fj-num) * .55);
  width: 34%;
  aspect-ratio: 1;
}

.feature-journey__sticker img{
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  filter: drop-shadow(0 16px 24px rgba(36, 65, 90, .22));
  animation: fj-float 5s ease-in-out infinite;
}

/* Card-click flight: an illustration copy lifts off the card and lands on the detail sticker. */
.feature-flight{
  position: fixed;
  z-index: 1200;
  inset: 0;
  visibility: hidden;
  pointer-events: none;
}

.feature-flight.is-flying{ visibility: visible; }

.feature-flight__veil{
  position: absolute;
  inset: 0;
  background: #fdf8f9;
  opacity: 0;
}

.feature-flight__ghost{
  position: absolute;
  display: none;
  object-fit: contain;
  transform-origin: 0 0;
  filter: drop-shadow(0 18px 26px rgba(36, 65, 90, .25));
}

.feature-flight__ghost.is-active{ display: block; }

.feature-flight__spark{
  position: absolute;
  width: 14px;
  height: 14px;
  background: var(--fj-orange);
  clip-path: polygon(50% 0, 62% 38%, 100% 50%, 62% 62%, 50% 100%, 38% 62%, 0 50%, 38% 38%);
  opacity: 0;
}

.feature-flight__spark:nth-of-type(even){ background: #f59ba7; }

/* Entrance motion: armed articles hold their first frame until .is-play. */
.feature-journey.is-armed .feature-journey__char{ animation: fj-char .9s var(--fj-pop) calc(var(--fj-offset) + .15s + var(--c) * .035s) both paused; }
.feature-journey.is-armed :is(.feature-journey__eyebrow, .feature-journey__lead){ animation: fj-fade .9s var(--fj-ease-out) calc(var(--fj-offset) + .9s) both paused; }
.feature-journey.is-armed .feature-journey__photo{ animation: fj-blob-in 1.4s var(--fj-ease-out) calc(var(--fj-offset) + .2s) both paused, fj-morph 9s ease-in-out calc(var(--fj-offset) + 1.6s) infinite paused; }
.feature-journey.is-armed .feature-journey__number{ animation: fj-pop .8s var(--fj-pop) calc(var(--fj-offset) + 1s) both paused; }
.feature-journey.is-armed .feature-journey__sticker img{ animation: fj-pop .8s var(--fj-pop) calc(var(--fj-offset) + 1.2s) both paused, fj-float 5s ease-in-out calc(var(--fj-offset) + 2s) infinite paused; }
.feature-journey.is-armed.is-flown .feature-journey__sticker img{ animation: fj-float 5s ease-in-out infinite; }
.feature-journey.is-armed .feature-journey__details{ animation: fj-fade .9s var(--fj-ease-out) calc(var(--fj-offset) + 1.1s) both paused; }
.feature-journey.is-armed .feature-journey__path path{ animation: fj-draw 1.8s var(--fj-ease-io) calc(var(--fj-offset) + .2s) both paused; }
.feature-journey.is-armed .feature-journey__dot{ animation: fj-pop .7s var(--fj-pop) calc(var(--fj-offset) + .4s + var(--i) * .5s) both paused; }
.feature-journey.is-armed :is(.feature-journey__node h5, .feature-journey__node ul){ animation: fj-fade .7s var(--fj-ease-out) calc(var(--fj-offset) + .6s + var(--i) * .5s) both paused; }

.feature-journey.is-play :is(.feature-journey__char, .feature-journey__eyebrow, .feature-journey__lead, .feature-journey__photo, .feature-journey__number, .feature-journey__sticker img, .feature-journey__details),
.feature-journey__care.is-play :is(.feature-journey__path path, .feature-journey__dot, .feature-journey__node h5, .feature-journey__node ul){
  animation-play-state: running;
}

.feature-journey.is-flown{ --fj-offset: .45s; }

@keyframes fj-char{
  from{
    opacity: 0;
    transform:
      translate(calc(sin(var(--c) * 2.3rad) * 140px), calc(cos(var(--c) * 1.7rad) * 90px - 60px))
      rotate(calc(sin(var(--c) * 3.1rad) * 70deg))
      scale(.4);
  }
}
@keyframes fj-fade{ from{ opacity: 0; transform: translateY(16px); } }
@keyframes fj-pop{ from{ opacity: 0; transform: scale(0) rotate(-40deg); } }
@keyframes fj-blob-in{ from{ transform: scale(0) rotate(-30deg); border-radius: 50%; } }
@keyframes fj-morph{
  33%{ border-radius: 42% 58% 60% 40% / 56% 44% 56% 44%; }
  66%{ border-radius: 50% 50% 38% 62% / 40% 60% 40% 60%; }
}
@keyframes fj-spin{ to{ transform: rotate(360deg); } }
@keyframes fj-marquee{ to{ transform: translateX(-50%); } }
@keyframes fj-draw{ from{ stroke-dashoffset: 1200; } }
@keyframes fj-float{ 50%{ transform: translateY(-10px) rotate(-2deg); } }

@media (max-width: 1024px){
  .feature-journeys__inner{ width: min(100% - 40px, 920px); }
}

@media (max-width: 860px){
  .feature-journey__hero,
  .feature-journey__details,
  .feature-journey__nodes{ grid-template-columns: minmax(0, 1fr); }
  .feature-journey__visual{ width: min(380px, 100%); }
  .feature-journey__visual{ --fj-num: 4.4rem; }
  .feature-journey__path{ display: none; }

  /* Phones: the three stops become a compact timeline (small dot, title and items beside it) on one rail. */
  .feature-journey__care{ gap: 16px; }
  .feature-journey__nodes{ gap: 0; }
  .feature-journey__nodes::before{
    content: "";
    position: absolute;
    top: 30px;
    bottom: 30px;
    left: 21px;
    border-left: 2px dashed var(--fj-accent);
    opacity: .5;
  }
  .feature-journey__node{
    position: relative;
    grid-template-columns: 44px minmax(0, 1fr);
    align-items: center;
    justify-items: start;
    gap: 2px 14px;
    padding-block: 10px;
    text-align: left;
  }
  .feature-journey__dot{
    grid-row: span 2;
    width: 44px;
    height: 44px;
    border-width: 2px;
    font-size: 1rem;
  }
  .feature-journey__node h5{ font-size: 1rem; }
  .feature-journey__node ul{
    display: flex;
    flex-wrap: wrap;
    gap: 0 .9em;
    font-size: .84rem;
    line-height: 1.7;
  }
}

@media (max-width: 480px){
  .feature-journeys__inner{ width: calc(100% - 36px); }
}

@media (prefers-reduced-motion: reduce){
  .feature-journey *,
  .feature-journey *::before,
  .feature-flight *{ animation: none !important; }
}
