/* Digital Yuanmingyuan — inspired by digitalbenin.org */

:root {
  --bg: #f7f5f0;
  --bg-dark: #1a1a1a;
  --text: #1a1a1a;
  --text-muted: #5c5c5c;
  --accent: #8b2942;
  --accent-light: #c45c6a;
  --border: #ddd8ce;
  --card: #ffffff;
  --header-h: 64px;
  --font-serif: "Georgia", "Times New Roman", serif;
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "PingFang SC", "Microsoft YaHei", sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body { font-family: var(--font-sans); background: var(--bg); color: var(--text); line-height: 1.6; overflow-x: hidden; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

.site-header {
  position: sticky; top: 0; z-index: 200;
  background: rgba(26, 26, 26, 0.92); backdrop-filter: blur(12px);
  color: #fff;
  height: var(--header-h); display: flex; align-items: center;
  padding: 0 2rem; gap: 2rem;
}
.site-logo { font-family: var(--font-serif); font-size: 1.25rem; color: #fff; white-space: nowrap; }
.site-logo span { color: var(--accent-light); }
.site-nav { display: flex; gap: 1.5rem; flex-wrap: wrap; }
.site-nav a { color: rgba(255,255,255,0.85); font-size: 0.9rem; text-decoration: none; }
.site-nav a:hover, .site-nav a.active { color: #fff; text-decoration: none; }

.hero {
  position: relative; min-height: 88vh;
  display: flex; align-items: center; justify-content: center;
  color: #fff; padding: 6rem 2rem 5rem; text-align: center; overflow: hidden;
}
.hero-bg {
  position: absolute; inset: 0; z-index: 0;
}
.hero-bg-slide {
  position: absolute; inset: 0; overflow: hidden;
}
.hero-bg-slide img {
  width: 100%; height: 100%; object-fit: cover; will-change: transform;
}
.hero-overlay {
  position: absolute; inset: 0; z-index: 1;
  background: linear-gradient(
    180deg,
    rgba(26, 26, 26, 0.55) 0%,
    rgba(44, 24, 16, 0.72) 45%,
    rgba(26, 26, 26, 0.88) 100%
  );
}
.hero-content { position: relative; z-index: 2; max-width: 760px; }
.hero-eyebrow {
  font-size: 0.8rem; letter-spacing: 0.22em; text-transform: uppercase;
  color: var(--accent-light); margin-bottom: 1rem; opacity: 0.95;
}
.hero h1 { font-family: var(--font-serif); font-size: clamp(2rem, 5vw, 3.2rem); font-weight: normal; margin-bottom: 1rem; }
.hero-lead { max-width: 640px; margin: 0 auto 2rem; opacity: 0.92; line-height: 1.75; }
.hero-lead a { color: #f0c8a0; }
.hero-stats { display: flex; justify-content: center; gap: 3rem; flex-wrap: wrap; }
.hero-stat strong { display: block; font-size: 2rem; font-family: var(--font-serif); color: var(--accent-light); }
.hero-stat span { font-size: 0.85rem; opacity: 0.8; }

/* Horizontal image showcase — native horizontal scroll */
.image-showcase {
  background: var(--bg-dark); color: #fff;
  padding-bottom: 1rem;
}
.showcase-inner { padding: 3rem 0 2rem; }
.showcase-header { padding: 0 2rem 2rem; max-width: 1200px; margin: 0 auto; }
.showcase-header .section-title { color: #fff; }
.showcase-header .section-sub { color: rgba(255,255,255,0.65); margin-bottom: 0; }
.showcase-viewport {
  overflow-x: auto;
  overflow-y: hidden;
  padding: 0 2rem 1.5rem;
  scroll-snap-type: x proximity;
  -webkit-overflow-scrolling: touch;
  scrollbar-color: rgba(255,255,255,0.35) transparent;
}
.showcase-viewport::-webkit-scrollbar { height: 8px; }
.showcase-viewport::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.25); border-radius: 4px; }
.showcase-track {
  display: flex; gap: 1.25rem; width: max-content; padding-bottom: 0.5rem;
}
.showcase-item {
  flex: 0 0 clamp(260px, 28vw, 340px);
  scroll-snap-align: start;
  display: block; color: inherit; text-decoration: none;
  border: 1px solid rgba(255,255,255,0.12); overflow: hidden;
  background: rgba(255,255,255,0.04); transition: border-color 0.3s;
}
.showcase-item:hover { border-color: var(--accent-light); text-decoration: none; }
.showcase-item img {
  width: 100%; aspect-ratio: 3/4; object-fit: cover; display: block;
  will-change: transform;
}
.showcase-caption { padding: 1rem 1.1rem 1.25rem; }
.showcase-id { display: block; font-family: monospace; font-size: 0.72rem; color: var(--accent-light); margin-bottom: 0.35rem; }
.showcase-name { font-size: 0.88rem; line-height: 1.45; color: rgba(255,255,255,0.88); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

.section { padding: 3rem 2rem; max-width: 1200px; margin: 0 auto; }
.section-title { font-family: var(--font-serif); font-size: 1.75rem; margin-bottom: 0.5rem; }
.section-sub { color: var(--text-muted); margin-bottom: 2rem; }

.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 1.5rem; }
.nav-card {
  background: var(--card); border: 1px solid var(--border); padding: 2rem;
  display: block; color: inherit; text-decoration: none;
  will-change: transform;
}
.nav-card:hover { text-decoration: none; box-shadow: 0 8px 24px rgba(0,0,0,0.08); }
.nav-card h3 { font-family: var(--font-serif); font-size: 1.2rem; margin: 0; }
.nav-card p { color: var(--text-muted); font-size: 0.9rem; }

.catalogue-layout {
  display: grid; grid-template-columns: 260px 1fr; gap: 2rem;
  max-width: 1400px; margin: 0 auto; padding: 2rem;
}
@media (max-width: 900px) { .catalogue-layout { grid-template-columns: 1fr; } }

.filters {
  background: var(--card); border: 1px solid var(--border); padding: 1.5rem;
  height: fit-content; position: sticky; top: calc(var(--header-h) + 1rem);
}
.filters h3 { font-size: 0.85rem; text-transform: uppercase; letter-spacing: 0.08em; margin-bottom: 1rem; color: var(--text-muted); }
.filter-group { margin-bottom: 1.25rem; }
.filter-group label { display: block; font-size: 0.8rem; color: var(--text-muted); margin-bottom: 0.35rem; }
.filter-group select, .filter-group input {
  width: 100%; padding: 0.5rem; border: 1px solid var(--border); background: var(--bg); font-size: 0.9rem;
}
.result-count { font-size: 0.9rem; color: var(--text-muted); margin-bottom: 1rem; }

.artifact-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 1.25rem; }
.artifact-card {
  background: var(--card); border: 1px solid var(--border); overflow: hidden;
  display: flex; flex-direction: column; color: inherit; text-decoration: none;
  will-change: transform, opacity;
}
.artifact-card:hover { box-shadow: 0 6px 20px rgba(0,0,0,0.1); text-decoration: none; }
.artifact-card-img {
  aspect-ratio: 4/3; background: #e8e4dc;
  display: flex; align-items: center; justify-content: center; overflow: hidden;
}
.artifact-card-img img {
  width: 100%; height: 100%; object-fit: cover;
  will-change: transform; transform-origin: center center;
}
.artifact-card-img .placeholder { color: var(--text-muted); font-size: 0.75rem; text-align: center; padding: 1rem; }
.artifact-card-body { padding: 1rem; flex: 1; }
.artifact-id { font-size: 0.7rem; font-family: monospace; color: var(--accent); letter-spacing: 0.05em; margin-bottom: 0.25rem; }
.artifact-card-body h3 { font-size: 0.95rem; font-weight: 600; margin-bottom: 0.35rem; }
.artifact-meta { font-size: 0.78rem; color: var(--text-muted); }
.tag { display: inline-block; font-size: 0.7rem; padding: 0.15rem 0.5rem; background: #f0ebe3; border-radius: 2px; margin-top: 0.5rem; margin-right: 0.25rem; }
.tag.returned { background: #e8f4e8; color: #2d5a2d; }
.tag.prov-confirmed { background: #e8f4e8; color: #2d5a2d; }
.tag.prov-likely { background: #e8eef8; color: #2a4a7a; }
.tag.prov-suspected { background: #fff4e5; color: #8a5a00; }
.tag.prov-unverified { background: #eceae6; color: #666; }
.provenance-note { font-size: 0.85rem; color: #666; margin: 0.75rem 0 0; max-width: 48rem; line-height: 1.5; }

.detail-page { max-width: 1100px; margin: 0 auto; padding: 2rem; }
.detail-header .catalog-id { font-family: monospace; color: var(--accent); font-size: 0.9rem; }
.detail-header h1 { font-family: var(--font-serif); font-size: clamp(1.5rem, 4vw, 2.2rem); font-weight: normal; margin: 0.5rem 0; }
.detail-header .subtitle { color: var(--text-muted); font-style: italic; }
.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 2rem; }
@media (max-width: 768px) { .detail-grid { grid-template-columns: 1fr; } }
.detail-image { background: #e8e4dc; aspect-ratio: 1; display: flex; align-items: center; justify-content: center; overflow: hidden; }
.detail-image img { max-width: 100%; max-height: 100%; object-fit: contain; will-change: transform; transform-origin: center center; }
.detail-header, .detail-table, .detail-desc, .back-link { will-change: transform, opacity; }
.detail-table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
.detail-table th { text-align: left; padding: 0.6rem 0.75rem 0.6rem 0; width: 38%; color: var(--text-muted); font-weight: 500; border-bottom: 1px solid var(--border); vertical-align: top; }
.detail-table td { padding: 0.6rem 0; border-bottom: 1px solid var(--border); }
.detail-desc { margin-top: 2rem; padding: 1.5rem; background: var(--card); border: 1px solid var(--border); }
.detail-desc h2 { font-family: var(--font-serif); font-size: 1.1rem; margin-bottom: 0.75rem; }
.sources li { margin-left: 1.2rem; margin-bottom: 0.25rem; font-size: 0.85rem; }
.back-link { display: inline-block; margin-bottom: 1.5rem; font-size: 0.9rem; }

.inst-table { width: 100%; border-collapse: collapse; background: var(--card); border: 1px solid var(--border); }
.inst-table th, .inst-table td { padding: 0.85rem 1rem; text-align: left; border-bottom: 1px solid var(--border); }
.inst-table th { background: var(--bg-dark); color: #fff; font-size: 0.85rem; }
.inst-table tr:hover td { background: #faf8f4; }

.site-footer { background: var(--bg-dark); color: rgba(255,255,255,0.6); padding: 2rem; text-align: center; font-size: 0.85rem; margin-top: 4rem; }
.notice { background: #fff8e6; border: 1px solid #e6d9a8; padding: 1rem 1.25rem; margin: 1rem auto; font-size: 0.88rem; max-width: 1200px; }

/* World map section */
.map-section {
  background: linear-gradient(180deg, #ebe6dc 0%, var(--bg) 100%);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  padding: 3rem 0 3.5rem;
}
.map-section-inner { max-width: 1400px; margin: 0 auto; padding: 0 2rem; }
.map-section-header { margin-bottom: 1rem; }
.map-layout {
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 1.25rem;
  align-items: stretch;
}
@media (max-width: 960px) {
  .map-layout { grid-template-columns: 1fr; }
}
.map-main { position: relative; min-height: 480px; }
.museum-map-canvas {
  height: min(62vh, 560px);
  min-height: 420px;
  border: 1px solid var(--border);
  background: #1a3040;
  position: relative;
  overflow: hidden;
}
.map-img-wrap {
  width: 100%;
  height: 100%;
  position: relative;
}
.map-viewport-outer {
  width: 100%;
  height: 100%;
  overflow: hidden;
  position: relative;
}
.map-transform {
  position: absolute;
  left: 0;
  top: 0;
  transform-origin: 0 0;
  will-change: transform;
}
.map-tiles {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}
.map-tile {
  position: absolute;
  display: block;
  user-select: none;
  pointer-events: none;
}
.map-pins-overlay {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: 2;
}
.map-bg-img {
  width: 100%;
  height: auto;
  display: block;
  user-select: none;
  pointer-events: none;
}
.map-pins {
  display: none;
}
.map-pin {
  position: absolute;
  transform: translate(-50%, -50%);
  border: 2px solid #fff;
  border-radius: 50%;
  background: #c45c6a;
  box-shadow: 0 2px 8px rgba(0,0,0,0.35);
  cursor: pointer;
  pointer-events: auto;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.15s, background 0.15s;
}
.map-pin:hover, .map-pin.is-active {
  background: #7a2238;
  transform: translate(-50%, -50%) scale(1.12);
  z-index: 3;
}
.map-pin-city {
  min-width: 28px;
  min-height: 28px;
  border-radius: 50%;
  padding: 0;
}
.map-pin-city:hover::after,
.map-pin-city.is-active::after {
  content: attr(data-city-label);
  position: absolute;
  left: 50%;
  top: calc(100% + 4px);
  transform: translateX(-50%);
  background: rgba(20, 30, 40, 0.92);
  color: #fff;
  font-size: 0.62rem;
  font-weight: 600;
  padding: 0.15rem 0.4rem;
  border-radius: 4px;
  white-space: nowrap;
  pointer-events: none;
  z-index: 5;
}
.map-pin-city-label { display: none; }
.map-pin-count {
  font-size: 0.58rem;
  font-weight: 700;
  color: #fff;
  line-height: 1;
  pointer-events: none;
}
.map-img-wrap.pan-mode .map-viewport-outer { cursor: grab; }
.map-img-wrap.pan-mode.is-dragging .map-viewport-outer { cursor: grabbing; }
.svg-map-wrap {
  width: 100%;
  height: 100%;
  position: relative;
  cursor: default;
}
.svg-map-wrap.pan-mode { cursor: grab; }
.svg-map-wrap.pan-mode.is-dragging { cursor: grabbing; }
.svg-map {
  width: 100%;
  height: 100%;
  display: block;
  user-select: none;
  touch-action: pan-y;
}
.svg-map-hint {
  position: absolute;
  left: 10px;
  bottom: 8px;
  margin: 0;
  font-size: 0.72rem;
  color: rgba(26,26,26,0.55);
  pointer-events: none;
  z-index: 4;
}
.map-btn.is-active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}
.svg-map-toolbar {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 5;
  display: flex;
  gap: 4px;
}
.map-btn {
  width: 32px;
  height: 32px;
  border: 1px solid var(--border);
  background: rgba(255,255,255,0.92);
  color: var(--text);
  font-size: 1rem;
  line-height: 1;
  cursor: pointer;
  border-radius: 2px;
}
.map-btn:hover { background: #fff; border-color: var(--accent-light); }
.map-tooltip {
  position: absolute;
  z-index: 6;
  pointer-events: none;
  background: rgba(26,26,26,0.92);
  color: #fff;
  padding: 0.45rem 0.65rem;
  border-radius: 2px;
  font-size: 0.75rem;
  line-height: 1.4;
  max-width: 220px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.2);
}
.map-tooltip strong { display: block; margin-bottom: 0.15rem; }
.map-tooltip span { color: rgba(255,255,255,0.75); font-size: 0.7rem; }
.map-attribution {
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-top: 0.5rem;
}
.map-sidebar {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  min-height: 420px;
}
.map-panel {
  flex: 0 0 auto;
  background: var(--card);
  border: 1px solid var(--border);
  padding: 1.25rem 1.35rem;
  min-height: 220px;
}
.map-panel-eyebrow {
  font-size: 0.72rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 0.35rem;
}
.map-panel h3 {
  font-family: var(--font-serif);
  font-size: 1.15rem;
  font-weight: normal;
  line-height: 1.35;
  margin-bottom: 0.65rem;
}
.map-panel-default p,
.map-panel-content p { font-size: 0.9rem; color: var(--text-muted); line-height: 1.65; }
.map-panel-muted {
  font-size: 0.88rem;
  color: var(--text-muted);
  margin: 0;
  text-align: center;
  padding: 0.5rem 0;
}
.map-panel-count { color: var(--text) !important; margin-bottom: 0.75rem; }
.map-panel-count strong { color: var(--accent); font-size: 1.1rem; }
.map-panel-hints {
  margin-top: 1rem;
  padding-left: 1.1rem;
  font-size: 0.85rem;
  color: var(--text-muted);
}
.map-panel-hints li { margin-bottom: 0.35rem; }
.map-panel-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 1rem;
}
.btn-primary, .btn-secondary {
  display: inline-block;
  padding: 0.45rem 0.85rem;
  font-size: 0.82rem;
  border-radius: 2px;
  text-decoration: none;
}
.btn-primary {
  background: var(--accent);
  color: #fff !important;
  border: 1px solid var(--accent);
}
.btn-primary:hover { background: #6d2035; text-decoration: none; }
.btn-secondary, .map-panel-link {
  background: var(--bg);
  color: var(--accent) !important;
  border: 1px solid var(--border);
}
.btn-secondary:hover, .map-panel-link:hover { background: #fff; text-decoration: none; }
.map-samples {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(92px, 1fr));
  gap: 0.5rem;
  margin: 0.75rem 0 0.25rem;
}
.map-sample {
  display: block;
  border: 1px solid var(--border);
  color: inherit;
  text-decoration: none;
  overflow: hidden;
  background: var(--bg);
}
.map-sample:hover { border-color: var(--accent-light); text-decoration: none; }
.map-sample-img {
  aspect-ratio: 1;
  background: #e8e4dc;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.map-sample-img img { width: 100%; height: 100%; object-fit: cover; }
.map-sample-img span { font-size: 0.65rem; color: var(--text-muted); padding: 0.25rem; text-align: center; }
.map-sample-body { padding: 0.35rem 0.4rem 0.45rem; }
.map-sample-id { display: block; font-family: monospace; font-size: 0.62rem; color: var(--accent); }
.map-sample-name {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  font-size: 0.68rem;
  line-height: 1.35;
  color: var(--text-muted);
}
.map-list-wrap {
  flex: 1;
  background: var(--card);
  border: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}
.map-list-title {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border);
}
.map-inst-list {
  overflow-y: auto;
  max-height: 260px;
}
.map-list-item {
  display: block;
  width: 100%;
  text-align: left;
  padding: 0.65rem 1rem;
  border: none;
  border-bottom: 1px solid var(--border);
  background: transparent;
  cursor: pointer;
  font-family: inherit;
}
.map-list-item:hover { background: #faf8f4; }
.map-list-item.active {
  background: #f5ece8;
  border-left: 3px solid var(--accent);
  padding-left: calc(1rem - 3px);
}
.map-list-name {
  display: block;
  font-size: 0.82rem;
  color: var(--text);
  line-height: 1.35;
  margin-bottom: 0.15rem;
}
.map-list-meta { font-size: 0.72rem; color: var(--text-muted); }
.map-empty { padding: 2rem; text-align: center; color: var(--text-muted); line-height: 1.6; }
.map-empty code { font-size: 0.8rem; background: #f0ebe3; padding: 0.15rem 0.35rem; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .hero-bg-slide img, .showcase-item img, .artifact-card-img img { will-change: auto; }
}
/* Evidence and coverage are part of the public catalogue. */
.evidence-panel {border:1px solid #c8bca9;border-left:4px solid #52705c;background:#f2eee5;padding:1.4rem;margin:1.5rem 0 2rem;line-height:1.8;}
.evidence-panel h2 {margin-top:0;}.evidence-list li {margin:1.3rem 0;}.evidence-list p {margin:.4rem 0;}.evidence-list blockquote {font-size:.9rem;border-left:2px solid #b1a48f;padding-left:1rem;margin:1rem 0;color:#5b5b50;}
.verification-limit {font-size:.9rem;color:#635b50;}.audit-banner {max-width:1200px;margin:2rem auto;padding:1.5rem 2rem;background:#eee9df;border-left:3px solid #766249;}.catalogue-intro{line-height:1.8;max-width:64em;color:#6d6457;}
.prov-excluded,.prov-duplicate{background:#e4e2df;color:#62594f;}.prov-unverified{background:#eee9df;color:#74624c;}.audit-stats{display:grid;grid-template-columns:repeat(auto-fit,minmax(150px,1fr));gap:1rem;margin:2rem 0;}.audit-stat{background:#eee9df;padding:1.3rem;}.audit-stat strong{display:block;font-size:2rem;color:#4b5948;}.source-list{padding-left:1.5rem;}.source-list li{padding:1rem 0;border-bottom:1px solid #ded7c9;overflow-wrap:anywhere;}.source-controls{display:flex;gap:1rem;flex-wrap:wrap;margin:1.5rem 0;}.source-controls input,.source-controls select{padding:.7rem;border:1px solid #c8bca9;background:#faf8f3;max-width:100%;}.source-controls input{flex:1;min-width:200px;} .source-pager{display:flex;gap:1rem;align-items:center;margin:1rem 0;}.source-pager button{padding:.6rem 1rem;border:1px solid #c8bca9;background:#eee9df;cursor:pointer;}.source-pager button:disabled{opacity:.4;cursor:default;}.source-status{font-size:.85rem;color:#79654e;} .site-nav{flex-wrap:wrap;} .sources a{overflow-wrap:anywhere;}
@media(max-width:650px){.site-header{flex-wrap:wrap;gap:.7rem;}.site-nav{gap:.8rem;}.evidence-panel{padding:1rem;}.detail-header h1{overflow-wrap:anywhere;}}
