/* ============================================================
   Tạp Chí Phố Wall - reference component CSS
   Part 1: the design language (copy these rules into a Vue SFC)
   Part 2: chrome for this documentation site (prefixed .ds-)
   ============================================================ */

/* ------------------------------------------------------------
   1. TYPE PRIMITIVES
   ------------------------------------------------------------ */

/* Eyebrow: the kicker line above any titled block. ◆ is a text node. */
.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 0.5em;
  font-family: var(--font-sans);
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-tertiary);
}
.eyebrow .mark { color: var(--text-primary); }

/* Micro-label: column headers, stat labels, field labels */
.micro-label {
  font-family: var(--font-sans);
  font-size: 0.64rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-secondary);
}
.micro-label--faint { color: var(--text-tertiary); }

/* Serif title ladder */
.title {
  font-family: var(--font-serif);
  font-weight: 600;
  line-height: 1.25;
  letter-spacing: -0.01em;
  color: var(--text-primary);
  text-wrap: balance;
}
.title--display { font-size: clamp(2.6rem, 7vw, 4rem); font-weight: 700; letter-spacing: -0.02em; line-height: 1; }
.title--sheet   { font-size: 1.55rem; line-height: 1.2; }
.title--section { font-size: 1.35rem; }
.title--card    { font-size: 1.2rem; line-height: 1.4; }
.title--minor   { font-size: 1.15rem; }

/* Italic serif = the "voice" register (reasoning, quotes, taglines) */
.voice {
  font-family: var(--font-serif);
  font-style: italic;
  font-weight: 600;
  font-size: 1.05rem;
  line-height: 1.6;
  color: var(--text-secondary);
}

/* Figures: tabular numerals always */
.figure {
  font-family: var(--font-serif);
  font-weight: 700;
  line-height: 0.95;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums lining-nums;
  color: var(--text-primary);
  white-space: nowrap;
}
.figure--lg { font-size: 3rem; }
.figure--md { font-size: 1.75rem; line-height: 1; letter-spacing: -0.01em; }
.figure--sans { font-family: var(--font-sans); letter-spacing: -0.03em; }
.num { font-variant-numeric: tabular-nums; }
.mono { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }

/* Hairline rules */
.rule { border: 0; border-top: 1px solid var(--border-color); margin: 2rem 0; }
.rule--strong { border-top-color: var(--text-primary); }
.rule--faint { border-top-color: var(--border-lighter); }
.rule--dashed { border-top-style: dashed; }
.rule--folio { border-top: 3px solid var(--text-primary); position: relative; }
.rule--folio::after { content: ''; position: absolute; left: 0; right: 0; top: 3px; height: 1px; background: var(--border-color); }

/* Semantic ink */
.pos { color: var(--positive-color); font-weight: 600; }
.neg { color: var(--negative-color); font-weight: 600; }
.warn { color: var(--warning-color); font-weight: 600; }
.muted { color: var(--text-secondary); }
.faint { color: var(--text-tertiary); }

/* ------------------------------------------------------------
   2. BUTTONS - squared ink
   ------------------------------------------------------------ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  height: 44px;
  padding: 0 1.5rem;
  border: 1px solid var(--text-primary);
  border-radius: 0;
  background: var(--text-primary);
  color: var(--bg-color);
  font-family: var(--font-sans);
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}
.btn svg { width: 14px; height: 14px; flex-shrink: 0; }
.btn:hover:not(:disabled) { background: var(--primary-hover); border-color: var(--primary-hover); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn:focus-visible { outline: 2px solid var(--accent-color); outline-offset: 2px; }

/* Ink that inverts on hover (masthead login, plan CTA) */
.btn--invert:hover:not(:disabled) { background: transparent; color: var(--text-primary); border-color: var(--text-primary); }

/* Ghost: hairline frame, ink on hover */
.btn--ghost { background: transparent; color: var(--text-primary); border-color: var(--border-color); }
.btn--ghost:hover:not(:disabled) { background: transparent; color: var(--text-primary); border-color: var(--text-primary); }

/* Outline: ink frame, fills on hover (footer back-to-top) */
.btn--outline { background: transparent; color: var(--text-primary); }
.btn--outline:hover:not(:disabled) { background: var(--text-primary); color: var(--bg-color); border-color: var(--text-primary); }

/* Quiet: hairline, accent fill on hover (calendar CTA). Note the 2px radius. */
.btn--quiet { background: transparent; color: var(--text-primary); border-color: var(--border-color); border-radius: 2px; font-size: 0.68rem; letter-spacing: 0.1em; height: auto; padding: 10px 28px; }
.btn--quiet:hover:not(:disabled) { background: var(--accent-color); color: #fff; border-color: var(--accent-color); }

/* Sizes */
.btn--sm { height: 38px; padding: 0 1.1rem; font-size: 0.72rem; letter-spacing: 0.1em; }
.btn--xs { height: 30px; padding: 0 12px; font-size: 0.66rem; letter-spacing: 0.1em; }
.btn--block { width: 100%; }

/* Text link with arrow */
.link-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--text-tertiary);
  font-family: var(--font-sans);
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  cursor: pointer;
  background: none;
  border: 0;
  transition: color 0.2s ease;
}
.link-btn::after { content: '→'; font-size: 0.85rem; transition: transform 0.25s ease; }
.link-btn:hover { color: var(--accent-color); }
.link-btn:hover::after { transform: translateX(3px); }

/* Square icon button */
.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  background: transparent;
  border: 1px solid var(--border-color);
  border-radius: 0;
  color: var(--text-secondary);
  cursor: pointer;
  transition: border-color 0.15s ease, color 0.15s ease, background 0.15s ease;
}
.icon-btn svg { width: 16px; height: 16px; }
.icon-btn:hover:not(:disabled) { color: var(--text-primary); border-color: var(--text-primary); }
.icon-btn--bare { border-color: transparent; width: 40px; height: 40px; color: var(--text-primary); }
.icon-btn--bare:hover:not(:disabled) { background: var(--surface-2); border-color: transparent; }
.icon-btn:disabled { opacity: 0.4; cursor: not-allowed; }
.icon-btn:focus-visible { outline: 2px solid var(--accent-color); outline-offset: 2px; }

/* ------------------------------------------------------------
   3. SEGMENTED CONTROLS AND TABS
   ------------------------------------------------------------ */

/* Divided box (footer language / theme) */
.seg { display: inline-flex; height: 30px; border: 1px solid var(--border-color); }
.seg-btn {
  height: 100%;
  padding: 0 11px;
  background: none;
  border: 0;
  border-right: 1px solid var(--border-color);
  border-radius: 0;
  font-family: var(--font-sans);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-secondary);
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}
.seg-btn:last-child { border-right: 0; }
.seg-btn:hover { background: var(--surface-2); color: var(--text-primary); }
.seg-btn.is-active { background: var(--text-primary); color: var(--bg-color); }
.seg-btn:focus-visible { outline: 2px solid var(--text-primary); outline-offset: -2px; }
.seg-btn--icon { width: 32px; padding: 0; display: inline-flex; align-items: center; justify-content: center; }
.seg-btn--icon svg { width: 14px; height: 14px; }

/* Sliding ink thumb (billing cycle) */
.segmented {
  position: relative;
  display: inline-grid;
  grid-template-columns: 1fr 1fr;
  padding: 3px;
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: 3px;
  isolation: isolate;
  max-width: 100%;
}
.segmented__thumb {
  position: absolute;
  top: 3px; bottom: 3px; left: 3px;
  width: calc(50% - 3px);
  background: var(--text-primary);
  border-radius: 2px;
  z-index: 0;
  transition: transform 0.35s var(--ease-thumb);
}
.segmented[data-active="b"] .segmented__thumb { transform: translateX(100%); }
.segmented button {
  position: relative;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 38px;
  padding: 0 20px;
  border: none;
  border-radius: 2px;
  background: transparent;
  color: var(--text-secondary);
  font-family: var(--font-sans);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  white-space: nowrap;
  cursor: pointer;
  transition: color 0.25s ease;
}
.segmented button:hover { color: var(--text-primary); }
.segmented button.active { color: var(--bg-color); }
.segmented button:focus-visible { outline: 2px solid var(--accent-color); outline-offset: 2px; }
.segmented .save {
  padding: 2px 6px;
  border-radius: 2px;
  font-size: 0.56rem;
  letter-spacing: 0.06em;
  background: rgba(16, 185, 129, 0.12);
  color: #059669;
}
.segmented button.active .save { background: color-mix(in srgb, currentColor 18%, transparent); color: inherit; }

/* Underline tabs */
.tabs { display: flex; gap: 0; border-bottom: 1px solid var(--border-color); overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab {
  padding: 10px 20px;
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  font-family: var(--font-sans);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-secondary);
  white-space: nowrap;
  cursor: pointer;
  transition: color 0.2s ease, border-color 0.2s ease;
}
.tab:hover { color: var(--text-primary); }
.tab.active { color: var(--accent-color); border-bottom-color: var(--accent-color); }
.tab.active--ink { color: var(--text-primary); border-bottom-color: var(--text-primary); }
.tab:focus-visible { outline: 2px solid var(--accent-color); outline-offset: -2px; }

/* ------------------------------------------------------------
   4. FORMS
   ------------------------------------------------------------ */
.field { display: flex; flex-direction: column; gap: 6px; }
.field-label {
  font-size: 0.5625rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-tertiary);
}

.input {
  width: 100%;
  min-height: 44px;
  padding: 0 0.875rem;
  background: var(--input-bg);
  border: 1px solid var(--border-color);
  border-radius: 0;
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 15px;
  letter-spacing: 0.01em;
  outline: none;
  transition: border-color 0.2s ease, background 0.2s ease;
}
.input::placeholder { color: var(--text-tertiary); }
.input:hover { border-color: var(--text-tertiary); }
.input:focus { border-color: var(--text-primary); background: var(--bg-color); }
.input:disabled { opacity: 0.6; cursor: not-allowed; }
@media (max-width: 768px) { .input { font-size: 16px; } } /* iOS zoom guard */

/* Affixed numeric input */
.input-wrap {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 0 0.6rem;
  min-height: 36px;
  background: var(--surface-1);
  border: 1px solid var(--border-color);
  border-radius: 0;
  transition: border-color 0.15s ease;
}
.input-wrap:focus-within { border-color: var(--text-primary); }
.input-wrap input {
  border: none; background: transparent; outline: none;
  width: 5.5rem;
  font-family: var(--font-sans);
  font-size: 0.8rem;
  color: var(--text-primary);
  font-variant-numeric: tabular-nums;
  -moz-appearance: textfield;
}
.input-wrap input::-webkit-inner-spin-button, .input-wrap input::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
.input-wrap .pfx, .input-wrap .sfx { font-size: 0.65rem; font-weight: 600; color: var(--text-tertiary); user-select: none; }

/* Select trigger */
.select-trigger {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  padding: 8px 11px;
  min-height: 38px;
  text-align: left;
  cursor: pointer;
  background: var(--input-bg);
  border: 1px solid var(--border-color);
  border-radius: 0;
  font-family: var(--font-sans);
  font-size: 13px;
  color: var(--text-primary);
  transition: border-color 0.15s, background 0.15s, box-shadow 0.15s;
}
.select-trigger svg { width: 14px; height: 14px; color: var(--text-tertiary); transition: transform 0.2s ease; }
.select-trigger:hover { border-color: var(--text-tertiary); }
.select-trigger.open { border-color: var(--accent-color); box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.12); }
.select-trigger.open svg { transform: rotate(180deg); }
.select-trigger.has-value { border-color: var(--accent-color); background: color-mix(in srgb, var(--accent-color) 8%, var(--input-bg)); }
.select-menu {
  margin-top: 6px;
  background: var(--card-bg);
  border: 1px solid var(--border-light);
  border-radius: 0;
  box-shadow: 0 12px 32px rgba(0,0,0,0.16), 0 2px 8px rgba(0,0,0,0.06);
  padding: 4px;
  max-height: 260px;
  overflow: auto;
  overscroll-behavior: contain;
}
.select-option {
  padding: 8px 10px;
  font-size: 13px;
  border-radius: 0;
  cursor: pointer;
}
.select-option:hover { background: var(--hover-bg); }
.select-option.selected { background: rgba(16, 185, 129, 0.1); color: var(--accent-color); font-weight: 600; }

/* Drawn radio (view toggle) */
.check {
  display: inline-flex; align-items: center; gap: 0.4rem;
  padding: 0.3rem 0.625rem 0.3rem 0.5rem;
  border: 1px solid var(--border-color);
  border-radius: 100px;
  background: transparent;
  font-family: var(--font-sans);
  font-size: 0.71875rem;
  color: var(--text-secondary);
  cursor: pointer;
  transition: border-color 0.15s ease, color 0.15s ease;
}
.check-mark {
  position: relative;
  width: 12px; height: 12px;
  border-radius: 50%;
  border: 1.5px solid currentColor;
  flex-shrink: 0;
}
.check-mark::after {
  content: ''; position: absolute; left: 3px; top: 0.5px;
  width: 3px; height: 6px;
  border: solid var(--bg-color); border-width: 0 1.5px 1.5px 0;
  transform: rotate(45deg) scale(0);
  transition: transform 0.15s var(--ease-out);
}
.check.is-on { color: var(--text-primary); border-color: var(--text-primary); }
.check.is-on .check-mark { background: var(--text-primary); border-color: var(--text-primary); }
.check.is-on .check-mark::after { transform: rotate(45deg) scale(1); }

/* Keyboard hint */
kbd.key {
  padding: 1px 5px;
  background: var(--surface-3);
  border: 1px solid var(--border-color);
  border-bottom-width: 2px;
  border-radius: 4px;
  font-family: var(--font-mono);
  font-size: 0.63rem;
  color: var(--text-secondary);
}

/* ------------------------------------------------------------
   5. CHIPS, STAMPS, BADGES
   ------------------------------------------------------------ */

/* Editorial pill - metadata only, never a control */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.15rem 0.5rem;
  background: transparent;
  border: 1px solid var(--border-color);
  border-radius: 100px;
  font-family: var(--font-sans);
  font-size: 0.6875rem;
  font-weight: 500;
  letter-spacing: 0.01em;
  white-space: nowrap;
  color: var(--text-secondary);
}
.chip--filled { background: var(--surface-2); }
.chip--label { font-size: 0.5625rem; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; padding: 0.1rem 0.45rem; }

/* Square stamp - status marks, plan tags, beta */
.stamp {
  display: inline-flex;
  align-items: center;
  padding: 3px 7px;
  border: 1px solid var(--border-color);
  border-radius: 0;
  font-family: var(--font-sans);
  font-size: 0.56rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-tertiary);
  white-space: nowrap;
}
.stamp--mono { font-family: var(--font-mono); padding: 2px 6px; }
.stamp--ink { color: var(--text-primary); border-color: var(--text-primary); }
.stamp--accent { color: #059669; border-color: rgba(16,185,129,0.4); background: rgba(16,185,129,0.06); }
[data-theme="dark"] .stamp--accent { color: #34d399; }
.stamp--fill { background: var(--accent-color); color: #fff; border-color: var(--accent-color); border-radius: 2px; font-size: 0.6rem; font-weight: 800; letter-spacing: 0.14em; }
.stamp--short { color: #ef4444; border-color: currentColor; border-radius: 3px; font-size: 0.5625rem; letter-spacing: 0.1em; padding: 0.1rem 0.35rem; }

/* Live dot: the only round thing in a squared frame */
.live-dot {
  display: inline-block;
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--accent-color);
  animation: breathe 1.8s ease-in-out infinite;
}
@keyframes breathe { 0%, 100% { opacity: 1; transform: scale(1); } 50% { opacity: 0.4; transform: scale(0.75); } }

/* Change chip (legacy idiom, 12px radius; document but do not extend) */
.value-change {
  display: inline-flex; align-items: center; gap: 2px;
  padding: 2px 8px; border-radius: 12px;
  font-size: 0.75rem; font-weight: 600; line-height: 1; white-space: nowrap;
}
.value-change.positive { color: var(--positive-color); background: var(--positive-bg); }
.value-change.negative { color: var(--negative-color); background: var(--negative-bg); }

/* ------------------------------------------------------------
   6. NOTICE, DIALOG, PROGRESS, USAGE
   ------------------------------------------------------------ */
.notice {
  --notice-ink: var(--text-primary);
  position: relative;
  font-family: var(--font-sans);
  color: var(--text-primary);
  padding: 1.25rem 1.25rem 1.25rem 1.5rem;
  border: 1px solid var(--border-color);
  background: var(--card-bg);
  max-width: 560px;
}
.notice::before {
  content: '';
  position: absolute; left: -1px; top: -1px; bottom: -1px;
  width: 3px;
  background: var(--notice-ink);
}
.notice.kind-error, .notice.kind-network { --notice-ink: var(--negative-color); }
.notice.kind-limit { --notice-ink: var(--warning-color); }
.notice .eyebrow .mark { color: var(--notice-ink); }
.notice .title { margin: 0.5rem 0 0.4rem; font-size: 1.3rem; line-height: 1.3; }
.notice p { font-size: 0.92rem; line-height: 1.6; color: var(--text-secondary); }
.notice-meta { margin-top: 0.6rem; font-size: 0.78rem; color: var(--text-tertiary); }
.notice-actions { display: flex; gap: 0.6rem; margin-top: 1.1rem; flex-wrap: wrap; }
.notice-actions:empty { display: none; }
@media (max-width: 480px) { .notice-actions { flex-direction: column; } .notice-actions .btn { width: 100%; } }

/* Dialog */
.dialog-scrim {
  position: fixed; inset: 0;
  z-index: var(--z-ai-dialog);
  display: flex; align-items: center; justify-content: center;
  padding: 16px;
  background: var(--overlay-background);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
  transition: opacity 0.18s ease;
}
.dialog {
  width: min(440px, 100%);
  padding: 1.75rem;
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  box-shadow: 0 24px 48px -28px rgba(0, 0, 0, 0.45);
  outline: none;
  transition: transform 0.22s var(--ease-out);
}
.dialog .title { font-size: 1.4rem; line-height: 1.3; margin: 0.5rem 0 0.5rem; }
.dialog p { font-size: 0.92rem; line-height: 1.6; color: var(--text-secondary); }
.dialog-actions {
  display: flex; justify-content: flex-end; gap: 0.6rem;
  margin-top: 1.5rem; padding-top: 1rem;
  border-top: 1px solid var(--border-color);
}
@media (max-width: 480px) { .dialog { padding: 1.4rem; } .dialog-actions { flex-direction: column-reverse; } .dialog-actions .btn { width: 100%; } }
.dialog-scrim[hidden] { display: none; }
.dialog-scrim.is-enter { opacity: 0; }
.dialog-scrim.is-enter .dialog { transform: translateY(12px); }

/* Index-bar progress */
.progress { max-width: 560px; }
.progress-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 0.6rem; }
.progress-head .eyebrow { color: var(--text-secondary); }
.progress-head .eyebrow .mark { animation: mark-pulse 2.4s ease-in-out infinite; }
.progress-step { color: var(--text-tertiary); letter-spacing: 0.1em; }
.progress-pct { font-family: var(--font-mono); font-size: 0.85rem; font-weight: 600; font-variant-numeric: tabular-nums; }
.progress-pct span { color: var(--text-tertiary); }
.progress-track {
  position: relative; height: 3px;
  background:
    repeating-linear-gradient(90deg,
      transparent 0,
      transparent calc(100% / var(--segments, 1) - 3px),
      var(--bg-color) calc(100% / var(--segments, 1) - 3px),
      var(--bg-color) calc(100% / var(--segments, 1))),
    var(--border-color);
  overflow: hidden;
}
.progress-fill { position: relative; height: 100%; background: var(--text-primary); transition: width 0.25s linear; overflow: hidden; }
.progress-sheen {
  position: absolute; inset: 0;
  background: linear-gradient(90deg, transparent, var(--bg-color) 50%, transparent);
  opacity: 0.55;
  transform: translateX(-100%);
  animation: sheen 2.2s ease-in-out infinite;
}
.progress-body { margin-top: 1.4rem; text-align: center; }
.progress-body .title { font-size: 1.2rem; line-height: 1.4; }
.progress-body p { margin-top: 0.4rem; font-size: 0.88rem; color: var(--text-secondary); }
.progress-reasoning { text-align: left; margin-top: 1.2rem; }
.progress-reasoning .voice { display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; font-size: 1rem; margin-top: 0.4rem; }
@keyframes sheen { 0% { transform: translateX(-100%); } 60%, 100% { transform: translateX(100%); } }
@keyframes mark-pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.35; } }

/* Usage badge (ledger line) */
.usage {
  --ub-ink: var(--accent-color);
  display: inline-flex; align-items: center; flex-wrap: wrap; gap: 0.45rem;
  font-family: var(--font-sans);
  font-size: 0.76rem; line-height: 1.2; min-height: 20px;
  color: var(--text-secondary);
}
.usage.state-low { --ub-ink: var(--warning-color); }
.usage.state-depleted { --ub-ink: var(--negative-color); }
.usage.state-credits, .usage.state-unlimited { --ub-ink: var(--text-primary); }
.usage .mark { font-size: 0.6rem; color: var(--ub-ink); }
.usage-figure { font-family: var(--font-mono); font-size: 0.82rem; font-weight: 600; font-variant-numeric: tabular-nums; color: var(--text-primary); }
.usage-figure span { color: var(--text-tertiary); font-weight: 500; }
.usage-meter { display: inline-block; width: 56px; height: 3px; background: var(--border-color); overflow: hidden; }
.usage-meter i { display: block; height: 100%; background: var(--ub-ink); transition: width 0.4s var(--ease-thumb); }
.usage.state-depleted .usage-label { color: var(--ub-ink); font-weight: 600; }
.usage-reset { color: var(--text-tertiary); white-space: nowrap; }

/* Streaming caret */
.caret::after {
  content: ''; display: inline-block; width: 0.5em; height: 1em; margin-left: 2px;
  background: var(--text-primary); vertical-align: -0.15em;
  animation: caret 1s steps(2, start) infinite;
}
@keyframes caret { to { visibility: hidden; } }

/* ------------------------------------------------------------
   7. TABLES AND STATEMENTS
   ------------------------------------------------------------ */
.table-scroll { overflow-x: auto; border: 1px solid var(--border-light); }
.table {
  width: 100%;
  border-collapse: collapse;
  font-family: var(--font-sans);
  font-size: 12px;
}
.table thead { position: sticky; top: 0; background: var(--surface-2); }
.table th {
  padding: 11px 12px;
  text-align: left;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--text-tertiary);
  white-space: nowrap;
  border-bottom: 1px solid var(--border-color);
  user-select: none;
}
.table th.sortable { cursor: pointer; transition: color 0.15s, background 0.15s; }
.table th.sortable:hover { color: var(--text-primary); background: var(--hover-bg); }
.table th.sorted { color: var(--accent-color); }
.table td {
  padding: 9px 12px;
  color: var(--text-primary);
  white-space: nowrap;
  vertical-align: middle;
  border-bottom: 1px solid var(--border-lighter);
  font-variant-numeric: tabular-nums;
}
.table th.r, .table td.r { text-align: right; }
.table tbody tr:nth-child(odd) { background: var(--surface-2); }
.table tbody tr:hover { background: color-mix(in srgb, var(--accent-color) 6%, var(--card-bg)); }
.table td.idx { color: var(--text-tertiary); font-size: 11px; text-align: right; }
.table td.sym { font-weight: 700; }

/* Prose table (AI markdown): bookended by two ink rules */
.prose-table { width: 100%; border-collapse: collapse; font-size: 0.9rem; font-variant-numeric: tabular-nums; }
.prose-table th { font-size: 0.66rem; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; text-align: left; white-space: nowrap; padding: 0.55rem 0.75rem; border-bottom: 1px solid var(--text-primary); color: var(--text-secondary); }
.prose-table td { padding: 0.55rem 0.75rem; border-bottom: 1px solid var(--border-color); vertical-align: top; }
.prose-table th:first-child, .prose-table td:first-child { padding-left: 0; }
.prose-table th:last-child, .prose-table td:last-child { padding-right: 0; }
.prose-table tr:last-child td { border-bottom-color: var(--text-primary); }

/* Statement hero: borderless figures on a subgrid */
.hero {
  display: grid;
  grid-template-columns: repeat(3, auto);
  column-gap: 3rem;
  padding: 0.25rem 0 1.5rem;
  justify-content: start;
}
.hero-figure { display: grid; grid-template-rows: subgrid; grid-row: span 2; row-gap: 0.5rem; align-items: baseline; min-width: 0; }
.hero-label { font-size: 0.625rem; font-weight: 600; letter-spacing: 0.12em; text-transform: uppercase; color: var(--text-tertiary); white-space: nowrap; }
@media (max-width: 768px) {
  .hero { grid-template-columns: 1fr 1fr; row-gap: 1.25rem; }
  .hero-figure:first-child { grid-column: 1 / -1; }
  .figure--lg { font-size: 2.5rem; }
}
@media (max-width: 380px) { .figure--lg { font-size: 2.125rem; } }

/* Ledger: two-column bordered statement */
.ledger {
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
  border-top: 1px solid var(--border-color);
  border-bottom: 1px solid var(--border-color);
}
.ledger > div { padding: 1rem 0; }
.ledger > div + div { border-left: 1px solid var(--border-color); padding-left: 1.75rem; }
.ledger-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1rem 1.5rem; }
.metric-label { font-size: 0.625rem; font-weight: 500; letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-tertiary); }
.metric-value { font-size: 1rem; font-weight: 600; font-variant-numeric: tabular-nums; line-height: 1.1; margin-top: 4px; }
@media (max-width: 768px) {
  .ledger { grid-template-columns: 1fr; }
  .ledger > div + div { border-left: 0; padding-left: 0; border-top: 1px solid var(--border-color); }
}

/* Overview card: 3px accent cap, faint ledger grid, mood glow */
.overview {
  --mood-rgb: 16, 185, 129;
  position: relative;
  isolation: isolate;
  border: 1px solid var(--border-color);
  border-top: 3px solid var(--accent-color);
  border-radius: 0;
  padding: 16px 20px 18px;
  overflow: hidden;
}
.overview.mood-positive { --mood-rgb: 45, 125, 50; }
.overview.mood-negative { --mood-rgb: 204, 51, 51; }
[data-theme="dark"] .overview.mood-positive { --mood-rgb: 76, 175, 80; }
[data-theme="dark"] .overview.mood-negative { --mood-rgb: 244, 67, 54; }
.overview::before {
  content: ''; position: absolute; inset: 0; z-index: -1; opacity: 0.5;
  background:
    linear-gradient(var(--border-color) 1px, transparent 1px) 0 0 / 28px 28px,
    linear-gradient(90deg, var(--border-color) 1px, transparent 1px) 0 0 / 28px 28px;
  -webkit-mask-image: radial-gradient(420px 220px at 0 0, #000, transparent 70%);
  mask-image: radial-gradient(420px 220px at 0 0, #000, transparent 70%);
}
.overview::after {
  content: ''; position: absolute; inset: 0; z-index: -1;
  background: radial-gradient(560px 280px at 3% 0%, rgba(var(--mood-rgb), 0.14), transparent 70%);
}
.overview-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.overview-sym { font-family: var(--font-serif); font-size: 2rem; font-weight: 700; letter-spacing: -0.02em; line-height: 1; }
.overview-name { font-size: 0.85rem; color: var(--text-secondary); margin-top: 6px; }
.overview-price { font-family: var(--font-sans); font-size: 1.75rem; font-weight: 700; letter-spacing: -0.03em; font-variant-numeric: tabular-nums; line-height: 1; text-align: right; }
.overview-change { font-size: 0.88rem; font-weight: 700; font-variant-numeric: tabular-nums; margin-top: 6px; text-align: right; }
.overview-meta { display: flex; gap: 16px; flex-wrap: wrap; margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--border-color); }
@media (max-width: 768px) { .overview-sym { font-size: 1.5rem; } }

/* ------------------------------------------------------------
   8. PLAN GRID (pricing)
   ------------------------------------------------------------ */
.plan-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1px;
  border: 1px solid var(--border-color);
  background: var(--border-color);
}
@media (max-width: 1100px) { .plan-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 768px) { .plan-grid { grid-template-columns: 1fr; } }
.plan {
  --ink: var(--text-tertiary); --ink-rgb: 107, 114, 128;
  position: relative;
  display: flex; flex-direction: column; min-width: 0;
  padding: 28px 24px 24px;
  background: var(--card-bg);
  font-family: var(--font-sans);
}
.plan::before { content: ''; position: absolute; top: 0; left: 0; right: 0; height: 2px; background: var(--ink); }
.plan-plus { --ink: #059669; --ink-rgb: 16, 185, 129; }
.plan-pro { --ink: #2563eb; --ink-rgb: 59, 130, 246; }
.plan-max { --ink: #b45309; --ink-rgb: 245, 158, 11; }
[data-theme="dark"] .plan-plus { --ink: #34d399; }
[data-theme="dark"] .plan-pro { --ink: #60a5fa; }
[data-theme="dark"] .plan-max { --ink: #fbbf24; }
.plan.is-featured { background: linear-gradient(rgba(var(--ink-rgb), 0.045), rgba(var(--ink-rgb), 0.045)), var(--card-bg); }
.plan.is-featured::before { height: 4px; }
.plan-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.plan-name { font-family: var(--font-serif); font-size: 1.3rem; font-weight: 700; line-height: 1; letter-spacing: -0.01em; color: var(--ink); }
.plan-tag { padding: 3px 7px; border: 1px solid rgba(var(--ink-rgb), 0.4); color: var(--ink); font-size: 0.56rem; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; }
.plan-price { margin: 18px 0 0; padding-bottom: 20px; border-bottom: 1px solid var(--border-color); }
.plan-amount { font-family: var(--font-serif); font-size: 2.6rem; font-weight: 700; line-height: 1; letter-spacing: -0.03em; font-variant-numeric: tabular-nums; }
.plan-amount small { font-size: 0.5em; font-weight: 600; vertical-align: 0.75em; }
.plan-period { font-size: 0.78rem; color: var(--text-secondary); margin-top: 6px; }
.plan-coffee { font-family: var(--font-serif); font-style: italic; font-size: 0.82rem; color: var(--text-tertiary); margin-top: 4px; }
.plan-list { list-style: none; display: flex; flex-direction: column; gap: 10px; padding: 20px 0; flex: 1; }
.plan-list li { display: flex; align-items: flex-start; gap: 10px; font-size: 0.86rem; line-height: 1.45; color: var(--text-secondary); }
.plan-list li svg { width: 14px; height: 14px; margin-top: 3px; color: var(--ink); flex-shrink: 0; }
.plan-list li.is-lead { color: var(--text-primary); font-weight: 600; padding-bottom: 10px; border-bottom: 1px solid var(--border-lighter); }
.plan .btn { width: 100%; border-radius: 2px; font-size: 0.7rem; }
@media (max-width: 768px) { .plan { padding: 22px 18px 20px; } .plan-amount { font-size: 2.2rem; } }

/* ------------------------------------------------------------
   9. POST CARDS - no chrome, dashed rules, container queries
   ------------------------------------------------------------ */
.post-grid-wrap { container-type: inline-size; width: 100%; }   /* the query container must be an ancestor */
.post-grid { display: grid; grid-template-columns: 1fr; }
.post-card { padding: 20px 0; border-top: 1px dashed var(--border-color); }
.post-card:first-child { border-top: 0; }
@container (min-width: 560px) {
  .post-grid { grid-template-columns: 1fr 1fr; }
  .post-card { padding: 20px; border-left: 1px dashed var(--border-color); }
  .post-card:nth-child(2) { border-top: 0; }
  .post-card:nth-child(2n+1) { border-left: 0; padding-left: 0; }
}
@container (min-width: 820px) {
  .post-grid { grid-template-columns: 1fr 1fr 1fr; }
  .post-card:nth-child(-n+3) { border-top: 0; }
  .post-card:nth-child(2n+1) { border-left: 1px dashed var(--border-color); padding-left: 20px; }
  .post-card:nth-child(3n+1) { border-left: 0; padding-left: 0; }
}
.post-img { aspect-ratio: 16 / 10; background: var(--input-bg); border-radius: 4px; overflow: hidden; margin-bottom: 14px; position: relative; }
.post-img::after { content: ''; position: absolute; inset: 0; background: linear-gradient(135deg, var(--surface-3), var(--input-bg)); transition: transform 0.55s cubic-bezier(0.25, 0.46, 0.45, 0.94); }
.post-card:hover .post-img::after { transform: scale(1.06); }
.post-title { font-size: 1rem; font-weight: 700; line-height: 1.35; text-wrap: balance; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; transition: color 0.25s ease; }
.post-card:hover .post-title { color: var(--accent-color); }
.post-desc { font-size: 0.8rem; line-height: 1.5; color: var(--text-secondary); margin-top: 6px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.post-meta { display: flex; align-items: center; gap: 8px; margin-top: 10px; font-size: 0.72rem; letter-spacing: 0.02em; font-variant-numeric: tabular-nums; }
.post-meta .author { color: var(--accent-color); font-weight: 500; }
.post-meta .date { color: var(--text-tertiary); }
.post-meta .sep { opacity: 0.4; }
.post-meta .stats { margin-left: auto; color: var(--text-tertiary); display: flex; gap: 12px; }

/* ------------------------------------------------------------
   10. MASTHEAD NAV + DROPDOWN PANEL (reference)
   ------------------------------------------------------------ */
.masthead {
  --nav-h: 64px;
  position: sticky; top: 0; z-index: 10000;
  background: var(--bg-color);
  border-bottom: 1px solid var(--border-color);
  transition: box-shadow 0.3s ease;
}
.masthead.is-scrolled { box-shadow: 0 10px 30px -24px rgba(0,0,0,0.35); }
[data-theme="dark"] .masthead.is-scrolled { box-shadow: 0 12px 32px -20px rgba(0,0,0,0.7); }
.masthead-inner {
  max-width: 1600px; margin: 0 auto; padding: 0 28px;
  height: var(--nav-h);
  display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 24px;
}
.brand { display: inline-flex; align-items: center; gap: 10px; }
.brand img { width: 30px; height: 30px; transition: transform 0.3s var(--ease-out); }
[data-theme="dark"] .brand img { filter: invert(1); }
.brand:hover img { transform: rotate(-8deg) scale(1.06); }
.brand-text { font-family: var(--font-brand); font-size: 21px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; line-height: 1; color: var(--text-primary); }
.nav-list { display: flex; height: var(--nav-h); align-items: stretch; }
.nav-link {
  position: relative;
  display: inline-flex; align-items: center;
  padding: 0 12px;
  font-family: var(--font-sans);
  font-size: 14px; font-weight: 500; letter-spacing: 0.01em;
  color: var(--text-secondary);
  transition: color 0.15s ease;
}
.nav-link::after {
  content: ''; position: absolute; left: 12px; right: 12px; bottom: -1px; height: 2px;
  background: var(--text-primary);
  transform: scaleX(0); transform-origin: left; opacity: 0.35;
  transition: transform 0.22s var(--ease-out), opacity 0.15s ease;
}
.nav-link:hover { color: var(--text-primary); }
.nav-link:hover::after { transform: scaleX(1); }
.nav-link.is-active { color: var(--text-primary); }
.nav-link.is-active::after { transform: scaleX(1); opacity: 1; }
.nav-link:focus-visible { outline: 2px solid var(--text-primary); outline-offset: -2px; }
.nav-tools { display: flex; align-items: center; gap: 10px; }

.panel {
  min-width: 248px;
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-top: 2px solid var(--text-primary);
  border-radius: 0;
  box-shadow: 0 24px 48px -28px rgba(0,0,0,0.35);
  animation: panel-in 0.22s var(--ease-out);
}
[data-theme="dark"] .panel { box-shadow: 0 28px 56px -28px rgba(0,0,0,0.8); }
.panel-eyebrow { padding: 12px 16px 6px; font-size: 10.5px; font-weight: 600; letter-spacing: 0.14em; text-transform: uppercase; color: var(--text-tertiary); }
.panel-row { position: relative; display: block; padding: 9px 16px; font-size: 14px; color: var(--text-primary); transition: background 0.15s ease; }
.panel-row:hover { background: var(--surface-2); }
.panel-row.is-active::before { content: ''; position: absolute; left: 0; top: 8px; bottom: 8px; width: 2px; background: var(--text-primary); }
.panel-row small { display: block; font-size: 12px; color: var(--text-tertiary); margin-top: 2px; }
@keyframes panel-in { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }

/* Right sheet */
.sheet-scrim { position: fixed; inset: 0; background: var(--overlay-background); z-index: calc(var(--z-ai-sheet) - 1); transition: opacity 0.25s ease; }
.sheet {
  position: fixed; top: 0; right: 0;
  width: min(640px, 100vw);
  height: 100vh; height: 100dvh;
  display: flex; flex-direction: column;
  background: var(--bg-color);
  border-left: 1px solid var(--border-color);
  box-shadow: -24px 0 48px -28px rgba(0,0,0,0.45);
  z-index: var(--z-ai-sheet);
  outline: none;
  transition: transform 0.35s var(--ease-out);
}
.sheet-head { padding: 1.1rem 1.5rem; border-bottom: 1px solid var(--border-color); flex-shrink: 0; }
.sheet-head-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.sheet-head .title { margin-top: 0.8rem; }
.sheet-sub { margin-top: 0.4rem; font-size: 0.88rem; line-height: 1.5; color: var(--text-secondary); }
.sheet-ledger { min-height: 42px; padding: 0.5rem 1.5rem; display: flex; align-items: center; justify-content: space-between; gap: 12px; background: var(--surface-2); border-bottom: 1px solid var(--border-color); }
.sheet-body { flex: 1; min-height: 0; overflow-y: auto; padding: 1.5rem; overscroll-behavior: contain; }
.sheet-disclaimer { margin-top: 1.5rem; padding-top: 1rem; border-top: 1px solid var(--border-color); font-size: 0.74rem; line-height: 1.55; color: var(--text-tertiary); }
.sheet-wrap[hidden] { display: none; }
.sheet-wrap.is-enter .sheet { transform: translateX(100%); }
.sheet-wrap.is-enter .sheet-scrim { opacity: 0; }
@media (max-width: 768px) {
  .sheet { width: 100vw; border-left: none; }
  .sheet-head, .sheet-ledger, .sheet-body { padding-left: 1.15rem; padding-right: 1.15rem; }
  .sheet-head .title { font-size: 1.35rem; }
}

/* AI prose scale */
.prose { font-size: 1rem; line-height: 1.75; font-family: var(--font-sans); overflow-wrap: anywhere; }
.prose h1, .prose h2, .prose h3 { font-family: var(--font-serif); font-weight: 600; letter-spacing: -0.01em; line-height: 1.25; margin: 2.1rem 0 0.75rem; padding-bottom: 0.5rem; border-bottom: 1px solid var(--border-color); }
.prose h1 { font-size: 1.5rem; } .prose h2 { font-size: 1.35rem; } .prose h3 { font-size: 1.15rem; }
.prose h2::before { content: '◆'; font-size: 0.5em; vertical-align: 0.35em; margin-right: 0.6em; color: var(--text-tertiary); }
.prose :first-child { margin-top: 0; }
.prose h4 { font-size: 0.7rem; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; color: var(--text-secondary); margin: 1.6rem 0 0.5rem; }
.prose p { margin: 0 0 1rem; }
.prose ul, .prose ol { margin: 0 0 1rem; padding-left: 1.35rem; }
.prose li { margin: 0.35rem 0; }
.prose li::marker { color: var(--text-tertiary); font-variant-numeric: tabular-nums; }
.prose blockquote { border-left: 2px solid var(--text-primary); padding: 0.25rem 0 0.25rem 1.1rem; font-family: var(--font-serif); font-style: italic; font-size: 1.05rem; color: var(--text-secondary); margin: 0 0 1rem; }
.prose code { font-family: var(--font-mono); font-size: 0.875em; background: var(--surface-2); padding: 0.1em 0.4em; }
.prose a { color: inherit; border-bottom: 1px solid var(--text-tertiary); transition: border-color 0.15s ease; }
.prose a:hover { border-bottom-color: var(--text-primary); }
@media (max-width: 768px) { .prose { font-size: 0.97rem; } .prose h1 { font-size: 1.35rem; } .prose h2 { font-size: 1.22rem; } .prose h3 { font-size: 1.08rem; } }

/* Citations */
.citation { display: flex; align-items: baseline; gap: 0.75rem; padding: 0.5rem 0; border-top: 1px solid var(--border-lighter); color: var(--text-secondary); font-size: 0.82rem; line-height: 1.45; transition: color 0.15s ease; }
.citation:hover { color: var(--text-primary); }
.citation-num { font-family: var(--font-mono); font-size: 0.7rem; font-variant-numeric: tabular-nums; color: var(--text-tertiary); flex-shrink: 0; }
.citation-host { color: var(--text-primary); font-weight: 500; }
.citation-path { color: var(--text-tertiary); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Empty, skeleton, spinner */
.empty { border: 1px dashed var(--border-color); padding: 3.5rem 2rem; text-align: center; }
.empty svg { width: 40px; height: 40px; color: var(--text-tertiary); margin: 0 auto 1rem; display: block; }
.empty .title { font-size: 1.25rem; font-weight: 700; }
.empty p { margin-top: 0.5rem; font-size: 0.875rem; color: var(--text-secondary); }
.skeleton-row { height: 44px; border-bottom: 1px solid var(--border-lighter); background: linear-gradient(90deg, transparent 25%, var(--surface-2) 50%, transparent 75%); background-size: 200% 100%; animation: shimmer 1.5s infinite; }
.skeleton-row:nth-child(odd) { background-color: var(--surface-2); }
@keyframes shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }
.pulse { display: inline-flex; gap: 6px; }
.pulse i { width: 7px; height: 7px; border-radius: 50%; background: var(--border-color); animation: blink 1.4s infinite; }
.pulse i:nth-child(2) { animation-delay: 0.2s; } .pulse i:nth-child(3) { animation-delay: 0.4s; }
@keyframes blink { 0%, 80%, 100% { transform: scale(0.6); opacity: 0.4; } 40% { transform: scale(1); opacity: 1; } }
.spinner { width: 28px; height: 28px; border: 2px solid var(--border-color); border-top-color: var(--accent-color); animation: spin 0.85s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Toast (current convention: squared, ink bar; the live toast is legacy 12px) */
.toast {
  display: flex; align-items: flex-start; gap: 12px;
  padding: 12px 14px;
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-left: 3px solid var(--accent-color);
  box-shadow: 0 10px 30px rgba(0,0,0,0.12);
  max-width: 360px;
  font-size: 0.85rem;
}
.toast.is-error { border-left-color: var(--negative-color); }
.toast.is-warning { border-left-color: var(--warning-color); }

/* Reduced motion: kill everything decorative */
@media (prefers-reduced-motion: reduce) {
  .live-dot, .progress-sheen, .progress-head .eyebrow .mark, .caret::after, .skeleton-row, .pulse i, .spinner, .panel { animation: none; }
  .progress-fill, .segmented__thumb, .sheet, .sheet-scrim, .dialog, .dialog-scrim, .brand img, .post-img::after { transition: none; }
}

/* ============================================================
   PART 2 - documentation site chrome (.ds-*)
   ============================================================ */
.ds-page { max-width: 1600px; margin: 0 auto; padding: 0 28px; }
.ds-layout { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 56px; padding-top: 40px; }
.ds-toc { position: sticky; top: calc(64px + 32px); align-self: start; }
.ds-toc .micro-label { display: block; padding-bottom: 10px; margin-bottom: 8px; border-bottom: 1px solid var(--border-color); color: var(--text-primary); font-size: 10.5px; letter-spacing: 0.14em; font-weight: 600; }
.ds-toc a { display: flex; gap: 10px; align-items: baseline; padding: 6px 0; font-size: 13px; color: var(--text-secondary); transition: color 0.15s ease; }
.ds-toc a:hover, .ds-toc a.is-active { color: var(--text-primary); }
.ds-toc a i { font-family: var(--font-serif); font-style: normal; font-size: 11px; font-variant-numeric: tabular-nums; color: var(--text-tertiary); min-width: 18px; }
.ds-main { min-width: 0; padding-bottom: 80px; }

.ds-hero { padding: 56px 0 40px; border-bottom: 1px solid var(--text-primary); margin-bottom: 8px; }
.ds-hero .eyebrow { margin-bottom: 20px; }
.ds-hero .title--display { max-width: 18ch; }
.ds-hero-lede { max-width: 56ch; margin-top: 20px; font-size: 1.05rem; line-height: 1.65; color: var(--text-secondary); }
.ds-hero-dl { display: flex; flex-wrap: wrap; gap: 32px; margin-top: 32px; padding-top: 20px; border-top: 1px solid var(--border-color); }
.ds-hero-dl div { display: grid; gap: 4px; }
.ds-hero-dl dt { font-size: 0.62rem; font-weight: 700; letter-spacing: 0.14em; text-transform: uppercase; color: var(--text-tertiary); }
.ds-hero-dl dd { font-size: 0.95rem; font-variant-numeric: tabular-nums; }

.ds-section { padding: 48px 0 8px; scroll-margin-top: 90px; }
.ds-section-head { display: grid; grid-template-columns: 56px minmax(0, 1fr); gap: 16px; align-items: end; padding-bottom: 14px; border-bottom: 1px solid var(--border-color); margin-bottom: 28px; }
.ds-folio { font-family: var(--font-serif); font-size: 1.9rem; font-weight: 700; font-variant-numeric: tabular-nums; line-height: 1; color: var(--text-tertiary); }
.ds-section-head .title { font-size: 1.75rem; line-height: 1.15; }
.ds-section-head .eyebrow { margin-bottom: 8px; }
.ds-lede { max-width: 64ch; font-size: 0.98rem; line-height: 1.65; color: var(--text-secondary); margin-bottom: 24px; }
.ds-lede strong { color: var(--text-primary); font-weight: 600; }
.ds-sub { font-family: var(--font-serif); font-size: 1.15rem; font-weight: 600; letter-spacing: -0.01em; margin: 36px 0 12px; }
.ds-sub:first-of-type { margin-top: 0; }
.ds-p { max-width: 64ch; font-size: 0.92rem; line-height: 1.65; color: var(--text-secondary); margin-bottom: 14px; }
.ds-p code, .ds-lede code, .ds-spec code, .ds-list code { font-family: var(--font-mono); font-size: 0.85em; background: var(--surface-2); padding: 0.1em 0.4em; color: var(--text-primary); }
.ds-list { max-width: 64ch; padding-left: 1.2rem; font-size: 0.92rem; line-height: 1.65; color: var(--text-secondary); margin-bottom: 14px; }
.ds-list li { margin: 4px 0; }
.ds-list li::marker { color: var(--text-tertiary); }
.ds-list strong { color: var(--text-primary); font-weight: 600; }

/* Demo frame */
.ds-demo { border: 1px solid var(--border-color); margin: 0 0 20px; }
.ds-demo-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 14px; border-bottom: 1px solid var(--border-color); background: var(--surface-2); }
.ds-demo-bar .micro-label { font-size: 0.6rem; }
.ds-demo-bar .tools { display: flex; gap: 6px; }
.ds-demo-stage { padding: 28px; display: flex; flex-wrap: wrap; gap: 16px; align-items: center; background: var(--bg-color); }
.ds-demo-stage.col { flex-direction: column; flex-wrap: nowrap; align-items: stretch; }
.ds-demo-stage > * { min-width: 0; max-width: 100%; }
.ds-demo-stage .prose-table { display: block; overflow-x: auto; }
.ds-demo-stage.pad-0 { padding: 0; }
.ds-demo-stage.resize { resize: horizontal; overflow: auto; min-width: 280px; max-width: 100%; }
.ds-demo pre { margin: 0; border-top: 1px solid var(--border-color); }
.ds-demo[data-code-hidden] pre { display: none; }

pre.ds-code, .ds-demo pre {
  background: var(--surface-2);
  padding: 16px 18px;
  overflow-x: auto;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  line-height: 1.6;
  color: var(--text-primary);
  tab-size: 2;
}
pre.ds-code { border: 1px solid var(--border-color); margin: 0 0 20px; position: relative; }
pre.ds-code .ds-copy, .ds-demo pre .ds-copy { position: absolute; top: 8px; right: 8px; }
.ds-demo pre { position: relative; }
.ds-code-title { font-family: var(--font-mono); font-size: 0.68rem; color: var(--text-tertiary); padding: 8px 18px; border: 1px solid var(--border-color); border-bottom: 0; background: var(--surface-2); margin-top: 20px; }
.ds-code-title + pre.ds-code { margin-top: 0; }
.ds-copy { height: 26px; padding: 0 8px; font-size: 0.6rem; letter-spacing: 0.1em; }
.ds-copy.did { color: var(--accent-color); border-color: var(--accent-color); }

/* Spec table */
.ds-spec { width: 100%; border-collapse: collapse; font-size: 0.85rem; margin-bottom: 20px; }
.ds-spec th { text-align: left; padding: 8px 12px 8px 0; font-size: 0.62rem; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; color: var(--text-secondary); border-bottom: 1px solid var(--text-primary); white-space: nowrap; }
.ds-spec td { padding: 9px 12px 9px 0; border-bottom: 1px solid var(--border-color); vertical-align: top; line-height: 1.5; color: var(--text-secondary); }
.ds-spec td:first-child { color: var(--text-primary); font-weight: 500; white-space: nowrap; }
.ds-spec tr:last-child td { border-bottom-color: var(--text-primary); }
.ds-spec .mono { font-size: 0.78rem; }
.ds-spec-wrap { overflow-x: auto; }

/* Swatches */
.ds-swatches { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 1px; background: var(--border-color); border: 1px solid var(--border-color); margin-bottom: 20px; }
.ds-swatch { background: var(--card-bg); padding: 0; }
.ds-swatch-chip { height: 56px; display: flex; }
.ds-swatch-chip i { flex: 1; }
.ds-swatch-meta { padding: 10px 12px; }
.ds-swatch-meta b { display: block; font-family: var(--font-mono); font-size: 0.68rem; font-weight: 500; color: var(--text-primary); }
.ds-swatch-meta span { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 2px 8px; font-family: var(--font-mono); font-size: 0.62rem; color: var(--text-tertiary); margin-top: 4px; word-break: break-all; }

/* Type specimen */
.ds-specimen { display: grid; grid-template-columns: 200px minmax(0, 1fr); gap: 24px; padding: 18px 0; border-top: 1px solid var(--border-color); align-items: baseline; }
.ds-specimen:last-child { border-bottom: 1px solid var(--text-primary); }
.ds-specimen-meta { font-family: var(--font-mono); font-size: 0.66rem; color: var(--text-tertiary); line-height: 1.7; }
.ds-specimen-meta b { display: block; font-family: var(--font-sans); font-size: 0.62rem; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; color: var(--text-primary); margin-bottom: 4px; }

/* Radius rule grid */
.ds-radius { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 1px; background: var(--border-color); border: 1px solid var(--border-color); margin-bottom: 20px; }
.ds-radius > div { background: var(--card-bg); padding: 18px; }
.ds-radius .r { width: 56px; height: 36px; border: 1px solid var(--text-primary); margin-bottom: 12px; }
.ds-radius b { display: block; font-family: var(--font-mono); font-size: 0.8rem; font-weight: 600; }
.ds-radius span { display: block; font-size: 0.78rem; line-height: 1.5; color: var(--text-secondary); margin-top: 4px; }

/* Do / Don't */
.ds-dodont { display: grid; grid-template-columns: 1fr 1fr; gap: 1px; background: var(--border-color); border: 1px solid var(--border-color); margin-bottom: 20px; }
.ds-dodont > div { background: var(--card-bg); padding: 18px; }
.ds-dodont .micro-label { display: block; margin-bottom: 10px; }
.ds-dodont .do .micro-label { color: var(--positive-color); }
.ds-dodont .dont .micro-label { color: var(--negative-color); }
.ds-dodont p { font-size: 0.85rem; line-height: 1.55; color: var(--text-secondary); }

/* Callout */
.ds-note { border: 1px solid var(--border-color); border-left: 3px solid var(--text-primary); padding: 14px 16px; font-size: 0.88rem; line-height: 1.6; color: var(--text-secondary); margin-bottom: 20px; max-width: 72ch; }
.ds-note.warn { border-left-color: var(--warning-color); }
.ds-note strong { color: var(--text-primary); font-weight: 600; }

/* Site footer */
.ds-colophon { margin-top: 72px; border-top: 3px solid var(--text-primary); position: relative; }
.ds-colophon::before { content: ''; position: absolute; left: 0; right: 0; top: 3px; height: 1px; background: var(--border-color); }
.ds-colophon-inner { max-width: 1600px; margin: 0 auto; padding: 36px 28px 40px; display: flex; justify-content: space-between; gap: 24px; flex-wrap: wrap; align-items: end; }
.ds-colophon .brand-text { font-size: clamp(22px, 2.2vw, 30px); }
.ds-colophon p { font-size: 12.5px; color: var(--text-tertiary); max-width: 52ch; line-height: 1.6; margin-top: 8px; }
.ds-colophon nav { display: flex; gap: 18px; font-size: 12.5px; color: var(--text-secondary); }
.ds-colophon nav a:hover { color: var(--text-primary); text-decoration: underline; text-underline-offset: 3px; }

/* Mobile nav for the doc site */
.ds-burger { display: none; }
@media (max-width: 960px) {
  .masthead-inner { --nav-h: 56px; padding: 0 16px; grid-template-columns: auto 1fr auto; }
  .ds-nav-desktop { display: none; }
  .ds-burger { display: inline-flex; }
  .ds-page { padding: 0 20px; }
  .ds-layout { grid-template-columns: 1fr; gap: 24px; padding-top: 24px; }
  .ds-toc { position: static; display: flex; gap: 4px 16px; flex-wrap: wrap; padding-bottom: 12px; border-bottom: 1px solid var(--border-color); }
  .ds-toc .micro-label { width: 100%; border: 0; margin: 0; padding: 0 0 4px; }
  .ds-toc a { padding: 4px 0; }
  .ds-hero { padding: 36px 0 28px; }
  .ds-specimen { grid-template-columns: 1fr; gap: 8px; }
  .ds-dodont { grid-template-columns: 1fr; }
  .ds-demo-stage { padding: 20px; }
}
@media (max-width: 480px) { .ds-page { padding: 0 14px; } .ds-section-head { grid-template-columns: 40px 1fr; } .ds-folio { font-size: 1.4rem; } }

.ds-mobile-sheet {
  position: fixed; top: 0; right: 0; bottom: 0;
  width: min(100% - 44px, 400px);
  background: var(--bg-color);
  border-left: 1px solid var(--border-color);
  box-shadow: -24px 0 48px -32px rgba(0,0,0,0.45);
  z-index: 10010;
  padding: 20px;
  display: flex; flex-direction: column;
  transition: transform 0.36s var(--ease-out);
}
.ds-mobile-sheet[hidden] { display: none; }
.ds-mobile-sheet a { display: flex; gap: 14px; align-items: baseline; min-height: 60px; border-bottom: 1px solid var(--border-color); font-family: var(--font-serif); font-size: 20px; font-weight: 700; color: var(--text-primary); }
.ds-mobile-sheet a i { font-style: normal; font-size: 12px; font-variant-numeric: tabular-nums; color: var(--text-tertiary); }
.ds-mobile-scrim { position: fixed; inset: 0; background: rgba(10,10,10,0.45); backdrop-filter: blur(2px); z-index: 10009; }
.ds-mobile-scrim[hidden] { display: none; }

.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Wordmark length variants, as in Navbar.vue */
.masthead .brand-text--short { display: none; }
@media (max-width: 960px) { .masthead .brand-text { font-size: 17px; white-space: nowrap; } }
@media (max-width: 480px) { .masthead .brand-text--full { display: none; } .masthead .brand-text--short { display: inline; } }
.ds-colophon p a { color: var(--text-secondary); text-decoration: underline; text-decoration-color: var(--border-color); text-underline-offset: 3px; }
.ds-colophon p a:hover { color: var(--text-primary); text-decoration-color: var(--text-primary); }
