/* Shared opt-in ASInfra shell for overview, education and project pages.
 * Content components stay in their existing stylesheets; these aliases
 * harmonize shared colors, including on the 404 page. */
.asinfra-page {
    --shell-background: #061017;
    --shell-surface: #0b1820;
    --shell-border: #30444b;
    --shell-accent: #9ce4e0;
    --shell-muted: #b1c0ca;
    --shell-width: 1520px;
    --shell-content-width: 1080px;
    --shell-header-height: 88px;
    --shell-radius: 7px;
    --shell-gutter: clamp(1.25rem, 4.6vw, 5.5rem);
    --background: var(--shell-background);
    --surface: var(--shell-surface);
    --surface-subtle: #0e202a;
    --border: var(--shell-border);
    --text-primary: #f1f5f7;
    --text-secondary: #cbd8e0;
    --text-muted: var(--shell-muted);
    --purple: #83d5d2;
    --purple-hover: #adebe7;
    --purple-light: var(--shell-accent);
    --purple-subtle: #132c33;
    --blue: #9ed1d6;
    --blue-light: #b2efea;
    background: var(--shell-background);
}

.asinfra-page .page-shell {
    min-height: 100svh;
    margin-left: 0;
}

.shell-width {
    width: min(var(--shell-width), calc(100% - 2 * var(--shell-gutter)));
    margin-inline: auto;
}

.shell-header {
    display: grid;
    min-height: var(--shell-header-height);
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: 1.5rem;
}

.shell-brand {
    display: inline-flex;
    width: fit-content;
    min-height: 44px;
    align-items: center;
    gap: .85rem;
    color: var(--text-primary);
    font-size: 1.4rem;
    font-weight: 600;
    letter-spacing: -.025em;
    text-decoration: none;
}

.shell-brand img {
    width: 30px;
    height: 34px;
    flex-shrink: 0;
}

.shell-nav,
.shell-header-actions {
    display: flex;
    align-items: center;
    gap: clamp(1rem, 2.1vw, 2.25rem);
}

.shell-nav a {
    display: inline-flex;
    min-height: 44px;
    align-items: center;
    color: #e4ebef;
    font-size: .88rem;
    text-decoration: none;
    text-underline-offset: .45em;
}

.shell-nav a:hover,
.shell-nav a[aria-current="page"] {
    color: var(--shell-accent);
    text-decoration: underline;
    text-decoration-thickness: 1px;
}

.shell-header-actions {
    justify-self: end;
    gap: .9rem;
}

.shell-search {
    display: grid;
    width: 44px;
    height: 44px;
    padding: .7rem;
    place-items: center;
    border: 1px solid transparent;
    border-radius: var(--shell-radius);
    background: transparent;
    color: #d0dce2;
}

.shell-search[hidden] { display: none; }

.shell-search svg {
    width: 22px;
    height: 22px;
    fill: none;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 1.3;
}

.shell-flow-link {
    display: inline-flex;
    min-height: 44px;
    padding: .65rem 1.5rem;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    border: 1px solid #5c8c94;
    border-radius: var(--shell-radius);
    background: rgb(6 16 23 / 30%);
    color: var(--shell-accent);
    font-size: .84rem;
    text-decoration: none;
    white-space: nowrap;
}

.shell-flow-link:hover,
.shell-search:hover {
    border-color: var(--shell-accent);
    background: var(--purple-subtle);
}

.shell-menu-button { display: none; }

.asinfra-page .site-main {
    width: min(var(--shell-content-width), calc(100% - 2 * var(--shell-gutter)));
    padding: 2.5rem 0 3.5rem;
}

.asinfra-page .page-intro::before { background: var(--shell-accent); }
.asinfra-page .back-link { min-height: 44px; }
.asinfra-page .content-page a:not([class]) { color: var(--blue-light); }

.asinfra-page :is(.button-link, .card-action) {
    border-radius: var(--shell-radius);
    color: #061c22;
}

.asinfra-page :is(a, button, input):focus-visible {
    outline: 2px solid var(--shell-accent);
    outline-offset: 4px;
}

.asinfra-page .skip-link {
    background: #83d5d2;
    color: #061c22;
}

.shell-footer {
    padding-block: 1.25rem;
    border-top: 1px solid var(--shell-border);
    color: var(--shell-muted);
    font-size: .75rem;
}

.asinfra-page .search-result:is(:hover, .is-active) {
    border-color: var(--shell-border);
}

.asinfra-page .shell-drawer-flow {
    display: flex;
    min-height: 44px;
    margin: 1rem 1.25rem;
    padding: .75rem;
    gap: .5rem;
    border-top: 1px solid var(--shell-border);
    color: var(--shell-accent);
    text-decoration: none;
}

@media (min-width: 821px) {
    .asinfra-page .sidebar { display: none; }
}

@media (max-width: 1100px) {
    .shell-header { gap: 1rem; }
    .shell-nav { gap: 1.1rem; }
    .shell-flow-link { padding-inline: 1rem; }
}

@media (max-width: 820px) {
    .asinfra-page { --shell-header-height: 80px; }
    .asinfra-page .sidebar { visibility: hidden; }
    html.sidebar-open .asinfra-page .sidebar { visibility: visible; }
    .asinfra-page .sidebar .shell-brand { gap: .5rem; font-size: 1.15rem; }
    .asinfra-page .sidebar .close-icon { display: block; }
    .asinfra-page .sidebar-nav a[aria-current="page"] {
        border-color: transparent;
        background: transparent;
        color: var(--shell-accent);
        box-shadow: inset 2px 0 0 var(--shell-accent);
    }
    .shell-header {
        grid-template-columns: 1fr auto;
        padding-block: .75rem;
        row-gap: .5rem;
    }
    /* Navigation remains visible if the shared script cannot initialize. */
    .shell-nav {
        grid-column: 1 / -1;
        grid-row: 2;
        flex-wrap: wrap;
        gap: .25rem 1.5rem;
    }
    .shell-enhanced .shell-nav { display: none; }
    .shell-enhanced .shell-menu-button {
        display: inline-flex;
        min-height: 44px;
        align-items: center;
        gap: .45rem;
        border-color: #536f79;
        background: transparent;
        color: #e4ebef;
    }
    .shell-header-actions { gap: .35rem; }
    .shell-header-actions > .shell-flow-link { display: none; }
    .asinfra-page .site-main { padding-top: 1.75rem; }
}

@media (max-width: 540px) {
    .shell-brand { gap: .5rem; font-size: 1.15rem; }
    .shell-brand img { width: 26px; }
}

@media (prefers-reduced-motion: no-preference) {
    .shell-flow-link,
    .shell-search { transition: background-color .15s ease, border-color .15s ease, color .15s ease; }
}

/* Shared interior content rhythm; the homepage keeps its own layout. */
.asinfra-page .interior-page {
    --shell-content-width: 1160px;
    padding-top: clamp(2rem, 3.5vw, 3rem);
    padding-bottom: clamp(3rem, 6vw, 5rem);
}

.interior-page .interior-intro {
    max-width: 880px;
    margin: 0 0 clamp(2.25rem, 4vw, 3rem);
}

.interior-page .interior-intro::before { content: none; }

.interior-page .interior-kicker {
    margin: 0 0 1.1rem;
    color: var(--shell-accent);
    font-size: .68rem;
    font-weight: 550;
    letter-spacing: .2em;
    line-height: 1.5;
    text-transform: uppercase;
}

.interior-page .interior-intro h1 {
    max-width: 23ch;
    font-size: clamp(2rem, 3.3vw, 2.9rem);
    font-weight: 550;
    letter-spacing: -.035em;
    line-height: 1.13;
    text-wrap: balance;
}

.interior-page .interior-intro > p:last-child {
    max-width: 68ch;
    margin-top: 1.3rem;
    color: var(--text-secondary);
    font-size: 1.05rem;
    line-height: 1.75;
}

.interior-page .interior-section-title {
    margin: 0;
    font-size: clamp(1.4rem, 2.5vw, 1.85rem);
    font-weight: 550;
    line-height: 1.25;
}

.interior-page .content-link {
    display: inline-flex;
    width: fit-content;
    min-height: 44px;
    align-items: center;
    gap: .75rem;
    color: var(--shell-accent);
    font-size: .9rem;
    font-weight: 500;
    text-decoration: none;
    text-underline-offset: .3em;
}

.interior-page .content-link:hover {
    color: var(--text-primary);
    text-decoration: underline;
}

.interior-next {
    display: flex;
    margin-top: 2.5rem;
    padding-top: 1.25rem;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: .5rem 2rem;
    border-top: 1px solid var(--shell-border);
}

.interior-next > div {
    display: flex;
    flex-wrap: wrap;
    gap: .5rem 2rem;
}

@media (max-width: 540px) {
    .interior-next { flex-direction: column; }
}

/* Education detail pages reuse the interior rhythm without changing their
 * course-specific structure, anchors or responsive table layouts. */
.asinfra-page .education-detail,
.asinfra-page .education-history {
    max-width: none;
    overflow-wrap: anywhere;
}

.education-detail .back-link,
.education-history .back-link {
    margin-bottom: 1.5rem;
    color: var(--shell-muted);
    font-size: .85rem;
    font-weight: 500;
}

.education-detail .back-link:hover,
.education-history .back-link:hover {
    color: var(--shell-accent);
}

.education-detail .interior-intro {
    padding-bottom: 0;
}

.education-detail :is(.course-map-lede, .it2810-course-lede) {
    max-width: 68ch;
    margin-top: 1.3rem;
    font-size: 1.05rem;
    line-height: 1.75;
}

.education-detail :is(.section-kicker, .it2810-section-kicker, .it2810-project-label),
.education-history .section-kicker {
    color: var(--shell-accent);
    font-size: .68rem;
    font-weight: 550;
    letter-spacing: .18em;
}

.education-detail :is(h2, h3),
.education-history :is(h2, h3, h4) {
    font-weight: 550;
}

.education-detail .content-card {
    padding: clamp(1.25rem, 3vw, 1.75rem);
    border-color: var(--shell-border);
    border-radius: var(--shell-radius);
    background: var(--shell-surface);
}

.education-detail .content-card h2 {
    font-size: 1.5rem;
}

.education-detail .ntnu-link,
.education-history .ntnu-link {
    font-size: .85rem;
    font-weight: 500;
}
