/* =============================================================================
   reactions.css — the Reactions hub (/reactions/) and the category examples
   pages (/reactions/<category>/). Shared page chrome comes from main.css;
   this file adds the hub cards, the type filter, the scheme list, and the
   focused-example dialog. Conventions per CLAUDE.md: the list loads once and
   only a filter change re-renders it; opening an example is an overlay, so
   nothing on the page moves behind it.
   ============================================================================= */

.rx-container {
    max-width: 900px;
    width: 100%;
    box-sizing: border-box;
    padding: 0 12px;
}

.rx-worksheet {
    margin: -0.4em 0 0.8em;
    font-size: 0.9rem;
    color: #555;
}

/* --- Hub cards (legacy: the hub page is gone; .rx-card styles stay for reuse) --- */
.rx-hub-grid {
    width: 100%;
    text-align: left;
    margin-top: 0.5em;
}

.rx-card h3 { font-size: 1.05rem; }

.rx-card-decks {
    margin: 0 0 12px;
    font-size: 0.9rem;
    color: #555;
    line-height: 1.4;
}

.rx-card-links {
    margin: 0;
    font-size: 0.95rem;
    font-weight: 600;
}

.rx-card-links a {
    color: #6153cc;
    text-decoration: none;
}

.rx-card-links a::after { content: " \2192"; }
.rx-card-links a:hover { text-decoration: underline; }

.rx-hub-views { margin: 0.6em 0 0.2em; }

.rx-hub-view { width: 100%; }

.rx-hub-group { width: 100%; margin-top: 1.4em; }
.rx-hub-group:first-child { margin-top: 0.4em; }

.rx-hub-group-title {
    font-size: 1.1rem;
    text-align: left;
    margin: 0 0 0.2em;
    padding-bottom: 0.25em;
    border-bottom: 1px solid #e3e3ea;
    color: #333;
}

.rx-hub-note {
    max-width: 40rem;
    margin: 1.6em auto 0;
    font-size: 0.9rem;
    color: #666;
    line-height: 1.5;
}

/* --- Type filter (same pill contract as the MS/IR difficulty rows) --- */
.pill-row {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    gap: 6px;
    margin-bottom: 0.4em;
}

.filter-pill {
    padding: 5px 14px;
    border: 2px solid #dee2e6;
    border-radius: 20px;
    cursor: pointer;
    font-size: 0.85rem;
    background: #fff;
    color: #555;
    transition: all 0.15s;
}

.filter-pill:hover { border-color: #6153cc; }

.filter-pill.active {
    background: #6153cc;
    border-color: #6153cc;
    color: #fff;
}

.filter-pill[hidden] { display: none; }

.rx-pill-n {
    margin-left: 4px;
    font-size: 0.78em;
    font-weight: 600;
    opacity: 0.75;
}

.rx-status {
    min-height: 1.4em;
    margin: 0 0 0.8em;
    font-size: 0.9rem;
    color: #666;
}

/* --- The list --- */
.rx-list {
    --rx-row-h: 150px;
    width: 100%;
    list-style: none;
    margin: 0;
    padding: 0;
    text-align: left;
}

/* The row is the card; the scheme is its link and the caption sits beside
   it so the citation can be a link of its own. */
.rx-row {
    margin: 0 0 12px;
    border: 1px solid #dee2e6;
    border-radius: 10px;
    background: #fff;
    padding: 8px 12px 6px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
    cursor: pointer;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.rx-row:hover,
.rx-row:has(.rx-row-link:focus-visible) {
    border-color: #6153cc;
    box-shadow: 0 3px 10px rgba(97, 83, 204, 0.15);
}

.rx-row-link {
    display: block;
    color: inherit;
    text-decoration: none;
    outline: none;
}

.rx-row-scheme {
    height: var(--rx-row-h);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.rx-row-meta {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 10px;
    margin-top: 6px;
    padding-top: 6px;
    border-top: 1px solid #f0f0f4;
    font-size: 0.85rem;
    color: #555;
}

.rx-row-deck { font-weight: 600; color: #333; }

.rx-row-cite {
    text-align: right;
    font-size: 0.82rem;
    color: #666;
}

a.rx-row-cite {
    color: #4d42a3;
    text-decoration: underline;
    text-underline-offset: 2px;
}

a.rx-row-cite:hover { color: #6153cc; }

/* --- Scheme: reactants (+) → conditions over arrow → products. Cells are
   sized by reactions.js from the bank SVGs' natural size × one shared scale
   factor, so relative molecule sizes are honest. --- */
.rx-scheme {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    max-width: 100%;
}

.rx-line {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    flex: 0 0 auto;
}

.rx-mol {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    justify-content: center;
}

.rx-mol svg { display: block; }

.rx-plus {
    flex: 0 0 20px;
    text-align: center;
    color: #444;
    font-size: 1.4rem;
    line-height: 1;
}

.rx-arrow {
    flex: 0 0 auto;
    width: 150px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
}

.rx-arrow-text {
    --rx-arrow-lines: 4;
    width: 100%;
    font-size: 0.78rem;
    line-height: 1.25;
    color: #333;
    text-align: center;
    max-height: calc(var(--rx-arrow-lines) * 1.25em + 0.1em);
    overflow: hidden;
    overflow-wrap: anywhere;
}

.rx-arrow-none { color: #b6b6c2; font-style: italic; }

.rx-arrow-yield {
    font-size: 0.78rem;
    line-height: 1.25;
    color: #555;
    text-align: center;
    white-space: nowrap;
}

.rx-arrow-col {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.rx-arrow--down .rx-arrow-yield { text-align: left; }

.rx-arrow-line {
    width: 100%;
    height: 14px;
    display: block;
}

/* Stacked (narrow) layout: reactants, a down arrow with the conditions
   beside it, products. The row grows to fit instead of scaling down. */
.rx-scheme--stack {
    flex-direction: column;
    gap: 6px;
    width: 100%;
}

.rx-scheme--stack .rx-line { max-width: 100%; flex-wrap: nowrap; }

.rx-arrow--down {
    flex-direction: row;
    width: auto;
    max-width: 100%;
    gap: 10px;
    align-items: center;
}

.rx-arrow--down .rx-arrow-line {
    width: 14px;
    height: 56px;
}

.rx-arrow--down .rx-arrow-text {
    width: auto;
    max-width: 240px;
    text-align: left;
}

.rx-row-scheme:has(.rx-scheme--stack) {
    height: auto;
    padding: 4px 0;
}

/* --- Focused example (dialog) --- */
.rx-focus {
    width: min(920px, 94vw);
    max-height: 92vh;
    box-sizing: border-box;
    margin: auto;
    padding: 16px 22px 18px;
    border: 1px solid #dee2e6;
    border-radius: 12px;
    background: #fff;
    color: #222;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.2);
    overflow-y: auto;
    text-align: left;
}

.rx-focus::backdrop { background: rgba(20, 20, 30, 0.45); }

.rx-focus-head {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 8px;
}

.rx-focus-title {
    flex: 1 1 auto;
    margin: 0;
    font-size: 1.25rem;
    text-align: left;
}

.rx-focus-pos {
    flex: 0 0 auto;
    font-size: 0.85rem;
    color: #666;
    white-space: nowrap;
}

.rx-focus-close {
    flex: 0 0 auto;
    width: 36px;
    height: 36px;
    padding: 0;
    border: 1px solid #dee2e6;
    border-radius: 50%;
    background: #fff;
    color: #444;
    font-size: 1.4rem;
    line-height: 1;
    cursor: pointer;
}

.rx-focus-close:hover { border-color: #6153cc; color: #6153cc; }

.rx-focus-scheme {
    height: min(340px, 42vh);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    border: 1px solid #eef0f4;
    border-radius: 10px;
    padding: 8px;
    box-sizing: border-box;
}

.rx-focus-scheme--stack {
    height: auto;
    max-height: 60vh;
    overflow-y: auto;
}

.rx-focus-text {
    margin-top: 12px;
    font-size: 0.95rem;
    line-height: 1.5;
}

.rx-focus-text p { margin: 0 0 6px; }

.rx-citation { color: #555; font-size: 0.9rem; }

.rx-focus-nav {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    margin-top: 14px;
}

.rx-focus-nav button {
    padding: 8px 16px;
    border: 2px solid #dee2e6;
    border-radius: 20px;
    background: #fff;
    color: #333;
    font-size: 0.9rem;
    cursor: pointer;
}

.rx-focus-nav button:hover:not(:disabled) { border-color: #6153cc; color: #6153cc; }
.rx-focus-nav button:disabled { opacity: 0.4; cursor: default; }

/* --- Phones --- */
@media (max-width: 560px) {
    .rx-container { padding: 0 6px; }
    .rx-row-link { padding: 6px 8px 4px; }
    /* the fixed Key Concepts tab sits at mid-height on the left edge;
       keep the pills off it */
    .rx-filter { padding: 0 30px; box-sizing: border-box; }
    .rx-filter .filter-pill { padding: 4px 10px; font-size: 0.8rem; }
    .rx-focus { padding: 12px 12px 14px; }
    .rx-focus-title { font-size: 1.05rem; }
    .rx-focus-nav button { padding: 8px 12px; font-size: 0.85rem; }
}

/* --- Prerendered row text: the crawlable sentence build-pages.mjs writes
   into every row, shown in the scheme slot until reactions.js draws the
   scheme over it (same fixed height, so nothing moves). --- */
.rx-row-text {
    margin: 0;
    padding: 0 18px;
    font-size: 0.9rem;
    line-height: 1.4;
    color: #666;
    text-align: center;
}

/* --- Family strip (replaced the filter pills 2026-09-09): the site's subnav
   markup (.roc-subnav-* in main.css), rendered statically by build-pages.mjs. --- */
