/* SAARSflow hero stories — a continuous engineering-to-sourcing narrative. */
.hero-stories {
  --hero-paper: #f4efe6;
  --hero-muted: #b9c8c6;
  --hero-flow: #9bc6bc;
  --hero-warm: #d7b877;
  height: max(780px, 100svh) !important;
  min-height: 780px !important;
  overflow: hidden;
  background: #061318;
}

.hero-stories::before { display: none !important; }

/* The earlier cinematic wordmark competes with the photographs. The new
   story-led hero keeps the identity in the navigation and lets real work lead. */
.hero-stories .hero-wordmark-layer,
.hero-stories .hero-wordmark { display: none !important; }

.hero-stories .hero-bg-parallax {
  inset: -2.5%;
  z-index: 0;
  overflow: hidden;
  transform: translateY(var(--hero-image-drift, 0));
}

.hero-story {
  position: absolute;
  inset: 0;
  opacity: 0;
  transform: scale(1.035);
  background-image: var(--hero-image) !important;
  background-position: var(--hero-focus, 50% 50%) !important;
  background-size: cover !important;
  background-repeat: no-repeat !important;
  filter: saturate(.94) contrast(1.04) brightness(.94) !important;
  transition: opacity 1.45s cubic-bezier(.22,.7,.18,1), transform 1.8s cubic-bezier(.22,.7,.18,1);
  will-change: opacity, transform;
}

.hero-story.is-active {
  z-index: 1;
  opacity: 1;
  animation: hero-story-camera 9s cubic-bezier(.2,.55,.2,1) both;
}

.hero-stories .hero-grade {
  z-index: 2;
  opacity: 1;
  mix-blend-mode: normal;
  background:
    linear-gradient(120deg, rgba(7,26,31,.26), rgba(7,26,31,.04) 57%, rgba(174,137,72,.04)),
    linear-gradient(180deg, rgba(1,9,12,.08), transparent 52%, rgba(1,9,12,.54));
}

.hero-stories .hero-image-overlay {
  z-index: 3;
  opacity: 1 !important;
  background:
    linear-gradient(90deg, rgba(2,12,16,.42), rgba(2,12,16,.1) 51%, transparent 76%),
    linear-gradient(180deg, rgba(2,10,13,.12), transparent 55%, rgba(2,10,13,.52));
}

/* The ribbon is intentionally asymmetrical: it feels like controlled flow,
   while giving the copy consistent contrast across all five photographs. */
.hero-flow-ribbon {
  position: absolute;
  top: -18%;
  bottom: -18%;
  left: -19%;
  z-index: 4;
  width: min(1130px, 78vw);
  overflow: hidden;
  pointer-events: none;
  transform: rotate(-2.2deg);
  border: 1px solid rgba(177,214,206,.16);
  border-left: 0;
  border-radius: 0 61% 52% 0 / 0 43% 57% 0;
  background:
    linear-gradient(112deg, rgba(5,20,25,.97) 0%, rgba(6,25,30,.91) 46%, rgba(9,35,40,.66) 69%, rgba(13,45,48,.22) 88%, transparent 100%);
  box-shadow: 28px 0 90px rgba(0,0,0,.16), inset -1px 0 0 rgba(194,224,217,.09);
  backdrop-filter: blur(4px) saturate(112%);
  -webkit-backdrop-filter: blur(4px) saturate(112%);
}

.hero-flow-ribbon::before {
  content: "";
  position: absolute;
  top: 7%;
  right: 2.5%;
  width: 46%;
  height: 86%;
  border-right: 1px solid rgba(173,211,202,.13);
  border-radius: 0 88% 72% 0 / 0 47% 53% 0;
  opacity: .9;
}

.hero-flow-ribbon__edge {
  position: absolute;
  top: -12%;
  right: -4%;
  width: 18%;
  height: 34%;
  border-radius: 50%;
  background: linear-gradient(180deg, transparent, rgba(180,218,209,.45), rgba(215,184,119,.22), transparent);
  filter: blur(11px);
  animation: hero-ribbon-travel 10s cubic-bezier(.45,0,.25,1) infinite;
}

.hero-stories .hero-engineering-layer {
  z-index: 5;
  opacity: .58;
}

.hero-stories .hero-flow-trace,
.hero-stories .hero-scan-dot,
.hero-stories .hero-tech-note { display: none !important; }

.hero-coordinate {
  position: absolute;
  right: 3.5vw;
  color: rgba(229,239,235,.52);
  font-family: var(--font-mono);
  font-size: 8px;
  letter-spacing: .19em;
  text-shadow: 0 2px 12px rgba(0,0,0,.55);
}

.hero-coordinate::before {
  content: "";
  display: inline-block;
  width: 36px;
  height: 1px;
  margin: 0 10px 3px 0;
  background: rgba(177,214,206,.46);
}

.hero-coordinate--one { top: 30%; }
.hero-coordinate--two { top: 33%; }

.hero-stories .hero-headline-parallax {
  z-index: 7;
  top: 50%;
  right: auto;
  bottom: auto;
  left: max(50px, calc((100vw - 1240px) / 2));
  width: min(610px, 46vw);
  transform: translateY(calc(-47% + var(--hero-headline-drift, 0px)));
}

.hero-stories .hero-headline { max-width: 610px; }
.hero-stories .hero-kicker {
  margin-bottom: 18px;
  color: var(--hero-warm);
  font-size: 9px;
  letter-spacing: .18em;
}
.hero-stories .hero-kicker span { background: var(--hero-flow); box-shadow: 0 0 0 5px rgba(155,198,188,.09); }

.hero-stories .hero-headline-text {
  max-width: 610px;
  margin-top: 0;
  color: var(--hero-paper);
  font-size: clamp(3.55rem, 5.05vw, 5.25rem);
  line-height: .95;
  letter-spacing: -.057em;
  text-shadow: 0 18px 50px rgba(0,0,0,.28);
}

.hero-stories .hero-headline-text > span,
.hero-stories .hero-headline-text > em { display: block; }
.hero-stories .hero-headline-text em {
  margin-top: .05em;
  color: var(--hero-flow) !important;
  background: none !important;
  -webkit-background-clip: border-box !important;
  background-clip: border-box !important;
  -webkit-text-fill-color: currentColor !important;
  font-family: var(--font-display);
  font-style: normal;
  font-weight: 600;
}

.hero-stories .hero-summary {
  max-width: 545px;
  margin-top: 22px;
  color: var(--hero-muted);
  font-size: clamp(.96rem, 1.1vw, 1.06rem);
  line-height: 1.65;
}

.hero-stories .hero-headline-ctas { margin-top: 24px; }
.hero-stories .hero-headline-cta { min-height: 49px; }
.hero-stories .hero-headline-cta--quiet { background: rgba(12,35,39,.46); }

.hero-scene-context {
  display: flex;
  align-items: center;
  gap: 14px;
  max-width: 545px;
  margin-top: 24px;
  padding-top: 17px;
  border-top: 1px solid rgba(185,210,204,.16);
  transition: opacity .28s ease, transform .28s ease;
}

.hero-scene-context.is-changing { opacity: 0; transform: translateY(5px); }
.hero-scene-context__index { min-width: 48px; color: var(--hero-warm); font-size: 9px; letter-spacing: .12em; }
.hero-scene-context strong { display: block; color: #e7eeea; font-size: 13px; font-weight: 600; letter-spacing: .01em; }
.hero-scene-context small { display: block; margin-top: 3px; color: #91aaa7; font-size: 11px; line-height: 1.35; }

.hero-story-nav {
  position: absolute;
  right: max(32px, calc((100vw - 1240px) / 2));
  bottom: 34px;
  z-index: 8;
  display: flex;
  gap: 8px;
  padding: 9px;
  border: 1px solid rgba(206,227,221,.15);
  border-radius: 999px;
  background: rgba(5,20,24,.54);
  box-shadow: 0 18px 50px rgba(0,0,0,.24);
  backdrop-filter: blur(14px) saturate(120%);
  -webkit-backdrop-filter: blur(14px) saturate(120%);
}

.hero-story-nav button {
  display: grid;
  grid-template-columns: 20px 0fr;
  align-items: center;
  gap: 0;
  min-width: 32px;
  min-height: 32px;
  padding: 0 6px;
  overflow: hidden;
  border: 0;
  border-radius: 999px;
  color: #8ea6a3;
  background: transparent;
  cursor: pointer;
  transition: grid-template-columns .5s cubic-bezier(.16,1,.3,1), gap .5s cubic-bezier(.16,1,.3,1), background .3s ease, color .3s ease;
}

.hero-story-nav button span {
  width: 5px;
  height: 5px;
  justify-self: center;
  border-radius: 50%;
  background: currentColor;
  box-shadow: 0 0 0 5px rgba(155,198,188,.06);
}

.hero-story-nav button b {
  overflow: hidden;
  font-family: var(--font-mono);
  font-size: 8px;
  font-weight: 500;
  letter-spacing: .1em;
  text-transform: uppercase;
  white-space: nowrap;
}

.hero-story-nav button:hover,
.hero-story-nav button:focus-visible { color: #dbe8e3; background: rgba(155,198,188,.08); }
.hero-story-nav button.is-active {
  grid-template-columns: 20px 1fr;
  gap: 4px;
  padding-right: 13px;
  color: #e4eee9;
  background: rgba(90,144,135,.2);
}
.hero-story-nav button.is-active span { background: var(--hero-warm); box-shadow: 0 0 0 5px rgba(215,184,119,.08), 0 0 14px rgba(215,184,119,.28); }

html[data-theme="light"] .hero-stories {
  --hero-paper: #13272b;
  --hero-muted: #465f62;
  --hero-flow: #2f736c;
  --hero-warm: #876523;
  background: #dce5e3;
}

html[data-theme="light"] .hero-stories .hero-grade {
  background: linear-gradient(120deg, rgba(231,239,236,.18), transparent 60%), linear-gradient(180deg, transparent 60%, rgba(13,31,35,.14));
}

html[data-theme="light"] .hero-stories .hero-image-overlay {
  background: linear-gradient(90deg, rgba(226,235,232,.2), transparent 60%), linear-gradient(180deg, transparent 62%, rgba(12,29,33,.16));
}

html[data-theme="light"] .hero-flow-ribbon {
  border-color: rgba(42,91,87,.14);
  background: linear-gradient(112deg, rgba(244,247,241,.98), rgba(235,241,236,.94) 49%, rgba(220,233,228,.78) 72%, rgba(220,233,228,.22) 91%, transparent);
  box-shadow: 28px 0 90px rgba(38,61,61,.12), inset -1px 0 rgba(255,255,255,.5);
}

html[data-theme="light"] .hero-scene-context { border-color: rgba(26,70,69,.18); }
html[data-theme="light"] .hero-scene-context strong { color: #183235; }
html[data-theme="light"] .hero-scene-context small { color: #516c6d; }
html[data-theme="light"] .hero-story-nav { border-color: rgba(24,63,63,.15); background: rgba(237,243,239,.74); }
html[data-theme="light"] .hero-story-nav button { color: #526f6e; }
html[data-theme="light"] .hero-story-nav button.is-active { color: #163f3d; background: rgba(47,115,108,.13); }
html[data-theme="light"] .hero-coordinate { color: rgba(24,60,62,.55); text-shadow: none; }

@keyframes hero-story-camera {
  from { transform: scale(1.035) translate3d(0,0,0); }
  to { transform: scale(1.075) translate3d(-.35%, -.25%, 0); }
}

@keyframes hero-ribbon-travel {
  0%, 12% { opacity: 0; transform: translateY(-5%); }
  36% { opacity: .8; }
  72%, 100% { opacity: 0; transform: translateY(330%); }
}

@media (max-width: 980px) {
  .hero-flow-ribbon { left: -31%; width: 112vw; }
  .hero-stories .hero-headline-parallax { right: 30px; left: 30px; width: min(610px, calc(100% - 60px)); }
  .hero-coordinate { display: none; }
  .hero-story-nav { right: 30px; }
}

@media (max-width: 700px) {
  .hero-stories { height: 820px !important; min-height: 820px !important; }
  .hero-stories .hero-bg-parallax { inset: -1%; }
  .hero-story { background-position: var(--hero-focus, 62% 50%) !important; filter: saturate(.88) contrast(1.03) brightness(.84) !important; }
  .hero-flow-ribbon {
    top: 36%;
    right: -16%;
    bottom: -26%;
    left: -18%;
    width: auto;
    border-radius: 54% 48% 0 0 / 23% 28% 0 0;
    transform: none;
    background: linear-gradient(180deg, rgba(5,20,25,.42), rgba(5,20,25,.94) 34%, rgba(5,20,25,.99));
  }
  html[data-theme="light"] .hero-flow-ribbon { background: linear-gradient(180deg, rgba(239,245,241,.25), rgba(239,245,241,.92) 32%, rgba(239,245,241,.99)); }
  .hero-stories .hero-image-overlay { background: linear-gradient(180deg, rgba(2,10,13,.08), rgba(2,10,13,.12) 38%, rgba(2,10,13,.58) 66%, rgba(2,10,13,.88)); }
  .hero-stories .hero-headline-parallax { top: auto; right: 20px; bottom: 112px; left: 20px; width: auto; transform: translateY(var(--hero-headline-drift, 0px)); }
  .hero-stories .hero-headline-text { font-size: clamp(2.75rem, 12.3vw, 3.9rem); line-height: .95; }
  .hero-stories .hero-summary { max-width: 520px; margin-top: 16px; font-size: .91rem; line-height: 1.52; }
  .hero-stories .hero-headline-ctas { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; margin-top: 18px; }
  .hero-stories .hero-headline-cta { min-width: 0; padding-inline: 12px; font-size: 10px; }
  .hero-scene-context { margin-top: 16px; padding-top: 13px; }
  .hero-scene-context small { font-size: 10px; }
  .hero-story-nav { right: 50%; bottom: 28px; transform: translateX(50%); }
  .hero-story-nav button { grid-template-columns: 18px 0fr; min-width: 28px; min-height: 28px; padding-inline: 5px; }
  .hero-story-nav button.is-active { grid-template-columns: 18px 1fr; padding-right: 10px; }
}

@media (max-width: 430px) {
  .hero-stories { height: 850px !important; min-height: 850px !important; }
  .hero-stories .hero-headline-ctas { grid-template-columns: 1fr; }
  .hero-stories .hero-headline-parallax { bottom: 98px; }
  .hero-story-nav button b { display: none; }
  .hero-story-nav button,
  .hero-story-nav button.is-active { grid-template-columns: 18px; gap: 0; padding: 0 5px; }
}

@media (prefers-reduced-motion: reduce) {
  .hero-story { transition: none !important; }
  .hero-story.is-active { animation: none !important; transform: scale(1.02); }
  .hero-flow-ribbon__edge { animation: none !important; opacity: .2; }
}
