/*
    Browse-by-subject rail and discipline hub.

    Two constraints from the theme this sits inside, both measured rather than
    assumed:

    1. `html` is set to `font-size: 10px`, so a rem here is 10px, not 16px.
       Sizes are therefore in px: a component that silently renders at 60% of
       its intended size is worse than one that ignores root scaling.

    2. `smartcollege_custom.css` forces `color: #fff !important` on every
       p/span/a while dark mode is on. Rather than answering with more
       !important, the tiles are dark and their text is white in BOTH themes —
       so there is no text colour to override, and the component is immune.

    No literal colour otherwise: every value is a --sc-* token, so the admin's
    palette switch repaints this with the rest of the site. Logical properties
    throughout, because the Arabic side runs RTL from the same stylesheet.
*/

/*
    Transparent, and the heading colours inherit: a fixed ink heading on a fixed
    paper band is invisible the moment dark mode forces headings white. Opacity
    rather than a muted colour for the lead, for the same reason — it reads as
    secondary against whatever the page background happens to be.
*/
.subj {
    padding-block: 56px;
    background: transparent;
}

.subj--compact {
    padding-block: 28px 0;
    background: transparent;
}

.subj-title {
    font-size: 24px;
    font-weight: 700;
    color: inherit;
    margin-bottom: 6px;
}

.subj-lead {
    font-size: 15px;
    line-height: 1.7;
    color: inherit;
    opacity: .72;
    max-width: 62ch;
    margin-bottom: 24px;
}

/*
    A scroller, not a wrapped grid: fifteen tiles wrapped onto three rows push
    the programmes themselves off a phone screen entirely.
*/
.subj-rail {
    display: flex;
    gap: 12px;
    overflow-x: auto;
    scroll-snap-type: x proximity;
    /* Room above for the hover lift, which overflow would otherwise clip. */
    padding-block: 6px 12px;
    scrollbar-width: thin;
    scrollbar-color: var(--sc-line) transparent;
}

.subj-rail::-webkit-scrollbar { height: 6px; }
.subj-rail::-webkit-scrollbar-track { background: transparent; }
.subj-rail::-webkit-scrollbar-thumb { background: var(--sc-line); border-radius: 99px; }

.subj-tile {
    flex: 0 0 auto;
    scroll-snap-align: start;
    inline-size: 168px;
    min-block-size: 132px;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
    padding: 18px 16px;
    border: 1px solid var(--sc-ink-soft);
    border-radius: var(--sc-radius, 14px);
    background: var(--sc-ink);
    text-decoration: none;
    transition: transform .25s var(--sc-ease, ease), border-color .25s, box-shadow .25s;
}

.subj-tile:hover,
.subj-tile:focus-visible {
    transform: translateY(-3px);
    border-color: var(--sc-accent);
    box-shadow: var(--sc-shadow, 0 10px 30px rgba(10, 16, 51, .18));
}

.subj-tile.is-active {
    border-color: var(--sc-accent);
    box-shadow: inset 0 0 0 1px var(--sc-accent);
}

.subj-tile .cat-tile-icon {
    inline-size: 26px;
    block-size: 26px;
    stroke: var(--sc-accent);
    stroke-width: 1.5;
    fill: none;
    flex: 0 0 auto;
}

/* White in both themes, so the dark-mode !important rule changes nothing. */
.subj-tile-name {
    font-size: 14px;
    font-weight: 600;
    line-height: 1.4;
    color: #fff;
    margin-block-end: auto;
}

.subj-tile-count {
    font-size: 12px;
    font-weight: 700;
    color: #fff;
    background: rgba(255, 255, 255, .14);
    border-radius: 99px;
    padding: 2px 9px;
}

/*
    The active tile is signalled by its accent border and inset ring, not by
    flipping the pill's text to ink: dark mode would force that text white
    again, leaving white on gold at roughly 2.4:1.
*/
.subj-tile.is-active .subj-tile-count {
    background: rgba(200, 150, 58, .28);
}

/* ---- Discipline hub ---- */

.disc-hero {
    background: var(--sc-ink);
    color: #fff;
    padding-block: 64px 52px;
}

.disc-crumb {
    font-size: 13px;
    color: rgba(255, 255, 255, .62);
    margin-bottom: 16px;
}

.disc-crumb a { color: inherit; text-decoration: none; }
.disc-crumb a:hover { text-decoration: underline; }

/*
    Explicitly white, not inherited: three stylesheets set a heading colour
    (bootstrap, the theme's style.css and site.css, the last with
    `h1, h2 { color: var(--sc-ink) }`), so an uncoloured h1 renders ink on this
    ink hero and disappears. The hero is always ink, so white is always right.
*/
.disc-title {
    color: #fff;
    font-size: clamp(30px, 4vw, 48px);
    font-weight: 700;
    line-height: 1.15;
    margin-bottom: 14px;
}

.disc-lead {
    font-size: 17px;
    line-height: 1.75;
    color: rgba(255, 255, 255, .78);
    max-width: 64ch;
    margin-bottom: 0;
}

.disc-facts {
    display: flex;
    flex-wrap: wrap;
    gap: 40px;
    margin-top: 36px;
}

.disc-fact-figure {
    font-size: 32px;
    font-weight: 700;
    color: var(--sc-accent);
    line-height: 1;
}

.disc-fact-label {
    font-size: 13px;
    color: rgba(255, 255, 255, .62);
    margin-top: 5px;
}

.disc-level-title {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 19px;
    font-weight: 700;
    color: inherit;
    margin: 40px 0 18px;
}

@media (max-width: 575.98px) {
    .subj-tile { inline-size: 148px; min-block-size: 124px; }
    .disc-facts { gap: 28px; }
    .disc-hero { padding-block: 44px 36px; }
}

@media (prefers-reduced-motion: reduce) {
    .subj-tile { transition: none; }
    .subj-tile:hover, .subj-tile:focus-visible { transform: none; }
}
