:root {
  color-scheme: light;
  --paper: #f4f1ea;
  --white: #fcfbf8;
  --surface: #fcfbf8;
  --surface-subtle: #efece4;
  --ink: #201e1b;
  --muted: #666057;
  --green: #2b4c43;
  --green-deep: #213d35;
  --green-soft: rgb(43 76 67 / 0.1);
  --rust: #9e3626;
  --rust-soft: rgb(158 54 38 / 0.1);
  --gold: #9a7b42;
  --line: rgb(42 36 28 / 0.09);
  --line-strong: rgb(42 36 28 / 0.16);
  --wash: #e8efe9;
  --radius-sm: 10px;
  --radius-md: 18px;
  --radius-pill: 999px;
  --shadow-sm: 0 1px 3px rgb(32 28 22 / 0.05), 0 1px 2px rgb(32 28 22 / 0.03);
  --shadow-md: 0 12px 32px rgb(32 28 22 / 0.07), 0 2px 8px rgb(32 28 22 / 0.04);
  --shadow-lg: 0 24px 60px rgb(32 28 22 / 0.14), 0 4px 14px rgb(32 28 22 / 0.06);
  --scrollbar-thumb: rgb(42 36 28 / 0.24);
  --scrollbar-track: transparent;
  --font-serif: "Noto Serif SC", "Songti SC", "STSong", "SimSun", Georgia, serif;
  --font-sans: "Noto Serif SC", "Songti SC", "STSong", "SimSun", system-ui, sans-serif;
  --font-brush: "Ma Shan Zheng", "STKaiti", "KaiTi", cursive;
  font: 15px/1.72 var(--font-sans);
  background: var(--paper);
  color: var(--ink);
  accent-color: var(--green);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  -webkit-tap-highlight-color: rgb(43 76 67 / 0.12);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  text-rendering: optimizeLegibility;
}
::selection { color: #ffffff; background: var(--green); }

.skip-link {
  position: fixed;
  top: -100px;
  left: 16px;
  z-index: 100;
  padding: 8px 16px;
  background: var(--ink);
  color: #ffffff;
  border-radius: var(--radius-pill);
  font-size: .85rem;
  font-weight: 600;
  text-decoration: none;
  box-shadow: var(--shadow-md);
  transition: top 160ms ease-out;
}
.skip-link:focus-visible { top: 12px; }

:where(a, button, input, select, textarea, summary, [tabindex]):focus-visible {
  outline: 2px solid var(--green);
  outline-offset: 2px;
}
a {
  color: var(--green);
  text-underline-offset: .24em;
  touch-action: manipulation;
  transition: color 160ms ease-out, background-color 160ms ease-out, border-color 160ms ease-out, opacity 160ms ease-out;
}
a:hover { text-decoration-thickness: 1.5px; }

button, input, select { font: inherit; }
button {
  cursor: pointer;
  color: inherit;
  border-radius: var(--radius-sm);
  touch-action: manipulation;
  transition: background-color 160ms cubic-bezier(.2, .8, .2, 1), border-color 160ms ease-out, color 160ms ease-out, box-shadow 160ms ease-out, transform 140ms cubic-bezier(.2, .8, .2, 1);
}
button:disabled { cursor: default; opacity: .38; }
button:hover:not(:disabled) { border-color: rgb(43 76 67 / 0.45); }
button:active:not(:disabled) { transform: scale(.975); }

@media (prefers-reduced-motion: reduce) {
  button, a, .skip-link, input[type="search"], select { transition: none; }
  button:active:not(:disabled) { transform: none; }
}

input[type="search"], select {
  border-radius: var(--radius-sm);
  background-color: var(--surface);
  color: var(--ink);
  transition: border-color 160ms ease-out, box-shadow 160ms ease-out;
}
input[type="search"]:focus, select:focus {
  border-color: var(--green);
  box-shadow: 0 0 0 3.5px rgb(43 76 67 / 0.16);
}

/* Authentic macOS / iOS style slider */
input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  height: 22px;
  background: transparent;
}
input[type="range"]::-webkit-slider-runnable-track {
  height: 4px;
  border-radius: 999px;
  background: rgb(0 0 0 / 0.12);
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 18px;
  height: 18px;
  margin-top: -7px;
  border-radius: 50%;
  background: #ffffff;
  border: 0.5px solid rgb(0 0 0 / 0.14);
  box-shadow: 0 1px 4px rgb(0 0 0 / 0.22), 0 0.5px 1px rgb(0 0 0 / 0.12);
  transition: transform 140ms ease-out, box-shadow 140ms ease-out;
}
input[type="range"]:hover::-webkit-slider-thumb {
  transform: scale(1.08);
  box-shadow: 0 2px 7px rgb(0 0 0 / 0.26), 0 0.5px 1.5px rgb(0 0 0 / 0.14);
}
input[type="range"]::-moz-range-track {
  height: 4px;
  border-radius: 999px;
  background: rgb(0 0 0 / 0.12);
}
input[type="range"]::-moz-range-thumb {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #ffffff;
  border: 0.5px solid rgb(0 0 0 / 0.14);
  box-shadow: 0 1px 4px rgb(0 0 0 / 0.22);
}

/* Apple.com translucent frosted glass navigation bar (warm ivory tint) */
.mast {
  position: sticky;
  top: 0;
  z-index: 10;
  min-height: 54px;
  padding: 8px max(4vw, 24px);
  border-bottom: 1px solid var(--line);
  background: rgb(250 248 242 / 0.82);
  backdrop-filter: saturate(170%) blur(20px);
  -webkit-backdrop-filter: saturate(170%) blur(20px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.mast div { display: flex; align-items: center; gap: 12px; }
.mast a { text-decoration: none; }
.brand {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font: 400 1.45rem/1.2 var(--font-brush);
  letter-spacing: .12em;
  color: var(--ink);
}
.mast span, .mast > a {
  color: var(--muted);
  font-size: .8rem;
  font-weight: 400;
  padding-left: 12px;
  border-left: 1px solid var(--line-strong);
}
.mast nav { display: flex; align-items: center; gap: 4px; font-size: .84rem; flex-wrap: wrap; }
.mast nav a {
  padding: 6px 13px;
  border-radius: var(--radius-pill);
  color: var(--ink);
  font-weight: 500;
  border: 1px solid transparent;
  transition: background-color 150ms ease-out, color 150ms ease-out;
}
.mast nav a:hover {
  background: rgb(0 0 0 / 0.05);
  color: var(--ink);
  text-decoration: none;
}
.mast nav a[aria-current="page"] {
  background: var(--ink);
  color: #ffffff;
  font-weight: 500;
}

main { width: min(1380px, 92%); margin: auto; }
#exhibit, #history, #guide { scroll-margin-top: 72px; }

.intro { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); align-items: center; gap: clamp(32px, 6vw, 100px); padding: clamp(32px, 5vw, 74px) 0; }
.edition { font-size: .84rem; color: var(--rust); font-weight: 600; margin: 0 0 12px; }

h1, h2, h3 {
  font-family: var(--font-serif);
  font-weight: 600;
  line-height: 1.22;
  letter-spacing: .035em;
  margin: 0;
  text-wrap: balance;
  color: var(--ink);
}
h1 { font-size: clamp(2.4rem, 5vw, 4.4rem); }
h2 { font-size: clamp(1.5rem, 2.5vw, 2.05rem); }
h3 { font-size: clamp(1.18rem, 1.7vw, 1.55rem); }
h4 { margin: 18px 0 6px; }
p { text-wrap: pretty; }

.deck { color: var(--muted); max-width: 28em; margin: 20px 0; }

/* Apple pill CTA buttons with architectural pine-celadon & cinnabar palette */
.jump {
  display: inline-flex;
  gap: 8px;
  align-items: center;
  background: var(--green);
  color: #fcfbf8;
  text-decoration: none;
  padding: 10px 20px;
  border-radius: var(--radius-pill);
  font-size: .88rem;
  font-weight: 500;
  border: 1px solid transparent;
  box-shadow: 0 2px 10px rgb(43 76 67 / 0.24);
  transition: background-color 160ms ease-out, box-shadow 160ms ease-out, transform 150ms ease-out;
}
.jump:hover {
  background: var(--green-deep);
  box-shadow: 0 6px 18px rgb(43 76 67 / 0.3);
  transform: translateY(-1px);
  text-decoration: none;
}
.jump-secondary {
  background: rgb(252 251 248 / 0.9);
  color: var(--rust);
  border: 1px solid rgb(158 54 38 / 0.28);
  box-shadow: var(--shadow-sm);
}
.jump-secondary:hover {
  background: var(--rust);
  border-color: var(--rust);
  color: #fcfbf8;
  box-shadow: 0 6px 18px rgb(158 54 38 / 0.24);
}
@media (prefers-reduced-motion: reduce) {
  .jump:hover, .jump-secondary:hover { transform: none; }
}

.hero { margin: 0; background: #1d1d1f; color: #ffffff; border-radius: var(--radius-md); overflow: hidden; min-width: 0; }
.hero img { display: block; width: 100%; height: auto; aspect-ratio: 1.85; object-fit: cover; object-position: center 56%; }
.hero figcaption { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 4px 12px; padding: 12px 18px 0; font-size: .88rem; }
.credit { padding: 2px 18px 10px; font-size: .72rem; color: #a1a1a6; }
.credit a { color: inherit; }

#atlas { padding: 32px 0 44px; border-top: 1px solid var(--line); }
.section-head { display: flex; align-items: end; justify-content: space-between; flex-wrap: wrap; gap: 14px 28px; }
.section-head p, .muted { color: var(--muted); margin: 6px 0; font-size: .88rem; }
.search { display: flex; align-items: center; gap: 10px; font-size: .85rem; color: var(--muted); font-weight: 500; }
.search input {
  width: min(52vw, 280px);
  min-height: 38px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-pill);
  background: var(--surface);
  padding: 6px 15px;
  box-shadow: var(--shadow-sm);
}
.themes { display: flex; flex-wrap: wrap; gap: 7px; margin: 16px 0; }
.themes button, #case-list button, .related button, #stepper button {
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-pill);
  padding: 6px 13px;
  min-height: 36px;
  font-size: .83rem;
}
button[aria-pressed="true"] { background: var(--green); color: #ffffff; border-color: var(--green); }

.map-scroll { overflow: auto; border: 1px solid var(--line); border-radius: var(--radius-md); background: var(--white); scrollbar-color: var(--scrollbar-thumb) var(--scrollbar-track); scrollbar-width: thin; }
table { width: 100%; min-width: 900px; border-collapse: separate; border-spacing: 0; table-layout: fixed; font-size: .85rem; }
th, td { text-align: center; padding: 5px 3px; height: 39px; border-bottom: 1px solid var(--line); }
th:first-child { position: sticky; left: 0; z-index: 1; width: 128px; background: var(--white); border-right: 1px solid var(--line); text-align: left; padding-left: 14px; }
thead th { background: var(--paper); }
thead th:first-child { background: var(--paper); }
thead button { border: 1px solid transparent; background: transparent; padding: 4px; width: 100%; font-weight: 600; }
tbody tr:last-child > * { border-bottom: 0; }
td { background: linear-gradient(var(--line), var(--line)) center / 100% 1px no-repeat; color: var(--muted); }
td.current { background-color: var(--wash); }
td button { min-width: 32px; min-height: 32px; padding: 0; border: 1px solid var(--green); border-radius: 50%; color: var(--green); background: var(--white); font-variant-numeric: tabular-nums; }
td span { background: var(--white); padding: 0 4px; }
td.current span { background: var(--wash); }
.dimmed td button { border-color: var(--line); color: var(--muted); }

#stepper { display: flex; align-items: center; gap: clamp(6px, 2vw, 18px); padding: 12px 0 16px; }
#stepper label, #stepper output { font-size: .85rem; }
#stepper output { min-width: 6.5em; text-align: center; font-weight: 600; font-variant-numeric: tabular-nums; }
#stepper input { min-width: 40px; flex: 1; }

.reading { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 2fr); border: 1px solid var(--line); border-radius: var(--radius-md); overflow: hidden; }
.reading > * { min-width: 0; padding: clamp(16px, 3vw, 32px); }
#detail { border-left: 1px solid var(--line); background: var(--white); }
#detail ul { padding-left: 1.3em; }
.kind { font-size: .82rem; color: var(--rust); font-weight: 600; }
#case-list, .related { display: flex; gap: 7px; flex-wrap: wrap; }
.related h4 { flex-basis: 100%; }
.sources { margin-top: 18px; }
.sources a { display: block; overflow-wrap: anywhere; }

#guide {
  border-top: 1px solid var(--line);
  padding: 40px 0 52px;
  max-width: 72ch;
}
#guide h2 {
  font-size: 1.2rem;
  color: var(--ink);
  margin-bottom: 12px;
}
#guide p {
  color: var(--muted);
  font-size: .88rem;
  line-height: 1.72;
  margin: 0 0 10px;
}

footer {
  border-top: 1px solid var(--line);
  background: var(--paper);
  padding: 20px max(4vw, 24px);
  color: var(--muted);
  font-size: .78rem;
}

dialog:modal { overscroll-behavior: contain; }
dialog::backdrop { overflow: hidden; overscroll-behavior: contain; }

.atlas-scroll {
  scrollbar-color: var(--scrollbar-thumb) var(--scrollbar-track);
  scrollbar-width: thin;
  overscroll-behavior: contain;
}
@supports not (scrollbar-color: auto) {
  .atlas-scroll, .map-scroll { scrollbar-width: auto; }
  .atlas-scroll::-webkit-scrollbar, .map-scroll::-webkit-scrollbar { width: 7px; height: 7px; }
  .atlas-scroll::-webkit-scrollbar-thumb, .map-scroll::-webkit-scrollbar-thumb { background: var(--scrollbar-thumb); border-radius: 999px; }
  .atlas-scroll::-webkit-scrollbar-track, .map-scroll::-webkit-scrollbar-track { background: transparent; }
}

@media (max-width: 720px) {
  .mast { padding: 8px 12px; min-height: 50px; flex-wrap: wrap; gap: 6px 10px; }
  .mast span { display: none; }
  .brand { font-size: 1.3rem; }
  .mast nav { gap: 3px; font-size: .76rem; }
  .mast nav a { padding: 4px 9px; }
  .jump { padding: 8px 14px; font-size: .82rem; gap: 6px; }
  .intro, .reading { grid-template-columns: 1fr; }
  .intro { gap: 22px; }
  .hero img { aspect-ratio: 1.55; }
  #detail { border-left: 0; border-top: 1px solid var(--line); }
  th:first-child { width: 110px; }
  .themes button, #case-list button, .related button, #stepper button { min-height: 44px; }
}
