/* =========================================================
   VARIABLES AND BASE
   ========================================================= */

:root {
  --blue-900: #12345b;
  --blue-800: #184a7a;
  --blue-700: #23649b;
  --blue-100: #eaf4fb;
  --blue-050: #f4f9fd;

  --yellow-500: #f3c84b;
  --yellow-300: #ffe28a;
  --yellow-100: #fff7d8;

  --ink: #1d2935;
  --muted: #677684;
  --line: #dfe7ee;
  --surface: #ffffff;
  --page: #f7f9fb;

  --shadow: 0 14px 40px rgba(25, 55, 80, 0.08);

  --radius-xl: 24px;
  --radius-lg: 18px;
  --radius-md: 14px;
  --radius-sm: 10px;

  --header-control-height: 52px;
  --header-control-radius: 16px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family:
    "Inter", system-ui, -apple-system,
    BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--page);
}

button,
input,
select {
  font: inherit;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

button {
  border: 0;
}

a {
  color: inherit;
  text-decoration: none;
}

h2 {
  margin: 0;
  color: var(--blue-900);
  font-size: 1.3rem;
  letter-spacing: -0.02em;
}

.hidden,
[hidden] {
  display: none !important;
}

/* =========================================================
   SHARED HEADER AND BRAND
   ========================================================= */

.topbar {
  width: min(1180px, calc(100% - 32px));
  min-height: 68px;
  margin: 18px auto 0;
  padding: 12px 16px;

  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;

  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow);

  position: sticky;
  top: 14px;
  z-index: 50;
}

.brand {
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
  gap: 11px;
  font-weight: 800;
}

.brand-mark {
  display: grid;
  place-items: center;
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  border-radius: 13px;
  background: var(--blue-800);
  color: #ffffff;
  box-shadow: inset 0 -7px 0 rgba(243, 200, 75, 0.2);
}

.brand-text {
  white-space: nowrap;
}

/* Shared globe icon */
.brand-mark.timeatlas-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 40px;
  padding: 0;
  overflow: hidden;
  background: #194d7d;
  background-image: none;
  box-shadow: none;
  line-height: 1;
}

.brand-mark.timeatlas-mark::before,
.brand-mark.timeatlas-mark::after {
  content: none;
  display: none;
}

.timeatlas-mark svg {
  display: block;
  width: 55%;
  height: 55%;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 16px;
}

.top-link,
.text-link {
  color: var(--blue-800);
  font-weight: 700;
}

/* Explore and Search Results share the same header */
.explore-topbar {
  width: min(1480px, calc(100% - 28px));
  flex: 0 0 auto;
  position: relative;
  top: auto;
  gap: 16px;
}

.explore-home-button,
.topbar .kids-mode-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  flex: 0 0 auto;

  width: auto;
  min-width: 0;
  height: var(--header-control-height);
  min-height: var(--header-control-height);
  margin: 0;
  padding: 0 18px;

  border-radius: var(--header-control-radius);
  font-size: 14px;
  font-weight: 600;
  line-height: 1;
  white-space: nowrap;
}

.explore-home-button {
  background: #edf4fa;
  border: 1px solid #d8e5f0;
  color: #315f86;
  box-shadow: none;
  transition: background 0.2s ease;
}

.explore-home-button:hover {
  background: #e2edf7;
  color: #194d7d;
}

.explore-home-button svg {
  display: block;
  flex-shrink: 0;
  width: 18px;
  height: 18px;
}

.language-select {
  min-height: 34px;
  padding: 7px 30px 7px 11px;
  border: 1px solid transparent;
  border-radius: 999px;
  outline: none;
  background: var(--blue-100);
  color: var(--blue-800);
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
}

.language-select:hover,
.language-select:focus {
  border-color: #c9deed;
  background: #dfedf7;
}

/* =========================================================
   SHARED SEARCH AND BUTTONS
   ========================================================= */

.search-box {
  display: flex;
  align-items: center;
  gap: 10px;
}

.search-box input {
  flex: 1 1 auto;
  width: 100%;
  min-width: 0;
  border: 0;
  outline: none;
  background: transparent;
  color: var(--ink);
}

.search-box-large {
  width: min(800px, 100%);
  margin: 34px auto 0;
  padding: 9px;
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 22px;
  box-shadow: var(--shadow);
}

.search-box-large input {
  padding: 15px 16px;
  font-size: 1rem;
}

.primary-btn {
  flex-shrink: 0;
  padding: 14px 20px;
  border-radius: 15px;
  background: var(--blue-800);
  color: #ffffff;
  font-weight: 800;
  white-space: nowrap;
  cursor: pointer;
  transition: transform 0.15s ease, background 0.15s ease;
}

.primary-btn:hover {
  background: var(--blue-900);
  transform: translateY(-1px);
}

.primary-btn.compact {
  padding: 10px 14px;
  border-radius: 12px;
}

/* Shared header search controls */
.explore-topbar .search-box-top {
  flex: 1 1 auto;
  width: auto;
  max-width: 650px;
  min-width: 0;
  height: var(--header-control-height);
  min-height: var(--header-control-height);
  margin-left: auto;
  padding: 0 6px 0 16px;

  border: 1px solid var(--line);
  border-radius: var(--header-control-radius);
  background: #ffffff;
}

.explore-topbar .search-box-top input {
  margin: 0;
  padding: 0;
  font-size: 16px;
  box-shadow: none;
}

.explore-topbar .search-box-top .primary-btn {
  height: 38px;
  min-height: 0;
  padding: 0 18px;
  border-radius: 10px;
}

.kids-mode-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  flex-shrink: 0;
  padding: 0 22px;

  background: #fff3c4;
  border: 1px solid #e8bd3f;
  border-radius: 50px;
  color: #123f6d;

  font-size: 16px;
  font-weight: 700;
  transition: background 0.2s ease, transform 0.2s ease;
}

.kids-mode-button:hover {
  background: #ffe89a;
  transform: translateY(-2px);
}

.kids-mode-icon {
  font-size: 20px;
  line-height: 1;
}

/* =========================================================
   HOME HERO
   ========================================================= */

.section-shell {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
}

.hero {
  padding: 92px 0 58px;
  text-align: center;
}

.hero::before {
  content: "";
  position: absolute;
  width: 420px;
  height: 420px;
  left: 8%;
  top: 95px;
  border-radius: 50%;
  background: rgba(243, 200, 75, 0.14);
  filter: blur(10px);
  z-index: -1;
}

.hero h1 {
  max-width: 900px;
  margin: 22px auto 16px;
  color: var(--blue-900);
  font-size: clamp(2.5rem, 6vw, 5rem);
  line-height: 1.02;
  letter-spacing: -0.05em;
}

.hero-copy {
  max-width: 720px;
  margin: 0 auto;
  color: var(--muted);
  font-size: 1.06rem;
  line-height: 1.75;
}

.search-action-row {
  display: flex;
  align-items: stretch;
  justify-content: center;
  gap: 16px;
  width: min(100%, 980px);
  margin: 0 auto;
}

.search-action-row .search-box-large {
  flex: 1;
  width: auto;
  margin: 0;
}

.home-search-tip {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  gap: 8px;
  margin: 14px 0 0;
  color: #64748b;
  font-size: 14px;
  line-height: 1.6;
}

.home-search-tip svg {
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  margin-top: 1px;
}

.home-search-tip span {
  min-width: 0;
}

.example-queries {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  margin-top: 18px;
}

.query-chip {
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #ffffff;
  color: var(--blue-800);
  cursor: pointer;
}

.query-chip:hover {
  border-color: var(--yellow-500);
  background: var(--yellow-100);
}

/* =========================================================
   SHARED HEADINGS AND BADGES
   ========================================================= */

.section-heading-row,
.panel-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--blue-700);
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.11em;
  text-transform: uppercase;
}

.hero-badge,
.neutral-badge,
.source-count-badge,
.source-type-badge,
.relationship-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 700;
}

.hero-badge {
  padding: 8px 13px;
  border: 1px solid #f4df8c;
  background: var(--yellow-100);
  color: #725b11;
}

.neutral-badge,
.source-count-badge {
  padding: 7px 10px;
  background: var(--blue-100);
  color: var(--blue-800);
}

.relationship-badge {
  margin-top: 6px;
  padding: 5px 8px;
  background: #eef3f7;
  color: var(--muted);
}

/* =========================================================
   HOME FEATURES
   ========================================================= */

.features-section {
  width: min(1180px, calc(100% - 32px));
  margin: 64px auto;
}

.features-header {
  margin-bottom: 28px;
}

.features-eyebrow {
  margin: 0 0 8px;
  color: #1e5d91;
  font-size: 14px;
  font-weight: 800;
  letter-spacing: 1.4px;
}

.features-header h2 {
  margin: 0;
  color: #0d3b66;
  font-size: clamp(28px, 3vw, 40px);
  line-height: 1.15;
}

.features-intro {
  margin: 14px 0 0;
  color: #61758a;
  font-size: 17px;
  line-height: 1.6;
}

.features-grid {
  display: grid;
  grid-template-rows: minmax(0, 1fr) 250px;
  gap: 18px;
  min-width: 0;
  min-height: 0;
}

/* =========================================================
   EVENT HERO
   ========================================================= */

.event-hero,
.timeline-card,
.content-card {
  padding: 24px;
}

.event-hero {
  background: linear-gradient(
    140deg,
    #ffffff 0%,
    var(--blue-050) 70%,
    var(--yellow-100) 130%
  );
}

.event-hero-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
}

.event-hero h1 {
  margin: 6px 0 10px;
  color: var(--blue-900);
  font-size: clamp(2rem, 4vw, 3.4rem);
  line-height: 1.03;
  letter-spacing: -0.045em;
}

.event-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  color: var(--muted);
  font-weight: 600;
}

.meta-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 11px;
  border-radius: 999px;
  background: #fff;
  border: 1px solid var(--line);
}

.key-people-row {
  margin-top: 18px;
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
}

.person-chip {
  padding: 8px 11px;
  border-radius: 999px;
  background: var(--yellow-100);
  color: #6f5710;
  font-size: 0.85rem;
  font-weight: 700;
}

/* =========================================================
   TIMELINE
   ========================================================= */

.timeline {
  display: flex;
  justify-content: center;
  align-items: flex-start;
  gap: 0;
  margin-top: 24px;
  overflow-x: auto;
  padding: 4px 4px 12px;
}

.timeline-item {
  position: relative;
  min-width: 145px;
  text-align: center;
  cursor: pointer;
  padding: 0 10px;
  transition: transform 0.2s ease;
}

.timeline-item:not(:last-child)::after {
  content: "";
  position: absolute;
  top: 18px;
  left: 60%;
  width: 80%;
  height: 3px;
  background: #d8e4ee;
  z-index: 0;
}

.timeline-dot {
  width: 38px;
  height: 38px;
  margin: 0 auto 9px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--blue-100);
  border: 4px solid #fff;
  box-shadow: 0 0 0 2px #c8dce9;
  position: relative;
  z-index: 2;
  font-size: 0.72rem;
  font-weight: 800;
  color: var(--blue-800);
}

.timeline-item.current .timeline-dot {
  background: var(--yellow-500);
  color: #5f4a0c;
  box-shadow: 0 0 0 2px #efd56e;
}

.timeline-title {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--blue-900);
  line-height: 1.35;
}

.relationship-badge {
  margin-top: 6px;
  padding: 5px 8px;
  background: #eef3f7;
  color: var(--muted);
}

.neutral-badge,
.source-count-badge {
  padding: 7px 10px;
  background: var(--blue-100);
  color: var(--blue-800);
}

.timeline-desc-wrapper {
  max-height: 140px;
  overflow: hidden;
  position: relative;
  transition: max-height 0.25s ease;
  word-break: break-word;
}

.timeline-desc-wrapper.is-collapsed::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 16px;
  background: linear-gradient(transparent, #ffffff);
  pointer-events: none;
}

.timeline-desc-wrapper.is-expanded {
  max-height: 300px;
}

.timeline-toggle-btn {
  background: none;
  border: none;
  color: var(--blue-800);
  font-size: 0.7rem;
  font-weight: 700;
  padding: 0;
  margin-top: 4px;
  cursor: pointer;
  outline: none;
}

.timeline-toggle-btn:hover {
  text-decoration: underline;
}

.timeline-item:hover {
  transform: translateY(-2px);
}

.timeline-modal {
  display: none;
  position: fixed;
  z-index: 1000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.4);
}

.timeline-modal-content {
  background-color: #ffffff;
  position: relative;
  margin: 8vh auto;
  padding: 28px 24px 24px 24px;
  border-radius: 12px;
  width: 85%;
  max-width: 500px;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
}

.timeline-modal-body {
  overflow-y: auto; 
  max-height: calc(82vh - 60px); 
  padding-right: 6px; 
}

.timeline-modal-close {
  position: absolute;
  right: 16px;
  top: 12px;
  font-size: 22px;
  font-weight: bold;
  cursor: pointer;
  color: #94a3b8;
  transition: color 0.2s ease;
}

.timeline-modal-close:hover {
  color: #334155;
}

.timeline-modal-body p {
  margin: 0;
  font-size: 0.95rem;
  line-height: 1.65;
  color: #334155;
  white-space: pre-line;
}
/* =========================================================
   HISTORICAL CONTEXT
   ========================================================= */

.historical-context-card {
  min-height: 250px;
}

.historical-context-content {
  min-height: 150px;
  margin-top: 20px;
}

.overview-claims {
  display: grid;
  gap: 13px;
}

.claim {
  margin: 0;
  font-size: 1rem;
  line-height: 1.78;
  color: #31404d;
}

.api-answer {
  color: #31404d;
  font-size: 1rem;
  line-height: 1.8;
}

.api-answer p {
  margin: 0;
}

.body-copy {
  margin: 16px 0 0;
  line-height: 1.75;
  color: #40505d;
}

/* =========================================================
   RELATED HISTORY / MAP
   ========================================================= */

.related-history-card {
  min-height: 390px;
  display: flex;
  flex-direction: column;
}

.related-history-map {
  flex: 1;
  min-height: 300px;
  margin-top: 20px;
  border: 1px dashed #cbd9e5;
  border-radius: var(--radius-lg);
  background: var(--blue-050);
  overflow: hidden;
}

/* =========================================================
   SUPPORTING SOURCES
   ========================================================= */

.evidence-panel {
  height: 100%;
  min-height: 0;
  padding: 0;
  overflow: hidden;
  background: #fff;
  transition:
    border-color 0.18s ease,
    box-shadow 0.18s ease,
    transform 0.18s ease;
}

.evidence-panel:hover {
  border-color: var(--yellow-500);
  box-shadow: 0 10px 28px rgba(210, 166, 38, 0.13);
  transform: translateY(-1px);
}

.evidence-list-view {
  height: 100%;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: #fff;
}

.evidence-heading {
  flex: 0 0 auto;
  padding: 20px 18px 16px;
  background: #fff;
  border-bottom: 1px solid var(--line);
  position: relative;
  z-index: 5;
}

.evidence-list {
  flex: 1;
  min-height: 0;
  display: grid;
  align-content: start;
  gap: 11px;
  margin: 0;
  padding: 16px 18px 18px;
  overflow-y: auto;
  overscroll-behavior: auto;
  background: #fff;
}

.evidence-list::-webkit-scrollbar {
  width: 8px;
}

.evidence-list::-webkit-scrollbar-thumb {
  background: #d8e2e9;
  border-radius: 999px;
}

.evidence-list::-webkit-scrollbar-track {
  background: transparent;
}

/* =========================================================
   SOURCE CARDS
   ========================================================= */

.source-card {
  display: block;
  padding: 14px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--line);
  background: #fff;
  cursor: pointer;
  transition:
    border 0.16s ease,
    box-shadow 0.16s ease,
    transform 0.16s ease;
}

.source-card:hover,
.source-card.highlight {
  border-color: var(--yellow-500);
  box-shadow: 0 8px 24px rgba(210, 166, 38, 0.13);
  transform: translateY(-1px);
}

.source-index {
  width: 29px;
  height: 29px;
  display: inline-grid;
  place-items: center;
  border-radius: 9px;
  background: var(--blue-800);
  color: #fff;
  font-size: 0.76rem;
  font-weight: 800;
}

.source-provider {
  margin: 10px 0 4px;
  color: var(--blue-900);
  font-weight: 800;
  font-size: 0.95rem;
}

.source-title {
  margin: 0;
  color: #41505c;
  font-size: 0.84rem;
  line-height: 1.4;
}

.source-meta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}

.source-type-badge {
  padding: 5px 7px;
  background: var(--yellow-100);
  color: #6a5411;
}

.source-date {
  padding: 5px 7px;
  border-radius: 999px;
  background: #eef3f7;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 700;
}

.source-excerpt {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 0.8rem;
  line-height: 1.5;
}

.source-link-text {
  display: inline-block;
  margin-top: 11px;
  color: var(--blue-700);
  font-size: 0.78rem;
  font-weight: 800;
}

/* =========================================================
   SOURCE PREVIEW
   ========================================================= */

.source-preview {
  height: 100%;
  overflow-y: auto;
  padding: 18px;
  background: #fff;
}

.hidden {
  display: none !important;
}

.back-btn {
  padding: 8px 10px;
  border-radius: 10px;
  background: var(--blue-050);
  color: var(--blue-800);
  font-weight: 700;
  cursor: pointer;
  margin-bottom: 16px;
}

.preview-header h2 {
  margin-top: 8px;
}

.preview-provider {
  color: var(--blue-700);
  font-weight: 800;
}

.preview-excerpt {
  margin: 18px 0;
  padding: 16px;
  border-radius: var(--radius-lg);
  background: var(--yellow-100);
  line-height: 1.7;
  color: #4b442e;
}

.metadata-list {
  display: grid;
  gap: 10px;
  margin: 18px 0;
}

.metadata-row {
  display: grid;
  grid-template-columns: 110px 1fr;
  gap: 10px;
  font-size: 0.82rem;
}

.metadata-row dt {
  color: var(--muted);
  font-weight: 700;
}

.metadata-row dd {
  margin: 0;
  color: var(--ink);
}

.source-link-btn {
  display: inline-flex;
  padding: 11px 14px;
  border-radius: 13px;
  background: var(--blue-800);
  color: #fff;
  font-weight: 800;
}

/* =========================================================
   GAME
   ========================================================= */

.game-panel {
  height: 250px;
  padding: 20px;
  display: flex;
  flex-direction: column;
  cursor: pointer;
  background: #fff;
  transition:
    border-color 0.18s ease,
    box-shadow 0.18s ease,
    transform 0.18s ease;
}

.game-panel:hover,
.game-panel:focus-visible {
  border-color: var(--yellow-500);
  box-shadow: 0 10px 28px rgba(210, 166, 38, 0.13);
  transform: translateY(-2px);
  outline: none;
}

.game-placeholder {
  flex: 1;
  min-height: 0;
  margin-top: 18px;
  border-radius: var(--radius-lg);
  border: 1px dashed #e5d17a;
  background: var(--yellow-100);
}

/* =========================================================
   TOAST
   ========================================================= */

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%) translateY(20px);
  padding: 10px 14px;
  border-radius: 999px;
  background: var(--blue-900);
  color: #fff;
  opacity: 0;
  pointer-events: none;
  transition: 0.2s ease;
  z-index: 100;
  font-size: 0.85rem;
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* =========================================================
   RESPONSIVE
   ========================================================= */

@media (max-width: 1180px) {
  .event-card-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .workspace-columns {
    grid-template-columns: minmax(0, 1fr) 300px;
  }
}

@media (max-width: 900px) {
  body.explore-page {
    height: auto;
    overflow: auto;
    display: block;
  }

  .explore-topbar {
    position: sticky;
    top: 8px;
  }

  .explore-scroll-area {
    overflow: visible;
    padding-top: 18px;
  }

  .workspace-columns {
    grid-template-columns: 1fr;
  }

  .workspace-right {
    grid-template-rows: auto auto;
  }

  .evidence-panel {
    height: 520px;
  }

  .game-panel {
    height: 240px;
  }
}

@media (max-width: 820px) {
  .topbar,
  .explore-topbar {
    width: calc(100% - 20px);
    border-radius: 18px;
  }

  .brand-text {
    display: none;
  }

  .hero {
    padding-top: 70px;
  }

  .search-box-large {
    flex-direction: column;
    align-items: stretch;
  }

  .event-card-grid {
    grid-template-columns: 1fr 1fr;
  }

  .trust-card {
    grid-template-columns: 1fr;
  }

  .trust-flow {
    justify-content: flex-start;
  }

  .workspace-shell {
    width: calc(100% - 20px);
  }

  .search-box-top {
    max-width: none;
  }

  .related-history-map {
    min-height: 260px;
  }
}

@media (max-width: 560px) {
  .hero h1 {
    font-size: 2.35rem;
  }

  .event-card-grid {
    grid-template-columns: 1fr;
  }

  .section-heading-row,
  .panel-heading,
  .event-hero-top {
    align-items: flex-start;
    flex-direction: column;
  }

  .explore-topbar {
    align-items: stretch;
    flex-direction: column;
  }

  .brand,
  .language-select {
    align-self: flex-start;
  }

  .event-hero,
  .timeline-card,
  .content-card {
    padding: 18px;
  }

  .timeline-item {
    min-width: 125px;
  }

  .related-history-map {
    min-height: 220px;
  }

  .evidence-panel {
    height: 460px;
  }

  .game-panel {
    height: 220px;
  }
}

.features-section {
  width: min(1180px, calc(100% - 32px));
  margin: 64px auto;
}

.features-header {
  margin-bottom: 28px;
}

.features-eyebrow {
  margin: 0 0 8px;
  color: #1e5d91;
  font-size: 14px;
  font-weight: 800;
  letter-spacing: 1.4px;
}

.features-header h2 {
  margin: 0;
  color: #0d3b66;
  font-size: clamp(28px, 3vw, 40px);
  line-height: 1.15;
}

.features-intro {
  margin: 14px 0 0;
  color: #61758a;
  font-size: 17px;
  line-height: 1.6;
}

.features-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 20px;
}

/* Informational cards have no hover effect */
.feature-card {
  min-height: 220px;
  padding: 26px;
  border: 1px solid #dbe5ee;
  border-radius: 22px;
  background: #ffffff;
  box-shadow: 0 12px 28px rgba(18, 58, 92, 0.06);
  cursor: default;
}

.feature-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  margin-bottom: 20px;
  border-radius: 14px;
  background: #fff5cf;
  font-size: 24px;
}

.feature-card h3 {
  margin: 0 0 10px;
  color: #0d3b66;
  font-size: 21px;
  line-height: 1.25;
}

.feature-card p {
  margin: 0;
  color: #61758a;
  font-size: 16px;
  line-height: 1.55;
}

/* =========================================================
   HOME EVENT DIRECTORY
   ========================================================= */

.event-directory {
  width: min(100% - 40px, 1200px);
  margin: 64px auto;
}

.event-directory-header {
  margin-bottom: 26px;
}

.event-directory-header h2 {
  margin: 6px 0 8px;
  color: #0d3b66;
  font-size: 32px;
}

.event-directory-header p {
  color: #61758a;
}

.event-list {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.event-list-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  width: 100%;
  min-height: 64px;
  padding: 14px 18px;

  border: 1px solid #dbe5ee;
  border-radius: 16px;
  background: #ffffff;
  color: #123f6d;
  font-weight: 600;
  text-align: left;
  cursor: pointer;

  transition:
    border-color 0.2s ease,
    background 0.2s ease,
    transform 0.2s ease;
}

.event-list-item:hover {
  background: #fffaf0;
  border-color: #e8bd3f;
  transform: translateY(-2px);
}

.event-year {
  display: inline-flex;
  flex-shrink: 0;
  padding: 5px 9px;
  border-radius: 999px;
  background: #eef4f8;
  color: #61758a;
  font-size: 13px;
  font-weight: 700;
}

/* Retained for existing featured-event rendering */
.featured-section,
.trust-section {
  padding: 40px 0;
}

.event-card-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 14px;
  margin-top: 22px;
}

.event-card {
  position: relative;
  min-height: 210px;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: #ffffff;
  box-shadow: 0 10px 28px rgba(25, 55, 80, 0.05);
  cursor: pointer;
  overflow: hidden;
  transition:
    transform 0.18s ease,
    box-shadow 0.18s ease,
    border-color 0.18s ease;
}

.event-card::after {
  content: "";
  position: absolute;
  width: 90px;
  height: 90px;
  right: -35px;
  bottom: -35px;
  border-radius: 50%;
  background: var(--yellow-100);
}

.event-card:hover {
  transform: translateY(-4px);
  border-color: #c7d8e7;
  box-shadow: var(--shadow);
}

.event-card h3 {
  margin: 26px 0 9px;
  color: var(--blue-900);
  font-size: 1.05rem;
}

.event-card p {
  margin: 0;
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.55;
}

.trust-card {
  display: grid;
  grid-template-columns: 1.1fr 1fr;
  align-items: center;
  gap: 30px;
  padding: 34px;
  border-radius: 28px;
  background: linear-gradient(135deg, var(--blue-900), var(--blue-700));
  color: #ffffff;
  box-shadow: var(--shadow);
}

.trust-card .eyebrow,
.trust-card h2 {
  color: #ffffff;
}

.trust-flow {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.trust-flow span {
  padding: 9px 11px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.11);
}

.footer {
  width: min(1180px, calc(100% - 32px));
  margin: 30px auto 50px;
  color: var(--muted);
  font-size: 0.85rem;
  text-align: center;
}

/* =========================================================
   EXPLORE SCROLL AND WORKSPACE
   ========================================================= */

body.explore-page {
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.explore-scroll-area {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 22px 0 50px;
}

.workspace-shell {
  display: grid;
  gap: 18px;
  width: min(1480px, calc(100% - 28px));
  margin: 0 auto;
}

.panel-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  box-shadow: 0 8px 28px rgba(20, 45, 70, 0.05);
}

.workspace-columns {
  display: grid;
  grid-template-columns: minmax(0, 3fr) minmax(320px, 1fr);
  align-items: stretch;
  gap: 24px;
}

.workspace-main {
  display: grid;
  grid-template-rows: auto auto minmax(390px, 1fr);
  gap: 18px;
  min-width: 0;
}

.workspace-right {
  display: flex;
  align-self: stretch;
  min-width: 0;
  min-height: 0;
}

.event-hero,
.timeline-card,
.content-card {
  padding: 24px;
}

/* =========================================================
   EVENT HERO AND IMAGE
   ========================================================= */

.event-hero {
  background: linear-gradient(
    140deg,
    #ffffff 0%,
    var(--blue-050) 70%,
    var(--yellow-100) 130%
  );
}

.workspace-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  align-items: stretch;
  gap: 32px;
  width: 100%;
}

.workspace-hero.no-event-image {
  grid-template-columns: minmax(0, 1fr);
}

.event-hero-content {
  min-width: 0;
}

.event-hero-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
}

.event-hero h1 {
  margin: 6px 0 10px;
  color: var(--blue-900);
  font-size: clamp(2rem, 4vw, 3.4rem);
  line-height: 1.03;
  letter-spacing: -0.045em;
}

.event-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  color: var(--muted);
  font-weight: 600;
}

.meta-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 11px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #ffffff;
}

.hero-jump-button {
  font-family: inherit;
  cursor: pointer;
}

.hero-jump-button:focus-visible {
  outline: 2px solid #194d7d;
  outline-offset: 3px;
}

.key-people-row {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
  margin-top: 18px;
}

.person-chip {
  padding: 8px 11px;
  border-radius: 999px;
  background: var(--yellow-100);
  color: #6f5710;
  font-size: 0.85rem;
  font-weight: 700;
}

.event-image-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 180px;
  overflow: hidden;
  background: #f4f8fc;
  border: 1px dashed #c8d9e8;
  border-radius: 18px;
  color: #71869a;
  font-size: 14px;
  font-weight: 600;
}

.event-image-placeholder.has-image {
  border-style: solid;
  cursor: zoom-in;
}

.event-image-placeholder img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* =========================================================
   TIMELINE
   ========================================================= */

.timeline {
  display: flex;
  align-items: flex-start;
  width: 100%;
  gap: 0;
  margin-top: 24px;
  padding: 1rem 0.5rem;
  overflow-x: auto;
}

.timeline-track {
  display: flex;
  flex-direction: row;
  align-items: flex-start;
  position: relative;
  min-width: max-content;
  padding-top: 20px;
}

.timeline-track::before {
  content: "";
  position: absolute;
  top: 24px;
  left: 0;
  right: 0;
  height: 2px;
  background: #e5e7eb;
  z-index: 1;
}

.timeline-item {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 180px;
  min-width: 145px;
  margin-right: 1.5rem;
  padding: 0 10px;
  text-align: center;
  cursor: pointer;
  z-index: 2;
}

.timeline-item:last-child {
  margin-right: 0;
}

/* Connector for the older timeline markup */
.timeline-item:not(:last-child)::after {
  content: "";
  position: absolute;
  top: 18px;
  left: 60%;
  width: 80%;
  height: 3px;
  background: #d8e4ee;
  z-index: 0;
}

.timeline-dot {
  position: relative;
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  margin: 0 auto 9px;
  border: 4px solid #ffffff;
  border-radius: 50%;
  background: var(--blue-100);
  box-shadow: 0 0 0 2px #c8dce9;
  color: var(--blue-800);
  font-size: 0.72rem;
  font-weight: 800;
  z-index: 2;
}

.timeline-item.current .timeline-dot {
  background: var(--yellow-500);
  color: #5f4a0c;
  box-shadow: 0 0 0 2px #efd56e;
}

.timeline-marker {
  width: 10px;
  height: 10px;
  margin-bottom: 0.75rem;
  border: 2px solid #ffffff;
  border-radius: 50%;
  background: #2563eb;
  box-shadow: 0 0 0 2px #2563eb;
  z-index: 3;
}

.timeline-content {
  width: 100%;
  padding: 0.75rem;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  background: #f9fafb;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.timeline-title {
  margin: 0 0 0.25rem;
  color: var(--blue-900);
  font-size: 0.8rem;
  font-weight: 700;
  line-height: 1.3;
}

.timeline-desc {
  margin: 0;
  color: #4b5563;
  font-size: 0.8rem;
  line-height: 1.4;
}

.timeline-desc-wrapper {
  position: relative;
  max-height: 140px;
  overflow: hidden;
  word-break: break-word;
  transition: max-height 0.25s ease;
}

.timeline-desc-wrapper.is-collapsed::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 16px;
  background: linear-gradient(transparent, #ffffff);
  pointer-events: none;
}

.timeline-desc-wrapper.is-expanded {
  max-height: 300px;
}

.timeline-toggle-btn {
  margin-top: 4px;
  padding: 0;
  border: 0;
  background: none;
  color: var(--blue-800);
  font-size: 0.7rem;
  font-weight: 700;
  cursor: pointer;
}

.timeline-toggle-btn:hover {
  text-decoration: underline;
}

/* =========================================================
   HISTORICAL CONTEXT
   ========================================================= */

.historical-context-card {
  min-height: 250px;
}

.historical-context-content {
  min-height: 150px;
  margin-top: 20px;
}

.overview-claims {
  display: grid;
  gap: 13px;
}

.claim {
  margin: 0;
  color: #31404d;
  font-size: 1rem;
  line-height: 1.78;
}

.api-answer {
  color: #31404d;
  font-size: 1rem;
  line-height: 1.8;
}

.api-answer p {
  margin: 0;
}

.body-copy {
  margin: 16px 0 0;
  color: #40505d;
  line-height: 1.75;
}

/* =========================================================
   RELATED HISTORY MAP
   ========================================================= */

.related-history-card {
  display: flex;
  flex-direction: column;
  min-height: 390px;
}

.related-history-map {
  position: relative;
  flex: 1;
  width: 100%;
  height: 100%;
  min-height: 520px;
  margin-top: 20px;
  overflow: hidden;
  background: #f4f8fc;
  border: 1px dashed #c8d9e8;
  border-radius: 20px;
}

.history-map-frame {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 520px;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: inherit;
  background: transparent;
}

/* =========================================================
   SUPPORTING SOURCES
   ========================================================= */

/* Stretches to the bottom of the left column */
.evidence-panel {
  position: static;
  display: flex;
  flex-direction: column;
  flex: 1;
  width: 100%;
  height: auto;
  max-height: none;
  min-height: 0;
  margin-bottom: 0;
  padding: 0;
  overflow: hidden;
  background: #ffffff;

  transition:
    border-color 0.18s ease,
    box-shadow 0.18s ease,
    transform 0.18s ease;
}

.evidence-panel:hover {
  border-color: var(--yellow-500);
  box-shadow: 0 10px 28px rgba(210, 166, 38, 0.13);
  transform: translateY(-1px);
}

.evidence-list-view {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  overflow: hidden;
  background: #ffffff;
}

.evidence-heading {
  position: relative;
  flex: 0 0 auto;
  padding: 20px 18px 16px;
  border-bottom: 1px solid var(--line);
  background: #ffffff;
  z-index: 5;
}

/* Zero basis prevents source content from stretching the row */
.evidence-list {
  display: grid;
  align-content: start;
  gap: 11px;
  flex: 1 1 0;
  height: 0;
  min-height: 0;
  max-height: none;
  margin: 0;
  padding: 16px 18px 18px;
  overflow-y: auto;
  overflow-x: hidden;
  background: #ffffff;
  overscroll-behavior: auto;
}

.evidence-list::-webkit-scrollbar {
  width: 8px;
}

.evidence-list::-webkit-scrollbar-thumb {
  background: #d8e2e9;
  border-radius: 999px;
}

.evidence-list::-webkit-scrollbar-track {
  background: transparent;
}

/* =========================================================
   SOURCE CARDS AND PREVIEW
   ========================================================= */

.source-card {
  display: block;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: #ffffff;
  cursor: pointer;

  transition:
    border-color 0.16s ease,
    box-shadow 0.16s ease,
    transform 0.16s ease;
}

.source-card:hover,
.source-card.highlight {
  border-color: var(--yellow-500);
  box-shadow: 0 8px 24px rgba(210, 166, 38, 0.13);
  transform: translateY(-1px);
}

.source-index {
  display: inline-grid;
  place-items: center;
  width: 29px;
  height: 29px;
  border-radius: 9px;
  background: var(--blue-800);
  color: #ffffff;
  font-size: 0.76rem;
  font-weight: 800;
}

.source-provider {
  margin: 10px 0 4px;
  color: var(--blue-900);
  font-size: 0.95rem;
  font-weight: 800;
}

.source-title {
  margin: 0;
  color: #41505c;
  font-size: 0.84rem;
  line-height: 1.4;
}

.source-meta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}

.source-type-badge {
  padding: 5px 7px;
  background: var(--yellow-100);
  color: #6a5411;
}

.source-date {
  padding: 5px 7px;
  border-radius: 999px;
  background: #eef3f7;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 700;
}

.source-excerpt {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 0.8rem;
  line-height: 1.5;
}

.source-link-text {
  display: inline-block;
  margin-top: 11px;
  color: var(--blue-700);
  font-size: 0.78rem;
  font-weight: 800;
}

.source-preview {
  flex: 1 1 0;
  height: 0;
  min-height: 0;
  padding: 18px;
  overflow-y: auto;
  background: #ffffff;
}

.back-btn {
  margin-bottom: 16px;
  padding: 8px 10px;
  border-radius: 10px;
  background: var(--blue-050);
  color: var(--blue-800);
  font-weight: 700;
  cursor: pointer;
}

.preview-header h2 {
  margin-top: 8px;
}

.preview-provider {
  color: var(--blue-700);
  font-weight: 800;
}

.preview-excerpt {
  margin: 18px 0;
  padding: 16px;
  border-radius: var(--radius-lg);
  background: var(--yellow-100);
  color: #4b442e;
  line-height: 1.7;
}

.metadata-list {
  display: grid;
  gap: 10px;
  margin: 18px 0;
}

.metadata-row {
  display: grid;
  grid-template-columns: 110px 1fr;
  gap: 10px;
  font-size: 0.82rem;
}

.metadata-row dt {
  color: var(--muted);
  font-weight: 700;
}

.metadata-row dd {
  margin: 0;
  color: var(--ink);
  overflow-wrap: anywhere;
}

.source-link-btn {
  display: inline-flex;
  padding: 11px 14px;
  border-radius: 13px;
  background: var(--blue-800);
  color: #ffffff;
  font-weight: 800;
}

/* =========================================================
   GAME
   ========================================================= */

.game-panel {
  display: flex;
  flex-direction: column;
  height: 250px;
  padding: 20px;
  background: #ffffff;
  cursor: pointer;

  transition:
    border-color 0.18s ease,
    box-shadow 0.18s ease,
    transform 0.18s ease;
}

.game-panel:hover,
.game-panel:focus-visible {
  border-color: var(--yellow-500);
  box-shadow: 0 10px 28px rgba(210, 166, 38, 0.13);
  transform: translateY(-2px);
  outline: none;
}

.game-placeholder {
  flex: 1;
  min-height: 0;
  margin-top: 18px;
  border: 1px dashed #e5d17a;
  border-radius: var(--radius-lg);
  background: var(--yellow-100);
}

/* =========================================================
   IMAGE LIGHTBOX AND TOAST
   ========================================================= */

.image-lightbox {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px;
  background: rgba(0, 0, 0, 0.78);
}

.image-lightbox-image {
  display: block;
  max-width: 90vw;
  max-height: 88vh;
  object-fit: contain;
  border-radius: 16px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.35);
}

.image-lightbox-close {
  position: absolute;
  top: 24px;
  right: 32px;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.95);
  color: #123f6d;
  font-size: 32px;
  line-height: 1;
  cursor: pointer;
}

.image-lightbox-close:hover {
  background: #ffffff;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  z-index: 100;
  padding: 10px 14px;
  border-radius: 999px;
  background: var(--blue-900);
  color: #ffffff;
  font-size: 0.85rem;
  opacity: 0;
  pointer-events: none;
  transform: translateX(-50%) translateY(20px);
  transition: 0.2s ease;
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* =========================================================
   SEARCH RESULTS PAGE
   ========================================================= */

.search-results-page {
  min-height: 100vh;
  background: #f5f7fa;
  color: #203658;
}

.search-results-page .catalogue-shell {
  width: calc(100% - 48px);
  max-width: 1500px;
  margin: 0 auto;
  padding: 36px 0 48px;
}

.search-results-page .catalogue-heading {
  margin-bottom: 30px;
  padding-left: 28px;
}

.search-results-page .catalogue-eyebrow {
  margin: 0 0 12px;
  color: #416c9b;
  font-size: 13px;
  font-weight: 700;
  line-height: 1.5;
  letter-spacing: 1.5px;
}

.search-results-page .catalogue-heading h1 {
  margin: 0;
  color: #203658;
  font-size: clamp(32px, 4vw, 48px);
  font-weight: 800;
  line-height: 1.2;
  letter-spacing: -0.8px;
  overflow-wrap: anywhere;
}

.search-results-page .catalogue-description {
  margin: 16px 0 0;
  color: #73879b;
  font-size: 16px;
  line-height: 1.7;
}

.search-results-page .catalogue-section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.search-results-page .catalogue-section-heading h2 {
  margin: 0;
  color: #203658;
  font-size: 23px;
  font-weight: 700;
  line-height: 1.35;
}

.search-results-page .catalogue-count {
  flex-shrink: 0;
  padding: 6px 12px;
  border: 1px solid #dce6ef;
  border-radius: 999px;
  background: #ffffff;
  color: #73879b;
  font-size: 13px;
}

/* One event per row */
.search-results-page .catalogue-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 22px;
}

.search-results-page .catalogue-card {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  gap: 32px;

  height: 300px;
  min-height: 0;
  min-width: 0;
  padding: 28px;

  border: 1px solid #dce6ef;
  border-radius: 26px;
  background: linear-gradient(
    110deg,
    #ffffff 0%,
    #f5f9fd 72%,
    #faf9ed 100%
  );

  box-shadow: 0 6px 20px rgba(25, 77, 125, 0.025);
  overflow: hidden;
  cursor: default;

  transition:
    transform 0.2s ease,
    border-color 0.2s ease,
    box-shadow 0.2s ease;
}

.search-results-page .catalogue-event-content {
  flex: 1;
  min-width: 0;
  align-self: flex-start;
}

.search-results-page .catalogue-event-label {
  margin: 0 0 12px;
  color: #416c9b;
  font-size: 13px;
  font-weight: 800;
  line-height: 1.5;
  letter-spacing: 1.2px;
}

.search-results-page .catalogue-event-title {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;

  margin: 0 0 18px;
  overflow: hidden;
  overflow-wrap: anywhere;

  color: #203658;
  font-size: clamp(28px, 3vw, 46px);
  font-weight: 800;
  line-height: 1.15;
  letter-spacing: -0.8px;
}

.search-results-page .catalogue-event-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.search-results-page .catalogue-event-pill {
  display: inline-flex;
  align-items: center;
  max-width: 100%;
  padding: 8px 14px;
  border: 1px solid #dce6ef;
  border-radius: 999px;
  background: #ffffff;
  color: #263548;
  font-size: 15px;
  font-weight: 600;
  line-height: 1.5;
}

.search-results-page .catalogue-event-image {
  display: block;
  flex: 0 0 300px;
  width: 300px;
  height: 100%;
  min-width: 0;
  border: 1px solid #e2e8ee;
  border-radius: 20px;
  object-fit: cover;
}

.search-results-page .catalogue-recommendations {
  margin-top: 32px;
  padding-top: 28px;
  border-top: 1px solid #d5e0eb;
}

.search-results-page .catalogue-recommendations .catalogue-eyebrow {
  margin-bottom: 8px;
}

.search-results-page .catalogue-recommendation-description {
  margin: -6px 0 20px;
  color: #73879b;
  font-size: 14px;
  line-height: 1.7;
}

.search-results-page a:focus-visible,
.search-results-page button:focus-visible,
.explore-home-button:focus-visible {
  outline: 3px solid #8ab7df;
  outline-offset: 3px;
}

@media (hover: hover) {
  .search-results-page .catalogue-card:hover {
    transform: translateY(-4px);
    border-color: #a9c3dc;
    box-shadow: 0 12px 28px rgba(25, 77, 125, 0.1);
  }
}

/* =========================================================
   RESPONSIVE
   ========================================================= */

@media (max-width: 1180px) {
  .event-card-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 1100px) {
  .features-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .explore-topbar {
    flex-wrap: wrap;
    gap: 12px;
  }

  .explore-topbar > .kids-mode-button {
    margin-left: auto;
  }

  .explore-topbar .search-box-top {
    order: 3;
    flex: 1 1 100%;
    width: 100%;
    max-width: none;
    margin-left: 0;
  }
}

@media (max-width: 900px) {
  body.explore-page {
    height: auto;
    overflow: auto;
    display: block;
  }

  .explore-topbar {
    position: sticky;
    top: 8px;
  }

  .explore-scroll-area {
    overflow: visible;
    padding-top: 18px;
  }

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

  .workspace-hero {
    grid-template-columns: minmax(0, 1fr);
  }

  .workspace-right {
    height: 520px;
  }

  .event-image-placeholder {
    min-height: 220px;
  }

  .image-lightbox {
    padding: 20px;
  }

  .game-panel {
    height: 240px;
  }

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

  .search-results-page .catalogue-card {
    height: 280px;
    gap: 22px;
    padding: 24px;
  }

  .search-results-page .catalogue-event-image {
    flex-basis: 220px;
    width: 220px;
  }

  .search-results-page .catalogue-event-pill {
    padding: 6px 10px;
    font-size: 13px;
  }
}

@media (max-width: 820px) {
  .topbar {
    width: calc(100% - 20px);
    border-radius: 18px;
  }

  .brand-text {
    display: none;
  }

  .hero {
    padding-top: 70px;
  }

  .search-box-large {
    flex-direction: column;
    align-items: stretch;
  }

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

  .trust-card {
    grid-template-columns: minmax(0, 1fr);
  }

  .trust-flow {
    justify-content: flex-start;
  }

  .workspace-shell {
    width: calc(100% - 20px);
  }
}

@media (max-width: 700px) {
  .search-action-row {
    flex-direction: column;
  }

  .search-action-row .kids-mode-button {
    min-height: 58px;
    width: 100%;
  }
}

@media (max-width: 650px) {
  .features-section {
    width: calc(100% - 28px);
    margin: 44px auto;
  }

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

  .feature-card {
    min-height: auto;
  }
}

@media (max-width: 600px) {
  .event-list {
    grid-template-columns: minmax(0, 1fr);
  }

  .home-search-tip {
    font-size: 13px;
    text-align: left;
  }

  .search-results-page .catalogue-shell {
    width: calc(100% - 32px);
    padding-top: 24px;
  }

  .search-results-page .catalogue-heading {
    padding-left: 20px;
  }

  .search-results-page .catalogue-description {
    font-size: 14px;
  }

  .search-results-page .catalogue-card {
    flex-direction: column;
    align-items: stretch;
    justify-content: flex-start;
    gap: 16px;
    height: 400px;
    padding: 20px;
  }

  .search-results-page .catalogue-event-content {
    flex: 0 0 auto;
    align-self: stretch;
  }

  .search-results-page .catalogue-event-title {
    margin-bottom: 14px;
    font-size: 27px;
  }

  .search-results-page .catalogue-event-label {
    margin-bottom: 10px;
    font-size: 11px;
  }

  .search-results-page .catalogue-event-image {
    flex: 1 1 0;
    width: 100%;
    height: auto;
    min-height: 0;
    border-radius: 15px;
  }

  .search-results-page .explore-topbar .explore-home-button,
  .search-results-page .explore-topbar .kids-mode-button {
    padding: 0 12px;
    font-size: 12px;
  }
}

@media (max-width: 560px) {
  .hero h1 {
    font-size: 2.35rem;
  }

  .event-card-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .section-heading-row,
  .panel-heading,
  .event-hero-top {
    align-items: flex-start;
    flex-direction: column;
  }

  .brand,
  .language-select {
    align-self: flex-start;
  }

  .event-hero,
  .timeline-card,
  .content-card {
    padding: 18px;
  }

  .timeline-item {
    min-width: 125px;
  }

  .workspace-right {
    height: 460px;
  }

  .game-panel {
    height: 220px;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  .search-results-page .catalogue-card {
    transition: none;
  }

  .search-results-page .catalogue-card:hover {
    transform: none;
  }
}

/* 允许两栏及其内部卡片缩小到栏宽 */
.workspace-main,
.workspace-right,
.workspace-main > .panel-card {
  min-width: 0;
}

/* 时间线超出时，在左侧卡片内部横向滚动 */
.timeline {
  min-width: 0;
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
}

/* 右侧长文字自动换行 */
.source-card {
  min-width: 0;
  overflow-wrap: anywhere;
}

/* Shared styles for matching and recommended event cards */

.search-results-page .catalogue-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 24px;
}

.search-results-page .catalogue-card {
  display: flex;
  flex-direction: row;
  align-items: flex-start;
  justify-content: space-between;
  gap: 40px;

  width: 100%;
  height: auto;
  min-height: 0;
  box-sizing: border-box;
  padding: 32px;

  border: 1px solid #b9cce4;
  border-radius: 28px;
  background: linear-gradient(
    110deg,
    #ffffff 0%,
    #f6f9fd 65%,
    #faf9ef 100%
  );
  color: #253555;
}

.search-results-page .catalogue-event-content {
  flex: 1;
  min-width: 0;
}

.search-results-page .catalogue-event-label {
  margin: 0 0 18px;
  color: #5275a5;
  font-size: 14px;
  font-weight: 800;
  line-height: 1.4;
  letter-spacing: 0.08em;
}

.search-results-page .catalogue-event-title {
  margin: 0 0 24px;
  color: #253555;
  font-size: clamp(32px, 4vw, 48px);
  font-weight: 800;
  line-height: 1.12;
  letter-spacing: -0.03em;
  overflow-wrap: anywhere;
}

.search-results-page .catalogue-event-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  margin: 0;
}

.search-results-page .catalogue-event-pill {
  display: inline-flex;
  align-items: center;
  max-width: 100%;
  box-sizing: border-box;
  padding: 10px 16px;

  border: 1px solid #dce5f0;
  border-radius: 999px;
  background: #ffffff;

  color: #334155;
  font-size: 16px;
  font-weight: 600;
  line-height: 1.4;
  overflow-wrap: anywhere;
}

.search-results-page .catalogue-event-description {
  max-width: 900px;
  margin: 24px 0 0;
  color: #455773;
  font-size: 16px;
  line-height: 1.7;
  overflow-wrap: anywhere;
}

.search-results-page .catalogue-event-footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-top: 24px;
}

.search-results-page .catalogue-event-topic {
  color: #7b8ba2;
  font-size: 14px;
}

.search-results-page .catalogue-event-action {
  color: #385f94;
  font-size: 16px;
  font-weight: 700;
}

.search-results-page .catalogue-event-image {
  display: block;
  flex: 0 0 320px;
  width: 320px;
  max-width: 100%;
  height: 280px;
  margin: 0;

  border-radius: 22px;
  object-fit: cover;
  object-position: center;
}

/* Ensure failed images stay hidden despite display: block above. */
.search-results-page .catalogue-event-image[hidden] {
  display: none;
}

.search-results-page .catalogue-matching-card {
  cursor: pointer;
  transition:
    border-color 0.2s ease,
    box-shadow 0.2s ease;
}

.search-results-page .catalogue-matching-card:hover {
  border-color: #7e9fc9;
  box-shadow: 0 8px 24px rgba(37, 53, 85, 0.08);
}

.search-results-page .catalogue-matching-card:focus-visible {
  outline: 3px solid #5275a5;
  outline-offset: 4px;
}

@media (max-width: 768px) {
  .search-results-page .catalogue-card {
    flex-direction: column;
    gap: 24px;
    padding: 24px;
    border-radius: 24px;
  }

  .search-results-page .catalogue-event-content {
    width: 100%;
  }

  .search-results-page .catalogue-event-title {
    font-size: 32px;
  }

  .search-results-page .catalogue-event-pill {
    padding: 9px 14px;
    font-size: 14px;
  }

  .search-results-page .catalogue-event-image {
    flex: none;
    width: 100%;
    height: 240px;
    border-radius: 18px;
  }
}

/* 缩小卡片 */
.search-results-page .catalogue-card {
  padding: 24px;
  gap: 24px;
}

/* 缩小标题 */
.search-results-page .catalogue-event-title {
  font-size: 28px;
  margin-bottom: 16px;
}

/* 描述最多两行，超出显示省略号 */
.search-results-page .catalogue-event-description {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;

  font-size: 15px;
  line-height: 1.6;
  margin-top: 16px;
}

/* 缩小信息标签 */
.search-results-page .catalogue-event-pill {
  padding: 7px 12px;
  font-size: 14px;
}

/* 缩小图片 */
.search-results-page .catalogue-event-image {
  flex: 0 0 220px;
  width: 220px;
  height: 160px;
  border-radius: 16px;
}

.search-results-page .catalogue-event-footer {
  margin-top: 16px;
}

@media (max-width: 768px) {
  .search-results-page .catalogue-card {
    padding: 20px;
    gap: 16px;
  }

  .search-results-page .catalogue-event-image {
    flex: none;
    width: 100%;
    height: 160px;
  }
}

.search-results-page #recommendedEventsSection[hidden] {
  display: none;
}

/* Platform introduction: horizontal rows */
.features-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.features-list .feature-row {
  display: grid;
  grid-template-columns: 48px 230px minmax(0, 1fr);
  align-items: center;
  gap: 20px;
  padding: 20px 24px;
  background: #ffffff;
  border: 1px solid #dbe5ee;
  border-radius: 16px;
  box-shadow: none;
  transform: none;
  transition: none;
  cursor: default;
}

.features-list .feature-row-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  background: #fff5cf;
  border-radius: 12px;
  font-size: 24px;
}

.features-list .feature-row h3 {
  margin: 0;
  color: #0d3b66;
  font-size: 20px;
  line-height: 1.35;
}

.features-list .feature-row p {
  margin: 0;
  color: #61758a;
  font-size: 16px;
  line-height: 1.6;
  overflow-wrap: anywhere;
}

/* Smaller screens: description sits below the title */
@media (max-width: 900px) {
  .features-list .feature-row {
    grid-template-columns: 48px minmax(0, 1fr);
    gap: 8px 16px;
    padding: 18px;
  }

  .features-list .feature-row-icon {
    grid-column: 1;
    grid-row: 1 / span 2;
    align-self: start;
  }

  .features-list .feature-row h3,
  .features-list .feature-row p {
    grid-column: 2;
  }
}

/* 首页纯色背景 */
body.home-page {
  background: #f6f8fb;
}

/* 去掉原来的黄色斑点 */
body.home-page .hero::before {
  content: none !important;
  display: none !important;
}

/* Homepage styles moved from index.html */

    /* Brand icon */
    .home-page .brand-mark.timeatlas-mark {
      display: inline-flex;
      align-items: center;
      justify-content: center;
      flex-shrink: 0;
      padding: 0;
      overflow: hidden;
      background: #194d7d;
      background-image: none;
      color: #ffffff;
      box-shadow: none;
      line-height: 1;
    }

    .home-page .brand-mark.timeatlas-mark::before,
    .home-page .brand-mark.timeatlas-mark::after {
      content: none;
      display: none;
    }

    .home-page .timeatlas-mark svg {
      display: block;
      width: 55%;
      height: 55%;
    }

    /* Header navigation */
    .home-page .topbar-actions {
      display: flex;
      align-items: center;
      gap: 16px;
    }

    .home-page .topbar-actions .kids-mode-button {
      display: inline-flex;
      align-items: center;
      justify-content: center;
      flex: none;
      width: auto;
      min-width: 0;
      margin: 0;
      white-space: nowrap;
    }

    /* Search now uses the space previously occupied by Kids Mode */
    .home-page .search-action-row {
      display: flex;
      width: 100%;
    }

    .home-page #homeSearchForm {
      flex: 1 1 100%;
      width: 100%;
      max-width: 900px;
      min-width: 0;
      box-sizing: border-box;
    }

    .home-page #homeSearchInput {
      flex: 1 1 auto;
      width: 100%;
      min-width: 0;
    }

    .home-page #homeSearchForm .primary-btn {
      flex-shrink: 0;
    }

    /* Search tip */
    .home-search-tip {
      display: flex;
      align-items: flex-start;
      justify-content: center;
      gap: 8px;
      margin: 14px 0 0;
      color: #64748b;
      font-size: 14px;
      line-height: 1.6;
    }

    .home-search-tip svg {
      flex-shrink: 0;
      width: 20px;
      height: 20px;
      margin-top: 1px;
    }

    .home-search-tip span {
      min-width: 0;
    }

    @media (max-width: 600px) {
      .home-page .topbar {
        flex-wrap: wrap;
        gap: 14px;
      }

      .home-page .topbar-actions {
        gap: 12px;
      }

      .home-search-tip {
        font-size: 13px;
        text-align: left;
      }
    }
  
/* Solid homepage background */
body.home-page {
  background: #f6f8fb;
}

body.home-page .hero::before {
  content: none !important;
  display: none !important;
}
