/* LOCUS Lab — public site.
   Bricolage Grotesque speaks (headlines, names, numbers); Hanken Grotesk explains (text, UI).
   Colour lives in illustrations and soft tinted surfaces; the page itself stays white and calm. */

body {
  font-family: var(--f-text);
  font-size: 1.125rem;
  line-height: 1.65;
  font-feature-settings: "kern", "liga", "calt";
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}
main { flex: 1 0 auto; }
h1, h2, h3, h4 { font-family: var(--f-display); font-weight: 650; line-height: 1.05; letter-spacing: -0.02em; margin: 0; color: var(--ink); font-variation-settings: "opsz" 72; }
p { margin: 0; }
.muted { color: var(--muted); }
.wrap { width: 100%; max-width: calc(var(--page) + 2 * var(--gutter)); margin: 0 auto; padding-inline: var(--gutter); }

.tint-lilac { background: var(--tint-lilac); } .tint-sun { background: var(--tint-sun); } .tint-leaf { background: var(--tint-leaf); }
.tint-sky { background: var(--tint-sky); } .tint-pink { background: var(--tint-pink); }

/* ------------------------------------------------------------------ small parts */

.button {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.5em;
  font: 600 1rem/1.2 var(--f-text); padding: 0.95em 1.45em; border-radius: 999px; border: 0;
  background: var(--ink); color: var(--bg); text-decoration: none; cursor: pointer;
  transition: background-color 180ms var(--ease), transform 180ms var(--ease);
}
.button:hover { background: var(--accent); color: #fff; transform: translateY(-1px); }
.button--soft { background: var(--surface-2); color: var(--ink); }
.button--soft:hover { background: var(--accent-wash); color: var(--accent-ink); }
.button--light { background: #fff; color: #1b1838; }
.button--light:hover { background: var(--sun); color: #1b1838; }

.chip {
  display: inline-flex; align-items: center; font: 600 0.8rem/1 var(--f-text); letter-spacing: 0.01em;
  padding: 0.45em 0.8em; border-radius: 999px; background: var(--surface-2); color: var(--ink); text-decoration: none; white-space: nowrap;
}
.chip--lilac { background: var(--tint-lilac); } .chip--sun { background: var(--tint-sun); } .chip--leaf { background: var(--tint-leaf); }
.chip--sky { background: var(--tint-sky); } .chip--pink { background: var(--tint-pink); }
a.chip:hover { box-shadow: inset 0 0 0 1.5px var(--ink); }

.link-pills { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 0.5rem; }
.link-pills a {
  display: inline-block; font: 600 0.95rem/1 var(--f-text); padding: 0.7em 1.1em; border-radius: 999px;
  border: 1.5px solid var(--line-2); color: var(--ink); text-decoration: none; transition: border-color 160ms var(--ease), color 160ms var(--ease);
}
.link-pills a:hover { border-color: var(--accent); color: var(--accent-ink); }

.more-link { font-weight: 600; color: var(--ink); text-decoration-color: var(--line-2); white-space: nowrap; }
.more-link:hover { color: var(--accent-ink); text-decoration-color: currentColor; }

.empty { padding: 3rem 0; color: var(--muted); display: grid; gap: 1rem; justify-items: start; }
.placeholder {
  padding: 1rem 1.25rem; border: 1.5px dashed var(--sun); border-radius: var(--r-m); background: var(--sun-wash);
  font-size: 0.95rem; display: flex; flex-wrap: wrap; gap: 0.3rem 1rem;
}
.placeholder a { font-weight: 600; }

/* ------------------------------------------------------------------ header */

.site-header {
  position: sticky; top: 0; z-index: 30;
  background: color-mix(in srgb, var(--bg) 86%, transparent);
  backdrop-filter: saturate(1.4) blur(14px); -webkit-backdrop-filter: saturate(1.4) blur(14px);
  border-bottom: 1px solid transparent; transition: border-color 200ms;
}
.site-header__inner { max-width: calc(var(--page) + 2 * var(--gutter)); margin: 0 auto; padding: 0 var(--gutter); height: 72px; display: flex; align-items: center; gap: 1rem; }
.brand { display: inline-flex; align-items: center; gap: 0.6rem; color: var(--ink); text-decoration: none; margin-right: auto; }
.brand__logo { height: 34px; width: auto; }
.brand__word { font-family: var(--f-display); font-weight: 800; font-size: 1.5rem; letter-spacing: -0.035em; line-height: 1; }
.site-nav { display: flex; gap: 0.15rem; }
.site-nav a { font-weight: 600; font-size: 1rem; color: var(--ink-2); text-decoration: none; padding: 0.55rem 1rem; border-radius: 999px; transition: background-color 160ms, color 160ms; }
.site-nav a:hover { background: var(--surface-2); color: var(--ink); }
.site-nav a[aria-current="page"] { background: var(--accent-wash); color: var(--accent-ink); }
.theme-toggle { flex: none; width: 42px; height: 42px; border-radius: 50%; border: 0; background: none; color: var(--ink-2); display: grid; place-items: center; cursor: pointer; }
.theme-toggle:hover { background: var(--surface-2); color: var(--ink); }
.theme-toggle__moon { display: none; }
:root[data-theme="dark"] .theme-toggle__moon { display: block; }
:root[data-theme="dark"] .theme-toggle__sun { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-toggle__moon { display: block; }
  :root:not([data-theme="light"]) .theme-toggle__sun { display: none; }
}
@media (max-width: 560px) {
  .site-header__inner { height: 62px; gap: 0.25rem; }
  .brand__word { font-size: 1.3rem; }
  .site-nav a { padding: 0.5rem 0.7rem; font-size: 0.95rem; }
}

/* language menu: a globe and the chosen language; the panel lists every language by its own name */
.lang-menu { position: relative; flex: none; }
.lang-menu__button {
  list-style: none; display: inline-flex; align-items: center; gap: 0.4rem; height: 42px; padding: 0 0.8rem 0 0.7rem;
  border-radius: 999px; color: var(--ink-2); font: 600 0.92rem/1 var(--f-text); cursor: pointer; user-select: none;
  transition: background-color 160ms, color 160ms;
}
.lang-menu__button::-webkit-details-marker { display: none; }
.lang-menu__button:hover, .lang-menu[open] .lang-menu__button { background: var(--surface-2); color: var(--ink); }
.lang-menu__panel {
  position: absolute; right: 0; top: calc(100% + 10px); z-index: 50; width: min(22rem, calc(100vw - 2 * var(--gutter)));
  padding: 0.6rem; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-m);
  box-shadow: 0 12px 32px -12px rgb(27 24 56 / 0.25); transform-origin: top right; animation: account-in 160ms var(--ease);
}
.lang-menu__title { padding: 0.35rem 0.6rem 0.5rem; color: var(--muted); font-size: 0.8rem; font-weight: 600; }
.lang-menu__list { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 1px 0.25rem; }
.lang-menu__list a {
  display: block; padding: 0.45rem 0.6rem; border-radius: var(--r-s); color: var(--ink); text-decoration: none;
  font-size: 0.95rem; line-height: 1.3; font-family: var(--f-text);
}
.lang-menu__list a:hover { background: var(--surface-2); }
.lang-menu__list a[aria-current] { background: var(--accent-wash); color: var(--accent-ink); font-weight: 600; }
@media (max-width: 720px) {
  /* phones: just the globe, and the list spans the screen under the header */
  .lang-menu__current { display: none; }
  .lang-menu__button { width: 40px; height: 40px; padding: 0; justify-content: center; }
  .lang-menu__panel { position: fixed; top: 66px; left: var(--gutter); right: var(--gutter); width: auto; }
}
@media (max-width: 420px) {
  .brand__word { white-space: nowrap; font-size: 1.2rem; }
  .site-nav a { padding: 0.45rem 0.55rem; font-size: 0.92rem; }
  .theme-toggle { width: 38px; height: 38px; }
}

/* signed-in editors: a small account menu in the header, and edit links beside the content.
   Nothing else about the page changes when you're signed in. */
.account { position: relative; }
.account__button {
  list-style: none; width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; cursor: pointer;
  background: var(--violet); color: #fff; font: 700 0.8rem/1 var(--f-text); letter-spacing: 0.02em; user-select: none;
  transition: transform 180ms var(--spring), box-shadow 180ms;
}
.account__button::-webkit-details-marker { display: none; }
.account__button:hover { transform: scale(1.06); }
.account[open] .account__button { box-shadow: 0 0 0 3px var(--accent-wash); }
.account__menu {
  position: absolute; right: 0; top: calc(100% + 10px); z-index: 50; width: 15.5rem; padding: 0.5rem;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-m);
  box-shadow: 0 12px 32px -12px rgb(27 24 56 / 0.25); font-size: 0.95rem;
  transform-origin: top right; animation: account-in 160ms var(--ease);
}
@keyframes account-in { from { opacity: 0; transform: translateY(-4px) scale(0.98); } }
.account__who { padding: 0.55rem 0.7rem 0.6rem; color: var(--muted); font-size: 0.85rem; border-bottom: 1px solid var(--line); margin-bottom: 0.3rem; }
.account__who strong { color: var(--ink); font-weight: 600; }
.account__label { padding: 0.5rem 0.7rem 0.15rem; color: var(--muted); font-size: 0.78rem; font-weight: 600; }
.account__group { display: grid; }
.account__group--rule { border-top: 1px solid var(--line); margin-top: 0.3rem; padding-top: 0.3rem; }
.account__group a, .account__item {
  display: block; width: 100%; text-align: left; padding: 0.5rem 0.7rem; border-radius: var(--r-s);
  color: var(--ink); text-decoration: none; font: 500 0.95rem/1.3 var(--f-text); background: none; border: 0; cursor: pointer;
}
.account__group a:hover, .account__item:hover { background: var(--surface-2); }
.account__group form { margin: 0; }

.edit-link {
  display: inline-flex; align-items: center; gap: 0.35em; padding: 0.4em 0.8em; border-radius: 999px;
  background: var(--accent-wash); color: var(--accent-ink); font: 600 0.82rem/1 var(--f-text); text-decoration: none;
}
.edit-link:hover { background: var(--accent); color: #fff; }
@media (max-width: 480px) {
  /* room is tight on phones: the theme switch moves into the account menu */
  .site-header--signed-in .theme-toggle { display: none; }
}

/* ------------------------------------------------------------------ hero */

.hero { padding-top: clamp(32px, 4.5vw, 72px); }
.hero__text { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); column-gap: 24px; align-items: end; }
.hero__title {
  grid-column: 1 / span 7; font-size: clamp(3rem, 6.6vw, 6.2rem); font-weight: 650; line-height: 0.95;
  letter-spacing: -0.045em; font-variation-settings: "opsz" 96; text-wrap: balance;
}
.hero__side { grid-column: 8 / -1; display: grid; gap: 1.4rem; padding-bottom: 0.6rem; padding-left: clamp(0px, 2vw, 32px); }
.hero__intro { font-size: 1.2rem; line-height: 1.55; color: var(--ink-2); }
.hero__actions { display: flex; flex-wrap: wrap; gap: 0.6rem; }
/* the name lockup: each initial of LOCUS in its own shape, unfolding into the full name */
.acronym {
  grid-column: 1 / -1; margin: 0 0 clamp(24px, 3.2vw, 44px);
  font-family: var(--f-display); font-weight: 500; font-size: clamp(1.25rem, 2.4vw, 2.05rem); line-height: 1.25;
  letter-spacing: -0.015em; color: var(--ink-2); font-variation-settings: "opsz" 48;
}
.acronym__visual { display: flex; flex-wrap: wrap; align-items: center; gap: 0.4em 0.32em; }
.acronym__word { display: inline-flex; align-items: center; }
.acronym__ini {
  display: inline-grid; place-items: center; width: 1.36em; height: 1.36em; margin-right: 0.07em; flex: none;
  font-weight: 750; text-transform: uppercase; line-height: 1; color: #1b1838;
  transition: transform 320ms var(--spring);
}
.acronym__ini--1 { background: var(--violet); color: #fff; border-radius: 0.32em; }
.acronym__ini--2 { background: var(--sun); border-radius: 50%; }
.acronym__ini--3 { background: var(--leaf); border-radius: 0.68em 0.68em 0.16em 0.16em; }
.acronym__ini--4 { background: var(--sky); border-radius: 0.16em 0.16em 0.68em 0.68em; }
.acronym__ini--5 { background: var(--coral); border-radius: 0.68em 0.16em; }
.acronym__word:hover .acronym__ini { transform: rotate(-8deg) scale(1.06); }
.acronym__fold { display: inline-grid; grid-template-columns: 1fr; }
.acronym__fold > span { min-width: 0; overflow: hidden; white-space: nowrap; padding-block: 0.1em; }
.acronym__fold--join { color: var(--muted); }
.acronym--plain { font-weight: 600; color: var(--ink); }
@keyframes acronym-pop { from { transform: scale(0.3) rotate(-24deg); opacity: 0; } }
@keyframes acronym-fold { from { grid-template-columns: 0fr; } }
.js-motion .acronym__ini { animation: acronym-pop 560ms var(--spring) backwards; animation-delay: calc(var(--i) * 90ms + 150ms); }
.js-motion .acronym__fold { animation: acronym-fold 1100ms var(--ease) backwards; animation-delay: calc(var(--i) * 70ms + 1050ms); }

/* the same initials wherever the full name appears in running text */
.fullname .ini { font-weight: 750; color: var(--accent-ink); }

.scene { position: relative; margin-top: clamp(24px, 3.5vw, 52px); height: clamp(280px, min(32vw, 100svh - 440px), 460px); }
.scene__canvas { width: 100%; height: 100%; touch-action: pan-y; }
.scene__hint {
  position: absolute; right: var(--gutter); bottom: 14px; font-size: 0.82rem; font-weight: 500; color: var(--ink-2);
  background: color-mix(in srgb, var(--bg) 80%, transparent); padding: 0.4em 0.85em; border-radius: 999px; pointer-events: none;
}
@media (max-width: 920px) {
  .hero__title, .hero__side { grid-column: 1 / -1; }
  .hero__side { margin-top: 1.5rem; max-width: 36rem; padding-left: 0; }
}
@media (hover: none) { .scene__hint { display: none; } }

/* ------------------------------------------------------------------ home sections */

.section { padding-top: clamp(80px, 10vw, 144px); }
.section--last, .page-home main > .section:last-child { padding-bottom: clamp(80px, 10vw, 144px); }
.section__head { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; margin-bottom: clamp(24px, 3vw, 40px); }
.section__title { font-size: clamp(2.2rem, 4.2vw, 3.5rem); letter-spacing: -0.035em; font-variation-settings: "opsz" 96; }

.definition { padding-top: clamp(64px, 8vw, 112px); }
.definition__card {
  display: grid; grid-template-columns: minmax(0, 15rem) minmax(0, 1fr); gap: clamp(24px, 5vw, 72px); align-items: center;
  background: var(--tint-sun); border-radius: var(--r-l); padding: clamp(28px, 5vw, 64px);
}
.definition__art .art { width: 100%; height: auto; }
.definition__term { font-family: var(--f-display); font-weight: 700; font-size: clamp(3rem, 6.5vw, 5.4rem); letter-spacing: -0.05em; line-height: 0.9; display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.2em 0.5em; font-variation-settings: "opsz" 96; }
.definition__plural { font-family: var(--f-text); font-weight: 500; font-size: 1.05rem; letter-spacing: 0; color: var(--ink-2); }
.definition__body { margin-top: 1.1rem; font-size: clamp(1.2rem, 1.8vw, 1.45rem); line-height: 1.55; max-width: 38em; }
@media (max-width: 720px) { .definition__card { grid-template-columns: 1fr; } .definition__art { max-width: 11rem; } }

.bento { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 20px; }
.bento__tile { grid-column: span 4; border-radius: var(--r-l); padding: clamp(20px, 2.4vw, 32px); display: flex; flex-direction: column; gap: 1.25rem; min-width: 0; overflow: hidden; }
.bento__tile--1 { grid-column: span 7; }
.bento__tile--2 { grid-column: span 5; }
.bento__tile--6 { grid-column: span 12; flex-direction: row-reverse; align-items: center; }
.bento__tile--6 .bento__art { flex: 0 0 min(46%, 30rem); }
.bento__art { display: grid; place-items: center; }
.bento__art .art { width: 100%; height: clamp(150px, 15vw, 210px); }
.bento__tile--1 .bento__art .art, .bento__tile--2 .bento__art .art { height: clamp(170px, 19vw, 260px); }
.bento__title { font-size: clamp(1.4rem, 1.9vw, 1.75rem); letter-spacing: -0.025em; margin-bottom: 0.45rem; }
.bento__text p { color: var(--ink-2); font-size: 1.02rem; line-height: 1.55; max-width: 32em; }
.bento__tile--6 .bento__text { flex: 1; }
@media (max-width: 1000px) {
  .bento__tile, .bento__tile--1, .bento__tile--2 { grid-column: span 6; }
  .bento__tile--6 { grid-column: span 12; }
}
@media (max-width: 640px) {
  .bento__tile, .bento__tile--1, .bento__tile--2, .bento__tile--6 { grid-column: span 12; }
  .bento__tile--6 { flex-direction: column; align-items: stretch; }
  .bento__tile--6 .bento__art { flex: none; }
}

.works { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: clamp(28px, 4vw, 48px) clamp(20px, 3vw, 40px); }
.works:has(> .work:only-child) { grid-template-columns: minmax(0, 1fr); }
.work { display: flex; flex-direction: column; gap: 1.4rem; }
.work__art { display: block; aspect-ratio: 16 / 10; border-radius: var(--r-l); overflow: hidden; background: var(--surface-2); }
.work__art .art, .work__art img { width: 100%; height: 100%; object-fit: cover; transition: transform 500ms var(--ease); }
.work__art:hover .art, .work__art:hover img { transform: scale(1.025); }
.work__meta { display: flex; flex-wrap: wrap; align-items: center; gap: 0.4rem 0.8rem; color: var(--muted); font-size: 0.95rem; margin-bottom: 0.75rem; }
.work__title { font-size: clamp(1.45rem, 2.2vw, 1.9rem); letter-spacing: -0.025em; line-height: 1.12; }
.work__title a { color: var(--ink); text-decoration: none; }
.work__title a:hover { color: var(--accent-ink); }
.work__authors { color: var(--muted); font-size: 0.95rem; margin-top: 0.6rem; }
.work__summary { color: var(--ink-2); margin: 0.75rem 0 1.1rem; max-width: 36em; }
@media (max-width: 760px) { .works { grid-template-columns: 1fr; } }

.bookshelf {
  display: grid; grid-template-columns: minmax(0, 4fr) minmax(0, 5fr) minmax(0, 3fr); gap: clamp(28px, 4vw, 56px);
  background: #1b1838; color: #f4f2ff; border-radius: var(--r-l); padding: clamp(28px, 5vw, 64px);
}
:root[data-theme="dark"] .bookshelf { background: var(--surface-2); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .bookshelf { background: var(--surface-2); } }
.bookshelf__title { color: inherit; font-size: clamp(2rem, 3.4vw, 2.9rem); letter-spacing: -0.035em; margin-bottom: 1rem; }
.bookshelf__intro p { color: #c9c6dd; margin-bottom: 1.6rem; max-width: 26em; }
.bookshelf__chapters { list-style: none; margin: 0; padding: 0; }
.bookshelf__chapters li + li { border-top: 1px solid rgb(255 255 255 / 0.12); }
.bookshelf__chapters a { display: grid; grid-template-columns: 3.4rem minmax(0, 1fr); align-items: baseline; column-gap: 0.5rem; padding: 0.9rem 0; color: inherit; text-decoration: none; }
.bookshelf__num { font-family: var(--f-display); font-weight: 700; font-size: 1.9rem; color: var(--sun); line-height: 1; }
.bookshelf__name { font-family: var(--f-display); font-weight: 600; font-size: 1.4rem; letter-spacing: -0.02em; line-height: 1.15; }
.bookshelf__chapters a:hover .bookshelf__name { text-decoration: underline; text-underline-offset: 0.18em; }
.bookshelf__count { grid-column: 2; color: #a3a0bc; font-size: 0.9rem; margin-top: 0.2rem; }
.bookshelf__label { font-weight: 600; color: #a3a0bc; font-size: 0.9rem; margin-bottom: 0.6rem; }
.bookshelf__notes ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.75rem; }
.bookshelf__notes a { color: inherit; font-weight: 500; text-decoration-color: rgb(255 255 255 / 0.3); }
.bookshelf__notes a:hover { text-decoration-color: var(--sun); }
@media (max-width: 1000px) { .bookshelf { grid-template-columns: 1fr 1fr; } .bookshelf__intro { grid-column: 1 / -1; } }
@media (max-width: 640px) { .bookshelf { grid-template-columns: 1fr; } }

.news { list-style: none; margin: 0; padding: 0; }
.news li + li .news__item { border-top: 1px solid var(--line); }
.news__item { display: grid; grid-template-columns: 11rem auto minmax(0, 1fr); align-items: center; gap: 0.5rem 1.4rem; padding: 1.1rem 0; text-decoration: none; color: var(--ink); }
.news__date { color: var(--muted); font-size: 0.95rem; font-variant-numeric: tabular-nums; }
.news__title { font-family: var(--f-display); font-weight: 600; font-size: 1.3rem; letter-spacing: -0.02em; }
.news__item:hover .news__title { color: var(--accent-ink); }
@media (max-width: 640px) { .news__item { grid-template-columns: auto 1fr; } .news__title { grid-column: 1 / -1; } }

/* ------------------------------------------------------------------ listing pages */

.page { padding-top: clamp(40px, 7vw, 96px); padding-bottom: clamp(80px, 10vw, 144px); }
.page-head { margin-bottom: clamp(32px, 4vw, 56px); }
.page-head__title { font-size: clamp(3.4rem, 8.5vw, 7rem); font-weight: 700; letter-spacing: -0.055em; line-height: 0.9; font-variation-settings: "opsz" 96; }
.page-head__lede { margin-top: 1.1rem; font-size: clamp(1.2rem, 1.9vw, 1.45rem); line-height: 1.5; color: var(--ink-2); max-width: 40rem; }
.page-head__lede.prose p + p { margin-top: 0.6em; }

.filters { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-bottom: clamp(28px, 3vw, 40px); }
.filters a { font-weight: 600; font-size: 0.95rem; text-decoration: none; color: var(--ink-2); padding: 0.6em 1.05em; border-radius: 999px; background: var(--surface-2); transition: background-color 160ms, color 160ms; }
.filters a:hover { color: var(--ink); background: var(--accent-wash); }
.filters a[aria-current="true"] { background: var(--ink); color: var(--bg); }
.filters a span { opacity: 0.55; margin-left: 0.45em; font-variant-numeric: tabular-nums; }
.filter-note { margin: -1rem 0 2rem; color: var(--muted); }

.cards { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 22rem), 1fr)); gap: clamp(32px, 4vw, 52px) clamp(20px, 2.4vw, 32px); }
.card { min-width: 0; }
.card__link { display: flex; flex-direction: column; gap: 1.1rem; color: var(--ink); text-decoration: none; height: 100%; }
.card__art { display: block; aspect-ratio: 16 / 10; border-radius: var(--r-m); overflow: hidden; background: var(--surface-2); }
.card__art .art, .card__art img { width: 100%; height: 100%; object-fit: cover; transition: transform 500ms var(--ease); }
.card__link:hover .card__art .art, .card__link:hover .card__art img { transform: scale(1.03); }
.card__body { display: flex; flex-direction: column; gap: 0.55rem; }
.card__meta { display: flex; align-items: center; flex-wrap: wrap; gap: 0.6rem; color: var(--muted); font-size: 0.9rem; }
.card__title { font-family: var(--f-display); font-weight: 600; font-size: 1.45rem; line-height: 1.15; letter-spacing: -0.022em; }
.card__link:hover .card__title { color: var(--accent-ink); }
.card__summary { color: var(--ink-2); font-size: 1rem; line-height: 1.55; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.card__venue { color: var(--muted); font-size: 0.9rem; font-style: italic; }
.card__tags { display: flex; flex-wrap: wrap; gap: 0.35rem; }
.card__tags span { font-size: 0.8rem; font-weight: 600; padding: 0.3em 0.7em; border-radius: 999px; background: var(--surface-2); color: var(--ink-2); }
.card--lead { grid-column: 1 / -1; }
.card--lead .card__link { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); align-items: center; gap: clamp(24px, 4vw, 56px); }
.card--lead .card__art { aspect-ratio: 16 / 9; border-radius: var(--r-l); }
.card--lead .card__title { font-size: clamp(1.9rem, 3.2vw, 2.8rem); letter-spacing: -0.035em; line-height: 1.05; }
.card--lead .card__summary { font-size: 1.12rem; -webkit-line-clamp: 4; }
.cards--notes .card__art { aspect-ratio: 16 / 7; }
@media (max-width: 760px) { .card--lead .card__link { grid-template-columns: 1fr; } }

.pagination { display: flex; justify-content: space-between; align-items: center; gap: 1rem; margin-top: 3.5rem; }
.pagination__status { color: var(--muted); font-size: 0.95rem; }

/* wiki index */
.handbook { margin-bottom: clamp(72px, 9vw, 128px); }
.handbook > .section__title { margin-bottom: clamp(24px, 3vw, 40px); }
.chapter__part { font-size: 0.85rem; font-weight: 600; color: var(--ink-2); }
.chapters { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 22rem), 1fr)); gap: 20px; }
.chapter { border-radius: var(--r-l); padding: clamp(22px, 2.4vw, 32px); display: flex; flex-direction: column; gap: 1rem; }
.chapter__main { display: grid; gap: 0.5rem; color: var(--ink); text-decoration: none; }
.chapter__num { font-family: var(--f-display); font-weight: 700; font-size: 3.2rem; line-height: 0.9; letter-spacing: -0.05em; color: var(--accent); }
.chapter__title { font-family: var(--f-display); font-weight: 650; font-size: 1.6rem; line-height: 1.1; letter-spacing: -0.025em; margin-top: 0.4rem; }
.chapter__main:hover .chapter__title { text-decoration: underline; text-underline-offset: 0.15em; text-decoration-thickness: 2px; }
.chapter__summary { color: var(--ink-2); font-size: 1rem; line-height: 1.55; }
.chapter__sections { list-style: none; margin: auto 0 0; padding: 0.9rem 0 0; border-top: 1px solid color-mix(in srgb, var(--ink) 12%, transparent); display: grid; gap: 0.35rem; }
.chapter__sections a { color: var(--ink); font-weight: 500; text-decoration: none; font-size: 0.98rem; }
.chapter__sections a:hover { text-decoration: underline; }
.chapter__subnum { font-variant-numeric: tabular-nums; color: var(--muted); margin-right: 0.6rem; }

/* ------------------------------------------------------------------ articles and wiki pages
   One content width for everything in an article — title, illustration, text, figures, tables,
   code and maths share the same left and right edges (--content, set in base.css). */

.article { width: 100%; max-width: calc(var(--content) + 2 * var(--gutter)); margin: 0 auto; padding: clamp(40px, 6vw, 80px) var(--gutter) clamp(80px, 10vw, 144px); }
.article__meta { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem 1rem; color: var(--muted); font-size: 0.95rem; }
.article__title { font-size: clamp(2.5rem, 5.4vw, 4.6rem); font-weight: 650; letter-spacing: -0.045em; line-height: 0.98; margin-top: 1.1rem; text-wrap: balance; font-variation-settings: "opsz" 96; }
.article__lede { font-size: clamp(1.25rem, 2vw, 1.55rem); line-height: 1.45; color: var(--ink-2); margin-top: 1.2rem; }
.article__byline { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 1rem 2rem; margin-top: 1.8rem; padding-top: 1.4rem; border-top: 1px solid var(--line); }
.article__authors { font-weight: 600; }
.article__venue { color: var(--muted); font-style: italic; }
.article__banner { margin: clamp(28px, 4vw, 48px) 0 clamp(36px, 5vw, 64px); }
.article__banner > .art, .article__banner > img { width: 100%; aspect-ratio: 21 / 8; object-fit: cover; border-radius: var(--r-l); }
.article__body, .reader__body { font-size: 1.1875rem; line-height: 1.75; }
.article__foot, .reader__foot { display: grid; gap: 2rem; margin-top: clamp(48px, 6vw, 80px); }

.reader {
  width: 100%; margin: 0 auto; padding: clamp(28px, 4vw, 56px) var(--gutter) clamp(80px, 10vw, 144px);
  display: grid; grid-template-columns: 16rem minmax(0, var(--content)); justify-content: center; column-gap: clamp(32px, 4vw, 64px);
}
.reader__nav { position: sticky; top: 92px; align-self: start; max-height: calc(100vh - 110px); overflow-y: auto; padding: 0.25rem 0.5rem 2rem 0; scrollbar-width: thin; }
.reader__main { min-width: 0; }
.reader__toggle { display: none; }
.reader__head { margin-bottom: clamp(32px, 4vw, 48px); }
.crumbs { display: flex; flex-wrap: wrap; gap: 0.2rem 0; font-size: 0.92rem; color: var(--muted); }
.crumbs > * + *::before { content: "/"; margin: 0 0.6rem; color: var(--line-2); }
.crumbs a { color: var(--muted); text-decoration: none; }
.crumbs a:hover { color: var(--ink); }
.reader__num { font-family: var(--f-display); font-weight: 700; font-size: clamp(3.2rem, 6vw, 5.2rem); letter-spacing: -0.06em; line-height: 0.85; color: var(--accent); margin-top: 1.4rem; }
.reader__title { font-size: clamp(2.4rem, 4.8vw, 4.1rem); font-weight: 650; letter-spacing: -0.045em; line-height: 1; margin-top: 0.8rem; text-wrap: balance; font-variation-settings: "opsz" 96; }
.reader__lede { font-size: clamp(1.2rem, 1.8vw, 1.4rem); line-height: 1.5; color: var(--ink-2); margin-top: 1.1rem; }
.reader__meta { display: flex; flex-wrap: wrap; align-items: center; gap: 0.4rem 1.2rem; color: var(--muted); font-size: 0.92rem; margin-top: 1.3rem; }

.tree { font-size: 0.95rem; line-height: 1.35; }
.tree__heading { font-family: var(--f-display); font-weight: 650; font-size: 1.1rem; letter-spacing: -0.015em; margin: 1.6rem 0 0.6rem; }
.tree__heading:first-child { margin-top: 0; }
.tree__heading a { color: var(--ink); text-decoration: none; }
.tree__part { color: var(--muted); font-size: 0.8rem; font-weight: 600; margin: 1rem 0 0.35rem 0.6rem; }
.tree__list, .tree__children { list-style: none; margin: 0; padding: 0; }
.tree__children { margin-left: 0.9rem; }
.tree__item > a { display: grid; grid-template-columns: 2.2rem minmax(0, 1fr); padding: 0.45rem 0.6rem; border-radius: var(--r-s); color: var(--ink-2); text-decoration: none; }
.tree__item > a:hover { background: var(--surface-2); color: var(--ink); }
.tree__num { color: var(--muted); font-variant-numeric: tabular-nums; font-weight: 600; }
.tree__item.is-current > a { background: var(--accent-wash); color: var(--accent-ink); font-weight: 600; }
.tree__item.is-current > a .tree__num { color: var(--accent-ink); }
.tree__toc { list-style: none; margin: 0.35rem 0 0.5rem 1.4rem; padding: 0 0 0 0.8rem; border-left: 2px solid var(--line); }
.tree__toc a { display: block; padding: 0.3rem 0.4rem; color: var(--muted); text-decoration: none; font-size: 0.88rem; border-radius: 6px; }
.tree__toc .toc__l3 a { padding-left: 1.1rem; }
.tree__toc a:hover { color: var(--ink); }
.tree__toc a.is-active { color: var(--accent-ink); font-weight: 600; }
.tree__empty { color: var(--muted); }

.subsections { margin-top: clamp(40px, 5vw, 64px); }
.subsections h2 { font-size: 1.5rem; margin-bottom: 1rem; }
.subsections__list { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 18rem), 1fr)); gap: 14px; }
.subsections__list a { display: grid; gap: 0.3rem; padding: 1.2rem 1.3rem; border-radius: var(--r-m); background: var(--surface-2); color: var(--ink); text-decoration: none; height: 100%; }
.subsections__list a:hover { background: var(--accent-wash); }
.subsections__num { font-family: var(--f-display); font-weight: 700; color: var(--accent); font-size: 1.3rem; }
.subsections__title { font-family: var(--f-display); font-weight: 600; font-size: 1.2rem; letter-spacing: -0.015em; }
.subsections__summary { color: var(--ink-2); font-size: 0.95rem; line-height: 1.5; }

@media (max-width: 920px) {
  .reader { grid-template-columns: minmax(0, 1fr); }
  .reader__nav {
    position: fixed; top: 0; left: 0; bottom: 0; z-index: 40; width: min(88vw, 22rem); max-height: none;
    background: var(--bg); padding: 1.5rem var(--gutter); box-shadow: 0 0 0 100vmax rgb(18 16 31 / 0);
    transform: translateX(-104%); transition: transform 280ms var(--ease), box-shadow 280ms; visibility: hidden;
  }
  .reader__nav.is-open { transform: none; visibility: visible; box-shadow: 0 0 0 100vmax rgb(18 16 31 / 0.4); }
  .reader__toggle {
    display: inline-flex; align-items: center; gap: 0.5rem; margin-bottom: 1.5rem; font-weight: 600; font-size: 0.95rem;
    background: var(--surface-2); border: 0; border-radius: 999px; padding: 0.6em 1.1em; cursor: pointer; color: var(--ink);
  }
}

.tags { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 0.5rem; }
.tags a { display: inline-block; font-size: 0.9rem; font-weight: 600; color: var(--ink-2); text-decoration: none; padding: 0.4em 0.9em; border-radius: 999px; background: var(--surface-2); }
.tags a::before { content: "#"; color: var(--muted); margin-right: 0.15em; }
.tags a:hover { background: var(--accent-wash); color: var(--accent-ink); }

.pager { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.pager__link { display: grid; gap: 0.35rem; padding: 1.2rem 1.4rem; border-radius: var(--r-m); background: var(--surface-2); color: var(--ink); text-decoration: none; font-family: var(--f-display); font-weight: 600; font-size: 1.15rem; line-height: 1.2; letter-spacing: -0.015em; }
.pager__link > span:first-child { font-family: var(--f-text); font-weight: 600; font-size: 0.85rem; letter-spacing: 0; color: var(--muted); }
.pager__link:hover { background: var(--accent-wash); }
.pager__link--next { text-align: right; grid-column: 2; }
@media (max-width: 600px) { .pager { grid-template-columns: 1fr; } .pager__link--next { grid-column: 1; text-align: left; } }
.related h2 { font-size: 1.3rem; margin-bottom: 0.6rem; }
.related ul { margin: 0; padding-left: 1.2em; }

/* ------------------------------------------------------------------ prose */

.prose { overflow-wrap: break-word; }
.prose > * + * { margin-top: 1.15em; }
.prose h2 { font-size: clamp(1.7rem, 2.6vw, 2.15rem); letter-spacing: -0.03em; margin-top: 2.2em; scroll-margin-top: 96px; }
.prose h3 { font-size: 1.4rem; letter-spacing: -0.02em; margin-top: 1.9em; scroll-margin-top: 96px; }
.prose h4 { font-size: 1.15rem; margin-top: 1.6em; }
.prose > :is(h2, h3, h4) + * { margin-top: 0.65em; }
.prose > :first-child { margin-top: 0; }
.heading-anchor { margin-left: 0.3em; color: var(--line-2); text-decoration: none; opacity: 0; font-weight: 500; transition: opacity 120ms; }
.prose :is(h2, h3, h4):hover .heading-anchor, .heading-anchor:focus { opacity: 1; color: var(--accent); }
.prose ul, .prose ol { padding-left: 1.3em; }
.prose li + li { margin-top: 0.4em; }
.prose li::marker { color: var(--muted); }
.prose strong { font-weight: 700; }
.prose blockquote { margin: 0; padding: 0.2em 0 0.2em 1.2em; border-left: 4px solid var(--sun); font-size: 1.2rem; color: var(--ink-2); }
.prose hr { border: 0; height: 1px; background: var(--line); margin-block: 2.6em; }
.prose :not(pre) > code { font-family: var(--f-mono); font-size: 0.84em; background: var(--surface-2); padding: 0.15em 0.4em; border-radius: 6px; overflow-wrap: anywhere; }
.prose iframe { width: 100%; aspect-ratio: 16 / 9; border: 0; border-radius: var(--r-m); }
.prose dt { font-weight: 700; }
.prose dd { margin-left: 1.2em; }
.prose sup { line-height: 0; }
.prose--large { font-size: 1.3rem; line-height: 1.55; }

.figure { margin: 2.2em 0; }
.figure img { margin: 0 auto; border-radius: var(--r-m); background: var(--surface-2); }
.figure figcaption { margin: 0.8em auto 0; font-size: 0.95rem; line-height: 1.5; color: var(--muted); max-width: var(--measure); text-align: center; }

.table-wrap { overflow-x: auto; margin-block: 2em; border: 1px solid var(--line); border-radius: var(--r-m); -webkit-overflow-scrolling: touch; }
.prose table { border-collapse: collapse; width: 100%; font-size: 0.98rem; line-height: 1.45; font-variant-numeric: tabular-nums; }
.prose th { text-align: left; font-weight: 700; background: var(--surface-2); padding: 0.8rem 1.1rem; border-bottom: 1px solid var(--line); vertical-align: bottom; }
.prose td { padding: 0.75rem 1.1rem; border-top: 1px solid var(--line); vertical-align: top; }
.prose tr:first-child td { border-top: 0; }
.prose td code { white-space: nowrap; }

.code-block { position: relative; margin-block: 2em; border-radius: var(--r-m); background: #1b1838; color: #e9e6ff; overflow: hidden; }
:root[data-theme="dark"] .code-block { background: #0b0a16; box-shadow: inset 0 0 0 1px var(--line); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .code-block { background: #0b0a16; box-shadow: inset 0 0 0 1px var(--line); } }
.code-block::before {
  content: attr(data-lang); display: block; padding: 0.7rem 1.2rem; font: 600 0.8rem/1 var(--f-text); letter-spacing: 0.02em;
  color: #a7a2cf; border-bottom: 1px solid rgb(255 255 255 / 0.08);
}
.code-block pre { margin: 0; padding: 1.1rem 1.2rem 1.3rem; overflow-x: auto; font-family: var(--f-mono); font-size: 0.86rem; line-height: 1.7; tab-size: 4; }
.code-block .highlight { background: none; }
/* citations and plain text don't depend on line breaks, so they wrap instead of scrolling */
.code-block:is([data-lang="bibtex"], [data-lang="bib"], [data-lang="text"]) pre { white-space: pre-wrap; overflow-wrap: anywhere; }
.code-copy {
  position: absolute; top: 0.35rem; right: 0.5rem; font: 600 0.8rem/1 var(--f-text); background: rgb(255 255 255 / 0.08); border: 0;
  color: #e9e6ff; cursor: pointer; padding: 0.45rem 0.8rem; border-radius: 999px;
}
.code-copy:hover { background: rgb(255 255 255 / 0.16); }

.admonition { margin-block: 2em; padding: 1.2rem 1.4rem; border-radius: var(--r-m); background: var(--tint-lilac); }
.admonition > * + * { margin-top: 0.6em; }
.admonition-title { font-family: var(--f-display); font-weight: 650; font-size: 1.1rem; letter-spacing: -0.01em; }
.admonition.tip { background: var(--tint-leaf); }
.admonition.warning, .admonition.caution, .admonition.danger { background: var(--tint-sun); }
.admonition.definition { background: none; box-shadow: inset 0 0 0 1.5px var(--line-2); }

.math-display { overflow-x: auto; overflow-y: hidden; padding: 0.4em 0; margin-block: 1.6em; display: block; }
.math-inline .katex { font-size: 1.04em; }
.math-display .katex { font-size: 1.12em; }
.math:not(.is-rendered) { font-family: var(--f-mono); font-size: 0.85em; color: var(--ink-2); }

.footnote { font-size: 0.95rem; color: var(--ink-2); margin-top: 3em; }
.footnote hr { margin: 0 0 1em; width: 5rem; }
.footnote-backref { text-decoration: none; }

/* ------------------------------------------------------------------ about */

.page-head--about { max-width: 56rem; }
.about-intro { margin-top: 1.4rem; font-size: clamp(1.3rem, 2.3vw, 1.75rem); line-height: 1.45; color: var(--ink-2); }
.about { display: grid; }
.about__row { display: grid; grid-template-columns: minmax(0, 15rem) minmax(0, 1fr); gap: 1.5rem clamp(32px, 5vw, 80px); padding: clamp(36px, 5vw, 64px) 0; border-top: 1px solid var(--line); }
.about__heading { font-size: clamp(1.6rem, 2.4vw, 2rem); letter-spacing: -0.03em; }
.about__body { min-width: 0; max-width: 56rem; }
.about__name { display: grid; grid-template-columns: 9rem minmax(0, 1fr); gap: 2rem; align-items: center; font-size: 1.15rem; }
.about__spot .art { width: 100%; height: auto; }
.directions { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 22rem), 1fr)); gap: 1.6rem 2rem; }
.directions__item { display: grid; grid-template-columns: 6.5rem minmax(0, 1fr); gap: 1rem; align-items: start; }
.directions__art { border-radius: var(--r-s); background: var(--surface-2); overflow: hidden; }
.directions__art .art { width: 100%; height: auto; }
.directions__item strong { display: block; font-family: var(--f-display); font-weight: 650; font-size: 1.15rem; letter-spacing: -0.015em; margin-bottom: 0.2rem; }
.directions__item span span { color: var(--ink-2); font-size: 0.98rem; line-height: 1.5; }
.team-group + .team-group { margin-top: 2.5rem; }
.team-group__title { font-family: var(--f-text); font-weight: 600; font-size: 1rem; letter-spacing: 0; color: var(--muted); margin-bottom: 1.2rem; }
.people { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 14rem), 1fr)); gap: 2rem 1.6rem; }
.person__photo { aspect-ratio: 1; border-radius: var(--r-l); overflow: hidden; background: var(--surface-2); margin-bottom: 1rem; }
.person__photo img, .person__photo .art { width: 100%; height: 100%; object-fit: cover; }
.person__name { font-family: var(--f-display); font-weight: 650; font-size: 1.25rem; letter-spacing: -0.02em; line-height: 1.2; }
.person__name span { font-family: var(--f-text); font-weight: 500; font-size: 1rem; color: var(--muted); letter-spacing: 0; }
.person__role { color: var(--muted); font-size: 0.95rem; margin-top: 0.15rem; }
.person__bio { margin-top: 0.6rem; font-size: 0.98rem; line-height: 1.55; color: var(--ink-2); }
.person__bio p + p { margin-top: 0.5em; }
.person__links { display: flex; flex-wrap: wrap; gap: 0 1rem; margin-top: 0.5rem; font-size: 0.95rem; font-weight: 600; }
@media (max-width: 760px) {
  .about__row { grid-template-columns: 1fr; }
  .about__name { grid-template-columns: 6rem minmax(0, 1fr); gap: 1.2rem; }
}

/* ------------------------------------------------------------------ errors */

.error-page { display: grid; grid-template-columns: minmax(0, 18rem) minmax(0, 1fr); gap: clamp(24px, 5vw, 72px); align-items: center; min-height: 60vh; }
.error-page__art .art { width: 100%; height: auto; }
.error-page__code { font-weight: 600; color: var(--accent-ink); margin-bottom: 0.6rem; }
.error-page__actions { display: flex; flex-wrap: wrap; gap: 0.6rem; margin-top: 2rem; }
@media (max-width: 680px) { .error-page { grid-template-columns: 1fr; } .error-page__art { max-width: 12rem; } }

/* ------------------------------------------------------------------ footer */

.site-footer { background: #1b1838; color: #f4f2ff; margin-top: auto; }
:root[data-theme="dark"] .site-footer { background: #0b0a16; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .site-footer { background: #0b0a16; } }
.site-footer a { color: inherit; text-decoration: none; }
.site-footer a:hover { color: var(--sun); }
.site-footer__inner { max-width: calc(var(--page) + 2 * var(--gutter)); margin: 0 auto; padding: clamp(56px, 7vw, 96px) var(--gutter) clamp(40px, 5vw, 64px); display: grid; grid-template-columns: minmax(0, 2fr); grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 2.5rem; }
.site-footer__name { font-family: var(--f-display); font-weight: 800; font-size: clamp(3rem, 8vw, 6.5rem); letter-spacing: -0.06em; line-height: 0.85; }
.site-footer__full { margin-top: 1rem; color: #c9c6dd; max-width: 26em; }
.site-footer__col { display: grid; align-content: start; gap: 0.55rem; font-weight: 500; }
.site-footer__base { max-width: calc(var(--page) + 2 * var(--gutter)); margin: 0 auto; padding: 1.2rem var(--gutter) 1.6rem; display: flex; flex-wrap: wrap; justify-content: space-between; gap: 1rem; font-size: 0.9rem; color: #a3a0bc; }
.site-footer__base p { margin: 0; }
.site-footer__legal { display: flex; flex-wrap: wrap; gap: 0.35rem 1.25rem; }
.site-footer__icp { white-space: nowrap; }
@media (max-width: 760px) { .site-footer__inner { grid-template-columns: 1fr 1fr; grid-auto-flow: row; } .site-footer__identity { grid-column: 1 / -1; } }

/* ------------------------------------------------------------------ code highlighting (on the dark code panel) */

.highlight .c, .highlight .c1, .highlight .cm, .highlight .ch, .highlight .cs, .highlight .cp { color: #8b86b3; font-style: italic; }
.highlight .k, .highlight .kd, .highlight .kn, .highlight .kr, .highlight .kc, .highlight .ow, .highlight .kt { color: #b9a9ff; }
.highlight .s, .highlight .s1, .highlight .s2, .highlight .sb, .highlight .sd, .highlight .si, .highlight .se, .highlight .sa, .highlight .sh, .highlight .dl { color: #8fe3b4; }
.highlight .m, .highlight .mi, .highlight .mf, .highlight .mh, .highlight .mo, .highlight .il { color: #ffd36b; }
.highlight .nf, .highlight .fm, .highlight .nc { color: #ffa38a; }
.highlight .nb, .highlight .bp { color: #8fd3ff; }
.highlight .nd, .highlight .na, .highlight .nt { color: #ff9fd0; }
.highlight .o, .highlight .p { color: #d6d2f5; }
.highlight .err { color: inherit; background: none; }

/* ------------------------------------------------------------------ languages */
/* switcher in a wiki page's meta line: one pill per language, the current one filled */
.lang-switch { display: inline-flex; flex-wrap: wrap; gap: 0.3rem; padding: 0.2rem; border-radius: 999px; background: var(--surface-2); }
.lang-switch a {
  display: inline-flex; align-items: center; min-height: 1.9rem; padding: 0 0.8rem; border-radius: 999px;
  color: var(--ink-2); font: 600 0.85rem/1 var(--f-text); text-decoration: none; white-space: nowrap;
}
.lang-switch a:hover { color: var(--ink); background: var(--bg); }
.lang-switch a[aria-current] { background: var(--ink); color: var(--bg); }
.lang-switch a.is-draft { font-style: normal; outline: 1.5px dashed var(--line-2); outline-offset: -3px; }
.lang-tag { display: inline-flex; align-items: center; padding: 0.4em 0.8em; border-radius: 999px; background: var(--surface-2); color: var(--ink-2); font: 600 0.82rem/1 var(--f-text); }

/* note under a page title: shown in another language, or translated from an original */
.lang-note {
  display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 0.8rem; align-items: start;
  margin: clamp(24px, 3vw, 36px) 0 0; padding: 0.9rem 1.1rem;
  border-radius: var(--r-m); background: var(--tint-sky); color: var(--ink); font-size: 0.95rem; line-height: 1.5;
}
/* in the wiki the header already leaves room below it, so the note tucks under it */
.reader__head + .lang-note { margin: calc(-1 * clamp(12px, 2vw, 24px)) 0 clamp(28px, 3.5vw, 40px); }
.lang-note--outdated { background: var(--tint-sun); }
.lang-note__icon { margin-top: 0.1rem; color: var(--accent-ink); }
.lang-note p + p { margin-top: 0.3rem; }
.lang-note a { color: var(--accent-ink); font-weight: 600; }

/* "English · 中文" on chapter and note cards */
.langs { display: flex; flex-wrap: wrap; gap: 0.3rem; margin-top: 0.15rem; }
.langs span { font: 600 0.75rem/1 var(--f-text); padding: 0.35em 0.65em; border-radius: 999px; color: var(--ink-2); box-shadow: inset 0 0 0 1px var(--line-2); }
.langs span.is-shown { background: var(--ink); color: var(--bg); box-shadow: none; }
.chapter__main .langs { margin-top: 0.3rem; }

/* right-to-left content keeps the page's layout but flows its own text the other way */
.prose[dir="rtl"] :is(ul, ol) { padding-inline-start: 1.4em; padding-inline-end: 0; }
.prose[dir="rtl"] blockquote { border-left: 0; border-right: 4px solid var(--sun); padding: 0.2em 1.2em 0.2em 0; }

/* ------------------------------------------------------------------ subscribe */
.section__links { display: inline-flex; gap: 1.2rem; align-items: baseline; flex-wrap: wrap; justify-content: flex-end; }
.more-link--subscribe { color: var(--accent-ink); }
.site-footer__subscribe p { color: #c9c6dd; font-weight: 500; }
.site-footer__subscribe .button { justify-self: start; }
.site-footer a.button--light { color: #1b1838; }
.subscribe-cta {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.8rem 1.5rem;
  padding: 1.1rem 1.4rem; border-radius: var(--r-m); background: var(--tint-lilac);
}
.subscribe-cta p { margin: 0; font-family: var(--f-display); font-weight: 600; font-size: 1.2rem; letter-spacing: -0.015em; }

/* the dialog: opened by script, or (without script) as the #subscribe target */
.subscribe { display: none; position: fixed; inset: 0; z-index: 80; place-items: center; padding: var(--gutter); }
.subscribe.is-open, .subscribe:target { display: grid; }
.subscribe__backdrop { position: absolute; inset: 0; background: rgb(18 16 31 / 0.55); backdrop-filter: blur(3px); animation: fade-in 180ms var(--ease); }
.subscribe__card {
  position: relative; width: min(30rem, 100%); max-height: calc(100vh - 2 * var(--gutter)); overflow: auto;
  padding: clamp(24px, 4vw, 36px); border-radius: var(--r-l); background: var(--surface); color: var(--ink);
  box-shadow: 0 30px 80px -30px rgb(18 16 31 / 0.6); animation: dialog-in 260ms var(--spring);
}
@keyframes fade-in { from { opacity: 0; } }
@keyframes dialog-in { from { opacity: 0; transform: translateY(12px) scale(0.97); } }
html.has-dialog { overflow: hidden; }
.subscribe__close {
  position: absolute; top: 14px; right: 14px; width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center;
  color: var(--ink-2); background: var(--surface-2);
}
.subscribe__close:hover { color: var(--ink); background: var(--accent-wash); }
.subscribe__art { width: 72px; height: 72px; border-radius: 18px; overflow: hidden; background: var(--tint-sky); margin-bottom: 1rem; }
.subscribe__art svg { width: 100%; height: 100%; }
.subscribe__title { font-size: clamp(1.6rem, 3vw, 2rem); letter-spacing: -0.03em; }
.subscribe__text { color: var(--ink-2); margin-top: 0.6rem; line-height: 1.55; }
.subscribe__form { margin-top: 1.4rem; }
.subscribe__label { display: block; font-weight: 600; font-size: 0.9rem; margin-bottom: 0.4rem; }
.subscribe__row { display: flex; gap: 0.5rem; flex-wrap: wrap; }
.subscribe__input {
  flex: 1 1 14rem; min-width: 0; height: 48px; padding: 0 1rem; border-radius: 999px; border: 1.5px solid var(--line-2);
  background: var(--bg); font-size: 1rem;
}
.subscribe__input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-wash); }
.subscribe__submit { height: 48px; }
.subscribe__submit:disabled { opacity: 0.6; cursor: progress; }
.subscribe__status { min-height: 1.5em; margin-top: 0.8rem; font-weight: 500; font-size: 0.95rem; }
.subscribe__status.is-ok { color: var(--ok); }
.subscribe__status.is-error { color: var(--danger); }
/* hidden fields for bots: invisible and unfocusable for people, in either writing direction */
.subscribe__hp, .comment-form__hp { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; opacity: 0; pointer-events: none; }

/* ------------------------------------------------------------------ comments */
.comments, .comment-form, .comment { scroll-margin-top: 96px; }
.comments { margin-top: clamp(8px, 2vw, 16px); padding-top: clamp(28px, 4vw, 40px); border-top: 1px solid var(--line); }
.comments__title { font-size: clamp(1.6rem, 2.6vw, 2rem); letter-spacing: -0.03em; display: flex; align-items: center; gap: 0.6rem; }
.comments__count { font: 700 0.9rem/1 var(--f-text); padding: 0.35em 0.65em; border-radius: 999px; background: var(--accent-wash); color: var(--accent-ink); letter-spacing: 0; }
.comments__empty { color: var(--muted); margin-top: 0.8rem; }
.comments__notice { margin-top: 1rem; padding: 0.75rem 1rem; border-radius: var(--r-s); font-weight: 500; }
.comments__notice.is-ok { background: color-mix(in srgb, var(--ok) 14%, transparent); color: var(--ok); }
.comments__notice.is-error { background: color-mix(in srgb, var(--danger) 12%, transparent); color: var(--danger); }
.comments__list { list-style: none; margin: 1.4rem 0 0; padding: 0; display: grid; gap: 1.4rem; }
.comment { display: grid; grid-template-columns: 2.6rem minmax(0, 1fr); gap: 0.9rem; }
.comment__avatar { width: 2.6rem; height: 2.6rem; border-radius: 50%; display: grid; place-items: center; background: var(--tint-sun); color: var(--ink); font: 700 0.85rem/1 var(--f-text); }
.comment:nth-child(3n+2) .comment__avatar { background: var(--tint-sky); }
.comment:nth-child(3n) .comment__avatar { background: var(--tint-pink); }
.comment__meta { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.2rem 0.8rem; color: var(--muted); font-size: 0.88rem; }
.comment__name { color: var(--ink); font-weight: 700; font-size: 1rem; }
.comment__lang { font-size: 0.78rem; font-weight: 600; padding: 0.2em 0.6em; border-radius: 999px; box-shadow: inset 0 0 0 1px var(--line-2); }
.comment__body { margin-top: 0.35rem; line-height: 1.6; overflow-wrap: anywhere; }
.comment__body p + p { margin-top: 0.6em; }
.comment__admin { margin-top: 0.4rem; }
.comment__admin button { background: none; border: 0; padding: 0; color: var(--danger); font: 600 0.82rem/1 var(--f-text); cursor: pointer; }
.comment-form { margin-top: clamp(24px, 3vw, 32px); padding: clamp(18px, 3vw, 28px); border-radius: var(--r-m); background: var(--surface-2); display: grid; gap: 1rem; position: relative; }
.comment-form__title { font-size: 1.3rem; letter-spacing: -0.02em; }
.comment-form__row { display: grid; gap: 0.35rem; }
.comment-form__label { font-weight: 600; font-size: 0.9rem; }
.comment-form__input { width: 100%; padding: 0.7rem 0.9rem; border-radius: var(--r-s); border: 1.5px solid var(--line-2); background: var(--bg); font-size: 1rem; line-height: 1.5; }
.comment-form__input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-wash); }
#comment-name { max-width: 22rem; }
.comment-form__help { color: var(--muted); font-size: 0.88rem; }
.comment-form .button { justify-self: start; }

@media print {
  .site-header, .site-footer, .edit-link, .lang-switch, .comment-form, .subscribe, .subscribe-cta, .reader__nav, .reader__toggle, .code-copy, .pager, .scene { display: none !important; }
  body { background: #fff; color: #000; font-size: 11pt; }
  .reader { display: block; padding: 0; }
}
