/* ── Design tokens — matchar internetport.se ─────────────────────────── */
:root {
  --primary:   #ffffff;
  --secondary: #1d1d1c;
  --accent:    #be1823;
  --accent-hover: #9c1821;
  --divider:   rgba(29,29,28,0.1);
  --surface:   #f6f6f6;
  --surface2:  #e7e7e7;
  --para:      #4f4f4f;
  --success:   #16a34a; --success-light: #f0fdf4;
  --omrade:    #d97706; --omrade-light:  #fffbeb;
  --warning:   #f97316; --warning-light: #fff7ed;
  --failure:   #dc2626; --failure-light: #fef2f2;
  --info:      #2563eb; --info-light:    #eff6ff;
  --shadow-sm: 0 2px 4px rgba(0,0,0,.08);
  --shadow-md: 0 6px 14px rgba(0,0,0,.10);
  --radius:    12px;
  --radius-sm: 8px;
}

/* ── Reset ───────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: 'IBM Plex Sans', system-ui, -apple-system, sans-serif;
  font-size: 15px;
  line-height: 1.6;
  color: var(--secondary);
  background: var(--primary);
  -webkit-font-smoothing: antialiased;
}

/* ── Layout ──────────────────────────────────────────────────────────── */
.container {
  max-width: 900px;
  margin: 0 auto;
  padding: 0 1.25rem;
}
.container-wide {
  max-width: 1120px;
  margin: 0 auto;
  padding: 0 1.25rem;
}

/* ── Site Header ─────────────────────────────────────────────────────── */
.site-header {
  border-bottom: 1px solid var(--divider);
  background: var(--primary);
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(8px);
}
.site-header-inner {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.85rem 1.25rem;
  max-width: 900px;
  margin: 0 auto;
}
.brand {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--secondary);
  text-decoration: none;
  letter-spacing: -0.02em;
}
.brand span { color: var(--accent); }
.brand-sub { font-weight: 400; color: var(--para); font-size: 0.9rem; }
.header-status-pill {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.8rem;
  font-weight: 600;
}
.header-actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 0.6rem;
}
.header-cta {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  background: var(--accent);
  color: #fff;
  padding: 0.5rem 0.85rem;
  border-radius: var(--radius-sm);
  text-decoration: none;
  font-size: 0.85rem;
  font-weight: 600;
  white-space: nowrap;
  line-height: 1;
}
.header-cta:hover { background: var(--accent-hover); }
.cta-short { display: none; }

/* ── Banner ──────────────────────────────────────────────────────────── */
.banner {
  padding: 2.5rem 1.25rem;
  text-align: center;
  margin: 1.5rem auto;
  max-width: 900px;
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
}
.banner h1 {
  margin: 0 0 0.35rem;
  font-size: 1.6rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}
.banner p {
  margin: 0;
  font-size: 0.9rem;
  opacity: 0.85;
}
.banner--drift    { background: var(--success); color: #fff; }
.banner--omrade   { background: var(--omrade);  color: #fff; }
.banner--storning { background: var(--warning); color: #fff; }
.banner--avbrott  { background: var(--failure); color: #fff; }
.banner--underhall{ background: var(--info);    color: #fff; }

/* ── Section headers ─────────────────────────────────────────────────── */
.section-title {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--para);
  margin: 2rem 0 0.75rem;
}

/* ── Network list ────────────────────────────────────────────────────── */
.netlist {
  list-style: none;
  padding: 0;
  margin: 0 0 1.5rem;
  border: 1px solid var(--divider);
  border-radius: var(--radius);
  overflow: hidden;
}
.netrow {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.7rem 1rem;
  border-bottom: 1px solid var(--divider);
  transition: background 0.12s;
}
.netrow:last-child { border-bottom: none; }
.netrow:hover { background: var(--surface); }
.netname { flex: 1; font-size: 0.9rem; font-weight: 500; }
.uptime {
  font-variant-numeric: tabular-nums;
  font-size: 0.8rem;
  color: var(--para);
}

/* ── Uptime bar (30-day) ─────────────────────────────────────────────── */
.uptime-bar-wrap {
  width: 60px;
  height: 8px;
  background: var(--surface2);
  border-radius: 999px;
  overflow: hidden;
  flex-shrink: 0;
}
.uptime-bar-fill {
  height: 100%;
  border-radius: 999px;
  background: var(--success);
  transition: width 0.4s ease;
}

/* ── Status pills ────────────────────────────────────────────────────── */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  padding: 0.2rem 0.65rem;
  border-radius: 999px;
  white-space: nowrap;
  color: #fff;
}
.pill::before {
  content: '';
  width: 6px; height: 6px;
  border-radius: 50%;
  background: rgba(255,255,255,0.7);
  flex-shrink: 0;
}
.pill--drift     { background: var(--success); }
.pill--omrade    { background: var(--omrade); }
.pill--storning  { background: var(--warning); }
.pill--avbrott   { background: var(--failure); }
.pill--underhall { background: var(--info); }

/* ── Incident cards ──────────────────────────────────────────────────── */
.incidents { margin-bottom: 2rem; }
.incident {
  border: 1px solid var(--divider);
  border-left: 4px solid var(--accent);
  border-radius: var(--radius-sm);
  padding: 1.1rem 1.2rem;
  margin-bottom: 0.75rem;
  box-shadow: var(--shadow-sm);
}
.incident--avbrott  { border-left-color: var(--failure); }
.incident--omrade   { border-left-color: var(--omrade); }
.incident--storning { border-left-color: var(--warning); }
.incident--underhall{ border-left-color: var(--info); }
.incident h3 {
  margin: 0 0 0.4rem;
  font-size: 1rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}
.incident__nets {
  font-size: 0.82rem;
  color: var(--para);
  margin: 0 0 0.4rem;
}
.incident__nets span::after { content: ' · '; }
.incident__nets span:last-child::after { content: ''; }
.timeline {
  list-style: none;
  padding: 0;
  margin: 0.6rem 0 0;
  border-top: 1px solid var(--divider);
  padding-top: 0.6rem;
}
.timeline li {
  font-size: 0.82rem;
  color: var(--para);
  padding: 0.2rem 0;
  display: flex;
  gap: 0.6rem;
}
.timeline time {
  color: var(--para);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
  flex-shrink: 0;
}

/* ── History section ─────────────────────────────────────────────────── */
.history {
  background: var(--surface);
  border-radius: var(--radius-sm);
  padding: 1rem 1.2rem;
  margin-bottom: 2rem;
}
.history ul {
  list-style: none;
  padding: 0;
  margin: 0;
}
.history li {
  font-size: 0.85rem;
  color: var(--para);
  padding: 0.3rem 0;
  border-bottom: 1px solid var(--divider);
  display: flex;
  gap: 0.5rem;
  align-items: center;
}
.history li:last-child { border-bottom: none; }

/* ── Site Footer ─────────────────────────────────────────────────────── */
.site-footer {
  border-top: 1px solid var(--divider);
  padding: 1.5rem 1.25rem;
  margin-top: 3rem;
  font-size: 0.8rem;
  color: var(--para);
}
.site-footer-inner {
  max-width: 900px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}
.site-footer a {
  color: var(--accent);
  text-decoration: none;
}
.site-footer a:hover { text-decoration: underline; }
.footer-logo {
  font-weight: 700;
  color: var(--secondary);
  font-size: 0.9rem;
}
.footer-logo span { color: var(--accent); }

/* ── Responsive ──────────────────────────────────────────────────────── */
@media (max-width: 600px) {
  .banner { padding: 1.8rem 1rem; border-radius: var(--radius-sm); }
  .banner h1 { font-size: 1.3rem; }
  .netrow { padding: 0.6rem 0.75rem; }
  .uptime-bar-wrap { display: none; }
  /* Header: kortare CTA-text, tightare layout på mobil */
  .site-header-inner { padding: 0.7rem 1rem; gap: 0.6rem; }
  .brand { font-size: 1rem; }
  .header-actions { gap: 0.5rem; }
  .header-cta { padding: 0.45rem 0.7rem; font-size: 0.8rem; }
  .cta-full { display: none; }
  .cta-short { display: inline; }
  .pnr-check, .sub-box { padding: 1.1rem 1rem; }
  .pnr-row, .sub-label, .sub-label input { max-width: 100%; }
  .banner { margin: 1rem auto; }
}
@media (max-width: 400px) {
  .brand-sub { display: none; }
  .header-cta .cta-short { display: none; }     /* visa bara klock-ikonen */
  .header-cta { padding: 0.45rem 0.6rem; }
}

/* ── Postnummer-koll ─────────────────────────────────────────────────── */
.pnr-check {
  background: var(--surface);
  border: 1px solid var(--divider);
  border-radius: var(--radius);
  padding: 1.25rem 1.5rem;
  margin: 0 0 1.5rem;
}
.pnr-check h2 { margin: 0 0 0.25rem; font-size: 1.05rem; }
.pnr-help { margin: 0 0 0.9rem; font-size: 0.88rem; color: var(--para); }
.pnr-row { display: flex; gap: 0.5rem; max-width: 380px; }
.pnr-row input {
  flex: 1; padding: 0.55rem 0.7rem;
  border: 1.5px solid var(--divider); border-radius: 8px;
  font: 16px/1.2 inherit; letter-spacing: 1px;
}
.pnr-row input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(190,24,35,.1); }
.pnr-row button {
  background: var(--accent); color: #fff; border: 0; border-radius: 8px;
  padding: 0.55rem 1.1rem; font: inherit; font-weight: 700; cursor: pointer;
}
.pnr-row button:hover { background: var(--accent-hover); }
#pnr-result { margin-top: 0.9rem; font-size: 0.92rem; }
.pnr-msg { padding: 0.7rem 0.9rem; border-radius: 8px; }
.pnr-msg.ok { background: var(--success-light); color: #15803d; }
.pnr-msg.avbrott { background: var(--failure-light); color: #b91c1c; }
.pnr-msg.omrade { background: var(--omrade-light); color: #b45309; }
.pnr-msg.planerat { background: var(--info-light); color: #1d4ed8; }
.pnr-msg .pnr-line { display: block; margin-top: 0.25rem; }

/* ── Postnr/ort autocomplete ─────────────────────────────────────────── */
.pnr-inputwrap { position: relative; flex: 1; }
.pnr-inputwrap input { width: 100%; }
.pnr-suggest {
  display: none; position: absolute; top: calc(100% + 4px); left: 0; right: 0;
  z-index: 20; margin: 0; padding: 4px; list-style: none;
  background: #fff; border: 1px solid var(--divider); border-radius: 8px;
  box-shadow: var(--shadow-md); max-height: 260px; overflow-y: auto;
}
.pnr-suggest.open { display: block; }
.pnr-suggest li {
  display: flex; align-items: center; gap: 0.5rem;
  padding: 0.5rem 0.6rem; border-radius: 6px; cursor: pointer; font-size: 0.92rem;
}
.pnr-suggest li:hover { background: var(--surface); }
.pnr-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.pnr-dot.avbrott { background: var(--failure); }
.pnr-dot.omrade { background: var(--omrade); }
.pnr-dot.planerat { background: var(--info); }
.pnr-dot.cleared { background: var(--success); }

/* ── Förklaring / legend ─────────────────────────────────────────────── */
.legend {
  background: var(--surface); border: 1px solid var(--divider);
  border-radius: var(--radius); padding: 0.5rem 1.25rem; margin: 0 0 1.5rem;
}
.legend > summary {
  cursor: pointer; font-weight: 600; font-size: 0.95rem; padding: 0.55rem 0;
  list-style: none; display: flex; align-items: center; gap: 0.4rem;
}
.legend > summary::-webkit-details-marker { display: none; }
.legend > summary::after { content: '▸'; margin-left: auto; color: var(--para); transition: transform 0.15s; }
.legend[open] > summary::after { transform: rotate(90deg); }
.legend__intro { font-size: 0.9rem; color: var(--para); margin: 0.2rem 0 0.9rem; }
.legend__item {
  display: flex; gap: 0.7rem; padding: 0.6rem 0; border-top: 1px solid var(--divider);
  font-size: 0.9rem;
}
.legend__dot { width: 14px; height: 14px; border-radius: 50%; flex-shrink: 0; margin-top: 0.2rem; }
.legend__dot--drift { background: var(--success); }
.legend__dot--omrade { background: var(--omrade); }
.legend__dot--storning { background: var(--warning); }
.legend__dot--avbrott { background: var(--failure); }
.legend__dot--underhall { background: var(--info); }
.legend__item strong { display: block; }
.legend__item span { color: var(--para); }

/* ── Prenumeration ───────────────────────────────────────────────────── */
.sub-box {
  background: var(--surface); border: 1px solid var(--divider);
  border-radius: var(--radius); padding: 1.25rem 1.5rem; margin: 0 0 1.5rem;
}
/* Dold som standard; fälls ut av header-CTA (JS) eller #prenumerera (no-JS) */
.sub-box.collapsed { display: none; }
#prenumerera { scroll-margin-top: 72px; }
#prenumerera:target { display: block; }
.sub-box h2 { margin: 0 0 0.25rem; font-size: 1.05rem; }
.sub-label { display: block; font-size: 0.82rem; font-weight: 600; color: var(--secondary); margin-bottom: 0.6rem; }
.sub-label input { display: block; width: 100%; max-width: 380px; margin-top: 0.25rem; padding: 0.55rem 0.7rem; border: 1.5px solid var(--divider); border-radius: 8px; font: 15px/1.2 inherit; }
.sub-label input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(190,24,35,.1); }
.sub-channels { display: flex; gap: 1.25rem; margin: 0.4rem 0 0.6rem; font-size: 0.92rem; }
.sub-channels label { display: flex; align-items: center; gap: 0.4rem; cursor: pointer; }
.btn-sub { background: var(--accent); color: #fff; border: 0; border-radius: 8px; padding: 0.55rem 1.3rem; font: inherit; font-weight: 700; cursor: pointer; }
.btn-sub:hover { background: var(--accent-hover); }
.btn-sub:disabled { opacity: .6; cursor: default; }
#sub-result { margin-top: 0.9rem; font-size: 0.92rem; }
