/* Keep the search and menu controls together at the far right on phones. */
.site-header {
    position: sticky;
}

.site-header .search-toggle {
    display: grid !important;
    place-items: center;
    width: 42px;
    height: 42px;
    flex-shrink: 0;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--surface, #fff);
    color: var(--ink);
    font-size: 22px;
    cursor: pointer;
}

.site-header .mobile-search-bar {
    display: none;
    position: fixed;
    z-index: 1000;
    inset: 0;
    width: 100%;
    height: 100%;
    padding: 24px;
    align-items: center;
    justify-content: center;
    background: rgba(8, 12, 25, .42);
    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);
}

.site-header .mobile-search-bar.open {
    display: flex;
    animation: search-backdrop-in .18s ease-out;
}

.site-header .mobile-search-bar form {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
    width: min(620px, 100%);
    height: fit-content;
    padding: 12px;
    border: 1px solid rgba(255, 255, 255, .5);
    border-radius: 4px;
    background: var(--surface, #fff);
    box-shadow: 0 24px 70px rgba(5, 10, 28, .32);
    animation: search-dialog-in .2s ease-out;
}

.site-header .mobile-search-bar .search-symbol {
    padding-left: 4px;
    font-size: 22px;
    color: var(--muted);
}

.site-header .mobile-search-bar input {
    flex: 1 1 auto;
    min-width: 0;
    height: 44px;
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 0 12px;
    outline: none;
    background: var(--surface, #fff);
    color: var(--ink);
    font: inherit;
}

.site-header .mobile-search-bar input:focus {
    border-color: #6675ff;
    box-shadow: 0 0 0 3px rgba(99, 91, 255, .16);
}

.site-header .mobile-search-bar button {
    flex: 0 0 auto;
    min-height: 42px;
    border: 0;
    border-radius: 10px;
    padding: 0 15px;
    background: linear-gradient(100deg, var(--blue), var(--violet));
    color: #fff;
    font-size: 12px;
    font-weight: 800;
    cursor: pointer;
}

html.dark .site-header .search-toggle,
html.dark .site-header .mobile-search-bar,
html.dark .site-header .mobile-search-bar input {
    background: #141b2f;
    color: var(--ink);
}

@keyframes search-backdrop-in {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes search-dialog-in {
    from { opacity: 0; transform: translateY(-8px) scale(.98); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

@media (max-width: 760px) {
    .site-header .nav {
        display: grid !important;
        grid-template-columns: minmax(0, 1fr) auto auto auto;
        gap: 6px;
    }

    .site-header .brand {
        grid-column: 1;
        grid-row: 1;
        min-width: 0;
        flex: 0 1 auto;
    }

    .site-header .brand-name {
        font-size: 15px;
    }

    .site-header .search-toggle {
        grid-column: 2;
        grid-row: 1;
        margin-left: 0 !important;
        flex-shrink: 0;
    }

    .site-header .nav-actions {
        grid-column: 3;
        grid-row: 1;
        display: flex !important;
        flex-shrink: 0;
        margin-left: 0;
    }

    .site-header .nav-actions .theme-toggle,
    .site-header .nav-actions .btn,
    .site-header .nav-actions .logout-form {
        display: none !important;
    }

    .site-header .nav-actions .login {
        display: inline-flex !important;
        align-items: center;
        justify-content: center;
        min-height: 38px;
        padding: 0 8px;
        white-space: nowrap;
        font-size: 12px;
    }

    .site-header .menu-toggle {
        grid-column: 4;
        grid-row: 1;
        margin-left: 0 !important;
        flex-shrink: 0;
        width: 39px;
        height: 39px;
    }

    .site-header .mobile-only .mobile-search,
    .site-header .mobile-only > a[href*="Register"] {
        display: none !important;
    }
}

@media (min-width: 761px) {
}

/* Keep the shared public header usable on tablets and narrow laptop windows. */
@media (max-width: 1080px) and (min-width: 761px) {
    .site-header .nav {
        display: grid !important;
        grid-template-columns: minmax(0, 1fr) auto auto auto;
        gap: 8px;
        height: 66px;
    }

    .site-header .brand { grid-column: 1; grid-row: 1; min-width: 0; }
    .site-header .nav-links {
        display: none;
        position: absolute;
        top: 66px;
        left: 14px;
        right: 14px;
        z-index: 70;
        margin: 0;
        padding: 10px;
        border: 1px solid var(--line);
        border-radius: 16px;
        background: #fff;
        box-shadow: 0 20px 45px rgba(18,30,68,.16);
        grid-template-columns: 1fr;
        gap: 2px;
        white-space: normal;
        max-height: calc(100vh - 90px);
        overflow: auto;
        font-size: 14px;
    }
    .site-header .nav-links.open { display: grid; }
    .site-header .nav-links > a,
    .site-header .nav-links .nav-mega-trigger { display: flex; width: 100%; padding: 12px 13px; border: 0; border-radius: 9px; text-align: left; }
    .site-header .nav-links > a:hover,
    .site-header .nav-links .nav-mega-trigger:hover { background: #f5f7ff; }
    .site-header .nav-links .caret { display: none; }
    .site-header .nav-links .nav-dropdown-panel { position: static; width: 100%; margin: 0 0 5px; padding: 5px 7px; border: 0; border-radius: 10px; background: #f8f9ff; box-shadow: none; }
    .site-header .nav-links .nav-dropdown-panel a { padding: 10px; }
    .site-header .menu-toggle { display: grid !important; grid-column: 4; grid-row: 1; order: 4; width: 39px; height: 39px; margin: 0 !important; place-items: center; }
    .site-header .search-toggle { display: grid !important; grid-column: 2; grid-row: 1; order: 2; margin: 0 !important; }
    .site-header .nav-actions { display: flex !important; grid-column: 3; grid-row: 1; order: 3; align-items: center; gap: 8px; margin: 0 !important; }
    .site-header .nav-actions .login { display: none; }
    .site-header .nav-actions .btn { padding: 9px 11px; font-size: 10px; }
    .site-header .mega-panel { display: none !important; }
}

@media (max-width: 760px) {
    .home-page .hero,
    .home-page .hero-slides {
        height: auto;
        min-height: min(600px, calc(100svh - 100px));
    }
    .home-page .hero-slide.active {
        min-height: min(600px, calc(100svh - 100px));
    }
}

html.dark .site-header .nav-links { background: #0e1426; border-color: var(--line); }
html.dark .site-header .nav-links > a:hover,
html.dark .site-header .nav-links .nav-mega-trigger:hover { background: #171f36; }
html.dark .site-header .nav-links .nav-dropdown-panel { background: #141b2f; }

/* Full-bleed home carousel: image backdrop, readable left copy and text tabs. */
.home-page .hero {
    height: min(760px, 78svh);
    min-height: 640px;
    background: #090a0d;
}

.home-page .hero-slides {
    height: 100%;
    min-height: inherit;
}

.home-page .hero-slide {
    isolation: isolate;
    display: flex;
    align-items: center;
    min-height: inherit;
    height: 100%;
    padding: 0 max(7.5%, calc((100vw - 1400px) / 2));
    background: #090a0d;
}

.home-page .hero-slide:before {
    z-index: 0;
    opacity: 1;
    background: linear-gradient(90deg, rgba(5, 6, 9, .96) 0%, rgba(5, 6, 9, .82) 34%, rgba(5, 6, 9, .28) 68%, rgba(5, 6, 9, .18) 100%);
}

.home-page .hero-slide:after {
    display: none;
}

.home-page .hero-background {
    position: absolute;
    inset: 0 max(calc(7.5% + 20px), calc((100vw - 1400px) / 2 + 20px)) 0 auto;
    z-index: -1;
    width: 68%;
    height: 100%;
    object-fit: contain;
    object-position: center right;
    filter: grayscale(12%);
}

.home-page .hero-copy {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 20px 90px;
    color: #fff;
}

.home-page .hero-copy > * {
    max-width: min(540px, 46vw);
}

.home-page .hero-copy .eyebrow {
    padding: 0;
    border: 0;
    border-radius: 0;
    background: none;
    color: rgba(255,255,255,.76);
    font-size: 15px;
    font-weight: 500;
    letter-spacing: .02em;
    text-transform: none;
}

.home-page .hero-copy h1 {
    max-width: 570px;
    margin: 8px 0 14px;
    color: #a9b7ff;
    font-size: clamp(30px, 3vw, 44px);
    font-weight: 800;
    line-height: 1.13;
    letter-spacing: .005em;
    text-transform: uppercase;
    opacity: 1;
    transform: none;
}

.home-page .hero-copy .hero-message {
    max-width: 520px;
    margin: 0;
    color: rgba(255,255,255,.86);
    font-size: clamp(15px, 1.25vw, 18px);
    line-height: 1.65;
}

.home-page .hero-slide.active .hero-copy .hero-buttons {
    margin-top: 28px;
}

.home-page .hero-copy .hero-buttons .btn-light {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 230px;
    min-height: 52px;
    padding: 12px 24px;
    border: 1px solid rgba(255,255,255,.9);
    border-radius: 14px;
    background: linear-gradient(180deg,#ffffff,#eef2ff);
    color: #121835;
    font-size: 13px;
    font-weight: 750;
    letter-spacing: .05em;
    text-transform: uppercase;
    box-shadow: 0 18px 38px -20px rgba(255,255,255,.55), inset 0 1px 0 #fff;
    opacity: 1;
    transform: none;
    transition: transform .3s cubic-bezier(.22,.61,.36,1), box-shadow .3s;
}

.home-page .hero-copy .hero-buttons .btn-outline-light {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 52px;
    padding: 12px 24px;
    border: 1px solid rgba(255,255,255,.5);
    border-radius: 14px;
    background: rgba(255,255,255,.08);
    color: #fff;
    font-size: 13px;
    font-weight: 650;
    letter-spacing: .04em;
    box-shadow: inset 0 1px 0 rgba(255,255,255,.14);
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
    transition: transform .3s cubic-bezier(.22,.61,.36,1), background .3s, border-color .3s;
}

.home-page .hero-copy .hero-buttons .btn-light:hover {
    background: linear-gradient(180deg,#ffffff,#f6f8ff);
    color: #111;
    transform: translateY(-2px);
    box-shadow: 0 24px 46px -18px rgba(255,255,255,.6), inset 0 1px 0 #fff;
}

.home-page .hero-copy .hero-buttons .btn-outline-light:hover {
    background: rgba(255,255,255,.16);
    border-color: rgba(255,255,255,.8);
    color: #fff;
    transform: translateY(-2px);
}

.home-page .hero-controls {
    z-index: 6;
    padding: 0 28px;
}

.home-page .hero-controls .circle-control {
    width: 46px;
    height: 46px;
    border: 0;
    border-radius: 2px;
    background: rgba(20,20,22,.72);
    color: #fff;
    font-size: 27px;
}

.home-page .hero-controls .circle-control:hover {
    background: rgba(45,45,48,.92);
}

.home-page .hero-pagination {
    position: absolute;
    z-index: 7;
    right: 0;
    bottom: 26px;
    left: 0;
    display: flex;
    width: min(100% - 40px, 1400px);
    margin: 0 auto;
    padding: 0 20px;
}

.home-page .hero-tab {
    position: relative;
    flex: 1 1 0;
    min-width: 0;
    min-height: 72px;
    padding: 12px 16px 16px;
    border: 0;
    border-bottom: 1px solid rgba(255,255,255,.48);
    background: transparent;
    color: #d7d7d7;
    font: inherit;
    font-size: 13px;
    line-height: 1.45;
    text-align: center;
    text-shadow: 0 1px 2px rgba(0,0,0,.65);
    cursor: pointer;
}

.home-page .hero-tab.current {
    border-bottom: 1px solid rgba(255,255,255,.48);
    color: #fff;
}

/* Progress line under the active tab (transform-only, so no layout/paint cost). */
.home-page .hero-tab::after {
    content: "";
    position: absolute;
    right: 0;
    bottom: -1px;
    left: 0;
    height: 2px;
    background: #fff;
    transform: scaleX(0);
    transform-origin: left center;
    pointer-events: none;
}

.home-page .hero-tab.current::after {
    transform: scaleX(1);
}

.home-page .hero.hero-playing .hero-tab.current::after {
    transform: scaleX(0);
    animation: heroTabProgress 6.5s linear forwards;
}

@keyframes heroTabProgress {
    to { transform: scaleX(1); }
}

@media (max-width: 1024px) {
    .home-page .hero-slide {
        padding-right: 7%;
        padding-left: 7%;
    }

    .home-page .hero-copy > *,
    .home-page .hero-copy .hero-message {
        max-width: min(620px, 68vw);
    }
}

@media (max-width: 760px) {
    .home-page .hero,
    .home-page .hero-slides {
        height: min(760px, 84svh);
        min-height: 620px;
    }

    .home-page .hero-slide {
        align-items: center;
        padding: 0 7%;
    }

    .home-page .hero-slide:before {
        background: linear-gradient(90deg, rgba(5,6,9,.92), rgba(5,6,9,.66) 65%, rgba(5,6,9,.42));
    }

    .home-page .hero-background {
        width: 100%;
        object-position: center;
    }

    .home-page .hero-copy {
        padding: 0 8px 105px;
    }

    .home-page .hero-copy > *,
    .home-page .hero-copy .hero-message {
        max-width: 100%;
    }

    .home-page .hero-copy h1 {
        font-size: clamp(27px, 8vw, 38px);
    }

    .home-page .hero-controls {
        padding: 0 12px;
    }

    .home-page .hero-controls .circle-control {
        width: 38px;
        height: 38px;
        font-size: 23px;
    }

    .home-page .hero-pagination {
        bottom: 16px;
        width: 100%;
        padding: 0 12px;
        overflow-x: auto;
        scrollbar-width: none;
    }

    .home-page .hero-pagination::-webkit-scrollbar {
        display: none;
    }

    .home-page .hero-tab {
        flex: 0 0 48%;
        min-height: 58px;
        padding: 10px 8px 12px;
        font-size: 11px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .home-page .hero-slide { transition: none !important; }
}

.topic-hub-section { padding: clamp(36px, 5vw, 68px) 0; background: #f7f8fc; }
.topic-hub-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr)); gap: 18px; }
.topic-hub-card { display: flex; min-width: 0; flex-direction: column; overflow: hidden; border: 1px solid #e3e8f1; border-radius: 16px; background: #fff; color: #17213a; transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease; }
.topic-hub-card:hover { transform: translateY(-3px); border-color: #b6c0ff; box-shadow: 0 16px 36px rgba(20, 33, 72, .12); }
.topic-hub-card > img,.topic-hub-placeholder { display: grid; width: 100%; height: 190px; place-items: center; object-fit: cover; background: linear-gradient(135deg,#151c3d,#424ca1); color: #cbd2ff; font-size: 40px; }
.topic-hub-copy { display: flex; flex: 1; flex-direction: column; align-items: flex-start; gap: 9px; padding: 18px; }
.topic-hub-copy small { color: #5755cd; font-size: 10px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; }
.topic-hub-copy strong { font-size: 19px; line-height: 1.25; }
.topic-hub-copy > span { display: -webkit-box; overflow: hidden; color: #66718a; font-size: 13px; line-height: 1.6; -webkit-box-orient: vertical; -webkit-line-clamp: 3; }
.topic-hub-copy b { display: flex; gap: 9px; margin-top: auto; padding-top: 8px; color: #5146e5; font-size: 12px; }
html.dark .topic-hub-section { background: #0c1222; }
html.dark .topic-hub-card { border-color: #27314a; background: #11182b; color: #edf1fb; }
html.dark .topic-hub-copy > span { color: #a7b2c9; }
