/* ==========================================================================
   RackTide landing page: "How we got here" story section
   Depends on the tokens in hero.css (fonts, colours, --gutter).
   ========================================================================== */

:root {
  --amber: #e0a12f;
  --amber-ink: #1c1406;
  --bg-2: #0e1319;
  --card: #e9edf0;
  --card-ink: #141a21;
  --card-muted: #3a4652;
}

.story {
  position: relative;
  /* Top padding is lighter because the hero now ends with its own fade-out space. */
  padding: clamp(48px, 5vw, 64px) var(--gutter) clamp(88px, 10vw, 140px);
  background: var(--bg-2);
  color: var(--text);
  overflow: hidden;
}

/* Soft seam between the hero and this section */
.story::before {
  content: '';
  position: absolute;
  inset: 0 0 auto 0;
  height: 160px;
  background: linear-gradient(to bottom, var(--bg), transparent);
  pointer-events: none;
}

.story__inner {
  position: relative;
  max-width: 1200px;
  margin: 0 auto;
}

/* --------------------------------------------------------------------------
   Intro copy
   -------------------------------------------------------------------------- */
.story__intro {
  margin: 0 auto;
  text-align: center;
}

/* Paragraphs stay at reading width; the title may run the full width. */
.story__intro p {
  max-width: 660px;
  margin-left: auto;
  margin-right: auto;
}

.eyebrow {
  display: block;
  margin: 0 auto 16px;
  font: 500 13px / 1 var(--font-body);
  letter-spacing: 0.02em;
  color: var(--amber);
}

.story__title {
  margin: 0;
  font: 700 var(--title-size) / var(--title-leading) var(--font-display);
  letter-spacing: var(--title-tracking);
  text-transform: uppercase;
  color: #ffffff;
}

.story__title span { display: block; }

.story__lead {
  margin: 30px auto 0;
  font: 400 15px / 1.6 var(--font-body);
  color: #e3e9ef;
}

.story__intro p:not(.story__lead):not(.eyebrow) {
  margin: 18px auto 0;
  font: 400 14px / 1.6 var(--font-body);
  color: #c3cdd8;
}

/* --------------------------------------------------------------------------
   Feature switcher: list on the left, image stage on the right
   -------------------------------------------------------------------------- */
.story__grid {
  display: grid;
  grid-template-columns: minmax(260px, 340px) minmax(0, 1fr);
  gap: clamp(32px, 5vw, 64px);
  align-items: start;
  margin-top: clamp(56px, 7vw, 88px);
}

.features {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.feature {
  position: relative;
  border-radius: 8px;
  background: rgba(233, 237, 240, 0);
  transition: background-color 0.45s ease, box-shadow 0.45s ease, transform 0.45s ease;
}

.feature__toggle {
  display: block;
  width: 100%;
  margin: 0;
  padding: 24px 20px 20px; /* extra top room so the arrow sits above the text */
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.feature__toggle:focus-visible {
  outline: 2px solid var(--blue-bright);
  outline-offset: 2px;
}

.feature__title {
  display: block;
  padding-right: 60px; /* only the title shares its row with the arrow */
  font: 700 15px / 1.15 var(--font-display);
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: #ffffff;
  transition: color 0.45s ease;
}

.feature__text {
  display: block;
  margin-top: 8px;
  font: 400 12.5px / 1.55 var(--font-body);
  color: #c3cdd8;
  transition: color 0.45s ease;
}

/* Amber arrow, shown only on the active item */
.feature__arrow {
  position: absolute;
  top: 12px;
  right: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 5px;
  background: var(--amber);
  color: var(--amber-ink);
  opacity: 0;
  transform: translateX(-8px) scale(0.85);
  pointer-events: none;
  transition: opacity 0.4s ease, transform 0.5s cubic-bezier(0.2, 0.8, 0.2, 1), background-color 0.25s ease, box-shadow 0.25s ease;
}

.feature__arrow svg { width: 15px; height: 15px; }

.feature__arrow:hover,
.feature__arrow:focus-visible {
  background: #f0b346;
  box-shadow: 0 0 18px rgba(224, 161, 47, 0.45);
}

.feature__arrow:focus-visible {
  outline: 2px solid var(--amber);
  outline-offset: 2px;
}

/* Active state: the white card */
.feature.is-active {
  background: var(--card);
  box-shadow: 0 18px 40px -22px rgba(0, 0, 0, 0.7);
}

.feature.is-active .feature__title { color: var(--card-ink); }
.feature.is-active .feature__text  { color: var(--card-muted); }

.feature.is-active .feature__arrow {
  opacity: 1;
  transform: none;
  pointer-events: auto;
}

/* Non-active items dim slightly while another is lit */
.features:has(.is-active) .feature:not(.is-active) .feature__title { color: #eef3f7; }

/* Image stage */
.story__media {
  position: relative;
  aspect-ratio: 4 / 3;
  border-radius: 10px;
  overflow: hidden;
  background: #121920;
  box-shadow: 0 30px 60px -30px rgba(0, 0, 0, 0.8);
  isolation: isolate;
}

.story__img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  transform: scale(1.06);
  transition: opacity 0.7s ease, transform 1.6s cubic-bezier(0.2, 0.7, 0.2, 1);
  will-change: opacity, transform;
}

.story__img.is-active {
  opacity: 1;
  transform: scale(1);
  z-index: 1;
}

/* A quiet blue edge so the photo feels part of the grid world above */
.story__media::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  box-shadow: inset 0 0 0 1px rgba(120, 190, 255, 0.12);
  pointer-events: none;
  z-index: 2;
}

/* --------------------------------------------------------------------------
   Scroll reveal (shared utility; any element with data-reveal)
   -------------------------------------------------------------------------- */
[data-reveal] {
  opacity: 0;
  transform: translateY(26px);
  transition: opacity 0.9s ease, transform 0.9s cubic-bezier(0.2, 0.7, 0.2, 1);
  transition-delay: calc(var(--i, 0) * 90ms);
}

[data-reveal="media"] {
  transform: translateY(32px) scale(0.97);
}

[data-reveal].is-in {
  opacity: 1;
  transform: none;
}

/* --------------------------------------------------------------------------
   Responsive
   -------------------------------------------------------------------------- */
@media (max-width: 899px) {
  .story__grid {
    grid-template-columns: 1fr;
    max-width: 640px;
    margin-left: auto;
    margin-right: auto;
  }
  /* On touch devices the image sits above the list so tapping an item
     changes something the user can still see. */
  .story__media { order: -1; }
}

@media (max-width: 719px) {
  .story__title span { display: inline; }
  .feature__toggle { padding: 22px 16px 18px; }
}

@media (prefers-reduced-motion: reduce) {
  [data-reveal] { transform: none; transition: opacity 0.4s ease; }
  .story__img { transform: none; transition: opacity 0.4s ease; }
  .feature, .feature__title, .feature__text, .feature__arrow { transition: none; }
}
