/* Home, Reference, Quiz, and shared selector layouts. Keep page structure here, not in app.css overrides. */
.rh-home-page,
.rh-hub-page {
    width: min(100%, var(--rh-wide-width));
    margin-inline: auto;
}

.rh-home-hero--editorial {
    display: block;
    min-height: 0;
    padding: clamp(1.5rem, 5vw, 3rem);
    border: 1px solid var(--rh-border);
    border-radius: var(--rh-radius-card);
    background:
        radial-gradient(circle at 88% 18%, rgba(255, 255, 255, 0.18), transparent 17rem),
        linear-gradient(135deg, var(--rh-hero-start), var(--rh-hero-middle) 58%, var(--rh-hero-end));
    color: var(--rh-hero-text);
    box-shadow: var(--rh-shadow-2);
}

.rh-home-hero--editorial .rh-home-hero__main,
.rh-home-hero--editorial .rh-home-hero__copy {
    width: min(100%, 52rem);
    max-width: 52rem;
    margin: 0 auto;
}

.rh-home-hero--editorial .rh-home-hero__copy {
    display: grid;
    gap: var(--rh-space-4);
    text-align: center;
}

.rh-home-hero--editorial h1 {
    max-width: 17ch;
    margin-inline: auto;
    color: var(--rh-hero-text);
}

.rh-home-hero--editorial .rh-home-hero__lead {
    max-width: 60ch;
    margin-inline: auto;
    color: var(--rh-hero-text-muted);
}

.rh-home-hero--editorial .rh-home-hero__topline {
    color: var(--rh-hero-text-muted);
}

.rh-home-hero--editorial .rh-home-hero__secondary .rh-button {
    border-color: rgba(255, 255, 255, 0.42);
    background: rgba(255, 255, 255, 0.12);
    color: var(--rh-hero-text);
    justify-content: center;
}

.rh-home-hero--editorial .rh-home-hero__secondary .rh-button:hover {
    border-color: rgba(255, 255, 255, 0.7);
    background: rgba(255, 255, 255, 0.2);
}

.rh-home-hero__actions {
    display: grid;
    gap: var(--rh-space-3);
    justify-items: center;
}

.rh-home-hero__secondary {
    display: grid;
    grid-template-columns: repeat(2, minmax(8rem, 1fr));
    gap: var(--rh-space-2);
    width: min(100%, 25rem);
}

.rh-home-hero__primary,
.rh-home-hero__secondary .rh-button {
    width: 100%;
}

.rh-home-track-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    grid-auto-rows: 1fr;
    gap: var(--rh-space-4);
}

.rh-home-track-card {
    display: flex;
    min-width: 0;
    flex-direction: column;
    gap: var(--rh-space-4);
    padding: clamp(1.1rem, 3vw, 1.45rem);
    border: 1px solid var(--rh-border);
    border-top: 4px solid var(--rh-action);
    border-radius: var(--rh-radius-card);
    background: var(--rh-surface);
    box-shadow: var(--rh-shadow-1);
}

.rh-home-track-card--nouns {
    border-top-color: var(--rh-success);
}

.rh-home-track-card--adjectives {
    border-top-color: #7452a8;
}

.rh-home-track-card__copy {
    display: grid;
    grid-template-rows: auto minmax(3rem, auto) minmax(4.5rem, auto);
    gap: var(--rh-space-2);
    min-width: 0;
}

.rh-home-track-card__kicker {
    width: fit-content;
    padding: 0.25rem 0.55rem;
    border-radius: 999px;
    background: var(--rh-action-soft);
    color: var(--rh-action);
    font-size: 0.75rem;
    font-weight: 800;
    letter-spacing: 0.04em;
}

.rh-home-track-card--nouns .rh-home-track-card__kicker {
    background: var(--rh-success-soft);
    color: var(--rh-success);
}

.rh-home-track-card--adjectives .rh-home-track-card__kicker {
    background: color-mix(in srgb, #7452a8 12%, var(--rh-surface));
    color: #684497;
}

.rh-home-track-card h3 {
    margin: 0;
    color: var(--rh-text);
    font-family: var(--rh-font-display);
    font-size: clamp(1.6rem, 3vw, 2.1rem);
    line-height: 1.05;
    overflow-wrap: break-word;
}

.rh-home-track-card p {
    margin: 0;
    color: var(--rh-text-muted);
    line-height: 1.55;
}

.rh-home-track-card__actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: var(--rh-space-2);
    margin-top: auto;
}

.rh-home-track-card__actions .rh-button {
    width: 100%;
    min-width: 0;
    white-space: normal;
    text-align: center;
}

.rh-home-progress-preview {
    display: grid;
    grid-template-columns: none;
    grid-template-rows: auto;
    grid-auto-columns: minmax(15rem, 18rem);
    grid-auto-flow: column;
    align-items: stretch;
    gap: var(--rh-space-3);
    margin-inline: calc(var(--rh-space-3) * -1);
    padding: var(--rh-space-1) var(--rh-space-3) var(--rh-space-3);
    overflow-x: auto;
    scroll-snap-type: x proximity;
    scrollbar-width: thin;
}

.rh-module01-staircase {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 14rem), 1fr));
    gap: var(--rh-space-3);
}

.rh-module01-staircase--practice {
    margin-top: var(--rh-space-4);
}

.rh-module01-step-card {
    display: flex;
    min-width: 0;
    flex-direction: column;
    gap: var(--rh-space-2);
    min-height: 11.5rem;
    padding: var(--rh-space-4);
    scroll-snap-align: start;
    border: 1px solid var(--rh-border);
    border-radius: var(--rh-radius-card);
    background: var(--rh-surface);
    color: var(--rh-text);
    text-decoration: none;
    box-shadow: var(--rh-shadow-1);
}

.rh-module01-step-card:hover,
.rh-module01-step-card:focus-visible {
    border-color: var(--rh-action);
    background: var(--rh-action-soft);
}

.rh-module01-step-card--active {
    border-top: 3px solid var(--rh-action);
}

.rh-module02-step-card {
    border-top: 3px solid color-mix(in srgb, var(--rh-success) 70%, var(--rh-warning));
}

.rh-module02-step-card:hover,
.rh-module02-step-card:focus-visible {
    border-color: var(--rh-success);
    background: var(--rh-success-soft);
}

.rh-module02-step-card .rh-module01-step-card__status,
.rh-module02-step-card .rh-module01-step-card__focus {
    color: var(--rh-success);
}

.rh-module01-step-card strong,
.rh-module01-step-card p,
.rh-module01-step-card span {
    min-width: 0;
    max-width: 100%;
    overflow-wrap: break-word;
}

.rh-module01-step-card strong {
    line-height: 1.25;
}

.rh-module01-step-card p {
    margin: 0;
    color: var(--rh-text-muted);
    font-size: 0.9rem;
    line-height: 1.45;
}

.rh-module01-step-card__status,
.rh-module01-step-card__focus {
    width: fit-content;
    color: var(--rh-action);
    font-size: 0.75rem;
    font-weight: 760;
}

.rh-module01-step-card__focus {
    margin-top: auto;
}

.rh-home-staircase-note {
    max-width: 68ch;
    margin: 0;
    color: var(--rh-text-muted);
    font-size: 0.88rem;
}

.rh-hub-card,
.rh-hub-mini-card {
    min-width: 0;
    border-color: var(--rh-border);
    border-radius: var(--rh-radius-control);
    background: var(--rh-surface);
    color: var(--rh-text);
    box-shadow: none;
}

.rh-reference-topic-grid > *,
.rh-reference-topic-card {
    min-width: 0;
}

.rh-reference-topic-card {
    align-content: start;
}

.rh-hub-card:hover,
.rh-hub-card:focus-visible,
.rh-hub-mini-card:hover,
.rh-hub-mini-card:focus-visible {
    border-color: var(--rh-action);
    background: var(--rh-action-soft);
}

.rh-hub-mini-card--featured {
    border-color: var(--rh-action);
    background: var(--rh-action-soft);
    font-weight: 800;
}

.rh-practice-batch-selector {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: var(--rh-space-3);
    align-items: center;
    padding: var(--rh-space-3) var(--rh-space-4);
    border: 1px solid var(--rh-border);
    border-radius: var(--rh-radius-card);
    background: var(--rh-surface);
}

.rh-practice-domain-banner {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    gap: 0.1rem var(--rh-space-3);
    align-items: center;
    padding: var(--rh-space-3) var(--rh-space-4);
    border: 1px solid var(--rh-border);
    border-radius: var(--rh-radius-control);
    background: var(--rh-surface-subtle);
}

.rh-practice-domain-banner > span {
    grid-row: 1 / span 2;
    color: var(--rh-action);
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.rh-practice-domain-banner h1,
.rh-practice-domain-banner p {
    margin: 0;
}

.rh-practice-domain-banner h1 {
    font-size: 1.08rem;
}

.rh-practice-domain-banner p {
    color: var(--rh-text-muted);
    font-size: 0.82rem;
}

.rh-practice-batch-selector__copy {
    display: grid;
    gap: 0.15rem;
    min-width: 0;
}

.rh-practice-batch-selector p {
    display: block !important;
    margin: 0;
    color: var(--rh-text-muted);
    line-height: 1.3;
}

.rh-practice-batch-selector__options {
    display: grid;
    grid-template-columns: repeat(3, minmax(2.8rem, 1fr));
    gap: 0.25rem;
    min-width: 10rem;
    padding: 0.25rem;
    border: 1px solid var(--rh-border);
    border-radius: calc(var(--rh-radius-control) + 0.15rem);
    background: var(--rh-surface-subtle);
}

.rh-practice-batch-selector__option {
    display: grid;
    min-height: 2.75rem;
    place-items: center;
    border-radius: var(--rh-radius-control);
}

.rh-practice-batch-selector__option--active {
    border-color: var(--rh-action);
    background: var(--rh-action);
    color: #fff;
    box-shadow: var(--rh-shadow-1);
}

.rh-ending-table {
    display: grid;
    gap: var(--rh-space-1);
    max-width: 100%;
    margin-top: var(--rh-space-3);
    padding: var(--rh-space-2);
    overflow-x: auto;
    border: 1px solid var(--rh-border);
    border-radius: var(--rh-radius-control);
    background: var(--rh-surface-subtle);
}

.rh-ending-table__row {
    display: grid;
    grid-template-columns: minmax(4rem, 0.55fr) minmax(7.5rem, 1fr) minmax(7.5rem, 1fr);
    gap: var(--rh-space-1);
    min-width: 20rem;
}

.rh-ending-table__row > * {
    min-width: 0;
    padding: 0.55rem 0.65rem;
    border-radius: calc(var(--rh-radius-control) - 0.2rem);
    background: var(--rh-surface);
    color: var(--rh-text);
    font-size: 0.86rem;
}

.rh-ending-table__row--head span {
    background: var(--rh-action-soft);
    color: var(--rh-action);
    font-size: 0.74rem;
    font-weight: 800;
}

.rh-home-track-progress {
    display: grid;
    gap: 0.15rem;
    padding: var(--rh-space-3);
    border: 1px solid var(--rh-border);
    border-left: 4px solid var(--rh-action);
    border-radius: var(--rh-radius-control);
    background: var(--rh-surface-subtle);
}

.rh-home-track-progress span,
.rh-home-track-progress small {
    color: var(--rh-text-muted);
    font-size: 0.78rem;
}

.rh-home-track-progress strong {
    color: var(--rh-text);
}

.rh-home-track-card--nouns .rh-home-track-progress {
    border-left-color: var(--rh-success);
}

.rh-home-track-card--adjectives .rh-home-track-progress {
    border-left-color: #7452a8;
}

.rh-reference-type-diagnostic {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(22rem, 1fr);
    gap: var(--rh-space-4);
    margin-top: var(--rh-space-5);
    padding: var(--rh-space-4);
    border: 1px solid var(--rh-border);
    border-radius: var(--rh-radius-card);
    background: var(--rh-surface-subtle);
}

.rh-reference-type-diagnostic h3,
.rh-reference-type-diagnostic p {
    margin: 0;
}

.rh-reference-type-diagnostic p {
    color: var(--rh-text-muted);
}

.rh-reference-type-diagnostic__cards {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: var(--rh-space-3);
}

.rh-reference-type-diagnostic__cards article {
    display: grid;
    gap: var(--rh-space-1);
    min-width: 0;
    padding: var(--rh-space-3);
    border: 1px solid var(--rh-border);
    border-radius: var(--rh-radius-control);
    background: var(--rh-surface);
}

.rh-reference-type-diagnostic__cards span {
    color: var(--rh-action);
    font-weight: 750;
}

.rh-reference-type-diagnostic__cards small {
    color: var(--rh-text-muted);
}

.rh-reference-jump-nav {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: var(--rh-space-2);
    margin-top: var(--rh-space-2);
}

.rh-reference-jump-nav a {
    min-height: 2.75rem;
    padding: 0.65rem 0.85rem;
    border: 1px solid color-mix(in srgb, currentColor 38%, transparent);
    border-radius: var(--rh-radius-control);
    color: inherit;
    font-weight: 750;
    text-decoration: none;
}

.rh-reference-jump-nav a:hover,
.rh-reference-jump-nav a:focus-visible {
    background: color-mix(in srgb, currentColor 12%, transparent);
}

#verb-system,
#noun-system,
#adjective-system,
#catalogs {
    scroll-margin-top: 1rem;
}

.rh-reference-preview-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-items: start;
    gap: var(--rh-space-4);
}

.rh-reference-preview-card {
    display: grid;
    gap: var(--rh-space-3);
    min-width: 0;
    padding: var(--rh-space-4);
    border: 1px solid var(--rh-border);
    border-top: 3px solid var(--rh-action);
    border-radius: var(--rh-radius-card);
    background: var(--rh-surface);
    color: var(--rh-text);
    box-shadow: var(--rh-shadow-1);
}

.rh-reference-preview-grid--nouns .rh-reference-preview-card {
    border-top-color: var(--rh-success);
}

.rh-reference-module-card {
    display: flex;
    min-width: 0;
    min-height: 10rem;
    flex-direction: column;
    gap: var(--rh-space-2);
    padding: var(--rh-space-4);
    border: 1px solid var(--rh-border);
    border-top: 3px solid #7452a8;
    border-radius: var(--rh-radius-card);
    background: var(--rh-surface);
    color: var(--rh-text);
    text-decoration: none;
    box-shadow: var(--rh-shadow-1);
}

.rh-reference-module-card:hover,
.rh-reference-module-card:focus-visible {
    border-color: #7452a8;
    background: color-mix(in srgb, #7452a8 7%, var(--rh-surface));
}

.rh-reference-module-card strong,
.rh-reference-module-card p {
    margin: 0;
    overflow-wrap: break-word;
}

.rh-reference-module-card strong {
    font-family: var(--rh-font-display);
    font-size: 1.12rem;
    line-height: 1.2;
}

.rh-reference-module-card p {
    color: var(--rh-text-muted);
    font-size: 0.86rem;
    line-height: 1.45;
}

.rh-reference-module-card__status,
.rh-reference-module-card__action {
    width: fit-content;
    color: #684497;
    font-size: 0.75rem;
    font-weight: 790;
}

.rh-reference-module-card__action {
    margin-top: auto;
}

.rh-hub-card--adjective,
.rh-hub-mini-card--adjective {
    border-color: color-mix(in srgb, #7452a8 44%, var(--rh-border));
}

.rh-hub-card--adjective .rh-hub-card__kicker,
.rh-hub-mini-card--adjective {
    color: #684497;
}

.rh-reference-preview-card__header {
    display: grid;
    gap: var(--rh-space-1);
    min-width: 0;
}

.rh-reference-preview-card__header > span {
    width: fit-content;
    color: var(--rh-action);
    font-size: 0.76rem;
    font-weight: 820;
}

.rh-reference-preview-grid--nouns .rh-reference-preview-card__header > span {
    color: var(--rh-success);
}

.rh-reference-preview-card h3,
.rh-reference-preview-card p {
    margin: 0;
}

.rh-reference-preview-card h3 {
    font-family: var(--rh-font-display);
    font-size: clamp(1.22rem, 2.2vw, 1.55rem);
    line-height: 1.15;
}

.rh-reference-preview-card__header p,
.rh-reference-preview-card__note {
    color: var(--rh-text-muted);
    font-size: 0.86rem;
    line-height: 1.45;
}

.rh-reference-preview-table-wrap {
    max-width: 100%;
    overflow-x: auto;
    border: 1px solid var(--rh-border);
    border-radius: var(--rh-radius-control);
    background: var(--rh-surface-subtle);
    scrollbar-width: thin;
}

.rh-reference-preview-table {
    width: 100%;
    min-width: 27rem;
    border-collapse: collapse;
    color: var(--rh-text);
    font-size: 0.78rem;
}

.rh-reference-preview-table caption {
    padding: 0.58rem 0.7rem;
    color: var(--rh-text);
    font-weight: 800;
    text-align: left;
}

.rh-reference-preview-table th,
.rh-reference-preview-table td {
    padding: 0.52rem 0.62rem;
    border-top: 1px solid var(--rh-border);
    border-right: 1px solid var(--rh-border);
    line-height: 1.35;
    text-align: left;
    vertical-align: top;
}

.rh-reference-preview-table tr > :last-child {
    border-right: 0;
}

.rh-reference-preview-table thead th {
    background: var(--rh-action-soft);
    color: var(--rh-action);
    font-size: 0.72rem;
}

.rh-reference-preview-grid--nouns .rh-reference-preview-table thead th {
    background: var(--rh-success-soft);
    color: var(--rh-success);
}

.rh-reference-preview-table tbody th {
    min-width: 7.2rem;
    color: var(--rh-text);
    font-weight: 760;
}

.rh-reference-preview-card__action {
    width: fit-content;
    margin-top: auto;
    color: var(--rh-action);
    font-weight: 780;
    text-decoration: none;
}

.rh-reference-preview-grid--nouns .rh-reference-preview-card__action {
    color: var(--rh-success);
}

.rh-reference-preview-card__action:hover,
.rh-reference-preview-card__action:focus-visible {
    text-decoration: underline;
    text-underline-offset: 0.2em;
}

@media (max-width: 52rem) {
    .rh-home-track-grid {
        grid-template-columns: 1fr;
        grid-auto-rows: auto;
    }

    .rh-home-track-card__copy {
        grid-template-rows: auto;
    }

    .rh-reference-preview-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 44rem) {
    .rh-home-hero--editorial {
        padding: 1.25rem 1rem;
    }

    .rh-home-hero__secondary,
    .rh-home-track-card__actions {
        grid-template-columns: 1fr;
    }

    .rh-home-progress-preview {
        grid-auto-columns: minmax(14rem, 82vw);
    }

    .rh-practice-batch-selector {
        grid-template-columns: 1fr;
        align-items: stretch;
    }

    .rh-practice-batch-selector__options {
        width: 100%;
        min-width: 0;
    }

    .rh-reference-type-diagnostic,
    .rh-reference-type-diagnostic__cards {
        grid-template-columns: 1fr;
    }

    .rh-reference-preview-card {
        padding: var(--rh-space-3);
    }

    .rh-practice-domain-banner {
        grid-template-columns: 1fr;
    }

    .rh-practice-domain-banner > span {
        grid-row: auto;
    }
}
