/* ============================================================
   SmartStandard – Design System  v2
   Hvit + #129d63 (grønn) + #b9f1d1 (mint)
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=IBM+Plex+Mono:wght@400;500;600&family=Fraunces:ital,opsz,wght@0,9..144,300;0,9..144,600;0,9..144,700;1,9..144,300;1,9..144,600&family=DM+Sans:wght@400;500;600&display=swap');

/* ── TOKENS ── */
:root {
  /* Tekst */
  --ink:        #111111;   /* 18:1 på hvit – AAA */
  --ink2:       #333333;   /* 12:1 på hvit – AAA */
  --ink3:       #555555;   /* 7:1 på hvit – AAA */

  /* Bakgrunn */
  --bg:         #ffffff;
  --bg-2:       #f2faf6;   /* Subtil grønn-tint – sidebar/panel */
  --bg-3:       #e8f7f0;   /* Lett mint – highlights */

  /* Kantlinjer */
  --rule:       #dce8e2;   /* Grønn-tint border */
  --rule-dark:  #c4d8cd;

  /* Primærfarge – grønn */
  --green:      #129d63;   /* 4.6:1 mot hvit – AA */
  --green-lt:   #16b874;
  --green-pale: #b9f1d1;   /* Lys mint */
  --green-dark: #0a6840;   /* 7:1 mot hvit – AAA, bruk på pale-bg */

  /* Sekundærfarge – amber (advarsler, sitat-tags) */
  --amber:      #b5621a;
  --amber-lt:   #e07a22;

  /* Overflate for mørke seksjoner */
  --surface-dark: #111111;

  --mono:  'IBM Plex Mono', monospace;
  --serif: 'Fraunces', Georgia, serif;
  --sans:  'DM Sans', sans-serif;

  --radius:    3px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --shadow-sm: 0 1px 4px rgba(0,0,0,0.06);
  --shadow-md: 0 4px 16px rgba(18,157,99,0.10);
}

/* ── RESET ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 16px; scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }

body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  line-height: 1.6;
  min-height: 100vh;
}

img, svg { display: block; max-width: 100%; }
a { color: inherit; }
button { font-family: inherit; cursor: pointer; }
textarea, input { font-family: inherit; }
ul, ol { list-style: none; }

/* ── FOKUS (WCAG 2.4.7 AA / 2.4.11 AAA) ── */
:focus-visible {
  outline: 2px solid #fff;
  outline-offset: 2px;
  box-shadow: 0 0 0 4px var(--green);
  border-radius: 2px;
}

/* ── TYPOGRAFI ── */
h1, h2, h3, h4 {
  font-family: var(--serif);
  line-height: 1.2;
  color: var(--ink);
}

/* ── BRAND ── */
.brand-name {
  font-family: var(--serif);
  font-weight: 700;
  font-size: 1.15rem;
  letter-spacing: -0.01em;
  text-decoration: none;
}

.brand-name span { color: var(--green-pale); }   /* Mint på mørk topbar */
.brand-name.on-light span { color: var(--green); } /* Grønn på hvit */

.brand-tag {
  font-family: var(--mono);
  font-size: 0.7rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.45);
  border: 1px solid rgba(255,255,255,0.2);
  padding: 2px 7px;
}

/* ── KNAPPER ── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  font-family: var(--mono);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  text-decoration: none;
  padding: 10px 20px;
  min-height: 44px;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
  white-space: nowrap;
  user-select: none;
}

.btn:active { opacity: 0.88; transform: scale(0.98); }

.btn-primary {
  background: var(--green);
  border-color: var(--green);
  color: #fff;
}
.btn-primary:hover { background: var(--green-lt); border-color: var(--green-lt); }

.btn-outline {
  background: transparent;
  border-color: var(--rule-dark);
  color: var(--ink2);
}
.btn-outline:hover { border-color: var(--green); color: var(--green); }

.btn-ghost {
  background: transparent;
  border-color: transparent;
  color: var(--ink3);
}
.btn-ghost:hover { color: var(--ink); }

.btn-lg { padding: 14px 28px; font-size: 0.78rem; }
.btn-sm { padding: 6px 14px; font-size: 0.7rem; min-height: 36px; }

/* ── BADGES ── */
.badge {
  display: inline-flex;
  align-items: center;
  font-family: var(--mono);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 3px 8px;
  border-radius: var(--radius);
  border: 1px solid transparent;
  white-space: nowrap;
}

/* Forskrift / TEK / grønn familie – bruker brand-fargene */
.badge-forskrift,
.badge-tek {
  background: var(--green-pale);
  color: var(--green-dark);
  border-color: rgba(18,157,99,0.3);
}

/* Veileder / amber */
.badge-veileder,
.badge-at {
  background: #fef3e8;
  color: #8a3d0a;
  border-color: #f0c090;
}

/* Standard (NS, NEK) – blå */
.badge-standard,
.badge-ns {
  background: #e8f0fb;
  color: #1a4a8a;
  border-color: #b8d0f5;
}

.badge-nek {
  background: #f5e8fb;
  color: #5a1a7a;
  border-color: #d5b0e8;
}

/* ── KILDEKORT ── */
.source-card {
  background: var(--bg);
  border: 1px solid var(--rule);
  border-radius: var(--radius-md);
  padding: 16px 20px;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.source-card:hover {
  border-color: var(--green);
  box-shadow: var(--shadow-md);
}

.source-card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}

.source-card-title {
  font-family: var(--serif);
  font-weight: 600;
  font-size: 0.95rem;
  line-height: 1.3;
  color: var(--ink);
}

.source-card-sub {
  font-family: var(--mono);
  font-size: 0.75rem;
  color: var(--ink3);
  margin-top: 4px;
}

.source-card-link {
  font-family: var(--mono);
  font-size: 0.75rem;
  color: var(--green);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-top: 10px;
}
.source-card-link:hover { text-decoration: underline; }

/* ── AI SVAR-BOKS (mørk – signaturen) ── */
.ai-answer {
  background: var(--surface-dark);
  border: 1px solid #222;
  border-left: 4px solid var(--green);   /* Grønn venstrekant */
  border-radius: var(--radius-md);
  overflow: hidden;
  margin-bottom: 24px;
}

.ai-answer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 20px;
  border-bottom: 1px solid #1e1e1e;
  gap: 12px;
}

.ai-label {
  font-family: var(--mono);
  font-size: 0.75rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--green-pale);   /* Mint på mørk */
}

.ai-meta {
  font-family: var(--mono);
  font-size: 0.75rem;
  color: #888;   /* 5.7:1 på mørk – AA */
}

.ai-answer-body {
  padding: 20px;
  color: #ddd;   /* 12:1 på mørk – AAA */
  font-size: 0.92rem;
  line-height: 1.75;
}

.ai-answer-body strong { color: #fff; font-weight: 600; }
.ai-answer-body em { font-style: italic; color: #ccc; }

.ai-answer-body ul {
  list-style: disc;
  padding-left: 1.5rem;
  margin: 8px 0;
}

.ai-answer-body ol {
  list-style: decimal;
  padding-left: 1.5rem;
  margin: 8px 0;
}

.ai-answer-body li { margin: 4px 0; }

/* Amber sitat-tag – holder amber for å skille fra grønn */
.ai-cite {
  display: inline;
  font-family: var(--mono);
  font-size: 0.75rem;
  color: var(--amber-lt);
  border: 1px solid rgba(181,98,26,0.4);
  background: rgba(181,98,26,0.12);
  border-radius: 2px;
  padding: 1px 6px;
  margin: 0 2px;
  white-space: nowrap;
}

/* ── VERDI-CHIP (fra kortene) ── */
.card-value {
  display: inline-block;
  font-family: var(--mono);
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--green-dark);
  background: var(--green-pale);
  border: 1px solid rgba(18,157,99,0.3);
  border-radius: var(--radius);
  padding: 5px 12px;
  margin-bottom: 12px;
}

/* ── TYPING ANIMASJON ── */
.typing-dots {
  display: flex;
  gap: 5px;
  align-items: center;
}

.typing-dot {
  width: 8px;
  height: 8px;
  background: var(--rule-dark);
  border-radius: 50%;
  animation: typingBounce 1.2s ease-in-out infinite;
}

.typing-dot:nth-child(2) { animation-delay: 0.2s; }
.typing-dot:nth-child(3) { animation-delay: 0.4s; }

@keyframes typingBounce {
  0%, 60%, 100% { transform: translateY(0); background: var(--rule-dark); }
  30%            { transform: translateY(-6px); background: var(--green); }
}

/* ── SKJEMA ── */
.search-input {
  width: 100%;
  border: none;
  outline: none;
  padding: 14px 18px;
  font-family: var(--sans);
  font-size: 1rem;
  color: var(--ink);
  background: transparent;
}

.search-input::placeholder { color: #999; font-style: italic; }

/* ── UTILITY ── */
.hidden { display: none !important; }
.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  white-space: nowrap;
  border: 0;
}
.text-mono  { font-family: var(--mono); }
.text-serif { font-family: var(--serif); }
.text-muted { color: var(--ink3); }
