/* Shared max width + gutters (nav, inner header, page body, footer) */

:root {
    --nx-page-max: 88rem;
    --nx-page-gutter: clamp(1.25rem, 4vw, 3rem);
}

html.nx-site-root {
    scrollbar-gutter: stable;
}

@media (max-width: 1023px) {
    html.nx-site-root,
    html.nx-site-root body {
        overflow-x: clip;
    }
}

/* Top nav - keep inner width aligned with .nx-page-body / .nx-inner-header__shell */
.nx-topnav {
    width: 100%;
    overflow-x: clip;
    box-sizing: border-box;
}

@media (max-width: 1023px) {
    .nx-topnav,
    .nx-topnav-inner {
        overflow: visible;
        overflow-x: visible;
    }
}

.nx-topnav-inner {
    min-width: 0;
}

@media (min-width: 1024px) {
    .nx-topnav-collapse {
        min-width: 0;
        overflow: hidden;
    }

    .nx-topnav-main {
        flex: 1 1 auto;
        min-width: 0;
        overflow-x: auto;
        overflow-y: hidden;
        scrollbar-width: none;
        -ms-overflow-style: none;
    }

    .nx-topnav-main::-webkit-scrollbar {
        display: none;
    }

    .nx-top-actions {
        flex-shrink: 0;
    }
}

.nx-site-shell {
    box-sizing: border-box;
    width: 100%;
    max-width: var(--nx-page-max, 88rem);
    margin-left: auto;
    margin-right: auto;
    padding-left: var(--nx-page-gutter, clamp(1.25rem, 4vw, 3rem));
    padding-right: var(--nx-page-gutter, clamp(1.25rem, 4vw, 3rem));
}

.nx-inner-header {
    position: relative;
    overflow: hidden;
    border-bottom: 1px solid rgba(230, 181, 54, 0.35);
    background: linear-gradient(180deg, rgba(8, 12, 28, 0.98) 0%, rgba(4, 6, 14, 0.92) 100%);
}

.nx-inner-header__grid {
    position: absolute;
    inset: 0;
    pointer-events: none;
    opacity: 0.45;
    background-image:
        linear-gradient(rgba(96, 165, 250, 0.05) 1px, transparent 1px),
        linear-gradient(90deg, rgba(96, 165, 250, 0.05) 1px, transparent 1px);
    background-size: 48px 48px;
    mask-image: linear-gradient(180deg, #000 0%, transparent 92%);
}

.nx-inner-header__shell {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: var(--nx-page-max, 88rem);
    margin: 0 auto;
    padding: clamp(1.75rem, 4vw, 2.75rem) var(--nx-page-gutter, clamp(1.25rem, 4vw, 3rem)) clamp(1.5rem, 3vw, 2.25rem);
}

.nx-inner-header__brand {
    margin: 0 0 0.35rem;
    font-size: 0.8125rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: #e6b536;
}

.nx-inner-header__kicker {
    margin: 0 0 0.5rem;
    font-size: 0.6875rem;
    letter-spacing: 0.2em;
    color: #22d3ee;
}

.nx-inner-header__row {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 0.75rem 1.25rem;
}

.nx-inner-header__title {
    margin: 0;
    flex: 1 1 auto;
    min-width: min(100%, 16rem);
    font-size: clamp(1.75rem, 3.5vw, 2.65rem);
    font-weight: 700;
    line-height: 1.12;
    letter-spacing: -0.03em;
    color: #f8fafc;
}

.nx-inner-header__meta {
    flex: 0 0 auto;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    font-size: 0.6875rem;
    color: #94a3b8;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 9999px;
    padding: 0.35rem 0.85rem;
    white-space: nowrap;
}

.nx-inner-header__lead {
    margin: 0.85rem 0 0;
    max-width: 42rem;
    font-size: 1rem;
    line-height: 1.65;
    color: #94a3b8;
}

body.page-inner .nx-inner-header + * {
    /* content sections follow header without double top padding when using nx-page-body */
}

.nx-page-body {
    box-sizing: border-box;
    width: 100%;
    max-width: min(100%, var(--nx-page-max, 88rem));
    min-width: 0;
    margin-left: auto;
    margin-right: auto;
    padding-left: var(--nx-page-gutter, clamp(1.25rem, 4vw, 3rem));
    padding-right: var(--nx-page-gutter, clamp(1.25rem, 4vw, 3rem));
    padding-top: clamp(1.25rem, 3vw, 2.5rem);
    padding-bottom: clamp(2rem, 4vw, 3rem);
    overflow-x: clip;
}

/* Align with inner header (was capped at 56rem) */
.nx-page-body--narrow {
    max-width: var(--nx-page-max, 88rem);
}

.nx-page-body--medium {
    max-width: var(--nx-page-max, 88rem);
}

.nx-event-featured {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    min-width: 0;
    max-width: 100%;
    overflow: hidden;
}

.nx-event-featured__media {
    position: relative;
    width: 100%;
    min-width: 0;
    min-height: 0;
    aspect-ratio: 16 / 9;
    overflow: hidden;
    background: #04060e;
}

.nx-events-page .grid,
.nx-events-page .panel {
    min-width: 0;
    max-width: 100%;
}

.nx-events-page h2,
.nx-events-page h3,
.nx-event-meta,
.nx-events-page time {
    overflow-wrap: anywhere;
    word-break: break-word;
}

.nx-event-featured__media img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

@media (min-width: 1024px) {
    .nx-event-featured {
        grid-template-columns: minmax(0, 7fr) minmax(0, 5fr);
        align-items: stretch;
    }

    .nx-event-featured__media {
        aspect-ratio: auto;
        min-height: 26rem;
        height: 100%;
    }
}

.nx-contact-directory {
    list-style: none;
    margin: 0 0 3rem;
    padding: 0;
    display: grid;
    gap: 0.75rem;
}

.nx-contact-card {
    display: grid;
    gap: 0.6rem;
    min-width: 0;
    padding: 1rem 1.1rem;
}

.nx-contact-card__name {
    font-size: 1rem;
    font-weight: 600;
    line-height: 1.3;
}

.nx-contact-card__role {
    display: block;
    margin-top: 0.15rem;
    font-size: 0.8125rem;
    font-weight: 400;
}

.nx-contact-card__row {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    min-width: 0;
    font-size: 0.875rem;
}

.nx-contact-card__row > span:first-child {
    width: 1rem;
    height: 1rem;
}

.nx-contact-card__value {
    min-width: 0;
    overflow-wrap: anywhere;
}

@media (min-width: 768px) {
    .nx-contact-card {
        grid-template-columns: minmax(0, 1.2fr) minmax(0, 1.4fr) minmax(0, 1fr);
        align-items: center;
        gap: 1rem;
        padding: 0.9rem 1.5rem;
    }

    .nx-contact-card__role {
        display: inline;
        margin: 0 0 0 0.35rem;
    }

    .nx-contact-card__role::before {
        content: "- ";
    }
}

/* Film / TV catalogue grids - full viewport width (only side gutters) */
.nx-page-body--catalog {
    max-width: none;
    width: 100%;
}

/* Resources catalog - filter toolbar */
.nx-resource-toolbar {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(14rem, 17.5rem);
    align-items: start;
    gap: 1rem 1.25rem;
    margin: 0 0 1.75rem;
    padding: 1rem 1.15rem 1.1rem;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: linear-gradient(180deg, rgba(18, 26, 54, 0.58), rgba(7, 10, 24, 0.42));
}

.nx-resource-filters {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.45rem;
    min-width: 0;
    flex: 1 1 28rem;
}

.nx-resource-filters__label {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    margin-right: 0.35rem;
    font-family: 'JetBrains Mono', ui-monospace, monospace;
    font-size: 0.625rem;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: #64748b;
}

.nx-resource-filters .chip-tag {
    text-decoration: none;
    padding: 0.45rem 0.7rem;
    line-height: 1.2;
}

.nx-resource-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 1.35rem;
    padding: 0.05rem 0.32rem;
    margin-left: 0.15rem;
    border: 1px solid currentColor;
    font-size: 0.5625rem;
    letter-spacing: 0.04em;
    opacity: 0.68;
}

.nx-resource-filters .chip-tag.active .nx-resource-count {
    opacity: 1;
    background: rgba(255, 255, 255, 0.12);
    border-color: rgba(255, 255, 255, 0.28);
}

.nx-resource-search {
    position: relative;
    width: 100%;
    min-width: 0;
}

.nx-resource-search__icon {
    position: absolute;
    left: 0.8rem;
    top: 50%;
    transform: translateY(-50%);
    color: #94a3b8;
    pointer-events: none;
}

.nx-resource-search .field {
    width: 100%;
    padding-left: 2.4rem;
    padding-top: 0.6rem;
    padding-bottom: 0.6rem;
    font-size: 0.875rem;
}

.nx-resource-status {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    margin: -0.75rem 0 1.35rem;
    font-family: 'JetBrains Mono', ui-monospace, monospace;
    font-size: 0.6875rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #94a3b8;
}

.nx-resource-status p {
    margin: 0;
}

.nx-resource-status__count {
    color: #64748b;
}

.nx-resource-status__clear {
    color: #67e8f9;
    text-decoration: none;
    border-bottom: 1px solid rgba(103, 232, 249, 0.35);
}

.nx-resource-status__clear:hover {
    color: #fff;
    border-bottom-color: currentColor;
}

@media (max-width: 720px) {
    .nx-resource-toolbar {
        grid-template-columns: 1fr;
    }
}

/* Resources list - fixed cover height, image always fills frame */
.nx-ebook-card__cover {
    position: relative;
    flex-shrink: 0;
    height: 320px;
    max-height: 320px;
    overflow: hidden;
    background: #04060e;
}

/* Cover overlays (category, format) - theme refinements in site-theme.css */
.nx-cover-badge {
    position: absolute;
    z-index: 1;
    font-family: 'JetBrains Mono', ui-monospace, monospace;
    font-size: 0.5625rem;
    font-weight: 600;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    line-height: 1.2;
    padding: 0.38rem 0.55rem;
    border-radius: 0.3rem;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    pointer-events: none;
    max-width: calc(100% - 1rem);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.nx-cover-badge--tl {
    top: 0.5rem;
    left: 0.5rem;
}

.nx-cover-badge--tr {
    top: 0.5rem;
    right: 0.5rem;
}

html[data-theme="dark"] .nx-cover-badge {
    background: rgba(4, 6, 14, 0.78);
    border: 1px solid rgba(230, 181, 54, 0.4);
    color: #f8fafc;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.35);
}

html[data-theme="dark"] .nx-cover-badge--category {
    border-color: rgba(230, 181, 54, 0.55);
    color: #fef3c7;
}

html[data-theme="dark"] .nx-cover-badge--pdf {
    background: rgba(29, 95, 217, 0.88);
    border-color: rgba(147, 197, 253, 0.45);
    color: #fff;
}

html[data-theme="dark"] .nx-cover-badge--web {
    background: rgba(4, 6, 14, 0.78);
    border-color: rgba(34, 211, 238, 0.45);
    color: #a5f3fc;
}

html[data-theme="light"] .nx-cover-badge {
    background: rgba(255, 255, 255, 0.94);
    border: 1px solid rgba(22, 26, 34, 0.1);
    color: #353c4a;
    box-shadow: 0 2px 10px rgba(22, 26, 34, 0.14);
}

html[data-theme="light"] .nx-cover-badge--category {
    border-color: rgba(230, 181, 54, 0.65);
    color: #8a6208;
    background: rgba(255, 250, 240, 0.96);
}

html[data-theme="light"] .nx-cover-badge--pdf {
    background: #1d5fd9;
    border-color: #3b82f6;
    color: #fff;
    box-shadow: 0 2px 10px rgba(29, 95, 217, 0.35);
}

html[data-theme="light"] .nx-cover-badge--web {
    border-color: rgba(14, 111, 134, 0.45);
    color: #0e6f86;
    background: rgba(255, 255, 255, 0.96);
}

.nx-ebook-card__cover-link {
    display: block;
    width: 100%;
    height: 100%;
}

.nx-ebook-card__cover-img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    transition: transform 0.3s ease;
}

.nx-ebook-card:hover .nx-ebook-card__cover-img {
    transform: scale(1.05);
}

/* Resource detail - “More in this category” (slightly shorter covers in dense grid) */
.nx-ebook-card--related .nx-ebook-card__cover {
    height: 280px;
    max-height: 280px;
}

@media (min-width: 768px) {
    .nx-ebook-card--related .nx-ebook-card__cover {
        height: 300px;
        max-height: 300px;
    }
}

.nx-ebook-card__body--related {
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    min-height: 6.75rem;
    padding: 0.875rem 1rem 1rem;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    background: linear-gradient(180deg, rgba(18, 26, 54, 0.4), rgba(4, 6, 14, 0.65));
}

.nx-ebook-card--related .nx-ebook-card__title {
    margin: 0;
    font-family: 'Space Grotesk', system-ui, sans-serif;
    font-size: 0.9375rem;
    font-weight: 600;
    line-height: 1.35;
    letter-spacing: -0.02em;
    color: #e6ecf5;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 3;
    overflow: hidden;
    transition: color 0.2s ease;
}

.nx-ebook-card--related:hover .nx-ebook-card__title {
    color: #67e8f9;
}

.nx-ebook-card--related .nx-ebook-card__meta {
    margin: 0;
    font-family: 'JetBrains Mono', ui-monospace, monospace;
    font-size: 0.625rem;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: #94a3b8;
    line-height: 1.4;
}

.nx-ebook-card--related .nx-ebook-card__pub {
    margin: 0;
    font-size: 0.75rem;
    line-height: 1.45;
    color: #94a3b8;
}

.nx-ebook-card--related .nx-ebook-card__cta {
    margin-top: auto;
    padding-top: 0.5rem;
    font-family: 'JetBrains Mono', ui-monospace, monospace;
    font-size: 0.625rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: #64748b;
    transition: color 0.2s ease;
}

.nx-ebook-card--related:hover .nx-ebook-card__cta {
    color: #22d3ee;
}

/* Empty states - shared layout (.empty component + resources .nx-empty-state) */
.empty,
.nx-empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    box-sizing: border-box;
    width: 100%;
    max-width: 28rem;
    min-height: clamp(18rem, 36vh, 26rem);
    margin: clamp(1.5rem, 5vw, 3rem) auto;
    padding: clamp(2rem, 5vw, 3rem) clamp(1.5rem, 4vw, 2.25rem);
    border-radius: 0.75rem;
    border: 1px dashed rgba(255, 255, 255, 0.14);
}

.nx-page-body--catalog .empty,
.nx-page-body--catalog > .nx-empty-state {
    max-width: 26rem;
    margin-top: clamp(2rem, 8vw, 4rem);
    margin-bottom: clamp(2rem, 8vw, 4rem);
}

.empty .empty-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 4.25rem;
    height: 4.25rem;
    margin: 0 auto 1.15rem;
    border-radius: 999px;
    background: rgba(34, 211, 238, 0.08);
    border: 1px solid rgba(34, 211, 238, 0.28);
    color: rgba(34, 211, 238, 0.85);
}

.empty .empty-title {
    font-family: 'Space Grotesk', 'Geist', sans-serif;
    font-weight: 600;
    font-size: 1.125rem;
    letter-spacing: -0.02em;
    margin: 0 0 0.4rem;
    color: #e6ecf5;
}

.empty .empty-msg {
    margin: 0;
    font-size: 0.9375rem;
    line-height: 1.55;
    color: #94a3b8;
}

.nx-empty-state {
    min-height: clamp(22rem, 42vh, 28rem);
    padding: clamp(2.5rem, 6vw, 4rem) clamp(1.5rem, 4vw, 2.5rem);
}

.nx-empty-state__inner {
    max-width: 22rem;
    margin: 0 auto;
}

.nx-empty-state__icon {
    display: block;
    margin: 0 auto 1rem;
    font-size: 2.25rem;
    line-height: 1;
    color: rgba(34, 211, 238, 0.65);
}

.nx-empty-state__title {
    margin: 0;
    font-family: 'Geist', ui-sans-serif, system-ui, sans-serif;
    font-size: 1.125rem;
    font-weight: 600;
    color: #cbd5e1;
}

.nx-empty-state__lead {
    margin: 0.5rem 0 0;
    font-size: 0.9375rem;
    line-height: 1.55;
    color: #64748b;
}
