/* ============ NORDLYS (scoped) ============ */
.nordlys-wrap{
  --bg:#0d1117; --card:#161b22; --txt:#e8eef5; --sub:#a9bacb;
  --ok:#19e179; --warn:#ffb100; --bad:#ff6767;
  --chip:#263041; --chip-txt:#e1ecf7; --amber:#ffb100;
  --gap:12px; --right-min:320px;
  color:var(--txt); background:var(--bg); padding:6px; line-height:1.45;
  max-width:1060px; margin:0 auto; border:1px solid #233046; border-radius:14px; overflow:hidden;
}
.nordlys-wrap *, .nordlys-wrap *::before, .nordlys-wrap *::after{ box-sizing:border-box; }

/* Cards */
.nordlys-wrap .card{ background:var(--card); border:1px solid #233046; border-radius:12px; padding:10px; position:relative; overflow:hidden; }
.nordlys-wrap .translucent{ background:rgba(22,27,34,.38); border-color:rgba(61,83,118,.55); }

/* ---------- HERO ---------- */
.nordlys-wrap .nordlys-hero{ display:grid; grid-template-columns:1fr; gap:var(--gap); margin-bottom:6px; }
@media (min-width:640px){
  .nordlys-wrap .nordlys-hero{
    grid-template-columns:minmax(0,60%) minmax(var(--right-min),40%);
    align-items:stretch; margin-bottom:4px;
  }
}

/* LEFT column container (wraps the two small cards) */
.nordlys-wrap .hero-container{ position:relative; isolation:isolate; width:100%; }
@media (min-width:640px){ .nordlys-wrap .hero-container{ align-self:stretch; height:100%; } }
.nordlys-wrap .hero-container::before{
  content:""; position:absolute; inset:0; z-index:0; pointer-events:none;
  background:
    radial-gradient(120% 140% at 15% 95%, rgba(46,28,68,.34) 0%, rgba(46,28,68,0) 60%),
    radial-gradient(110% 120% at 95% 10%, rgba(11,48,40,.36) 0%, rgba(11,48,40,0) 62%),
    linear-gradient(180deg, rgba(13,17,23,0) 0%, rgba(13,17,23,.28) 100%);
}

/* Two cards inside LEFT column */
.nordlys-wrap .inner-flex{ position:relative; z-index:1; display:grid; gap:10px; grid-template-columns:1fr; }
@media (min-width:640px){
  .nordlys-wrap .inner-flex{ grid-template-columns:1fr 1fr; height:100%; align-items:stretch; align-content:center; justify-content:stretch; }
}
.nordlys-wrap .inner-flex > .card{ display:flex; flex-direction:column; }

/* RIGHT column (webcam) */
.nordlys-wrap .hero-right{ width:100%; }
.nordlys-wrap .webcam-card{ padding:8px; }
.nordlys-wrap .webcam-img{ display:block; width:100%; aspect-ratio:3/2; object-fit:cover; border-radius:8px; }
.nordlys-wrap .webcam-cap{ margin-top:6px; font-size:.8rem; color:#c1d0e0; opacity:.82; display:flex; align-items:center; justify-content:space-between; gap:8px; }

/* Info card */
.nordlys-wrap .center{ text-align:center; }
.nordlys-wrap .hero-title{ margin:0 0 6px; font-size:1.18rem; font-weight:800; letter-spacing:.2px; }

/* Badges */
.nordlys-wrap .badge-col{ display:grid; grid-template-columns:1fr; gap:6px; margin-top:2px; }
.nordlys-wrap .badge{
  display:inline-flex; align-items:center; justify-content:center; background:var(--chip);
  border:1px solid #324058; border-radius:999px; padding:3px 10px; font-size:.82rem; min-height:26px;
  width:max(220px,60%); max-width:100%; white-space:nowrap; overflow:hidden; text-overflow:ellipsis;
  color:var(--chip-txt); margin:0 auto;
}
.nordlys-wrap .badge.ok{ border-color:var(--ok); color:var(--ok); }
.nordlys-wrap .badge.warn{ border-color:var(--warn); color:var(--warn); }
.nordlys-wrap .badge.bad{ border-color:var(--bad); color:var(--bad); }

/* Updated pill */
.nordlys-wrap .hero-updated{ margin-top:8px; font-size:.8rem; color:#c1d0e0; display:flex; align-items:center; gap:8px; justify-content:center; }
.nordlys-wrap .stale-dot{ display:none; width:8px; height:8px; border-radius:50%; background:var(--amber);
  box-shadow:0 0 0 3px rgba(255,177,0,.18),0 0 8px rgba(255,177,0,.5); }
.nordlys-wrap .stale-dot.show{ display:inline-block; }

/* K-index card */
.nordlys-wrap .kp-card{ text-align:center; }
.nordlys-wrap .kp-title{ margin:0 0 6px; font-size:.96rem; font-weight:800; color:#d7e9ff; }
.nordlys-wrap .kp-value{ font-size:1.9rem; font-weight:900; line-height:1; margin-bottom:6px; }
.nordlys-wrap .kp-scale{ padding-inline:6px; }
.nordlys-wrap .kp-scale .kp-bar{ height:8px; border-radius:999px; background:#1f2736; overflow:hidden; border:1px solid #2b3549; }
.nordlys-wrap .kp-scale .kp-fill{ height:100%; background:linear-gradient(90deg,#18c06a,#a3c938 40%,#f2b824 70%,#e66a5e 100%); }
.nordlys-wrap .kp-legend{ display:flex; justify-content:space-between; gap:8px; padding-inline:2px; font-size:.74rem; color:#a9bacb; margin-top:3px; }
.nordlys-wrap .kp-hint{ margin-top:6px; font-size:.84rem; color:#cfe0f1; text-align:center; }
.nordlys-wrap .kp-divider{ height:1px; background:#2b3549; border-radius:1px; margin:8px 0; opacity:.9; }
.nordlys-wrap .hero-score.center{ display:flex; flex-direction:column; align-items:center; gap:0; }
.nordlys-wrap .score-label{ font-size:.9rem; color:#a9bacb; line-height:1.2; }
.nordlys-wrap .score-value{ position:relative; font-size:2.0rem; font-weight:800; letter-spacing:.4px; }
.score-value.hot{ text-shadow:0 0 10px rgba(24,192,106,.35), 0 0 18px rgba(24,192,106,.25); }

/* ---------- MINI ROW (Clouds + Temp left, Global aktivitet right) ---------- */
.nordlys-wrap .mini-row{ display:grid; grid-template-columns:1fr; gap:8px; margin:0 0 12px; }
@media (min-width:640px){
  .nordlys-wrap .mini-row{ grid-template-columns:minmax(0,60%) minmax(var(--right-min),40%); }
}

/* Left split grid */
.nordlys-wrap .mini-left{ display:grid; grid-template-columns:1fr; gap:8px; }
@media (min-width:360px){ .nordlys-wrap .mini-left{ grid-template-columns:1fr 1fr; } }

.nordlys-wrap .mini-row > .card,
.nordlys-wrap .mini-left > .card{ padding:8px; display:flex; flex-direction:column; }

/* Clouds */
.nordlys-wrap .cloud-card .mini-title{ text-align:center; font-weight:800; margin:0 0 6px; white-space:normal; }
.nordlys-wrap .cloud-list{ list-style:none; margin:0; padding:0; display:flex; flex-direction:column; gap:6px; }
.nordlys-wrap .cloud-row{
  display:flex; align-items:center; justify-content:space-between; gap:10px;
  border:1px solid #1f2b3b; border-radius:12px; padding:8px 12px; background:rgba(22,27,34,.5);
}
.nordlys-wrap .cloud-row .t{ font-weight:800; min-width:56px; }
.nordlys-wrap .cloud-row .s{ font-weight:800; color:var(--ok); }
.nordlys-wrap .cloud-row .s.mid{ color:var(--warn); }
.nordlys-wrap .cloud-row .s.bad{ color:var(--bad); }

/* Temperature card */
.nordlys-wrap .temp-card .mini-title{ text-align:center; font-weight:800; margin:0 0 6px; white-space:normal; }
.nordlys-wrap .temp-list{ list-style:none; margin:0; padding:0; display:flex; flex-direction:column; gap:6px; }
.nordlys-wrap .temp-row{
  display:flex; align-items:center; justify-content:space-between; gap:10px;
  border:1px solid #1f2b3b; border-radius:12px; padding:8px 12px; background:rgba(22,27,34,.5);
}
.nordlys-wrap .temp-row .t{ font-weight:800; min-width:56px; }
.nordlys-wrap .temp-row .v{ font-weight:800; text-align:right; min-width:92px; display:flex; gap:8px; justify-content:flex-end; flex-wrap:wrap; }
.nordlys-wrap .temp-row .v .hi{ color:#ffcc66; font-weight:900; }
.nordlys-wrap .temp-row .v .lo{ color:#79c0ff; font-weight:900; }

/* Small-screen compaction */
@media (max-width:640px){
  .nordlys-wrap .cloud-row, .nordlys-wrap .temp-row{ padding:6px 10px; }
  .nordlys-wrap .temp-row .v{ min-width:72px; }
}

/* ===== Global aktivitet ===== */
.nordlys-wrap .ml-head{
  display:grid; grid-template-columns:1fr minmax(132px,25%);
  align-items:center; column-gap:8px; margin:0 0 6px;
}
.nordlys-wrap .ml-head h3{ grid-column:1; justify-self:center; margin:0; font-weight:800; }
.nordlys-wrap .ml-head .ml-upd-inline{ grid-column:2; justify-self:end; font-size:.82rem; color:var(--sub); white-space:nowrap; }
.nordlys-wrap .ml-head .ml-sub{ grid-column:1; justify-self:center; margin:2px 0 0; color:var(--sub); font-size:.9rem; }

.nordlys-wrap .ml-grid{ display:grid; grid-template-columns:1fr minmax(132px,25%); gap:8px; align-items:stretch; }
@media (max-width:360px){
  .nordlys-wrap .ml-head{ grid-template-columns:1fr auto; }
  .nordlys-wrap .ml-head .ml-upd-inline{ grid-column:2; }
  .nordlys-wrap .ml-grid{ grid-template-columns:1fr; }
}

.nordlys-wrap .ml-facts{ display:flex; flex-direction:column; align-items:center; }
.nordlys-wrap .ml-badges{ display:flex; flex-direction:column; align-items:center; gap:6px; width:100%; }
.nordlys-wrap .ml-badge{
  display:flex; align-items:center; justify-content:center;
  min-height:26px; padding:4px 10px; width:min(230px,92%);
  border-radius:999px; background:#202734; border:1px solid #2b3549;
  color:#dfeafb; font-weight:700; font-size:.9rem; text-align:center;
}
.nordlys-wrap .ml-badge.ok{    border-color:var(--ok); color:var(--ok); }
.nordlys-wrap .ml-badge.watch{ border-color:var(--warn); color:var(--warn); }
.nordlys-wrap .ml-badge.alert{ border-color:var(--bad); color:var(--bad); }

.nordlys-wrap .ml-box{
  display:flex; align-items:center; justify-content:center; text-align:center;
  padding:8px; border-radius:12px; border:2px solid transparent;
  font-weight:900; letter-spacing:.2px; font-size:1.05rem; min-height:0;
}
.nordlys-wrap .ml-box.ok    { background:rgba(25,225,121,.10); border-color:var(--ok); color:var(--ok); }
.nordlys-wrap .ml-box.watch { background:rgba(255,177,0,.16); border-color:var(--warn); color:var(--warn); }
.nordlys-wrap .ml-box.alert { background:rgba(255,103,103,.14); border-color:var(--bad); color:var(--bad); }

/* ---------- CHECKLIST ---------- */
.nordlys-wrap .section-title{ font-size:1.06rem; margin:10px 0 6px; font-weight:800; text-align:center; }
.nordlys-wrap .section-sub{ margin:0 0 10px; color:var(--sub); font-size:.9rem; text-align:right; }
.nordlys-wrap .legend-good{ color:var(--ok); font-weight:700; }
.nordlys-wrap .legend-bad{ color:var(--bad); font-weight:700; }

.nordlys-wrap .checklist{ list-style:none; margin:0; padding:0; display:grid; grid-template-columns:1fr; gap:8px; }
.nordlys-wrap .check-item{
  display:grid !important; grid-template-columns:28px 1fr 34px !important;
  align-items:center; gap:10px; background:var(--card); border:1px solid #222a36; border-radius:12px; padding:10px 12px;
}
.nordlys-wrap .check-icon{ width:28px; height:28px; display:grid; place-items:center; border-radius:999px; background:#243044; }
.nordlys-wrap .icon-svg{ fill:#d7e9ff; }
.nordlys-wrap .check-content{ min-width:0; }
.nordlys-wrap .check-title{ font-weight:800; white-space:nowrap; }
.nordlys-wrap .check-desc{ color:var(--sub); font-size:.86rem; margin-top:2px; }
.nordlys-wrap .check-state{ min-width:34px; text-align:right !important; justify-self:end !important; font-weight:900; }
.nordlys-wrap .check-state.ok{ color:var(--ok); }
.nordlys-wrap .check-state.bad{ color:var(--bad); }

/* K-aktivitet alignment */
.nordlys-wrap .k-activity-card{ display:grid; grid-template-columns:auto 1fr auto; gap:12px; align-items:center; }
.nordlys-wrap .ka-emoji{ width:28px; height:28px; display:grid; place-items:center; border-radius:999px; background:#243044; font-size:16px; }
.nordlys-wrap .ka-left{ display:flex; flex-direction:column; gap:4px; }
.nordlys-wrap .ka-title{ font-weight:800; }
.nordlys-wrap .ka-label{ font-size:.95rem; color:#e0edff; }
.nordlys-wrap .ka-sub{ font-size:.85rem; color:var(--sub); }
.nordlys-wrap .ka-state{ min-width:34px; text-align:right; font-weight:900; font-size:1.05rem; }
.nordlys-wrap .ka-state.ok{ color:var(--ok); }
.nordlys-wrap .ka-state.bad{ color:var(--bad); }

/* Screen-reader only */
.nordlys-wrap .sr{
  position:absolute!important;width:1px!important;height:1px!important;padding:0!important;margin:-1px!important;
  overflow:hidden!important;clip:rect(0,0,0,0)!important;white-space:nowrap!important;border:0!important;
}

/* ===== Info buttons & popovers ===== */

/* little circular “i” button in the top-left */
.nordlys-wrap .info-btn{
  position:absolute; top:6px; left:6px;
  width:22px; height:22px; border-radius:999px;
  display:grid; place-items:center;
  background:#1f6feb; color:#fff; border:1px solid #3a7eea;
  font:700 13px/1 system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  cursor:pointer; opacity:.96; transition:filter .15s ease, opacity .15s ease;
}
.nordlys-wrap .info-btn:hover{ filter:brightness(1.06); }
.nordlys-wrap .info-btn:active{ filter:brightness(0.96); }

/* Overlay (no blur). Keep it below the popover. */
.nordlys-wrap .info-overlay{
  position:fixed; inset:0;
  background:rgba(0,0,0,.45);
  z-index:2147483600;                      /* under popover */
  backdrop-filter:none !important;
  -webkit-backdrop-filter:none !important;
}

/* Popover panel: always fixed, guaranteed to be visible */
.nordlys-wrap .info-popover{
  position:fixed !important;
  z-index:2147483647 !important;           /* above everything */
  left:16px; top:16px;                     /* JS will reposition near the button */
  max-width:360px; width:min(92vw,360px);
  background:#0f1725 !important;           /* force a solid bg */
  border:1px solid #3a7eea !important;
  border-radius:12px;
  padding:12px;
  box-shadow:0 12px 28px rgba(0,0,0,.55), 0 0 0 1px rgba(58,126,234,.35) inset;
}
.nordlys-wrap .info-popover[hidden]{ display:none !important; }

.nordlys-wrap .info-popover h4{
  margin:0 0 8px; font-weight:800; font-size:.98rem; color:#e6f0ff;
  padding-bottom:6px; border-bottom:1px dashed #324058;
}
.nordlys-wrap .info-popover p{ margin:8px 0; color:#c8d7ea; font-size:.9rem; }
.nordlys-wrap .info-popover p strong{ color:#eaf3ff; }
.nordlys-wrap .info-popover ul{ margin:8px 0 8px 18px; padding:0; color:#d8e5f7; font-size:.9rem; }
.nordlys-wrap .info-popover li{ margin:4px 0; }
.nordlys-wrap .info-popover a{ color:#79c0ff; text-decoration:underline; }

/* Callout chips (colors inside popover) */
.nordlys-wrap .info-popover .info-chip{
  display:inline-block; padding:2px 8px; border-radius:999px; font-weight:700; font-size:.8rem; line-height:1;
  border:1px solid currentColor; vertical-align:baseline;
}
.nordlys-wrap .info-popover .chip-ok{
  color:var(--ok); background:rgba(25,225,121,.18); border-color:var(--ok);
}
.nordlys-wrap .info-popover .chip-warn{
  color:var(--warn); background:rgba(255,177,0,.18); border-color:var(--warn);
}
.nordlys-wrap .info-popover .chip-note{
  color:#79c0ff; background:rgba(121,192,255,.18); border-color:#79c0ff;
}

/* close button */
.nordlys-wrap .info-popover .info-close{
  position:absolute; top:6px; right:6px;
  width:24px; height:24px; border-radius:6px;
  background:transparent; border:0; color:#9fb3cc; cursor:pointer; font-size:16px;
}
.nordlys-wrap .info-popover .info-close:hover{ color:#cfe0f1; }

/* iPhone safe areas when docked at bottom */
@supports (padding: max(0px)){
  .nordlys-wrap .info-popover{ padding-bottom:max(12px, env(safe-area-inset-bottom)); }
}
.nordlys-wrap .info-popover{
  /* NEW: fit vertically on any phone, allow internal scroll */
  max-height: calc(
    100vh - max(16px, env(safe-area-inset-top)) - max(16px, env(safe-area-inset-bottom))
  ) !important;
  overflow: auto !important;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}

/* Landscape: allow a wider panel so it needs fewer lines (shorter height) */
@media (orientation: landscape){
  .nordlys-wrap .info-popover{
    max-width: 520px;
    width: min(94vw, 520px);
  }
}
/* Overlay (under popover, no blur) */
.nordlys-wrap .info-overlay{
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.45);
  z-index: 2147483600 !important; /* below popover */
  pointer-events: auto;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
}
.nordlys-wrap .info-overlay[hidden]{ display:none !important; }

/* Popover panel (always on top, viewport-fixed) */
.nordlys-wrap .info-popover{
  position: fixed !important;
  z-index: 2147483647 !important;          /* above everything */
  left: 16px; top: 16px;                    /* JS will reposition */
  max-width: 360px;
  width: min(92vw, 360px);
  background: #0f1725 !important;
  border: 1px solid #3a7eea !important;
  border-radius: 12px;
  padding: 12px;
  box-shadow: 0 12px 28px rgba(0,0,0,.55), 0 0 0 1px rgba(58,126,234,.35) inset;

  /* fit vertically on phones; internal scroll */
  max-height: calc(
    100vh - max(16px, env(safe-area-inset-top)) - max(16px, env(safe-area-inset-bottom))
  ) !important;
  overflow: auto !important;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}
@media (orientation: landscape){
  .nordlys-wrap .info-popover{
    max-width: 520px;
    width: min(94vw, 520px);
  }
}

