/* Geo Story — full-screen scrollytelling map. Fonts reused from lovelanghe. */

@font-face {
  font-family: "Tiempos Headline";
  src: url("./fonts/TiemposHeadlineWeb-Bold.woff2") format("woff2");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Tiempos Text";
  src: url("./fonts/TiemposTextWeb-Regular.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Tiempos Text";
  src: url("./fonts/TiemposTextWeb-RegularItalic.woff2") format("woff2");
  font-weight: 400;
  font-style: italic;
  font-display: swap;
}
@font-face {
  font-family: "Founders Text";
  src: url("./fonts/FoundersGroteskTextWeb-Regular.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Founders Condensed";
  src: url("./fonts/FoundersGroteskCondensedWeb-Semibold.woff2") format("woff2");
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}

:root {
  --gs-paper: #f7f4ec;
  --gs-ink: #1d1a16;
  --gs-muted: #6a6055;
  --gs-accent: #7b1f3a;
  --gs-vini: #7b1f3a;
  --gs-nocciole: #a9742f;
  --gs-formaggi: #cda53b;
  --gs-frutta: #4a7c3f;
  --gs-condimenti: #c2561f;
  --gs-rail-width: clamp(320px, 32vw, 440px);
}

html,
body.geo-story {
  margin: 0;
  padding: 0;
  height: 100%;
  background: #11100e;
  color: var(--gs-ink);
  font-family: "Tiempos Text", Georgia, serif;
}

.geo-story__map {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
}

.geo-story__story {
  position: relative;
  z-index: 1;
}

.geo-story__step {
  display: flex;
  align-items: center;
  min-height: 100vh;
  padding: 12vh 6vw;
  box-sizing: border-box;
  opacity: 0.2;
  transition: opacity 0.45s ease;
}

.geo-story__step.is-active {
  opacity: 1;
}

.geo-story__step.is-left {
  justify-content: flex-start;
  /* Clear the left chapter rail so previously-left cards sit beside it,
     not under it (two-column feel). Reset on mobile, where the rail is a
     top bar. */
  padding-left: calc(var(--gs-rail-width) + 3vw);
}

.geo-story__step.is-right {
  justify-content: flex-end;
}

.geo-story__step.is-center {
  justify-content: center;
}

.geo-story__card {
  max-width: 380px;
  padding: 1.75rem 1.9rem;
  background: var(--gs-paper);
  border-radius: 3px;
  box-shadow: 0 12px 44px rgba(0, 0, 0, 0.4);
}

.geo-story__step--intro .geo-story__card,
.geo-story__step--closing .geo-story__card {
  max-width: 560px;
  text-align: center;
}

.geo-story__media {
  display: block;
  width: 100%;
  height: auto;
  margin: 0 0 1.1rem;
  border-radius: 2px;
}

.geo-story__eyebrow {
  margin: 0 0 0.5rem;
  font-family: "Founders Condensed", "Arial Narrow", sans-serif;
  font-weight: 600;
  font-size: 0.82rem;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--gs-accent);
}

.geo-story__title {
  margin: 0 0 0.9rem;
  font-family: "Tiempos Headline", Georgia, serif;
  font-weight: 700;
  font-size: clamp(1.6rem, 4vw, 2.3rem);
  line-height: 1.08;
}

.geo-story__step--intro .geo-story__title,
.geo-story__step--closing .geo-story__title {
  font-size: clamp(2rem, 6vw, 3.1rem);
}

.geo-story__body {
  font-size: 1.05rem;
  line-height: 1.55;
  color: #2a261f;
}

.geo-story__body strong {
  font-weight: 500;
}

.geo-story__km0 {
  margin: 1.2rem 0 0;
  padding: 0 0 0 1rem;
  border-left: 3px solid var(--gs-nocciole);
  font-style: italic;
  font-size: 0.98rem;
  line-height: 1.5;
  color: var(--gs-muted);
}

/* Company points are rendered as a Mapbox `circle` GL layer (see story.js):
   colored by category, scaled when active, dimmed when another is active.
   The --gs-* palette below feeds that layer (read via getComputedStyle). */

/* --- Chapter rail --------------------------------------------------------
   Persistent company panel: a full-height rail on the left (desktop) /
   sticky collapsing header up top (mobile). Driven by the scroll engine
   (story.js): filled on a company opener (hero/card stop), kept across its
   beats, swapped at the next company, hidden on intro/closing. The in-flow
   opener card is suppressed — the rail is its presentation. Skin = photo
   cover + scrim + light text (Option A), tinted per category. */
.geo-story__step--hero .geo-story__card,
.geo-story__step--card .geo-story__card {
  display: none;
}

.geo-story__chapter {
  position: fixed;
  inset: 0 auto 0 0;
  width: var(--gs-rail-width);
  z-index: 2;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  overflow-x: hidden;
  background: var(--gs-ink);
  color: var(--gs-paper);
  box-shadow: 8px 0 40px rgba(0, 0, 0, 0.45);
  scrollbar-width: thin;
  transition: opacity 0.5s ease;
}

/* Hidden on steps with no chapter (intro / closing) — a clean title screen. */
body.gs-no-chapter .geo-story__chapter,
body.gs-no-chapter .geo-story__chapter-bar {
  opacity: 0;
  pointer-events: none;
}

.geo-story__chapter-item {
  flex: none;
  border-bottom: 1px solid rgba(247, 244, 236, 0.1);
}

.geo-story__chapter-head {
  display: flex;
  align-items: baseline;
  gap: 0.6rem;
  width: 100%;
  padding: 0.95rem 1.4rem;
  border: 0;
  background: transparent;
  color: inherit;
  text-align: left;
  cursor: pointer;
  font-family: "Founders Text", "Helvetica Neue", sans-serif;
  transition: background 0.25s ease;
}

.geo-story__chapter-head:hover,
.geo-story__chapter-item.is-open .geo-story__chapter-head {
  background: rgba(247, 244, 236, 0.06);
}

.geo-story__chapter-num {
  flex: none;
  font-family: "Founders Condensed", "Arial Narrow", sans-serif;
  font-weight: 600;
  font-size: 0.85rem;
  letter-spacing: 0.12em;
  color: rgba(247, 244, 236, 0.55);
}

.geo-story__chapter-name {
  flex: 1 1 auto;
  font-size: 1rem;
  line-height: 1.2;
}

.geo-story__chapter-town {
  flex: none;
  max-width: 42%;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  font-size: 0.78rem;
  color: rgba(247, 244, 236, 0.55);
}

.geo-story__chapter-panel {
  position: relative;
  height: 0;
  overflow: hidden;
  opacity: 0;
  transition: height 0.7s ease-in-out, opacity 0.7s ease-in-out;
}

.geo-story__chapter-item.is-open .geo-story__chapter-panel {
  height: 75vh;
  opacity: 1;
}

.geo-story__chapter-media {
  position: absolute;
  inset: 0;
  z-index: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.geo-story__chapter-panel::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  background: linear-gradient(
    to top,
    rgba(17, 16, 14, 0.95) 0%,
    rgba(17, 16, 14, 0.6) 50%,
    rgba(17, 16, 14, 0.2) 100%
  );
}

.geo-story__chapter-text {
  position: absolute;
  inset: auto 0 0 0;
  z-index: 2;
  padding: 1.6rem 1.5rem 1.9rem;
}

.geo-story__chapter .geo-story__eyebrow {
  color: var(--gs-paper);
  opacity: 0.82;
}

.geo-story__chapter .geo-story__title {
  margin: 0 0 0.6rem;
  color: var(--gs-paper);
  font-size: clamp(1.8rem, 2.6vw, 2.6rem);
}

.geo-story__chapter .geo-story__body {
  font-size: 0.98rem;
  color: rgba(247, 244, 236, 0.9);
}

.geo-story__chapter .geo-story__km0 {
  color: rgba(247, 244, 236, 0.8);
  border-left-color: var(--chapter-accent, var(--gs-paper));
}

.geo-story__chapter-bar {
  display: none;
}

@media (max-width: 768px) {
  .geo-story__step {
    justify-content: center;
    padding: 9vh 5vw;
  }

  .geo-story__step.is-left {
    padding-left: 5vw;
  }

  .geo-story__card {
    max-width: 100%;
  }

  /* Chapter index -> off-canvas drawer, opened by the bar trigger. */
  .geo-story__chapter {
    width: min(86vw, 360px);
    padding-top: 3rem;
    transform: translateX(-100%);
    transition: transform 0.45s ease-in-out;
    box-shadow: 6px 0 40px rgba(0, 0, 0, 0.5);
  }

  body.gs-drawer-open .geo-story__chapter {
    transform: translateX(0);
  }

  .geo-story__chapter-bar {
    position: fixed;
    inset: 0 0 auto 0;
    z-index: 3;
    display: flex;
    align-items: center;
    gap: 0.8rem;
    padding: 0.7rem 1.1rem;
    background: rgba(17, 16, 14, 0.9);
    color: var(--gs-paper);
    -webkit-backdrop-filter: blur(6px);
    backdrop-filter: blur(6px);
    transition: opacity 0.4s ease;
  }

  .geo-story__chapter-toggle {
    flex: none;
    border: 0;
    background: transparent;
    color: var(--gs-paper);
    font-family: "Founders Condensed", "Arial Narrow", sans-serif;
    font-size: 0.85rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    cursor: pointer;
  }

  .geo-story__chapter-current {
    flex: 1 1 auto;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
    font-size: 0.95rem;
  }
}
