/*
 * Nuhet reskin: app shell (top bar, rail / bottom bar, Mer sheet, main, banners area).
 * Mobile first. Tablet from 700px, desktop from 1024px.
 * <body class="nh"> is the reset root (tokens.css); .nh-shell inside it is the grid,
 * so toasts and dialogs outside the grid still get the reset and component rules.
 */

.nh-shell{
  min-height:100vh;
  min-height:100dvh;
  display:grid;
  grid-template-rows:auto 1fr auto;
  grid-template-columns:100%;
  grid-template-areas:"top" "main" "rail";
}
.nh-topbar{grid-area:top}
.nh-main{grid-area:main}
.nh-rail{grid-area:rail}

/* ---------- skip link ---------- */
.nh-skip{position:absolute;left:var(--nh-space-sm);top:var(--nh-space-sm);z-index:20;padding:var(--nh-space-sm) var(--nh-space-md);background:var(--nh-surface);border-radius:var(--nh-radius-md);transform:translateY(-200%)}
.nh-skip:focus{transform:none}

/* ---------- top bar (phone + tablet) ---------- */
.nh-topbar{position:sticky;top:0;z-index:5;display:flex;align-items:center;gap:var(--nh-space-md);min-height:var(--nh-space-topbar);padding:var(--nh-space-sm) var(--nh-space-gutter-phone);background:var(--nh-surface);border-bottom:1px solid var(--nh-line)}
.nh-topbar .nh-brand{display:flex;align-items:center;gap:var(--nh-space-sm-md);font-weight:var(--nh-weight-semibold);color:var(--nh-ink);text-decoration:none}
.nh-mark{width:var(--nh-mark);height:var(--nh-mark);object-fit:contain;display:block;flex:none}
.nh-topbar .nh-pagename{margin-left:auto;color:var(--nh-muted);font-size:var(--nh-size-body-sm);min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.nh-topbar .nh-topbtns{display:flex;gap:var(--nh-space-xs)}
.nh-iconbtn{position:relative;display:inline-grid;place-items:center;width:var(--nh-space-touch);height:var(--nh-space-touch);border:0;border-radius:var(--nh-radius-md);background:transparent;color:var(--nh-primary);text-decoration:none}
.nh-iconbtn:hover{background:var(--nh-info-bg)}
.nh-iconbtn svg{width:var(--nh-icon-lg);height:var(--nh-icon-lg)}
.nh-tablet-feedback{display:none}
.nh-badge{display:inline-grid;place-items:center;min-width:var(--nh-icon-md);height:var(--nh-icon-md);padding:0 var(--nh-space-xs-sm);border-radius:var(--nh-radius-full);background:var(--nh-warn-bg);color:var(--nh-warn);font:var(--nh-font-label-sm);font-variant-numeric:tabular-nums}
.nh-iconbtn .nh-badge{position:absolute;top:var(--nh-space-2xs);right:var(--nh-space-2xs)}

/* ---------- navigation (phone: bottom bar) ---------- */
.nh-rail{background:var(--nh-surface);border-top:1px solid var(--nh-line);position:sticky;bottom:0;z-index:6;padding-bottom:env(safe-area-inset-bottom,0px)}
.nh-rail .nh-railhead{display:none}
.nh-nav{display:grid;grid-template-columns:repeat(5,1fr)}
.nh-nav li{min-width:0}
.nh-nav a,.nh-nav button{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:var(--nh-space-xs);width:100%;min-height:var(--nh-nav-phone-height);padding:var(--nh-space-xs-sm) var(--nh-space-2xs);border:0;border-top:var(--nh-indicator) solid transparent;background:transparent;color:var(--nh-muted);text-decoration:none;font:var(--nh-font-nav-phone);text-align:center}
.nh-nav a[aria-current="page"]{color:var(--nh-ink);border-top-color:var(--nh-accent)}
/* "Mer" on the phone bar when the current section is folded into the sheet */
.nh-nav a.is-current{color:var(--nh-ink);border-top-color:var(--nh-accent)}
.nh-nav svg{width:var(--nh-icon-lg);height:var(--nh-icon-lg)}
.nh-nav .nh-desk{display:none}
.nh-navutils{display:none}
.nh-railfoot{display:none}

/* ---------- main ---------- */
.nh-main{padding:var(--nh-space-gutter-phone) var(--nh-space-gutter-phone) var(--nh-space-xl);width:100%;max-width:var(--nh-space-content-max);margin:0 auto;min-width:0}
.nh-mainfoot{margin-top:var(--nh-space-xl);padding-top:var(--nh-space-lg);border-top:1px solid var(--nh-line);color:var(--nh-muted);font:var(--nh-font-label-md-regular)}

/* banners area: sits at the top of main, above the page head */
.nh-banners{display:flex;flex-direction:column;gap:var(--nh-space-sm);margin-bottom:var(--nh-space-lg)}
.nh-banners:empty{display:none}

/* ---------- Mer sheet (phone): a <dialog class="nh-sheet"> that slides up over the scrim ---------- */
.nh-sheet{position:fixed;inset:auto 0 0 0;width:100%;max-width:100%;max-height:85vh;max-height:85dvh;margin:0;padding:var(--nh-space-sm) var(--nh-space-lg) calc(var(--nh-space-lg) + env(safe-area-inset-bottom,0px));border:1px solid var(--nh-line);border-bottom:0;border-radius:var(--nh-radius-xl) var(--nh-radius-xl) 0 0;background:var(--nh-surface);color:var(--nh-ink);overflow-y:auto;overscroll-behavior:contain}
.nh-sheet[open]{animation:nh-sheet-up var(--nh-duration) ease-out}
.nh-sheet::backdrop{background:var(--nh-scrim)}
.nh-sheethead{display:flex;align-items:center;justify-content:space-between;gap:var(--nh-space-md);padding:var(--nh-space-xs) 0 var(--nh-space-sm);border-bottom:1px solid var(--nh-line);margin-bottom:var(--nh-space-xs)}
.nh-sheethead h2{flex:1;font:var(--nh-font-headline-sm)}
.nh-sheethead .nh-sheetco{font-weight:var(--nh-weight-semibold);min-width:0;overflow-wrap:anywhere}
.nh-sheetlist{display:flex;flex-direction:column}
.nh-sheetlist a,.nh-sheetlist button{display:flex;align-items:center;gap:var(--nh-space-md);width:100%;min-height:var(--nh-space-touch);padding:var(--nh-space-sm) var(--nh-space-xs);border:0;border-radius:var(--nh-radius-sm);background:transparent;color:var(--nh-ink);font-weight:var(--nh-weight-medium);text-align:left;text-decoration:none}
.nh-sheetlist a:hover,.nh-sheetlist button:hover{background:var(--nh-ground)}
.nh-sheetlist a[aria-current="page"]{background:var(--nh-accent-soft)}
.nh-sheetlist svg{width:var(--nh-icon-md);height:var(--nh-icon-md);color:var(--nh-muted)}
.nh-sheetlist .nh-sep{height:1px;margin:var(--nh-space-xs) 0;background:var(--nh-line)}
.nh-sheetlist .nh-badge{margin-left:auto}
@keyframes nh-sheet-up{from{transform:translateY(100%)}to{transform:none}}

/* ---------- agreement dialog (Agreement.vue with shell="nh"; chrome is .nh-dialog in components.css) ---------- */
.nh-agreement .nh-agreementcount{color:var(--nh-muted);font:var(--nh-font-label-md-regular);margin-bottom:var(--nh-space-xs)}
.nh-agreement .nh-agreementbody{max-height:60vh;max-height:60dvh;overflow-y:auto;overscroll-behavior:contain}
.nh-agreement .nh-agreementbody :where(p,ul,ol,h1,h2,h3,h4){margin-bottom:var(--nh-space-sm)}
.nh-agreement .nh-agreementbody :where(ul){padding-left:var(--nh-space-lg);list-style:disc}
.nh-agreement .nh-agreementbody :where(ol){padding-left:var(--nh-space-lg);list-style:decimal}

/* ================= tablet ================= */
@media (min-width: 700px){
  .nh-shell{grid-template-rows:auto 1fr;grid-template-columns:var(--nh-space-rail-tablet) minmax(0,1fr);grid-template-areas:"top top" "rail main"}
  .nh-topbar{padding-inline:var(--nh-space-gutter-tablet)}
  .nh-nav .nh-tablet-feedback{display:block}
  /* The rail column is painted full page height by this grid item in the rail area, so the
     white column never ends where the viewport did; the rail itself is sticky and exactly
     viewport high (below the top bar here, full height on desktop) with its own scroll. */
  .nh-shell::before{content:"";grid-area:rail;background:var(--nh-surface);border-right:1px solid var(--nh-line)}
  .nh-rail{position:sticky;top:var(--nh-space-topbar);bottom:auto;align-self:start;height:calc(100vh - var(--nh-space-topbar));height:calc(100dvh - var(--nh-space-topbar));overflow-y:auto;overscroll-behavior:contain;border-top:0;border-right:1px solid var(--nh-line);padding:var(--nh-space-sm) 0}
  .nh-nav{display:flex;flex-direction:column;gap:var(--nh-space-2xs);padding:0 var(--nh-space-xs)}
  /* Nuheter and Mediabibliotek are icon buttons in the tablet top bar; the rail shows them on desktop only. */
  .nh-navutils{display:none}
  .nh-nav a,.nh-nav button{min-height:var(--nh-nav-tablet-height);border-top:0;border-radius:var(--nh-radius-md);border-left:var(--nh-indicator) solid transparent;font:var(--nh-font-nav-tablet);padding:var(--nh-space-xs-sm) 0}
  .nh-nav a[aria-current="page"]{background:var(--nh-accent-soft);border-left-color:var(--nh-accent)}
  .nh-nav .nh-desk{display:block}
  /* 72px icon rail: the 11px labels get the full item width (60px; "Nyhetsbrev" is 59px) and
     slightly tighter tracking for slack. Labels wrap only between words; a single word longer
     than the rail (admin labels) is cut with an ellipsis, never broken mid-word. */
  .nh-nav a span:not(.nh-badge),.nh-nav button span:not(.nh-badge){max-width:100%;letter-spacing:-.01em;overflow:hidden;text-overflow:ellipsis}
  .nh-nav .nh-mob{display:none}
  .nh-main{padding:var(--nh-space-gutter-tablet)}
  .nh-sheet{display:none}
}

/* ================= desktop ================= */
@media (min-width: 1024px){
  .nh-shell{grid-template-rows:1fr;grid-template-columns:var(--nh-space-rail-desktop) minmax(0,1fr);grid-template-areas:"rail main"}
  .nh-topbar{display:none}
  .nh-nav .nh-tablet-feedback{display:none}
  .nh-rail{top:0;height:100vh;height:100dvh;min-height:0;padding:0;display:flex;flex-direction:column;overflow-y:auto}
  .nh-rail .nh-railhead{display:flex;align-items:center;gap:var(--nh-space-md);min-height:var(--nh-railhead-height);padding:var(--nh-space-lg-xl) var(--nh-space-lg-xl) var(--nh-space-lg);border-bottom:1px solid var(--nh-line);margin-bottom:var(--nh-space-sm)}
  .nh-railhead .nh-mark{width:var(--nh-mark-lg);height:var(--nh-mark-lg)}
  .nh-railhead .nh-railtext{min-width:0;line-height:1.25}
  .nh-railhead .nh-railtext b{display:block;font-weight:var(--nh-weight-semibold);font-size:var(--nh-size-body-sm);line-height:1.2;overflow-wrap:anywhere}
  .nh-railhead .nh-railtext span{display:block;color:var(--nh-muted);font:var(--nh-font-label-md-regular);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
  .nh-nav{padding:0 var(--nh-space-md)}
  .nh-nav a span:not(.nh-badge),.nh-nav button span:not(.nh-badge){letter-spacing:normal}
  .nh-nav a,.nh-nav button{flex-direction:row;justify-content:flex-start;gap:var(--nh-space-md);min-height:var(--nh-nav-desktop-height);padding:var(--nh-space-sm) var(--nh-space-md);font:var(--nh-font-nav-desktop);text-align:left}
  .nh-nav a[aria-current="page"]{font-weight:var(--nh-weight-semibold)}
  .nh-nav a:not([aria-current="page"]):hover{background:var(--nh-surface-hover);color:var(--nh-ink)}
  .nh-navutils{display:block;margin-top:var(--nh-space-sm);padding-top:var(--nh-space-sm);border-top:1px solid var(--nh-line)}
  .nh-navutils .nh-badge{margin-left:auto}
  .nh-railfoot{display:flex;flex-direction:column;align-items:flex-start;margin-top:auto;padding:var(--nh-space-lg) var(--nh-space-lg-xl);border-top:1px solid var(--nh-line);font:var(--nh-font-label-md-regular);color:var(--nh-muted)}
  .nh-railfoot :is(a,button){display:inline-flex;align-items:center;gap:var(--nh-space-sm);min-height:var(--nh-space-touch);padding:0;border:0;background:transparent;color:var(--nh-primary);font:var(--nh-font-body-md-strong);text-decoration:none}
  .nh-railfoot :is(a,button):hover{text-decoration:underline}
  .nh-railfoot svg{width:var(--nh-icon-md);height:var(--nh-icon-md)}
  .nh-railfoot p{margin-top:var(--nh-space-sm)}
  .nh-main{padding:var(--nh-space-gutter-desktop) var(--nh-space-gutter-desktop) var(--nh-space-3xl)}
  .nh-mainfoot{display:none}
}


/* Unread notices keep their count and a visible state at every navigation size. */
.nh .nh-topbtns a[data-nh-unread="true"],.nh .nh-navutils a[data-nh-unread="true"],.nh .nh-sheetlist a[data-nh-unread="true"]{background:var(--nh-warn-bg);color:var(--nh-warn)}
.nh a[data-nh-unread="true"] .nh-badge{background:var(--nh-warn);color:var(--nh-on-primary)}