.reactions-page,
.reaction-page {
  padding-bottom: var(--space-16);
}

.reactions-page .page-header {
  padding: var(--space-12) 0 var(--space-6);
}

.reaction-filters {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 240px) auto;
  gap: var(--space-2);
  max-width: 860px;
}

.reaction-search {
  position: relative;
  display: flex;
  align-items: center;
  min-width: 0;
}

.reaction-search .icon {
  position: absolute;
  left: 12px;
  color: var(--text-subtle);
  pointer-events: none;
}

.reaction-search .input {
  height: 40px;
  padding-left: 38px;
  font-size: 14.5px;
}

.reaction-filters .select,
.reaction-filters .button {
  height: 40px;
}

.reaction-chips {
  margin: var(--space-5) 0 var(--space-6);
}

.reaction-chips .icon {
  color: var(--text-subtle);
}

.result-count {
  min-height: 20px;
  margin-bottom: var(--space-2);
  color: var(--text-subtle);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}

.reaction-list {
  display: grid;
  margin: 0;
  padding: 0;
  list-style: none;
  border-top: 1px solid var(--border);
}

.reaction-row {
  position: relative;
  display: flex;
  align-items: center;
  gap: var(--space-4);
  border-bottom: 1px solid var(--border);
  transition: background-color 120ms ease;
}

.reaction-row:hover {
  background: var(--background-subtle);
}

.reaction-row-link {
  display: flex;
  flex: 1;
  align-items: center;
  gap: var(--space-5);
  min-width: 0;
  padding: var(--space-4) var(--space-2);
}

.reaction-thumb {
  display: grid;
  flex: none;
  place-items: center;
  width: 208px;
  height: 76px;
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}

.reaction-thumb .reaction-scheme {
  width: auto;
  max-width: 100%;
  max-height: 64px;
}

.reaction-row-body {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.reaction-row-title {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px var(--space-2);
  min-width: 0;
}

.reaction-row-title strong {
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.01em;
  overflow-wrap: anywhere;
}

.reaction-row-link:hover strong {
  color: var(--accent-text);
}

.reaction-row-summary {
  display: -webkit-box;
  overflow: hidden;
  color: var(--text-muted);
  font-size: 13.5px;
  line-height: 1.5;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.reaction-row-meta {
  color: var(--text-subtle);
  font-size: 12.5px;
}

.reaction-row-action {
  flex: none;
  margin-right: var(--space-2);
}

.badge-type {
  gap: 0;
  height: 20px;
  padding: 0 7px;
  font-size: 11.5px;
}

.badge-detail {
  margin-left: 5px;
  padding-left: 5px;
  border-left: 1px solid var(--border-strong);
  color: var(--text-subtle);
}

.type-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: var(--space-3);
}

.type-card {
  display: grid;
  align-content: start;
  gap: var(--space-2);
  padding: var(--space-4) var(--space-5);
  transition: border-color 150ms ease, background-color 150ms ease;
}

.type-card:hover {
  border-color: var(--accent-border);
  background: var(--surface-raised);
}

.type-card-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--space-3);
}

.type-card-head strong {
  font-size: 15px;
  font-weight: 600;
}

.type-card .count {
  color: var(--text-subtle);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}

.type-card-examples {
  display: -webkit-box;
  overflow: hidden;
  color: var(--text-muted);
  font-size: 13px;
  line-height: 1.5;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
}

.reaction-header {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--space-4) var(--space-8);
  padding: var(--space-6) 0 var(--space-6);
}

.reaction-heading {
  min-width: 0;
  max-width: 820px;
}

.reaction-heading h1 {
  font-size: clamp(28px, 4vw, 40px);
  font-weight: 650;
  line-height: 1.1;
  letter-spacing: -0.03em;
  overflow-wrap: anywhere;
  text-wrap: balance;
}

.index-name {
  margin-top: var(--space-2);
  color: var(--text-muted);
  font-size: 14px;
}

.reaction-badges {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin-top: var(--space-3);
}

.reaction-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

.scheme-panel {
  margin: 0;
  overflow: hidden;
}

.scheme-frame {
  display: grid;
  place-items: center;
  padding: var(--space-6) var(--space-4);
  background-image: radial-gradient(var(--grid-line) 1.2px, transparent 1.2px);
  background-size: 16px 16px;
}

.scheme-wide,
.scheme-tall {
  max-width: 100%;
}

.scheme-tall {
  display: none;
}

.reaction-scheme {
  display: block;
  max-width: 100%;
  height: auto;
  overflow: visible;
}

.orgsyn-scheme {
  display: grid;
  justify-items: center;
  gap: var(--space-3);
  padding: var(--space-6) var(--space-4) var(--space-4);
}

.orgsyn-scheme img {
  max-width: 100%;
  height: auto;
  mix-blend-mode: multiply;
}

.orgsyn-scheme figcaption {
  color: var(--text-subtle);
  font-size: 12.5px;
  text-align: center;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .orgsyn-scheme img {
    filter: invert(1) hue-rotate(180deg);
    mix-blend-mode: screen;
  }
}

:root[data-theme="dark"] .orgsyn-scheme img {
  filter: invert(1) hue-rotate(180deg);
  mix-blend-mode: screen;
}

.reaction-body {
  display: grid;
  grid-template-columns: minmax(0, 7fr) minmax(0, 4fr);
  gap: var(--space-8);
  align-items: start;
  padding-top: var(--space-8);
}

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

.reaction-main {
  display: grid;
  gap: var(--space-6);
  min-width: 0;
  max-width: var(--prose-width);
}

.reaction-main .lead {
  color: var(--text);
  font-size: 16.5px;
  line-height: 1.7;
  text-wrap: pretty;
}

.reaction-main a,
.related-list a span:first-child {
  text-decoration: none;
}

.reaction-main p a {
  color: var(--accent-text);
  text-decoration: underline;
  text-decoration-color: var(--accent-border);
  text-underline-offset: 3px;
}

.reaction-section h2 {
  margin-bottom: var(--space-2);
  font-size: 15px;
  font-weight: 600;
}

.reaction-section p,
.procedure-steps {
  color: var(--text-muted);
  font-size: 15px;
  line-height: 1.7;
}

.procedure-steps {
  display: grid;
  gap: var(--space-2);
  margin: 0;
  padding-left: var(--space-5);
}

.reaction-aside {
  display: grid;
  gap: var(--space-4);
  min-width: 0;
}

.equation {
  font-family: var(--font-mono);
  font-size: 12.5px;
}

.scale-cta .chips {
  margin-top: var(--space-3);
}

.section-title {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--space-2) var(--space-4);
  margin-bottom: var(--space-4);
}

.section-title h2 {
  font-size: 18px;
  font-weight: 650;
  letter-spacing: -0.02em;
}

.section-title a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--accent-text);
  font-size: 14px;
}

.reagent-table-frame {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-large);
  background: var(--surface);
}

.reagent-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
  line-height: 1.45;
  font-variant-numeric: tabular-nums;
}

.reagent-table thead th {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  background: var(--background-subtle);
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 500;
  text-align: left;
  white-space: nowrap;
}

.reagent-table tbody th,
.reagent-table td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: top;
}

.reagent-table tbody th {
  font-weight: 400;
}

.reagent-table tbody tr:last-child th,
.reagent-table tbody tr:last-child td {
  border-bottom: 0;
}

.reagent-table .numeric {
  text-align: right;
  white-space: nowrap;
}

.reagent-name {
  display: block;
  font-weight: 600;
  overflow-wrap: anywhere;
}

.reagent-name a:hover {
  color: var(--accent-text);
}

.reagent-cas {
  display: block;
  color: var(--text-subtle);
  font-size: 12px;
}

.reagent-note {
  display: block;
  max-width: 460px;
  margin-top: 4px;
  color: var(--text-muted);
  font-size: 12.5px;
  line-height: 1.5;
}

.role {
  display: inline-block;
  color: var(--text-muted);
  text-transform: capitalize;
}

.role-product {
  color: var(--accent-text);
}

.role-loading {
  display: block;
  color: var(--text-subtle);
  font-size: 12px;
}

.sds-link {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--text-muted);
  font-size: 12.5px;
  font-weight: 500;
}

.sds-link:hover {
  color: var(--accent-text);
}

.related-list {
  display: grid;
  margin: 0;
  padding: 0;
  list-style: none;
  border-top: 1px solid var(--border);
}

.related-list a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  padding: 10px 4px;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
  transition: background-color 120ms ease;
}

.related-list a:hover {
  background: var(--background-subtle);
}

.related-list a > span:first-child {
  min-width: 0;
  overflow-wrap: anywhere;
}

.related-list a:hover > span:first-child {
  color: var(--accent-text);
}

.related-meta {
  flex: none;
  color: var(--text-subtle);
  font-size: 12.5px;
}

.facts dd a {
  color: var(--accent-text);
}

@media (max-width: 900px) {
  .reaction-body {
    grid-template-columns: minmax(0, 1fr);
    gap: var(--space-6);
  }

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

  .reaction-filters .reaction-search {
    grid-column: 1 / -1;
  }
}

@media (max-width: 760px) {
  .reagent-table thead {
    display: none;
  }

  .reagent-table,
  .reagent-table tbody {
    display: block;
  }

  .reagent-table tr {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: var(--space-3) var(--space-3);
    padding: var(--space-4);
    border-bottom: 1px solid var(--border);
  }

  .reagent-table tbody tr:last-child {
    border-bottom: 0;
  }

  .reagent-table tbody th,
  .reagent-table td,
  .reagent-table .numeric {
    display: grid;
    align-content: start;
    gap: 1px;
    min-width: 0;
    padding: 0;
    border: 0;
    text-align: left;
    white-space: normal;
  }

  .reagent-table tbody th {
    display: block;
    grid-column: 1 / -1;
  }

  .reagent-table td::before {
    content: attr(data-label);
    color: var(--text-subtle);
    font-size: 11.5px;
    white-space: nowrap;
  }

  .reagent-table .role-loading {
    display: inline;
    margin-left: 6px;
  }
}

@media (max-width: 640px) {
  .scheme-wide {
    display: none;
  }

  .scheme-tall {
    display: block;
  }

  .reaction-row {
    flex-wrap: wrap;
    gap: 0;
  }

  .reaction-row-link {
    flex-basis: 100%;
    flex-direction: column;
    align-items: stretch;
    gap: var(--space-3);
  }

  .reaction-row:has(.reaction-row-action) .reaction-row-link {
    padding-bottom: var(--space-3);
  }

  .reaction-thumb {
    width: 100%;
    height: 88px;
  }

  .reaction-thumb .reaction-scheme {
    max-height: 74px;
  }

  .reaction-row-action {
    margin: 0 0 var(--space-4) var(--space-2);
  }

  .reaction-actions {
    width: 100%;
  }
}
