/*
 * DARC SECTOR shared layout
 * Header brand (portrait + logo), parallax background and the white page shell.
 * Loaded on every public page, directly after styles.css.
 */

/* Header portrait + logo */
.header .brand {
    display: flex !important;
    align-items: center;
    gap: 10px;
    width: auto !important;
    flex: 0 0 auto !important;
}

.header .brand-portrait {
    display: block !important;
    width: 58px !important;
    height: 58px !important;
    max-width: none !important;
    object-fit: contain;
    flex: 0 0 58px !important;
}

.header .brand-logo {
    display: block !important;
    width: 158px !important;
    height: auto !important;
    max-width: none !important;
    flex: 0 0 158px !important;
}

@media (max-width: 760px) {
    .header .brand {
        gap: 7px;
        width: auto !important;
        flex-basis: auto !important;
    }

    .header .brand-portrait {
        width: 44px !important;
        height: 44px !important;
        flex-basis: 44px !important;
    }

    .header .brand-logo {
        width: 118px !important;
        flex-basis: 118px !important;
    }
}

/*
 * Parallax background
 * .home-page-bg (homepage) and .site-parallax-bg (other pages) look identical.
 * The movement itself is done in /assets/js/site.js.
 */
body.home-page,
body.site-parallax-page {
    background: #fff;
}

.home-page-bg,
.site-parallax-bg {
    position: fixed;
    inset: -18vh 0;
    z-index: 0;
    overflow: hidden;
    pointer-events: none;
    user-select: none;
    background-image: url('/assets/parallax-bg.png');
    background-image: image-set(url('/assets/parallax-bg.webp') type('image/webp'), url('/assets/parallax-bg.png') type('image/png'));
    background-repeat: repeat-y;
    background-size: 100% auto;
    background-position: center 0;
    background-attachment: scroll;
    will-change: background-position;
}

/* Soft white veil over the background image. */
.home-page-bg::after,
.site-parallax-bg::after {
    content: '';
    position: absolute;
    inset: 0;
    z-index: 1;
    /* Lighter wash towards the outer edges, so more of the background shows there (depth). */
    background:
        linear-gradient(90deg, rgba(255, 255, 255, .38) 0%, rgba(255, 255, 255, .7) 22%, rgba(255, 255, 255, .7) 78%, rgba(255, 255, 255, .38) 100%);
    pointer-events: none;
}

/* White page shell on top of the background. */
.home-page-shell,
.site-parallax-shell {
    position: relative;
    z-index: 1;
    width: min(1220px, calc(100% - 80px));
    min-height: 100vh;
    margin: 0 auto;
    background: #fff;
    /* Layered shadow: a fine edge, a close shadow and a wide purple glow, so the page floats above the background. */
    box-shadow:
        0 0 0 1px rgba(60, 40, 120, .06),
        0 0 14px rgba(20, 17, 30, .08),
        0 0 60px rgba(20, 17, 30, .14),
        0 0 140px rgba(116, 27, 255, .12);
}

.home-page-shell .header,
.home-page-shell main,
.home-page-shell footer,
.site-parallax-shell .header,
.site-parallax-shell main,
.site-parallax-shell footer {
    width: calc(100% - 80px);
}

@media (max-width: 760px) {
    .home-page-bg,
    .site-parallax-bg {
        inset: -10vh 0;
    }

    .home-page-shell,
    .site-parallax-shell {
        width: calc(100% - 20px);
    }

    /* Witruimte binnen de witte pagina, zodat tekst niet tegen de rand staat. */
    .home-page-shell .header,
    .home-page-shell main,
    .home-page-shell footer,
    .site-parallax-shell .header,
    .site-parallax-shell main,
    .site-parallax-shell footer {
        width: calc(100% - 32px);
    }
}

/* Footer links (contact, privacy) */
footer { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 24px; }
.footer-links { display: flex; flex-wrap: wrap; gap: 8px 20px; }
.footer-links a { color: inherit; text-decoration: none; }
.footer-links a:hover { color: var(--purple); }

/* Search icon in the main menu (with the word "Search" in the mobile menu) */
.main-navigation > a.nav-search { display: inline-flex; align-items: center; gap: 8px; }
.nav-search svg { display: block; }
.nav-search-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

@media (max-width: 760px) {
    .nav-search-label { position: static; width: auto; height: auto; overflow: visible; clip: auto; }
}

/*
 * Envelope in the main menu (messages to Darc Sector), only when logged in.
 * Desktop: in the menu next to the search icon. Phone: next to the menu
 * button, so it is visible while the menu is closed.
 */
.main-navigation > a.nav-inbox,
.header > a.nav-inbox { position: relative; display: inline-flex; align-items: center; gap: 8px; }
.nav-inbox svg { display: block; }
.nav-inbox-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.nav-inbox-count { position: absolute; top: 1px; left: 12px; min-width: 18px; height: 18px; padding: 0 5px; border: 2px solid #fff; border-radius: 9px; background: var(--purple); color: #fff; font-size: 10px; font-weight: 700; line-height: 14px; text-align: center; animation: nav-inbox-pop .35s ease-out; }
.nav-inbox-mobile { display: none !important; }
.header > a.nav-inbox:hover { color: var(--purple); }

@keyframes nav-inbox-pop { from { transform: scale(.4); } to { transform: scale(1); } }

@media (max-width: 760px) {
    .nav-inbox-desktop { display: none !important; }
    .nav-inbox-mobile { display: inline-flex !important; margin-left: auto; width: 42px; height: 38px; justify-content: center; border: 1px solid var(--line); border-radius: 8px; background: #fff; color: var(--ink); }
    .nav-inbox-mobile.active { color: var(--purple); border-color: var(--purple); }
    .nav-inbox-mobile .nav-inbox-count { top: -7px; left: auto; right: -8px; }
    .nav-inbox-mobile + .menu-toggle { margin-left: 0 !important; }
}

@media (prefers-reduced-motion: reduce) {
    .nav-inbox-count { animation: none; }
}

/* Content type icon in front of labels such as "Shader" or "3D model" (darc_type_icon()). */
.type-icon { display: block; flex: 0 0 auto; width: 1.2em; height: 1.2em; }
.type-icon-image { object-fit: contain; border-radius: 2px; }

/*
 * Popup for images and videos (assets/js/lightbox.js), on every page.
 * The page stays visible behind a dark, blurred layer.
 */
.lightbox { position: fixed; inset: 0; z-index: 1000; display: flex; align-items: center; justify-content: center; padding: 56px 64px; background: rgba(8, 6, 14, .6); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); animation: lightbox-in .2s ease-out; }
.lightbox[hidden] { display: none; }
.lightbox-stage { display: flex; align-items: center; justify-content: center; width: 100%; height: 100%; }
.lightbox-stage img { display: block; max-width: 100%; max-height: 100%; object-fit: contain; border-radius: 6px; box-shadow: 0 10px 40px rgba(0, 0, 0, .5); }
.lightbox-video { display: block; width: min(1280px, 100%, calc((100vh - 112px) * 16 / 9)); aspect-ratio: 16 / 9; border: 0; border-radius: 10px; background: #000; box-shadow: 0 10px 40px rgba(0, 0, 0, .5); }
.lightbox button { position: absolute; display: flex; align-items: center; justify-content: center; width: 46px; height: 46px; border: 0; border-radius: 50%; background: rgba(20, 12, 40, .72); color: #fff; font: inherit; font-size: 22px; cursor: pointer; }
.lightbox button[hidden] { display: none; }
.lightbox button:hover, .lightbox button:focus-visible { background: var(--purple); }
.lightbox-close { top: 14px; right: 14px; }
.lightbox-prev { left: 12px; top: 50%; margin-top: -23px; }
.lightbox-next { right: 12px; top: 50%; margin-top: -23px; }
.lightbox-count { position: absolute; left: 50%; bottom: 16px; transform: translateX(-50%); padding: 3px 10px; border-radius: 999px; background: rgba(20, 12, 40, .72); color: #e9e6f5; font-size: 13px; }
.lightbox-count:empty { display: none; }
body.lightbox-open { overflow: hidden; }
img.is-zoomable { cursor: zoom-in; }

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

@media (max-width: 760px) {
    .lightbox { padding: 64px 10px; }
    .lightbox-video { width: 100%; }
    .lightbox-prev, .lightbox-next { top: auto; bottom: 8px; margin: 0; }
}

@media (prefers-reduced-motion: reduce) {
    .lightbox { animation: none; }
}

/*
 * Content may never make the page wider than the screen (mainly on phones):
 * long words or links wrap, and wide code, tables, videos and images stay within the text column.
 */
.article-content,
.mnode-detail-description { overflow-wrap: anywhere; }
.article-content pre { max-width: 100%; overflow-x: auto; }
.article-content table { display: block; max-width: 100%; overflow-x: auto; }
.article-content iframe,
.article-content video { max-width: 100%; }
.article-content iframe[src*="youtube"],
.article-content iframe[src*="vimeo"] { width: 100%; height: auto; aspect-ratio: 16 / 9; }

/*
 * Tablets and small laptops (761 to 1099px): the full menu no longer fits
 * on one line, so it works like on a phone: the menu button opens it as a
 * list. The same rules as in styles.css for phones, only for this width.
 */
@media (min-width: 761px) and (max-width: 1099px) {
    .header { flex-wrap: wrap; gap: 8px 20px; padding: 14px 0 6px; }
    .menu-toggle { display: flex; align-items: center; justify-content: center; margin-left: auto; width: 42px; height: 38px; border: 1px solid var(--line); background: #fff; border-radius: 8px; padding: 0; color: var(--ink); font-size: 20px; line-height: 1; cursor: pointer; }
    .main-navigation { display: none; order: 3; width: 100%; flex-direction: column; align-items: stretch; gap: 0; padding: 4px 0 10px; }
    .main-navigation.open { display: flex; }
    .main-navigation > a { padding: 9px 2px; border-bottom: 1px solid var(--line); }
    .nav-dropdown { width: 100%; }
    .nav-dropdown-toggle { width: 100%; justify-content: space-between; padding: 9px 2px; }
    .nav-dropdown-menu { position: static; min-width: 0; margin: 0 0 4px; padding: 2px 0 2px 12px; border: 0; border-radius: 0; box-shadow: none; background: transparent; }
    .nav-dropdown:hover .nav-dropdown-menu { display: none; }
    .nav-dropdown.open .nav-dropdown-menu { display: block; }
    .nav-dropdown-menu a { padding: 7px 2px; font-size: 14px; }
    .nav-search-label { position: static; width: auto; height: auto; overflow: visible; clip: auto; }
    .nav-inbox-desktop { display: none !important; }
    .nav-inbox-mobile { display: inline-flex !important; margin-left: auto; width: 42px; height: 38px; justify-content: center; border: 1px solid var(--line); border-radius: 8px; background: #fff; color: var(--ink); }
    .nav-inbox-mobile.active { color: var(--purple); border-color: var(--purple); }
    .nav-inbox-mobile .nav-inbox-count { top: -7px; left: auto; right: -8px; }
    .nav-inbox-mobile + .menu-toggle { margin-left: 0 !important; }
}

/* From 1100px: the menu on one line, a little closer together so everything fits (also when logged in). */
@media (min-width: 1100px) {
    .header { gap: 24px; }
    .main-navigation { gap: clamp(14px, 1.6vw, 26px); }
}
@media (min-width: 1100px) and (max-width: 1299px) {
    .main-navigation > a, .main-navigation .nav-dropdown-toggle { font-size: 14px; }
}

/* Latest work: the version on a software card */
.latest-work-version { margin-left:6px; color:var(--purple); font-size:11px; font-weight:700; letter-spacing:.04em; }
