:root {
  color-scheme: light dark;
  --paper: #f7f5ef;
  --surface: #efebe1;
  --ink: #211f1b;
  --secondary: #5e554a;
  --rule: #c9c0b0;
  --accent: #9a382b;
  --on-button: #faf7ee;
  --nav-fill: #f7f5efbe;
  --folio-back: #ebe4d8;
  --folio-shade: #635145;
  --folio-line: #a88f79;
  --folio-red: #a24836;
  --folio-red-edge: #6e352a;
  --folio-core: #464541;
  --folio-core-edge: #302e28;
  --folio-track: #ad9c7e;
  --folio-stock: #d8c9ad;
  --folio-stock-edge: #b7a385;
  --folio-stock-rule: #ab9473;
  --mono: "Cascadia Code", "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  --sans: "Segoe UI", system-ui, "PingFang SC", "Microsoft YaHei", sans-serif;
}
:root[data-theme="light"] { color-scheme: light; }
:root[data-theme="dark"] { color-scheme: dark; }
:root[data-theme="dark"] {
  --paper: #191815;
  --surface: #211e19;
  --ink: #f4efe4;
  --secondary: #c6bdad;
  --rule: #5b5247;
  --accent: #f1a68f;
  --on-button: #231e17;
  --nav-fill: #191815bf;
  --folio-back: #272521;
  --folio-shade: #0c0a08;
  --folio-line: #796858;
  --folio-red: #af503d;
  --folio-red-edge: #6b3228;
  --folio-core: #5b564a;
  --folio-core-edge: #34302a;
  --folio-track: #c2b28f;
  --folio-stock: #c0ac8e;
  --folio-stock-edge: #74604a;
  --folio-stock-rule: #9a7c5b;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) {
    --paper: #191815;
    --surface: #211e19;
    --ink: #f4efe4;
    --secondary: #c6bdad;
    --rule: #5b5247;
    --accent: #f1a68f;
    --on-button: #231e17;
    --nav-fill: #191815bf;
    --folio-back: #272521;
    --folio-shade: #0c0a08;
    --folio-line: #796858;
    --folio-red: #af503d;
    --folio-red-edge: #6b3228;
    --folio-core: #5b564a;
    --folio-core-edge: #34302a;
    --folio-track: #c2b28f;
    --folio-stock: #c0ac8e;
    --folio-stock-edge: #74604a;
    --folio-stock-rule: #9a7c5b;
  }
}
* { box-sizing: border-box; }
html { scroll-padding-block-start: 4.8rem; }
body {
  margin: 0; color: var(--ink); background: var(--paper);
  font: 400 1rem/1.68 var(--sans);
  -webkit-text-size-adjust: 100%; -webkit-tap-highlight-color: #a45a3d31;
}
@media (prefers-reduced-motion: no-preference) {
  html { scroll-behavior: smooth; }
}
h1,h2,h3,p,figure,ul,dl,dd,pre,fieldset { margin: 0; }
h1,h2,h3 { font-weight: 710; }
button,summary,input { font: inherit; }
button,summary { cursor: pointer; }
button,a { color: inherit; }
a { text-decoration: none; }
code,pre { font-family: var(--mono); }
summary { list-style: none; }
summary::-webkit-details-marker { display: none; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
html:not(.js) .enhanced { display: none; }
.sr-only, .skip:not(:focus) {
  overflow: hidden; clip-path: inset(50%); position: absolute;
  width: 1px; height: 1px; padding: 0; margin: -1px; white-space: nowrap;
}
.skip:focus { position: fixed; z-index: 20; top: .5rem; left: .5rem; background: var(--paper); padding: .65rem 1rem; }
.wrap { width: min(82.5rem, calc(100% - clamp(2.25rem, 8.6vw, 9.25rem))); margin-inline: auto; }

.top {
  position: absolute; z-index: 5; inset: max(.42rem, env(safe-area-inset-top)) 0 auto;
  pointer-events: none;
}
.nav {
  position: relative; display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); align-items: center;
  gap: clamp(.8rem, 3.2vw, 2.8rem); min-height: 3.8rem; padding-inline: .1rem;
  border-bottom: 1px solid var(--rule); background: var(--nav-fill);
  transform-origin: center top; pointer-events: auto;
}
.wordmark {
  display: inline-flex; align-items: center; justify-self: start; gap: .55rem; width: fit-content; min-height: 44px;
  font-size: 1.18rem; line-height: 1; font-weight: 760; letter-spacing: -.035em; white-space: nowrap;
}
.wordmark rect { fill: var(--ink); }
.wordmark path { fill: var(--paper); }
.nav nav, .nav-end { display: flex; align-items: center; justify-content: center; gap: clamp(.75rem, 2.65vw, 2.35rem); }
.nav nav a { min-height: 44px; display: inline-flex; align-items: center; gap: .32rem; color: var(--secondary); font-size: .86rem; white-space: nowrap; }
.nav nav span { color: var(--accent); font-family: var(--mono); font-size: .79rem; }
.nav-end { justify-content: end; gap: .35rem; }
.nav-console { display: inline-flex; align-items: center; gap: .45rem; padding-inline: .55rem .26rem; min-height: 44px; font-size: .86rem; font-weight: 670; white-space: nowrap; }
.nav-console span { color: var(--accent); font-family: var(--mono); }
.theme-control { position: relative; }
.theme-trigger { display: grid; place-items: center; min-width: 44px; min-height: 44px; }
.theme-trigger svg { width: 19px; height: 19px; stroke: currentColor; stroke-width: 1.45; fill: none; stroke-linecap: round; stroke-linejoin: round; }
.theme-trigger .theme-moon, :root[data-theme="dark"] .theme-trigger .theme-sun { display: none; }
:root[data-theme="dark"] .theme-trigger .theme-moon { display: block; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) .theme-trigger .theme-sun { display: none; }
  :root:not([data-theme]) .theme-trigger .theme-moon { display: block; }
}
.theme-menu {
  position: absolute; top: calc(100% + .45rem); right: -.2rem;
  width: 9.6rem; min-width: 0; padding: .35rem .45rem .45rem;
  color: var(--ink); background: var(--paper); border: 1px solid var(--rule);
  box-shadow: 0 12px 30px #23150928; font-size: .88rem;
}
.theme-menu legend { position: absolute; inset: 0 0 auto; padding: .55rem .76rem 0; color: var(--secondary); font-size: .74rem; }
.theme-menu label { display: flex; align-items: center; gap: .57rem; min-height: 44px; padding-inline: .45rem; cursor: pointer; }
.theme-menu label:first-of-type { margin-top: 1.33rem; }
.theme-menu input { margin: 0; accent-color: var(--accent); }

.hero {
  display: grid;
  grid-template-columns: minmax(0,.91fr) minmax(0,1.09fr);
  align-items: center; gap: clamp(1.2rem,3.45vw,4.25rem);
  padding-block: clamp(5.7rem,8.9vw,9.1rem) clamp(1.55rem,4.05vw,4rem);
  border-bottom: 1px solid var(--rule);
}
.hero-intro { min-width: 0; padding-bottom: .5rem; }
.hero-overline {
  margin-bottom: 1.08rem;
  color: var(--accent); font-size: .84rem; letter-spacing: .105em; font-weight: 645;
}
.hero-overline span { display: inline-block; width: 1.48rem; height: 1px; margin-right: .53rem; background: currentColor; vertical-align: .3em; }
.hero h1 {
  font-size: clamp(2.7rem,5.46vw,5.15rem); line-height: 1.12;
  font-weight: 680; letter-spacing: -.016em;
}
.hero h1 span { display: block; }
.hero-summary {
  max-width: 28em; margin-top: 1.25rem; color: var(--secondary);
  font-size: clamp(1rem,1.27vw,1.16rem); line-height: 1.75;
}
.actions { display: flex; align-items: center; flex-wrap: wrap; gap: .45rem 1.25rem; margin-top: 1.35rem; }
.hero-actions { margin-top: 1.7rem; }
.button {
  display: inline-flex; align-items: center; justify-content: center; gap: .75rem; padding: .6rem 1rem;
  min-height: 47px; border: 1px solid transparent; font-size: .9rem; font-weight: 675; white-space: nowrap;
}
.button span,.inline-link span { display: inline-block; font: 600 .95rem var(--mono); }
.primary { color: var(--on-button); background: var(--ink); }
.quiet { padding-inline: .17rem; }
.quiet span, .inline-link span { color: var(--accent); }

.folio-window {
  position: relative; isolation: isolate; overflow: clip;
  background: var(--folio-back); aspect-ratio: 1.3;
}
.folio-tilt, .folio-illustration { width: 100%; height: 100%; }
.folio-tilt { pointer-events: none; }
.folio-illustration { display: block; overflow: visible; }
.ground-shadow { fill: var(--folio-shade); opacity: .25; }
.ground-guide { stroke: var(--folio-line); opacity: .44; vector-effect: non-scaling-stroke; }
.ground-cross { stroke: var(--folio-line); opacity: .6; vector-effect: non-scaling-stroke; }
.top-face { fill: var(--folio-red); }
.top-edge { fill: var(--folio-red-edge); }
.top-rule { stroke: #f1bf9e; opacity: .42; }
.top-shadow { fill: #793c31; opacity: .8; }
.top-mark { fill: #f3e3cb; }
.top-grain,.top-edge-rule { stroke: #f0bfa1; opacity: .55; }
.middle-face { fill: var(--folio-core); }
.middle-edge { fill: var(--folio-core-edge); }
.middle-band { fill: var(--folio-track); }
.middle-rule,.middle-edge-rule { stroke: var(--folio-track); opacity: .68; }
.middle-node { fill: var(--folio-track); }
.base-face { fill: var(--folio-stock); }
.base-edge { fill: var(--folio-stock-edge); }
.base-seam,.base-edge-rule { stroke: var(--folio-stock-rule); opacity: .77; }
.base-swath { fill: var(--folio-stock-rule); }
.base-marks { stroke: var(--folio-stock-rule); opacity: .81; }
#integration { padding-block-start: clamp(3rem,6.9vw,6.35rem); }

.chapter { padding-block: clamp(4.2rem, 9vw, 8.5rem); }
.chapter-head,.closing { display: grid; grid-template-columns: minmax(7.3rem,1fr) minmax(0,3.53fr); gap: .85rem 1.7rem; }
.chapter-head { margin-bottom: clamp(2rem, 4.6vw, 4rem); }
.chapter-id { display: flex; align-items: center; align-self: start; gap: .65rem; width: max-content; min-height: 2.4rem; color: var(--secondary); font-size: .83rem; }
.chapter-id span { padding: .35rem .5rem; border: 1px solid var(--rule); color: var(--accent); line-height: 1; font: 530 .79rem var(--mono); }
.chapter-id b { font-weight: 645; }
.chapter h2, .closing h2 {
  font-size: clamp(1.92rem, 4.4vw, 4.35rem); line-height: 1.18; letter-spacing: -.028em; text-wrap: balance;
  font-feature-settings: "palt" 1, "kern" 1;
}
.chapter-copy p { margin-top: .95rem; max-width: 46rem; color: var(--secondary); }
.chapter-body { display: grid; grid-template-columns: minmax(0,1fr) minmax(0,1.29fr); align-items: start; gap: 1.65rem clamp(1.9rem, 6vw, 6rem); }
.interface { min-width: 0; border-top: 1px solid var(--rule); }
.interface:last-of-type { border-bottom: 1px solid var(--rule); }
.interface summary { display: flex; justify-content: space-between; align-items: center; gap: .7rem; min-height: 3.8rem; padding: .64rem .1rem; }
.interface-name { display: flex; align-items: baseline; flex-wrap: wrap; gap: .15rem .75rem; }
.interface-name strong { font-size: .99rem; }
.interface-name code { color: var(--accent); font-size: .77rem; }
.interface p { padding: 0 1.13rem 1.1rem .1rem; color: var(--secondary); font-size: .91rem; line-height: 1.72; overflow-wrap: anywhere; }
.disclose { display: block; position: relative; flex: 0 0 15px; width: 15px; height: 15px; color: var(--accent); }
.disclose::before,.disclose::after { content: ""; position: absolute; inset: 7px 2px auto; height: 1px; background: currentColor; }
.disclose::after { transform: rotate(90deg); }
.interface[open] .disclose::after { opacity: 0; }
.inline-link { display: inline-flex; align-items: center; width: fit-content; gap: .65rem; min-height: 44px; margin-top: .72rem; font-size: .93rem; font-weight: 670; }
.example { overflow: hidden; min-width: 0; border: 1px solid var(--rule); background: var(--surface); }
.example-head { display: flex; align-items: center; justify-content: space-between; gap: .45rem; min-height: 3.35rem; padding: 0 .98rem; border-bottom: 1px solid var(--rule); }
.example-head > div { min-width: 0; font: 580 clamp(.67rem,1.45vw,.83rem) var(--mono); overflow-wrap: anywhere; }
.example-head b { margin-right: .27rem; color: var(--accent); }
.example-head button { min-height: 44px; border: 0; background: transparent; padding: .2rem .05rem; font-size: .81rem; font-weight: 670; white-space: nowrap; }
.example pre { overflow: auto; padding: 1.02rem 1rem 1.15rem; min-height: 12rem; font-size: clamp(.73rem,1.25vw,.92rem); line-height: 1.72; }
.example pre:focus-visible { outline-offset: -3px; }
.example > p { padding: .62rem .98rem; border-top: 1px solid var(--rule); color: var(--secondary); font-size: .81rem; }
.example > p a { color: var(--accent); text-decoration: underline; text-underline-offset: .17em; }

.usage-surface { background: var(--surface); border-block: 1px solid var(--rule); }
.note { display: grid; grid-template-columns: 1.45rem minmax(0,1fr); gap: .65rem; padding-block: .93rem; border-top: 1px solid var(--rule); }
.note > span { color: var(--accent); font: 660 .8rem var(--mono); padding-top: .25rem; }
.note h3 { font-size: 1rem; }
.note p { margin-top: .19rem; color: var(--secondary); font-size: .91rem; }
.request-example { background: var(--paper); padding: .95rem clamp(.8rem,2.5vw,1.5rem) 1.18rem; border-top: 2px solid var(--ink); min-width: 0; }
.request-example figcaption { display: flex; align-items: center; justify-content: space-between; gap: .6rem; padding-bottom: .6rem; border-bottom: 1px solid var(--rule); font-size: .88rem; }
.request-example figcaption span { color: var(--secondary); font-size: .75rem; }
.request-example dl { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: .55rem; padding-block: 1rem 1.15rem; }
.request-example dt { color: var(--secondary); font-size: .79rem; }
.request-example dd { margin-top: .4rem; font: 670 clamp(1.02rem,3vw,2.23rem)/1.2 var(--mono); letter-spacing: -.055em; white-space: nowrap; }
.request-example dd span { display: block; margin-top: .29rem; color: var(--secondary); font: 500 .7rem var(--mono); letter-spacing: 0; }
.usage-bar { display: grid; grid-template-columns: 11264fr 1216fr; height: .57rem; gap: 3px; overflow: hidden; }
.usage-bar div:first-child,.legend span:first-child i { background: var(--accent); }
.usage-bar div:last-child,.legend span:last-child i { background: var(--rule); }
.legend { display: flex; flex-wrap: wrap; gap: .2rem .83rem; margin-top: .63rem; color: var(--secondary); font-size: .76rem; }
.legend i { display: inline-block; width: .49rem; height: .49rem; margin-right: .12rem; }

.closing { padding-block: clamp(3.6rem,8vw,6.9rem); }
.closing-body { display: flex; justify-content: space-between; align-items: end; gap: 1rem 1.6rem; flex-wrap: wrap; }
.closing .actions { margin-top: 0; }
.closing h2 { font-size: clamp(1.92rem,3.6vw,3.75rem); }
.foot { background: var(--surface); border-top: 1px solid var(--rule); }
.foot .wrap {
  display: flex; justify-content: space-between; gap: .6rem 1.4rem; flex-wrap: wrap;
  padding-block: 1.2rem max(1.4rem, env(safe-area-inset-bottom));
}
.foot p { color: var(--secondary); font: 520 .75rem var(--mono); }
.foot nav { display: flex; align-items: start; flex-wrap: wrap; gap: 0 1.25rem; }
.foot nav a { display: inline-flex; align-items: center; min-height: 44px; color: var(--secondary); font-size: .84rem; white-space: nowrap; }

@media (hover: hover) {
  .nav a:hover,.foot a:hover,.quiet:hover,.inline-link:hover,.example button:hover { color: var(--accent); text-decoration: underline; text-underline-offset: .25em; }
  .primary:hover { opacity: .86; }
  .theme-trigger:hover,.theme-menu label:hover,.interface summary:hover { background: var(--surface); }
}
@keyframes withdraw {
  from { opacity: 1; transform: translateY(0) scale(1); filter: blur(0); }
  68% { opacity: .72; transform: translateY(-.93rem) scale(.925); filter: blur(2px); }
  to { opacity: 0; transform: translateY(-2.1rem) scale(.855); filter: blur(4.6px); visibility: hidden; }
}
@keyframes enter {
  from { opacity: .18; transform: translateY(1.6rem); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes chart { from { transform: scaleX(.08); } to { transform: scaleX(1); } }
@keyframes ink-seat {
  from { opacity: .18; transform: translateY(.95rem); }
  to { opacity: 1; transform: none; }
}
@keyframes top-open {
  from { transform: none; }
  to { transform: translate(22px,-61px); }
}
@keyframes middle-open {
  from { transform: none; }
  to { transform: translate(36px,-5px); }
}
@keyframes base-open {
  from { transform: none; }
  to { transform: translate(-30px,28px); }
}
@keyframes ground-open {
  from { opacity: .6; transform: none; }
  to { opacity: 1; transform: translate(-11px,5px); }
}
@media (prefers-reduced-motion: no-preference) {
  .base-ink,.middle-ink,.top-ink { animation: ink-seat .7s cubic-bezier(.16,.77,.19,1) both; }
  .middle-ink { animation-delay: .06s; }
  .top-ink { animation-delay: .12s; }
  .folio-tilt { transition: transform .23s cubic-bezier(.22,.62,.3,1); }
  .button span { transition: transform .2s ease-out; }
  .quiet:hover span,.quiet:focus-visible span { transform: translateY(3px); }
  .primary:hover span,.primary:focus-visible span { transform: translate(2px,-2px); }
  @supports ((animation-timeline: scroll()) and (animation-range: 0% 100%)) {
    .hero { view-timeline: --hero-fold block; }
    .sheet-top,.sheet-middle,.sheet-base,.folio-ground {
      animation-duration: auto; animation-timing-function: linear; animation-fill-mode: both;
      animation-timeline: --hero-fold; animation-range: exit 0% exit 65%;
    }
    .sheet-top { animation-name: top-open; }
    .sheet-middle { animation-name: middle-open; }
    .sheet-base { animation-name: base-open; }
    .folio-ground { animation-name: ground-open; }
  }
}

@media (prefers-reduced-motion: no-preference) {
  @supports ((animation-timeline: scroll()) and (animation-range: 0% 100%)) {
    .top { position: fixed; }
    .nav { animation: withdraw linear both; animation-timeline: scroll(root block); animation-range: 10px 190px; }
    .nav:focus-within:has(:focus-visible),.nav:has(details[open]) { animation: none; }
    .appear { animation: enter linear both; animation-timeline: view(block); animation-range: entry 0% cover 28%; }
    .chapter-id.appear { animation-range: entry 0% cover 22%; }
    .example.appear,.request-example.appear { animation-range: entry 0% cover 31%; }
    .appear:focus-within,:target > .chapter-head .appear { animation: none; }
    .request-example { view-timeline-name: --record; }
    .usage-bar div { transform-origin: left; animation: chart linear both; animation-timeline: --record; animation-range: entry 7% cover 28%; }
  }
  @supports not ((animation-timeline: scroll()) and (animation-range: 0% 100%)) {
    .scroll-fallback .appear.pending { opacity: .18; transform: translateY(1.25rem); }
    .scroll-fallback .appear { transition: opacity .65s ease-out, transform .65s ease-out; }
    .scroll-fallback .appear.pending:focus-within, .scroll-fallback :target .appear.pending { opacity: 1; transform: none; }
  }
}
@media (max-width: 54rem) {
  .hero h1 { font-size: clamp(2.4rem,6.35vw,4.1rem); }
  .hero-actions { gap: .42rem .65rem; }
  .hero .quiet { gap: .36rem; }
}
@media (max-width: 46rem) {
  .wrap { width: calc(100% - clamp(2.1rem, 8.5vw, 3.75rem)); }
  .top { inset-block-start: max(.23rem, env(safe-area-inset-top)); }
  .nav { grid-template-columns: minmax(0,1fr) auto; min-height: 3.25rem; gap: .4rem; padding-inline: .05rem; }
  .nav > nav { display: none; }
  .nav-console { padding-inline: .36rem .17rem; }
  .hero { grid-template-columns: minmax(0,1fr); align-items: start; gap: 1.35rem; padding-block: 5.6rem 1.45rem; }
  .hero-intro { padding-bottom: 0; }
  .hero-overline { margin-bottom: .72rem; font-size: .73rem; }
  .hero h1 { font-size: clamp(1.96rem,8.8vw,3.75rem); text-wrap: balance; }
  .hero h1 span { display: inline; }
  .hero-summary { font-size: .95rem; margin-top: .69rem; line-height: 1.64; }
  .hero-actions { margin-top: 1.11rem; gap: .35rem .95rem; }
  .folio-window { max-height: 28rem; }
  .chapter { padding-block: 3.55rem; }
  .chapter-head,.chapter-body,.closing { grid-template-columns: minmax(0,1fr); }
  .chapter-head { margin-bottom: 1.75rem; }
  .chapter-copy p { margin-top: .6rem; font-size: .93rem; }
  .request-example { padding-top: .7rem; }
  .closing-body { flex-direction: column; align-items: start; }
  .closing .actions { gap: .4rem .9rem; }
}
@media (max-width: 23rem) {
  .hero .primary { padding-inline: .68rem; }
  .hero-actions { gap: .2rem .8rem; }
}
