/* ensomi site: one dark plum theme (docs/brand.md). Tokens first, then base, then components. */
:root {
  color-scheme: dark;

  /* ground: dark plum; bg and bg-2 are the two halves of the diagonal split */
  --bg: #1c1525;
  --bg-2: #231a2e;
  --surface: #2a2036;
  --surface-2: #342944;
  --line: #4a3b5e;
  --field-line: #8f7dab;
  --text: #f6f1fb;
  --muted: #c7bcd6;

  /* the mark: two open arcs and their overlap */
  --lavender: #b5b3ef;
  --rose: #eaa0b7;
  --purple: #9562d7;

  /* action and motion only: primary buttons, progress, playhead */
  --coral-1: #f39aaf;
  --coral-2: #ff879f;
  --coral-3: #ff708f;
  --action: linear-gradient(115deg, var(--coral-1), var(--coral-2) 55%, var(--coral-3));
  --action-ink: #2b0f1e;

  --no: #ff9aa5;
  --stage: #130e1a; /* the player and code */
  --stage-line: #3a2e4a;

  /* type */
  --font-text: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", "Hiragino Sans", "Yu Gothic UI", "Noto Sans JP", sans-serif;
  --font-round: "SF Pro Rounded", "Hiragino Maru Gothic ProN", "M PLUS Rounded 1c", "Nunito", var(--font-text);
  --font-mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --step--1: 0.9rem;
  --step-0: 1.0625rem;
  --step-1: 1.35rem;
  --step-2: 2rem;
  --step-3: 3.4rem;

  /* space and shape: soft, a little asymmetric */
  --s1: 0.25rem;
  --s2: 0.5rem;
  --s3: 1rem;
  --s4: 1.5rem;
  --s5: 2.5rem;
  --s6: 4.5rem;
  --measure: 40rem;
  --wide: 72rem;
  --radius: 18px;
  --radius-soft: 26px 26px 26px 10px;
  --radius-pill: 999px;
}

/* The Chinese page uses Simplified Chinese faces; Japanese text on it, such as the statement, keeps Japanese faces. */
:root:lang(zh) {
  --font-text: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", sans-serif;
  --font-round: "SF Pro Rounded", "PingFang SC", "Nunito", var(--font-text);
}
:root:lang(zh) [lang|="ja"] { font-family: "SF Pro Rounded", "Hiragino Maru Gothic ProN", "M PLUS Rounded 1c", "Hiragino Sans", "Yu Gothic UI", "Noto Sans JP", sans-serif; }
/* Japanese headings break between phrases where the browser can find them. */
:root:lang(ja) :is(h1, h2, h3, .lede, .eyebrow) { word-break: auto-phrase; }

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; background: var(--bg); }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: var(--step-0)/1.65 var(--font-text);
  overflow-wrap: break-word;
}
img { max-width: 100%; height: auto; display: block; }
a { color: var(--lavender); text-underline-offset: 0.18em; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 3px solid var(--coral-2); outline-offset: 3px; border-radius: 6px; }
code, pre { font-family: var(--font-mono); font-size: 0.88em; }
code { background: var(--surface-2); padding: 0.1em 0.4em; border-radius: 6px; }
[hidden] { display: none !important; }

.wrap { max-width: var(--wide); margin: 0 auto; padding: 0 var(--s4); }
.skip { position: absolute; left: -999px; }
.skip:focus { left: var(--s3); top: var(--s3); background: var(--bg); padding: var(--s2) var(--s3); z-index: 10; }

/* header: the brand, the sections, then the two repositories and the language menu in the top right corner */
.top { display: flex; align-items: center; gap: var(--s2) var(--s4); padding: var(--s3) 0; }
.brand { display: flex; align-items: center; gap: var(--s2); color: var(--text); text-decoration: none; font: 650 var(--step-1)/1 var(--font-round); letter-spacing: 0.01em; }
.brand img { width: 36px; height: 36px; border-radius: 10px; }
.top .page-nav { display: flex; flex-wrap: wrap; gap: var(--s1) var(--s4); margin-left: auto; font-size: var(--step--1); }
.top .page-nav a { color: var(--muted); text-decoration: none; padding: var(--s1) 0; }
.top .page-nav a:hover { color: var(--text); text-decoration: underline; }
.top .icons { display: flex; gap: var(--s1); }
.icon-link { display: inline-grid; place-items: center; width: 2.25rem; height: 2.25rem; border-radius: 50%; color: var(--muted); }
button.icon-link { border: 0; padding: 0; background: none; cursor: pointer; }
.icon-link:hover { color: var(--text); background: var(--surface); }
.icon-link::before { content: ""; width: 1.3rem; height: 1.3rem; background: currentColor; mask: var(--icon) center / contain no-repeat; }
.icon-link.hf { --icon: url(/img/huggingface.svg); }
.icon-link.gh { --icon: url(/img/github.svg); }
.icon-link.lang { --icon: url(/img/language.svg); }
.icon-link.lang:has(+ :popover-open) { color: var(--text); background: var(--surface); }
/* The language menu is a popover, so the reading pages need no script for it: Esc or a click elsewhere closes it,
   and the top layer escapes .hero-band's overflow. Absolute there is against the page, so the insets put it under
   the button by the header's own measures: its padding and the button's height, and the right edge of .wrap.
   Flex, not grid: WebKit stretches a grid popover to the viewport's height. */
.top .langs { position: absolute; inset: calc(var(--s3) + 2.25rem + var(--s1)) max(var(--s4), calc(50% - var(--wide) / 2 + var(--s4))) auto auto; margin: 0; padding: var(--s1); min-width: 8rem; background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius) 10px var(--radius) var(--radius); font-size: var(--step--1); }
.top .langs:popover-open { display: flex; flex-direction: column; }
.top .langs a { padding: var(--s2) var(--s3); border-radius: 14px; color: var(--muted); text-decoration: none; }
.top .langs a:hover { color: var(--text); background: var(--surface); }
.top .langs a:focus-visible { outline-offset: -3px; }
.top .langs a[aria-current="page"] { color: var(--text); font-weight: 650; }

/* hero: the diagonal split of the mark, the icon, the statement */
.hero-band { background: linear-gradient(152deg, var(--bg) 0 58%, var(--bg-2) 58% 100%); overflow: hidden; }
.hero { position: relative; padding: var(--s5) 0; }
.hero-icon { position: absolute; right: 0; top: 50%; transform: translateY(-50%); width: clamp(12rem, 22vw, 17rem); border-radius: 22.5%; pointer-events: none; }
.hero h1 { position: relative; font: 700 var(--step-3)/1.08 var(--font-round); letter-spacing: -0.02em; max-width: 16ch; }
.hero h1 .name { color: var(--lavender); }
.hero .jp { position: relative; font: 500 var(--step-1)/1.5 var(--font-round); color: var(--rose); margin-top: var(--s3); }
.hero .lede { position: relative; }

/* text blocks */
section { padding-top: var(--s6); }
h1, h2, h3, h4 { line-height: 1.2; margin: 0; font-weight: 650; letter-spacing: -0.01em; }
h2 { font: 650 var(--step-2)/1.2 var(--font-round); margin-bottom: var(--s3); }
h3, h4 { font-size: var(--step-0); margin-bottom: var(--s1); }
p { margin: 0 0 var(--s3); }
.prose { max-width: var(--measure); }
.eyebrow { color: var(--rose); font-size: var(--step--1); font-weight: 650; letter-spacing: 0.08em; text-transform: uppercase; text-wrap: balance; margin-bottom: var(--s2); }
.lede { font-size: var(--step-1); line-height: 1.5; color: var(--muted); max-width: 38rem; margin-top: var(--s3); }
.muted { color: var(--muted); }
.small { font-size: var(--step--1); }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

.actions { display: flex; flex-wrap: wrap; gap: var(--s2) var(--s3); margin-top: var(--s4); }
.community-links { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s2) var(--s3); }
.icon-link.discord { --icon: url(/img/discord.svg); }
.icon-link.qq { --icon: url(/img/qq.svg); }
.qq-community { display: inline-flex; align-items: center; gap: var(--s1); color: var(--muted); font-variant-numeric: tabular-nums; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: var(--s2); padding: 0.62rem 1.2rem; border-radius: var(--radius-pill); border: 1.5px solid var(--lavender); background: transparent; color: var(--lavender); text-decoration: none; font: 600 var(--step--1)/1.2 var(--font-text); cursor: pointer; }
.btn:hover { background: color-mix(in srgb, var(--lavender) 12%, transparent); }
.btn.primary { background: var(--action); border-color: transparent; color: var(--action-ink); }
.btn.primary:hover { filter: brightness(1.06); }
.btn.big { padding: 0.85rem 1.8rem; font-size: var(--step-0); }
.btn.small { padding: 0.35rem 0.85rem; }
.btn:disabled { opacity: 0.45; cursor: not-allowed; filter: none; }

/* forms */
label { display: grid; gap: var(--s1); font-size: var(--step--1); color: var(--muted); font-weight: 600; }
input[type="text"], select {
  font: 500 var(--step-0)/1.3 var(--font-text); color: var(--text); background: var(--surface-2);
  border: 1.5px solid var(--field-line); border-radius: 12px; padding: 0.5rem 0.7rem; min-width: 0;
}
input[type="range"] { accent-color: var(--coral-2); width: 100%; }
input[type="file"] { font: 500 var(--step--1) var(--font-text); color: var(--muted); }
input[type="file"]::file-selector-button { font: 600 var(--step--1) var(--font-text); color: var(--lavender); background: transparent; border: 1.5px solid var(--lavender); border-radius: var(--radius-pill); padding: 0.45rem 1rem; margin-right: var(--s3); cursor: pointer; }
output { color: var(--text); font-variant-numeric: tabular-nums; }

/* the generator */
.tool { padding-top: var(--s4); }
.tool-row { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s4); }
.panel { background: var(--surface); border-radius: var(--radius-soft); padding: var(--s4); display: grid; gap: var(--s3); align-content: start; }
.panel h3 { display: flex; align-items: center; gap: var(--s2); font: 650 var(--step-1)/1.2 var(--font-round); margin: 0; }
.step-num { display: inline-grid; place-items: center; width: 2rem; height: 2rem; border-radius: 50% 50% 50% 22%; background: color-mix(in srgb, var(--purple) 35%, var(--surface)); border: 2px solid var(--purple); color: var(--text); font-size: var(--step--1); font-weight: 700; }
.panel .status { margin: 0; font-size: var(--step--1); color: var(--muted); }
.choice { display: flex; flex-wrap: wrap; gap: var(--s2) var(--s4); border: 0; margin: 0; padding: 0; }
.choice label { display: flex; align-items: center; gap: var(--s2); color: var(--text); font-weight: 500; font-size: var(--step-0); }
.choice input { accent-color: var(--coral-2); }
.pair { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s3); }
#conditions { margin-top: var(--s4); }
.star-label { display: flex; justify-content: space-between; align-items: baseline; }
.star-label output { font: 700 var(--step-1) var(--font-round); color: var(--rose); }
.seed-row { display: flex; gap: var(--s2); }
.seed-row input { flex: 1; font-family: var(--font-mono); }
.exact, .star { display: grid; gap: var(--s1); }
.exact label { display: flex; align-items: center; gap: var(--s2); color: var(--text); font-weight: 500; font-size: var(--step-0); }
.exact input { accent-color: var(--coral-2); }
.exact p, .star p { margin: 0; }

.meter { height: 8px; background: var(--surface-2); border-radius: var(--radius-pill); overflow: hidden; }
.meter span { display: block; height: 100%; width: 0; background: var(--action); border-radius: inherit; transition: width 0.15s; }

.sections { border-top: 1px solid var(--line); padding-top: var(--s3); display: grid; gap: var(--s2); }
.sections p { margin: 0; }
.section-row { display: grid; grid-template-columns: 7rem 7rem 14rem 1fr auto; gap: var(--s3); align-items: end; background: var(--surface-2); border-radius: 16px 16px 16px 6px; padding: var(--s3); }
.section-row input[type="text"] { font-family: var(--font-mono); width: 100%; }
.section-row select { width: 100%; }
.section-row .value-label span { display: flex; justify-content: space-between; }
.section-row .note { grid-column: 1 / -1; margin: 0; font-size: var(--step--1); color: var(--muted); }
.section-row .remove { border: none; background: transparent; color: var(--muted); font-size: 1.4rem; line-height: 1; padding: 0.4rem 0.6rem; border-radius: 10px; cursor: pointer; }
.section-row .remove:hover { color: var(--text); background: var(--surface); }
.sections .btn { justify-self: start; }
.invalid { color: var(--no); font-size: var(--step--1); font-weight: 600; }

.run { display: grid; grid-template-columns: auto 1fr; gap: var(--s2) var(--s4); align-items: center; margin-top: var(--s4); }
.run .status { grid-column: 1 / -1; margin: 0; color: var(--muted); font-size: var(--step--1); }
.phases { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: var(--s2); }
.phases li { padding: 0.3rem 0.85rem; border-radius: var(--radius-pill); background: var(--surface); color: var(--muted); font-size: var(--step--1); font-variant-numeric: tabular-nums; }
.phases li.active { background: var(--action); color: var(--action-ink); font-weight: 650; }
.phases li.done { background: var(--surface-2); color: var(--text); }
.error { margin-top: var(--s3); background: color-mix(in srgb, var(--no) 14%, var(--surface)); border-left: 4px solid var(--no); border-radius: 0 12px 12px 0; padding: var(--s2) var(--s3); color: var(--text); max-width: 52rem; }

/* result: the live inspector (after Beatmap Lens) and the receipt */
.inspector { display: grid; grid-template-columns: 24rem 3rem 1fr; gap: var(--s3); align-items: start; }
.viewport canvas { display: block; width: 100%; height: 36rem; background: var(--stage); border-radius: var(--radius-soft); touch-action: none; cursor: ns-resize; }
.instrument { display: flex; justify-content: space-between; gap: var(--s2); margin: var(--s2) 0 0; font: 500 var(--step--1) var(--font-mono); color: var(--muted); }
.instrument #clock { color: var(--text); font-variant-numeric: tabular-nums; white-space: nowrap; }
.overview { display: block; width: 100%; height: 36rem; background: var(--stage); border-radius: 14px 14px 14px 6px; cursor: pointer; touch-action: none; }
.side { display: grid; gap: var(--s3); padding-left: var(--s3); }
.side p { margin: 0; }
.transport { display: flex; gap: var(--s2); border: 0; margin: 0; padding: 0; }
.transport .btn { min-width: 6.5rem; }
.tuning { display: grid; gap: var(--s2); }
.preset-row { display: flex; align-items: center; justify-content: space-between; gap: var(--s3); font-size: var(--step--1); color: var(--muted); font-weight: 600; }
.presets { display: inline-flex; gap: 2px; padding: 3px; background: var(--surface); border-radius: var(--radius-pill); }
.presets button { border: 0; background: transparent; color: var(--muted); font: 600 var(--step--1)/1.2 var(--font-text); font-variant-numeric: tabular-nums; padding: 0.35rem 0.75rem; border-radius: var(--radius-pill); cursor: pointer; }
.presets button:hover { color: var(--text); }
.presets button[aria-pressed="true"] { background: var(--lavender); color: var(--action-ink); }
.volume { display: inline-flex; align-items: center; gap: var(--s2); padding: 3px 0.75rem; background: var(--surface); border-radius: var(--radius-pill); }
.volume input { width: 8rem; margin: 0; }
.volume output { min-width: 2.75rem; padding: 0.35rem 0; line-height: 1.2; text-align: right; }
.downloads { display: flex; flex-wrap: wrap; gap: var(--s2); }
.downloads .btn[aria-pressed="true"] { background: var(--lavender); color: var(--action-ink); }
.receipt { display: grid; grid-template-columns: max-content 1fr; gap: var(--s1) var(--s4); margin: 0; background: var(--surface); border-radius: var(--radius-soft); padding: var(--s3) var(--s4); font-size: var(--step--1); }
.receipt dt { color: var(--muted); }
.receipt dd { margin: 0; font-variant-numeric: tabular-nums; }
.timing summary { width: fit-content; color: var(--muted); font-size: var(--step--1); cursor: pointer; }
.timing summary:hover { color: var(--text); }
.timing[open] summary { margin-bottom: var(--s2); }
.times { border-collapse: collapse; font-size: var(--step--1); font-variant-numeric: tabular-nums; }
.times th, .times td { text-align: left; padding: 0.15rem var(--s4) 0.15rem 0; }
.times th { color: var(--muted); font-weight: 500; }
.times td { text-align: right; }
.times tr.total > * { color: var(--text); font-weight: 650; border-top: 1px solid var(--line); }

/* R2's steps, the four frontiers, the two next models and their aims */
.steps { list-style: none; padding: 0; margin: var(--s4) 0 0; display: grid; gap: var(--s3); grid-template-columns: repeat(3, 1fr); counter-reset: step; }
.steps li { counter-increment: step; background: var(--surface); border-radius: var(--radius-soft); padding: var(--s3) var(--s4) var(--s4); }
.steps li::before { content: counter(step); display: block; font-weight: 700; color: var(--rose); }
.steps b { display: block; margin-bottom: var(--s1); }
.steps span { color: var(--muted); font-size: var(--step--1); }
.cols { display: grid; gap: var(--s4); grid-template-columns: 1fr 1fr; margin-top: var(--s5); }
.cols > div { background: var(--surface); border-radius: var(--radius-soft); padding: var(--s4); }
.cols .eyebrow { margin-bottom: var(--s3); }
.cols h3 { font: 650 var(--step-0)/1.3 var(--font-round); margin-bottom: var(--s3); }
.cols p:last-child { color: var(--muted); margin: 0; }
.aims { list-style: none; padding: 0; margin: var(--s5) 0 0; display: grid; gap: var(--s4) var(--s5); grid-template-columns: 1fr 1fr; max-width: 62rem; counter-reset: aim; }
.aims li { counter-increment: aim; display: grid; grid-template-columns: 2rem 1fr; gap: var(--s1) var(--s3); align-content: start; }
.aims li::before { content: counter(aim); grid-row: span 2; display: grid; place-items: center; width: 2rem; height: 2rem; border-radius: 50% 50% 50% 22%; background: color-mix(in srgb, var(--purple) 35%, var(--surface)); border: 2px solid var(--purple); color: var(--text); font-size: var(--step--1); font-weight: 700; }
.aims h4 { font: 650 var(--step-0)/1.3 var(--font-round); margin: 0.2rem 0 0; }
.aims p { color: var(--muted); margin: 0; }
.tracks h3 { font-size: var(--step-1); }
.tracks > div > p:not(.eyebrow) { color: var(--muted); }
.tracks .aims { grid-template-columns: 1fr; margin-top: var(--s4); }

/* reading pages (data-provenance/): the home page's header and type, one column of prose, no generator */
.doc-hero { padding: var(--s5) 0 var(--s4); }
.doc-hero h1 { font: 700 clamp(2rem, 1.3rem + 2.6vw, 2.9rem)/1.12 var(--font-round); letter-spacing: -0.02em; max-width: 22ch; text-wrap: balance; }
.dates { list-style: none; padding: 0; margin: var(--s3) 0 0; display: flex; flex-wrap: wrap; gap: var(--s1) var(--s4); color: var(--muted); font-size: var(--step--1); }
.translated { margin: var(--s2) 0 0; color: var(--muted); font-size: var(--step--1); }
.doc > section { padding-top: var(--s5); max-width: var(--measure); }
.doc > section:first-child { padding-top: var(--s4); }
.doc ul { padding-left: 1.25em; margin: 0 0 var(--s3); }
.doc li { margin-bottom: var(--s2); }
.doc h2 { text-wrap: balance; }
.doc :is(code, time) { white-space: nowrap; }
.doc h3 { font: 650 var(--step-1)/1.25 var(--font-round); margin: var(--s4) 0 var(--s2); }
.figures { display: grid; grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr)); gap: var(--s3); margin: var(--s4) 0; }
.figures > div { background: var(--surface); border-radius: var(--radius-soft); padding: var(--s3) var(--s4); }
.figures dt { font: 700 var(--step-1)/1.25 var(--font-round); font-variant-numeric: tabular-nums; }
.figures dd { margin: var(--s1) 0 0; color: var(--muted); font-size: var(--step--1); }
.contact-note { margin-top: var(--s4); }

/* code */
pre { background: var(--stage); color: #ece6f4; border: 1px solid var(--stage-line); border-radius: var(--radius); padding: var(--s3); overflow-x: auto; line-height: 1.55; margin: var(--s3) 0; max-width: 100%; }
pre code { background: none; padding: 0; }

footer { margin-top: var(--s6); border-top: 1px solid var(--line); padding: var(--s4) 0 var(--s5); color: var(--muted); font-size: var(--step--1); }
footer p { margin-bottom: var(--s2); }

/* Narrow screens: the page reads on a phone; the generator and inspector are desktop-only. */
.desktop-note { display: none; }
@media (max-width: 60rem) {
  .tool, #result, .desktop-only { display: none !important; }
  .desktop-note { display: block; margin-top: var(--s4); background: var(--surface); border-radius: var(--radius-soft); padding: var(--s3) var(--s4); color: var(--muted); }
  .wrap { padding: 0 var(--s3); }
  .top { flex-wrap: wrap; }
  /* the brand and the icons share the first row; the sections follow */
  .top .icons { order: 1; margin-left: auto; }
  .top .page-nav { order: 2; flex-basis: 100%; margin-left: 0; }
  .top .page-nav { column-gap: var(--s3); }
  .top .langs { right: var(--s3); }
  .hero, .doc-hero { padding-top: var(--s3); }
  .hero h1 { font-size: clamp(2.1rem, 1.2rem + 4.5vw, 3.4rem); }
  .hero-icon { display: none; }
  section { padding-top: var(--s5); }
  h2 { font-size: 1.6rem; }
  .steps { grid-template-columns: 1fr; }
}
@media (max-width: 40rem) {
  .cols, .aims { grid-template-columns: 1fr; }
  .lede { font-size: 1.15rem; }
}
