/* R07–R09 public school and Program compositions. */

/* Existing curriculum section: flat source-backed rows, no shared overrides. */
:where([data-runtime-theme="target-u"]) #curriculum-catalog {
    min-width: 0;
    overflow-wrap: anywhere;
}

:where([data-runtime-theme="target-u"]) #curriculum-catalog .curriculum-course-list {
    margin: 0;
    padding: 0;
    list-style: none;
}

:where([data-runtime-theme="target-u"]) #curriculum-catalog .curriculum-course-list > li {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: start;
    gap: var(--theme-spacing-md);
    padding-block: var(--theme-spacing-md);
    border-bottom: 1px solid var(--theme-color-border);
}

:where([data-runtime-theme="target-u"]) #curriculum-catalog .curriculum-course-name {
    margin-block: 0 var(--theme-spacing-xs);
    font-weight: 500;
}

:where([data-runtime-theme="target-u"]) #curriculum-catalog .curriculum-course-code {
    color: var(--theme-color-muted);
}

:where([data-runtime-theme="target-u"]) #curriculum-catalog .curriculum-source-link,
:where([data-runtime-theme="target-u"]) #curriculum-catalog .program-action-row > a {
    display: inline-flex;
    min-height: 44px;
    min-width: 44px;
    align-items: center;
}

:where([data-runtime-theme="target-u"]) #curriculum-catalog .curriculum-disclosure > summary {
    min-height: 44px;
    padding-block: var(--theme-spacing-sm);
    color: var(--theme-color-primary);
    cursor: pointer;
}

:where([data-runtime-theme="target-u"]:not([data-focus-modality="pointer"])) #curriculum-catalog .curriculum-disclosure > summary:focus-visible {
    outline: var(--theme-focus-ring-width) solid var(--theme-color-focus);
    outline-offset: var(--theme-focus-ring-gap);
}

:where([data-runtime-theme="target-u"]) #curriculum-catalog .curriculum-note {
    padding-block: var(--theme-spacing-md);
    border-bottom: 1px solid var(--theme-color-border);
}

:where([data-runtime-theme="target-u"]) #curriculum-catalog .curriculum-gaps {
    padding-inline-start: var(--theme-spacing-lg);
}

:where([data-runtime-theme="target-u"]) .program-pages {
    --program-readable-width: 52rem;
    --program-grid-min: 16rem;
    min-width: 0;
}

:where([data-runtime-theme="target-u"]) .program-action-row,
:where([data-runtime-theme="target-u"]) .program-chip-row {
    display: flex;
    min-width: 0;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--theme-spacing-sm);
    margin: 0;
    padding: 0;
    list-style: none;
}

:where([data-runtime-theme="target-u"]) .program-link {
    color: var(--theme-color-primary);
    text-underline-offset: var(--theme-spacing-xs);
}

:where([data-runtime-theme="target-u"]:not([data-focus-modality="pointer"])) .program-link:focus-visible,
:where([data-runtime-theme="target-u"]:not([data-focus-modality="pointer"])) .program-topic-nav a:focus-visible {
    outline: var(--theme-focus-ring-width) solid var(--theme-color-focus);
    outline-offset: var(--theme-focus-ring-gap);
}

:where([data-runtime-theme="target-u"]) .program-eyebrow {
    margin: 0;
    color: var(--theme-color-primary);
    font-size: var(--theme-text-supporting);
    font-weight: var(--theme-text-supporting--font-weight);
    line-height: var(--theme-text-supporting--line-height);
    letter-spacing: 0.08em;
}

:where([data-runtime-theme="target-u"]) .program-lead,
:where([data-runtime-theme="target-u"]) .program-muted {
    margin: 0;
    color: var(--theme-color-muted);
}

:where([data-runtime-theme="target-u"]) .program-lead {
    max-width: var(--program-readable-width);
    font-size: var(--theme-text-body);
    line-height: var(--theme-text-body--line-height);
}

:where([data-runtime-theme="target-u"]) .program-card-grid,
:where([data-runtime-theme="target-u"]) .program-metric-grid,
:where([data-runtime-theme="target-u"]) .program-two-column,
:where([data-runtime-theme="target-u"]) .program-three-column {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: var(--theme-spacing-lg);
}

/*
 * These two panels describe what a course of study feels like. They are not
 * feedback, so they must not borrow the success/info palette -- a green box
 * would imply the very judgement the copy above it disclaims.
 */
:where([data-runtime-theme="target-u"]) .program-fit-panel {
    padding-block: var(--theme-spacing-md);
    border-block-start: 1px solid var(--theme-color-border);
}

:where([data-runtime-theme="target-u"]) .program-fit-panel h4 {
    margin: 0 0 var(--theme-spacing-sm);
    font-size: var(--theme-text-panel-title);
    font-weight: var(--theme-text-panel-title--font-weight);
}

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

:where([data-runtime-theme="target-u"]) .program-data-value {
    margin: var(--theme-spacing-xs) 0 0;
    color: var(--theme-color-foreground);
    font-family: var(--theme-font-sans);
    font-size: var(--theme-text-dense-label);
    font-weight: var(--theme-text-dense-label--font-weight);
    line-height: var(--theme-text-dense-label--line-height);
    letter-spacing: var(--theme-text-dense-label--letter-spacing);
}

/* A data value may share the program layout hook while retaining the complete
   Mono data role.  Keep this explicit because program_pages.css loads after
   the shared runtime typography utilities. */
:where([data-runtime-theme="target-u"]) .program-data-value.ui-type-data {
    font-family: var(--theme-font-data);
    font-size: var(--theme-text-data);
    font-weight: var(--theme-text-data--font-weight);
    line-height: var(--theme-text-data--line-height);
    letter-spacing: normal;
    font-variant-numeric: tabular-nums;
}

:where([data-runtime-theme="target-u"]) .program-chip {
    display: inline-flex;
    min-height: 28px;
    align-items: center;
    padding: var(--theme-spacing-xs) var(--theme-spacing-sm);
    border-radius: var(--theme-radius-pill);
    background: var(--theme-color-primary-soft);
    color: var(--theme-color-primary);
    font-size: var(--theme-text-supporting);
    font-weight: var(--theme-text-supporting--font-weight);
    line-height: var(--theme-text-supporting--line-height);
    letter-spacing: var(--theme-text-supporting--letter-spacing);
}

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

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

:where([data-runtime-theme="target-u"]) .program-section:first-child {
    border-top: 0;
}

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

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

:where([data-runtime-theme="target-u"]) .program-flat-surface {
    min-width: 0;
    padding: var(--theme-spacing-card);
    border: 1px solid var(--theme-color-border);
    background: var(--theme-color-surface);
}

:where([data-runtime-theme="target-u"]) .program-track-summary {
    display: grid;
    min-width: 0;
    align-content: start;
    gap: var(--theme-spacing-lg);
    padding-block: var(--theme-spacing-lg);
    border-block-start: 1px solid var(--theme-color-border);
}

:where([data-runtime-theme="target-u"]) .program-track-summary__header {
    display: grid;
    gap: var(--theme-spacing-sm);
}

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

:where([data-runtime-theme="target-u"]) .program-track-summary__facts {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: var(--theme-spacing-lg);
    margin: 0;
    padding-block: var(--theme-spacing-md);
    border-block: 1px solid var(--theme-color-border);
}

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

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

:where([data-runtime-theme="target-u"]) .program-step-list,
:where([data-runtime-theme="target-u"]) .program-source-list {
    display: grid;
    gap: 0;
    margin: 0;
    padding: 0;
    border-top: 1px solid var(--theme-color-border);
    list-style: none;
}

:where([data-runtime-theme="target-u"]) .program-step-list > *,
:where([data-runtime-theme="target-u"]) .program-source-list > * {
    min-width: 0;
    padding-block: var(--theme-spacing-md);
    border-bottom: 1px solid var(--theme-color-border);
}

:where([data-runtime-theme="target-u"]) .program-topic-nav {
    position: relative;
    overflow-x: auto;
    border-block: 1px solid var(--theme-color-border);
    scrollbar-width: thin;
    scroll-snap-type: x proximity;
}

:where([data-runtime-theme="target-u"]) .program-topic-nav__track {
    display: flex;
    width: max-content;
    min-width: 100%;
    gap: var(--theme-spacing-xs);
    padding-block: var(--theme-spacing-sm);
}

/* Topic navigation is page navigation, not the shared segmented filter owner. */
:where([data-runtime-theme="target-u"]) .program-topic-nav__link {
    display: inline-flex;
    min-height: 44px;
    align-items: center;
    padding: 10px 14px;
    border-radius: var(--theme-radius-control);
    color: var(--theme-color-muted);
    font-size: var(--theme-text-control);
    font-weight: var(--theme-text-control--font-weight);
    letter-spacing: var(--theme-text-control--letter-spacing);
    line-height: var(--theme-text-control--line-height);
    text-decoration: none;
    scroll-snap-align: center;
}

:where([data-runtime-theme="target-u"]) .program-topic-nav__link[aria-current="page"] {
    background: var(--theme-color-surface-selected);
    color: var(--theme-color-primary);
}

@media (max-width: 47.999rem) {
    /* A Program topic is page navigation, not a clipped filter rail. Keep all
       destinations visible on a phone, including the no-JS baseline. */
    :where([data-runtime-theme="target-u"]) .program-topic-nav {
        overflow-x: visible;
        scroll-snap-type: none;
    }

    :where([data-runtime-theme="target-u"]) .program-topic-nav__track {
        width: 100%;
        flex-wrap: wrap;
    }

    :where([data-runtime-theme="target-u"]) .program-topic-nav__link {
        flex: 1 1 calc(50% - var(--theme-spacing-xs));
        justify-content: center;
    }
}


:where([data-runtime-theme="target-u"]) .program-topic-nav__link.htmx-request {
    cursor: progress;
    text-decoration: underline;
}

:where([data-runtime-theme="target-u"]) [data-program-panel][aria-busy="true"] {
    opacity: 0.68;
}

:where([data-runtime-theme="target-u"]) .program-request-status:empty {
    display: none;
}

/* R08 Program composition.  These selectors deliberately stay
   behind route owners so the shared R07/R09/R17/R18/R19 consumers of this
   stylesheet retain their existing layout. */
:where([data-runtime-theme="target-u"]) .program-detail-page {
    gap: var(--theme-spacing-lg);
    padding-block: var(--theme-spacing-xl);
}

:where([data-runtime-theme="target-u"]) .program-mobile-return {
    width: fit-content;
    max-width: 100%;
    justify-content: flex-start;
}

:where([data-runtime-theme="target-u"]) .program-identity-facts {
    display: flex;
    min-width: 0;
    flex-wrap: wrap;
    gap: var(--theme-spacing-sm) var(--theme-spacing-xl);
    margin: var(--theme-spacing-sm) 0 0;
    padding-block-start: var(--theme-spacing-sm);
    border-block-start: 1px solid var(--theme-color-border);
}

:where([data-runtime-theme="target-u"]) .program-identity-facts > div {
    display: grid;
    min-width: min(100%, 8rem);
    gap: 2px;
}

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

:where([data-runtime-theme="target-u"]) .program-identity-facts dd {
    margin: 0;
    font-size: var(--theme-text-supporting);
    font-weight: var(--theme-text-supporting--font-weight);
    line-height: var(--theme-text-supporting--line-height);
}

:where([data-runtime-theme="target-u"]) .program-detail-page .program-topic-nav__track {
    box-sizing: border-box;
    padding-inline: 3px;
}

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

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

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

:where([data-runtime-theme="target-u"]) .program-decision-summary {
    display: grid;
    max-width: var(--program-readable-width);
    grid-template-columns: minmax(7rem, auto) minmax(0, 1fr);
    gap: var(--theme-spacing-sm) var(--theme-spacing-lg);
    align-items: baseline;
    padding-block: var(--theme-spacing-md);
    border-block: 1px solid var(--theme-color-border);
}

:where([data-runtime-theme="target-u"]) .program-decision-summary strong {
    color: var(--theme-color-primary);
    font-size: var(--theme-text-supporting);
}

:where([data-runtime-theme="target-u"]) .program-decision-summary p {
    margin: 0;
    color: var(--theme-color-muted);
    font-size: var(--theme-text-supporting);
    line-height: var(--theme-text-supporting--line-height);
}

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

:where([data-runtime-theme="target-u"]) .program-topic-content > .program-section:first-child {
    border-block-start: 1px solid var(--theme-color-border);
}

:where([data-runtime-theme="target-u"]) .program-track-summary__title {
    display: grid;
    gap: var(--theme-spacing-sm);
}

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

:where([data-runtime-theme="target-u"]) .program-track-summary__quota {
    display: grid;
    align-content: start;
    gap: var(--theme-spacing-xs);
    min-width: 10rem;
}

:where([data-runtime-theme="target-u"]) .program-track-summary__quota .program-data-value {
    margin: 0;
    font-family: var(--theme-font-data);
    font-size: var(--theme-text-data);
    font-weight: var(--theme-text-data--font-weight);
    line-height: var(--theme-text-data--line-height);
    letter-spacing: normal;
    font-variant-numeric: tabular-nums;
}

:where([data-runtime-theme="target-u"]:not([data-focus-modality="pointer"])) .program-detail-page .program-table-wrap:focus-visible {
    outline: var(--theme-focus-ring-width) solid var(--theme-color-focus);
    outline-offset: var(--theme-focus-ring-gap);
}

:where([data-runtime-theme="target-u"]) .program-table-wrap {
    max-width: 100%;
    overflow-x: auto;
    border-block: 1px solid var(--theme-color-border);
}

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

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

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

:where([data-runtime-theme="target-u"]) .program-table--compact {
    min-width: 32rem;
}

:where([data-runtime-theme="target-u"]) .program-bar-list {
    display: grid;
    gap: var(--theme-spacing-md);
}

:where([data-runtime-theme="target-u"]) .program-bar-row {
    display: grid;
    grid-template-columns: minmax(7rem, auto) minmax(8rem, 1fr) auto;
    align-items: center;
    gap: var(--theme-spacing-sm);
}

:where([data-runtime-theme="target-u"]) .program-bar-track {
    height: var(--theme-spacing-sm);
    overflow: hidden;
    border-radius: var(--theme-radius-pill);
    background: var(--theme-color-surface-muted);
}

:where([data-runtime-theme="target-u"]) .program-bar-value {
    /* The track is a grid item and gets blockified; its fill is a plain span,
       so it has to be blockified here or the width never applies. */
    display: block;
    width: clamp(0%, var(--program-value, 0%), 100%);
    height: 100%;
    border-radius: inherit;
    background: var(--theme-color-primary);
}

:where([data-runtime-theme="target-u"]) .program-offering-selector {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: var(--theme-spacing-xs);
    margin: 0;
    padding: 0;
    list-style: none;
}

:where([data-runtime-theme="target-u"]) .program-offering-selector a,
:where([data-runtime-theme="target-u"]) .program-offering-selector > li > span {
    display: flex;
    min-height: 44px;
    align-items: center;
    justify-content: space-between;
    gap: var(--theme-spacing-sm);
    padding: var(--theme-spacing-sm) var(--theme-spacing-md);
    border: 1px solid var(--theme-color-border);
    border-radius: var(--theme-radius-control);
    background: var(--theme-color-surface);
    color: var(--theme-color-foreground);
    text-decoration: none;
}


:where([data-runtime-theme="target-u"]) .program-stage-flow {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: var(--theme-spacing-sm);
    margin: 0;
    padding: 0;
    list-style: none;
}

:where([data-runtime-theme="target-u"]) .program-stage {
    display: grid;
    grid-template-columns: 2rem minmax(0, 1fr);
    gap: var(--theme-spacing-sm);
    align-items: start;
    padding-block: var(--theme-spacing-sm);
    border-bottom: 1px solid var(--theme-color-border);
}

:where([data-runtime-theme="target-u"]) .program-stage__index {
    display: grid;
    width: 2rem;
    height: 2rem;
    place-items: center;
    border-radius: var(--theme-radius-marker);
    background: var(--theme-color-primary-soft);
    color: var(--theme-color-primary);
    font-family: var(--theme-font-data);
    font-size: var(--theme-text-data);
    font-weight: var(--theme-text-data--font-weight);
    line-height: var(--theme-text-data--line-height);
    font-variant-numeric: tabular-nums;
}

:where([data-runtime-theme="target-u"]) .program-rich-text {
    max-width: var(--program-readable-width);
    color: var(--theme-color-muted);
    line-height: var(--theme-text-body--line-height);
    overflow-wrap: anywhere;
}

:where([data-runtime-theme="target-u"]) .program-rich-text > * + * {
    margin-top: var(--theme-spacing-sm);
}

:where([data-runtime-theme="target-u"]) .program-analysis-summary {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 0;
    margin: 0;
    border-block: 1px solid var(--theme-color-border);
}

:where([data-runtime-theme="target-u"]) .program-analysis-summary > * {
    min-width: 0;
    padding: var(--theme-spacing-lg) 0;
    border-bottom: 1px solid var(--theme-color-border);
}

:where([data-runtime-theme="target-u"]) .program-panel-shell {
    display: grid;
    gap: var(--theme-spacing-md);
    padding-block: var(--theme-spacing-lg);
    border-block: 1px solid var(--theme-color-border);
}

:where([data-runtime-theme="target-u"]) [data-analysis-panel-content] {
    display: grid;
    gap: var(--theme-spacing-md);
    min-width: 0;
}

:where([data-runtime-theme="target-u"]) .program-request-status:not(.sr-only):not(:empty) {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: var(--theme-spacing-sm) var(--theme-spacing-md);
}

:where([data-runtime-theme="target-u"]) [data-analysis-dialog-host],
:where([data-runtime-theme="target-u"]) [data-analysis-dialog-host] > [data-analysis-panel-content] {
    min-width: 0;
}

:where([data-runtime-theme="target-u"]) [data-analysis-dialog-host] .program-panel-shell {
    padding-block: 0;
    border-block: 0;
}

@media (hover: hover) and (pointer: fine) {
    :where([data-runtime-theme="target-u"]) .program-link:hover,
    :where([data-runtime-theme="target-u"]) .program-topic-nav a:hover {
        color: var(--theme-color-primary-light);
        text-decoration: underline;
    }

    :where([data-runtime-theme="target-u"]) .program-offering-selector a:hover {
        border-color: var(--theme-color-border-strong);
        background: var(--theme-color-surface-muted);
    }
}

@media (min-width: 40rem) {
    :where([data-runtime-theme="target-u"]) .program-metric-grid,
    :where([data-runtime-theme="target-u"]) .program-card-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

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

@media (min-width: 48rem) {
    :where([data-runtime-theme="target-u"]) .program-two-column {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

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

    :where([data-runtime-theme="target-u"]) .program-detail-page .program-track-summary__header {
        grid-template-columns: minmax(0, 1fr) minmax(10rem, auto);
        align-items: end;
    }

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

@media (min-width: 64rem) {
    :where([data-runtime-theme="target-u"]) .program-metric-grid,
    :where([data-runtime-theme="target-u"]) .program-card-grid,
    :where([data-runtime-theme="target-u"]) .program-three-column {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

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

    :where([data-runtime-theme="target-u"]) .program-analysis-summary > * {
        padding-inline: var(--theme-spacing-lg);
        border-inline-end: 1px solid var(--theme-color-border);
        border-bottom: 0;
    }

    :where([data-runtime-theme="target-u"]) .program-analysis-summary > :first-child {
        padding-inline-start: 0;
    }

    :where([data-runtime-theme="target-u"]) .program-analysis-summary > :last-child {
        padding-inline-end: 0;
        border-inline-end: 0;
    }
}

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

    :where([data-runtime-theme="target-u"]) .program-detail-page .program-topic-nav {
        overflow-x: visible;
    }

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

    :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-decision-summary {
        grid-template-columns: minmax(0, 1fr);
        gap: var(--theme-spacing-xs);
    }

    :where([data-runtime-theme="target-u"]) .program-detail-page .program-track-summary__quota {
        padding-block-start: var(--theme-spacing-sm);
        border-block-start: 1px solid var(--theme-color-border);
    }
}

@media (max-width: 21.999rem) {
    :where([data-runtime-theme="target-u"]) .program-detail-page .program-topic-nav__track {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

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

/* University detail: admissions track cards. */
:where([data-runtime-theme="target-u"]) .program-pages[data-ui-route="university-detail"] .program-track-summary {
    padding: var(--theme-spacing-card);
    border: 1px solid var(--theme-color-border);
    background: var(--theme-color-surface);
}

/* Shared page hero and breadcrumb for 校系分則 (offering-detail-page) and
   學系介紹 (program-detail-page): one layout so breadcrumb, title and the
   favorite/preference actions land in the same place on both page types.
   Moved verbatim from offering_detail.css; only the route owner widened. */
:is(.offering-detail-page, .program-detail-page, .school-detail-page) .offering-hero {
    display: grid; grid-template-columns: minmax(0, 1fr); align-items: end;
    gap: var(--theme-spacing-lg); padding-block: var(--theme-spacing-lg) 0;
    /* The page's flex gap follows every child. The hero sits 16px above the
       first section on all three page types, whatever that gap is. */
    margin-block-end: calc(var(--theme-spacing-lg) - var(--offering-section-gap));
    border-block: 0;
    background: transparent;
}
/* Breadcrumb to hero is 24px on all three page types. */
:is(.offering-detail-page, .program-detail-page, .school-detail-page) > .ui-breadcrumb {
    margin-block-end: calc(var(--theme-spacing-xl) - var(--offering-section-gap));
}
.offering-hero__copy { display: grid; gap: var(--theme-spacing-sm); min-width: 0; max-width: 52rem; }
.offering-hero__context, .offering-hero__details { display: flex; flex-wrap: wrap; align-items: baseline; gap: var(--theme-spacing-sm) var(--theme-spacing-lg); min-width: 0; }
.offering-hero__meta { color: var(--theme-color-muted); }
.offering-hero__actions { display: grid; gap: var(--theme-spacing-xs); min-width: 0; }
.offering-hero__primary { display: flex; flex-wrap: wrap; align-items: center; gap: var(--theme-spacing-sm); }
.offering-hero h1 > span { display: inline-block; }
.offering-hero__nav { display: flex; flex-wrap: wrap; gap: var(--theme-spacing-xs) var(--theme-spacing-md); }
.offering-hero__nav > a.ui-button--inline { margin-inline: 0; }
.offering-hero__nav { align-items: center; }
.offering-hero__nav, .offering-hero .ui-favorite-control { font-size: var(--theme-text-control); font-weight: var(--theme-text-control--font-weight); line-height: var(--theme-text-control--line-height); letter-spacing: var(--theme-text-control--letter-spacing); }
@media (min-width: 48rem) {
    :is(.offering-detail-page, .program-detail-page, .school-detail-page) .offering-hero { grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "context context" "title actions" "details details"; align-items: center; gap: var(--theme-spacing-sm) var(--theme-spacing-lg); }
    .offering-hero__copy { display: contents; }
    .offering-hero__context { grid-area: context; }
    .offering-hero h1 { grid-area: title; max-width: 52rem; }
    .offering-hero__details { grid-area: details; }
    .offering-hero__actions { grid-area: actions; }
    .offering-hero__primary { justify-content: flex-end; }
}
@media (max-width: 47.999rem) {
    /* 學系介紹: 收藏 closes the 分類 line, as on the 校系分則 hero
       (offering_detail_reading.css), so the title keeps the full width. */
    .program-detail-page .offering-hero {
        grid-template-columns: minmax(0, 1fr) auto;
        grid-template-areas: "context context" "title title" "details favorite";
        gap: var(--theme-spacing-sm);
    }
    .program-detail-page .offering-hero :is(.offering-hero__copy, .offering-hero__actions, .offering-hero__primary) { display: contents; }
    .program-detail-page .offering-hero__context { grid-area: context; }
    .program-detail-page .offering-hero h1 { grid-area: title; }
    .program-detail-page .offering-hero__details { grid-area: details; }
    /* Centre the heart on the chip line and pull the 44px owner's inner space
       out of the row height and to the content edge. */
    .program-detail-page .offering-hero__primary > .ui-favorite-control { grid-area: favorite; align-self: center; margin-block: -8px; margin-inline-end: -12px; }
}
@media (max-width: 39.999rem) {
    .program-detail-page .offering-hero .ui-favorite-control { min-width: 44px; width: 44px; padding-inline: 0; justify-content: center; }
    .program-detail-page .offering-hero .ui-favorite-control span { position: absolute; clip-path: inset(50%); width: 1px; height: 1px; overflow: hidden; }
}

/* Program page MVP (specs/tasks/active/2026-11-17-program-page-mvp.md).
   Scoped to the program-detail route owner; shared consumers of this
   stylesheet (unit, school, offering pages) are unaffected. */
/* Page spacing matches the 校系分則 page (the shared .ui-page rhythm). */
:where([data-runtime-theme="target-u"]) .program-pages.program-detail-page {
    --offering-section-gap: var(--theme-spacing-xl);
    gap: var(--offering-section-gap);
    padding-block: var(--theme-spacing-2xl);
}

/* Lead and facts sit under the shared hero's detail row, full width. */
:is(.program-detail-page, .school-detail-page) .offering-hero > .offering-hero__copy > :is(.program-hero__lead, .program-hero__facts) {
    grid-column: 1 / -1;
}

:where([data-runtime-theme="target-u"]) :is(.program-detail-page, .school-detail-page) .program-hero__lead {
    margin: 0;
    max-width: 52rem;
    color: var(--theme-color-foreground);
}

/* 所在地、所屬學院、考招管道: one row of equal columns at every width. */
:where([data-runtime-theme="target-u"]) :is(.program-detail-page, .school-detail-page) .program-hero__facts {
    display: grid;
    grid-auto-columns: minmax(0, 1fr);
    grid-auto-flow: column;
    margin: var(--theme-spacing-md) 0 0;
    border-block: 1px solid var(--theme-color-border);
}

:where([data-runtime-theme="target-u"]) :is(.program-detail-page, .school-detail-page) .program-hero__facts > div {
    min-width: 0;
    padding: var(--theme-spacing-md);
    border-inline-start: 1px solid var(--theme-color-border);
}

:where([data-runtime-theme="target-u"]) :is(.program-detail-page, .school-detail-page) .program-hero__facts > div:first-child {
    padding-inline-start: 0;
    border-inline-start: 0;
}

:where([data-runtime-theme="target-u"]) :is(.program-detail-page, .school-detail-page) .program-hero__facts dt {
    color: var(--theme-color-muted);
    font-size: var(--theme-text-supporting);
    font-weight: var(--theme-text-supporting--font-weight);
    line-height: var(--theme-text-supporting--line-height);
}

:where([data-runtime-theme="target-u"]) :is(.program-detail-page, .school-detail-page) .program-hero__facts dd {
    margin: 2px 0 0;
    overflow-wrap: anywhere;
    font-size: var(--theme-text-dense-label);
    font-weight: var(--theme-text-dense-label--font-weight);
    line-height: var(--theme-text-dense-label--line-height);
}

:where([data-runtime-theme="target-u"]) :is(.program-detail-page, .school-detail-page) .program-hero__fact-part {
    white-space: nowrap;
}

@media (min-width: 48rem) {
    :where([data-runtime-theme="target-u"]) :is(.program-detail-page, .school-detail-page) .program-hero__facts > div {
        padding-inline: var(--theme-spacing-lg);
    }
}

/* The topic bar stays under the fixed site nav while the page scrolls. */
:where([data-runtime-theme="target-u"]) .program-detail-page .program-topic-nav-wrap {
    position: sticky;
    top: 4rem;
    z-index: 5;
    background: var(--theme-color-background);
}

/* One section grammar for all three topics: a 24px section title with an
   optional supporting line on the same row, sections split by a divider, and
   white surfaces reserved for the data itself. */
:where([data-runtime-theme="target-u"]) .program-detail-page .program-topic-content {
    display: grid;
    gap: 0;
}

:where([data-runtime-theme="target-u"]) .program-tab-section,
:where([data-runtime-theme="target-u"]) .program-detail-page .program-composition-surface {
    display: grid;
    min-width: 0;
    gap: var(--theme-spacing-lg);
    padding: var(--theme-spacing-2xl) 0;
    border: 0;
    border-block-end: 1px solid var(--theme-color-border);
    border-radius: 0;
    background: transparent;
}

:where([data-runtime-theme="target-u"]) .program-tab-section:last-child,
:where([data-runtime-theme="target-u"]) .program-detail-page .program-composition-surface:last-child {
    border-block-end: 0;
}

:where([data-runtime-theme="target-u"]) .program-section-head,
:where([data-runtime-theme="target-u"]) .program-detail-page .program-composition-surface__header {
    display: flex;
    max-width: none;
    flex-wrap: wrap;
    align-items: baseline;
    justify-content: space-between;
    gap: var(--theme-spacing-xs) var(--theme-spacing-lg);
}

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

:where([data-runtime-theme="target-u"]) .program-section-head > .ui-type-supporting {
    color: var(--theme-color-muted);
}

/* The curriculum templates keep their markup; their eyebrow reads as the
   supporting line after the title, and any intro sentence takes a full row. */
:where([data-runtime-theme="target-u"]) .program-detail-page .program-composition-surface__header > .program-eyebrow {
    order: 1;
    color: var(--theme-color-muted);
    font-size: var(--theme-text-supporting);
    font-weight: var(--theme-text-supporting--font-weight);
    letter-spacing: var(--theme-text-supporting--letter-spacing);
}

:where([data-runtime-theme="target-u"]) .program-detail-page .program-composition-surface__header > :not(h3):not(.program-eyebrow):not(.program-topic-question) {
    order: 2;
    flex-basis: 100%;
}

:where([data-runtime-theme="target-u"]) .program-about__pending {
    margin: 0;
    color: var(--theme-color-muted);
    font-size: var(--theme-text-dense-label);
    font-weight: var(--theme-text-dense-label--font-weight);
    line-height: var(--theme-text-dense-label--line-height);
}

:where([data-runtime-theme="target-u"]) .program-about__source {
    margin: 0;
    color: var(--theme-color-muted);
}

:where([data-runtime-theme="target-u"]) .program-tab-section.profile-intro {
    align-items: start;
    gap: var(--theme-spacing-xl);
}

.profile-intro__copy {
    display: grid;
    min-width: 0;
    gap: var(--theme-spacing-md);
}

.profile-intro__figure {
    justify-self: center;
    width: min(100%, 26rem);
    margin: 0;
}

.profile-intro__frame {
    aspect-ratio: 3 / 2;
    overflow: hidden;
    border: 1px solid var(--theme-color-border);
    background: var(--theme-color-surface);
}

.profile-intro__frame img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    /* The WebP artwork includes a feathered margin on all four edges. */
    transform: scale(1.2);
}

.profile-intro__figure figcaption {
    margin-block-start: var(--theme-spacing-xs);
    color: var(--theme-color-muted);
    text-align: end;
}

:where([data-runtime-theme="target-u"]) .program-about__intro {
    display: grid;
    gap: var(--theme-spacing-xl);
}

:where([data-runtime-theme="target-u"]) .program-about__intro-text {
    display: grid;
    max-width: var(--program-readable-width);
    gap: var(--theme-spacing-md);
}

:where([data-runtime-theme="target-u"]) .program-about__intro-text p {
    margin: 0;
}

:where([data-runtime-theme="target-u"]) .program-about__points {
    margin: 0;
    border-block-start: 1px solid var(--theme-color-border);
}

:where([data-runtime-theme="target-u"]) .program-about__points > div {
    display: grid;
    grid-template-columns: 6em minmax(0, 1fr);
    gap: var(--theme-spacing-md);
    padding-block: var(--theme-spacing-md);
    border-block-end: 1px solid var(--theme-color-border);
}

:where([data-runtime-theme="target-u"]) .program-about__points dt {
    color: var(--theme-color-muted);
    font-size: var(--theme-text-supporting);
    font-weight: var(--theme-text-supporting--font-weight);
    line-height: var(--theme-text-body-compact--line-height);
}

:where([data-runtime-theme="target-u"]) .program-about__points dd {
    margin: 0;
    font-size: var(--theme-text-body-compact);
    line-height: var(--theme-text-body-compact--line-height);
}

@media (min-width: 64rem) {
    :where([data-runtime-theme="target-u"]) .program-tab-section.profile-intro {
        grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr);
        gap: var(--theme-spacing-4xl);
    }

    .profile-intro__figure {
        justify-self: end;
    }

    :where([data-runtime-theme="target-u"]) .profile-intro__copy .program-about__intro {
        grid-template-columns: minmax(0, 1fr);
        gap: var(--theme-spacing-md);
    }

    :where([data-runtime-theme="target-u"]) .program-about__intro {
        grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr);
        gap: var(--theme-spacing-4xl);
    }
}

/* 學系概況: PR ranking on the left, the three profile stats stacked on the
   right; one bordered surface. Below 64rem the stats move under the ranking. */
:where([data-runtime-theme="target-u"]) .program-overview {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    border: 1px solid var(--theme-color-border);
    background: var(--theme-color-surface);
}

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

:where([data-runtime-theme="target-u"]) .program-overview__label {
    margin: 0;
    color: var(--theme-color-muted);
}

:where([data-runtime-theme="target-u"]) .program-overview__kpi {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: var(--theme-spacing-xs) var(--theme-spacing-md);
    margin: 0;
}

:where([data-runtime-theme="target-u"]) .program-overview__pr {
    color: var(--theme-color-decision-ink);
    font-variant-numeric: tabular-nums;
}

:where([data-runtime-theme="target-u"]) .program-overview__facts {
    display: grid;
    align-content: start;
    min-width: 0;
    border-block-start: 1px solid var(--theme-color-border);
}

:where([data-runtime-theme="target-u"]) .program-overview__facts > .program-about__source {
    padding: 0 var(--theme-spacing-card) var(--theme-spacing-lg);
}

:where([data-runtime-theme="target-u"]) .program-about__stats {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    margin: 0;
}

:where([data-runtime-theme="target-u"]) .program-about__stats > div {
    min-width: 0;
    padding: var(--theme-spacing-lg) var(--theme-spacing-card);
    border-block-end: 1px solid var(--theme-color-border);
}

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

:where([data-runtime-theme="target-u"]) .program-about__stats dt {
    color: var(--theme-color-muted);
    font-size: var(--theme-text-supporting);
    font-weight: var(--theme-text-supporting--font-weight);
    line-height: var(--theme-text-supporting--line-height);
}

:where([data-runtime-theme="target-u"]) .program-about__stats dd {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: var(--theme-spacing-xs) var(--theme-spacing-sm);
    margin: var(--theme-spacing-xs) 0 0;
}

@media (min-width: 64rem) {
    :where([data-runtime-theme="target-u"]) .program-overview {
        grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr);
    }

    :where([data-runtime-theme="target-u"]) .program-overview__facts {
        border-block-start: 0;
        border-inline-start: 1px solid var(--theme-color-border);
    }
}

:where([data-runtime-theme="target-u"]) .program-faq {
    border-block-start: 1px solid var(--theme-color-border);
}

:where([data-runtime-theme="target-u"]) .program-faq__item {
    border-block-end: 1px solid var(--theme-color-border);
}

:where([data-runtime-theme="target-u"]) .program-faq__question {
    display: flex;
    min-height: 56px;
    align-items: center;
    justify-content: space-between;
    gap: var(--theme-spacing-lg);
    padding-block: var(--theme-spacing-md);
    cursor: pointer;
    font-size: var(--theme-text-panel-title);
    font-weight: var(--theme-text-panel-title--font-weight);
    line-height: 1.5;
    list-style: none;
    transition: color 180ms ease-out;
}

:where([data-runtime-theme="target-u"]) .program-faq__question::-webkit-details-marker {
    display: none;
}

:where([data-runtime-theme="target-u"]) .program-faq__question:hover {
    color: var(--theme-color-primary-light, var(--theme-color-primary));
}

:where([data-runtime-theme="target-u"]:not([data-focus-modality="pointer"])) .program-faq__question:focus-visible {
    outline: var(--theme-focus-ring-width) solid var(--theme-color-focus);
    outline-offset: var(--theme-focus-ring-gap);
}

:where([data-runtime-theme="target-u"]) .program-faq__question .ico {
    flex: none;
    transition: transform 180ms ease-out;
}

:where([data-runtime-theme="target-u"]) .program-faq__item[open] .program-faq__question .ico {
    transform: rotate(180deg);
}

:where([data-runtime-theme="target-u"]) .program-faq__answer {
    display: grid;
    max-width: var(--program-readable-width);
    gap: var(--theme-spacing-sm);
    padding-block-end: var(--theme-spacing-lg);
}

:where([data-runtime-theme="target-u"]) .program-faq__answer p {
    margin: 0;
    font-size: var(--theme-text-body-compact);
    line-height: var(--theme-text-body-compact--line-height);
}

:where([data-runtime-theme="target-u"]) .program-faq__answer p.ui-type-supporting {
    font-size: var(--theme-text-supporting);
}

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

:where([data-runtime-theme="target-u"]) .program-similar + .program-similar {
    margin-block-start: var(--theme-spacing-lg);
}

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

:where([data-runtime-theme="target-u"]) .program-similar__grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: var(--theme-spacing-md);
}

@media (min-width: 37.5rem) {
    :where([data-runtime-theme="target-u"]) .program-similar__grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (min-width: 64rem) {
    :where([data-runtime-theme="target-u"]) .program-similar__grid {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }
}

/* {年度} 招生資訊 */
:where([data-runtime-theme="target-u"]) .program-offer-list {
    margin: 0;
    padding: 0;
    border: 1px solid var(--theme-color-border);
    background: var(--theme-color-surface);
    list-style: none;
}

:where([data-runtime-theme="target-u"]) .program-offer {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: var(--theme-spacing-md) var(--theme-spacing-xl);
    align-items: start;
    padding: var(--theme-spacing-lg) var(--theme-spacing-card);
}

:where([data-runtime-theme="target-u"]) .program-offer + .program-offer {
    border-block-start: 1px solid var(--theme-color-border);
}

:where([data-runtime-theme="target-u"]) .program-offer__identity,
:where([data-runtime-theme="target-u"]) .program-offer__subjects,
:where([data-runtime-theme="target-u"]) .program-offer__links {
    grid-column: 1 / -1;
}

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

:where([data-runtime-theme="target-u"]) .program-offer__name {
    font-size: var(--theme-text-panel-title);
    font-weight: var(--theme-text-panel-title--font-weight);
    line-height: 1.5;
    overflow-wrap: anywhere;
}

:where([data-runtime-theme="target-u"]) .program-offer__fact {
    min-width: 0;
    margin: 0;
}

:where([data-runtime-theme="target-u"]) .program-offer__fact dt {
    color: var(--theme-color-muted);
    font-size: var(--theme-text-supporting);
    font-weight: var(--theme-text-supporting--font-weight);
    line-height: var(--theme-text-supporting--line-height);
}

:where([data-runtime-theme="target-u"]) .program-offer__fact dd {
    margin: 2px 0 0;
}

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

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

:where([data-runtime-theme="target-u"]) .program-offer__subject-list {
    display: flex;
    flex-wrap: wrap;
    gap: var(--theme-spacing-xs);
}

:where([data-runtime-theme="target-u"]) .program-offer__subject-list > span {
    padding: 2px var(--theme-spacing-sm);
    border: 1px solid var(--theme-color-border);
    background: var(--theme-color-surface-muted);
    font-size: var(--theme-text-supporting);
    font-weight: var(--theme-text-supporting--font-weight);
    line-height: var(--theme-text-supporting--line-height);
}

:where([data-runtime-theme="target-u"]) .program-offer__links {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--theme-spacing-xs) var(--theme-spacing-lg);
}

:where([data-runtime-theme="target-u"]) .program-tab-footnote {
    margin: 0;
    padding-block-end: var(--theme-spacing-2xl);
    color: var(--theme-color-muted);
}

@media (min-width: 64rem) {
    :where([data-runtime-theme="target-u"]) .program-offer {
        grid-template-columns: minmax(14rem, 1.3fr) minmax(0, 0.8fr) minmax(0, 1.4fr) auto;
        align-items: center;
    }

    :where([data-runtime-theme="target-u"]) .program-offer__identity,
    :where([data-runtime-theme="target-u"]) .program-offer__subjects,
    :where([data-runtime-theme="target-u"]) .program-offer__links {
        grid-column: auto;
    }

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

/* 畢業學分結構 (學系必選修 tab): proportion bar over a five-cell table —
   four parts, then the total. The bar is a Navy ramp; every segment has a
   labelled row with its number, so colour never carries the data alone. */
:where([data-runtime-theme="target-u"]) .program-credits__body {
    display: grid;
    gap: var(--theme-spacing-lg);
    min-width: 0;
    padding: var(--theme-spacing-lg) var(--theme-spacing-card);
    border: 1px solid var(--theme-color-border);
    background: var(--theme-color-surface);
}

:where([data-runtime-theme="target-u"]) .program-credits [data-credit-part="professional"] { --credit-fill: var(--theme-color-primary); }
:where([data-runtime-theme="target-u"]) .program-credits [data-credit-part="general"] { --credit-fill: color-mix(in oklch, var(--theme-color-primary) 62%, var(--theme-color-surface)); }
:where([data-runtime-theme="target-u"]) .program-credits [data-credit-part="internship"] { --credit-fill: color-mix(in oklch, var(--theme-color-primary) 38%, var(--theme-color-surface)); }
:where([data-runtime-theme="target-u"]) .program-credits [data-credit-part="other"] { --credit-fill: color-mix(in oklch, var(--theme-color-primary) 20%, var(--theme-color-surface)); }
:where([data-runtime-theme="target-u"]) .program-credits [data-credit-part="elective"] { --credit-fill: var(--theme-color-border); }

:where([data-runtime-theme="target-u"]) .program-credits__bar {
    display: flex;
    gap: 2px;
    height: 0.75rem;
}

:where([data-runtime-theme="target-u"]) .program-credits__segment {
    flex: var(--credit-share) 1 0;
    min-width: 2px;
    background: var(--credit-fill);
}

:where([data-runtime-theme="target-u"]) .program-credits__table {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    margin: 0;
    border-block-start: 1px solid var(--theme-color-border);
}

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

:where([data-runtime-theme="target-u"]) .program-credits__table dt {
    display: flex;
    align-items: center;
    gap: var(--theme-spacing-sm);
    color: var(--theme-color-muted);
    font-size: var(--theme-text-supporting);
    font-weight: var(--theme-text-supporting--font-weight);
    line-height: var(--theme-text-supporting--line-height);
}

:where([data-runtime-theme="target-u"]) .program-credits__swatch {
    flex: none;
    width: 0.625rem;
    height: 0.625rem;
    background: var(--credit-fill);
}

:where([data-runtime-theme="target-u"]) .program-credits__table dd {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: var(--theme-spacing-xs) var(--theme-spacing-sm);
    margin: 0;
}

:where([data-runtime-theme="target-u"]) .program-credits__table .ui-type-data {
    font-variant-numeric: tabular-nums;
}

:where([data-runtime-theme="target-u"]) .program-credits__total {
    grid-column: 1 / -1;
}

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

@media (min-width: 48rem) {
    :where([data-runtime-theme="target-u"]) .program-credits__table {
        grid-template-columns: repeat(4, minmax(0, 1fr)) minmax(0, 1.15fr);
        border-block-end: 1px solid var(--theme-color-border);
    }

    /* 自由選修 is a fifth part: keep the total on the same row. */
    :where([data-runtime-theme="target-u"]) .program-credits__table:has(> [data-credit-part="elective"]) {
        grid-template-columns: repeat(5, minmax(0, 1fr)) minmax(0, 1.15fr);
    }

    :where([data-runtime-theme="target-u"]) .program-credits__table > div {
        padding: var(--theme-spacing-md) var(--theme-spacing-lg);
        border-block-end: 0;
        border-inline-start: 1px solid var(--theme-color-border);
    }

    :where([data-runtime-theme="target-u"]) .program-credits__table > div:first-child {
        padding-inline-start: 0;
        border-inline-start: 0;
    }

    :where([data-runtime-theme="target-u"]) .program-credits__total {
        grid-column: auto;
        border-inline-start-color: var(--theme-color-border-strong);
    }
}

/* School page (specs/tasks/done/2026/2026-11-17-university-page-profile.md).
   The hero, 認識學校 and 學校概況 reuse the 學系介紹 owners above; only the
   four-fact row, the ranking column and the no-ranking layout are new. */
:where([data-runtime-theme="target-u"]) .program-pages.school-detail-page {
    --offering-section-gap: var(--theme-spacing-xl);
    gap: var(--offering-section-gap);
}

:where([data-runtime-theme="target-u"]) .school-detail-page .school-profile-sections {
    display: grid;
    min-width: 0;
}

:where([data-runtime-theme="target-u"]) .school-detail-page .school-profile-sections > .program-tab-section:first-child {
    padding-block-start: var(--theme-spacing-lg);
}

/* 所在地、招生校系、涵蓋學群、考招管道: two by two on phones. */
@media (max-width: 47.999rem) {
    :where([data-runtime-theme="target-u"]) .school-detail-page .program-hero__facts {
        grid-auto-flow: row;
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    :where([data-runtime-theme="target-u"]) .school-detail-page .program-hero__facts > div:nth-child(odd) {
        padding-inline-start: 0;
        border-inline-start: 0;
    }

    :where([data-runtime-theme="target-u"]) .school-detail-page .program-hero__facts > div:nth-child(n + 3) {
        border-block-start: 1px solid var(--theme-color-border);
    }
}

:where([data-runtime-theme="target-u"]) .school-rankings__kpi {
    color: var(--theme-color-foreground);
    font-variant-numeric: tabular-nums;
}

:where([data-runtime-theme="target-u"]) .school-rankings__list {
    display: grid;
    margin: 0;
    border-block-start: 1px solid var(--theme-color-border);
}

:where([data-runtime-theme="target-u"]) .school-rankings__list > div {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    justify-content: space-between;
    gap: var(--theme-spacing-xs) var(--theme-spacing-md);
    padding-block: var(--theme-spacing-sm);
    border-block-end: 1px solid var(--theme-color-border);
}

:where([data-runtime-theme="target-u"]) .school-rankings__list dt {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: var(--theme-spacing-xs) var(--theme-spacing-sm);
    font-size: var(--theme-text-dense-label);
    font-weight: var(--theme-text-dense-label--font-weight);
    line-height: var(--theme-text-dense-label--line-height);
}

:where([data-runtime-theme="target-u"]) .school-rankings__list dd {
    margin: 0;
}

:where([data-runtime-theme="target-u"]) .school-overview__body {
    display: grid;
    min-width: 0;
    gap: var(--theme-spacing-sm);
}

:where([data-runtime-theme="target-u"]) .school-overview__source {
    margin: 0;
    text-align: end;
}

/* Six stats form two rows of three from 48rem in both variants. With a
   ranking, it takes a narrow first column at 64rem; without one, the stats
   own the whole surface. */
:where([data-runtime-theme="target-u"]) .school-detail-page .school-stat__note {
    flex-basis: 100%;
}

:where([data-runtime-theme="target-u"]) .school-stat__fraction {
    display: inline-flex;
    flex-wrap: wrap;
    align-items: baseline;
    column-gap: var(--theme-spacing-xs);
}

:where([data-runtime-theme="target-u"]) .school-stat__denominator {
    white-space: nowrap;
}

:where([data-runtime-theme="target-u"]) .school-stat__rates {
    display: flex;
    flex-wrap: wrap;
    gap: var(--theme-spacing-xs) var(--theme-spacing-md);
}

:where([data-runtime-theme="target-u"]) .school-stat__rates > span {
    white-space: nowrap;
}

:where([data-runtime-theme="target-u"]) .school-overview--stats-only .program-overview__facts {
    border-block-start: 0;
}

@media (min-width: 48rem) {
    :where([data-runtime-theme="target-u"]) .school-detail-page .program-about__stats {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    :where([data-runtime-theme="target-u"]) .school-detail-page .program-about__stats > div {
        border-block-end: 0;
        border-inline-start: 1px solid var(--theme-color-border);
    }

    :where([data-runtime-theme="target-u"]) .school-detail-page .program-about__stats > div:nth-child(3n + 1) {
        border-inline-start: 0;
    }

    :where([data-runtime-theme="target-u"]) .school-detail-page .program-about__stats > div:nth-child(n + 4) {
        border-block-start: 1px solid var(--theme-color-border);
    }

}

@media (min-width: 64rem) {
    :where([data-runtime-theme="target-u"]) .school-detail-page .program-overview {
        grid-template-columns: minmax(0, 1fr) minmax(0, 2.4fr);
    }

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

    :where([data-runtime-theme="target-u"]) .school-overview--stats-only .program-overview__facts {
        border-inline-start: 0;
    }
}
