/* berlin.css - cleaned version */

#berlin.berlin-story-section {
  --story-scroll-length: 620vh;
  --story-card-height: 84vh;
  --story-card-top: 8vh;
  --story-tabs-height: 60px;
  --story-stage-height: calc(var(--story-card-height) - var(--story-tabs-height));

  position: relative;
  min-height: var(--story-scroll-length);
  padding-bottom: 0;
}

#berlin.berlin-story-section.is-locations-tab {
  min-height: 0;
  padding-bottom: 0;
}

.berlin-story-intro {
  margin: 0 0 1rem;
  color: var(--t2);
  line-height: 1.7;
}

.berlin-story-card {
  position: sticky;
  top: var(--story-card-top);
  height: var(--story-card-height);
  min-height: var(--story-card-height);
  overflow: hidden;
  padding: 0;
}

#berlin.berlin-story-section.is-locations-tab .berlin-story-card {
  position: relative;
  top: 0;
  height: auto;
  min-height: 0;
  overflow: visible;
}

.berlin-tabs {
  display: flex;
  min-height: var(--story-tabs-height, 60px);
  border-bottom: 1px solid var(--line);
  background: rgba(0, 0, 0, 0.04);
}

:root.dark .berlin-tabs {
  background: rgba(255, 255, 255, 0.04);
}

.berlin-tab {
  flex: 1 1 0;
  border: 0;
  border-right: 1px solid var(--line);
  border-radius: 0;
  background: transparent;
  font-size: 17px;
  color: var(--t2);
}

.berlin-tab:last-child {
  border-right: 0;
}

.berlin-tab.is-active {
  background: rgba(31, 88, 112, 0.12);
  color: var(--t1);
}

:root.dark .berlin-tab.is-active {
  background: rgba(109, 182, 214, 0.16);
}

.berlin-panel {
  display: block;
}

.berlin-panel[hidden] {
  display: none !important;
}

.berlin-story-layout {
  display: grid;
  grid-template-columns: 120px minmax(0, 1fr);
  height: var(--story-stage-height);
  min-height: 0;
}

.berlin-story-timeline {
  --axis-x: 28px;
  --text-x: 50px;
  --dot-size: 10px;
  --marker-size: 14px;
  --active-marker-y-offset: -6px;

  position: relative;
  padding: 32px 10px 28px 0;
  border-right: 1px solid var(--line);
}

.berlin-story-rail {
  position: absolute;
  top: 34px;
  bottom: 34px;
  left: var(--axis-x);
  width: 1px;
  background: linear-gradient(180deg, transparent 0%, var(--line) 8%, var(--line) 92%, transparent 100%);
}

.berlin-story-marker {
  position: absolute;
  left: calc(var(--axis-x) - (var(--marker-size) / 2));
  width: var(--marker-size);
  height: var(--marker-size);
  box-sizing: border-box;
  border-radius: 999px;
  background: var(--brand);
  border: 2px solid var(--paper);
  box-shadow: 0 0 0 3px rgba(31, 88, 112, 0.16);
  transition: top .25s ease;
  transform: translateY(var(--active-marker-y-offset));
}

:root.dark .berlin-story-marker {
  background: var(--brand);
  box-shadow: 0 0 0 3px rgba(109, 182, 214, 0.2);
}

.berlin-story-steps {
  display: grid;
  gap: 16px;
}

.berlin-story-step {
  position: relative;
  display: grid;
  grid-template-columns: var(--text-x) minmax(0, 1fr);
  gap: 0;
  align-items: start;
  color: var(--t3);
  transition: color .2s ease;
}

.berlin-story-step.is-active {
  color: var(--t1);
}

.berlin-story-dot {
  width: var(--dot-size);
  height: var(--dot-size);
  box-sizing: border-box;
  margin-top: 3px;
  margin-left: calc(var(--axis-x) - (var(--dot-size) / 2));
  border-radius: 999px;
  border: 1px solid var(--brand);
  background: var(--paper);
}

.berlin-story-step.is-active .berlin-story-dot {
  background: var(--brand);
}

.berlin-story-step strong,
.berlin-story-step span {
  display: block;
  min-width: 0;
  overflow-wrap: anywhere;
  hyphens: auto;
}

.berlin-story-step strong {
  margin-bottom: 2px;
  color: inherit;
  font-size: 13px;
}

.berlin-story-step span {
  color: inherit;
  font-size: 12px;
  line-height: 1.4;
}

.berlin-stage {
  position: relative;
  height: 100%;
  min-height: 0;
  overflow: hidden;
  isolation: isolate;
}

.berlin-scene-stack,
.berlin-text-stack {
  position: absolute;
  inset: 0;
  height: 100%;
}

.berlin-scene-stack {
  z-index: 0;
}

.berlin-text-stack {
  z-index: 20;
  pointer-events: none;
}

.berlin-scene {
  position: absolute;
  inset: 0;
  height: 100%;
  opacity: 0;
  transition: opacity .45s ease;
}

.berlin-scene.is-active {
  opacity: 1;
}

.berlin-story-layer {
  position: absolute;
  top: -5%;
  right: auto;
  bottom: auto;
  left: -18%;
  width: 136%;
  height: 110%;
  max-width: none;
  max-height: none;
  object-fit: cover;
  object-position: center center;
  pointer-events: none;
  user-select: none;
  transition: transform .35s ease;
}

.berlin-story-shade {
  position: absolute;
  top: -30px;
  right: -2px;
  bottom: -30px;
  left: auto;
  width: 58%;
  height: auto;
  z-index: 10;
  pointer-events: none;
  background:
    linear-gradient(
      270deg,
      rgba(28, 26, 24, 0.72) 0%,
      rgba(28, 26, 24, 0.42) 28%,
      rgba(28, 26, 24, 0.16) 54%,
      rgba(28, 26, 24, 0.00) 100%
    );
}

:root.dark .berlin-story-shade {
  background:
    linear-gradient(
      270deg,
      rgba(0, 0, 0, 0.76) 0%,
      rgba(0, 0, 0, 0.42) 28%,
      rgba(0, 0, 0, 0.14) 52%,
      rgba(0, 0, 0, 0.00) 76%
    ),
    radial-gradient(circle at top right, rgba(109, 182, 214, 0.1), transparent 34%);
}

.berlin-text-card {
  position: absolute;
  right: 28px;
  bottom: 24px;
  left: min(44%, 420px);
  z-index: 21;
  transform: translateY(18px);
  opacity: 0;
  padding: 22px 62px 24px 24px;
  border: 1px solid rgba(223, 212, 191, 0.8);
  border-radius: 18px;
  background: rgba(255, 253, 250, 0.86);
  box-shadow: 0 22px 46px rgba(30, 30, 30, 0.14);
  transition: opacity .28s ease, transform .28s ease, padding .28s ease, min-height .28s ease;
  pointer-events: none;
}

:root.dark .berlin-text-card {
  border-color: rgba(85, 85, 85, 0.9);
  background: rgba(42, 41, 39, 0.86);
  box-shadow: 0 22px 46px rgba(0, 0, 0, 0.32);
}

.berlin-text-card.is-active {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.berlin-text-card.is-collapsed {
  min-height: 118px;
  padding-bottom: 18px;
}

.berlin-story-toggle {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 34px;
  height: 34px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.82);
  color: var(--t1);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 2;
}

:root.dark .berlin-story-toggle {
  background: rgba(0, 0, 0, 0.28);
}

.berlin-story-toggle:hover {
  background: #fff;
}

:root.dark .berlin-story-toggle:hover {
  background: rgba(0, 0, 0, 0.42);
}

.berlin-story-toggle:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
}

.berlin-story-toggle-icon {
  position: relative;
  display: block;
  width: 12px;
  height: 12px;
}

.berlin-story-toggle-icon::before,
.berlin-story-toggle-icon::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  border-radius: 999px;
  background: currentColor;
  transform: translate(-50%, -50%);
  transition: opacity .2s ease, transform .2s ease;
}

.berlin-story-toggle-icon::before {
  width: 12px;
  height: 2px;
}

.berlin-story-toggle-icon::after {
  width: 2px;
  height: 12px;
}

.berlin-text-card:not(.is-collapsed) .berlin-story-toggle-icon::after {
  opacity: 0;
  transform: translate(-50%, -50%) scaleY(.35);
}

.berlin-kicker {
  display: inline-block;
  margin-bottom: .5rem;
  font-size: 12px;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--brand);
  font-family: var(--ff-accent);
}

.berlin-text-card h3 {
  margin: 0 0 .55rem;
  font-family: var(--ff-display);
  font-size: 1.5rem;
  line-height: 1.15;
  color: var(--t1);
}

.berlin-text-card.is-collapsed h3 {
  margin-bottom: 0;
}

.berlin-text-card-body {
  display: grid;
  gap: .9rem;
  max-height: 480px;
  overflow: hidden;
  opacity: 1;
  visibility: visible;
  transition: max-height .28s ease, opacity .18s ease;
}

.berlin-text-card.is-collapsed .berlin-text-card-body {
  max-height: 0;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.berlin-text-card p {
  margin: 0;
  color: var(--t2);
  line-height: 1.65;
  font-size: 15.5px;
}

.berlin-chapter-no {
  position: absolute;
  right: 16px;
  bottom: 12px;
  font-family: var(--ff-display);
  font-size: clamp(44px, 6vw, 72px);
  color: rgba(31, 88, 112, 0.1);
  pointer-events: none;
}

:root.dark .berlin-chapter-no {
  color: rgba(109, 182, 214, 0.12);
}

.berlin-story-link {
  margin-top: 0;
}

.berlin-story-mobile-progress {
  display: none;
  z-index: 30;
}

.berlin-locations-pane {
  display: grid;
  gap: 14px;
  padding: 18px;
  min-height: 0;
}

.berlin-locations-intro {
  margin: 0;
  color: var(--t2);
  line-height: 1.6;
}

.berlin-locations-toolbar {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 12px;
}

.berlin-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.berlin-legend-item,
.berlin-rembetix-filter {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: .4rem .6rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: var(--t2);
  font-family: var(--ff-accent);
  font-size: 13px;
}

:root.dark .berlin-legend-item,
:root.dark .berlin-rembetix-filter {
  background: rgba(0, 0, 0, 0.24);
  color: var(--t2);
}

.berlin-legend-item input,
.berlin-rembetix-filter input {
  accent-color: var(--brand);
}

.berlin-category-dot {
  width: 11px;
  height: 11px;
  border-radius: 999px;
  display: inline-block;
  border: 1px solid rgba(255, 255, 255, 0.35);
}

.berlin-map-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 16px;
  align-items: start;
}

.berlin-map-card {
  min-width: 0;
}

.berlin-map-canvas {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: #d8ccb6;
  box-shadow: 0 20px 34px rgba(30, 30, 30, 0.08);
}

:root.dark .berlin-map-canvas {
  background: #111;
  box-shadow: 0 20px 34px rgba(0, 0, 0, 0.24);
}

.berlin-map-canvas img {
  display: block;
  width: 100%;
  height: auto;
  user-select: none;
}

.berlin-marker-layer {
  position: absolute;
  inset: 0;
}

.berlin-marker {
  position: absolute;
  width: 18px;
  height: 18px;
  transform: translate(-50%, -50%);
  border: 2px solid var(--paper);
  border-radius: 999px;
  box-shadow: 0 0 0 3px rgba(28, 26, 24, 0.12), 0 8px 16px rgba(0, 0, 0, 0.18);
  cursor: pointer;
}

:root.dark .berlin-marker {
  border-color: #111;
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.08), 0 8px 16px rgba(0, 0, 0, 0.32);
}

.berlin-marker::after {
  content: "";
  position: absolute;
  inset: -6px;
  border: 1px solid currentColor;
  border-radius: 999px;
  opacity: .32;
}

.berlin-marker.is-active {
  transform: translate(-50%, -50%) scale(1.16);
  z-index: 2;
}

.berlin-info-panel {
  position: sticky;
  top: 18px;
  min-height: 360px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--paper);
}

:root.dark .berlin-info-panel {
  background: rgba(42, 41, 39, 0.9);
}

.berlin-info-empty {
  margin: 0;
  color: var(--t3);
  line-height: 1.6;
}

.berlin-category-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-bottom: .5rem;
  color: var(--t2);
  font-size: 13px;
  font-family: var(--ff-accent);
}

.berlin-panel-title {
  margin: 0 0 .55rem;
  font-family: var(--ff-display);
  font-size: 1.5rem;
  line-height: 1.15;
  color: var(--t1);
}

.berlin-panel-description {
  margin: 0 0 1rem;
  color: var(--t2);
  line-height: 1.65;
}

.berlin-panel-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 1rem;
}

.berlin-panel-links a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: .4rem .7rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--t1);
  text-decoration: none;
  font-family: var(--ff-accent);
  font-size: 13px;
}

.berlin-panel-links a:hover {
  background: #efe6d5;
}

:root.dark .berlin-panel-links a:hover {
  background: rgba(255, 255, 255, 0.08);
}

.berlin-events-title {
  margin: 0 0 .55rem;
  font-size: 14px;
  color: var(--t1);
}

.berlin-event-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 10px;
}

.berlin-event-item {
  padding: .7rem;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(239, 230, 213, 0.35);
}

:root.dark .berlin-event-item {
  background: rgba(0, 0, 0, 0.18);
}

.berlin-event-head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: .4rem;
  color: var(--t1);
  font-size: 14px;
  font-weight: 600;
}

.berlin-event-description {
  margin: 0;
  color: var(--t2);
  line-height: 1.55;
  font-size: 14px;
}

.berlin-event-poster {
  display: block;
  width: 100%;
  max-width: 180px;
  margin-top: .65rem;
  border: 1px solid var(--line);
  border-radius: 12px;
}

@media (max-width: 980px) {
  #berlin.berlin-story-section:not(.is-locations-tab) {
    --story-scroll-length: 560vh;
  }

  .berlin-map-layout {
    grid-template-columns: 1fr;
  }

  .berlin-info-panel {
    position: static;
    min-height: 0;
    margin-top: 14px;
  }
}

@media (max-width: 900px) {
  #berlin.berlin-story-section:not(.is-locations-tab) {
    --story-scroll-length: 460vh;
    --story-card-height: 88vh;
    --story-card-top: 6vh;
  }

  .berlin-story-layout {
    grid-template-columns: 96px minmax(0, 1fr);
  }

  .berlin-text-card {
    left: 34%;
  }
}

@media (max-width: 720px) {
  #berlin.berlin-story-section:not(.is-locations-tab) {
    --story-scroll-length: 430vh;
  }

  .berlin-story-layout {
    display: block;
    height: var(--story-stage-height);
    min-height: 0;
  }

  .berlin-story-timeline {
    display: none;
  }

  .berlin-stage {
    height: var(--story-stage-height);
    min-height: 0;
  }

  .berlin-story-mobile-progress {
    position: absolute;
    top: 14px;
    left: 16px;
    right: 16px;
    display: flex;
    gap: 6px;
    z-index: 30;
  }

  .berlin-story-mobile-progress span {
    flex: 1;
    height: 3px;
    border-radius: 999px;
    background: rgba(31, 88, 112, 0.16);
  }

  .berlin-story-mobile-progress span.is-active {
    background: var(--brand);
  }

  .berlin-story-layer {
    top: -6%;
    left: -34%;
    width: 168%;
    height: 112%;
  }

  .berlin-text-card {
    left: 16px;
    right: 16px;
    bottom: 18px;
    padding: 18px 54px 20px 18px;
  }

  .berlin-text-card.is-collapsed {
    min-height: 108px;
    padding-bottom: 16px;
  }

  .berlin-story-toggle {
    top: 12px;
    right: 12px;
    width: 32px;
    height: 32px;
  }

  .berlin-kicker {
    font-size: 11px;
  }

  .berlin-text-card h3 {
    font-size: 1.5rem;
  }

  .berlin-text-card p {
    font-size: 15px;
  }

  .berlin-chapter-no {
    font-size: 54px;
  }

  .berlin-locations-pane {
    padding: 14px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .berlin-scene,
  .berlin-text-card,
  .berlin-text-card-body,
  .berlin-story-marker,
  .berlin-story-layer {
    transition: none !important;
  }

  .berlin-story-toggle-icon::before,
  .berlin-story-toggle-icon::after {
    transition: none !important;
  }

  .berlin-story-layer {
    transform: none !important;
  }
}
