/*
 * Noetische Wesen 5.13.7 – Raumname links neben der Weltmarke.
 *
 * Geltungsbereich: nur assets/welt/index.html und eingebettete Wesensräume.
 * Eigenständig geöffnete Wesensseiten werden nicht verändert.
 */

:root {
    --nw-shared-header-height: 68px;
}

/* Der Portalheader ist auch beim Scrollen und in der Wesensansicht sichtbar. */
.nw-header {
    position: fixed !important;
    top: 0;
    right: 0;
    left: 0;
    z-index: 110 !important;
    height: var(--nw-shared-header-height);
    min-height: var(--nw-shared-header-height);
}

/* Kein zweiter Navigationsstreifen oberhalb des eingebetteten Raums. */
.wesen-fullscreen.open {
    top: var(--nw-shared-header-height);
    bottom: 0;
    z-index: 85;
}

.wesen-fullscreen-top {
    display: none !important;
}

/* Die vorhandenen Kontextaktionen werden in den Portalheader versetzt. */
.nw-header .nw-room-action {
    display: inline-flex;
    align-items: center;
    color: #d2dce1;
    font-size: 10px;
    letter-spacing: 0.10em;
    white-space: nowrap;
    padding: 9px 2px;
    background: transparent;
    border: 0;
    cursor: pointer;
}

.nw-header .nw-room-action:hover,
.nw-header .nw-room-action:focus-visible {
    color: #f4d6ab;
}

.nw-header .nw-room-action[hidden] {
    display: none !important;
}

/* Kompass und Infotafeln bleiben über dem feststehenden Header bedienbar. */
.overlay-shade {
    z-index: 120;
}

.compass-panel,
.detail-panel {
    z-index: 121;
}

/* Bei einer geöffneten Wesensansicht wird der Raumname angezeigt. */
body.wesen-active .nw-header .nw-place {
    color: #e6bd89;
}

@media (max-width: 980px) {
    body.wesen-active .nw-header .nw-place {
        display: inline-block;
        margin: 0 6px;
    }
}

/* ================================================================
 * 5.13.7 – Navigationsanordnung und eindeutiger Ausgang
 * Nur Darstellung. Keine Änderungen an JavaScript oder HTML.
 * ================================================================ */

/*
 * Markenbereich links, Raumname direkt daneben, Aktionen rechts.
 * Der Raumname beansprucht keine feste Bildschirmmitte mehr.
 */
.nw-header {
    display: grid !important;
    grid-template-columns: max-content max-content minmax(0, 1fr);
    align-items: center;
    column-gap: clamp(12px, 1.6vw, 24px);
}

.nw-header > .nw-brand {
    grid-column: 1;
    justify-self: start;
    min-width: 0;
}

/* Die Trennlinie kennzeichnet den Wechsel von Weltmarke zu Raumname. */
.nw-header > .nw-place {
    grid-column: 2;
    justify-self: start;
    min-width: 0;
    padding-left: clamp(14px, 1.5vw, 24px);
    border-left: 1px solid rgba(185, 203, 217, 0.38);
    color: #e6bd89;
    letter-spacing: 0.16em;
    white-space: nowrap;
}

.nw-header > .nw-actions {
    grid-column: 3;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    flex-wrap: nowrap;
    gap: clamp(4px, 0.7vw, 10px);
    min-width: 0;
    max-width: 100%;
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: thin;
    scrollbar-color: rgba(140, 180, 204, 0.5) transparent;
}

/* Die Navigationslinks dürfen sich nicht gegenseitig zusammendrücken. */
.nw-header > .nw-actions > * {
    flex-shrink: 0;
}

/* Die JavaScript-Datei setzt die Raumlinks an den Anfang des DOM.
   Die Reihenfolge wird hier ohne Eingriff in Event-Listener geregelt. */
.nw-header #close-wesen { order: 10; }
.nw-header #nera-recording-link { order: 15; }
.nw-header #nera-controls-toggle { order: 16; }
.nw-header #wesen-info { order: 20; }
.nw-header #open-compass { order: 30; }
.nw-header #open-archive { order: 40; }
.nw-header .nw-actions > .nw-link[href^="https://eden-spirit.eu"] {
    order: 100;
}

/* Alle internen Navigationsaktionen sehen gleich aus. */
.nw-header .nw-actions > :is(.nw-action, .nw-room-action) {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 34px;
    padding: 8px 10px;
    border: 1px solid transparent;
    border-radius: 6px;
    background: transparent;
    color: #d5dce3;
    font-family: inherit;
    font-size: 10px;
    font-weight: 500;
    letter-spacing: 0.10em;
    line-height: 1.2;
    text-decoration: none;
    white-space: nowrap;
    cursor: pointer;
    transition: color 180ms ease, background-color 180ms ease,
                border-color 180ms ease;
}

.nw-header .nw-actions > :is(.nw-action, .nw-room-action):is(:hover, :focus-visible) {
    color: #f4d6ab;
    background: rgba(232, 195, 142, 0.08);
    border-color: rgba(232, 195, 142, 0.22);
}

.nw-header .nw-actions > .nw-room-action[hidden] {
    display: none !important;
}

/* Der externe Ausgang steht immer ganz rechts und ist bewusst blau. */
.nw-header .nw-actions > .nw-link[href^="https://eden-spirit.eu"] {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 34px;
    padding: 8px 12px;
    border: 1px solid rgba(107, 184, 230, 0.45);
    border-radius: 6px;
    background: rgba(40, 112, 164, 0.15);
    color: #8ed2fa;
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.10em;
    white-space: nowrap;
    text-decoration: none;
    transition: color 180ms ease, background-color 180ms ease;
}

.nw-header .nw-actions > .nw-link[href^="https://eden-spirit.eu"]:is(:hover, :focus-visible) {
    color: #e4f5ff;
    background: rgba(48, 134, 194, 0.30);
}

/*
 * Auf schmaleren Bildschirmen bleibt die Marke links und der Raumname
 * daneben. Die Navigation bekommt bei Bedarf eine eigene zweite Zeile.
 */
@media (max-width: 1200px) {
    .nw-header {
        column-gap: 12px;
    }

    .nw-header > .nw-actions {
        gap: 4px;
    }

    .nw-header .nw-actions > :is(.nw-action, .nw-room-action) {
        padding: 7px 6px;
        font-size: 9px;
        letter-spacing: 0.04em;
    }
}

@media (max-width: 900px) {
    :root {
        --nw-shared-header-height: 98px;
    }

    .nw-header {
        grid-template-columns: max-content minmax(0, 1fr);
        grid-template-rows: auto auto;
        height: var(--nw-shared-header-height);
        min-height: var(--nw-shared-header-height);
        row-gap: 5px;
        padding-top: 6px;
        padding-bottom: 6px;
    }

    .nw-header > .nw-brand {
        grid-column: 1;
        grid-row: 1;
    }

    .nw-header > .nw-place {
        grid-column: 2;
        grid-row: 1;
        justify-self: start;
    }

    .nw-header > .nw-actions {
        grid-column: 1 / -1;
        grid-row: 2;
        justify-content: flex-start;
        width: 100%;
    }
}

@media (max-width: 520px) {
    :root {
        --nw-shared-header-height: 102px;
    }

    .nw-header {
        column-gap: 7px;
    }

    .nw-header > .nw-place {
        display: inline-block !important;
        padding-left: 9px;
        font-size: 10px;
        letter-spacing: 0.07em;
    }

    .nw-header .nw-actions > :is(.nw-action, .nw-room-action),
    .nw-header .nw-actions > .nw-link[href^="https://eden-spirit.eu"] {
        min-height: 30px;
        padding: 6px;
        font-size: 9px;
    }
}
