:root {
  --component-band-height: 82px;
}

.badge {
  background: var(--color-panel);
  color: var(--color-text);
  font-size: 12px;
  font-weight: 600;
  box-shadow: none;
}

.badge-recommended {
  background: var(--color-accent);
  color: var(--color-text);
}

.badge-primary {
  background: var(--color-success-wash);
  color: var(--color-text);
}

.badge-retired {
  background: var(--color-error-wash);
  color: var(--color-text);
}

.badge-protocol {
  background: var(--color-panel-cool);
  color: var(--color-text);
  font-family: var(--font-mono);
  font-weight: 400;
  letter-spacing: 0.03em;
}

.tab-layout {
  display: grid;
  grid-template-columns: minmax(180px, 0.35fr) minmax(0, 1fr);
  gap: clamp(28px, 5vw, 68px);
  align-items: start;
}

.tab-list {
  display: flex;
  align-items: stretch;
  flex-direction: column;
  gap: 4px;
}

.tab-list [role="tab"] {
  position: relative;
  display: flex;
  min-height: 46px;
  width: 100%;
  align-items: center;
  border-radius: var(--radius-small);
  padding: 10px 14px 10px 28px;
  cursor: pointer;
  background: transparent;
  color: var(--color-text-muted);
  text-align: left;
}

.tab-list [role="tab"]::before {
  position: absolute;
  left: 11px;
  width: 7px;
  height: 7px;
  flex-shrink: 0;
  border-radius: var(--radius-pill);
  background: var(--color-border);
  content: "";
}

.tab-list [role="tab"]:hover {
  background: var(--color-panel);
  color: var(--color-text);
}

.tab-list [role="tab"][aria-selected="true"],
.tab-list [role="tab"].is-active {
  background: var(--color-panel);
  color: var(--color-text);
  font-weight: 600;
}

.tab-list [role="tab"][aria-selected="true"]::before,
.tab-list [role="tab"].is-active::before {
  background: var(--color-accent);
}

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

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

.feature-panel {
  overflow: hidden;
  padding: 0;
}

.feature-band {
  position: relative;
  height: var(--component-band-height);
  overflow: hidden;
  background: var(--color-illustration-field);
  color: var(--color-text);
}

.feature-band::before,
.feature-band::after {
  position: absolute;
  right: -8%;
  left: -8%;
  border-radius: 50%;
  content: "";
}

.feature-band::before {
  bottom: -44px;
  height: 74px;
  background: var(--color-illustration-ridge-far);
}

.feature-band::after {
  bottom: -58px;
  height: 78px;
  background: var(--color-illustration-water);
}

.feature-panel-body {
  padding: clamp(26px, 4vw, 46px);
}

.feature-panel-body p:last-child {
  margin-bottom: 0;
}

.toc {
  display: flex;
  max-width: 100%;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 40px;
  border-radius: var(--radius-medium);
  background: var(--color-panel);
  color: var(--color-text);
  padding: 10px;
}

.toc a {
  display: inline-flex;
  min-height: 42px;
  align-items: center;
  border-radius: var(--radius-pill);
  padding: 8px 15px;
  color: var(--color-text-muted);
  font-size: 14px;
  text-decoration: none;
}

.toc a:hover,
.toc a[aria-current="true"] {
  background: var(--color-bg);
  color: var(--color-text);
  box-shadow: var(--shadow-small);
}

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

.faq-item {
  overflow: clip;
  border-radius: var(--radius-medium);
  background: var(--color-bg);
  color: var(--color-text);
  box-shadow: var(--shadow-small);
}

.faq-item summary {
  position: relative;
  display: flex;
  min-height: 64px;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 17px 54px 17px 22px;
  cursor: pointer;
  font-weight: 600;
  list-style: none;
}

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

.faq-item summary::after {
  position: absolute;
  right: 22px;
  width: 22px;
  height: 22px;
  flex-shrink: 0;
  border-radius: var(--radius-pill);
  background: var(--color-panel-cool);
  color: var(--color-text);
  content: "+";
  font-size: 17px;
  font-weight: 400;
  line-height: 21px;
  text-align: center;
}

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

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

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

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

.glossary-card {
  position: relative;
  min-width: 0;
  border-radius: var(--radius-large);
  background: var(--color-bg);
  color: var(--color-text);
  padding: 28px;
  box-shadow: var(--shadow-small);
}

.glossary-card::before {
  display: block;
  width: 34px;
  height: 5px;
  margin-bottom: 22px;
  border-radius: var(--radius-pill);
  background: var(--color-accent);
  content: "";
}

.glossary-card dt {
  margin-bottom: 10px;
  font-family: var(--font-mono);
  font-size: 15px;
  font-weight: 600;
}

.glossary-card dd {
  margin: 0;
  color: var(--color-text-muted);
}

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

.download-card {
  display: flex;
  min-width: 0;
  flex-direction: column;
  border-radius: var(--radius-large);
  background: var(--color-bg);
  color: var(--color-text);
  padding: clamp(24px, 4vw, 38px);
  box-shadow: var(--shadow-large);
}

.download-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 20px;
}

.download-card-title {
  min-width: 0;
}

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

.download-version {
  color: var(--color-text-muted);
  font-family: var(--font-mono);
  font-size: 12px;
}

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

.download-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: auto;
  padding-top: 12px;
}

.download-filename {
  max-width: 100%;
  color: var(--color-text-muted);
  font-family: var(--font-mono);
  font-size: 12px;
  overflow-wrap: anywhere;
}

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

.article-card {
  display: flex;
  min-width: 0;
  flex-direction: column;
  border-radius: var(--radius-large);
  background: var(--color-bg);
  color: var(--color-text);
  padding: 28px;
  box-shadow: var(--shadow-small);
  transition: transform var(--transition-fast), box-shadow var(--transition-fast);
}

.article-card:hover {
  color: var(--color-text);
  transform: translateY(-3px);
  box-shadow: var(--shadow-large);
}

.article-card-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 18px;
  color: var(--color-text-muted);
  font-size: 12px;
}

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

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

.article-card-link {
  margin-top: auto;
  color: var(--color-accent-dark);
  font-weight: 600;
}

.callout {
  position: relative;
  margin-block: 28px;
  border-radius: var(--radius-medium);
  background: var(--color-panel-cool);
  color: var(--color-text);
  padding: 22px 24px 22px 54px;
}

.callout::before {
  position: absolute;
  top: 24px;
  left: 24px;
  width: 12px;
  height: 12px;
  border-radius: var(--radius-pill);
  background: var(--color-accent);
  content: "";
}

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

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

.callout-success {
  background: var(--color-success-wash);
  color: var(--color-text);
}

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

.callout-warning {
  background: var(--color-accent-wash);
  color: var(--color-text);
}

.prose {
  min-width: 0;
}

.prose h2 {
  scroll-margin-top: 92px;
  margin-top: 2.25em;
}

.prose h3 {
  scroll-margin-top: 92px;
  margin-top: 1.8em;
}

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

.data-table-wrap {
  max-width: 100%;
  overflow-x: auto;
  border-radius: var(--radius-medium);
  box-shadow: var(--shadow-small);
  -webkit-overflow-scrolling: touch;
}

.data-table-wrap table {
  margin-bottom: 0;
  background: var(--color-bg);
  color: var(--color-text);
}

.download-guide-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 28px;
  margin-top: 48px;
  border-radius: var(--radius-large);
  background: var(--color-panel-cool);
  color: var(--color-text);
  padding: clamp(24px, 4vw, 40px);
}

.download-guide-card h2,
.download-guide-card h3 {
  margin-bottom: 8px;
}

.download-guide-card p {
  max-width: 680px;
  margin-bottom: 0;
  color: var(--color-text-muted);
}

.dl-fab {
  position: fixed;
  right: max(18px, env(safe-area-inset-right));
  bottom: max(18px, env(safe-area-inset-bottom));
  z-index: 80;
  display: flex;
  max-width: min(320px, calc(100vw - 36px));
  align-items: center;
  gap: 12px;
  border-radius: var(--radius-pill);
  background: var(--color-accent);
  color: var(--color-text);
  padding: 11px 18px 11px 12px;
  box-shadow: var(--shadow-large);
  font-size: 14px;
  font-weight: 600;
  line-height: 1.35;
  text-decoration: none;
}

.dl-fab:hover {
  background: var(--color-accent-dark);
  color: var(--color-bg);
  transform: translateY(-2px);
}

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

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

.state-samples {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
}

@media (max-width: 900px) {
  .tab-layout {
    grid-template-columns: minmax(0, 1fr);
  }

  .tab-list {
    flex-direction: row;
    max-width: 100%;
    overflow-x: auto;
    padding: 5px;
    border-radius: var(--radius-pill);
    background: var(--color-panel);
    overscroll-behavior-inline: contain;
    scrollbar-width: thin;
  }

  .tab-list [role="tab"] {
    min-width: max-content;
    width: auto;
    border-radius: var(--radius-pill);
    padding-inline: 30px 16px;
  }

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

@media (max-width: 640px) {
  .glossary-grid,
  .download-grid,
  .article-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .toc {
    flex-wrap: nowrap;
    overflow-x: auto;
    overscroll-behavior-inline: contain;
  }

  .toc a {
    flex-shrink: 0;
  }

  .download-guide-card {
    align-items: stretch;
    flex-direction: column;
  }

  .download-guide-card .button {
    width: 100%;
  }

  .dl-fab {
    right: 16px;
    bottom: 16px;
  }

  .faq-item summary {
    padding-left: 18px;
  }
}