/* Education & Courses page */

body {
    background: var(--bg-primary);
}

/* per-university colour coding (same idea as the Projects section categories) */
[data-uni="mdu"] { --acc: var(--accent-primary); --tint: rgba(76, 175, 80, 0.14); --tint2: rgba(76, 175, 80, 0.3); --line: rgba(76, 175, 80, 0.55); }
[data-uni="oru"] { --acc: #4c8dff; --tint: rgba(76, 141, 255, 0.14); --tint2: rgba(76, 141, 255, 0.3); --line: rgba(76, 141, 255, 0.55); }
[data-uni="umu"] { --acc: #a78bfa; --tint: rgba(167, 139, 250, 0.14); --tint2: rgba(167, 139, 250, 0.3); --line: rgba(167, 139, 250, 0.55); }
[data-uni="agb"] { --acc: #e6a04a; --tint: rgba(230, 160, 74, 0.14); --tint2: rgba(230, 160, 74, 0.3); --line: rgba(230, 160, 74, 0.55); }
[data-uni="lnu"] { --acc: #2ec4b6; --tint: rgba(46, 196, 182, 0.14); --tint2: rgba(46, 196, 182, 0.3); --line: rgba(46, 196, 182, 0.55); }

/* HERO - reuses the homepage intro's tilted, drifting circuit-board technique */
#education_page_hero {
    position: relative;
    height: 340px;
    overflow: hidden;
    border-bottom: 2px solid #3d4151;
}

#education_page_hero_bg {
    position: absolute;
    top: -300px;
    left: -600px;
    width: 300%;
    height: 250%;
    background-image: var(--education-hero-background-image);
    background-size: 500px;
    z-index: -1;
    transform: perspective(2500px) rotateX(35deg) rotateY(0deg);
    transform-origin: center;
    animation: scrollDiagonal 20s linear infinite;
}

#education_page_hero_overlay {
    position: absolute;
    inset: 0;
    background: rgba(28, 30, 37, 0.55);
}

#education_page_hero_content {
    position: relative;
    z-index: 2;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 14px;
    text-align: center;
    padding: 0 24px;
}

.education_page_eyebrow {
    font-size: 12px;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--accent-primary);
    font-weight: 700;
}

#education_page_hero_content h1 {
    margin: 0;
    font-size: 2.6em;
    font-weight: 700;
    color: var(--text-primary);
}

#education_page_hero_content p {
    margin: 0;
    max-width: 660px;
    font-size: 1.05em;
    line-height: 1.6;
    color: var(--text-secondary);
}

.education_page_stats {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px;
    margin-top: 8px;
}

.education_page_stat_pill {
    padding: 6px 14px;
    border-radius: 999px;
    background: var(--bg-card);
    border: 1px solid var(--border-primary);
    font-size: 0.9em;
    color: var(--text-secondary);
}

/* BODY LAYOUT */
#education_page_body {
    display: grid;
    row-gap: 40px;
    max-width: 1400px;
    margin: 0 auto;
    padding: 48px 40px 80px;
}

/* ROW 1: map (left) + university tiles (right), same row height */
#education_page_row1 {
    display: grid;
    grid-template-columns: minmax(0, 460px) minmax(0, 1fr);
    column-gap: 40px;
}

.education_page_section_label {
    font-size: 12px;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--text-tertiary);
    margin-bottom: 12px;
}

/* UNIVERSITY TILES - chamfered "circuit tile" buttons, distributed across
   the map card's height (space-between, not a hardcoded row count, since
   the number of universities is data-driven) - tiles size to their own
   (compact) content, with the leftover vertical space spread as gaps. */
.education_page_uni_col {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 10px;
    height: 100%;
}

.education_page_uniw {
    filter: drop-shadow(0 6px 10px var(--shadow-primary));
    transition: transform 0.2s ease;
}

.education_page_uniw:hover {
    transform: translateY(-3px);
}

.education_page_uni {
    display: block;
    width: 100%;
    box-sizing: border-box;
    padding: 1px;
    border: 0;
    cursor: pointer;
    font: inherit;
    color: var(--text-primary);
    text-align: left;
    /* Neutral, identical across universities at rest - unique color is
       reserved for the hover/selected state below (and always-on for the
       map's GPS markers, see .education_page_pin). */
    background: var(--border-secondary);
    clip-path: polygon(0 0, calc(100% - 18px) 0, 100% 18px, 100% 100%, 18px 100%, 0 calc(100% - 18px));
    transition: background-color 0.2s ease;
}

.education_page_uni_inner {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
    box-sizing: border-box;
    padding: 12px 16px;
    background-color: var(--bg-tertiary);
    clip-path: polygon(0 0, calc(100% - 17.4px) 0, 100% 17.4px, 100% 100%, 17.4px 100%, 0 calc(100% - 17.4px));
    transition: background-color 0.2s ease;
}

.education_page_uni_meta_row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    gap: 8px;
}

.education_page_uni:hover,
.education_page_uni[data-on="true"] {
    background: var(--acc);
}

.education_page_uni:hover .education_page_uni_inner,
.education_page_uni[data-on="true"] .education_page_uni_inner {
    background-image: linear-gradient(var(--tint2), var(--tint2));
}

.education_page_uni_top {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--text-secondary);
    transition: color 0.2s ease;
}

.education_page_uni:hover .education_page_uni_top,
.education_page_uni[data-on="true"] .education_page_uni_top {
    color: var(--acc);
}

.education_page_uni_name {
    font-size: 15px;
    font-weight: 700;
    color: var(--text-primary);
}

.education_page_uni_line {
    font-size: 13px;
    color: var(--text-secondary);
}

.education_page_uni_count {
    font-size: 15px;
    font-weight: 700;
    color: var(--text-primary);
}

/* Active "filtering by university" banner - sits at the top of the
   "Sort by relevance to" block, tinted with that university's own accent
   color (via the [data-uni=...] custom properties) so the connection to
   the tile just clicked is obvious. */
.education_page_uni_filter {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 16px;
    padding: 12px 16px;
    border-radius: 10px;
    background-image: linear-gradient(var(--tint), var(--tint));
    border: 1px solid var(--line);
}

.education_page_uni_filter[hidden] {
    display: none;
}

#education_page_uni_filter_label {
    font-size: 14.5px;
    color: var(--text-primary);
}

#education_page_uni_filter_label strong {
    color: var(--acc);
}

/* RELEVANCE CHIPS */
.education_page_areas_block {
    margin-top: 28px;
}

.education_page_areas {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.education_page_chip,
.education_page_seg {
    display: inline-flex;
    align-items: center;
    height: 40px;
    padding: 0 16px;
    border-radius: 999px;
    background: var(--bg-card);
    border: 1px solid var(--border-primary);
    color: var(--text-secondary);
    font: inherit;
    font-size: 14px;
    cursor: pointer;
    transition: background-color 0.2s, color 0.2s, border-color 0.2s;
}

.education_page_seg:hover {
    background: var(--bg-card-hover);
    color: var(--text-primary);
}

.education_page_seg[data-on="true"] {
    background: rgba(76, 175, 80, 0.16);
    border-color: var(--accent-primary);
    color: var(--text-primary);
}

.education_page_result_row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 12px;
    font-size: 14px;
    color: var(--text-tertiary);
}

.education_page_clear {
    background: none;
    border: none;
    color: var(--accent-primary);
    text-decoration: underline;
    cursor: pointer;
    font: inherit;
    font-size: 14px;
}

.education_page_clear:hover {
    color: var(--accent-primary-hover);
}

/* COURSE CARD GRID - windowed viewport, 2 rows visible at a time (see
   education_page_scroller below); JS slides the grid's translateY by exactly
   one row per Up/Down press.

   The viewport height is pinned here as well as in script.js (SHOWN, CARD_HEIGHT
   and GRID_GAP) so the server-rendered grid is already the right height - it
   used to paint at full height and collapse once the fetch resolved. Keep the
   two in sync: 2 * 140px card + 1 * 20px gap. */
#education_page_grid_row {
    display: flex;
    align-items: stretch;
    gap: 12px;
    margin-top: 20px;
}

#education_page_grid_viewport {
    flex: 1;
    min-width: 0;
    height: 300px;
    overflow: hidden;
}

.education_page_grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 20px;
    transition: transform 0.25s ease;
    will-change: transform;
}

.education_page_card {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    height: 140px;
    box-sizing: border-box;
    overflow: hidden;
    padding: 22px;
    border-radius: 14px;
    text-align: left;
    font: inherit;
    color: var(--text-primary);
    cursor: pointer;
    background: var(--bg-card);
    border: 1px solid var(--border-primary);
    box-shadow: 0 5px 10px var(--shadow-primary);
    transition: transform 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease, border-color 0.2s ease;
}

.education_page_card:hover {
    background: var(--bg-card-hover);
    transform: translateY(-2px);
    box-shadow: 0 12px 24px var(--shadow-secondary);
}

.education_page_card[data-sel="true"] {
    /* Always the site's green, regardless of the course's university -
       selection is a single consistent signal, not a per-uni color. */
    border-color: var(--accent-primary);
    background-image: linear-gradient(rgba(76, 175, 80, 0.14), rgba(76, 175, 80, 0.14));
}

.education_page_card_top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
}

.education_page_card_name {
    font-size: 18px;
    font-weight: 700;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.education_page_card_meta {
    flex: none;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 8px;
}

.education_page_card_city {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    font-weight: 700;
    color: var(--acc);
    white-space: nowrap;
}

.education_page_mini_pin {
    flex: none;
    color: inherit;
}

.education_page_lvl {
    font-size: 12px;
    font-weight: 700;
    padding: 4px 10px;
    border-radius: 999px;
    /* Neutral regardless of university - color-coding is reserved for the
       map pins and city labels, not this badge. */
    color: var(--text-secondary);
    background: var(--bg-card);
    border: 1px solid var(--border-primary);
    white-space: nowrap;
}

.education_page_card_tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: auto;
    padding-top: 16px;
    max-height: 34px;
    overflow: hidden;
}

.education_page_tag {
    font-size: 13px;
    padding: 5px 11px;
    border-radius: 999px;
    background: var(--bg-card);
    border: 1px solid var(--border-primary);
    color: var(--text-secondary);
    white-space: nowrap;
}

.education_page_tag_more {
    background: none;
    border-style: dashed;
    color: var(--text-tertiary);
}

.education_page_empty {
    margin-top: 20px;
    padding: 40px;
    text-align: center;
    border-radius: 14px;
    border: 1px dashed var(--border-primary);
    color: var(--text-tertiary);
    font-size: 15px;
}

/* Vertical scroller: Up/Down buttons + a scrollbar-style thumb track,
   moves the course grid exactly one row per press (see script.js). */
#education_page_scroller {
    flex: none;
    width: 44px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

#education_page_scroll_track {
    position: relative;
    flex: 1;
    width: 4px;
    border-radius: 999px;
    background: var(--border-secondary);
}

#education_page_scroll_thumb {
    position: absolute;
    left: 0;
    width: 100%;
    border-radius: 999px;
    background: var(--accent-primary);
    transition: top 0.25s ease, height 0.25s ease;
}

#education_page_scroller .education_page_iconbtn:disabled {
    opacity: 0.35;
    cursor: default;
}

.education_page_glass {
    padding: 20px;
    border-radius: 14px;
    background: var(--bg-card);
    border: 1px solid var(--border-primary);
    box-shadow: 0 5px 10px var(--shadow-primary);
}

.education_page_map_label_row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0;
}

/* The map card is the parent that sizes the map: it fills its grid column
   up to a max width, and the map frame adapts to fill it (rather than the
   frame dictating a fixed size and the card shrinking to match). */
.education_page_map_card {
    width: 100%;
    max-width: 460px;
    box-sizing: border-box;
}

.education_page_map_frame {
    position: relative;
    width: 100%;
    aspect-ratio: 460 / 500;
    margin-top: 12px;
    border-radius: 10px;
    overflow: hidden;
    background: var(--bg-tertiary);
}

.education_page_map_bg {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: 50% 38%;
    opacity: 0.7;
    pointer-events: none;
}

.education_page_pin {
    position: absolute;
    z-index: 1;
    width: 25px;
    height: 32px;
    /* Always tinted with its own university's accent color (see the
       [data-uni=...] custom-property rules above) - unlike the university
       tiles, GPS markers keep their unique color whether or not they're
       the active/hovered one. */
    color: var(--acc);
    transform: translate(-50%, -100%);
    transition: width 0.2s ease, height 0.2s ease;
}

/* Black outline around the marker shape so it pops off the map background. */
.education_page_pin path {
    stroke: #000;
    stroke-width: 1.4;
    paint-order: stroke fill;
}

.education_page_lab {
    position: absolute;
    z-index: 1;
    transform: translate(-50%, -100%);
    font-size: 12px;
    font-weight: 700;
    color: var(--text-tertiary);
    white-space: nowrap;
    /* Hidden until its university is the active one (selected or hovered) -
       revealed together with the color change below. */
    opacity: 0;
    /* Black outline around the text (webkit-text-stroke plus a 4-direction
       shadow fallback for browsers without text-stroke support) so the
       label pops off the map background. */
    -webkit-text-stroke: 0.6px #000;
    text-shadow:
        -1px -1px 0 #000,
        1px -1px 0 #000,
        -1px 1px 0 #000,
        1px 1px 0 #000;
    transition: color 0.25s ease, opacity 0.25s ease;
}

/* Persisted selection (JS sets data-active from the selected course / active
   university filter) always wins over a transient hover preview below - a
   higher z-index than the hover-preview rules, so hovering the University
   tiles can never visually bury the course you actually have selected. */
.education_page_pin[data-active="true"] {
    width: 36px;
    height: 46px;
    z-index: 6;
}

/* The city-name label stays hidden in every state (hover, select, active
   university filter) - only the pin itself highlights. See
   .education_page_lab's base rule for the permanent opacity: 0. */

/* Hover preview - highlights the pin for whichever University/course is
   hovered (cards carry .education_page_hov again so this fires on course
   hover too, without revealing the city name). */
#education_page_body:has(.education_page_hov[data-uni="mdu"]:hover) .education_page_pin[data-uni="mdu"],
#education_page_body:has(.education_page_hov[data-uni="oru"]:hover) .education_page_pin[data-uni="oru"],
#education_page_body:has(.education_page_hov[data-uni="umu"]:hover) .education_page_pin[data-uni="umu"],
#education_page_body:has(.education_page_hov[data-uni="agb"]:hover) .education_page_pin[data-uni="agb"],
#education_page_body:has(.education_page_hov[data-uni="lnu"]:hover) .education_page_pin[data-uni="lnu"] {
    width: 36px;
    height: 46px;
    z-index: 4;
}


.education_page_map_hint {
    margin-top: 12px;
    font-size: 12.5px;
    color: var(--text-tertiary);
}

/* Large selected-course block: main pane (title/description/topics) plus a
   divided "at a glance" facts pane. */
.education_page_detail_lg {
    display: grid;
    grid-template-columns: 1.7fr 1fr;
    gap: 24px;
    padding: 28px;
    margin-bottom: 32px;
    overflow: hidden;
    opacity: 1;
    box-sizing: border-box;
    /* Height is animated via the Web Animations API (see script.js), so it is
       deliberately left out of the CSS transition - only the fade/padding/
       margin that accompany the initial open are transitioned here. */
    transition: opacity 0.35s ease, padding 0.6s ease, margin-bottom 0.6s ease;
}

/* Collapsed until the first course is selected: the block is hidden on
   page load and animates open (making space) the first time a course is
   picked. */
.education_page_detail_lg.education_page_detail_hidden {
    height: 0;
    opacity: 0;
    padding-top: 0;
    padding-bottom: 0;
    margin-bottom: 0;
    border-width: 0;
}

.education_page_detail_main {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.education_page_detail_meta_row {
    flex-direction: row;
    align-items: center;
    gap: 16px;
}

.education_page_detail_aside {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding-left: 24px;
    border-left: 1px solid var(--border-primary);
}

.education_page_detail_fact_row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 10px 0;
    border-bottom: 1px solid var(--border-primary);
    font-size: 14px;
    color: var(--text-secondary);
}

.education_page_detail_fact_row:last-child {
    border-bottom: none;
}

.education_page_iconbtn {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: var(--bg-card);
    border: 1px solid var(--border-primary);
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 18px;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s, color 0.2s;
}

.education_page_iconbtn:hover {
    background: var(--bg-card-hover);
    color: var(--text-primary);
}

#education_page_detail_name {
    margin: 0;
    font-size: 28px;
    line-height: 1.2;
    font-weight: 700;
    color: var(--text-primary);
}

#education_page_detail_uni {
    font-size: 15px;
    color: var(--text-secondary);
}

.education_page_fact_label {
    font-size: 11px;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--text-tertiary);
    margin-bottom: 4px;
}

.education_page_detail_facts {
    display: flex;
    flex-direction: column;
}

.education_page_plan_link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-top: 16px;
    padding: 10px 14px;
    border-radius: 10px;
    background: var(--bg-card);
    border: 1px solid var(--border-primary);
    color: var(--text-primary);
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    transition: background-color 0.2s, border-color 0.2s, color 0.2s;
}

.education_page_plan_link[hidden] {
    display: none;
}

.education_page_plan_link:hover {
    background: var(--bg-card-hover);
    border-color: var(--accent-primary);
    color: var(--accent-primary);
}

.education_page_plan_icon {
    flex-shrink: 0;
}

#education_page_detail_desc {
    margin: 0;
    font-size: 14.5px;
    line-height: 1.6;
    color: var(--text-secondary);
}

@media (max-width: 900px) {
    #education_page_body {
        padding: 32px 20px 60px;
    }

    #education_page_row1 {
        grid-template-columns: 1fr;
        row-gap: 20px;
    }

    .education_page_uni_col {
        flex-direction: row;
        flex-wrap: wrap;
        height: auto;
        max-width: none;
    }

    .education_page_uniw {
        flex: 1 1 160px;
    }

    .education_page_detail_lg {
        grid-template-columns: 1fr;
    }

    .education_page_detail_aside {
        padding-left: 0;
        padding-top: 16px;
        border-left: none;
        border-top: 1px solid var(--border-primary);
    }

    #education_page_grid_row {
        flex-direction: column;
    }

    #education_page_grid_viewport {
        max-height: 480px;
        overflow-y: auto;
        overflow-x: hidden;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: thin;
        scrollbar-color: var(--accent-primary) transparent;
    }

    #education_page_grid_viewport::-webkit-scrollbar {
        width: 6px;
    }

    #education_page_grid_viewport::-webkit-scrollbar-thumb {
        background: var(--accent-primary);
        border-radius: 999px;
    }

    .education_page_grid {
        grid-template-columns: 1fr;
        transform: none !important;
    }

    #education_page_scroller {
        display: none;
    }

    .education_page_card {
        height: auto;
    }

    .education_page_map_card {
        max-width: none;
    }

    .education_page_map_frame {
        width: 100%;
    }

    #education_page_hero_content h1 {
        font-size: 1.9em;
    }
}
