:root {
  color-scheme: light;
  --paper: #f5f5f7;
  --card: #ffffff;
  --text: #1d1d1f;
  --muted: #55555e;
  --line: #dedee3;
  --radius: 22px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
  color: var(--text);
  background: var(--paper);
  font-synthesis: none;
}
* { box-sizing: border-box; }
body { margin: 0; font-size: 16px; font-weight: 400; line-height: 1.6; }
body, main, section, aside, nav, div { min-width: 0; }
::selection { color: var(--card); background: var(--text); }
.shell { width: min(1200px, calc(100% - 64px)); margin-inline: auto; }
.grid { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 20px; }
.span-4 { grid-column: span 4; }
.span-6 { grid-column: span 6; }
.span-8 { grid-column: span 8; }
.span-12 { grid-column: 1 / -1; }
.surface { position: relative; padding: clamp(24px, 3vw, 38px); border-radius: var(--radius); background: var(--card); overflow: hidden; }
.ink { color: var(--paper); background: var(--text); }
.soft { background: #eaeaee; }
.mono, dt, code, select { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
code { font-size: 16px; font-weight: 500; white-space: nowrap; }
.mono { font-size: 16px; font-weight: 500; letter-spacing: .04em; }
p { margin: 0 0 18px; max-width: 72ch; }
p:last-child { margin-bottom: 0; }
h1, h2, h3 { margin: 0 0 20px; font-weight: 700; line-height: 1.15; letter-spacing: -.045em; text-wrap: balance; }
h1 { font-size: 2.25rem; max-width: 22ch; }
h2 { font-size: clamp(1.6rem, 2.1vw, 2rem); max-width: 28ch; }
h3 { font-size: 1.25rem; }
a { color: inherit; text-underline-offset: .2em; text-decoration-thickness: 1px; font-size: 16px; overflow-wrap: anywhere; }
button, select, summary { font-size: 16px; }
a:focus-visible, summary:focus-visible, select:focus-visible, button:focus-visible { outline: 3px solid #363639; outline-offset: 5px; border-radius: 4px; }
.ink a:focus-visible { outline-color: #fff; }
h2:focus, main:focus { outline: none; }
ul { padding-left: 22px; margin: 0 0 20px; }
li { margin-bottom: 14px; max-width: 72ch; }
dl { margin: 22px 0; }
dt { font-size: 16px; font-weight: 600; line-height: 1.5; margin-bottom: 5px; }
dd { margin: 0; font-size: 16px; max-width: 72ch; }
header.shell { display: flex; align-items: center; justify-content: space-between; gap: 24px; padding-block: 24px; position: relative; z-index: 10; }
header > a { display: flex; align-items: center; gap: 12px; text-decoration: none; min-height: 48px; font-weight: 700; }
header > a .mono { font-weight: 400; color: var(--muted); }
.mark { flex: 0 0 22px; width: 22px; height: 22px; border: 2px solid var(--text); border-radius: 6px; background: linear-gradient(90deg, transparent 43%, var(--text) 43%, var(--text) 53%, transparent 53%), linear-gradient(0deg, transparent 43%, var(--text) 43%, var(--text) 53%, transparent 53%); transform: rotate(-8deg); }
summary { display: flex; align-items: center; justify-content: space-between; gap: 20px; list-style: none; padding: 10px 18px; min-height: 48px; background: var(--card); border: 1px solid var(--line); border-radius: 14px; cursor: pointer; font-weight: 500; }
summary::-webkit-details-marker { display: none; }
details[open] summary > span { transform: rotate(45deg); }
details:not([open]) > nav { display: none; }
details > nav { position: absolute; inset: calc(100% - 8px) 0 auto; border: 1px solid var(--line); padding: 30px; background: var(--card); border-radius: var(--radius); box-shadow: 0 16px 40px #1d1d1f16; max-height: calc(100dvh - 110px); overflow-y: auto; }
details > nav section { grid-column: span 3; }
nav h2 { font-size: 1.125rem; letter-spacing: -.02em; margin: 0 0 12px; }
nav ul { padding: 0; margin: 0; list-style: none; }
nav li { margin: 0; }
nav a { display: flex; align-items: center; min-height: 48px; padding: 8px 0; text-decoration: none; }
nav a:hover { text-decoration: underline; }
nav a[aria-current="page"] { font-weight: 700; text-decoration: underline; }
main { padding-bottom: 36px; }
.intro { padding-block: 46px 40px; align-items: start; }
.intro > section { padding-right: 30px; }
.intro > section > .mono { color: var(--muted); margin-bottom: 22px; }
.intro h1 + p { font-size: 18px; max-width: 62ch; margin: 0; }
body:has(#chapters-list) .intro h1 { font-size: clamp(2.5rem, 4.7vw, 4rem); line-height: 1.08; max-width: 20ch; }
[data-section-jump] { padding: 24px; border: 1px solid var(--line); border-radius: var(--radius); }
[data-section-jump] .mono { color: var(--muted); margin-bottom: 12px; }
[data-section-jump] li a { min-height: 44px; padding-block: 8px; }
[data-section-jump] select { display: block; width: 100%; min-height: 48px; padding: 10px; color: var(--text); background: var(--card); border: 1px solid #777780; border-radius: 10px; }
[data-section-jump][data-enhanced] ul { display: none; }
.surface > .mono { margin-bottom: 18px; color: var(--muted); }
.surface.ink > .mono { color: #c7c7cc; }
.row-link { display: flex; gap: 18px; align-items: center; justify-content: space-between; min-height: 50px; padding-block: 12px; margin-top: 8px; border-top: 1px solid var(--line); text-decoration: none; font-weight: 500; }
.row-link > span { flex: 0 0 auto; font-size: 20px; }
.row-link:hover { text-decoration: underline; }
.ink .row-link { border-color: #5b5b60; }
.geometry { position: relative; display: grid; grid-template-columns: 1.25fr 1fr .6fr; gap: 14px; height: 150px; margin-top: 32px; align-items: center; }
.geometry span { width: 100%; height: 100%; border: 1px solid #c8c8cf; border-radius: 90px 90px 24px 24px; background: linear-gradient(145deg, #f5f5f7, #e2e2e8); }
.geometry span:first-child { border-radius: 100px 24px 24px 100px; background: repeating-linear-gradient(0deg, transparent 0, transparent 10px, #dedee5 11px, transparent 12px), #f5f5f7; }
.geometry span:nth-child(2) { height: 85%; border-radius: 50%; background: radial-gradient(circle at 35% 35%, #fff 0, #f5f5f7 46%, #c8c8d0 100%); }
.geometry span:nth-child(3) { height: 60%; background: var(--text); border: 0; border-radius: 16px; transform: rotate(-8deg); }
.source-note { display: grid; grid-template-columns: 180px 1fr; gap: 10px 28px; padding: 28px 8px; margin-top: 12px; border-bottom: 1px solid var(--line); }
.source-note > p { margin: 0; color: var(--muted); }
.source-note ul { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 0 26px; }
.source-note li { margin: 0; }
.source-note a { min-height: 48px; padding-block: 10px; display: flex; align-items: center; }
.source-note > p:last-child:not(:first-child) { grid-column: 2; }
#chapters-list { padding-block: 54px 16px; scroll-margin-top: 24px; }
.section-head { margin-bottom: 26px; }
.section-head > .mono { color: var(--muted); }
#chapters-list nav section { grid-column: span 3; background: var(--card); border-radius: 16px; padding: 24px; }
#chapters-list nav h2 { margin-bottom: 14px; }
.next { padding-block: 32px 18px; }
.next > .mono { color: var(--muted); margin-bottom: 6px; }
.next > a { display: flex; justify-content: space-between; gap: 20px; font-size: 20px; font-weight: 600; max-width: 560px; min-height: 56px; border-bottom: 1px solid var(--line); }
footer { padding-block: 32px 40px; border-top: 1px solid var(--line); }
footer p { font-size: 16px; max-width: 72ch; color: var(--muted); margin-bottom: 16px; }
footer nav { display: flex; flex-wrap: wrap; gap: 8px 26px; }
footer a { min-height: 48px; }
.skip { position: absolute; top: -100px; left: 20px; padding: 12px 20px; background: var(--text); color: #fff; z-index: 20; min-height: 48px; }
.skip:focus { top: 8px; outline-color: #fff; }
[id] { scroll-margin-top: 24px; }
@media (hover: hover) and (prefers-reduced-motion: no-preference) {
  .surface { transition: transform 160ms ease, box-shadow 160ms ease; }
  .surface:has(a):hover { transform: scale(1.007); box-shadow: 0 10px 24px #1d1d1f0a; }
}
@media (min-width: 761px) {
  [data-section-jump] select { display: none; }
  [data-section-jump][data-enhanced] ul { display: block; }
}
@media (max-width: 1000px) {
  details > nav section, #chapters-list nav section { grid-column: span 6; }
  .intro > section { grid-column: span 8; padding-right: 0; }
  .source-note { grid-template-columns: 145px 1fr; }
}
@media (max-width: 760px) {
  .shell { width: calc(100% - 32px); }
  .grid { gap: 16px; }
  .span-4, .span-6, .span-8, .span-12, .intro > section { grid-column: 1 / -1; }
  header.shell { padding-block: 16px; gap: 12px; flex-wrap: wrap; }
  header > a { flex: 1 1 auto; }
  header > a .mono { display: block; letter-spacing: 0; font-size: 16px; }
  header > a { line-height: 1.2; }
  summary { padding-inline: 12px; gap: 12px; }
  details > nav { padding: 20px; max-height: calc(100dvh - 170px); }
  details > nav section { grid-column: 1 / -1; }
  details > nav .grid { grid-template-columns: minmax(0, 1fr); gap: 24px; }
  .intro { padding-block: 24px 26px; gap: 26px; }
  .intro h1 + p { font-size: 16px; }
  .intro > section > .mono { margin-bottom: 16px; }
  [data-section-jump] { padding: 18px; }
  .surface { padding: 24px; border-radius: 20px; }
  h1 { font-size: 2.25rem; }
  h2 { font-size: 1.6rem; }
  .geometry { height: 120px; gap: 10px; margin-top: 26px; }
  .source-note { display: block; padding: 24px 0; }
  .source-note > .mono { margin-bottom: 10px; }
  .source-note ul { display: block; }
  .source-note a { min-height: 48px; }
  .source-note > p:last-child:not(:first-child) { margin-top: 16px; }
  #chapters-list { padding-top: 36px; }
  #chapters-list nav section { grid-column: 1 / -1; padding: 24px; }
  footer nav { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 16px; }
  footer a { padding-block: 10px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; animation: none !important; }
}
