/* Spec 154 — route-owned Program composition recovery.
 *
 * This file only owns the public Program shell and its five topic pages. It
 * deliberately keeps the shared program_pages.css primitives available to
 * Department detail and school pages without making their generic
 * `.program-section` organism the Program page's composition owner.
 */

:where([data-runtime-theme="target-u"]) .program-detail-page {
    --program-catalog-readable: 48rem;
    min-width: 0;
    gap: var(--theme-spacing-lg);
    padding-block: var(--theme-spacing-lg) var(--theme-spacing-2xl);
}

:where([data-runtime-theme="target-u"]) .program-detail-page,
:where([data-runtime-theme="target-u"]) .program-detail-page * {
    box-sizing: border-box;
}

:where([data-runtime-theme="target-u"]) .program-detail-page h1,
:where([data-runtime-theme="target-u"]) .program-detail-page h2,
:where([data-runtime-theme="target-u"]) .program-detail-page h3,
:where([data-runtime-theme="target-u"]) .program-detail-page h4,
:where([data-runtime-theme="target-u"]) .program-detail-page p,
:where([data-runtime-theme="target-u"]) .program-detail-page dl {
    overflow-wrap: anywhere;
}

:where([data-runtime-theme="target-u"]) .program-catalog-identity {
    position: relative;
    min-width: 0;
    overflow: visible;
    border: 1px solid var(--theme-color-border);
    border-radius: var(--theme-radius-entity);
    background: var(--theme-color-surface);
}

:where([data-runtime-theme="target-u"]) .program-detail-page .program-page-header.program-catalog-identity {
    display: block;
    gap: 0;
    padding: 0;
    border: 1px solid var(--theme-color-border);
}

:where([data-runtime-theme="target-u"]) .program-catalog-identity::before {
    position: absolute;
    inset: 0 0 auto;
    height: 4px;
    border-radius: var(--theme-radius-entity) var(--theme-radius-entity) 0 0;
    background: var(--theme-color-primary);
    content: "";
}

:where([data-runtime-theme="target-u"]) .program-catalog-identity__body {
    display: grid;
    min-width: 0;
    gap: var(--theme-spacing-xl);
    padding: var(--theme-spacing-xl);
}

:where([data-runtime-theme="target-u"]) .program-catalog-identity__copy {
    display: grid;
    min-width: 0;
    max-width: var(--program-catalog-readable);
    gap: var(--theme-spacing-sm);
}

:where([data-runtime-theme="target-u"]) .program-detail-page .program-page-header__copy.program-catalog-identity__copy {
    gap: var(--theme-spacing-sm);
}

:where([data-runtime-theme="target-u"]) .program-catalog-identity__copy > * {
    margin-block: 0;
}

:where([data-runtime-theme="target-u"]) .program-catalog-identity__actions {
    display: flex;
    min-width: 0;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--theme-spacing-sm);
}

:where([data-runtime-theme="target-u"]) .program-catalog-identity__facts {
    display: grid;
    min-width: 0;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0;
    overflow: hidden;
    margin: var(--theme-spacing-sm) 0 0;
    border: 1px solid var(--theme-color-border);
    border-radius: var(--theme-radius-control);
    background: var(--theme-color-surface-muted);
}

:where([data-runtime-theme="target-u"]) .program-catalog-identity__facts > div {
    display: grid;
    min-width: 0;
    align-content: start;
    gap: var(--theme-spacing-xs);
    padding: var(--theme-spacing-md);
    border-inline-end: 1px solid var(--theme-color-border);
    border-block-end: 1px solid var(--theme-color-border);
}

:where([data-runtime-theme="target-u"]) .program-catalog-identity__facts dt {
    color: var(--theme-color-muted);
    font-size: var(--theme-text-micro);
    font-weight: 600;
}

:where([data-runtime-theme="target-u"]) .program-catalog-identity__facts dd {
    margin: 0;
    color: var(--theme-color-foreground);
    font-size: var(--theme-text-supporting);
    font-weight: 650;
}

:where([data-runtime-theme="target-u"]) .program-catalog-admissions-snapshot {
    display: grid;
    min-width: 0;
    gap: var(--theme-spacing-md);
    padding: var(--theme-spacing-lg) var(--theme-spacing-xl);
    border-block-start: 1px solid var(--theme-color-border);
    background: var(--theme-color-surface-muted);
}

:where([data-runtime-theme="target-u"]) .program-catalog-admissions-snapshot__heading {
    display: flex;
    min-width: 0;
    flex-wrap: wrap;
    align-items: baseline;
    justify-content: space-between;
    gap: var(--theme-spacing-sm) var(--theme-spacing-lg);
}

:where([data-runtime-theme="target-u"]) .program-catalog-admissions-snapshot__heading > * {
    margin: 0;
}

:where([data-runtime-theme="target-u"]) .program-catalog-admissions-snapshot__facts {
    display: grid;
    min-width: 0;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: var(--theme-spacing-md) var(--theme-spacing-xl);
    margin: 0;
}

:where([data-runtime-theme="target-u"]) .program-catalog-admissions-snapshot__facts > div {
    display: grid;
    min-width: 0;
    gap: 2px;
}

:where([data-runtime-theme="target-u"]) .program-catalog-admissions-snapshot__facts dt {
    color: var(--theme-color-muted);
    font-size: var(--theme-text-micro);
}

:where([data-runtime-theme="target-u"]) .program-catalog-admissions-snapshot__facts dd {
    margin: 0;
    font-size: var(--theme-text-supporting);
    font-weight: 650;
}

:where([data-runtime-theme="target-u"]) .program-detail-page .program-topic-nav {
    overflow: visible;
    border: 1px solid var(--theme-color-border);
    border-radius: var(--theme-radius-entity);
    background: var(--theme-color-surface);
}

:where([data-runtime-theme="target-u"]) .program-detail-page .program-topic-nav__track {
    display: grid;
    width: 100%;
    min-width: 0;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: var(--theme-spacing-xs);
    padding: var(--theme-spacing-sm);
}

:where([data-runtime-theme="target-u"]) .program-detail-page .program-topic-nav__link {
    min-width: 0;
    justify-content: center;
    padding-inline: var(--theme-spacing-sm);
    text-align: center;
    white-space: normal;
}

:where([data-runtime-theme="target-u"]) .program-detail-page .program-request-status:not(:empty) {
    margin-block-start: var(--theme-spacing-sm);
}

:where([data-runtime-theme="target-u"]) .program-topic-shell {
    display: grid;
    min-width: 0;
    gap: var(--theme-spacing-lg);
}

:where([data-runtime-theme="target-u"]) .program-topic-shell__header {
    display: grid;
    min-width: 0;
    max-width: none;
    gap: var(--theme-spacing-sm);
    padding: var(--theme-spacing-lg) var(--theme-spacing-xl);
    border: 1px solid var(--theme-color-border);
    border-radius: var(--theme-radius-entity);
    background: var(--theme-color-surface);
}

:where([data-runtime-theme="target-u"]) .program-topic-shell__header > * {
    max-width: var(--program-catalog-readable);
    margin: 0;
}

:where([data-runtime-theme="target-u"]) .program-topic-content {
    display: grid;
    min-width: 0;
    gap: var(--theme-spacing-lg);
}

:where([data-runtime-theme="target-u"]) .program-composition-surface {
    display: grid;
    min-width: 0;
    gap: var(--theme-spacing-lg);
    padding: var(--theme-spacing-xl);
    border: 1px solid var(--theme-color-border);
    border-radius: var(--theme-radius-entity);
    background: var(--theme-color-surface);
}

:where([data-runtime-theme="target-u"]) .program-composition-surface__header {
    display: grid;
    max-width: var(--program-catalog-readable);
    gap: var(--theme-spacing-sm);
}

:where([data-runtime-theme="target-u"]) .program-composition-surface__header > * {
    margin: 0;
}

:where([data-runtime-theme="target-u"]) .program-composition-surface--muted {
    background: var(--theme-color-surface-muted);
}

:where([data-runtime-theme="target-u"]) .program-official-links {
    display: grid;
    min-width: 0;
    gap: 0;
    margin: 0;
    padding: 0;
    border-block-start: 1px solid var(--theme-color-border);
    list-style: none;
}

:where([data-runtime-theme="target-u"]) .program-official-links > li {
    display: grid;
    min-width: 0;
    gap: var(--theme-spacing-xs);
    padding-block: var(--theme-spacing-md);
    border-block-end: 1px solid var(--theme-color-border);
}

:where([data-runtime-theme="target-u"]) .program-admissions-overview-band {
    display: grid;
    min-width: 0;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    overflow: hidden;
    border: 1px solid var(--theme-color-border);
    border-radius: var(--theme-radius-control);
    background: var(--theme-color-surface-muted);
}

:where([data-runtime-theme="target-u"]) .program-admissions-overview-band > div {
    display: grid;
    min-width: 0;
    gap: var(--theme-spacing-xs);
    padding: var(--theme-spacing-lg);
    border-inline-end: 1px solid var(--theme-color-border);
    border-block-end: 1px solid var(--theme-color-border);
}

:where([data-runtime-theme="target-u"]) .program-admissions-overview-band > div:nth-child(even) {
    border-inline-end: 0;
}

:where([data-runtime-theme="target-u"]) .program-admissions-overview-band > div:nth-child(n + 3) {
    border-block-end: 0;
}

:where([data-runtime-theme="target-u"]) .program-admissions-overview-band dt {
    color: var(--theme-color-muted);
    font-size: var(--theme-text-supporting);
}

:where([data-runtime-theme="target-u"]) .program-admissions-overview-band dd {
    margin: 0;
    color: var(--theme-color-primary);
    font-family: var(--theme-font-serif);
    font-size: var(--theme-text-decision-kpi);
    font-weight: var(--theme-text-decision-kpi--font-weight);
    font-variant-numeric: tabular-nums;
}

:where([data-runtime-theme="target-u"]) .program-track-group {
    display: grid;
    min-width: 0;
    gap: var(--theme-spacing-md);
}

:where([data-runtime-theme="target-u"]) .program-track-group__header {
    display: grid;
    min-width: 0;
    gap: var(--theme-spacing-xs);
}

:where([data-runtime-theme="target-u"]) .program-track-group__header > * {
    margin: 0;
}

:where([data-runtime-theme="target-u"]) .program-recruitment-surface {
    display: grid;
    min-width: 0;
    overflow: visible;
    gap: 0;
    padding: 0;
    border: 1px solid var(--theme-color-border);
    border-radius: var(--theme-radius-entity);
    background: var(--theme-color-surface);
}

:where([data-runtime-theme="target-u"]) .program-detail-page .program-track-summary.program-recruitment-surface {
    padding: 0;
    border: 1px solid var(--theme-color-border);
}

:where([data-runtime-theme="target-u"]) .program-recruitment-surface__header {
    display: grid;
    min-width: 0;
    gap: var(--theme-spacing-md);
    padding: var(--theme-spacing-lg) var(--theme-spacing-xl);
    border-block-end: 1px solid var(--theme-color-border);
    border-radius: var(--theme-radius-entity) var(--theme-radius-entity) 0 0;
    background: var(--theme-color-surface-muted);
}

:where([data-runtime-theme="target-u"]) .program-recruitment-surface__identity,
:where([data-runtime-theme="target-u"]) .program-recruitment-surface__quota {
    display: grid;
    min-width: 0;
    align-content: start;
    gap: var(--theme-spacing-xs);
}

:where([data-runtime-theme="target-u"]) .program-recruitment-surface__identity > *,
:where([data-runtime-theme="target-u"]) .program-recruitment-surface__quota > * {
    margin: 0;
}

:where([data-runtime-theme="target-u"]) .program-recruitment-surface__quota {
    color: var(--theme-color-muted);
    font-size: var(--theme-text-supporting);
}

:where([data-runtime-theme="target-u"]) .program-recruitment-surface__quota strong {
    color: var(--theme-color-foreground);
    font-family: var(--theme-font-data);
    font-variant-numeric: tabular-nums;
}

:where([data-runtime-theme="target-u"]) .program-detail-page .program-table-wrap {
    max-width: 100%;
    overflow-x: auto;
    border: 0;
    border-radius: 0 0 var(--theme-radius-entity) var(--theme-radius-entity);
    overscroll-behavior-inline: contain;
}

:where([data-runtime-theme="target-u"]) .program-detail-page .program-table {
    width: 100%;
    min-width: 58rem;
    border-collapse: collapse;
    table-layout: fixed;
    text-align: start;
}

:where([data-runtime-theme="target-u"]) .program-detail-page .program-table th,
:where([data-runtime-theme="target-u"]) .program-detail-page .program-table td {
    padding: var(--theme-spacing-md);
    border-block-end: 1px solid var(--theme-color-border);
    vertical-align: top;
    overflow-wrap: anywhere;
}

:where([data-runtime-theme="target-u"]) .program-detail-page .program-table thead {
    background: var(--theme-color-surface);
    color: var(--theme-color-muted);
    font-size: var(--theme-text-micro);
}

:where([data-runtime-theme="target-u"]) .program-detail-page .program-table tbody tr:last-child > * {
    border-block-end: 0;
}

:where([data-runtime-theme="target-u"]) .program-detail-page .program-table th[scope="row"] {
    color: var(--theme-color-primary);
    font-weight: 700;
}

:where([data-runtime-theme="target-u"]) .program-table__numeric {
    text-align: end;
    font-variant-numeric: tabular-nums;
}

:where([data-runtime-theme="target-u"]) .program-quota-state {
    display: grid;
    gap: 2px;
}

:where([data-runtime-theme="target-u"]) .program-quota-state small {
    color: var(--theme-color-muted);
    font-size: var(--theme-text-micro);
    line-height: var(--theme-text-micro--line-height);
}

:where([data-runtime-theme="target-u"]) .program-source-surface {
    display: grid;
    min-width: 0;
    gap: var(--theme-spacing-md);
    padding: var(--theme-spacing-lg) var(--theme-spacing-xl);
    border: 1px solid var(--theme-color-border);
    border-radius: var(--theme-radius-entity);
    background: var(--theme-color-surface-muted);
}

:where([data-runtime-theme="target-u"]) .program-source-surface > * {
    margin-block: 0;
}

:where([data-runtime-theme="target-u"]) .program-detail-page .program-decision-summary {
    max-width: none;
    padding: var(--theme-spacing-lg) var(--theme-spacing-xl);
    border: 1px solid var(--theme-color-border);
    border-radius: var(--theme-radius-entity);
    background: var(--theme-color-surface-muted);
}

@media (min-width: 40rem) {
    :where([data-runtime-theme="target-u"]) .program-catalog-identity__facts {
        grid-template-columns: repeat(auto-fit, minmax(9rem, 1fr));
    }

    :where([data-runtime-theme="target-u"]) .program-catalog-admissions-snapshot__facts {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    :where([data-runtime-theme="target-u"]) .program-admissions-overview-band {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }

    :where([data-runtime-theme="target-u"]) .program-admissions-overview-band > div,
    :where([data-runtime-theme="target-u"]) .program-admissions-overview-band > div:nth-child(even),
    :where([data-runtime-theme="target-u"]) .program-admissions-overview-band > div:nth-child(n + 3) {
        border-inline-end: 1px solid var(--theme-color-border);
        border-block-end: 0;
    }

    :where([data-runtime-theme="target-u"]) .program-admissions-overview-band > div:last-child {
        border-inline-end: 0;
    }
}

@media (min-width: 48rem) {
    :where([data-runtime-theme="target-u"]) .program-catalog-identity__body {
        grid-template-columns: minmax(0, 1fr) auto;
        align-items: end;
    }

    :where([data-runtime-theme="target-u"]) .program-catalog-identity__actions {
        justify-content: flex-end;
    }

    :where([data-runtime-theme="target-u"]) .program-recruitment-surface__header {
        grid-template-columns: minmax(0, 1fr) minmax(12rem, auto);
        align-items: start;
    }

    :where([data-runtime-theme="target-u"]) .program-recruitment-surface__quota {
        justify-items: end;
        text-align: end;
    }
}

@media (max-width: 39.999rem) {
    :where([data-runtime-theme="target-u"]) .program-detail-page {
        gap: var(--theme-spacing-md);
        padding-block: var(--theme-spacing-md) var(--theme-spacing-xl);
    }

    :where([data-runtime-theme="target-u"]) .program-catalog-identity__body,
    :where([data-runtime-theme="target-u"]) .program-composition-surface,
    :where([data-runtime-theme="target-u"]) .program-topic-shell__header {
        padding: var(--theme-spacing-lg);
    }

    :where([data-runtime-theme="target-u"]) .program-catalog-admissions-snapshot,
    :where([data-runtime-theme="target-u"]) .program-recruitment-surface__header,
    :where([data-runtime-theme="target-u"]) .program-source-surface {
        padding-inline: var(--theme-spacing-lg);
    }

    :where([data-runtime-theme="target-u"]) .program-catalog-identity__actions {
        align-items: stretch;
    }

    :where([data-runtime-theme="target-u"]) .program-catalog-identity__actions > *,
    :where([data-runtime-theme="target-u"]) .program-catalog-identity__actions .ui-button {
        max-width: 100%;
    }

    :where([data-runtime-theme="target-u"]) .program-catalog-identity__facts > div:nth-child(even) {
        border-inline-end: 0;
    }
}

@media (prefers-reduced-motion: reduce) {
    :where([data-runtime-theme="target-u"]) .program-detail-page * {
        scroll-behavior: auto;
    }
}
