/* ============================================================
   Wayscout — designsystem
   Tema: kartografi + bergrum. Djup skiffer, mässingsaccent,
   topografiska konturlinjer, koordinat-etiketter i monospace.
   ============================================================ */

:root {
  /* Färger */
  --bg:      #10161a;   /* djup skiffer, berg i skymning */
  --bg-2:    #151d22;
  --surface: #1a242a;   /* paneler/kort */
  --surface-2:#202c33;
  --line:    rgba(210, 198, 170, 0.12); /* hårfina linjer */
  --line-2:  rgba(210, 198, 170, 0.22);
  --ink:     #ece7da;   /* varm off-white, som gammalt kartpapper */
  --muted:   #8a9aa0;   /* kall grå */
  --brass:   #c8a24b;   /* mässing — primär accent */
  --brass-2: #e0be6a;
  --live:    #e5643e;   /* signalorange — LIVE/sändning */
  --ok:      #6fb3a6;   /* dämpad hav-teal */

  /* Typografi */
  --display: "Space Grotesk", system-ui, sans-serif;
  --serif:   "Fraunces", Georgia, serif;
  --mono:    "Space Mono", ui-monospace, monospace;

  /* Mått */
  --maxw: 1120px;
  --radius: 4px;        /* stram, nästan kartografisk */
  --gap: 24px;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--serif);
  font-size: 17px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* ---- Typografi ---- */
h1, h2, h3, h4 { font-family: var(--display); font-weight: 600; line-height: 1.12; letter-spacing: -0.01em; margin: 0 0 .5em; }
h1 { font-size: clamp(2.2rem, 5vw, 3.6rem); }
h2 { font-size: clamp(1.5rem, 3vw, 2.2rem); }
h3 { font-size: 1.2rem; }
p { margin: 0 0 1em; }
a { color: var(--brass-2); text-decoration: none; }
a:hover { color: var(--brass); }

/* Koordinat-/etikett-stil (signatur) */
.eyebrow {
  font-family: var(--mono);
  font-size: .72rem;
  letter-spacing: .22em;
  text-transform: uppercase;
  color: var(--brass);
  display: inline-flex;
  align-items: center;
  gap: .6em;
}
.eyebrow::before {
  content: "";
  width: 26px; height: 1px;
  background: var(--brass);
  display: inline-block;
}

.coord { font-family: var(--mono); color: var(--muted); font-size: .8rem; letter-spacing: .08em; }

/* ---- Layout ---- */
.wrap { max-width: var(--maxw); margin: 0 auto; padding: 0 24px; }
.section { padding: 72px 0; }
.grid { display: grid; gap: var(--gap); }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
@media (max-width: 820px) { .grid-2, .grid-3 { grid-template-columns: 1fr; } }

/* ---- Topbar ---- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  background: rgba(16,22,26,.82);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.topbar .wrap { display: flex; align-items: center; gap: 20px; height: 64px; }
.brand { font-family: var(--display); font-weight: 700; font-size: 1.15rem; letter-spacing: -.02em; color: var(--ink); display: flex; align-items: center; gap: 10px; }
.brand .mark { width: 18px; height: 18px; border: 1.5px solid var(--brass); border-radius: 50%; position: relative; }
.brand .mark::after { content: ""; position: absolute; inset: 4px; background: var(--brass); border-radius: 50%; }
.nav { margin-left: auto; display: flex; align-items: center; gap: 22px; }
.nav a { font-family: var(--display); font-size: .92rem; color: var(--muted); }
.nav a:hover { color: var(--ink); }

/* ---- Knappar ---- */
.btn {
  font-family: var(--display); font-weight: 600; font-size: .92rem;
  display: inline-flex; align-items: center; gap: .5em;
  padding: 11px 20px; border-radius: var(--radius);
  border: 1px solid var(--brass); color: var(--bg); background: var(--brass);
  cursor: pointer; transition: transform .08s ease, background .2s;
}
.btn:hover { background: var(--brass-2); color: var(--bg); transform: translateY(-1px); }
.btn.ghost { background: transparent; color: var(--ink); border-color: var(--line-2); }
.btn.ghost:hover { border-color: var(--brass); color: var(--brass); }
.btn.sm { padding: 7px 13px; font-size: .82rem; }
.btn.danger { background: transparent; border-color: rgba(229,100,62,.5); color: #f0a488; }
.btn.danger:hover { background: rgba(229,100,62,.12); color: #f0a488; }

/* ---- Kort ---- */
.card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 26px;
}
.card + .card { margin-top: 0; }
.card h3 { margin-bottom: .3em; }
.card .meta { color: var(--muted); font-size: .85rem; }

/* Kort med hörnmarkör (kart-/siktkorn-känsla) */
.card.pin { position: relative; }
.card.pin::before {
  content: ""; position: absolute; top: 12px; right: 12px;
  width: 10px; height: 10px;
  border-top: 1px solid var(--brass); border-right: 1px solid var(--brass);
}

/* ---- Badges ---- */
.badge {
  font-family: var(--mono); font-size: .68rem; letter-spacing: .12em; text-transform: uppercase;
  padding: 3px 9px; border-radius: 999px; border: 1px solid var(--line-2); color: var(--muted);
}
.badge.free { color: var(--ok); border-color: rgba(111,179,166,.4); }
.badge.subscriber { color: var(--brass); border-color: rgba(200,162,75,.4); }
.badge.premium { color: var(--brass-2); border-color: rgba(224,190,106,.5); background: rgba(224,190,106,.08); }
.badge.live { color: #fff; background: var(--live); border-color: var(--live); }
.badge.locked { color: var(--muted); }

/* LIVE-punkt som pulserar */
.dot-live { display:inline-block; width:8px; height:8px; border-radius:50%; background: var(--live); margin-right:6px; animation: pulse 1.4s infinite; }
@keyframes pulse { 0%{ box-shadow: 0 0 0 0 rgba(229,100,62,.6);} 70%{ box-shadow: 0 0 0 7px rgba(229,100,62,0);} 100%{ box-shadow: 0 0 0 0 rgba(229,100,62,0);} }

/* ---- Hero med topografiska konturlinjer ---- */
.hero { position: relative; overflow: hidden; padding: 100px 0 80px; }
.hero::before {
  /* koncentriska "konturlinjer" — topografi ur ett kartblad */
  content: ""; position: absolute; inset: -40% -10% auto auto;
  width: 900px; height: 900px; right: -300px; top: -300px;
  background:
    repeating-radial-gradient(circle at 50% 50%,
      transparent 0 26px, rgba(200,162,75,.10) 26px 27px);
  -webkit-mask-image: radial-gradient(circle at 50% 50%, #000 40%, transparent 72%);
          mask-image: radial-gradient(circle at 50% 50%, #000 40%, transparent 72%);
  pointer-events: none;
}
.hero .wrap { position: relative; z-index: 1; }
.hero p.lead { font-size: 1.2rem; color: var(--muted); max-width: 56ch; }
.hero .actions { display: flex; gap: 14px; margin-top: 28px; flex-wrap: wrap; }

/* ---- Formulär ---- */
label { display: block; font-family: var(--display); font-size: .85rem; color: var(--muted); margin: 14px 0 6px; }
input, textarea, select {
  width: 100%; font-family: var(--serif); font-size: 1rem;
  background: var(--bg-2); color: var(--ink);
  border: 1px solid var(--line-2); border-radius: var(--radius);
  padding: 11px 13px;
}
input:focus, textarea:focus, select:focus { outline: 2px solid var(--brass); outline-offset: 0; border-color: transparent; }
textarea { min-height: 90px; resize: vertical; }
.form-narrow { max-width: 420px; }

/* ---- Tabeller ---- */
table { width: 100%; border-collapse: collapse; font-size: .92rem; }
th, td { text-align: left; padding: 12px 10px; border-bottom: 1px solid var(--line); }
th { font-family: var(--display); font-size: .78rem; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); font-weight: 600; }
tr:hover td { background: rgba(255,255,255,.02); }

/* ---- Statistik-brickor ---- */
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; }
.stat .n { font-family: var(--display); font-size: 2.2rem; font-weight: 700; color: var(--ink); line-height: 1; }
.stat .k { font-family: var(--mono); font-size: .72rem; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); margin-top: 8px; }
.stat.accent .n { color: var(--brass); }

/* ---- Flash-meddelanden ---- */
.flash { padding: 12px 16px; border-radius: var(--radius); margin-bottom: 12px; border: 1px solid var(--line-2); font-size: .92rem; }
.flash.ok { border-color: rgba(111,179,166,.5); background: rgba(111,179,166,.1); }
.flash.warn { border-color: rgba(229,100,62,.5); background: rgba(229,100,62,.1); }

/* ---- Divider ---- */
.hr { height: 1px; background: var(--line); border: 0; margin: 0; }

/* ---- Footer ---- */
.footer { border-top: 1px solid var(--line); padding: 40px 0; color: var(--muted); font-size: .85rem; }
.footer .wrap { display: flex; justify-content: space-between; gap: 20px; flex-wrap: wrap; }

/* ---- Live-rum: video + sidopanel ---- */
.stage { display: grid; grid-template-columns: 1fr 340px; gap: 20px; align-items: start; }
@media (max-width: 900px) { .stage { grid-template-columns: 1fr; } }
.video-frame { background: #000; border: 1px solid var(--line-2); border-radius: var(--radius); overflow: hidden; aspect-ratio: 16/9; position: relative; }
.video-frame video { width: 100%; height: 100%; object-fit: cover; display: block; }
.video-frame .tag { position: absolute; top: 12px; left: 12px; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); display: flex; flex-direction: column; height: 520px; }
.panel .tabs { display: flex; border-bottom: 1px solid var(--line); }
.panel .tabs button { flex: 1; background: none; border: 0; color: var(--muted); font-family: var(--display); padding: 12px; cursor: pointer; }
.panel .tabs button.active { color: var(--brass); box-shadow: inset 0 -2px 0 var(--brass); }
.panel .messages { flex: 1; overflow-y: auto; padding: 14px; display: flex; flex-direction: column; gap: 10px; }
.msg { font-size: .9rem; }
.msg .who { font-family: var(--display); color: var(--brass); font-size: .82rem; }
.msg.q { border-left: 2px solid var(--live); padding-left: 8px; }
.panel .composer { display: flex; gap: 8px; padding: 12px; border-top: 1px solid var(--line); }
.panel .composer input { flex: 1; }

/* ============================================================
   KUND-TEMA — "kalla kriget" (bergrum / hemligstämplad akt)
   Atmosfäriskt och rufft: scanlines, sökljus, stencil, stämpel.
   Bara på kundvända sidor med <body class="cold">.
   Admin/backend lämnas rent och administrativt.
   ============================================================ */
.cold {
  background:
    /* fina scanlines — gammal monitor/film */
    linear-gradient(rgba(255,255,255,.015) 1px, transparent 1px) 0 0 / 100% 3px,
    var(--bg);
}

/* Dossier-remsa högst upp på kundsidan */
.dossier { position: relative; background: var(--bg-2); border-bottom: 1px solid var(--line-2); overflow: hidden; }
.dossier .wrap { position: relative; padding: 22px 24px; }
.dossier-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.dossier-sys { font-family: var(--mono); font-weight: 700; font-size: .8rem; letter-spacing: .18em; color: var(--brass); }
.dossier-status { font-family: var(--mono); font-size: .7rem; letter-spacing: .16em; color: var(--live); display: inline-flex; align-items: center; gap: 8px; }
.dossier-status .blip { width: 8px; height: 8px; border-radius: 50%; background: var(--live); box-shadow: 0 0 8px var(--live); animation: pulse 1.4s infinite; }
.dossier-coord { font-family: var(--mono); font-size: .72rem; letter-spacing: .14em; color: var(--muted); margin-top: 10px; }

/* "HEMLIGT"-stämpel, snedställd som på en akt */
.stamp {
  position: absolute; top: 52px; right: 34px;
  font-family: var(--mono); font-weight: 700; font-size: 1rem; letter-spacing: .1em;
  color: rgba(229,100,62,.7); border: 3px solid rgba(229,100,62,.5);
  padding: 3px 12px; border-radius: 3px; transform: rotate(9deg);
  opacity: .82; pointer-events: none;
}
@media (max-width: 640px) { .stamp { display: none; } }

/* Varningsrand (hazard) i botten av remsan */
.hazard {
  height: 8px;
  background: repeating-linear-gradient(45deg, #d9a441 0 14px, #16120a 14px 28px);
  opacity: .85;
}

/* Hero: kallt sökljus som sveper över berget */
.cold .hero::after {
  content: ""; position: absolute; inset: 0; pointer-events: none; z-index: 0;
  background: radial-gradient(120% 90% at 15% -10%, rgba(229,100,62,.10), transparent 55%);
}

/* Kort: rufft, hårda kanter, hörnvinkel i mässing */
.cold .card { border-radius: 2px; border-color: var(--line-2); background: linear-gradient(var(--surface), var(--bg-2)); }
.cold .eyebrow { color: var(--live); }
.cold .eyebrow::before { background: var(--live); }
.cold h1, .cold h2 { text-transform: uppercase; letter-spacing: .02em; }

/* Tillgänglighet: respektera reducerad rörelse */
@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}
