:root {
  --paper-texture: url("assets/background/mountain-paper.webp");
  --font-display: "Zhi Mang Xing", "Ma Shan Zheng", "STKaiti", "KaiTi", cursive;
  --font-building: "Building Brush", "Ma Shan Zheng", "STKaiti", "KaiTi", cursive;
  --font-brush: "Ma Shan Zheng", "Zhi Mang Xing", "STKaiti", "KaiTi", cursive;
}

html {
  overflow-x: clip;
  background-color: var(--paper, #f4f1ea);
  background-image: none;
}

html:has(body.mind-page) { background-image: none; }

html:has(.story-showcase),
body:has(.story-showcase) { background-image: none; }

body:has(.story-showcase)::before { display: none; }

body,
body.mind-page {
  position: relative;
  isolation: isolate;
  overflow-x: clip;
  background-color: transparent;
  background-image: none;
  letter-spacing: .012em;
}

body.mind-page {
  background-color: var(--paper, #f4f1ea);
  background-image: none;
}

body.mind-page::before { display: none; }

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 9997;
  pointer-events: none;
  background-image: var(--paper-texture);
  background-position: center;
  background-size: cover;
  background-repeat: no-repeat;
  mix-blend-mode: soft-light;
  opacity: .32;
}

main { position: relative; z-index: 1; }

.atlas-content {
  position: relative;
  isolation: isolate;
  background-color: var(--paper, #f4f1ea);
}

.atlas-content::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background-image: var(--paper-texture);
  background-position: center;
  background-size: cover;
  background-repeat: no-repeat;
  background-attachment: fixed;
  mix-blend-mode: soft-light;
  opacity: .32;
}

.atlas-content > * { position: relative; z-index: 1; }

.story-sticky { isolation: isolate; }

:where(.map-scroll, #history-periods, .exhibit-layout, .dynasty-bar, .map-card, .mind-toolbar, #mind-chapters) {
  background-color: rgb(252 251 248 / 0.92);
  background-image: none;
  background-blend-mode: normal;
}

#mind-viewport {
  background-color: rgb(244 241 234 / 0.9);
  background-image: radial-gradient(circle, rgb(42 36 28 / 0.1) 1px, transparent 1px);
  background-size: 22px 22px;
}

footer {
  background-color: rgb(244 241 234 / 0.92);
  background-image: none;
}

.brand {
  font-family: var(--font-brush);
  font-weight: 400;
  -webkit-text-stroke: .22px currentColor;
  text-shadow: 0 1px 0 rgb(255 255 255 / 0.55), 0 5px 16px rgb(32 28 22 / 0.08);
}

main h1,
.mind-entry h1,
.page-heading h1,
.atlas-header h1,
.mind-header h1,
.story-center-title h2,
.story-editorial h3,
#title,
#timeline-title,
#mind-sheet-title,
#detail-title {
  font-family: var(--font-display);
  font-weight: 400;
  line-height: 1.2;
  letter-spacing: .055em;
  -webkit-text-stroke: .25px currentColor;
  text-shadow: 0 1px 0 rgb(255 255 255 / 0.38), 0 8px 24px rgb(32 28 22 / 0.08);
}

.story-center-title h2,
.story-editorial h3 {
  text-shadow: 0 2px 0 rgb(0 0 0 / 0.18), 0 12px 32px rgb(0 0 0 / 0.4);
}

#model-title,
#detail-title,
#sites-list .site-row-text strong,
#search-results .search-item strong,
.map-tooltip,
#city-observation h2,
#city-results button,
:is(#model-catalog, #map-shelves) .model-shelf-items > :is(button, .city-map-link),
#mind-detail-title,
#mind-board .mind-card-building,
#mind-results .mind-result-title,
#mind-content .mind-plan-link,
.model-pin-building,
#model-note .building-name,
#history-nodes .node-btn-head > span:first-child,
#branches .branch-main h4,
#branches .branch-card button,
#history-results button,
#tl-demo-title,
.mind-board-preview .mind-node-leaf {
  font-family: var(--font-building);
  font-weight: 400;
  letter-spacing: .035em;
  -webkit-text-stroke: .15px currentColor;
}

.story-runway[data-theme="timeline"] .story-center-title h2,
.story-runway[data-theme="mindmap"] .story-center-title h2,
.story-editorial.is-dark-text h3 {
  text-shadow: 0 1px 0 rgb(255 255 255 / 0.6), 0 8px 24px rgb(255 255 255 / 0.35);
}

:where(.edition, .eyebrow, .mind-entry-eyebrow, .kind) { letter-spacing: .2em; }
:where(.mast nav a, .jump, button, .segmented button, .mind-nav a) { letter-spacing: .045em; }
:where(.deck, .lead, .history-intro p, .page-heading p, .atlas-header .lead) { line-height: 1.9; }

@media (max-width: 720px) {
  body::before {
    opacity: .24;
  }
  .atlas-content::before {
    opacity: .24;
  }
  main h1,
  .mind-entry h1,
  .page-heading h1,
  .atlas-header h1,
  .mind-header h1,
  .story-center-title h2,
  .story-editorial h3,
  #title,
  #timeline-title,
  #mind-sheet-title,
  #detail-title {
    letter-spacing: .035em;
    -webkit-text-stroke: .18px currentColor;
  }
}

@media print {
  body::before { display: none; }
}

/* Static ink silhouettes on the home preview and the exhibit introduction. */
body:has(.story-showcase) {
  --ink-silhouette: url("assets/background/ink-mountains-bamboo.webp");
}
body:has(.story-showcase) .atlas-content::before {
  background-image: var(--ink-silhouette);
  background-position: center top;
  background-size: 100% auto;
  background-attachment: scroll;
  mix-blend-mode: normal;
  opacity: .29;
}
.story-stats-band {
  position: relative;
  isolation: isolate;
}
.story-stats-band::before,
.fg-stage::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: var(--ink-silhouette) center bottom / 100% auto no-repeat;
}
.story-stats-band::before { z-index: -1; opacity: .36; }
.fg-stage::before {
  background-size: cover;
  filter: brightness(0) invert(1);
  opacity: .18;
}

@media (max-width: 740px) {
  #runway-foguang .story-sticky { background: #f4f0e5; }
  #runway-foguang .story-sticky::before {
    content: "";
    position: absolute;
    inset: 0;
    z-index: -1;
    pointer-events: none;
    background: var(--ink-silhouette) center bottom / 100% auto no-repeat;
    opacity: .66;
  }
  .fg-stage::before { display: none; }
  .story-mobile-intro h2 { color: #252e25; }
  .story-mobile-intro p { color: #4b5146; }
  #runway-foguang .story-cta {
    background: var(--story-jade);
    color: #fffdf5;
    box-shadow: none;
  }
  #runway-foguang .cta-ghost {
    background: #f8f5eb;
    border-color: #6c7b67;
    color: #263b2f;
    backdrop-filter: none;
  }
}

#top:has(.history-paper) {
  width: 100%;
}
#top > .atlas-content,
.history-paper-content {
  width: var(--home-content-width, min(1380px, 92%));
  margin-inline: auto;
}

.history-paper {
  background-color: #f4f0e7;
  background-image:
    linear-gradient(180deg, rgb(244 240 231 / .86), rgb(244 240 231 / .66) 55%, rgb(244 240 231 / .46)),
    url("assets/background/history-river-handscroll.webp");
  background-position: center bottom;
  background-size: cover;
  background-repeat: no-repeat;
}
.history-paper footer {
  background: transparent;
  border-top-color: rgb(55 54 45 / .13);
}

@media (max-width: 740px) {
  .history-paper {
    background-image:
      linear-gradient(180deg, rgb(244 240 231 / .90), rgb(244 240 231 / .73)),
      url("assets/background/history-river-handscroll.webp");
  }
}
