/* Shared portal shell: the DRNE colour palette and the top bar (logo, page links, theme switch
   and the compact menu on narrow screens). Used by the portal (index.html) and NOTAM (notam.html),
   so both pages carry one and the same top bar. Load it after the page's own stylesheet.
   The theme is set on <html> and <body> by portal-theme.js; the menu is driven by portal-menu.mjs.
   Top bar rules are prefixed with body[data-theme] .topbar so they win over a page's generic
   button rules (style.css, notam.css) without !important. */

/* DRNE palette: New Light Mode / Dark Mode reference. */
body[data-theme="light"]{
 --bg:#f0f2f5;--panel:#fafafa;--panel2:#fff;--line:#e8e8e8;
 --ink:rgba(0,0,0,.87);--text:var(--ink);--muted:rgba(0,0,0,.60);--tertiary:rgba(0,0,0,.38);
 --primary:#2673dd;--primary-hover:#1d62c0;--primary-medium:rgba(38,115,221,.20);--primary-soft:rgba(38,115,221,.05);--link:#2167c8;
 --success:#44cc77;--success-ink:#17713a;--success-soft:rgba(68,204,119,.09);--success-border:rgba(68,204,119,.30);
 --error:#ee2c4a;--error-ink:#c51c38;--error-soft:rgba(238,44,74,.05);--error-border:rgba(238,44,74,.20);
 --warning:#ffbb00;--warning-ink:#805e00;--warning-soft:rgba(255,187,0,.09);--warning-border:rgba(255,187,0,.30);
 --blue:var(--primary);--green:var(--success-ink);--amber:var(--warning);--danger:var(--error-ink);
 background:var(--bg);color:var(--text)
}
body[data-theme="dark"]{
 --bg:#121212;--panel:#222;--panel2:#1e1e1e;--line:rgba(255,255,255,.09);
 --ink:rgba(255,255,255,.87);--text:var(--ink);--muted:rgba(255,255,255,.60);--tertiary:rgba(255,255,255,.38);
 --primary:#2673dd;--primary-hover:#3180eb;--primary-medium:rgba(38,115,221,.30);--primary-soft:rgba(38,115,221,.14);--link:#82b3f7;
 --success:#309053;--success-ink:#73d595;--success-soft:rgba(48,144,83,.14);--success-border:rgba(48,144,83,.30);
 --error:#ab2830;--error-ink:#ff8594;--error-soft:rgba(171,40,48,.14);--error-border:rgba(171,40,48,.30);
 --warning:#b28400;--warning-ink:#edc752;--warning-soft:rgba(178,132,0,.14);--warning-border:rgba(178,132,0,.30);
 --blue:var(--primary);--green:var(--success-ink);--amber:var(--warning);--danger:var(--error-ink);
 background:var(--bg);color:var(--text)
}

/* Bar: logo on the left, page links and icon buttons on the right; stays at the top while scrolling. */
body[data-theme] .topbar{position:sticky;top:0;z-index:5;display:flex;align-items:center;justify-content:space-between;height:92px;padding:0 max(30px,calc((100vw - 1380px)/2));border-bottom:1px solid var(--line);border-color:var(--line);background:var(--panel);backdrop-filter:blur(16px);font-family:Archivo,Arial,sans-serif}
body[data-theme] .topbar .brand{display:flex;align-items:center;gap:12px;font-family:Sora,Arial,sans-serif}
/* The logo file is drawn in white; the filter turns it black in light mode and white in dark mode. */
body[data-theme] .topbar .brand-logo{width:150px;filter:brightness(0) saturate(100%)}
body[data-theme="dark"] .topbar .brand-logo{filter:brightness(0) invert(1)}
body[data-theme] .topbar .brand-logo img{display:block;width:100%;height:auto}
body[data-theme] .topbar .brand small{display:block;margin-top:2px;color:var(--muted);font-family:Archivo,Arial,sans-serif;font-size:10px;font-weight:600;letter-spacing:.08em;text-transform:uppercase}
body[data-theme] .topbar .top-actions{display:flex;align-items:center;gap:7px;font-family:Sora,Arial,sans-serif}

/* Page links (buttons in the portal, links on other pages): transparent until hovered or active. */
body[data-theme] .topbar .nav-button{min-height:38px;margin:0;padding:8px 14px;border:1px solid transparent;border-radius:999px;background:transparent;color:var(--ink);font-family:Sora,Arial,sans-serif;font-size:12px;font-weight:700;line-height:normal;letter-spacing:.015em;text-align:center;text-decoration:none;text-transform:uppercase;cursor:pointer;transition:background-color .18s,color .18s,border-color .18s,transform .18s}
/* As links (other pages than the portal) they centre their text like the portal's buttons. */
body[data-theme] .topbar a.nav-button{display:inline-flex;align-items:center;justify-content:center}
body[data-theme] .topbar .nav-button:hover{border-color:var(--primary);background:var(--primary-soft);color:var(--ink)}
body[data-theme] .topbar .nav-button.active{border-color:var(--primary);background:var(--primary-medium);color:var(--ink)}

/* Round 44px icon buttons: theme switch, menu toggle, settings and profile. */
body[data-theme] .topbar .header-icon{display:inline-flex;align-items:center;justify-content:center;flex-shrink:0;width:44px;height:44px;min-width:44px;padding:0;border:1px solid var(--line);border-radius:50%;background:var(--panel2);color:var(--ink);font-family:Sora,Arial,sans-serif;list-style:none;cursor:pointer}
body[data-theme] .topbar button.header-icon{min-height:40px;font-weight:700;letter-spacing:.015em;transition:background-color .18s,color .18s,border-color .18s,transform .18s}
body[data-theme] .topbar .header-icon:hover{border-color:var(--primary);background:var(--primary-soft);color:var(--ink)}
body[data-theme] .topbar .header-icon svg{display:block;pointer-events:none}
body[data-theme] .topbar :is(.nav-button,.header-icon):active{transform:translateY(1px)}
body[data-theme] .topbar :is(.nav-button,.header-icon):focus-visible{outline:2px solid var(--primary);outline-offset:3px}

@media(max-width:1000px){body[data-theme] .topbar .top-actions .nav-button{padding:8px}}
@media(max-width:850px){
 body[data-theme] .topbar{height:auto;min-height:82px}
 body[data-theme] .topbar .top-actions{flex-wrap:wrap;justify-content:flex-end}
}

/* Narrow screens (<768px): logo, active page and a menu button; the page links and icon
   buttons open in a panel under the bar. Above 768px these elements stay hidden. */
body[data-theme] .topbar :is(.topbar-current,.topbar-menu-toggle,.topbar-menu-tagline){display:none}
@media(max-width:767.98px){
 /* The bar stays at the top; focused or scrolled-to content stops below it, not under it. */
 :root{--topbar-height:60px;scroll-padding-top:calc(var(--topbar-height) + 8px)}
 body[data-theme] .topbar{height:var(--topbar-height);min-height:0;gap:12px;padding:0 16px;flex-wrap:nowrap}
 body[data-theme] .topbar .brand{flex:0 0 auto;min-width:0}
 /* The logo keeps its proportions at a phone size; the page name gets the remaining room. */
 body[data-theme] .topbar .brand-logo{width:96px;max-width:none}
 body[data-theme] .topbar .brand>span:not(.brand-logo){display:none}
 body[data-theme] .topbar .topbar-current{display:block;flex:1 1 auto;min-width:0;overflow:hidden;color:var(--ink);font-family:Sora,Arial,sans-serif;font-size:12px;font-weight:700;letter-spacing:.06em;text-align:right;text-overflow:ellipsis;text-transform:uppercase;white-space:nowrap}
 body[data-theme] .topbar .topbar-menu-toggle{display:inline-flex;flex:0 0 44px}
 body[data-theme] .topbar .topbar-menu-close-icon,body[data-theme] .topbar[data-menu-open] .topbar-menu-open-icon{display:none}
 body[data-theme] .topbar[data-menu-open] .topbar-menu-close-icon{display:inline}
 body[data-theme] .topbar[data-menu-open] .topbar-menu-toggle{border-color:var(--primary);background:var(--primary-medium);color:var(--ink)}
 /* Open: above page content and map popovers; dialogs still sit in the top layer above it. */
 body[data-theme] .topbar[data-menu-open]{z-index:10050}
 /* The open panel is never taller than the window below the bar (dvh follows iOS Safari's
    address bar; vh is the fallback) and scrolls on its own; an open submenu gets room at the bottom. */
 body[data-theme] .topbar .top-actions{display:none;position:absolute;top:100%;left:0;right:0;flex-wrap:wrap;align-items:center;justify-content:flex-start;gap:6px;max-height:calc(100vh - var(--topbar-height));max-height:calc(100dvh - var(--topbar-height));padding:12px 16px calc(16px + var(--submenu-height,0px));overflow-y:auto;overscroll-behavior:contain;border-bottom:1px solid var(--line);background:var(--panel);box-shadow:0 16px 32px rgb(0 0 0 / .28)}
 body[data-theme] .topbar[data-menu-open] .top-actions{display:flex}
 body[data-theme] .topbar .topbar-menu-tagline{display:block;flex:1 0 100%;margin:0 0 4px;color:var(--muted);font-family:Archivo,Arial,sans-serif;font-size:11px;font-weight:600;letter-spacing:.12em;text-transform:uppercase}
 body[data-theme] .topbar .top-actions .nav-button{flex:1 0 100%;justify-content:flex-start;min-height:44px;padding:10px 14px;border-radius:10px;text-align:left;font-size:13px}
 body[data-theme] .topbar .top-actions .nav-button[hidden]{display:none}
 /* Only html: hidden overflow on body as well would make body a scroll container and unstick the bar. */
 html.portal-menu-open{overflow:hidden;overscroll-behavior:none}
}

/* ==== Felles sidelayout – design/login-og-layout (2026-10) ====
   Én innholdsbredde for alle portalsidene (Oversikt, Whiteboard, Beredskap, Oppdrag, NOTAM, Enheter).
   2200px maks er bredden Oversikt, Oppdrag, Enheter, Systemstatus og Konto allerede brukte på brede
   skjermer; sidemargen er clamp(24px,2vw,40px) på PC og 16px under 768px. Topbaren bruker samme
   innrykk, så logo og meny står på nøyaktig samme sted på alle sider og flukter med innholdet. */
body[data-theme]{--page-max:2200px;--page-gutter:clamp(24px,2vw,40px);--page-inline:max(var(--page-gutter),calc((100% - var(--page-max))/2))}
@media(max-width:767.98px){body[data-theme]{--page-gutter:16px}}
body[data-theme] .topbar{padding-inline:var(--page-inline)}
body[data-theme] main.page{width:min(var(--page-max),calc(100% - 2*var(--page-gutter)));margin-inline:auto}
/* Mellombredder (768–1100px): undertittelen ved logoen gir plass, så menyen aldri går ut over kanten. */
@media(min-width:768px) and (max-width:1100px){
 body[data-theme] .topbar{gap:16px}
 body[data-theme] .topbar .brand>span:not(.brand-logo){display:none}
 body[data-theme] .topbar .brand-logo{width:128px}
 body[data-theme] .topbar .top-actions{flex-wrap:wrap;justify-content:flex-end;min-width:0;gap:4px}
}
@media(min-width:768px) and (max-width:900px){body[data-theme] .topbar .top-actions .nav-button{padding:8px 7px;font-size:11px;letter-spacing:0}}
