/* --- Base ----------------------------------------------------- */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --z-nav: 120000;
  --z-modal: 110000;
  --tl-border: #ddd;
  --tl-shadow: rgba(0, 0, 0, 0.05);
  --tl-related-shadow: rgba(0, 0, 0, 0.1);
  --tl-primary: #4c8bf5;
  --tl-primary-shadow: rgba(76, 139, 245, 0.25);
}

body {
  font-family: "Inter", sans-serif;
  background-color: #fafafa;
  color: #333;
}

body.landing-page {
  height: 100vh;
  overflow: hidden;
}

body.detail-page {
  height: auto;
  overflow: visible;
}

/* --- Shared navigation ---------------------------------------- */
.top-nav {
  display: flex;
  gap: 12px;
  justify-content: center;
  align-items: center;
  padding: 12px 16px;
  background: #fff;
  border-bottom: 1px solid rgba(0, 0, 0, 0.12);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.04);
  position: sticky;
  top: 0;
  z-index: var(--z-nav);
}

.top-nav .nav-link {
  color: #555;
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 14px;
  text-decoration: none;
  transition: background-color 0.2s ease, color 0.2s ease, transform 0.2s ease;
}

.top-nav .nav-link:hover {
  color: #111;
  background: #f8f8f8;
  transform: translateY(-1px);
}

.top-nav .nav-link.is-active {
  color: #111;
  background: rgba(0, 0, 0, 0.08);
  font-weight: 600;
}

.top-nav .nav-link:focus-visible {
  outline: 2px solid #4c8bf5;
  outline-offset: 2px;
}

.hidden {
  display: none !important;
}

/* --- Mobile alert (small screens) ----------------------------- */
.mobile-alert {
  display: none;
  position: fixed;
  inset: 0;
  background: #fff;
  z-index: 9999;

  /* center msg */
  justify-content: center;
  align-items: center;
  text-align: center;
  padding: 1rem;
}

/* --- Landing layout ------------------------------------------- */
.landing-left {
  position: fixed;
  top: 0;
  left: 0;
  width: 330px;
  height: 100vh;
  background: #fff;
  border-right: 1px solid #ccc;

  display: flex;
  align-items: center;
  justify-content: center;
}

.landing-left-content {
  max-width: 350px;
  padding: 1rem;
  text-align: left;
  color: #333;
}

.landing-left-content .intro-text,
.landing-left-content .intro-text-bold {
  margin: 1rem 0;
  font-size: 0.95rem;
  line-height: 1.6;
}

.landing-left-content .intro-text-bold {
  font-weight: 600;
}

.landing-left-content .click-text {
  margin-top: 2rem;
  font-size: 1rem;
  font-weight: 600;
  color: #222;
  text-align: center;
}

.landing-right {
  margin-left: 320px;
  height: 100vh;
  overflow-y: auto;
  padding: 2rem;
}

.landing-right h1 {
  margin-bottom: 1rem;
}

.landing-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
}

.landing-grid img {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  border: 1px solid #ccc;
  border-radius: 4px;
  transition: transform 0.2s ease;
}

.landing-grid img:hover {
  transform: scale(1.02);
}

/* gallery item + caption */
.gallery-item {
  position: relative;
  display: inline-block;
  cursor: pointer;
}

.gallery-item img {
  display: block;
  width: 100%;
  height: auto;
}

.image-caption {
  display: none;
  position: absolute;
  left: 0;
  bottom: 0;
  background-color: #000;
  color: #fff;
  opacity: 0.9;
  padding: 0.5rem;
  font-size: 0.9rem;
  line-height: 1.2;
  pointer-events: none;
  white-space: pre-line;
}

.gallery-item:hover .image-caption {
  display: block;
}

/* mobile: hide layout, show alert */
@media (max-width: 700px) {
  .landing-left,
  .landing-right {
    display: none;
  }

  .mobile-alert {
    display: flex !important;
  }
}

/* --- Detail page layout --------------------------------------- */
.page-container {
  max-width: 80%;
  margin: 0 auto;
  padding: 1rem 0;
}

header {
  background-color: #fff;
  border: 1px solid #ccc;
  border-radius: 6px;
  margin: 1rem 0;
  padding: 1rem;
}

#artwork-info {
  display: flex;
  gap: 1rem;
  margin-top: 1rem;
}

#artwork-info img {
  max-width: 35%;
  width: 100%;
  height: auto;
  border: 1px solid #ccc;
  border-radius: 4px;
  object-fit: cover;
}

#artwork-description {
  flex: 1;
}

/* shared card-ish look */
.object-header,
.content-section,
.column {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.content-section {
  background-color: #fff;
  border: 1px solid #ccc;
  border-radius: 6px;
  margin: 1rem 0;
  padding: 1rem;
}

/* object header */
.object-header {
  display: flex;
  align-items: flex-start;
  gap: 2rem;
  padding: 1rem;
  background-color: #fff;
  border: 1px solid #ccc;
  border-radius: 6px;
  margin: 1rem 0;
}

#image-col {
  flex: 0 0 30%;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

#image-col img {
  max-width: 100%;
  height: auto;
  border: 1px solid #ccc;
  border-radius: 4px;
  object-fit: cover;
}

#artwork-image {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  display: block;
}

.wall-label {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.wall-label h2 {
  font-size: 1.3rem;
  margin-bottom: 0.3rem;
}

.wall-label h3 {
  font-size: 1rem;
  color: #555;
  margin-bottom: 0.3rem;
}

.paint-medium {
  font-size: 1rem;
  color: #555;
}

#intro-text,
#current-museum {
  font-size: 1rem;
  color: #333;
}

.label-spacer {
  margin: 0.5rem 0;
}

@media (max-width: 700px) {
  .object-header {
    flex-direction: column;
    gap: 1rem;
  }

  #image-col,
  .wall-label {
    flex: 0 0 auto;
    width: 100%;
  }
}

/* --- Map ------------------------------------------------------- */
#map-container {
  position: relative;
  height: 600px;
  width: 100%;
  border: 1px solid #ccc;
  border-radius: 6px;
  overflow: hidden;
  background-color: #eee;
  margin-bottom: 0;
}
#map-container h2 {
  position: absolute;
  top: 20px;
  right: 20px;
  z-index: 1000;

}
#map {
  width: 100%;
  height: 100%;
}

.map-label {
  background: rgba(255, 255, 255, 0.5);
  padding: 2px 5px;
  border-radius: 3px;
  font-size: 0.8rem;
  width: auto !important;
  height: auto !important;
}

.map-badge {
  background: #e74c3c;
  color: #fff;
  text-align: center;
  border-radius: 50%;
  width: 22px;
  height: 22px;
  line-height: 22px;
  font-size: 0.8rem;
}

.overlay-btn {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 999;
  background-color: #fff;
  border: 1px solid #aaa;
  border-radius: 4px;
  padding: 0.5rem 1rem;
  cursor: pointer;
  font-size: 0.9rem;
  outline: none;
}

.overlay-btn:hover {
  background-color: #eee;
}

/* --- Story section -------------------------------------------- */
#story-section {
  padding: 1rem;
}

.story-grid-container {
  display: grid;
  grid-template-rows: 1fr auto;
  grid-template-columns: 1fr 1.2fr 1.8fr;
  gap: 1rem;
  height: 500px;
  width: 100%;
}

#story-section .overlay-col {
  height: 105%;
}

#story-section .overlay-nav {
  grid-column: 1 / -1;
  display: flex;
  margin-top: 1rem;
  border-top: 1px solid #eee;
  height: auto;
}

.story-network-legend {
  margin-top: 2rem;
  padding-top: 0.55rem;
}

.story-network-legend .legend-swatch {
  border-radius: 2px;
}

/* shared overlay column */
.overlay-col {
  background-color: #fafafa;
  border: 1px solid #ddd;
  border-radius: 4px;
  padding: 1rem;
  overflow-y: auto;
  height: 100%;
}

.overlay-col::-webkit-scrollbar {
  width: 0px;
}

.overlay-col::-webkit-scrollbar-thumb {
  background: #ccc;
}

.col-middle {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 0 !important;
}

.col-middle svg {
  border: 0 !important;
}

.col-left img {
  max-width: 100%;
  max-height: 300px;
  object-fit: cover;
}

/* story nav buttons */
.overlay-nav button {
  flex: 1;
  width: 50%;
  background: none;
  border: none;
  border-radius: 0;
  box-shadow: none;
  font-size: 1rem;
  color: #555;
  padding: 1rem 2rem;
  cursor: pointer;

  display: flex;
  align-items: center;
  transition: background-color 0.4s ease, color 0.4s ease;
}

#prev-event {
  justify-content: flex-start;
}

#next-event {
  justify-content: flex-end;
}

.overlay-nav .arrow {
  font-size: 20px;
  transition: transform 0.4s cubic-bezier(0.19, 1, 0.22, 1);
}

.overlay-nav .nav-text {
  max-width: 0;
  opacity: 0;
  white-space: nowrap;
  overflow: hidden;
  transition: max-width 0.5s cubic-bezier(0.19, 1, 0.22, 1),
    opacity 0.2s ease 0.1s;
}

.overlay-nav button:hover {
  background-color: #f8f8f8;
  color: #111;
}

.overlay-nav button:hover .nav-text {
  max-width: 150px;
  opacity: 1;
}

#prev-event .arrow {
  margin-right: 0.75em;
}

#prev-event:hover .arrow {
  transform: translateX(-4px);
}

#next-event .arrow {
  margin-left: 0.75em;
}

#next-event:hover .arrow {
  transform: translateX(4px);
}

.overlay-nav button.is-hidden {
  opacity: 0;
  pointer-events: none;
  cursor: default;
}

/* --- Overlay base --------------------------------------------- */
#overlay-content {
  background-color: #fff;
  width: 85%;
  max-width: 1200px;
  height: 90%;
  max-height: 90%;
  border-radius: 8px;
  padding: 1rem;

  display: grid;
  grid-template-rows: 90% 5%;
  grid-template-columns: 1fr 1.2fr 1.8fr;
  gap: 1rem;

  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
  overflow: hidden;
}

#overlay-event-text {
  max-height: 100%;
  overflow-y: auto;
  padding: 10px;
}

#overlay-event-text > p + p {
  margin-top: 1.375rem;
}

#overlay-close {
  color: black !important;
  position: absolute;
  top: 5%;
  right: 8%;
  z-index: 100000;
}

/* generic close */
.close {
  position: absolute;
  top: 0.5rem;
  right: 1rem;
  font-size: 1.5rem;
  font-weight: bold;
  cursor: pointer;
}

.close:hover {
  color: red;
}

.link-label {
  fill: #666;
  font-size: 12px;
  pointer-events: none;
}

/* --- Full network overlay ------------------------------------- */
#full-network-overlay,
#social-network-overlay {
  position: fixed;
  inset: 0;
  background-color: rgba(0, 0, 0, 0.6);
  z-index: var(--z-modal);

  display: flex;
  justify-content: center;
  align-items: center;
  padding: 70px 16px 16px;
}

#full-network-content,
#social-network-content {
  background-color: #fff;
  width: 80%;
  max-width: 1200px;
  border-radius: 8px;
  padding: 1rem;
  position: relative;

  display: flex;
  flex-direction: column;
  gap: 1rem;

  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}

#full-network-content {
  min-height: 50%;
}

#social-network-content {
  min-height: 80%;
  max-height: calc(100vh - 86px);
}

#full-network-content h2,
#social-network-content h2 {
  margin: 0.5rem 0;
  text-align: center;
}

#full-network-diagram,
#social-network-diagram {
  flex: 1;
  border: 1px solid #ccc;
  border-radius: 6px;
  background: #fff;
  overflow: hidden;
}

#social-network-content svg {
  border: none !important;
}

#full-network-close {
  position: absolute;
  top: 0.5rem;
  right: 1rem;
  font-size: 1.5rem;
  font-weight: bold;
  cursor: pointer;
}

#full-network-close:hover {
  color: red;
}

.network-footer {
  font-size: 0.9rem;
  color: #555;
  text-align: left;
}

/* --- Lightbox -------------------------------------------------- */
#image-lightbox,
#event-network-lightbox {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  z-index: var(--z-modal);
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 70px 16px 16px;
}

#image-lightbox.hidden {
  display: none;
}

.lightbox-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  max-width: 90vw;
  max-height: calc(100vh - 86px);
}

#lightbox-img {
  max-width: 100%;
  max-height: 70vh;
  object-fit: contain;
  border: 2px solid #fff;
  border-radius: 4px;
}

#lightbox-text {
  display: block;
  margin-top: 0.5rem;
  padding: 0.5rem;
  background: #fff;
  border-radius: 4px;
  max-width: 100%;
  text-align: center;
}

#lightbox-close {
  position: absolute;
  top: 70px;
  right: 2rem;
  font-size: 2rem;
  color: #fff;
  cursor: pointer;
}

.event-network-lightbox-content {
  position: relative;
  padding: 1rem;
  background: #fff;
  border-radius: 6px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}

.event-network-lightbox-content h3 {
  width: 100%;
  padding-right: 52px;
}

#event-network-close {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 1;
  display: block;
  width: 32px;
  height: 32px;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: #333;
  box-shadow: none;
  font: inherit;
  font-size: 1.75rem;
  line-height: 1;
  cursor: pointer;
}

#event-network-close:hover {
  color: #111;
  background: transparent;
}

#event-network-close:focus-visible {
  outline: 2px solid #4c8bf5;
  outline-offset: 2px;
}

/* --- Buttons --------------------------------------------------- */
.back-btn {
  background: none;
  border: 1px solid #ddd;
  border-radius: 6px;
  color: #555;

  font-size: 0.9rem;
  padding: 0.75rem 1.5rem;
  cursor: pointer;

  transition: transform 0.3s cubic-bezier(0.19, 1, 0.22, 1),
    box-shadow 0.3s cubic-bezier(0.19, 1, 0.22, 1),
    background-color 0.3s ease,
    color 0.3s ease;
}

.back-btn:hover {
  color: #111;
  background-color: #fff;
  transform: translateY(-3px);
  box-shadow: 0 6px 15px rgba(0, 0, 0, 0.08);
}

.back-btn .arrow {
  margin-right: 0.5em;
}

.icon-btn {
  position: absolute;
  bottom: 10px;
  right: 10px;
  z-index: 99;

  background: #fff;
  border: 1px solid #ddd;
  border-radius: 50%;
  color: #555;

  width: 40px;
  height: 40px;
  padding: 0;

  display: flex;
  align-items: center;
  justify-content: center;

  font-size: 1.2rem;
  cursor: pointer;

  transition: transform 0.3s cubic-bezier(0.19, 1, 0.22, 1),
    box-shadow 0.3s cubic-bezier(0.19, 1, 0.22, 1),
    background-color 0.3s ease,
    color 0.3s ease;
}

.icon-btn:hover {
  color: #000;
  background-color: #fff;
  transform: scale(1.1) rotate(-10deg);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

/* --- Instructions modal + floating icon ------------------------ */
#instructions-modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  z-index: var(--z-modal);

  display: flex;
  justify-content: center;
  align-items: center;
  padding: 70px 24px 24px;
}

.instructions-modal-content {
  background: #fff;
  width: 90%;
  max-width: 900px;
  max-height: calc(100vh - 94px);
  padding: 0;
  border-radius: 10px;
  position: relative;
  overflow: hidden;
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.4);

  font-family: "Arial", sans-serif;
  text-align: left;
  line-height: 1.6;
  animation: fadeIn 0.3s ease-in-out;
}

.instructions-modal-scroll {
  max-height: calc(100vh - 94px);
  padding: 2rem;
  overflow-y: auto;
}

.instructions-modal-content h2 {
  font-size: 1.4rem;
  margin-bottom: 1rem;
  color: #333;
  text-align: center;
}

.instructions-modal-content p {
  font-size: 1rem;
  color: #555;
}

.instructions-modal-content ul {
  padding-left: 20px;
}

.instructions-modal-content li {
  margin-bottom: 0.5rem;
  font-size: 0.95rem;
}

.instructions-close {
  position: absolute;
  top: 10px;
  right: 15px;
  font-size: 1.5rem;
  font-weight: bold;
  cursor: pointer;
  z-index: 1;
  transition: color 0.2s ease-in-out;
}

.instructions-close:hover {
  color: #e74c3c;
}

#instructions-icon {
  position: fixed;
  bottom: 20px;
  right: 20px;
  width: 45px;
  height: 45px;
  border-radius: 50%;
  background: #f39c12;
  color: #fff;
  cursor: pointer;
  z-index: 3001;

  font-size: 1.5rem;
  display: flex;
  justify-content: center;
  align-items: center;

  transition: transform 0.2s ease-in-out, width 0.2s ease-in-out,
    border-radius 0.2s ease-in-out;
  box-shadow: 0 0 10px rgba(243, 156, 18, 0.6);
}

#instructions-icon:hover {
  transform: scale(1.1);
  width: 150px;
  height: 45px;
  font-size: 1.2rem;
  border-radius: 25px;
}

#instructions-icon:hover span {
  display: none;
}

#instructions-icon:hover:before {
  content: "Instructions";
}

#instructions-text {
  display: none;
  position: absolute;
  bottom: 50%;
  right: 110%;
  transform: translateY(50%);
  background: #333;
  color: #fff;
  padding: 5px 8px;
  border-radius: 5px;
  font-size: 0.75rem;
  white-space: nowrap;
}

#instructions-icon:hover #instructions-text {
  display: block;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* --- Two-column section --------------------------------------- */
.two-column-container {
  display: flex;
  gap: 1.5rem;
  margin: 1.5rem 0;
}

.column {
  flex: 1;
  min-width: 0;
}

#social-network-container {
  background-color: #fff;
  border: 1px solid #ccc;
  border-radius: 6px;
  padding: 1.5rem;
  height: 600px;
  display: flex;
  flex-direction: column;
}

#social-network-container h2 {
  text-align: left;
  margin-bottom: 1rem;
}

.placeholder-content {
  flex: 1 1 auto;
  background-color: #f0f0f0;
  border-radius: 4px;
  min-height: 0;

  display: flex;
  align-items: center;
  justify-content: center;

  color: #888;
  font-style: italic;
}

.network-footer {
  margin-top: 0.75rem;
}

.network-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem 0.85rem;
  align-items: center;
  margin-top: 0.45rem;
  font-size: 0.9rem;
  color: #555;
}

.network-legend-title {
  font-weight: 600;
  color: #333;
}

.network-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.legend-swatch {
  display: inline-block;
  width: 0.85rem;
  height: 0.85rem;
  border: 1px solid rgba(0, 0, 0, 0.24);
  border-radius: 50%;
}

.legend-swatch--key {
  background: #008000;
}

.legend-swatch--museum {
  background: #ffff00;
}

.legend-swatch--other {
  background: #636363;
}

/* --- Timeline / provenance ------------------------------------ */
.provenance-entry.is-related {
  text-decoration: underline dotted rgba(0, 0, 0, 0.35);
  text-underline-offset: 2px;
}

.provenance-entry.is-primary {
  text-decoration: underline solid var(--tl-primary);
  text-decoration-thickness: 2px;
  text-underline-offset: 2px;
}

.provenance-entry.highlighted,
.provenance-entry.sub-highlight,
.provenance-entry.is-related,
.provenance-entry.is-primary {
  background: none !important;
  box-shadow: none !important;
  border-radius: 0 !important;
}

.provenance-source {
  margin-top: 0.5rem;
  font-size: 0.95rem;
}

.provenance-source .provenance-source-link {
  text-decoration: underline;
}

.prov-event-mention {
  font-weight: 700;
}

.colonial-figure {
  color: #2e7d32;
}

.museum-name {
  color: #b28a00;
}

.prov-entry-bold {
  font-weight: 700 !important;
}

/* cohort focus */
.has-cohort-focus .provenance-entry,
.has-cohort-focus .timeline-item {
  opacity: 0.45;
  transition: opacity 0.18s ease;
}

.has-cohort-focus .provenance-entry.is-related,
.has-cohort-focus .provenance-entry.is-primary,
.has-cohort-focus .timeline-item.is-related,
.has-cohort-focus .timeline-item.is-primary {
  opacity: 1;
}

.has-cohort-focus .timeline-item:hover {
  opacity: 0.7;
}

.has-cohort-focus .timeline-item.is-related:hover,
.has-cohort-focus .timeline-item.is-primary:hover {
  opacity: 1;
}

/* don't fade helper ui */
.story-cohort-popover,
.timeline-scroll-btn {
  opacity: 1 !important;
}

/* timeline container */
.timeline-container {
  position: relative;
}

.timeline-wrapper {
  width: 100%;
  overflow-x: auto;
  scroll-behavior: smooth;
  -ms-overflow-style: none;
  scrollbar-width: none;
}

.timeline-wrapper::-webkit-scrollbar {
  display: none;
}

.timeline {
  display: flex;
  position: relative;
  padding: 0 60px;
  min-height: var(--tl-min-height, 350px);
}

.timeline::before {
  content: "";
  position: absolute;
  width: 100%;
  top: 50%;
  left: 0;
  height: 4px;
  background-color: #e0e0e0;
  transform: translateY(-50%);
}

.timeline-item {
  position: relative;
  flex: 1;
  display: flex;
  justify-content: center;
}

.timeline-item[data-story-id] {
  cursor: pointer;
}

.timeline-event {
  display: -webkit-box;
  -webkit-line-clamp: 8;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.timeline-point {
  position: absolute;
  top: 50%;
  left: 50%;
  border: 3px solid #fff;
  border-radius: 50%;
  transform: translate(-50%, -50%);
  z-index: 2;
  transition: all 0.3s ease;
}

.timeline-item:not([data-story-id]) .timeline-point {
  width: 12px;
  height: 12px;
  background-color: #b0b0b0;
}

.timeline-item[data-story-id] .timeline-point {
  width: 18px;
  height: 18px;
  background-color: #3498db;
}

.timeline-content {
  position: absolute;
  width: 260px;
  padding: 10px;
  background-color: #fff;
  border: 1px solid var(--tl-border);
  border-radius: 6px;
  box-shadow: 0 2px 5px var(--tl-shadow);
  transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
  z-index: 1;
}

.timeline-item[data-story-id]:hover .timeline-content {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  transform: translateY(-2px);
}

.timeline-date-label {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  font-size: 0.85em;
  font-weight: bold;
  color: #777;
  background-color: #f7f7f7;
  padding: 2px 6px;
  border-radius: 4px;
  z-index: 1;
}

.timeline-item:nth-child(odd) .timeline-date-label {
  top: 50%;
  margin-top: 15px;
}

.timeline-item:nth-child(even) .timeline-date-label {
  bottom: 50%;
  margin-bottom: 15px;
}

.timeline-item:nth-child(odd) .timeline-content {
  bottom: 50%;
  margin-bottom: 30px;
}

.timeline-item:nth-child(even) .timeline-content {
  top: 50%;
  margin-top: 30px;
}

.timeline-item .timeline-content::after {
  content: "";
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  border-style: solid;
  transition: border-color 0.15s ease;
}

.timeline-item:nth-child(odd) .timeline-content::after {
  top: 100%;
  border-width: 10px 10px 0;
  border-color: var(--tl-border) transparent transparent transparent;
}

.timeline-item:nth-child(even) .timeline-content::after {
  bottom: 100%;
  border-width: 0 10px 10px;
  border-color: transparent transparent var(--tl-border) transparent;
}

.timeline-item.is-related .timeline-content {
  box-shadow: 0 6px 16px var(--tl-related-shadow);
}

.timeline-item.is-primary .timeline-content {
  border-color: var(--tl-primary);
  box-shadow: 0 8px 22px var(--tl-primary-shadow);
  transform: translateY(-2px);
}

.timeline-item.is-primary:nth-child(odd) .timeline-content::after {
  border-color: var(--tl-primary) transparent transparent transparent;
}

.timeline-item.is-primary:nth-child(even) .timeline-content::after {
  border-color: transparent transparent var(--tl-primary) transparent;
}

.timeline-item.is-primary .timeline-point {
  background-color: var(--tl-primary) !important;
  transform: translate(-50%, -50%) scale(1.15);
}

.timeline-item.is-related .timeline-point {
  transform: translate(-50%, -50%) scale(1.08);
}

.timeline-item:focus-within .timeline-content {
  outline: 2px solid var(--tl-primary);
  outline-offset: 2px;
}

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

.timeline-item.is-related,
.timeline-item.is-primary {
  outline: none !important;
  border-radius: 0 !important;
}

/* timeline scroll buttons */
.timeline-scroll-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 10;

  background: none;
  border: 1px solid #eee;
  border-radius: 8px;
  font-size: 1rem;
  color: #555;
  padding: 0.75rem 1rem;
  cursor: pointer;

  display: flex;
  align-items: center;
  transition: all 0.4s ease;
}

#timeline-scroll-prev {
  left: 5px;
  justify-content: flex-start;
}

#timeline-scroll-next {
  right: 5px;
  justify-content: flex-end;
}

.timeline-scroll-btn .arrow {
  font-size: 20px;
  transition: transform 0.4s cubic-bezier(0.19, 1, 0.22, 1);
}

.timeline-scroll-btn .nav-text {
  max-width: 0;
  opacity: 0;
  white-space: nowrap;
  overflow: hidden;
  transition: max-width 0.5s cubic-bezier(0.19, 1, 0.22, 1), opacity 0.2s ease 0.1s;
}

.timeline-scroll-btn:hover {
  background-color: #f8f8f8;
  color: #111;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.timeline-scroll-btn:hover .nav-text {
  max-width: 100px;
  opacity: 1;
}

#timeline-scroll-prev .arrow {
  margin-right: 0.5em;
}

#timeline-scroll-prev:hover .arrow {
  transform: translateX(-4px);
}

#timeline-scroll-next .arrow {
  order: 1;
  margin-left: 0.5em;
}

#timeline-scroll-next:hover .arrow {
  transform: translateX(4px);
}

.timeline-scroll-btn.hidden {
  opacity: 0;
  pointer-events: none;
}

/* unlinked items (muted) */
.timeline-item[data-story-id=""],
.timeline-item[data-unlinked="1"] {
  cursor: default;
}

.timeline-item[data-story-id=""] .timeline-point,
.timeline-item[data-unlinked="1"] .timeline-point {
  width: 12px;
  height: 12px;
  background-color: #b0b0b0;
  filter: grayscale(60%);
  opacity: 0.65;
}

.timeline-item[data-story-id=""] .timeline-content,
.timeline-item[data-story-id=""] .timeline-date-label,
.timeline-item[data-unlinked="1"] .timeline-content,
.timeline-item[data-unlinked="1"] .timeline-date-label {
  opacity: 0.35;
  filter: grayscale(50%);
  transition: opacity 0.15s ease, filter 0.15s ease, box-shadow 0.15s ease,
    transform 0.15s ease;
}

.timeline-item[data-story-id=""]:hover .timeline-content,
.timeline-item[data-unlinked="1"]:hover .timeline-content {
  opacity: 1;
  filter: none;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.timeline-item[data-story-id=""]:hover .timeline-date-label,
.timeline-item[data-unlinked="1"]:hover .timeline-date-label {
  opacity: 1;
  filter: none;
}

.has-cohort-focus .timeline-item[data-story-id=""] .timeline-content,
.has-cohort-focus .timeline-item[data-story-id=""] .timeline-date-label,
.has-cohort-focus .timeline-item[data-unlinked="1"] .timeline-content,
.has-cohort-focus .timeline-item[data-unlinked="1"] .timeline-date-label {
  opacity: 0.25;
  filter: grayscale(60%);
}

.has-cohort-focus .timeline-item[data-story-id=""]:hover .timeline-content,
.has-cohort-focus .timeline-item[data-story-id=""]:hover .timeline-date-label,
.has-cohort-focus .timeline-item[data-unlinked="1"]:hover .timeline-content,
.has-cohort-focus .timeline-item[data-unlinked="1"]:hover .timeline-date-label {
  opacity: 0.95;
  filter: none;
}

.timeline-item[data-story-id]:not([data-story-id=""]) {
  cursor: pointer;
}

/* --- Loading (shared) ----------------------------------------- */
.spinner {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 3px solid #d9d9d9;
  border-top-color: #555;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@media (prefers-reduced-motion: reduce) {
  .spinner {
    animation: none;
  }
}

/* loading cover (fade) */
.loading-cover {
  position: fixed;
  inset: 0;
  z-index: 9999;

  display: flex;
  align-items: center;
  justify-content: center;

  background: rgba(235, 235, 235);
  backdrop-filter: blur(2px);

  opacity: 1;
  transition: opacity 0.5s ease;
}

.loading-cover.is-done {
  opacity: 0;
  pointer-events: none;
}

.loading-cover.hidden {
  display: none;
}

.loading-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;

  padding: 18px 20px;
  border: none;
  border-radius: 12px;
  background: transparent;
}

/* loading curtain (open to sides) */
.loading-curtain {
  position: fixed;
  inset: 0;
  z-index: 9999;
  overflow: hidden;
}

.loading-curtain.hidden {
  display: none;
}

.loading-curtain .curtain {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 50%;
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(2px);
  transition: transform 0.55s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.loading-curtain .curtain-left {
  left: 0;
  transform: translateX(0);
}

.loading-curtain .curtain-right {
  right: 0;
  transform: translateX(0);
}

.loading-curtain .loading-card {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);

  border: 1px solid #e6e6e6;
  background: #fff;
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.06);

  opacity: 1;
  transition: opacity 0.2s ease;
}

.loading-curtain.is-done .loading-card {
  opacity: 0;
}

.loading-curtain.is-done .curtain-left {
  transform: translateX(-100%);
}

.loading-curtain.is-done .curtain-right {
  transform: translateX(100%);
}

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

  .loading-curtain .curtain,
  .loading-curtain .loading-card {
    transition: none;
  }
}

/* --- Responsive dashboard ------------------------------------ */

@media (max-width: 900px) {
  .page-container {
    max-width: calc(100% - 32px);
  }

  .story-grid-container {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr);
    grid-template-rows: auto auto;
    height: auto;
  }

  #story-section .overlay-col {
    height: 430px;
  }

  #story-section .col-right {
    grid-column: 1 / -1;
    height: auto;
    max-height: none;
  }

  .two-column-container {
    flex-direction: column;
  }

  .two-column-container > .column {
    flex: 0 0 auto;
    width: 100%;
  }

  #social-network-container,
  #map-container {
    height: 520px;
  }
}

@media (max-width: 700px) {
  body.detail-page {
    font-size: 15.5px;
    line-height: 1.52;
  }

  .top-nav {
    gap: 3px;
    padding: 8px;
    overflow-x: auto;
    scrollbar-width: none;
  }

  .top-nav::-webkit-scrollbar {
    display: none;
  }

  .top-nav .nav-link {
    flex: 0 0 auto;
    padding: 7px 8px;
    font-size: 13px;
    white-space: nowrap;
  }

  .mobile-alert {
    display: none !important;
  }

  .page-container {
    max-width: calc(100% - 36px);
    padding: 0.75rem 0 2.5rem;
  }

  .page-container > h2,
  .content-section > h2,
  #social-network-container > h2,
  #map-container > h2 {
    font-size: 1.35rem;
    line-height: 1.25;
  }

  .page-container > h2 {
    margin-top: 1.75rem;
    margin-bottom: 0.65rem;
  }

  .content-section,
  .object-header {
    margin: 1.25rem 0;
    padding: 16px;
    box-shadow: 0 3px 12px rgba(0, 0, 0, 0.055);
  }

  .object-header {
    gap: 1.15rem;
  }

  .two-column-container {
    margin-left: -8px;
    margin-right: -8px;
  }

  .wall-label h2 {
    font-size: 1.2rem;
    line-height: 1.3;
    margin-bottom: 0.35rem;
  }

  .wall-label h3,
  .paint-medium,
  #intro-text,
  #current-museum {
    font-size: 0.95rem;
    line-height: 1.5;
  }

  #image-col {
    height: auto !important;
    min-height: 0;
  }

  #image-col img,
  #artwork-image {
    width: 100%;
    max-height: none;
    object-fit: contain;
  }

  #story-section {
    padding: 16px;
  }

  .story-grid-container {
    display: flex;
    flex-direction: column;
    gap: 12px;
    height: auto;
  }

  #story-section .overlay-col {
    width: 100%;
    height: auto;
    max-height: none;
    overflow: visible;
  }

  #story-section .col-middle {
    height: 360px;
    min-height: 360px;
  }

  .col-left img {
    width: 100%;
    max-height: none;
    object-fit: contain;
  }

  #overlay-event-text {
    max-height: none;
    overflow: visible;
    padding: 0;
    font-size: 0.95rem;
    line-height: 1.56;
  }

  #overlay-event-title {
    font-size: 1.05rem;
    line-height: 1.35;
  }

  #overlay-image-source {
    font-size: 0.78rem;
    line-height: 1.35;
  }

  #story-section .overlay-nav {
    margin-top: 4px;
  }

  .story-network-legend {
    margin-top: 0.75rem;
    padding-top: 0.35rem;
  }

  .overlay-nav button {
    min-height: 48px;
    padding: 0.75rem 0.5rem;
    font-size: 0.92rem;
  }

  .overlay-nav .nav-text {
    max-width: 150px;
    opacity: 1;
  }

  #social-network-container {
    height: 720px;
    padding: 14px;
  }

  #social-network-container h2 {
    margin-bottom: 0.8rem;
  }

  .network-footer {
    font-size: 0.84rem;
    line-height: 1.42;
  }

  #map-container {
    height: 460px;
  }

  .timeline {
    padding-inline: 42px;
  }

  .timeline-content {
    width: 200px;
    font-size: 0.88rem;
    line-height: 1.4;
  }

  .timeline-scroll-btn {
    padding: 0.65rem 0.75rem;
    background: rgba(255, 255, 255, 0.94);
  }

  .network-legend {
    gap: 0.4rem 0.65rem;
    font-size: 0.8rem;
    line-height: 1.35;
  }

  #image-lightbox,
  #event-network-lightbox,
  #instructions-modal,
  #social-network-overlay {
    padding: 54px 12px 12px;
  }

  .lightbox-content,
  .event-network-lightbox-content,
  .instructions-modal-content,
  #social-network-content {
    width: 100%;
    max-width: 100%;
    max-height: calc(100dvh - 66px);
  }

  #lightbox-img {
    max-height: 58dvh;
  }

  #lightbox-text {
    max-height: 26dvh;
    overflow-y: auto;
  }

  #lightbox-close {
    top: 54px;
    right: 16px;
    z-index: 2;
  }

  .event-network-lightbox-content {
    padding: 12px;
  }

  #event-network-zoomed-container {
    width: calc(100vw - 48px) !important;
    height: min(70dvh, 560px) !important;
  }

  .instructions-modal-scroll {
    max-height: calc(100dvh - 66px);
    padding: 1.5rem;
  }

  #instructions-icon {
    right: 10px;
    bottom: 10px;
    width: 36px;
    height: 36px;
    font-size: 1.2rem;
  }

  #instructions-icon:hover {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    font-size: 1.2rem;
    transform: none;
  }

  #instructions-icon:hover span {
    display: inline;
  }

  #instructions-icon:hover::before {
    content: none;
  }

  #instructions-icon:hover #instructions-text {
    display: none;
  }
}

@media (max-width: 420px) {
  .top-nav {
    gap: 2px;
    justify-content: space-between;
    padding: 7px 6px;
  }

  .top-nav .nav-link {
    padding: 6px 7px;
    font-size: 12.5px;
  }

  .page-container {
    max-width: calc(100% - 36px);
  }

  .content-section,
  .object-header {
    padding: 16px;
  }

  #story-section .col-middle {
    height: 320px;
    min-height: 320px;
  }

  #social-network-container {
    height: 720px;
    padding: 14px;
  }

  #map-container {
    height: 420px;
  }

  .timeline-content {
    width: 190px;
  }

  .network-legend {
    font-size: 0.82rem;
  }
}
