.badge,
.tag {
  max-width: 100%;
  display: inline-flex;
  min-height: 26px;
  align-items: center;
  gap: 7px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-pill);
  background: var(--color-surface);
  color: var(--color-text-muted);
  padding: 3px 10px;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.04em;
  overflow: hidden;
  overflow-wrap: anywhere;
}

.badge-accent,
.tag-accent {
  border-color: var(--line-accent-soft);
  background: var(--color-surface-soft);
  color: var(--color-accent-strong);
}

.badge-dot {
  width: 7px;
  height: 7px;
  flex-shrink: 0;
  border-radius: 2px;
  background: var(--color-accent);
  transform: rotate(45deg);
}

/* Tabs */
.tabs {
  max-width: 100%;
}

.tab-list {
  display: inline-flex;
  max-width: 100%;
  gap: 4px;
  overflow-x: auto;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-surface-soft);
  padding: 4px;
  scrollbar-width: thin;
  -webkit-overflow-scrolling: touch;
}

.tab-button {
  min-width: 92px;
  min-height: 42px;
  flex: none;
  border: 0;
  border-radius: var(--radius-sm);
  background: var(--color-transparent);
  color: var(--color-text-muted);
  padding: 8px 16px;
  font-weight: 650;
}

.tab-button:hover {
  color: var(--color-text);
}

.tab-button[aria-selected="true"],
.tab-button.is-active {
  background: var(--color-surface);
  color: var(--color-text);
  box-shadow: var(--shadow-popover);
}

.tab-panel {
  padding-top: 28px;
}

.tab-panel[hidden] {
  display: none;
}

/* Long-page navigation */
.toc-tabs {
  position: sticky;
  z-index: 12;
  top: 10px;
  display: flex;
  max-width: 100%;
  gap: 5px;
  overflow-x: auto;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-surface);
  box-shadow: var(--shadow-popover);
  padding: 6px;
  scrollbar-width: thin;
  -webkit-overflow-scrolling: touch;
}

.toc-tabs a {
  min-height: 40px;
  display: inline-flex;
  flex: none;
  align-items: center;
  border-radius: var(--radius-sm);
  padding: 7px 13px;
  color: var(--color-text-muted);
  font-size: 14px;
  font-weight: 620;
}

.toc-tabs a:hover,
.toc-tabs a.is-current,
.toc-tabs a[aria-current="true"] {
  background: var(--color-surface-soft);
  color: var(--color-accent-strong);
}

body:has(.toc-tabs) section[id] {
  scroll-margin-top: var(--toc-offset);
}

/* FAQ */
.faq-list {
  display: grid;
  gap: 10px;
}

.faq-item {
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-surface);
}

.faq-item summary {
  position: relative;
  min-height: 56px;
  display: flex;
  align-items: center;
  padding: 15px 52px 15px 18px;
  color: var(--color-text);
  cursor: pointer;
  font-weight: 700;
  list-style: none;
}

.faq-item summary::-webkit-details-marker {
  display: none;
}

.faq-item summary::after {
  position: absolute;
  right: 18px;
  width: 24px;
  height: 24px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--color-accent-strong);
  content: "+";
  font-family: var(--font-mono);
  font-size: 20px;
}

.faq-item[open] summary::after {
  content: "−";
}

.faq-answer {
  border-top: 1px solid var(--color-border);
  padding: 16px 18px 18px;
  color: var(--color-text-muted);
}

.faq-answer p:last-child {
  margin-bottom: 0;
}

/* Pricing */
.pricing-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
}

.plan-card {
  position: relative;
  display: flex;
  min-height: 100%;
  flex-direction: column;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-surface);
  padding: 28px;
}

.plan-card.is-featured {
  border-color: var(--color-accent);
  box-shadow: var(--shadow-popover);
}

.plan-ribbon {
  position: absolute;
  top: 0;
  right: 18px;
  transform: translateY(-50%);
  border-radius: var(--radius-pill);
  background: var(--color-accent-strong);
  color: var(--color-white);
  padding: 4px 11px;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
}

.plan-name {
  margin-bottom: 6px;
  font-size: 20px;
  font-weight: 750;
}

.plan-cycle {
  margin-bottom: 20px;
  color: var(--color-text-muted);
  font-family: var(--font-mono);
  font-size: 12px;
}

.plan-price {
  display: flex;
  align-items: baseline;
  gap: 5px;
  margin-bottom: 20px;
}

.plan-price strong {
  font-family: var(--font-display);
  font-size: 42px;
  font-weight: 850;
  line-height: 1;
}

.plan-price span {
  color: var(--color-text-muted);
}

.plan-features {
  display: grid;
  gap: 9px;
  margin: 0 0 26px;
  padding: 0;
  list-style: none;
  color: var(--color-text-muted);
}

.plan-features li {
  position: relative;
  padding-left: 20px;
}

.plan-features li::before {
  position: absolute;
  left: 0;
  color: var(--color-success);
  content: "✓";
  font-weight: 800;
}

.plan-card .button {
  width: 100%;
  margin-top: auto;
}

/* Wide tables */
.table-scroll,
.server-table-wrap,
.compare-table-wrap {
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-surface);
  -webkit-overflow-scrolling: touch;
}

.data-table,
.server-table,
.compare-table {
  width: 100%;
  min-width: 680px;
  border-collapse: collapse;
  color: var(--color-text);
}

.data-table th,
.data-table td,
.server-table th,
.server-table td,
.compare-table th,
.compare-table td {
  border-bottom: 1px solid var(--color-border);
  padding: 14px 16px;
  text-align: left;
  vertical-align: middle;
}

.data-table th,
.server-table th,
.compare-table th {
  background: var(--color-surface-soft);
  color: var(--color-text);
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.04em;
}

.data-table td:first-child,
.server-table td:first-child,
.compare-table td:first-child {
  color: var(--color-text);
  font-weight: 650;
}

.data-table tr:last-child td,
.server-table tr:last-child td,
.compare-table tr:last-child td {
  border-bottom: 0;
}

.table-group-row th {
  background: var(--color-ink-panel);
  color: var(--color-on-ink);
}

.prose > .data-table {
  display: block;
  max-width: 100%;
  min-width: 0;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

/* Platform cards */
.platform-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 14px;
}

.platform-card {
  min-height: 210px;
  display: flex;
  align-items: flex-start;
  flex-direction: column;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-surface);
  padding: 22px;
}

.platform-card-icon {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  margin-bottom: 22px;
  border-radius: var(--radius-sm);
  background: var(--color-surface-soft);
  color: var(--color-accent-strong);
}

.platform-card-icon svg {
  width: 23px;
  height: 23px;
}

.platform-card h3 {
  margin-bottom: 6px;
  font-size: 18px;
}

.platform-card p {
  margin-bottom: 20px;
  color: var(--color-text-muted);
  font-size: 14px;
}

.platform-card .button {
  width: 100%;
  margin-top: auto;
}

/* Article cards */
.article-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
}

.article-card {
  min-height: 100%;
  display: flex;
  flex-direction: column;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-surface);
  padding: 24px;
  transition: border-color var(--transition-fast), transform var(--transition-fast), box-shadow var(--transition-fast);
}

.article-card:hover {
  transform: translateY(-3px);
  border-color: var(--color-accent);
  box-shadow: var(--shadow-popover);
}

.article-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
  color: var(--color-text-muted);
  font-family: var(--font-mono);
  font-size: 11px;
}

.article-card h3 {
  font-size: 21px;
}

.article-card p {
  color: var(--color-text-muted);
}

.article-link {
  min-height: 32px;
  display: inline-flex;
  align-items: center;
  margin-top: auto;
  color: var(--color-accent-strong);
  font-weight: 700;
}

/* Callouts and promotional blocks */
.callout {
  position: relative;
  border: 1px solid var(--color-border);
  border-left: 4px solid var(--color-accent);
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
  background: var(--color-surface-soft);
  padding: 20px 22px;
  color: var(--color-text-muted);
}

.callout strong {
  display: block;
  margin-bottom: 5px;
}

.promo-block {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--line-on-ink);
  border-radius: var(--radius-lg);
  background-color: var(--color-ink);
  background-image: radial-gradient(var(--texture-dot) 1px, var(--color-transparent) 1.5px);
  background-size: 16px 16px;
  color: var(--color-on-ink);
  padding: clamp(28px, 5vw, 56px);
}

.promo-block h2,
.promo-block strong {
  color: var(--color-on-ink);
}

.promo-block p {
  max-width: 46em;
  color: var(--color-on-ink-muted);
}

.promo-actions {
  display: flex;
  gap: 12px;
  margin-top: 24px;
}

/* Feature archive browser */
.feature-browser {
  display: grid;
  grid-template-columns: minmax(230px, 0.8fr) minmax(0, 1.7fr);
  gap: clamp(28px, 5vw, 72px);
}

.feature-index {
  display: grid;
  align-content: start;
}

.feature-index button {
  min-height: 72px;
  border: 0;
  border-left: 3px solid var(--line-on-ink);
  background: var(--color-transparent);
  color: var(--color-on-ink-muted);
  padding: 12px 18px;
  text-align: left;
}

.feature-index button b {
  display: block;
  margin-bottom: 3px;
  color: var(--color-on-ink);
}

.feature-index button[aria-selected="true"],
.feature-index button.is-active {
  border-left-color: var(--color-accent);
  background: var(--fill-ink-soft);
  color: var(--color-on-ink);
}

.feature-detail {
  min-height: 340px;
  border: 1px solid var(--line-on-ink);
  border-radius: var(--radius-md);
  background: var(--color-ink-panel);
  padding: clamp(26px, 4vw, 48px);
}

/* Ticker */
.ticker {
  max-width: 100%;
  overflow: hidden;
  border-block: 1px solid var(--color-border);
  background: var(--color-surface);
}

.ticker-track {
  width: max-content;
  display: flex;
  will-change: transform;
}

.ticker-group {
  display: flex;
  flex: none;
  align-items: center;
}

.ticker-item {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  padding: 15px 24px;
  color: var(--color-text-muted);
  font-family: var(--font-mono);
  font-size: 12px;
  white-space: nowrap;
}

.ticker-item::before {
  width: 6px;
  height: 6px;
  flex: none;
  border-radius: 2px;
  background: var(--color-accent);
  content: "";
  transform: rotate(45deg);
}

/* Floating CTA */
.float-cta {
  position: fixed;
  z-index: 40;
  right: 22px;
  bottom: calc(22px + env(safe-area-inset-bottom, 0px));
  min-height: 46px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-radius: var(--radius-pill);
  background: var(--color-accent-strong);
  color: var(--color-white);
  box-shadow: 0 10px 24px var(--fill-accent-shadow-strong);
  padding: 11px 20px;
  font-size: 14px;
  font-weight: 750;
}

.float-cta:hover {
  background: var(--color-accent);
}

.float-cta svg {
  width: 16px;
  height: 16px;
}

body:has(.float-cta)::after {
  height: calc(88px + env(safe-area-inset-bottom, 0px));
  display: block;
  content: "";
}

/* Preview-only layout; all classes are shared through this stylesheet */
.preview-page {
  background: var(--color-page);
}

.preview-intro,
.preview-block {
  padding-top: 72px;
  padding-bottom: 72px;
}

.preview-intro {
  border-bottom: 1px solid var(--color-border);
}

.preview-kicker {
  margin-bottom: 12px;
  color: var(--color-accent-strong);
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.08em;
}

.preview-lead {
  max-width: 46em;
  color: var(--color-text-muted);
  font-size: 18px;
}

.preview-title-row {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 32px;
}

.preview-title-row h2,
.preview-title-row p {
  margin-bottom: 0;
}

.preview-title-row p {
  max-width: 36em;
  color: var(--color-text-muted);
}

.swatch-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 12px;
}

.swatch {
  overflow: hidden;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-surface);
}

.swatch-color {
  height: 86px;
}

.swatch-page .swatch-color {
  background: var(--color-page);
}

.swatch-surface .swatch-color {
  background: var(--color-surface);
}

.swatch-soft .swatch-color {
  background: var(--color-surface-soft);
}

.swatch-accent .swatch-color {
  background: var(--color-accent);
}

.swatch-accent-strong .swatch-color {
  background: var(--color-accent-strong);
}

.swatch-text .swatch-color {
  background: var(--color-text);
}

.swatch-muted .swatch-color {
  background: var(--color-text-muted);
}

.swatch-success .swatch-color {
  background: var(--color-success);
}

.swatch-warning .swatch-color {
  background: var(--color-warning);
}

.swatch-error .swatch-color {
  background: var(--color-error);
}

.swatch-ink .swatch-color {
  background: var(--color-ink);
}

.swatch-ink-panel .swatch-color {
  background: var(--color-ink-panel);
}

.swatch-info {
  padding: 12px;
}

.swatch-info b,
.swatch-info code {
  display: block;
}

.swatch-info code {
  margin-top: 4px;
  border: 0;
  background: var(--color-transparent);
  color: var(--color-text-muted);
  padding: 0;
  font-size: 11px;
}

.type-specimen {
  display: grid;
  gap: 28px;
}

.type-specimen-row {
  border-bottom: 1px solid var(--color-border);
  padding-bottom: 28px;
}

.type-specimen-row:last-child {
  border-bottom: 0;
}

.type-label {
  margin-bottom: 8px;
  color: var(--color-text-muted);
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.08em;
}

.type-display {
  font-family: var(--font-display);
  font-size: clamp(38px, 5vw, 64px);
  font-weight: 900;
  letter-spacing: -0.02em;
  line-height: 1.1;
}

.type-body {
  max-width: 48em;
  color: var(--color-text-muted);
  font-size: 17px;
}

.button-showcase,
.badge-showcase {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.component-stack {
  display: grid;
  gap: 48px;
}

.component-caption {
  margin-bottom: 16px;
  color: var(--color-text-muted);
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.06em;
}

.preview-footer {
  margin-top: 72px;
}

@media (max-width: 1080px) {
  .platform-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

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

@media (max-width: 768px) {
  .pricing-grid,
  .article-grid,
  .feature-browser {
    grid-template-columns: 1fr;
  }

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

  .feature-index {
    display: flex;
    max-width: 100%;
    overflow-x: auto;
  }

  .feature-index button {
    min-width: 190px;
    border-left: 0;
    border-bottom: 3px solid var(--line-on-ink);
  }

  .feature-index button[aria-selected="true"],
  .feature-index button.is-active {
    border-bottom-color: var(--color-accent);
  }

  .promo-actions,
  .preview-title-row {
    align-items: stretch;
    flex-direction: column;
  }

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

@media (max-width: 640px) {
  .ticker {
    overflow: visible;
  }

  .ticker-track,
  .ticker-group {
    width: 100%;
    flex-wrap: wrap;
  }

  .ticker-group + .ticker-group {
    display: none;
  }

  .ticker-item {
    flex: 1 1 auto;
    justify-content: center;
    white-space: normal;
  }

  .platform-grid {
    grid-template-columns: 1fr;
  }

  .preview-intro,
  .preview-block {
    padding-top: 52px;
    padding-bottom: 52px;
  }

  .float-cta {
    right: 14px;
    bottom: calc(14px + env(safe-area-inset-bottom, 0px));
  }
}