/* Layout: one scroll read like a pilgrimage route; a living Dharma wheel opens it, chapters follow in historical order, each with one thing to touch. */
:root {
  --paper: #e7ece5; /* celadon glaze */
  --paper-2: #dce3da;
  --ink: #1e2a2b; /* temple-ink indigo green */
  --ink-soft: #4a5857;
  --rule: #b9c4ba;
  --saffron: #b9690f; /* robe */
  --lacquer: #93291f; /* temple lacquer */
  --lapis: #2d4f86; /* Tibetan lapis */
  --gold: #a8862e;
  --chip: #f3f6f1;
  --water: #9fb7b4;
  --display: "Marcellus", "Trajan Pro", Georgia, serif;
  --body: "Source Serif 4", Georgia, "Times New Roman", serif;
  --label: "Work Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --measure: 64ch;
  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #141b1d;
    --paper-2: #1b2427;
    --ink: #dce5dd;
    --ink-soft: #9daaa5;
    --rule: #33413f;
    --saffron: #e3953a;
    --lacquer: #d9634f;
    --lapis: #7fa2dd;
    --gold: #d2b05a;
    --chip: #20292b;
    --water: #2c4446;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --paper: #141b1d;
  --paper-2: #1b2427;
  --ink: #dce5dd;
  --ink-soft: #9daaa5;
  --rule: #33413f;
  --saffron: #e3953a;
  --lacquer: #d9634f;
  --lapis: #7fa2dd;
  --gold: #d2b05a;
  --chip: #20292b;
  --water: #2c4446;
  color-scheme: dark;
}

* {
  box-sizing: border-box;
}
html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}
section[id] {
  scroll-margin-top: 60px;
}
body {
  background: var(--paper);
  color: var(--ink);
  font-family: var(--body);
  font-size: 1.075rem;
  line-height: 1.65;
  margin: 0;
  overflow-x: hidden;
}
body::before {
  content: "";
  position: fixed;
  inset: 0 0 auto;
  height: env(safe-area-inset-top, 0px);
  z-index: 10;
  background: var(--paper);
}
.wrap {
  max-width: 1120px;
  margin: 0 auto;
  padding-left: max(20px, env(safe-area-inset-left, 0px));
  padding-right: max(20px, env(safe-area-inset-right, 0px));
}
h1,
h2,
h3 {
  font-family: var(--display);
  font-weight: 400;
  line-height: 1.12;
  text-wrap: balance;
  margin: 0;
}
h2 {
  font-size: clamp(2rem, 4.4vw, 3.1rem);
}
h3 {
  font-size: 1.45rem;
}
p {
  margin: 0;
}
.eyebrow {
  font-family: var(--label);
  font-size: 0.74rem;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--saffron);
}
em.term {
  font-style: italic;
  color: var(--lacquer);
}
a {
  color: var(--lapis);
}
button {
  font: inherit;
  color: inherit;
}
a:focus-visible,
button:focus-visible,
input:focus-visible,
[tabindex]:focus-visible {
  outline: 2px solid var(--saffron);
  outline-offset: 3px;
}
.sr {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}

/* progress + nav */
.progress {
  position: fixed;
  top: env(safe-area-inset-top, 0px);
  left: 0;
  height: 3px;
  width: 100%;
  background: var(--saffron);
  transform-origin: 0 50%;
  transform: scaleX(0);
  z-index: 11;
}
.nav {
  position: sticky;
  top: env(safe-area-inset-top, 0px);
  z-index: 9;
  background: color-mix(in srgb, var(--paper) 90%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--rule);
}
.nav .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding-block: 12px;
}
.brand {
  font-family: var(--display);
  font-size: 1.3rem;
  color: var(--ink);
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 10px;
  white-space: nowrap;
}
.brand svg {
  width: 26px;
  height: 26px;
  color: var(--saffron);
}
.nav ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  gap: 22px;
  font-family: var(--label);
  font-size: 0.82rem;
  font-weight: 500;
  position: relative;
}
.nav a.link {
  color: var(--ink-soft);
  text-decoration: none;
  white-space: nowrap;
  transition: color 0.25s;
  display: block;
  padding-block: 4px;
}
.nav a.link:hover,
.nav a.link.on {
  color: var(--ink);
}
.nav .ind {
  position: absolute;
  bottom: -2px;
  height: 2px;
  background: var(--saffron);
  border-radius: 2px;
  transition:
    left 0.45s var(--ease),
    width 0.45s var(--ease),
    opacity 0.3s;
  opacity: 0;
}
.menu-btn {
  display: none;
  width: 44px;
  height: 44px;
  margin-right: -10px;
  border: 0;
  background: none;
  cursor: pointer;
  place-content: center;
  gap: 5px;
}
.menu-btn span {
  display: block;
  width: 22px;
  height: 2px;
  border-radius: 2px;
  background: var(--ink);
  transition:
    transform 0.3s var(--ease),
    opacity 0.2s;
}
.menu-btn[aria-expanded="true"] span:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}
.menu-btn[aria-expanded="true"] span:nth-child(2) {
  opacity: 0;
}
.menu-btn[aria-expanded="true"] span:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}
@media (max-width: 960px) {
  .nav .wrap {
    padding-block: 8px;
  }
  .menu-btn {
    display: grid;
  }
  .nav ul {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    flex-direction: column;
    gap: 0;
    padding: 8px max(20px, env(safe-area-inset-left, 0px)) 16px;
    background: var(--paper);
    border-bottom: 1px solid var(--rule);
    box-shadow: 0 16px 32px -20px rgba(0, 0, 0, 0.35);
    font-size: 1rem;
    max-height: calc(100dvh - 60px);
    overflow-y: auto;
    visibility: hidden;
    opacity: 0;
    transform: translateY(-8px);
    transition:
      opacity 0.25s,
      transform 0.25s var(--ease),
      visibility 0s 0.25s;
  }
  .nav ul.open {
    visibility: visible;
    opacity: 1;
    transform: none;
    transition:
      opacity 0.25s,
      transform 0.25s var(--ease);
  }
  .nav a.link {
    padding-block: 12px;
    border-bottom: 1px solid var(--rule);
  }
  .nav li:nth-last-child(2) a.link {
    border-bottom: 0;
  }
  .nav a.link.on {
    color: var(--saffron);
  }
  .nav .ind {
    display: none;
  }
}

/* hero */
.hero {
  position: relative;
  overflow: hidden;
  padding-block: clamp(48px, 8vw, 96px) clamp(40px, 6vw, 72px);
  border-bottom: 1px solid var(--rule);
}
#leaves {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}
.hero .wrap {
  position: relative;
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: clamp(24px, 5vw, 64px);
  align-items: center;
}
.hero h1 {
  font-size: clamp(2.7rem, 7vw, 5.4rem);
  letter-spacing: -0.01em;
}
.hero h1 .w {
  display: inline-block;
  animation: rise 0.9s var(--ease) both;
}
.hero h1 .w.s {
  color: var(--saffron);
}
@keyframes rise {
  from {
    transform: translateY(0.4em);
    opacity: 0;
    filter: blur(4px);
  }
}
.hero .lede {
  margin-top: 24px;
  font-size: 1.22rem;
  max-width: 34ch;
  color: var(--ink-soft);
  animation: rise 1s 0.5s var(--ease) both;
}
.hero .meta {
  margin-top: 32px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px 28px;
  font-family: var(--label);
  font-size: 0.8rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-soft);
  animation: rise 1s 0.7s var(--ease) both;
}
.hero .meta b {
  display: block;
  font-family: var(--display);
  font-size: 1.6rem;
  letter-spacing: 0;
  text-transform: none;
  color: var(--ink);
  font-weight: 400;
}
.wheel {
  width: 100%;
  max-width: 420px;
  justify-self: center;
  margin: 0;
}
.wheel .spin {
  aspect-ratio: 1;
  max-width: 100%;
  cursor: grab;
  touch-action: none;
  user-select: none;
  position: relative;
}
.wheel .spin:active {
  cursor: grabbing;
}
.wheel .spin::after {
  content: "";
  position: absolute;
  inset: 12%;
  border-radius: 50%;
  background: radial-gradient(circle, color-mix(in srgb, var(--saffron) 22%, transparent), transparent 70%);
  z-index: -1;
  animation: glow 6s ease-in-out infinite;
}
@keyframes glow {
  50% {
    transform: scale(1.15);
    opacity: 0.6;
  }
}
.wheel svg {
  width: 100%;
  height: 100%;
  color: var(--saffron);
  display: block;
  animation: zoomin 1.2s var(--ease) both;
}
@keyframes zoomin {
  from {
    transform: scale(0.7) rotate(-90deg);
    opacity: 0;
  }
}
.wheel figcaption {
  text-align: center;
  font-family: var(--label);
  font-size: 0.75rem;
  color: var(--ink-soft);
  margin-top: 10px;
  letter-spacing: 0.04em;
}
@media (max-width: 820px) {
  .hero .wrap {
    grid-template-columns: 1fr;
  }
  .wheel {
    max-width: 260px;
    order: -1;
  }
}

/* sections + scroll reveal (only where the browser supports scroll timelines; otherwise static) */
section.chapter {
  padding-block: clamp(56px, 8vw, 104px);
  border-bottom: 1px solid var(--rule);
}
.head {
  display: grid;
  gap: 14px;
  max-width: 760px;
  margin-bottom: clamp(32px, 5vw, 56px);
}
.head p {
  color: var(--ink-soft);
  font-size: 1.15rem;
  max-width: var(--measure);
}
@supports (animation-timeline: view()) {
  .rv {
    animation: reveal linear both;
    animation-timeline: view();
    animation-range: entry 0% entry 55%;
  }
  @keyframes reveal {
    from {
      opacity: 0.15;
      transform: translateY(36px);
    }
  }
  .head h2 {
    background: linear-gradient(90deg, var(--ink) 50%, var(--rule) 50%) 100% 0/200% 100% no-repeat;
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    animation: ink linear both;
    animation-timeline: view();
    animation-range: entry 20% cover 35%;
  }
  @keyframes ink {
    to {
      background-position: 0 0;
    }
  }
}
.prose {
  display: grid;
  gap: 1.1em;
  max-width: var(--measure);
}
.two {
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) minmax(0, 0.9fr);
  gap: clamp(28px, 5vw, 64px);
  align-items: start;
}
@media (max-width: 820px) {
  .two {
    grid-template-columns: 1fr;
  }
}
aside.note {
  background: var(--paper-2);
  border-top: 3px solid var(--gold);
  padding: 24px 26px;
  display: grid;
  gap: 12px;
  font-size: 1rem;
}
aside.note h3 {
  font-size: 1.25rem;
}
blockquote {
  margin: 0;
  padding-left: 20px;
  border-left: 2px solid var(--saffron);
  font-family: var(--display);
  font-size: 1.45rem;
  line-height: 1.35;
}
blockquote cite {
  display: block;
  margin-top: 10px;
  font-family: var(--label);
  font-size: 0.78rem;
  font-style: normal;
  color: var(--ink-soft);
  letter-spacing: 0.05em;
}

/* Sramana sect flip cards */
.sects {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-top: 28px;
  max-width: var(--measure);
}
.flip {
  perspective: 900px;
  border: 0;
  background: none;
  padding: 0;
  cursor: pointer;
  text-align: left;
  min-height: 150px;
}
.flip .in {
  position: relative;
  display: grid;
  height: 100%;
  transition: transform 0.7s var(--ease);
  transform-style: preserve-3d;
}
.flip[aria-pressed="true"] .in {
  transform: rotateY(180deg);
}
.flip .f,
.flip .b {
  grid-area: 1/1;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  padding: 16px;
  border: 1px solid var(--rule);
  background: var(--chip);
  display: grid;
  gap: 6px;
  align-content: start;
}
.flip .f b {
  font-family: var(--display);
  font-weight: 400;
  font-size: 1.25rem;
}
.flip .f span,
.flip .b span {
  font-family: var(--label);
  font-size: 0.7rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--saffron);
}
.flip .b {
  transform: rotateY(180deg);
  background: var(--ink);
  color: var(--paper);
  border-color: var(--ink);
  font-size: 0.92rem;
  line-height: 1.45;
}
.flip:hover .f {
  border-color: var(--saffron);
}
@media (max-width: 600px) {
  .sects {
    grid-template-columns: 1fr;
  }
  .flip {
    min-height: 120px;
  }
}

/* pilgrimage */
.route {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  position: relative;
}
.route .line {
  position: absolute;
  top: 27px;
  left: 28px;
  right: 28px;
  height: 0;
  border-top: 2px dotted var(--saffron);
}
.route .walker {
  position: absolute;
  top: -6px;
  width: 10px;
  height: 10px;
  margin-left: -5px;
  border-radius: 50%;
  background: var(--saffron);
  box-shadow: 0 0 0 6px color-mix(in srgb, var(--saffron) 25%, transparent);
  transition:
    left 1s var(--ease),
    top 1s var(--ease);
}
.route .st {
  position: relative;
}
.station {
  display: grid;
  gap: 8px;
  text-align: left;
  border: 0;
  background: none;
  padding: 0 18px 0 0;
  cursor: pointer;
  width: 100%;
}
.station .n {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: 2px solid var(--saffron);
  background: var(--paper);
  display: grid;
  place-items: center;
  font-family: var(--display);
  font-size: 1.4rem;
  color: var(--saffron);
  transition:
    background 0.35s,
    color 0.35s,
    transform 0.35s var(--ease);
}
.station:hover .n {
  transform: scale(1.08);
}
.station[aria-selected="true"] .n {
  background: var(--saffron);
  color: var(--paper);
}
.station .place {
  font-family: var(--display);
  font-size: 1.5rem;
  margin-top: 6px;
}
.station .where {
  font-family: var(--label);
  font-size: 0.75rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-soft);
}
.station p {
  font-size: 0.98rem;
}
.stop {
  margin-top: 32px;
  background: var(--paper-2);
  border-left: 3px solid var(--saffron);
  padding: 24px 28px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 24px;
}
.stop h3 {
  font-size: 1.6rem;
}
.stop .k {
  font-family: var(--label);
  font-size: 0.72rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-soft);
  margin-bottom: 4px;
}
.stop.swap > * {
  animation: swapin 0.55s var(--ease) both;
}
.stop.swap > *:nth-child(2) {
  animation-delay: 0.08s;
}
@keyframes swapin {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
}
@media (max-width: 820px) {
  .route {
    grid-template-columns: 1fr;
    gap: 28px;
  }
  .route .line {
    top: 28px;
    bottom: 28px;
    left: 27px;
    right: auto;
    border-top: 0;
    border-left: 2px dotted var(--saffron);
  }
  .route .walker {
    left: -6px !important;
    margin-left: 0;
    margin-top: -5px;
  }
  .station {
    grid-template-columns: 56px minmax(0, 1fr);
    column-gap: 18px;
    padding-right: 0;
  }
  .station > *:not(.n) {
    grid-column: 2;
  }
  .station .n {
    grid-row: 1 / span 4;
  }
  .station .place {
    margin-top: 0;
  }
  .stop {
    grid-template-columns: 1fr;
  }
}
.life {
  margin-top: clamp(40px, 6vw, 64px);
}

/* Four truths */
.truths {
  margin-top: clamp(48px, 7vw, 80px);
}
.tabs {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  border-bottom: 1px solid var(--rule);
  position: relative;
}
.tabs button {
  border: 0;
  background: none;
  padding: 14px 10px 16px;
  text-align: left;
  cursor: pointer;
  display: grid;
  gap: 2px;
}
.tabs button b {
  font-family: var(--display);
  font-weight: 400;
  font-size: 1.25rem;
  transition: color 0.3s;
}
.tabs button span {
  font-family: var(--label);
  font-size: 0.7rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-soft);
}
.tabs button[aria-selected="true"] b {
  color: var(--saffron);
}
.tabs .bar {
  position: absolute;
  bottom: -1px;
  height: 3px;
  background: var(--saffron);
  transition:
    left 0.5s var(--ease),
    width 0.5s var(--ease);
}
.tpanel {
  padding-top: 24px;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 28px;
  align-items: start;
  max-width: 820px;
}
.tpanel .big {
  font-family: var(--display);
  font-size: clamp(3.5rem, 8vw, 6rem);
  line-height: 0.9;
  color: var(--saffron);
  font-variant-numeric: tabular-nums;
}
.tpanel.swap > * {
  animation: swapin 0.5s var(--ease) both;
}
@media (max-width: 600px) {
  .tabs {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .tpanel {
    grid-template-columns: 1fr;
    gap: 8px;
  }
}

/* Eightfold path */
.path {
  margin-top: clamp(48px, 7vw, 80px);
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: clamp(24px, 5vw, 56px);
  align-items: center;
}
.path-wheel {
  max-width: 440px;
  width: 100%;
  justify-self: center;
}
.path-wheel svg {
  width: 100%;
  height: auto;
  display: block;
  overflow: visible;
}
#pw-rot {
  transition: transform 1.1s var(--ease);
  transform-origin: 200px 200px;
}
.spoke {
  cursor: pointer;
}
.spoke line {
  stroke-width: 6;
  stroke-linecap: round;
  transition: stroke-width 0.3s;
}
.spoke circle {
  transition: r 0.35s var(--ease);
}
.spoke:hover circle,
.spoke.on circle {
  r: 26px;
}
.spoke text {
  font-family: var(--display);
  font-size: 20px;
  text-anchor: middle;
  dominant-baseline: central;
  pointer-events: none;
  transition: transform 1.1s var(--ease);
}
.spoke:focus {
  outline: none;
}
.spoke:focus-visible circle {
  stroke: var(--ink);
  stroke-width: 3;
}
.pdetail {
  display: grid;
  gap: 12px;
}
.pdetail .grp {
  font-family: var(--label);
  font-size: 0.74rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}
.pdetail h3 {
  font-size: clamp(1.8rem, 3.4vw, 2.4rem);
}
.pdetail .pali {
  font-style: italic;
  color: var(--ink-soft);
}
.pdetail.swap > * {
  animation: swapin 0.5s var(--ease) both;
}
.pdots {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 8px;
}
.pdots button {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 1px solid var(--rule);
  background: var(--chip);
  cursor: pointer;
  font-family: var(--display);
  transition: transform 0.25s var(--ease);
}
.pdots button:hover {
  transform: translateY(-2px);
}
.pdots button[aria-pressed="true"] {
  background: var(--ink);
  color: var(--paper);
  border-color: var(--ink);
}
.pkey {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 18px;
  font-family: var(--label);
  font-size: 0.78rem;
  color: var(--ink-soft);
}
.pkey i {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  margin-right: 6px;
}
@media (max-width: 820px) {
  .path {
    grid-template-columns: 1fr;
  }
}

/* vehicles */
.raft {
  width: 100%;
  height: 180px;
  display: block;
  border: 1px solid var(--rule);
  background: var(--paper-2);
  margin-bottom: clamp(28px, 4vw, 40px);
}
.vehicles {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
}
.vehicle {
  background: var(--paper);
  border: 1px solid var(--rule);
  padding: 30px 26px 32px;
  display: grid;
  gap: 14px;
  align-content: start;
  transition:
    transform 0.45s var(--ease),
    box-shadow 0.45s,
    border-color 0.3s;
  transform-style: preserve-3d;
  will-change: transform;
}
.vehicle:hover {
  border-color: var(--c);
  box-shadow: 0 18px 40px -24px color-mix(in srgb, var(--c) 70%, transparent);
}
.vehicle .sw {
  height: 6px;
  width: 36px;
  background: var(--c);
  transition: width 0.6s var(--ease);
}
.vehicle:hover .sw {
  width: 100%;
}
.vehicle h3 {
  font-size: 1.9rem;
}
.vehicle .gloss {
  font-family: var(--label);
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-soft);
}
.vehicle dl {
  margin: 6px 0 0;
  display: grid;
  gap: 12px;
  font-size: 0.97rem;
}
.vehicle dt {
  font-family: var(--label);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-soft);
}
.vehicle dd {
  margin: 2px 0 0;
}
@media (max-width: 900px) {
  .vehicles {
    grid-template-columns: 1fr;
  }
}
.v-thera {
  --c: var(--saffron);
}
.v-maha {
  --c: var(--lacquer);
}
.v-vajra {
  --c: var(--lapis);
}

/* spread chart */
.spread {
  --lab: 150px;
  --chart-min: 640px;
  border: 1px solid var(--rule);
  background: var(--paper-2);
  padding: 24px clamp(16px, 3vw, 32px) 22px;
  margin: 0;
}
.player {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px 20px;
  margin-bottom: 18px;
}
.play {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  border: 1px solid var(--ink);
  background: var(--ink);
  color: var(--paper);
  border-radius: 999px;
  padding: 9px 18px 9px 14px;
  font-family: var(--label);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.2s;
}
.play:hover {
  transform: scale(1.03);
}
.play svg {
  width: 14px;
  height: 14px;
}
.year {
  font-family: var(--display);
  font-size: 2rem;
  min-width: 7ch;
  font-variant-numeric: tabular-nums;
  color: var(--saffron);
}
.player input {
  flex: 1 1 220px;
  accent-color: var(--saffron);
  min-width: 0;
}
.chart-scroll {
  overflow-x: auto;
}
.chart {
  min-width: var(--chart-min);
  display: grid;
  gap: 4px;
}
.row {
  display: grid;
  grid-template-columns: var(--lab) minmax(0, 1fr);
  align-items: center;
  min-height: 34px;
  border-radius: 4px;
  transition: background 0.25s;
}
.row:hover {
  background: var(--chip);
}
.row .lab {
  font-family: var(--label);
  font-size: 0.85rem;
  font-weight: 500;
  padding-left: 6px;
}
.row .lab small {
  display: block;
  font-weight: 400;
  color: var(--ink-soft);
  font-size: 0.72rem;
}
.track {
  position: relative;
  height: 34px;
}
.track::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 50%;
  border-top: 1px solid var(--rule);
}
.bar {
  position: absolute;
  top: 50%;
  height: 3px;
  transform: translateY(-50%);
  opacity: 0.6;
  transition: width 0.2s linear;
}
.dot {
  position: absolute;
  top: 50%;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  transform: translate(-50%, -50%);
  border: 2px solid var(--paper-2);
  transition:
    transform 0.5s var(--ease),
    opacity 0.5s;
}
.row.off .dot {
  transform: translate(-50%, -50%) scale(0.45);
  opacity: 0.3;
}
.row.off .yr {
  opacity: 0.35;
}
.row.new .dot {
  animation: ping 0.9s var(--ease);
}
@keyframes ping {
  0% {
    box-shadow: 0 0 0 0 color-mix(in srgb, var(--saffron) 70%, transparent);
  }
  100% {
    box-shadow: 0 0 0 18px transparent;
  }
}
.yr {
  position: absolute;
  top: 50%;
  transform: translate(12px, -50%);
  font-family: var(--label);
  font-size: 0.72rem;
  color: var(--ink-soft);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
  transition: opacity 0.4s;
}
.now {
  position: absolute;
  top: 0;
  bottom: 28px;
  width: 0;
  border-left: 1px dashed var(--saffron);
  margin-left: var(--lab);
  pointer-events: none;
  transition: left 0.2s linear;
}
.chart {
  position: relative;
}
.axis {
  position: relative;
  height: 28px;
  margin-left: var(--lab);
  border-top: 1px solid var(--ink-soft);
}
.axis span {
  position: absolute;
  top: 6px;
  transform: translateX(-50%);
  font-family: var(--label);
  font-size: 0.7rem;
  color: var(--ink-soft);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.axis span::before {
  content: "";
  position: absolute;
  left: 50%;
  top: -6px;
  height: 5px;
  border-left: 1px solid var(--ink-soft);
}
.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 22px;
  margin-top: 14px;
  font-family: var(--label);
  font-size: 0.8rem;
  color: var(--ink-soft);
}
.legend i {
  display: inline-block;
  width: 11px;
  height: 11px;
  border-radius: 50%;
  margin-right: 7px;
  vertical-align: -1px;
}
.c-early {
  background: var(--gold);
}
.c-thera {
  background: var(--saffron);
}
.c-maha {
  background: var(--lacquer);
}
.c-vajra {
  background: var(--lapis);
}
.event {
  margin-top: 14px;
  min-height: 3.2em;
  font-size: 0.98rem;
  color: var(--ink-soft);
  border-top: 1px solid var(--rule);
  padding-top: 12px;
}
.event b {
  color: var(--ink);
  font-weight: 600;
}
.spread-notes {
  margin-top: clamp(32px, 5vw, 48px);
}

/* timeline */
.tools {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 20px;
  align-items: center;
  margin-bottom: 28px;
}
.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.filters button,
.chipbtn {
  font-family: var(--label);
  font-size: 0.82rem;
  font-weight: 500;
  padding: 8px 16px;
  border: 1px solid var(--rule);
  background: var(--chip);
  color: var(--ink);
  border-radius: 999px;
  cursor: pointer;
  transition:
    background 0.25s,
    color 0.25s,
    border-color 0.25s;
}
.filters button:hover,
.chipbtn:hover {
  border-color: var(--saffron);
}
.filters button[aria-pressed="true"],
.chipbtn[aria-pressed="true"] {
  background: var(--ink);
  color: var(--paper);
  border-color: var(--ink);
}
.search {
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--rule);
  background: var(--chip);
  border-radius: 999px;
  padding: 7px 14px;
  flex: 1 1 220px;
  max-width: 340px;
}
.search input {
  border: 0;
  background: none;
  outline: none;
  font: inherit;
  font-size: 0.92rem;
  color: var(--ink);
  width: 100%;
  min-width: 0;
}
.search svg {
  width: 16px;
  height: 16px;
  flex: none;
  color: var(--ink-soft);
}
.count {
  font-family: var(--label);
  font-size: 0.8rem;
  color: var(--ink-soft);
}
.tl {
  list-style: none;
  margin: 0;
  padding: 0 0 0 28px;
  display: grid;
  max-width: 880px;
  position: relative;
}
.tl::before {
  content: "";
  position: absolute;
  left: 5px;
  top: 8px;
  bottom: 8px;
  width: 2px;
  background: var(--rule);
}
.tl .fill {
  position: absolute;
  left: 5px;
  top: 8px;
  width: 2px;
  background: var(--saffron);
  height: 0;
}
.tl li {
  position: relative;
  display: grid;
  grid-template-columns: 150px minmax(0, 1fr);
  gap: 24px;
  padding-block: 20px;
  border-top: 1px solid var(--rule);
  animation: swapin 0.5s var(--ease) both;
}
.tl li::before {
  content: "";
  position: absolute;
  left: -28px;
  top: 28px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--paper);
  border: 2px solid var(--saffron);
  transition:
    background 0.3s,
    transform 0.3s var(--ease);
}
.tl li:hover::before {
  background: var(--saffron);
  transform: scale(1.3);
}
.tl .date {
  font-family: var(--display);
  font-size: 1.35rem;
  color: var(--saffron);
  font-variant-numeric: tabular-nums;
  line-height: 1.2;
}
.tl .era {
  display: block;
  font-family: var(--label);
  font-size: 0.68rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-soft);
  margin-top: 6px;
}
.tl h3 {
  font-family: var(--body);
  font-weight: 600;
  font-size: 1.08rem;
  line-height: 1.4;
  margin-bottom: 4px;
}
.tl p {
  color: var(--ink-soft);
  font-size: 0.98rem;
}
.tl mark {
  background: color-mix(in srgb, var(--saffron) 30%, transparent);
  color: inherit;
  border-radius: 2px;
}
.empty {
  padding: 24px 0;
  color: var(--ink-soft);
}
@media (max-width: 600px) {
  .tl li {
    grid-template-columns: 1fr;
    gap: 6px;
  }
}

/* west */
.west-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: clamp(20px, 3vw, 36px);
  margin-top: clamp(36px, 5vw, 56px);
}
.west-grid article {
  display: grid;
  gap: 10px;
  align-content: start;
  border-top: 1px solid var(--ink);
  padding-top: 16px;
  position: relative;
}
.west-grid article::before {
  content: "";
  position: absolute;
  top: -1px;
  left: 0;
  height: 3px;
  width: 0;
  background: var(--saffron);
  transition: width 0.6s var(--ease);
}
.west-grid article:hover::before {
  width: 100%;
}
.west-grid h3 {
  font-size: 1.3rem;
}
.west-grid p {
  font-size: 0.98rem;
  color: var(--ink-soft);
}
@media (max-width: 820px) {
  .west-grid {
    grid-template-columns: 1fr;
  }
}
.stat-line {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 48px;
  margin-top: 40px;
  padding-top: 24px;
  border-top: 1px solid var(--rule);
}
.stat-line div {
  font-family: var(--label);
  font-size: 0.8rem;
  color: var(--ink-soft);
  max-width: 22ch;
}
.stat-line b {
  display: block;
  font-family: var(--display);
  font-weight: 400;
  font-size: 2.2rem;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}
.quote-words span {
  transition: color 0.5s;
}

/* glossary */
.gloss-tools {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 16px;
  align-items: center;
  margin-bottom: 24px;
}
.gloss-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 0 36px;
  margin: 0;
}
.gloss-grid > div {
  padding-block: 16px;
  border-top: 1px solid var(--rule);
  transition: opacity 0.3s;
}
.gloss-grid dt {
  font-family: var(--display);
  font-size: 1.3rem;
}
.gloss-grid dt small {
  font-family: var(--label);
  font-size: 0.7rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--saffron);
  margin-left: 8px;
}
.gloss-grid dd {
  margin: 4px 0 0;
  font-size: 0.96rem;
  color: var(--ink-soft);
  transition:
    filter 0.45s,
    opacity 0.45s;
}
.quiz .gloss-grid > div {
  cursor: pointer;
}
.quiz .gloss-grid > div:not(.shown) dd {
  filter: blur(6px);
  opacity: 0.5;
  user-select: none;
}
.quiz .gloss-grid > div:not(.shown):hover dd {
  opacity: 0.7;
}
.score {
  font-family: var(--label);
  font-size: 0.8rem;
  color: var(--ink-soft);
}

/* back to top */
.top {
  position: fixed;
  right: calc(18px + env(safe-area-inset-right, 0px));
  bottom: calc(18px + env(safe-area-inset-bottom, 0px));
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: 1px solid var(--rule);
  background: var(--paper);
  display: grid;
  place-items: center;
  cursor: pointer;
  z-index: 8;
  transition:
    opacity 0.4s,
    transform 0.4s var(--ease);
  box-shadow: 0 8px 24px -12px rgba(0, 0, 0, 0.35);
}
.top.hide {
  opacity: 0;
  transform: translateY(16px);
  pointer-events: none;
}
.top svg {
  width: 30px;
  height: 30px;
  color: var(--saffron);
}

footer {
  padding-block: 56px 64px;
  font-size: 0.92rem;
  color: var(--ink-soft);
}
footer .wrap {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr);
  gap: 40px;
}
footer .brand {
  font-size: 1.6rem;
}
footer ul {
  margin: 10px 0 0;
  padding-left: 18px;
  display: grid;
  gap: 4px;
}
@media (max-width: 760px) {
  footer .wrap {
    grid-template-columns: 1fr;
  }
}

/* small screens */
@media (max-width: 820px) {
  .spread {
    --lab: 120px;
    --chart-min: 560px;
  }
}
@media (max-width: 600px) {
  body {
    font-size: 1rem;
  }
  .head p {
    font-size: 1.05rem;
  }
  .hero .lede {
    font-size: 1.1rem;
  }
  .hero .meta {
    gap: 12px 22px;
  }
  .hero .meta b {
    font-size: 1.35rem;
  }
  aside.note {
    padding: 20px;
  }
  blockquote {
    font-size: 1.25rem;
  }
  .stop {
    padding: 20px;
    gap: 16px;
  }
  .stop h3 {
    font-size: 1.4rem;
  }
  .tabs button {
    padding: 12px 8px 14px;
  }
  .tabs button b {
    font-size: 1.1rem;
  }
  .tpanel .big {
    font-size: 3rem;
  }
  .raft {
    height: 150px;
  }
  .vehicle {
    padding: 24px 20px 26px;
  }
  .vehicle h3 {
    font-size: 1.6rem;
  }
  .spread {
    --lab: 96px;
    --chart-min: 480px;
    padding: 18px 14px;
  }
  .row .lab {
    font-size: 0.78rem;
    padding-left: 2px;
  }
  .row .lab small {
    font-size: 0.66rem;
  }
  .axis span:nth-child(even) {
    display: none;
  }
  .year {
    font-size: 1.6rem;
  }
  .player input {
    flex-basis: 100%;
  }
  .tools .search,
  .gloss-tools .search {
    flex-basis: 100%;
    max-width: none;
  }
  .filters button,
  .chipbtn {
    padding: 7px 13px;
  }
  .tl {
    padding-left: 24px;
  }
  .tl li::before {
    left: -24px;
  }
  .tl .date {
    font-size: 1.2rem;
  }
  .stat-line {
    gap: 20px 32px;
  }
  .stat-line b {
    font-size: 1.8rem;
  }
  .gloss-grid {
    grid-template-columns: 1fr;
  }
  footer {
    padding-block: 40px 88px;
  }
  .top {
    width: 44px;
    height: 44px;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-delay: 0s !important;
    transition-duration: 0.01ms !important;
  }
  .rv,
  .head h2 {
    animation: none !important;
  }
  .head h2 {
    color: var(--ink);
    background: none;
  }
}
