/* ═══ Explore: a full-screen view below the top bar (#/explore) ═══ */
/* Below the bar, as Meanwhile, In depth and the quiz: the page is the view,
   not a box floating over a veiled map. */
.explore-view {
  position: fixed;
  inset: var(--site-nav-h, 0px) 0 0;
  z-index: 600;
  overflow-y: auto;
  overscroll-behavior: contain;
  background: var(--bg);
  color: var(--text);
  --explore-gutter: clamp(1rem, 4vw, 3rem);
}

.explore-view[hidden] { display: none; }

/* ═══ The journeys page ═══ */
.journeys-page {
  width: 100%;
  max-width: 1360px;
  margin: 0 auto;
}

.explore-view .journeys-page { padding: 0 var(--explore-gutter) 5rem; }

.journeys-head { padding: clamp(2.5rem, 5vw, 4rem) 0 1.25rem; }
/* The title takes the focus as the page opens, for a screen reader; it is
   not a control, so it draws no ring. */
.journeys-title:focus { outline: none; }

.explore-view .journeys-title {
  margin: 0 0 0.6rem;
  font-size: clamp(2.5rem, 5.5vw, 3.75rem);
  font-weight: 700;
  line-height: 1.04;
  letter-spacing: -0.045em;
}

.journeys-lead {
  max-width: 36rem;
  margin: 0;
  color: var(--muted);
  font-size: clamp(1rem, 1.4vw, 1.15rem);
  line-height: 1.55;
}

/* The bar that jumps between sections is shared with In depth
   (section-bar.js, history-profile.css); Explore only places it. */
.explore-view .jump-bar { --jump-gutter: var(--explore-gutter); --jump-top: 0px; }

/* ═══ Sections ═══ */
.browse-layout {
  display: grid;
  gap: clamp(3rem, 6vw, 4.5rem);
}

.browse-section {
  display: grid;
  gap: 1.5rem;
  scroll-margin-top: calc(var(--jump-h) + 0.75rem);
}

.explore-view .browse-section-head h3 {
  margin: 0;
  font-size: clamp(1.6rem, 2.6vw, 2rem);
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: -0.035em;
  color: var(--text);
}

.explore-view .browse-section-head h4 {
  margin: 0;
  font-size: 1.2rem;
  font-weight: 650;
  letter-spacing: -0.025em;
  color: var(--text);
}

.browse-section-head p {
  margin: 0.35rem 0 0;
  color: var(--muted);
  font-size: 0.98rem;
  line-height: 1.45;
}

/* A country's threads after its timeline, under a hairline of their own. */
.browse-section-head.is-sub {
  margin-top: 1.5rem;
  padding-top: 2rem;
  border-top: 1px solid var(--sep);
}

.browse-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 2.5rem 1.5rem;
}
@media (max-width: 1180px) { .browse-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 900px)  { .browse-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* A phone swipes through a section instead of scrolling a mile of cards:
   one shelf per section, the next card peeking in at the edge. */
@media (max-width: 700px) {
  .browse-grid {
    grid-template-columns: none;
    grid-auto-flow: column;
    grid-auto-columns: min(78%, 20rem);
    gap: 1rem;
    margin: 0 calc(var(--explore-gutter) * -1);
    padding: 0 var(--explore-gutter) 0.25rem;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    scroll-snap-type: x mandatory;
    scroll-padding: 0 var(--explore-gutter);
    scrollbar-width: none;
  }
  .browse-grid::-webkit-scrollbar { display: none; }
  .browse-grid > .browse-card { scroll-snap-align: start; }
}

/* ═══ A journey's card ═══ */
/* Picture first, words underneath, then its two actions side by side at
   the same height on every card, so a row of cards ends in one line. */
.browse-card {
  position: relative;
  display: flex;
  flex-direction: column;
  min-width: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--text);
  font: inherit;
  text-align: left;
  cursor: pointer;
  container-type: inline-size;
  -webkit-tap-highlight-color: transparent;
}
.browse-card:focus-visible { outline: none; }
.browse-card:focus-visible .browse-card-media {
  outline: 3px solid var(--ui-action, var(--accent));
  outline-offset: 3px;
}

.browse-card-media {
  position: relative;
  display: block;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  border-radius: var(--r-card, 16px);
  background:
    linear-gradient(150deg, color-mix(in srgb, var(--route, var(--accent)) 38%, var(--surf-2)), var(--surf-2) 70%);
  box-shadow: 0 1px 2px rgb(0 0 0 / 6%);
  transition: box-shadow 0.35s ease;
  isolation: isolate;
}

.browse-card-media img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.6s cubic-bezier(0.2, 0.7, 0.2, 1);
}

/* A journey without a picture shows its own route line, large and faint. */
.browse-card-media-empty::after {
  content: "";
  position: absolute;
  left: 18%;
  right: 18%;
  top: 50%;
  height: 6px;
  margin-top: -3px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--route, var(--accent)) 60%, transparent);
}

@media (hover: hover) {
  .browse-card:hover .browse-card-media { box-shadow: 0 14px 34px -12px rgb(0 0 0 / 34%); }
  .browse-card:hover .browse-card-media img { transform: scale(1.045); }
}

/* The whole card plays its journey: a play mark in the picture's corner says
   so, and grows when the card is pointed at. */
.browse-card-play {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  display: grid;
  place-items: center;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 50%;
  background: rgb(255 255 255 / 88%);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  box-shadow: 0 2px 12px rgb(0 0 0 / 18%);
  color: #1c1c1e;
  pointer-events: none;
  transition: transform 0.25s cubic-bezier(0.2, 0.7, 0.2, 1), background 0.2s ease;
}
.browse-card-play svg { width: 1rem; height: 1rem; margin-left: 0.14rem; }
.browse-card:hover .browse-card-play,
.browse-card:focus-visible .browse-card-play { transform: scale(1.1); background: #fff; }

/* A journey told In depth wears it as a badge on its picture. */
.browse-card-badge {
  position: absolute;
  top: 0.75rem;
  left: 0.75rem;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  height: 2rem;
  padding: 0 0.75rem 0 0.55rem;
  border-radius: 999px;
  background: rgb(255 255 255 / 92%);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  box-shadow: 0 2px 10px rgb(0 0 0 / 14%);
  color: #1c1c1e;
  font-size: 0.8rem;
  font-weight: 650;
  letter-spacing: -0.005em;
  transition: background 0.2s ease;
}
.browse-card-badge svg { width: 1rem; height: 1rem; flex: none; }
.browse-card-badge:hover { background: #fff; }

.browse-card-body {
  display: grid;
  gap: 0.2rem;
  padding: 0.9rem 0.1rem 0;
}

.explore-view .browse-card strong {
  font-size: 1.08rem;
  font-weight: 650;
  line-height: 1.25;
  letter-spacing: -0.02em;
  text-wrap: balance;
}

.browse-card-period {
  color: var(--muted);
  font-size: 0.93rem;
  line-height: 1.35;
}

/* The route line: each journey has its own colour (stories.json "color"),
   shown here, on the map highlight and anywhere the route is followed. On
   the card it is drawn like a metro line, a terminus at each end. */
.browse-card-route {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  margin-top: 0.4rem;
  color: var(--muted);
  font-size: 0.84rem;
  line-height: 1.3;
}
.route-line {
  position: relative;
  flex: none;
  width: 2.25rem;
  height: 3px;
  border-radius: 999px;
  background: var(--route, var(--accent));
}
.browse-card-route .route-line::before,
.browse-card-route .route-line::after {
  content: "";
  position: absolute;
  top: 50%;
  width: 9px;
  height: 9px;
  margin-top: -4.5px;
  border: 2px solid var(--route, var(--accent));
  border-radius: 50%;
  background: var(--bg);
  box-sizing: border-box;
}
.browse-card-route .route-line::before { left: -1px; }
.browse-card-route .route-line::after { right: -1px; }

/* The card's other actions, side by side at equal widths. */
.browse-card-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
  margin-top: auto;
  padding-top: 1rem;
}
.browse-card-actions.is-single { grid-template-columns: 1fr; }

.browse-card-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  min-width: 0;
  height: 2.5rem;
  padding: 0 0.6rem;
  border-radius: 0.75rem;
  background: var(--surf);
  color: var(--text);
  font-size: 0.86rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  white-space: nowrap;
  cursor: pointer;
  transition: background 0.15s ease, transform 0.15s ease;
}
.browse-card-action > span { overflow: hidden; text-overflow: ellipsis; }
.browse-card-action svg { width: 1.05rem; height: 1.05rem; flex: none; }
.browse-card-action:hover { background: var(--surf-2); }
.browse-card-action:active { transform: scale(0.97); }
.browse-card-action:focus-visible,
.browse-card-badge:focus-visible { outline: 2px solid var(--ui-action, var(--accent)); outline-offset: 2px; }
/* A finger needs 44px; a mouse is fine with the slimmer button. */
@media (pointer: coarse) { .browse-card-action { height: 44px; } }

/* A narrow column cannot hold two labels side by side: they stack. */
@container (max-width: 15rem) {
  .browse-card-actions { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  .browse-card-media img,
  .browse-card-play,
  .browse-card-action { transition: none; }
  .browse-card:hover .browse-card-media img { transform: none; }
}

/* Tabs */
.col-tabs {
  display: flex;
  gap: 0.25rem;
  padding: 1rem 1.5rem 0;
  border-bottom: 1px solid var(--sep);
}

.col-tab {
  padding: 0.5rem 1rem;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s;
}

.col-tab:hover { color: var(--text); }

.col-tab.is-active {
  color: var(--text);
  border-bottom-color: var(--accent);
}

/* Cards grid */
.col-cards {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.65rem;
}

@media (max-width: 600px) {
  .col-cards { grid-template-columns: repeat(2, 1fr); }
}

.time-century-card {
  min-height: 12.2rem;
  display: grid;
  grid-template-rows: auto 1fr;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 0.75rem;
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
  text-align: left;
  cursor: pointer;
  transition: border-color 0.15s, box-shadow 0.15s, transform 0.15s;
}

.time-century-card:hover {
  border-color: var(--text);
  box-shadow: 0 4px 16px rgba(0,0,0,0.08);
  transform: translateY(-1px);
}

.time-century-card.is-active {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent);
}

.time-century-media {
  position: relative;
  display: block;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--accent) 18%, transparent), transparent),
    var(--surf-2);
}

.time-century-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.45s ease;
}

.time-century-card:hover .time-century-media img {
  transform: scale(1.05);
}

.time-century-media-empty {
  position: absolute;
  inset: 28% 34%;
  border: 1.5px solid color-mix(in srgb, var(--accent) 36%, transparent);
  border-radius: 999px;
}

.time-century-body {
  display: grid;
  align-content: end;
  gap: 0.32rem;
  padding: 0.75rem;
  min-width: 0;
}

.time-century-label {
  font-family: 'Nunito', var(--font);
  font-size: 0.88rem;
  font-weight: 800;
  letter-spacing: 0;
  line-height: 1.15;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.time-century-years {
  color: var(--accent);
  font-size: 0.74rem;
  font-weight: 600;
  line-height: 1.25;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Era chips — eras are filters, kept light */
.col-era-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  padding: 1rem 1.5rem 0.25rem;
}

.col-era-chip {
  font-family: 'Nunito', var(--font);
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--muted);
  background: var(--surf);
  border: 1px solid transparent;
  border-radius: 999px;
  padding: 0.38rem 0.85rem;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

/* Era material dot, same colors as the timeline bands ([data-era] sets --era-c) */
.col-era-chip[data-era]::before {
  content: "";
  display: inline-block;
  width: 0.55em;
  height: 0.55em;
  border-radius: 50%;
  background: var(--era-c, var(--accent));
  margin-right: 0.45em;
}

.col-era-chip-count {
  font-weight: 600;
  opacity: 0.6;
  margin-left: 0.15rem;
}

.col-era-chip:hover { color: var(--text); background: var(--surf-2); }

.col-era-chip.is-active {
  background: var(--text);
  color: var(--bg);
}

/* Collection shelves — one section per era that has collections */
.col-section {
  padding: 1rem 1.5rem 0.5rem;
}

.col-section:last-of-type { padding-bottom: 1.5rem; }

.col-section-head {
  display: flex;
  align-items: baseline;
  gap: 0.6rem;
  margin-bottom: 0.65rem;
}

.col-section-head h3 {
  font-family: 'Nunito', var(--font);
  font-size: 0.95rem;
  font-weight: 800;
  letter-spacing: -0.01em;
  color: var(--text);
}

.col-section-head span {
  font-size: 0.7rem;
  font-weight: 500;
  color: var(--muted);
}

.col-empty {
  padding: 1.5rem;
  font-size: 0.85rem;
  color: var(--muted);
}

.col-card {
  position: relative;
  border: 1.5px solid var(--border);
  border-radius: 0.75rem;
  overflow: hidden;
  cursor: pointer;
  background: var(--surf);
  text-align: left;
  transition: border-color 0.15s, box-shadow 0.15s;
  padding: 0;
}

.col-card:hover {
  border-color: var(--text);
  box-shadow: 0 4px 16px rgba(0,0,0,0.1);
}

.col-card.is-active {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent);
}

.col-card-img-wrap {
  position: relative;
  aspect-ratio: 3 / 2;
  overflow: hidden;
  background: var(--surf-2);
}

.col-card-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.5s ease;
}

.col-card:hover .col-card-img { transform: scale(1.06); }

.col-card-placeholder {
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, var(--surf-2) 0%, var(--border) 100%);
}

.col-card-gradient {
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(0,0,0,0.45) 0%, transparent 60%);
}

.col-card-body {
  padding: 0.6rem 0.75rem 0.65rem;
}

.col-card-name {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text);
  line-height: 1.25;
  margin-bottom: 0.15rem;
}

.col-card-years {
  font-size: 0.62rem;
  font-weight: 500;
  color: var(--accent);
  letter-spacing: 0.02em;
  margin-bottom: 0.1rem;
}

.col-card-count {
  font-size: 0.65rem;
  color: var(--muted);
  letter-spacing: 0.03em;
}


.col-card-check {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  width: 1.35rem;
  height: 1.35rem;
  background: var(--accent);
  color: #fff;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 0.6rem;
  font-weight: 700;
}
