/* Journey page — sections are rendered by js/pages/about.js from content/journey.js.
   Tokens come from style.css. Blade red is used for active state, links and the quote bar only. */

/* --journey-svh is only ever set by the dashboard preview, so a phone, tablet or desktop frame that is taller than
   a real screen still sizes the hero as that screen would. On the live site it is unset and means 100svh. */

/* Hold the page height until the sections are drawn so the footer never flashes into view. */
[data-journey-root]:not([data-journey-ready]) {
  min-height: 100svh;
}

/* ── Inline text: bold + links inside paragraphs ─────────────────────────── */
[data-journey-root] p strong {
  color: var(--c-text);
  font-weight: 700;
}

[data-journey-root] p a:not(.btn):not(.tile):not(.tile__advance) {
  color: var(--c-edge-text);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.18em;
}

.journey-intro {
  max-width: 60ch;
  color: var(--c-text-muted);
}

.journey-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-2);
  margin-top: var(--sp-2);
}

/* ── Hero ────────────────────────────────────────────────────────────────── */
.about-hero {
  display: grid;
  gap: var(--sp-4);
  align-items: end;
}

@media (min-width: 768px) {
  .about-hero {
    grid-template-columns: 1fr minmax(220px, 320px);
  }
}

/* Desktop: the whole hero (photo, title, intro) fits in one screen, sized from the viewport height. */
@media (min-width: 1024px) {
  .page-hero--journey {
    box-sizing: border-box;
    min-height: calc(var(--journey-svh, 100svh) - var(--topbar-h));
    display: flex;
    align-items: center;
    padding-block: var(--sp-4);
  }

  .page-hero--journey .about-hero {
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
  }

  .page-hero--journey .about-hero__media {
    width: calc(clamp(280px, calc(var(--journey-svh, 100svh) - var(--topbar-h) - var(--sp-4) * 2 - 4.75rem), 560px) * 0.75);
    justify-self: end;
  }

  .page-hero--journey .about-hero__portrait {
    width: 100%;
    height: auto;
    aspect-ratio: 3 / 4;
    max-height: none;
  }
}

/* No photo: the title and intro take the full width. */
.about-hero.about-hero--solo {
  grid-template-columns: minmax(0, 1fr);
  align-items: center;
}

/* Phone: the portrait stays near 42% of the screen so the title and intro stay with it. */
.about-hero__media {
  width: min(100%, calc(var(--journey-svh, 100svh) * 0.42 * 0.8));
  justify-self: center;
  min-width: 0;
}

.about-hero__portrait {
  width: 100%;
  aspect-ratio: 4 / 5;
  max-height: calc(var(--journey-svh, 100svh) * 0.42);
}

.about-hero__portrait img {
  display: block;
}

@media (min-width: 768px) {
  .about-hero__media {
    width: auto;
    justify-self: stretch;
  }

  .about-hero__portrait {
    aspect-ratio: 3 / 4;
    max-height: none;
  }
}

/* ── Story timeline ──────────────────────────────────────────────────────── */
.about-layout {
  display: grid;
  gap: var(--sp-6);
}

@media (min-width: 1024px) {
  .about-layout {
    grid-template-columns: minmax(200px, 240px) 1fr;
    align-items: start;
  }

  .about-layout.about-layout--solo {
    grid-template-columns: minmax(0, 1fr);
  }

  .about-sticky.about-sticky--enabled {
    position: sticky;
    top: calc(var(--topbar-h) + var(--nav-h) + var(--sp-4));
  }
}

.about-rail {
  display: none;
  flex-direction: column;
  gap: var(--sp-2);
  padding-left: var(--sp-2);
  border-left: 1px solid var(--c-line);
}

@media (min-width: 1024px) {
  .about-rail {
    display: flex;
  }
}

.about-rail__dot {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  padding: var(--sp-1) 0;
  background: none;
  border: none;
  color: var(--c-text-faint);
  cursor: pointer;
  font-family: var(--font-hud);
  font-size: var(--fs-hud);
  letter-spacing: var(--ls-hud);
  text-align: left;
}

.about-rail__dot.is-current {
  color: var(--c-text);
}

.about-rail__dot.is-current .about-rail__index {
  box-shadow: inset 2px 0 0 var(--c-edge);
  padding-left: var(--sp-2);
}

.about-chapters {
  display: grid;
  gap: var(--sp-10);
}

.about-chapter {
  display: grid;
  gap: var(--sp-4);
  padding-left: var(--sp-2);
  border-left: 2px solid transparent;
  transition: border-color var(--t-base) var(--ease-out);
}

.about-chapter.is-current {
  border-left-color: var(--c-edge);
}

/* Phone: title, then a short photo, then the story. From tablet up the photo sits beside the story. */
.about-chapter--has-media {
  grid-template-areas:
    "head"
    "media"
    "body";
}

.about-chapter--has-media .about-chapter__head {
  grid-area: head;
}

.about-chapter--has-media .about-chapter__media {
  grid-area: media;
}

.about-chapter--has-media .about-chapter__body {
  grid-area: body;
}

.about-chapter__media {
  min-width: 0;
}

.about-chapter__media .journey-gallery {
  width: min(100%, calc(var(--journey-svh, 100svh) * 0.34 * 1.5));
}

.about-chapter__media .journey-gallery__frame {
  aspect-ratio: 3 / 2;
  width: 100%;
  max-height: calc(var(--journey-svh, 100svh) * 0.34);
}

.about-chapter__media img {
  display: block;
}

@media (min-width: 768px) {
  .about-chapter.about-chapter--has-media {
    grid-template-columns: minmax(0, 1fr) minmax(240px, 360px);
    grid-template-areas:
      "head media"
      "body media";
    gap: var(--sp-5);
    align-items: start;
  }

  .about-chapter__media .journey-gallery {
    width: 100%;
  }

  .about-chapter__media .journey-gallery__frame {
    aspect-ratio: 3 / 4;
    max-height: none;
  }
}

@media (min-width: 1024px) {
  .about-chapter--has-media .about-chapter__media {
    position: sticky;
    top: calc(var(--topbar-h) + var(--nav-h) + var(--sp-4));
  }
}

/* Lead photo and the strip that swaps it. */
.journey-gallery {
  min-width: 0;
  max-width: 100%;
}

.journey-thumbs {
  display: flex;
  gap: 0.4rem;
  margin-top: 0.45rem;
  width: 100%;
  min-width: 0;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scrollbar-width: none;
}

.journey-thumbs::-webkit-scrollbar {
  display: none;
}

.journey-thumb {
  --chamfer: 5px;
  flex: 0 0 auto;
  width: 48px;
  height: 48px;
  padding: 0;
  border: 0;
  background: var(--c-surface);
  color: inherit;
  cursor: pointer;
  opacity: 0.62;
  clip-path: var(--chamfer-poly);
  box-shadow: inset 0 0 0 1px transparent;
}

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

.journey-thumb.is-active,
.journey-thumb:focus-visible {
  opacity: 1;
  box-shadow: inset 0 0 0 2px var(--c-edge);
}

@media (hover: hover) and (pointer: fine) {
  .journey-thumb:hover {
    opacity: 1;
  }
}

@media (prefers-reduced-motion: reduce) {
  .journey-thumb {
    transition: none;
  }
}

/* ── Tile cards and stats ────────────────────────────────────────────────── */
.values-grid {
  display: grid;
  gap: var(--sp-3);
}

@media (min-width: 768px) {
  .values-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .values-grid.values-grid--2 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.journey-stats {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--sp-3);
}

.journey-stats.journey-stats--c1 {
  grid-template-columns: minmax(0, 1fr);
}

.journey-stats > :last-child:nth-child(odd) {
  grid-column: 1 / -1;
}

@media (min-width: 768px) {
  .journey-stats.journey-stats--c3 {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .journey-stats.journey-stats--c4 {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .journey-stats > :last-child:nth-child(odd) {
    grid-column: auto;
  }
}

/* Values stay titanium white — only the label carries the HUD tone. */
.journey-stat__value {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(1.75rem, 6.5vw, 2.75rem);
  font-weight: 800;
  font-stretch: 125%;
  line-height: var(--lh-tight);
  letter-spacing: var(--ls-tight);
  color: var(--c-text);
  overflow-wrap: anywhere;
}

/* ── Text + image card ───────────────────────────────────────────────────── */
@media (min-width: 768px) {
  .journey-split--left .corner-card {
    order: -1;
  }
}

/* The card can hold more detail lines than the shared rule (3 grid rows) expects:
   about.js sets --card-rows to the number of rows the thumbnail has to span. */
@media (min-width: 1024px) {
  .corner-card__thumb {
    grid-row: 1 / span var(--card-rows, 3);
  }
}

/* ── Text block ──────────────────────────────────────────────────────────── */
.journey-prose--narrow > * {
  max-width: 68ch;
}

/* ── Pull quote ──────────────────────────────────────────────────────────── */
.journey-quote {
  margin: 0;
  padding: var(--sp-2) 0 var(--sp-2) var(--sp-4);
  max-width: 52rem;
  border-left: 3px solid var(--c-edge);
}

.journey-quote__text {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(1.25rem, 1rem + 1.6vw, 2rem);
  font-weight: 700;
  font-stretch: 112%;
  line-height: 1.25;
  letter-spacing: var(--ls-tight);
  color: var(--c-text);
}

.journey-quote__cite {
  display: block;
  margin-top: var(--sp-3);
  font-style: normal;
}

.journey-quote__cite a {
  color: inherit;
}

/* ── Video ───────────────────────────────────────────────────────────────── */
.journey-video {
  display: grid;
  gap: var(--sp-2);
  margin: 0;
  max-width: 56rem;
}

.journey-video--portrait {
  max-width: 24rem;
}

.journey-video figcaption {
  color: var(--c-text-muted);
}

/* ── Dashboard preview ───────────────────────────────────────────────────── */
.journey-hidden {
  outline: 1px dashed var(--c-line-strong);
  outline-offset: -1px;
}

.journey-hidden__ribbon {
  margin: 0;
  padding: var(--sp-1) var(--gutter);
  background: var(--c-raised);
  color: var(--c-text-faint);
  font-family: var(--font-hud);
  font-size: var(--fs-hud);
  letter-spacing: var(--ls-hud);
  text-transform: uppercase;
}

.journey-preview-note {
  position: fixed;
  left: 50%;
  bottom: calc(var(--tabbar-h) + var(--sp-4));
  z-index: var(--z-toast);
  transform: translateX(-50%);
  padding: var(--sp-2) var(--sp-3);
  background: var(--c-raised);
  border: 1px solid var(--c-line-strong);
  color: var(--c-text);
  font-family: var(--font-hud);
  font-size: var(--fs-hud);
  letter-spacing: var(--ls-hud);
  text-transform: uppercase;
  pointer-events: none;
}

@media (prefers-reduced-motion: reduce) {
  .about-chapter {
    transition: none;
  }
}
