.tab-set {
  min-width: 0;
}

.tab-list {
  display: flex;
  max-width: 100%;
  gap: 8px;
  overflow-x: auto;
  padding: 6px;
  border-radius: var(--radius-medium);
  background: var(--color-mist);
  scrollbar-width: thin;
  -webkit-overflow-scrolling: touch;
}

.tab-list [role="tab"] {
  min-height: 44px;
  flex: 0 0 auto;
  padding: 9px 18px;
  border-radius: var(--radius-small);
  background: var(--color-mist);
  color: var(--color-muted);
  font-weight: 700;
  white-space: nowrap;
}

.tab-list [role="tab"]:hover,
.tab-list [role="tab"].is-active,
.tab-list [role="tab"][aria-selected="true"] {
  background: var(--color-surface);
  color: var(--color-ink);
  box-shadow: 0 5px 16px var(--color-card-shadow);
}

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

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

.toc-nav {
  position: sticky;
  top: 12px;
  z-index: 10;
  display: flex;
  max-width: 100%;
  gap: 8px;
  overflow-x: auto;
  padding: 8px;
  border-radius: var(--radius-medium);
  background: var(--color-surface);
  box-shadow: var(--shadow-card);
  -webkit-overflow-scrolling: touch;
}

.toc-nav a {
  min-height: 40px;
  flex: 0 0 auto;
  padding: 7px 13px;
  border-radius: var(--radius-small);
  color: var(--color-muted);
  font-size: 14px;
  font-weight: 700;
  text-decoration: none;
  white-space: nowrap;
}

.toc-nav a:hover {
  background: var(--color-mist);
  color: var(--color-ink);
}

.faq-list {
  display: grid;
  gap: 14px;
}

.faq-item {
  border-radius: var(--radius-medium);
  background: var(--color-surface);
  color: var(--color-ink);
  box-shadow: 0 10px 30px var(--color-card-shadow);
}

.faq-item summary {
  position: relative;
  display: flex;
  min-height: 60px;
  align-items: center;
  padding: 16px 54px 16px 20px;
  color: var(--color-ink);
  font-weight: 750;
  cursor: pointer;
  list-style: none;
}

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

.faq-item summary::after {
  position: absolute;
  right: 20px;
  width: 22px;
  height: 22px;
  flex-shrink: 0;
  border-radius: var(--radius-pill);
  background: var(--color-mist);
  color: var(--color-brand-deep);
  content: "+";
  font: 700 17px/22px var(--font-display);
  text-align: center;
}

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

.faq-answer {
  padding: 0 20px 20px;
  color: var(--color-muted);
}

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

.term-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
}

.term-card {
  padding: 25px;
  border-radius: var(--radius-large);
  background: var(--color-surface);
  color: var(--color-ink);
  box-shadow: var(--shadow-card);
}

.term-card dt {
  margin-bottom: 8px;
  color: var(--color-brand-deep);
  font-family: var(--font-display);
  font-size: 19px;
  font-weight: 800;
}

.term-card dd {
  color: var(--color-muted);
}

.download-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 22px;
}

.download-card {
  position: relative;
  display: flex;
  min-width: 0;
  flex-direction: column;
  padding: 27px;
  border-radius: var(--radius-large);
  background: var(--color-surface);
  color: var(--color-ink);
  box-shadow: var(--shadow-card);
}

.download-card-head {
  display: flex;
  min-width: 0;
  align-items: flex-start;
  gap: 16px;
}

.download-card-head img {
  width: 54px;
  height: 54px;
  flex-shrink: 0;
}

.download-card h3 {
  margin-bottom: 5px;
}

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

.download-card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: auto;
  padding-top: 16px;
}

.version-slot:empty {
  display: none;
}

.app-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-bottom: 12px;
}

.badge-featured {
  background: var(--color-brand);
  color: var(--color-surface);
}

.badge-recommended {
  background: var(--color-mint);
  color: var(--color-ink);
}

.badge-archived {
  background: var(--color-line);
  color: var(--color-ink);
}

.post-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 22px;
}

.post-card {
  display: flex;
  min-width: 0;
  flex-direction: column;
  padding: 25px;
  border-radius: var(--radius-large);
  background: var(--color-surface);
  color: var(--color-ink);
  box-shadow: var(--shadow-card);
  transition: transform var(--transition-fast), box-shadow var(--transition-fast);
}

.post-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 22px 48px var(--color-card-shadow);
}

.post-card-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 9px;
  margin-bottom: 15px;
  color: var(--color-muted);
  font-size: 13px;
}

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

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

.post-card > a:last-child {
  margin-top: auto;
  font-weight: 700;
}

.callout {
  position: relative;
  margin: 28px 0;
  padding: 21px 23px 21px 27px;
  overflow: hidden;
  border-radius: var(--radius-medium);
  background: var(--color-mist);
  color: var(--color-ink);
}

.callout::before {
  position: absolute;
  inset: 0 auto 0 0;
  width: 5px;
  background: var(--color-brand);
  content: "";
}

.callout-warning {
  background: var(--color-mint);
  color: var(--color-ink);
}

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

.callout-title {
  display: block;
  margin-bottom: 5px;
  font-weight: 800;
}

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

.article-download-card {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 22px;
  margin-top: 48px;
  padding: 28px;
  border-radius: var(--radius-large);
  background: var(--color-mist);
  color: var(--color-ink);
}

.article-download-card p {
  margin-bottom: 0;
  color: var(--color-muted);
}

.dl-fab {
  position: fixed;
  right: max(18px, env(safe-area-inset-right));
  bottom: max(18px, env(safe-area-inset-bottom));
  z-index: 35;
  display: flex;
  max-width: calc(100vw - 36px);
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-radius: var(--radius-medium);
  background: var(--color-brand);
  color: var(--color-surface);
  box-shadow: var(--shadow-button);
  text-decoration: none;
}

.dl-fab:hover {
  background: var(--color-brand-deep);
  color: var(--color-surface);
}

.dl-fab-icon {
  display: grid;
  width: 34px;
  height: 34px;
  flex-shrink: 0;
  place-items: center;
  border-radius: var(--radius-small);
  background: var(--color-surface);
  color: var(--color-brand-deep);
}

.dl-fab-icon svg {
  width: 18px;
  height: 18px;
}

.dl-fab-copy {
  display: grid;
  line-height: 1.25;
}

.dl-fab-copy strong {
  color: var(--color-surface);
  font-size: 14px;
}

.dl-fab-copy small {
  color: var(--color-surface);
  font-size: 12px;
  opacity: .82;
}

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

.preview-block {
  padding-top: 80px;
  padding-bottom: 80px;
}

.preview-block-head {
  max-width: 680px;
  margin-bottom: 38px;
}

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

.swatch {
  overflow: hidden;
  border-radius: var(--radius-medium);
  background: var(--color-surface);
  color: var(--color-ink);
  box-shadow: var(--shadow-card);
}

.swatch-color {
  height: 90px;
}

.swatch-info {
  padding: 13px;
  font: 12px/1.5 var(--font-mono);
}

.swatch-canvas { background: var(--color-canvas); }
.swatch-surface { background: var(--color-surface); }
.swatch-mist { background: var(--color-mist); }
.swatch-mint { background: var(--color-mint); }
.swatch-brand { background: var(--color-brand); }
.swatch-brand-deep { background: var(--color-brand-deep); }
.swatch-ink { background: var(--color-ink); }
.swatch-amber { background: var(--color-amber); }

.preview-hero {
  position: relative;
  min-height: calc(100svh - var(--header-height));
  overflow-x: clip;
}

.preview-hero-band {
  position: absolute;
  inset: 0 0 96px;
  background: var(--color-mist);
}

.preview-hero-grid {
  position: relative;
  z-index: 2;
  display: grid;
  min-height: calc(100svh - var(--header-height));
  grid-template-columns: minmax(0, 520px) 1fr;
  align-content: center;
  padding-bottom: 96px;
}

.preview-hero-copy {
  position: relative;
  z-index: 3;
  padding-top: 40px;
  padding-bottom: 40px;
}

.preview-hero-copy h1 {
  margin-bottom: 0;
}

.preview-hero-copy .hero-key {
  display: block;
  margin-top: 14px;
  font-size: clamp(23px, 2.2vw, 30px);
  line-height: 1.3;
}

.hero-accent {
  color: var(--color-brand);
  font-style: normal;
}

.preview-hero-desc {
  max-width: 390px;
  margin-top: 24px;
  color: var(--color-muted);
  font-size: 15px;
  line-height: 1.9;
}

.core-keys {
  margin-top: 14px;
  color: var(--color-muted);
  font: 12px/1.7 var(--font-mono);
  letter-spacing: .02em;
}

.platform-row {
  display: flex;
  flex-wrap: wrap;
  gap: 17px;
  margin-top: 28px;
}

.platform-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--color-muted);
  font-size: 12px;
  font-weight: 600;
  text-decoration: none;
}

.platform-link:hover {
  color: var(--color-ink);
}

.platform-link svg {
  width: 13px;
  height: 13px;
  flex-shrink: 0;
}

.chip-stage {
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
}

.chip-wrap {
  position: absolute;
  right: -64px;
  bottom: -6px;
  width: min(45vw, 660px);
  transform: rotate(4deg);
}

.chip-svg {
  width: 100%;
  overflow: visible;
}

.chip-trace {
  fill: none;
  stroke: var(--color-trace);
  stroke-linecap: round;
  stroke-width: 2.5;
}

.chip-pad {
  fill: var(--color-surface);
  stroke: var(--color-trace);
  stroke-width: 2.5;
}

.chip-pin {
  fill: var(--color-pin);
}

.chip-board-group {
  filter: drop-shadow(0 3px 6px var(--color-chip-shadow-a)) drop-shadow(0 34px 60px var(--color-chip-shadow-b));
}

.chip-rim {
  fill: var(--color-board-rim);
}

.chip-board {
  fill: var(--color-board);
}

.chip-highlight {
  fill: none;
  stroke: var(--color-board-highlight);
  stroke-width: 1.5;
}

.chip-silk {
  fill: var(--color-surface);
}

.chip-eye {
  fill: var(--color-board);
}

.chip-label {
  fill: var(--color-surface);
  font-family: var(--font-mono);
  font-size: 24px;
  font-weight: 700;
  letter-spacing: .18em;
}

.chip-sub {
  fill: var(--color-surface);
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: .18em;
  opacity: .55;
}

.flow-dot {
  offset-path: path("M 146 84 L 208 84 Q 220 84 220 96 L 220 138");
  offset-rotate: 0deg;
  fill: var(--color-amber);
  filter: drop-shadow(0 0 6px var(--color-amber));
  animation: chip-flow 6s linear infinite;
}

@keyframes chip-flow {
  0% { offset-distance: 0%; opacity: 0; }
  12% { opacity: 1; }
  88% { opacity: 1; }
  100% { offset-distance: 100%; opacity: 0; }
}

@media (max-width: 960px) {
  .post-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .preview-hero-band {
    bottom: 0;
  }

  .preview-hero-grid {
    grid-template-columns: 1fr;
    align-content: center;
    padding-bottom: 0;
  }

  .preview-hero-copy {
    padding-top: 44px;
    padding-bottom: 8px;
  }

  .chip-stage {
    position: relative;
    min-height: 430px;
  }

  .chip-wrap {
    position: absolute;
    right: 50%;
    bottom: 10px;
    width: min(80vw, 430px);
    transform: translateX(50%) rotate(4deg);
  }

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

@media (max-width: 700px) {
  .term-grid,
  .download-grid,
  .post-grid {
    grid-template-columns: 1fr;
  }

  .article-download-card {
    grid-template-columns: 1fr;
  }

  .chip-stage {
    min-height: 360px;
  }

  .chip-wrap {
    transform: translateX(50%);
  }
}

@media (max-width: 480px) {
  .swatch-grid {
    grid-template-columns: 1fr;
  }

  .dl-fab-copy small {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .flow-dot {
    animation: none;
    offset-distance: 60%;
    opacity: 1;
  }
}