/* ============================================================
   ScriptPlayer+ Docs — site styles
   ============================================================ */

:root {
  --bg: #0a0c11;
  --bg-soft: #0d1017;
  --surface: #12161f;
  --surface-2: #171c27;
  --surface-3: #1d2331;
  --line: rgba(255, 255, 255, 0.075);
  --line-strong: rgba(255, 255, 255, 0.15);

  --text: #e8ebf3;
  --text-2: #a3abbd;
  --text-3: #6f7891;

  --violet: #a78bfa;
  --violet-bright: #c4b5fd;
  --violet-soft: rgba(167, 139, 250, 0.14);
  --cyan: #67e8f9;
  --green: #8fd14f;
  --amber: #f0b429;
  --red: #f2545b;

  --radius: 12px;
  --radius-lg: 16px;

  /* every top-bar control shares this height, so icon-only buttons
     and text buttons line up regardless of their content */
  --ctl-h: 38px;

  --sidebar-w: 268px;
  --toc-w: 208px;
  --content-max: 820px;
  /* one reading width for prose, lists, steps and callouts, so their right
     edges line up instead of stepping in and out down the page */
  --measure: 45rem;

  --font: "SUIT Variable", "Pretendard Variable", Pretendard, -apple-system,
    BlinkMacSystemFont, "Segoe UI", "Apple SD Gothic Neo", "Malgun Gothic",
    system-ui, sans-serif;
  --mono: "SFMono-Regular", ui-monospace, "JetBrains Mono", Consolas,
    "Liberation Mono", Menlo, monospace;

  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
}

/* SUIT covers Latin and Hangul but not kana, kanji or hanzi, so the Japanese
   and Chinese editions name their own system faces rather than falling through
   to the browser's last resort. */

:root:lang(ja) {
  --font: "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Yu Gothic UI",
    "Yu Gothic", Meiryo, "Noto Sans JP", -apple-system, BlinkMacSystemFont,
    system-ui, sans-serif;
}

:root:lang(zh) {
  --font: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei",
    "Noto Sans SC", "Source Han Sans SC", -apple-system, BlinkMacSystemFont,
    system-ui, sans-serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 15.5px;
  line-height: 1.72;
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  word-break: keep-all;
  overflow-wrap: anywhere;
}

img,
video {
  max-width: 100%;
  display: block;
}

a {
  color: var(--violet-bright);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
  text-decoration-thickness: from-font;
  text-underline-position: from-font;
  text-decoration-skip-ink: auto;
  text-underline-offset: 2px;
}

button {
  font: inherit;
  color: inherit;
  cursor: pointer;
}

:focus-visible {
  outline: 2px solid var(--violet);
  outline-offset: 2px;
  border-radius: 4px;
}

.skip-link {
  position: fixed;
  left: -9999px;
  top: 12px;
  z-index: 200;
  padding: 0.6rem 1rem;
  background: var(--violet);
  color: #10091f;
  font-weight: 700;
  border-radius: 8px;
}

.skip-link:focus {
  left: 12px;
}

/* ------------------------------------------------------------
   Icons — Disarto Icons (MIT, © Disarto), one set for this site's
   own chrome. The playback-bar legend keeps lucide-style marks
   because those depict ScriptPlayer+'s own buttons, not this site's.
   ------------------------------------------------------------ */

.icon-sprite {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}

svg use {
  fill: currentColor;
}

/* visually hidden, still read by assistive tech */
.vh {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

/* Ambient background ---------------------------------------- */

.page-bg {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background: var(--bg);
}

/* ============================================================
   Top bar
   ============================================================ */

.topbar {
  position: sticky;
  top: 0;
  z-index: 60;
  height: 60px;
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0 1.15rem;
  /* No divider rule — the sidebar has none either. Content passes under
     the bar, so the ground is opaque enough to keep the controls legible
     and the blur only softens what shows at the edges. */
  background: rgba(10, 12, 17, 0.92);
  backdrop-filter: saturate(150%) blur(14px);
  -webkit-backdrop-filter: saturate(150%) blur(14px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  color: var(--text);
  font-weight: 800;
  letter-spacing: -0.025em;
  font-size: 1.02rem;
  flex-shrink: 0;
}

.brand:hover {
  text-decoration: none;
}

.brand img {
  width: 26px;
  height: 26px;
  border-radius: 7px;
}

.topbar-spacer {
  flex: 1;
}

/* Search trigger */
.search-btn {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  min-width: 240px;
  height: var(--ctl-h);
  padding: 0 0.7rem;
  border-radius: 9px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text-3);
  font-size: 0.86rem;
  transition: border-color 0.15s var(--ease), background 0.15s var(--ease);
}

.search-btn:hover {
  border-color: var(--line-strong);
  background: var(--surface-2);
}

.search-btn svg {
  flex-shrink: 0;
  opacity: 0.8;
}

.search-btn .kbd-hint {
  margin-left: auto;
  font-family: var(--mono);
  font-size: 0.7rem;
  padding: 0.08rem 0.32rem;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: var(--bg);
  color: var(--text-3);
}

/* ---- Language switcher ---- */

.lang-switch {
  display: flex;
  align-items: center;
  height: var(--ctl-h);
  padding: 3px;
  gap: 2px;
  border-radius: 9px;
  border: 1px solid var(--line);
  background: var(--surface);
  flex-shrink: 0;
}

.lang-switch a {
  display: inline-flex;
  align-items: center;
  height: 100%;
  padding: 0 0.6rem;
  border-radius: 6px;
  font-size: 0.79rem;
  font-weight: 600;
  color: var(--text-3);
  white-space: nowrap;
  transition: color 0.14s var(--ease), background 0.14s var(--ease);
}

.lang-switch a:hover {
  color: var(--text);
  background: var(--surface-2);
  text-decoration: none;
}

.lang-switch a[aria-current="true"] {
  color: var(--text);
  background: var(--surface-3);
}

.top-links {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.tlink {
  display: inline-flex;
  align-items: center;
  gap: 0.42rem;
  height: var(--ctl-h);
  padding: 0 0.78rem;
  border-radius: 8px;
  font-size: 0.83rem;
  font-weight: 600;
  border: 1px solid var(--line);
  color: var(--text-2);
  transition: color 0.15s var(--ease), border-color 0.15s var(--ease),
    background 0.15s var(--ease);
}

.tlink:hover {
  color: var(--text);
  border-color: var(--line-strong);
  background: var(--surface);
  text-decoration: none;
}

.tlink svg {
  flex-shrink: 0;
}

/* live star count pulled from the GitHub API.
   The rule separates the repo name from its count; it is only needed
   because the label is present. */
.tlink .stars {
  display: inline-flex;
  align-items: center;
  gap: 0.22rem;
  padding-left: 0.5rem;
  border-left: 1px solid var(--line-strong);
  font-family: var(--mono);
  font-size: 0.78rem;
  font-weight: 600;
  line-height: 1;
  color: var(--text-3);
  font-variant-numeric: tabular-nums;
}

.tlink .stars svg {
  /* optical nudge: the star's point sits high against the digits */
  margin-top: -1px;
}

.tlink:hover .stars {
  color: var(--text-2);
}

.tlink--dl {
  background: var(--violet);
  border-color: var(--violet);
  color: #17092e;
  font-weight: 700;
}

.tlink--dl:hover {
  background: var(--violet-bright);
  border-color: var(--violet-bright);
  color: #17092e;
}

.nav-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  width: var(--ctl-h);
  height: var(--ctl-h);
  padding: 0;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--surface);
  line-height: 0;
}

/* ============================================================
   Shell layout
   ============================================================ */

.shell {
  display: grid;
  grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
  align-items: start;
  max-width: 1560px;
  margin: 0 auto;
}

/* ---- Sidebar ---- */

.sidebar {
  position: sticky;
  top: 60px;
  height: calc(100vh - 60px);
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 1.5rem 0.75rem 3rem 1.15rem;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.sidebar::-webkit-scrollbar {
  width: 0;
  height: 0;
}

.nav-group + .nav-group {
  margin-top: 1.5rem;
}

.nav-group > h4 {
  margin: 0 0 0.5rem;
  padding-left: 0.7rem;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: var(--text-3);
}

.nav-group ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.42rem 0.7rem;
  border-radius: 8px;
  color: var(--text-2);
  font-size: 0.895rem;
  line-height: 1.4;
  transition: background 0.13s var(--ease), color 0.13s var(--ease);
}

.nav-link:hover {
  background: var(--surface);
  color: var(--text);
  text-decoration: none;
}

.nav-link.is-active {
  background: var(--violet-soft);
  color: var(--violet-bright);
  font-weight: 650;
}

.nav-link .n {
  font-family: var(--mono);
  font-size: 0.7rem;
  color: var(--text-3);
  min-width: 1.1em;
}

.nav-link.is-active .n {
  color: var(--violet);
}

/* ---- Main column ---- */

.main-col {
  display: grid;
  grid-template-columns: minmax(0, 1fr) var(--toc-w);
  gap: 2.5rem;
  padding: 2.5rem 2rem 5rem;
}

.content {
  max-width: var(--content-max);
  min-width: 0;
}

/* ---- On-this-page TOC ---- */

.toc {
  position: sticky;
  top: 84px;
  align-self: start;
  max-height: calc(100vh - 110px);
  overflow-y: auto;
  font-size: 0.83rem;
  scrollbar-width: none;
}

.toc::-webkit-scrollbar {
  display: none;
}

.toc h5 {
  margin: 0 0 0.65rem;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: var(--text-3);
}

.toc ul {
  list-style: none;
  margin: 0;
  padding: 0;
  border-left: 1px solid var(--line);
}

/* The left rule is the scroll position indicator, not decoration:
   it marks which section of the current page you are reading. */
.toc a {
  display: block;
  padding: 0.28rem 0 0.28rem 0.85rem;
  margin-left: -1px;
  border-left: 2px solid transparent;
  color: var(--text-3);
  line-height: 1.45;
}

.toc a:hover {
  color: var(--text-2);
  text-decoration: none;
}

.toc a.is-active {
  color: var(--violet-bright);
  border-left-color: var(--violet);
  font-weight: 600;
}

/* ============================================================
   Page / typography
   ============================================================ */

.page {
  display: none;
  animation: fade 0.16s var(--ease);
}

.page.is-active {
  display: block;
}

@keyframes fade {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

.eyebrow {
  display: inline-block;
  margin-bottom: 0.7rem;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: var(--violet);
}

.page > h1 {
  text-wrap: balance;
  margin: 0 0 0.65rem;
  font-size: clamp(1.85rem, 3.2vw, 2.4rem);
  line-height: 1.2;
  letter-spacing: -0.035em;
  font-weight: 800;
}

.content .lede {
  text-wrap: pretty;
  margin: 0 0 2.4rem;
  font-size: 1.06rem;
  line-height: 1.68;
  color: var(--text-2);
  max-width: var(--measure);
}

.content h2 {
  text-wrap: balance;
  margin: 3.2rem 0 1rem;
  padding-top: 1.6rem;
  border-top: 1px solid var(--line);
  font-size: 1.38rem;
  letter-spacing: -0.025em;
  font-weight: 750;
  scroll-margin-top: 80px;
}

.content h2:first-of-type {
  margin-top: 0;
  padding-top: 0;
  border-top: none;
}

.content h3 {
  text-wrap: balance;
  margin: 2.1rem 0 0.7rem;
  font-size: 1.04rem;
  font-weight: 700;
  letter-spacing: -0.015em;
  scroll-margin-top: 80px;
}

.content h4 {
  margin: 1.5rem 0 0.5rem;
  font-size: 0.94rem;
  font-weight: 700;
  color: var(--text);
}

.content p {
  margin: 0 0 1rem;
  color: var(--text-2);
  max-width: var(--measure);
}

.content > p strong,
li strong {
  color: var(--text);
  font-weight: 650;
}

.content ul,
.content ul {
  max-width: var(--measure);
}

.content ol {
  margin: 0 0 1.15rem;
  padding-left: 1.25rem;
  color: var(--text-2);
  max-width: var(--measure);
}

.content li {
  margin-bottom: 0.42rem;
}

.content li::marker {
  color: var(--text-3);
}

.content ul ul,
.content ol ol {
  margin: 0.42rem 0 0.2rem;
}

hr {
  margin: 2.5rem 0;
  border: none;
  border-top: 1px solid var(--line);
}

/* Anchor link on headings */
.anchor {
  margin-left: 0.45rem;
  color: var(--text-3);
  font-weight: 400;
  opacity: 0;
  transition: opacity 0.15s;
  font-size: 0.85em;
}

h2:hover .anchor,
h3:hover .anchor,
.anchor:focus {
  opacity: 1;
}

/* Inline code */
code {
  font-family: var(--mono);
  font-size: 0.855em;
  padding: 0.12em 0.4em;
  border-radius: 5px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  color: #d9c9ff;
  word-break: break-word;
}

a code {
  color: inherit;
}

pre {
  margin: 0 0 1.2rem;
  padding: 1rem 1.1rem;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--bg-soft);
  overflow-x: auto;
  font-size: 0.85rem;
  line-height: 1.65;
}

pre code {
  padding: 0;
  border: none;
  background: none;
  color: var(--text-2);
  font-size: inherit;
}

/* Keyboard keys */
kbd {
  display: inline-block;
  font-family: var(--mono);
  font-size: 0.78em;
  font-weight: 600;
  line-height: 1.5;
  padding: 0.15em 0.45em;
  min-width: 1.9em;
  text-align: center;
  color: var(--text);
  background: linear-gradient(180deg, var(--surface-3), var(--surface));
  border: 1px solid var(--line-strong);
  border-bottom-width: 2px;
  border-radius: 6px;
  white-space: nowrap;
}

/* ============================================================
   Callouts
   The left rule encodes severity (note / tip / warn / danger) and is
   squared on the accent side, so it reads as a marginal rule rather
   than a striped card.
   ============================================================ */

.note {
  --c: var(--violet);
  position: relative;
  margin: 1.4rem 0;
  padding: 0.95rem 1.1rem 0.95rem 1.15rem;
  border: 1px solid var(--line);
  border-left: 3px solid var(--c);
  border-radius: 0 var(--radius) var(--radius) 0;
  background: var(--surface);
  font-size: 0.92rem;
  max-width: var(--measure);
}

.note > :last-child {
  margin-bottom: 0;
}

.note p {
  color: var(--text-2);
  margin-bottom: 0.5rem;
}

.note ul {
  margin-bottom: 0;
  font-size: 0.96em;
}

.note-title {
  display: flex;
  align-items: center;
  gap: 0.42rem;
  margin-bottom: 0.35rem;
  font-weight: 700;
  font-size: 0.87rem;
  color: var(--c);
  letter-spacing: -0.01em;
}

.note-ico {
  flex-shrink: 0;
  /* optical nudge: the marks sit a hair high against cap height */
  margin-top: 1px;
}

/* Icons in the left-rail reference table show the reader the exact
   mark to look for in the app, so they carry content, not decoration. */
.col-icon {
  width: 1%;
  padding-right: 0 !important;
  color: var(--text-2);
}

.rail-ico {
  display: block;
}

.note--tip {
  --c: var(--green);
}
.note--warn {
  --c: var(--amber);
}
.note--danger {
  --c: var(--red);
}

/* ============================================================
   Media figures
   ============================================================ */

figure {
  margin: 1.6rem 0 1.8rem;
}

.figure-compact {
  max-width: 300px;
}

.shot {
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 1px solid var(--line);
  background: var(--bg-soft);
}

.shot img,
.shot video {
  width: 100%;
  height: auto;
  display: block;
  cursor: zoom-in;
  background: #000;
}

.shot video {
  cursor: default;
}

figcaption {
  text-wrap: pretty;
  margin-top: 0.7rem;
  font-size: 0.845rem;
  line-height: 1.55;
  color: var(--text-3);
}

.media-grid {
  display: grid;
  gap: 1.2rem;
  margin: 1.6rem 0 1.8rem;
}

@media (min-width: 720px) {
  .media-grid.cols-2 {
    grid-template-columns: 1fr 1fr;
  }
}

.media-grid figure {
  margin: 0;
}

/* swipeable demo strip: the next clip peeks in so it reads as scrollable */
.reel {
  max-width: var(--measure);
  margin: 1.6rem 0 2rem;
}

.reel-track {
  display: flex;
  gap: 0.9rem;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scroll-behavior: smooth;
  overscroll-behavior-x: contain;
  scrollbar-width: none;
}

.reel-track::-webkit-scrollbar {
  display: none;
}

.reel-track:focus-visible {
  outline: 2px solid var(--violet);
  outline-offset: 3px;
}

.reel-item {
  flex: 0 0 86%;
  margin: 0;
  scroll-snap-align: start;
}

.reel-bar {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin-top: 0.8rem;
}

.reel-btn {
  display: inline-grid;
  place-items: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--text-2);
  font: inherit;
  font-size: 1rem;
  line-height: 1;
  cursor: pointer;
  transition: color 0.15s var(--ease), background-color 0.15s var(--ease);
}

.reel-btn:hover:not(:disabled) {
  color: var(--text);
  background: var(--surface-3);
}

.reel-btn:disabled {
  opacity: 0.35;
  cursor: default;
}

.reel-count {
  min-width: 3.2rem;
  text-align: center;
  font-size: 0.8rem;
  font-variant-numeric: tabular-nums;
  color: var(--text-3);
}

@media (prefers-reduced-motion: reduce) {
  .reel-track {
    scroll-behavior: auto;
  }
}

/* video placeholder before load */
.shot video[data-src] {
  aspect-ratio: 16 / 9;
}

/* ============================================================
   Cards / grids
   ============================================================ */

.cards {
  display: grid;
  gap: 0.9rem;
  margin: 1.5rem 0 1.8rem;
}

@media (min-width: 640px) {
  .cards.cols-2 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .cards.cols-3 {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

.card {
  padding: 1.1rem 1.15rem;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--surface);
  transition: border-color 0.16s var(--ease), transform 0.16s var(--ease);
}

a.card:hover {
  border-color: var(--line-strong);
  background: var(--surface-2);
  text-decoration: none;
}

.card h3,
.card h4 {
  margin: 0 0 0.4rem;
  font-size: 0.97rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.015em;
}

.card p {
  margin: 0;
  font-size: 0.875rem;
  color: var(--text-2);
  line-height: 1.6;
}

.card .ico {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  margin-bottom: 0.7rem;
  border-radius: 7px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  color: var(--text-3);
}

/* Definition list — used where a set of terms is being explained,
   in place of a row of identical icon+heading cards. */

.deflist {
  margin: 1.5rem 0 1.8rem;
  border-top: 1px solid var(--line);
  max-width: var(--measure);
}

.deflist > div {
  display: grid;
  gap: 0.15rem 1.5rem;
  padding: 0.85rem 0;
  border-bottom: 1px solid var(--line);
}

@media (min-width: 700px) {
  .deflist > div {
    grid-template-columns: 12rem minmax(0, 1fr);
    align-items: baseline;
  }
}

.deflist dt {
  font-weight: 650;
  font-size: 0.94rem;
  letter-spacing: -0.015em;
  color: var(--text);
}

.deflist dd {
  margin: 0;
  font-size: 0.9rem;
  color: var(--text-2);
  line-height: 1.62;
}

/* Numbered steps */
.steps {
  counter-reset: step;
  list-style: none;
  margin: 1.6rem 0 2rem;
  padding: 0;
  max-width: var(--measure);
}

.steps > li {
  counter-increment: step;
  position: relative;
  margin: 0;
  padding: 0 0 1.6rem 2.6rem;
}

.steps > li:last-child {
  padding-bottom: 0;
}

.steps > li::before {
  content: counter(step);
  position: absolute;
  inset-inline-start: 0;
  top: 0;
  width: 1.7rem;
  height: 1.7rem;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--bg-soft);
  border: 1px solid var(--line-strong);
  color: var(--violet-bright);
  font-family: var(--mono);
  font-size: 0.8rem;
  font-weight: 700;
}

.steps h3 {
  margin: 0 0 0.35rem;
  font-size: 1rem;
}

.steps p:last-child,
.steps ul:last-child {
  margin-bottom: 0;
}

/* ============================================================
   Tables
   ============================================================ */

.table-wrap {
  margin: 1.4rem 0 1.8rem;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.885rem;
}

thead th {
  position: sticky;
  top: 0;
  text-align: left;
  padding: 0.72rem 1rem;
  background: var(--surface-2);
  border-bottom: 1px solid var(--line);
  font-weight: 700;
  font-size: 0.78rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-3);
  white-space: nowrap;
}

tbody td {
  padding: 0.72rem 1rem;
  border-bottom: 1px solid var(--line);
  color: var(--text-2);
  vertical-align: top;
}

tbody tr:last-child td {
  border-bottom: none;
}

tbody tr:hover td {
  background: rgba(255, 255, 255, 0.018);
}

td strong {
  color: var(--text);
  font-weight: 650;
}

.col-key {
  white-space: nowrap;
  width: 1%;
}

/* ============================================================
   Playback bar legend (signature component)
   ============================================================ */

.legend {
  margin: 1.6rem 0 1.8rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  overflow: hidden;
}

.legend-row {
  display: grid;
  grid-template-columns: 82px minmax(0, 1fr);
  gap: 1rem;
  align-items: baseline;
  padding: 0.72rem 1rem;
  border-bottom: 1px solid var(--line);
}

.legend-row:last-child {
  border-bottom: none;
}

.legend-row:hover {
  background: rgba(255, 255, 255, 0.018);
}

.legend-key {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.2rem 0.5rem;
  border-radius: 7px;
  background: var(--surface-3);
  border: 1px solid var(--line-strong);
  font-family: var(--mono);
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--violet-bright);
  white-space: nowrap;
}

.legend-key--icon {
  padding: 0.26rem 0.55rem;
  color: var(--text-2);
}

.legend-key--icon svg {
  width: 14px;
  height: 14px;
  display: block;
}

.legend-desc {
  font-size: 0.885rem;
  color: var(--text-2);
  line-height: 1.6;
}

.legend-desc b {
  color: var(--text);
  font-weight: 650;
}

/* ============================================================
   Pills / badges
   ============================================================ */

.pill {
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.12rem 0.55rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  border: 1px solid var(--line-strong);
  color: var(--text-2);
  background: var(--surface-2);
  vertical-align: middle;
  /* middle aligns to the x-height; lift it to the optical center of the text */
  position: relative;
  top: -0.14em;
}

h1 .pill,
h2 .pill,
h3 .pill {
  margin-left: 0.55rem;
  top: -0.24em;
}

.pill--new {
  color: var(--violet-bright);
  border-color: rgba(167, 139, 250, 0.4);
  background: var(--violet-soft);
}

.pill--exp {
  color: var(--amber);
  border-color: rgba(240, 180, 41, 0.35);
  background: rgba(240, 180, 41, 0.1);
}

.pill--win {
  color: #7cc4ff;
  border-color: rgba(124, 196, 255, 0.3);
  background: rgba(124, 196, 255, 0.09);
}

.pill--mac {
  color: #d7dae3;
}

.pill--linux {
  color: #f5b96b;
  border-color: rgba(245, 185, 107, 0.3);
  background: rgba(245, 185, 107, 0.09);
}

/* ============================================================
   Hero (home page)
   ============================================================ */

.hero {
  margin-bottom: 3rem;
}

.hero h1 {
  font-size: clamp(1.9rem, 3.6vw, 2.5rem);
  line-height: 1.18;
  letter-spacing: -0.038em;
  margin: 0 0 0.9rem;
  font-weight: 800;
  text-wrap: balance;
}

.hero-lede {
  text-wrap: pretty;
  font-size: 1.1rem;
  color: var(--text-2);
  max-width: 56ch;
  margin: 0 0 1.6rem;
}

.hero-cta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  margin-bottom: 1rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.62rem 1.2rem;
  border-radius: 9px;
  font-size: 0.92rem;
  font-weight: 700;
  border: 1px solid var(--line-strong);
  color: var(--text);
  transition: background 0.15s var(--ease), border-color 0.15s var(--ease),
    color 0.15s var(--ease);
}

.btn:hover {
  text-decoration: none;
  border-color: rgba(255, 255, 255, 0.28);
  background: var(--surface);
}

.btn--primary {
  background: var(--violet);
  border-color: var(--violet);
  color: #17092e;
}

.btn--primary:hover {
  background: var(--violet-bright);
  border-color: var(--violet-bright);
  color: #17092e;
}

.hero-meta {
  font-size: 0.85rem;
  color: var(--text-3);
}

/* Quick jump grid on home */
.jump {
  display: grid;
  gap: 0.75rem;
  margin: 1.5rem 0 0;
}

@media (min-width: 640px) {
  .jump {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.jump a {
  display: flex;
  gap: 0.85rem;
  align-items: flex-start;
  padding: 0.95rem 1.1rem;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
  transition: background 0.15s var(--ease), border-color 0.15s var(--ease);
}

.jump a:hover {
  border-color: rgba(167, 139, 250, 0.4);
  background: var(--surface-2);
  text-decoration: none;
  transform: translateY(-2px);
}

.jump .num {
  flex: 0 0 2ch;
  white-space: nowrap;
  overflow-wrap: normal;
  font-variant-numeric: tabular-nums;
  font-family: var(--mono);
  font-size: 0.74rem;
  font-weight: 700;
  color: var(--violet);
  padding-top: 0.18rem;
}

.jump b {
  display: block;
  font-size: 0.94rem;
  font-weight: 700;
  letter-spacing: -0.015em;
  margin-bottom: 0.12rem;
}

.jump span.d {
  display: block;
  font-size: 0.83rem;
  color: var(--text-3);
  line-height: 1.5;
}

/* ============================================================
   Prev / next footer nav
   ============================================================ */

.pager {
  display: grid;
  gap: 0.75rem;
  margin-top: 3.5rem;
  padding-top: 1.75rem;
  border-top: 1px solid var(--line);
}

@media (min-width: 640px) {
  .pager {
    grid-template-columns: 1fr 1fr;
  }
}

.pager a {
  display: block;
  padding: 0.9rem 1.1rem;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
  transition: background 0.15s var(--ease), border-color 0.15s var(--ease);
}

.pager a:hover {
  border-color: rgba(167, 139, 250, 0.4);
  text-decoration: none;
  background: var(--surface-2);
}

.pager .dir {
  display: block;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-3);
  margin-bottom: 0.15rem;
}

.pager .ttl {
  font-weight: 700;
  font-size: 0.94rem;
  letter-spacing: -0.015em;
}

.pager .next {
  text-align: right;
}

.pager .placeholder {
  visibility: hidden;
}

/* ============================================================
   Search overlay
   ============================================================ */

.search-overlay {
  position: fixed;
  inset: 0;
  z-index: 120;
  display: none;
  padding: 10vh 1rem 2rem;
  background: rgba(5, 6, 10, 0.72);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

.search-overlay.is-open {
  display: block;
  animation: fade 0.16s var(--ease);
}

.search-box {
  max-width: 620px;
  margin: 0 auto;
  border-radius: var(--radius-lg);
  border: 1px solid var(--line-strong);
  background: var(--surface);
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.6);
  overflow: hidden;
}

.search-input-row {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0.9rem 1.1rem;
  border-bottom: 1px solid var(--line);
}

.search-input-row svg {
  flex-shrink: 0;
  color: var(--text-3);
}

#searchInput {
  flex: 1;
  min-width: 0;
  background: none;
  border: none;
  color: var(--text);
  font-family: inherit;
  font-size: 1rem;
}

#searchInput::placeholder {
  color: var(--text-3);
}

.search-esc {
  font-family: var(--mono);
  font-size: 0.7rem;
  padding: 0.12rem 0.4rem;
  border: 1px solid var(--line);
  border-radius: 5px;
  color: var(--text-3);
}

.search-results {
  max-height: min(58vh, 460px);
  overflow-y: auto;
  padding: 0.45rem;
}

.search-results:empty {
  display: none;
}

.sr-item {
  display: block;
  width: 100%;
  text-align: left;
  padding: 0.6rem 0.8rem;
  border-radius: 9px;
  border: none;
  background: none;
  color: var(--text);
  transition: background 0.1s;
}

.sr-item:hover,
.sr-item.is-sel {
  background: var(--violet-soft);
}

.sr-crumb {
  display: block;
  font-size: 0.7rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--violet);
  font-weight: 700;
  margin-bottom: 0.12rem;
}

.sr-title {
  display: block;
  font-size: 0.92rem;
  font-weight: 650;
  letter-spacing: -0.015em;
  line-height: 1.4;
}

.sr-snip {
  display: block;
  font-size: 0.8rem;
  color: var(--text-3);
  line-height: 1.5;
  margin-top: 0.15rem;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.sr-item mark {
  background: rgba(167, 139, 250, 0.28);
  color: var(--violet-bright);
  border-radius: 3px;
  padding: 0 1px;
}

.search-empty {
  padding: 1.6rem 1rem;
  text-align: center;
  color: var(--text-3);
  font-size: 0.88rem;
}

/* ============================================================
   Lightbox
   ============================================================ */

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 150;
  display: none;
  place-items: center;
  padding: 2.5rem 1.5rem;
  background: rgba(4, 5, 8, 0.9);
  backdrop-filter: blur(4px);
  cursor: zoom-out;
}

.lightbox.is-open {
  display: grid;
  animation: fade 0.16s var(--ease);
}

.lightbox img {
  max-width: 100%;
  max-height: 100%;
  width: auto;
  border-radius: 10px;
  box-shadow: 0 30px 90px rgba(0, 0, 0, 0.7);
}

.lightbox-close {
  position: absolute;
  top: 1.1rem;
  right: 1.3rem;
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--text);
}

/* ============================================================
   Back to top
   ============================================================ */

.totop {
  position: fixed;
  right: 1.5rem;
  bottom: 1.5rem;
  z-index: 55;
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  border: 1px solid var(--line-strong);
  background: rgba(18, 22, 31, 0.9);
  backdrop-filter: blur(8px);
  color: var(--text-2);
  opacity: 0;
  pointer-events: none;
  transform: translateY(8px);
  transition: opacity 0.2s var(--ease), transform 0.2s var(--ease),
    color 0.2s var(--ease), border-color 0.2s var(--ease);
}

.totop.is-shown {
  opacity: 1;
  pointer-events: auto;
  transform: none;
}

.totop:hover {
  color: var(--text);
  border-color: var(--violet);
}

/* ============================================================
   Footer
   ============================================================ */

.site-footer {
  border-top: 1px solid var(--line);
  padding: 2rem 2rem 3rem;
  color: var(--text-3);
  font-size: 0.83rem;
}

.footer-inner {
  max-width: 1560px;
  margin: 0 auto;
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1.5rem;
  align-items: center;
  justify-content: space-between;
}

.footer-links {
  display: flex;
  gap: 1.2rem;
  flex-wrap: wrap;
}

.site-footer a {
  color: var(--text-3);
}

.site-footer a:hover {
  color: var(--text);
}

/* ============================================================
   Responsive
   ============================================================ */

@media (max-width: 1180px) {
  .main-col {
    grid-template-columns: minmax(0, 1fr);
  }
  .toc {
    display: none;
  }
}

@media (max-width: 900px) {
  .top-links {
    display: none;
  }

  .shell {
    grid-template-columns: minmax(0, 1fr);
  }

  .nav-toggle {
    display: inline-flex;
  }

  .sidebar {
    position: fixed;
    top: 60px;
    left: 0;
    width: min(84vw, 300px);
    height: calc(100vh - 60px);
    z-index: 70;
    background: var(--bg-soft);
    transform: translateX(-102%);
    transition: transform 0.24s var(--ease);
    box-shadow: 20px 0 60px rgba(0, 0, 0, 0.5);
  }

  .sidebar.is-open {
    transform: none;
  }

  .nav-scrim {
    position: fixed;
    inset: 60px 0 0;
    z-index: 65;
    background: rgba(5, 6, 10, 0.6);
    display: none;
  }

  .nav-scrim.is-open {
    display: block;
  }

  .main-col {
    padding: 1.75rem 1.15rem 4rem;
  }

  .search-btn {
    min-width: 0;
    width: var(--ctl-h);
    padding: 0;
    justify-content: center;
  }

  .search-btn span,
  .search-btn .kbd-hint {
    display: none;
  }

  .brand span.name {
    display: none;
  }
}

@media (max-width: 480px) {
  .topbar {
    gap: 0.45rem;
    padding-inline: 0.65rem;
  }
  .nav-toggle,
  .search-btn {
    flex-shrink: 0;
  }
  .lang-switch a {
    padding-inline: 0.4rem;
  }
  body {
    font-size: 15px;
  }
  .legend-row {
    grid-template-columns: 1fr;
    gap: 0.3rem;
  }
  .legend-key {
    justify-self: start;
  }
  .site-footer {
    padding: 1.75rem 1.15rem 2.5rem;
  }
}

.table-scroll-hint {
  display: none;
}

.jump a > span:last-child {
  min-width: 0;
}

.nav-link .n {
  flex-shrink: 0;
  white-space: nowrap;
  overflow-wrap: normal;
}

.steps > li:not(:last-child)::after {
  content: "";
  position: absolute;
  inset-inline-start: 0.85rem;
  top: 2.05rem;
  bottom: 0.35rem;
  border-inline-start: 1px solid var(--line);
}

@media (max-width: 600px) {
  #page-external .table-wrap table {
    min-width: 540px;
  }
  #page-external .table-wrap td:first-child {
    min-width: 160px;
  }
  .table-scroll-hint {
    display: block;
    color: var(--text-3);
    font-size: 0.85rem;
    margin-bottom: 0.5rem;
  }
}

@media (max-width: 360px) {
  .topbar .brand {
    display: none;
  }
  .topbar {
    gap: 0.35rem;
  }
  .lang-switch a {
    padding-inline: 0.3rem;
    font-size: 0.74rem;
  }
}

@media print {
  .topbar,
  .sidebar,
  .toc,
  .pager,
  .totop,
  .nav-scrim {
    display: none !important;
  }
  .page {
    display: block !important;
  }
  body {
    background: #fff;
    color: #000;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
