:root {
  color-scheme: light;
  --ink: #171a18;
  --ink-soft: #343936;
  --muted: #6d726e;
  --paper: #f3f1eb;
  --paper-deep: #e8e4db;
  --panel: #fbfaf7;
  --line: #d4d0c7;
  --song: #a54236;
  --song-soft: #ead8d2;
  --west: #315f8e;
  --west-soft: #d8e2ed;
  --jade: #466b5d;
  --gold: #bf975b;
  --shadow: 0 18px 48px rgba(25, 29, 26, 0.1);
  --header-height: 72px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  overflow-x: hidden;
  background: var(--paper);
  color: var(--ink);
  font-family: Inter, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", Arial, sans-serif;
}
body:has(dialog[open]) { overflow: hidden; }
a { color: inherit; text-decoration: none; }
button, input { font: inherit; }
button { color: inherit; }
img { display: block; max-width: 100%; }

.site-header {
  position: sticky;
  z-index: 50;
  top: 0;
  display: flex;
  min-height: var(--header-height);
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(23, 26, 24, 0.12);
  background: rgba(243, 241, 235, 0.9);
  padding: 0 5vw;
  backdrop-filter: blur(18px);
}
.site-header--overlay {
  position: absolute;
  right: 0;
  left: 0;
  color: #fff;
  border-color: rgba(255,255,255,0.22);
  background: linear-gradient(rgba(12,14,13,0.68), transparent);
  backdrop-filter: none;
}
.site-brand { display: inline-flex; align-items: center; gap: 12px; }
.site-brand > span:last-child { display: grid; gap: 1px; }
.site-brand strong { font-size: 15px; }
.site-brand small { color: var(--muted); font-size: 10px; letter-spacing: 0.12em; }
.site-header--overlay .site-brand small { color: rgba(255,255,255,0.7); }
.brand-seal {
  display: grid;
  width: 40px;
  height: 40px;
  place-items: center;
  border: 1px solid currentColor;
  border-radius: 50%;
  font-family: "Songti SC", STSong, serif;
  font-size: 18px;
  font-weight: 800;
}
.site-nav { display: flex; align-items: center; gap: 30px; color: var(--muted); font-size: 14px; }
.site-header--overlay .site-nav { color: rgba(255,255,255,0.76); }
.site-nav a { position: relative; padding: 26px 0 24px; }
.site-nav a::after { content: ""; position: absolute; right: 0; bottom: 17px; left: 0; height: 1px; background: currentColor; transform: scaleX(0); transition: transform 220ms ease; }
.site-nav a:hover::after, .site-nav a[aria-current="page"]::after { transform: scaleX(1); }
.site-nav a[aria-current="page"] { color: var(--ink); }
.site-header--overlay .site-nav a[aria-current="page"] { color: #fff; }
.nav-toggle { display: none; border: 1px solid currentColor; border-radius: 999px; background: transparent; padding: 8px 14px; }

.section { padding: 88px 6vw; }
.section--compact { padding-top: 66px; padding-bottom: 64px; }
.section--flush-top { padding-top: 0; }
.eyebrow { margin: 0 0 14px; color: var(--song); font-size: 11px; font-weight: 900; letter-spacing: 0.14em; text-transform: uppercase; }
.button {
  display: inline-flex;
  min-height: 48px;
  align-items: center;
  justify-content: center;
  gap: 12px;
  border: 1px solid transparent;
  border-radius: 999px;
  padding: 0 22px;
  font-size: 14px;
  font-weight: 800;
  transition: transform 220ms ease, background 220ms ease, color 220ms ease;
}
.button:hover { transform: translateY(-2px); }
.button--light { color: #151816; background: #fff; }
.button--dark { color: #fff; background: var(--ink); }
.button--line { border-color: var(--ink); }
.button--ghost { color: #fff; border-color: rgba(255,255,255,0.62); }
.back-link { border: 0; background: transparent; padding: 0; color: var(--muted); cursor: pointer; font-size: 13px; font-weight: 800; }
.back-link:hover { color: var(--ink); }

.museum-hero {
  position: relative;
  display: grid;
  min-height: 90svh;
  align-items: center;
  overflow: hidden;
  padding: calc(var(--header-height) + 7vw) 7vw 8vw;
  color: #fff;
  background: #171916;
}
.museum-hero > img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; animation: hero-pan 26s ease-in-out infinite alternate; }
.museum-hero-shade { position: absolute; inset: 0; background: linear-gradient(90deg, rgba(10,12,11,0.88) 0%, rgba(10,12,11,0.48) 48%, rgba(10,12,11,0.25) 74%, rgba(10,12,11,0.6) 100%); }
.museum-hero-copy { position: relative; z-index: 1; width: min(860px, 90%); text-align: center; justify-self: center; }
.museum-hero .eyebrow, .end-page .eyebrow { color: #dfba81; }
.museum-hero h1 { margin: 0; font-family: "Songti SC", STSong, serif; font-size: clamp(44px, 7.6vw, 102px); font-weight: 600; line-height: 1.02; }
.museum-hero h1 span { display: block; margin-top: 12px; font-family: inherit; font-size: 0.37em; font-weight: 500; letter-spacing: 0.08em; }
.museum-hero-copy > p:not(.eyebrow) { max-width: 640px; margin: 28px auto 34px; color: rgba(255,255,255,0.84); font-size: 18px; line-height: 1.8; }
.hero-caption { position: absolute; z-index: 1; right: 3vw; bottom: 4vw; margin: 0; color: rgba(255,255,255,0.66); font-size: 11px; writing-mode: vertical-rl; }
.home-intro { display: grid; grid-template-columns: 1.2fr 0.8fr; gap: 8vw; align-items: start; background: var(--panel); }
.home-intro h2 { margin: 0; font-family: "Songti SC", STSong, serif; font-size: clamp(34px, 4.2vw, 62px); font-weight: 500; line-height: 1.24; }
.home-intro-copy p { margin: 0; color: var(--muted); font-size: 17px; line-height: 1.9; }
.intro-links { display: flex; flex-wrap: wrap; gap: 28px; margin-top: 30px; }
.intro-links a { border-bottom: 1px solid currentColor; padding-bottom: 6px; font-weight: 800; }

.page-lead { border-bottom: 1px solid var(--line); background: var(--panel); }
.page-lead .back-link { margin-bottom: 54px; }
.page-lead h1 { max-width: 860px; margin: 0; font-family: "Songti SC", STSong, serif; font-size: clamp(42px, 6.7vw, 88px); font-weight: 500; line-height: 1.08; }
.page-lead > p:last-child { max-width: 620px; margin: 28px 0 0; color: var(--muted); font-size: 17px; line-height: 1.8; }

.timeline-section { padding-bottom: 50px; background: #1b1e1c; color: #fff; }
.timeline-toolbar { display: flex; align-items: end; justify-content: space-between; padding-top: 52px; padding-bottom: 24px; }
.timeline-toolbar h2 { margin: 0; font-size: 30px; }
.timeline-toolbar p { margin: 8px 0 0; color: rgba(255,255,255,0.55); }
.timeline-legend { display: flex; gap: 22px; color: rgba(255,255,255,0.7); font-size: 12px; }
.timeline-legend span { display: inline-flex; align-items: center; gap: 8px; }
.timeline-legend span::before { content: ""; width: 9px; height: 9px; border-radius: 50%; background: var(--song); }
.timeline-legend .legend-west::before { background: #6e9bca; }
.timeline-scroll { overflow-x: auto; padding: 16px 6vw 50px; scrollbar-color: #666 #2b2e2c; }
.parallel-timeline { position: relative; width: max(1380px, 100%); height: 610px; }
.timeline-axis { position: absolute; top: 284px; right: 0; left: 0; height: 1px; background: rgba(255,255,255,0.5); }
.timeline-axis::after { content: ""; position: absolute; top: -3px; right: 0; border-width: 4px 0 4px 8px; border-style: solid; border-color: transparent transparent transparent rgba(255,255,255,0.72); }
.timeline-culture-label { position: absolute; left: 0; color: rgba(255,255,255,0.6); font-size: 11px; font-weight: 900; letter-spacing: 0.14em; }
.timeline-culture-label--song { top: 18px; color: #dd8b7d; }
.timeline-culture-label--west { top: 544px; color: #8db8e1; }
.year-mark { position: absolute; top: 272px; left: var(--left); color: rgba(255,255,255,0.64); font-size: 10px; transform: translateX(-50%); }
.year-mark i { display: block; width: 1px; height: 24px; margin: 0 auto 5px; background: rgba(255,255,255,0.3); }
.period-block {
  position: absolute;
  left: var(--left);
  width: var(--width);
  min-width: 92px;
  height: 118px;
  border: 1px solid rgba(255,255,255,0.14);
  border-radius: 6px;
  padding: 14px;
  color: #fff;
  background: rgba(255,255,255,0.06);
  text-align: left;
  cursor: pointer;
  transition: background 220ms ease, transform 220ms ease, border-color 220ms ease;
}
.period-block--china { top: 88px; border-top: 3px solid #c76153; }
.period-block--west { top: 368px; border-bottom: 3px solid #6e9bca; }
.period-block--song-transition { z-index: 2; min-width: 0; padding: 14px 5px; }
.period-block--song-transition strong { font-size: 11px; text-align: center; }
.period-block--song-transition span { display: none; }
.period-block:hover, .period-block:focus-visible { z-index: 5; border-color: rgba(255,255,255,0.42); background: #2d302e; transform: translateY(-5px); outline: 0; }
.period-block--west:hover, .period-block--west:focus-visible { transform: translateY(5px); }
.period-block strong { display: block; overflow: hidden; font-size: 15px; text-overflow: ellipsis; white-space: nowrap; }
.period-block span { display: block; margin-top: 8px; color: rgba(255,255,255,0.58); font-size: 10px; }
.period-block em { position: absolute; z-index: 8; bottom: calc(100% + 12px); left: 0; display: none; width: 260px; border: 1px solid rgba(255,255,255,0.16); border-radius: 6px; padding: 14px; color: rgba(255,255,255,0.78); background: #303330; box-shadow: 0 18px 40px rgba(0,0,0,0.28); font-size: 12px; font-style: normal; line-height: 1.6; }
.period-block--west em { top: calc(100% + 12px); bottom: auto; }
.period-block:hover em, .period-block:focus-visible em { display: block; }
.timeline-milestone {
  position: absolute;
  z-index: 3;
  top: calc(214px + var(--lane) * 27px);
  left: var(--left);
  display: grid;
  justify-items: center;
  width: 42px;
  border: 0;
  padding: 0;
  color: rgba(255,255,255,0.66);
  background: transparent;
  cursor: pointer;
  transform: translateX(-50%);
}
.timeline-milestone--west { top: calc(312px + var(--lane) * 27px); }
.timeline-milestone > i {
  display: block;
  width: 11px;
  height: 11px;
  border: 3px solid #1b1e1c;
  border-radius: 50%;
  background: #c76153;
  box-shadow: 0 0 0 1px rgba(255,255,255,0.3);
  transition: transform 180ms ease, box-shadow 180ms ease;
}
.timeline-milestone--west > i { background: #6e9bca; }
.timeline-milestone > span { margin-top: 5px; font-size: 9px; font-weight: 800; }
.timeline-milestone:hover > i, .timeline-milestone:focus-visible > i { box-shadow: 0 0 0 5px rgba(199,97,83,0.2); transform: scale(1.25); }
.timeline-milestone--west:hover > i, .timeline-milestone--west:focus-visible > i { box-shadow: 0 0 0 5px rgba(110,155,202,0.2); }
.timeline-milestone:focus-visible { outline: 0; }
.timeline-milestone > em {
  position: absolute;
  z-index: 10;
  right: auto;
  bottom: calc(100% + 10px);
  left: 50%;
  display: none;
  width: 230px;
  border: 1px solid rgba(255,255,255,0.16);
  border-radius: 6px;
  padding: 13px;
  color: rgba(255,255,255,0.7);
  background: #303330;
  box-shadow: 0 16px 36px rgba(0,0,0,0.3);
  font-size: 11px;
  font-style: normal;
  line-height: 1.55;
  text-align: left;
  transform: translateX(-50%);
}
.timeline-milestone--west > em { top: calc(100% + 10px); bottom: auto; }
.timeline-milestone > em strong { display: block; margin-bottom: 4px; color: #fff; font-size: 13px; }
.timeline-milestone:hover > em, .timeline-milestone:focus-visible > em { display: block; }

.period-section { background: var(--panel); }
.section-title-row { display: flex; align-items: end; justify-content: space-between; gap: 20px; margin-bottom: 38px; }
.section-title-row h2, .hall-comparison h2 { margin: 0; font-family: "Songti SC", STSong, serif; font-size: clamp(34px, 4vw, 54px); font-weight: 500; }
.selected-year { color: var(--line); font-size: clamp(58px, 10vw, 138px); font-weight: 900; line-height: 0.75; }
.period-comparison { display: grid; grid-template-columns: 1fr 78px 1fr; gap: 30px; align-items: stretch; }
.period-detail { border-top: 3px solid var(--west); padding: 30px 6px; }
.period-detail--china { border-color: var(--song); }
.period-detail > span { color: var(--west); font-size: 12px; font-weight: 900; }
.period-detail--china > span { color: var(--song); }
.period-detail h3 { margin: 14px 0 4px; font-size: 28px; }
.period-detail .period-subtitle { margin: 0 0 20px; color: var(--ink); font-weight: 800; }
.period-detail p { color: var(--muted); line-height: 1.8; }
.period-facts { display: grid; gap: 0; margin: 30px 0 0; border-top: 1px solid var(--line); }
.period-facts div { display: grid; grid-template-columns: 96px minmax(0, 1fr); gap: 18px; border-bottom: 1px solid var(--line); padding: 13px 0; }
.period-facts dt { color: var(--ink); font-size: 12px; font-weight: 900; }
.period-facts dd { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.65; }
.period-events { margin-top: 32px; }
.period-events > strong { font-size: 13px; }
.period-events ul { display: grid; gap: 0; margin: 12px 0 0; padding: 0; list-style: none; }
.period-events li { display: grid; grid-template-columns: 54px 1fr; gap: 12px; border-top: 1px solid var(--line); padding: 11px 0; }
.period-events time { color: var(--west); font-size: 12px; font-weight: 900; }
.period-detail--china .period-events time { color: var(--song); }
.period-events span { display: grid; gap: 3px; color: var(--muted); font-size: 12px; line-height: 1.5; }
.period-events b { color: var(--ink); }
.period-year-pin { position: relative; display: grid; place-items: start center; }
.period-year-pin::before { content: ""; position: absolute; top: 0; bottom: 0; left: 50%; width: 1px; background: var(--line); }
.period-year-pin span { position: relative; display: grid; width: 56px; height: 56px; place-items: center; border-radius: 50%; color: #fff; background: var(--ink); font-size: 12px; font-weight: 900; }
.next-route { display: flex; justify-content: center; gap: 14px; margin-top: 54px; }

.page-lead--halls { padding-bottom: 48px; }
.hall-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); min-height: 74svh; background: #111; }
.hall-card { position: relative; min-height: 690px; overflow: hidden; border-right: 1px solid rgba(255,255,255,0.22); color: #fff; }
.hall-card:last-child { border-right: 0; }
.hall-card > img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; filter: saturate(0.72) brightness(0.75); transition: transform 800ms cubic-bezier(.2,.7,.2,1), filter 450ms ease; }
.hall-card:hover > img { filter: saturate(0.92) brightness(0.9); transform: scale(1.045); }
.hall-overlay { position: absolute; inset: 0; background: linear-gradient(0deg, rgba(9,11,10,0.94), rgba(9,11,10,0.12) 62%, rgba(9,11,10,0.42)); }
.hall-number { position: absolute; top: 28px; left: 28px; border-bottom: 1px solid rgba(255,255,255,0.5); padding-bottom: 7px; font-size: 12px; }
.hall-copy { position: absolute; right: 28px; bottom: 36px; left: 28px; }
.hall-copy small { display: block; color: rgba(255,255,255,0.6); font-size: 10px; letter-spacing: 0.12em; }
.hall-copy strong { display: block; margin-top: 10px; font-family: "Songti SC", STSong, serif; font-size: clamp(28px, 2.6vw, 42px); font-weight: 500; }
.hall-copy em { display: block; margin-top: 7px; color: #dfba81; font-size: 11px; font-style: normal; }
.hall-copy p { min-height: 96px; margin: 24px 0; color: rgba(255,255,255,0.7); font-size: 13px; line-height: 1.7; }
.hall-copy b { font-size: 13px; }

.gallery-lead { background: var(--panel); }
.gallery-lead .back-link { margin-bottom: 48px; }
.gallery-lead-grid { display: grid; grid-template-columns: 1fr 0.65fr; gap: 8vw; align-items: end; }
.gallery-lead h1 { margin: 0; font-family: "Songti SC", STSong, serif; font-size: clamp(48px, 7vw, 92px); font-weight: 500; }
.gallery-lead-grid > p { margin: 0; color: var(--muted); font-size: 16px; line-height: 1.8; }
.gallery-controls { display: flex; gap: 8px; margin-top: 44px; }
.filter-button { min-width: 92px; min-height: 40px; border: 1px solid var(--line); border-radius: 999px; background: transparent; cursor: pointer; }
.filter-button.is-active { color: #fff; border-color: var(--ink); background: var(--ink); }
.artifact-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 26px; }
.artifact-card { display: grid; grid-template-rows: auto 1fr; overflow: hidden; border: 1px solid rgba(23,26,24,0.1); border-radius: 8px; background: var(--panel); box-shadow: 0 8px 24px rgba(25,29,26,0.05); transition: transform 280ms ease, box-shadow 280ms ease; }
.artifact-card:hover { box-shadow: var(--shadow); transform: translateY(-6px); }
.artifact-image { position: relative; overflow: hidden; aspect-ratio: 4 / 3; background: var(--paper-deep); }
.artifact-image img { width: 100%; height: 100%; object-fit: cover; transition: transform 650ms cubic-bezier(.2,.7,.2,1), filter 350ms ease; }
.artifact-card:hover .artifact-image img { transform: scale(1.035); }
.artifact-card.is-pending .artifact-image img { filter: grayscale(1); }
.artifact-status { position: absolute; top: 12px; right: 12px; border-radius: 999px; padding: 6px 9px; color: #fff; background: rgba(23,26,24,0.8); font-size: 10px; font-weight: 800; backdrop-filter: blur(8px); }
.artifact-copy { display: grid; align-content: start; padding: 22px; }
.artifact-copy > div { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; }
.culture-pill { display: inline-flex; width: fit-content; border-radius: 999px; padding: 5px 9px; color: var(--song); background: var(--song-soft); font-size: 10px; font-weight: 900; }
.culture-pill--west { color: var(--west); background: var(--west-soft); }
.artifact-copy time { color: var(--muted); font-size: 11px; }
.artifact-copy h2 { margin: 15px 0 6px; font-size: 22px; line-height: 1.3; }
.artifact-copy p { margin: 0; color: var(--muted); font-size: 13px; }
.artifact-copy b { margin-top: 25px; font-size: 12px; }
.hall-comparison { color: #fff; background: var(--ink); text-align: center; }
.hall-comparison .eyebrow { color: #dfba81; }
.hall-comparison > p:not(.eyebrow) { max-width: 820px; margin: 28px auto 0; color: rgba(255,255,255,0.68); font-size: 17px; line-height: 1.9; }
.hall-comparison .button--dark { color: var(--ink); background: #fff; }
.hall-comparison .button--line { color: #fff; border-color: rgba(255,255,255,0.6); }

.detail-head { padding-bottom: 54px; background: var(--panel); }
.detail-head .back-link { margin-bottom: 54px; }
.detail-head-grid { display: grid; grid-template-columns: 1.1fr 0.9fr; gap: 8vw; align-items: end; }
.detail-head h1 { margin: 18px 0 0; font-family: "Songti SC", STSong, serif; font-size: clamp(48px, 7vw, 94px); font-weight: 500; line-height: 1.06; }
.detail-byline { margin: 18px 0 0; color: var(--muted); font-size: 17px; }
.detail-head dl { display: grid; gap: 0; margin: 0; border-top: 1px solid var(--line); }
.detail-head dl div { display: grid; grid-template-columns: 110px 1fr; gap: 20px; border-bottom: 1px solid var(--line); padding: 14px 0; }
.detail-head dt { color: var(--muted); font-size: 12px; }
.detail-head dd { margin: 0; line-height: 1.5; }
.detail-media { background: var(--panel); }
.detail-primary { position: relative; display: grid; min-height: 64svh; max-height: 900px; place-items: center; overflow: hidden; background: #20231f; }
.detail-primary img { width: 100%; height: 100%; max-height: 900px; object-fit: contain; }
.view-image-button { position: absolute; right: 22px; bottom: 22px; min-height: 42px; border: 1px solid rgba(255,255,255,0.4); border-radius: 999px; padding: 0 16px; color: #fff; background: rgba(20,22,20,0.76); cursor: pointer; backdrop-filter: blur(10px); }
.detail-thumbs { display: grid; grid-template-columns: repeat(4, 120px); gap: 10px; margin-top: 12px; }
.detail-thumbs button { overflow: hidden; aspect-ratio: 4 / 3; border: 1px solid var(--line); border-radius: 6px; padding: 0; background: #fff; cursor: pointer; }
.detail-thumbs img { width: 100%; height: 100%; object-fit: cover; }
.detail-story { display: grid; grid-template-columns: repeat(2, 1fr); gap: 70px 9vw; }
.detail-story article h2 { margin: 0 0 20px; font-family: "Songti SC", STSong, serif; font-size: 38px; font-weight: 500; }
.detail-story article p:not(.eyebrow) { margin: 0; color: var(--muted); font-size: 16px; line-height: 1.9; }
.detail-compare { grid-column: 1 / -1; border-top: 1px solid var(--line); padding-top: 52px; }
.archive-note { grid-column: 1 / -1; display: grid; grid-template-columns: 120px 1fr auto; gap: 24px; align-items: center; border-left: 3px solid var(--jade); padding: 24px; background: #e3e9e5; }
.archive-note--pending { border-color: var(--gold); background: #eee7d9; }
.archive-note p { margin: 0; color: var(--muted); line-height: 1.65; }
.archive-note a { border-bottom: 1px solid currentColor; font-size: 12px; font-weight: 800; }
.related-section { background: var(--paper-deep); }
.related-section .section-title-row a { border-bottom: 1px solid currentColor; font-size: 13px; font-weight: 800; }
.related-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
.related-grid > a { position: relative; overflow: hidden; min-height: 300px; border-radius: 8px; background: #242723; }
.related-grid img { width: 100%; height: 100%; object-fit: cover; opacity: 0.78; transition: transform 500ms ease; }
.related-grid a:hover img { transform: scale(1.035); }
.related-grid span { position: absolute; right: 20px; bottom: 20px; left: 20px; display: grid; gap: 6px; color: #fff; }
.related-grid small { color: rgba(255,255,255,0.66); }
.loading-state, .not-found { min-height: 62svh; }
.not-found h1 { margin: 0 0 30px; font-size: clamp(44px, 7vw, 86px); }

.image-viewer { width: 100vw; max-width: none; height: 100vh; max-height: none; margin: 0; border: 0; padding: 0; color: #fff; background: #111311; }
.image-viewer::backdrop { background: #111311; }
.viewer-bar { position: relative; z-index: 2; display: flex; min-height: 64px; align-items: center; justify-content: space-between; gap: 20px; border-bottom: 1px solid rgba(255,255,255,0.14); padding: 10px 20px; background: rgba(17,19,17,0.88); }
.viewer-bar > div { display: flex; align-items: center; gap: 8px; }
.viewer-bar button, .viewer-bar output { display: grid; min-width: 42px; min-height: 38px; place-items: center; border: 1px solid rgba(255,255,255,0.24); border-radius: 6px; color: #fff; background: transparent; padding: 0 12px; }
.viewer-bar button { cursor: pointer; }
.viewer-stage { display: grid; width: 100%; height: calc(100vh - 64px); place-items: center; overflow: auto; padding: 4vw; }
.viewer-stage img { max-width: 86vw; max-height: 78vh; transform-origin: center; transition: transform 180ms ease; }

.end-scene { position: relative; display: grid; min-height: 100svh; place-items: center; overflow: hidden; padding: calc(var(--header-height) + 5vw) 6vw 6vw; color: #fff; background: #151815; }
.end-scene > img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; animation: hero-pan 28s ease-in-out infinite alternate; }
.end-shade { position: absolute; inset: 0; background: rgba(10,13,11,0.7); }
.end-copy { position: relative; z-index: 1; max-width: 780px; text-align: center; }
.end-copy h1 { margin: 0; font-family: "Songti SC", STSong, serif; font-size: clamp(52px, 8vw, 104px); font-weight: 500; line-height: 1.08; }
.end-copy > p:not(.eyebrow) { max-width: 620px; margin: 28px auto; color: rgba(255,255,255,0.78); font-size: 17px; line-height: 1.9; }
.end-copy > div { display: flex; justify-content: center; gap: 12px; }

.site-footer { display: grid; grid-template-columns: 1fr 1fr auto; gap: 7vw; align-items: start; border-top: 1px solid rgba(255,255,255,0.1); padding: 54px 6vw; color: #fff; background: #141715; }
.site-footer div { display: grid; gap: 8px; }
.site-footer strong { font-size: 13px; }
.site-footer p { margin: 0; color: rgba(255,255,255,0.55); font-size: 12px; line-height: 1.7; }
.site-footer > a { border-bottom: 1px solid rgba(255,255,255,0.5); padding-bottom: 6px; font-size: 12px; font-weight: 800; }
.end-page .site-footer { display: none; }
.error-state { width: 100%; padding: 48px; color: var(--muted); text-align: center; }

.ai-assistant { position: fixed; right: 22px; bottom: 22px; z-index: 90; font-family: inherit; }
.ai-launcher { display: flex; min-width: 58px; height: 58px; align-items: center; justify-content: center; gap: 9px; border: 1px solid rgba(255,255,255,0.16); border-radius: 8px; padding: 0 17px; color: #fff; background: #202a25; box-shadow: 0 16px 38px rgba(18,27,22,0.28); cursor: pointer; transition: transform 180ms ease, background 180ms ease, box-shadow 180ms ease; }
.ai-launcher:hover { transform: translateY(-2px); background: #2b3a32; box-shadow: 0 20px 42px rgba(18,27,22,0.34); }
.ai-launcher:focus-visible, .ai-close:focus-visible, .ai-quick-questions button:focus-visible, .ai-form button:focus-visible, .ai-form textarea:focus-visible { outline: 2px solid #bd8d4c; outline-offset: 2px; }
.ai-launcher-mark { display: grid; width: 27px; height: 27px; place-items: center; border-radius: 50%; color: #233129; background: #f3e3c5; font-size: 17px; }
.ai-launcher-label { font-size: 13px; font-weight: 800; letter-spacing: 0; white-space: nowrap; }
.ai-panel { position: absolute; right: 0; bottom: 72px; display: grid; width: min(390px, calc(100vw - 32px)); height: min(590px, calc(100svh - 116px)); grid-template-rows: auto minmax(0, 1fr) auto; overflow: hidden; border: 1px solid rgba(31,43,36,0.12); border-radius: 8px; color: #202723; background: #fbfcfa; box-shadow: 0 28px 80px rgba(21,31,25,0.24); opacity: 0; pointer-events: none; transform: translateY(12px) scale(0.98); transform-origin: right bottom; transition: opacity 180ms ease, transform 180ms ease; }
.ai-assistant.is-open .ai-panel { opacity: 1; pointer-events: auto; transform: none; }
.ai-assistant.is-open .ai-launcher { visibility: hidden; opacity: 0; pointer-events: none; }
.ai-panel-head { display: flex; min-height: 72px; align-items: center; justify-content: space-between; gap: 16px; border-bottom: 1px solid #e5e9e6; padding: 12px 14px 12px 16px; background: rgba(251,252,250,0.96); }
.ai-identity { display: flex; min-width: 0; align-items: center; gap: 11px; }
.ai-avatar, .ai-message-avatar { display: grid; flex: 0 0 auto; place-items: center; border-radius: 50%; color: #fff; background: #2d493a; font-family: "Songti SC", STSong, serif; }
.ai-avatar { width: 42px; height: 42px; box-shadow: inset 0 0 0 1px rgba(255,255,255,0.17); font-size: 20px; }
.ai-identity > span:last-child { display: grid; min-width: 0; gap: 4px; }
.ai-identity strong { font-size: 15px; }
.ai-identity small { display: flex; align-items: center; gap: 6px; color: #7c847f; font-size: 11px; white-space: nowrap; }
.ai-identity i { width: 7px; height: 7px; border-radius: 50%; background: #b1b7b3; }
.ai-identity i.is-ready { background: #42a36b; box-shadow: 0 0 0 3px rgba(66,163,107,0.12); }
.ai-close { display: grid; width: 38px; height: 38px; place-items: center; border: 0; border-radius: 50%; color: #5f6762; background: transparent; font-size: 25px; line-height: 1; cursor: pointer; }
.ai-close:hover { background: #edf0ee; }
.ai-messages { min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 20px 16px 16px; scrollbar-color: #c9cfcb transparent; }
.ai-message { display: flex; align-items: flex-start; gap: 9px; margin-bottom: 14px; }
.ai-message-avatar { width: 28px; height: 28px; margin-top: 2px; font-size: 13px; }
.ai-message > div { max-width: calc(100% - 38px); border-radius: 8px; padding: 11px 13px; background: #edf1ee; }
.ai-message p { margin: 0; font-size: 13px; line-height: 1.72; white-space: pre-wrap; }
.ai-message--user { justify-content: flex-end; }
.ai-message--user > div { max-width: 82%; color: #fff; background: #2d493a; }
.ai-message--system { justify-content: center; }
.ai-message--system > div { max-width: 92%; border: 1px solid #e7d7bb; color: #765d36; background: #fbf5e9; text-align: center; }
.ai-quick-questions { display: grid; gap: 7px; margin: 4px 0 18px 37px; }
.ai-quick-questions button { width: fit-content; max-width: 100%; border: 1px solid #dfe5e1; border-radius: 8px; padding: 9px 11px; color: #425049; background: #fff; font: inherit; font-size: 12px; line-height: 1.45; text-align: left; cursor: pointer; transition: border-color 160ms ease, background 160ms ease; }
.ai-quick-questions button:hover { border-color: #a9b9af; background: #f4f7f5; }
.ai-message--pending > div { display: flex; min-width: 52px; align-items: center; justify-content: center; gap: 4px; padding: 14px; }
.ai-message--pending > div span { width: 5px; height: 5px; border-radius: 50%; background: #728078; animation: ai-thinking 900ms ease-in-out infinite alternate; }
.ai-message--pending > div span:nth-child(2) { animation-delay: 160ms; }
.ai-message--pending > div span:nth-child(3) { animation-delay: 320ms; }
.ai-form { border-top: 1px solid #e5e9e6; padding: 12px 14px 11px; background: #fff; }
.ai-form > label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.ai-form > div { display: flex; align-items: flex-end; gap: 8px; border: 1px solid #cfd7d2; border-radius: 8px; padding: 7px 7px 7px 12px; background: #fff; transition: border-color 160ms ease, box-shadow 160ms ease; }
.ai-form > div:focus-within { border-color: #6f897a; box-shadow: 0 0 0 3px rgba(80,113,94,0.1); }
.ai-form textarea { flex: 1; min-height: 34px; max-height: 112px; resize: none; border: 0; outline: 0; padding: 7px 0 4px; color: #202723; background: transparent; font: inherit; font-size: 13px; line-height: 1.5; }
.ai-form textarea::placeholder { color: #929994; }
.ai-form button { display: grid; flex: 0 0 auto; width: 34px; height: 34px; place-items: center; border: 0; border-radius: 6px; color: #fff; background: #2d493a; font-size: 19px; cursor: pointer; }
.ai-form button:disabled { cursor: wait; opacity: 0.48; }
.ai-form > p { margin: 7px 2px 0; color: #959b97; font-size: 10px; line-height: 1.4; text-align: center; }
.reveal { opacity: 0; transform: translateY(20px); transition: opacity 650ms ease var(--delay, 0ms), transform 650ms ease var(--delay, 0ms); }
.reveal.is-visible { opacity: 1; transform: none; }
[data-media-frame]:not(.is-loaded) img[data-resilient-image] { opacity: 0; }
[data-media-frame] img[data-resilient-image] { transition: opacity 360ms ease, transform 650ms cubic-bezier(.2,.7,.2,1), filter 350ms ease; }

@keyframes hero-pan { from { transform: scale(1.01) translateX(-0.5%); } to { transform: scale(1.06) translateX(0.7%); } }
@keyframes ai-thinking { from { transform: translateY(1px); opacity: 0.45; } to { transform: translateY(-2px); opacity: 1; } }

@media (max-width: 1000px) {
  .hall-grid { grid-template-columns: repeat(2, 1fr); }
  .hall-card { min-height: 600px; border-bottom: 1px solid rgba(255,255,255,0.22); }
  .artifact-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .detail-head-grid, .gallery-lead-grid { grid-template-columns: 1fr; }
  .gallery-lead-grid { gap: 28px; }
}

@media (max-width: 760px) {
  :root { --header-height: 64px; }
  .site-header { min-height: var(--header-height); padding: 0 18px; }
  .brand-seal { width: 36px; height: 36px; }
  .nav-toggle { display: inline-flex; }
  .site-nav { position: absolute; top: 64px; right: 12px; left: 12px; display: none; align-items: stretch; flex-direction: column; gap: 0; border: 1px solid var(--line); border-radius: 8px; color: var(--ink); background: var(--panel); box-shadow: var(--shadow); }
  .site-header.nav-open .site-nav { display: flex; }
  .site-header--overlay.nav-open { background: rgba(20,23,21,0.96); }
  .site-nav a, .site-header--overlay .site-nav a { border-bottom: 1px solid var(--line); padding: 15px 18px; color: var(--ink); }
  .site-nav a:last-child { border-bottom: 0; }
  .site-nav a::after { display: none; }
  .section { padding: 64px 18px; }
  .section--compact { padding-top: 44px; padding-bottom: 48px; }
  .section--flush-top { padding-top: 0; }
  .museum-hero { min-height: 88svh; padding-right: 18px; padding-left: 18px; }
  .museum-hero-shade { background: linear-gradient(0deg, rgba(10,12,11,0.88), rgba(10,12,11,0.35)); }
  .museum-hero-copy { width: 100%; }
  .museum-hero h1 { font-size: clamp(42px, 13vw, 64px); }
  .museum-hero h1 span { font-size: 0.38em; line-height: 1.5; }
  .museum-hero-copy > p:not(.eyebrow) { font-size: 15px; }
  .hero-caption { display: none; }
  .home-intro { grid-template-columns: 1fr; gap: 42px; }
  .home-intro h2 { font-size: 38px; }
  .page-lead .back-link { margin-bottom: 36px; }
  .page-lead h1 { font-size: 46px; }
  .timeline-toolbar { align-items: start; flex-direction: column; gap: 20px; padding-right: 18px; padding-left: 18px; }
  .timeline-scroll { padding-right: 18px; padding-left: 18px; }
  .period-comparison { grid-template-columns: 1fr; gap: 18px; }
  .period-year-pin { display: none; }
  .selected-year { font-size: 60px; }
  .period-detail { padding-top: 24px; }
  .next-route { flex-direction: column; }
  .hall-grid { grid-template-columns: 1fr; }
  .hall-card { min-height: 68svh; border-right: 0; }
  .hall-copy p { min-height: auto; }
  .gallery-controls { overflow-x: auto; padding-bottom: 4px; }
  .filter-button { flex: 0 0 auto; }
  .artifact-grid { grid-template-columns: 1fr; }
  .artifact-copy h2 { font-size: 24px; }
  .detail-head-grid { gap: 42px; }
  .detail-head h1 { font-size: 50px; }
  .detail-head dl div { grid-template-columns: 86px 1fr; }
  .detail-media { padding-right: 0; padding-left: 0; }
  .detail-primary { min-height: 52svh; }
  .detail-thumbs { padding: 0 18px; }
  .detail-story { grid-template-columns: 1fr; gap: 48px; }
  .detail-compare, .archive-note { grid-column: auto; }
  .archive-note { grid-template-columns: 1fr; gap: 10px; }
  .related-grid { grid-template-columns: 1fr; }
  .related-grid > a { min-height: 260px; }
  .viewer-bar { align-items: start; flex-direction: column; }
  .viewer-bar > div { width: 100%; }
  .viewer-bar button, .viewer-bar output { flex: 1; padding: 0 6px; }
  .viewer-stage { height: calc(100vh - 116px); }
  .end-copy h1 { font-size: 52px; }
  .end-copy > div { align-items: stretch; flex-direction: column; }
  .site-footer { grid-template-columns: 1fr; gap: 30px; padding: 44px 18px; }
  .ai-assistant { right: 12px; bottom: 12px; }
  .ai-launcher { min-width: 54px; height: 54px; padding: 0 14px; }
  .ai-panel { position: fixed; inset: 72px 10px 10px; width: auto; height: auto; transform-origin: right bottom; }
  .ai-panel-head { min-height: 66px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
  .reveal { opacity: 1; transform: none; }
}
