/* Karlmenn.is — hönnunarkerfi
   Dökkt, hlýtt, traust. Inter letur. Mobile-first. */

:root {
  --bg: #0F1117;
  --surface: #1A1F2E;
  --surface-2: #222838;
  --border: #2A3142;
  --accent: #F59E0B;
  --accent-hover: #FBBF24;
  --accent-soft: rgba(245, 158, 11, 0.12);
  --text: #F8F9FA;
  --muted: #9aa3b2;
  --muted-2: #6B7280;
  --success: #10B981;
  --danger: #EF4444;
  --radius: 14px;
  --radius-lg: 22px;
  --maxw: 1120px;
  --shadow: 0 18px 50px -20px rgba(0, 0, 0, 0.7);
  --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

a { color: inherit; text-decoration: none; }

img, svg { display: block; max-width: 100%; }

.container {
  width: 100%;
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 22px;
}

/* ---------- Typography ---------- */
h1, h2, h3 { line-height: 1.12; letter-spacing: -0.02em; margin: 0 0 0.4em; font-weight: 800; }
h1 { font-size: clamp(2.4rem, 7vw, 4.2rem); }
h2 { font-size: clamp(1.7rem, 4.5vw, 2.6rem); }
h3 { font-size: 1.25rem; font-weight: 700; }
p { margin: 0 0 1rem; color: var(--muted); }
.lead { font-size: clamp(1.05rem, 2.5vw, 1.3rem); color: var(--muted); max-width: 60ch; }
.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.18em;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--accent);
  margin-bottom: 0.8rem;
}
.accent { color: var(--accent); }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5em;
  padding: 0.85em 1.5em;
  border-radius: 999px;
  font-weight: 600;
  font-size: 0.98rem;
  border: 1px solid transparent;
  cursor: pointer;
  transition: transform 0.15s ease, background 0.2s ease, border-color 0.2s ease;
  white-space: nowrap;
}
.btn:hover { transform: translateY(-2px); }
.btn-primary { background: var(--accent); color: #1a1304; }
.btn-primary:hover { background: var(--accent-hover); }
.btn-ghost { background: transparent; color: var(--text); border-color: var(--border); }
.btn-ghost:hover { border-color: var(--accent); color: var(--accent); }
.btn-block { width: 100%; }
.btn-lg { padding: 1.05em 1.9em; font-size: 1.05rem; }

/* ---------- Header ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  backdrop-filter: blur(14px);
  background: rgba(15, 17, 23, 0.78);
  border-bottom: 1px solid var(--border);
}
.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 70px;
}
.brand { display: flex; align-items: center; gap: 0.6em; font-weight: 800; font-size: 1.15rem; letter-spacing: -0.02em; }
.brand .shield { width: 30px; height: 34px; }
.nav-links { display: flex; align-items: center; gap: 1.6rem; list-style: none; margin: 0; padding: 0; }
.nav-links a { color: var(--muted); font-size: 0.95rem; font-weight: 500; transition: color 0.15s; }
.nav-links a:hover, .nav-links a.active { color: var(--text); }
.nav-cta { display: flex; align-items: center; gap: 0.8rem; }
.nav-user { color: var(--muted); font-weight: 600; font-size: 0.92rem; }
@media (max-width: 860px) { .nav-user { display: none; } }
.nav-toggle { display: none; background: none; border: 0; color: var(--text); cursor: pointer; padding: 8px; }

@media (max-width: 860px) {
  .nav-links, .nav-cta .btn { display: none; }
  .nav-toggle { display: inline-flex; }
}

.mobile-menu {
  display: none;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  padding: 14px 0 22px;
}
.mobile-menu.open { display: block; }
.mobile-menu ul { list-style: none; margin: 0 0 14px; padding: 0; }
.mobile-menu a { display: block; padding: 12px 22px; color: var(--muted); font-weight: 500; border-radius: 10px; }
.mobile-menu a:hover { color: var(--text); background: var(--surface-2); }
.mobile-menu .container > .btn { margin-top: 6px; }

/* ---------- Hero ---------- */
.hero {
  position: relative;
  text-align: center;
  padding: clamp(56px, 12vw, 120px) 0 clamp(48px, 9vw, 96px);
  overflow: hidden;
}
.hero::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(60% 50% at 50% 0%, rgba(245, 158, 11, 0.16), transparent 70%),
    radial-gradient(50% 40% at 80% 30%, rgba(59, 130, 246, 0.08), transparent 70%);
  pointer-events: none;
}
.hero .container { position: relative; }
.hero .shield-lg { width: 84px; height: 96px; margin: 0 auto 26px; filter: drop-shadow(0 8px 24px rgba(245, 158, 11, 0.25)); }
.hero h1 { margin-bottom: 0.5rem; }
.hero .lead { margin: 0 auto 2rem; }
.hero-actions { display: flex; gap: 0.9rem; justify-content: center; flex-wrap: wrap; }

/* ---------- Sections ---------- */
section { padding: clamp(56px, 9vw, 92px) 0; }
.section-head { text-align: center; max-width: 62ch; margin: 0 auto clamp(32px, 5vw, 56px); }
.section-head p { margin: 0 auto; }
.bg-surface { background: var(--surface); }

/* ---------- Cards ---------- */
.grid { display: grid; gap: 22px; }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
@media (max-width: 860px) { .grid-3, .grid-2 { grid-template-columns: 1fr; } }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 30px 26px;
  transition: transform 0.18s ease, border-color 0.18s ease;
}
.bg-surface .card { background: var(--surface-2); }
.card:hover { transform: translateY(-4px); border-color: var(--accent); }
.card .icon {
  width: 52px; height: 52px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.6rem;
  border-radius: 14px;
  background: var(--accent-soft);
  margin-bottom: 18px;
}
.card h3 { margin-bottom: 0.4rem; }
.card p { margin: 0; font-size: 0.97rem; }

/* ---------- Steps ---------- */
.steps { counter-reset: step; }
.step .num {
  width: 46px; height: 46px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 800;
  font-size: 1.2rem;
  margin-bottom: 16px;
}

/* ---------- Donate / CTA band ---------- */
.cta-band {
  background: linear-gradient(135deg, var(--surface), var(--surface-2));
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: clamp(34px, 6vw, 60px);
  text-align: center;
}

/* ---------- Crisis ---------- */
.crisis { background: var(--surface); border-top: 1px solid var(--border); }
.crisis-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; margin-top: 28px; }
@media (max-width: 860px) { .crisis-grid { grid-template-columns: 1fr; } }
.crisis-item {
  border: 1px solid var(--border);
  border-left: 3px solid var(--danger);
  border-radius: var(--radius);
  padding: 20px 22px;
  background: var(--bg);
}
.crisis-item .num { font-size: 1.7rem; font-weight: 800; color: var(--text); }
.crisis-item .label { color: var(--muted); font-size: 0.95rem; }

/* ---------- Forum preview ---------- */
.thread {
  display: flex; gap: 16px; align-items: flex-start;
  padding: 18px 20px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  margin-bottom: 14px;
}
.thread .votes { text-align: center; color: var(--muted); min-width: 42px; }
.thread .votes b { display: block; color: var(--accent); font-size: 1.1rem; }
.thread h3 { font-size: 1.05rem; margin-bottom: 0.25rem; }
.thread .meta { font-size: 0.85rem; color: var(--muted-2); }
.tag {
  display: inline-block; font-size: 0.75rem; font-weight: 600;
  padding: 0.2em 0.7em; border-radius: 999px;
  background: var(--accent-soft); color: var(--accent);
  margin-bottom: 8px;
}

/* ---------- Forms ---------- */
.form { max-width: 560px; margin: 0 auto; }
.field { margin-bottom: 18px; text-align: left; }
.field label { display: block; font-weight: 600; font-size: 0.92rem; margin-bottom: 7px; }
.field input, .field textarea, .field select {
  width: 100%;
  padding: 0.85em 1em;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  color: var(--text);
  font: inherit;
  font-size: 0.97rem;
}
.field input:focus, .field textarea:focus, .field select:focus {
  outline: none; border-color: var(--accent);
}
.field textarea { min-height: 130px; resize: vertical; }
.note { font-size: 0.85rem; color: var(--muted-2); }

/* ---------- Donate toggle ---------- */
.amounts { display: flex; gap: 12px; flex-wrap: wrap; justify-content: center; margin: 22px 0; }
.amount {
  padding: 0.7em 1.3em; border-radius: 999px;
  border: 1px solid var(--border); background: var(--surface);
  color: var(--text); font-weight: 600; cursor: pointer; transition: all 0.15s;
}
.amount:hover, .amount.active { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }

/* ---------- Page hero (inner pages) ---------- */
.page-hero { padding: clamp(48px, 8vw, 80px) 0 clamp(24px, 4vw, 40px); text-align: center; }
.page-hero h1 { font-size: clamp(2rem, 6vw, 3.2rem); }

/* ---------- Prose ---------- */
.prose { max-width: 72ch; margin: 0 auto; }
.prose h2 { margin-top: 1.6em; }
.prose ul { color: var(--muted); padding-left: 1.2em; }
.prose li { margin-bottom: 0.5em; }
.prose a.accent { text-decoration: underline; text-underline-offset: 3px; }

/* ---------- Footer ---------- */
.site-footer { border-top: 1px solid var(--border); padding: 56px 0 40px; background: var(--bg); }
.footer-grid { display: flex; justify-content: space-between; gap: 40px; flex-wrap: wrap; margin-bottom: 36px; }
.footer-brand { max-width: 320px; }
.footer-brand p { font-size: 0.92rem; margin-top: 12px; }
.footer-col h4 { font-size: 0.82rem; text-transform: uppercase; letter-spacing: 0.12em; color: var(--muted-2); margin: 0 0 14px; }
.footer-col ul { list-style: none; margin: 0; padding: 0; }
.footer-col li { margin-bottom: 10px; }
.footer-col a { color: var(--muted); font-size: 0.93rem; }
.footer-col a:hover { color: var(--accent); }
.footer-bottom { border-top: 1px solid var(--border); padding-top: 24px; display: flex; justify-content: space-between; flex-wrap: wrap; gap: 12px; color: var(--muted-2); font-size: 0.86rem; }

/* ---------- Helpers ---------- */
.center { text-align: center; }
.mt-2 { margin-top: 2rem; }
.reveal { opacity: 0; transform: translateY(18px); transition: opacity 0.6s ease, transform 0.6s ease; }
.reveal.in { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) {
  .reveal { opacity: 1; transform: none; transition: none; }
  .btn:hover, .card:hover { transform: none; }
}

/* ---------- Admin bar (public pages, logged in) ---------- */
.admin-bar { background: #11151f; border-bottom: 1px solid var(--border); font-size: 0.86rem; }
.admin-bar .container { display: flex; align-items: center; gap: 18px; min-height: 42px; padding-top: 8px; padding-bottom: 8px; flex-wrap: wrap; }
.admin-bar > .container > span { color: var(--muted-2); font-weight: 700; }
.admin-bar a { color: var(--muted); font-weight: 600; }
.admin-bar a:hover, .admin-bar a.edit { color: var(--accent); }
.admin-bar .right { margin-left: auto; }

/* ---------- Flash ---------- */
.flash > .container { padding: 12px 22px; }
.flash-ok > .container { color: var(--success); background: rgba(16, 185, 129, 0.12); }
.flash-err > .container { color: var(--danger); background: rgba(239, 68, 68, 0.12); }

/* ---------- Forum (dynamic) ---------- */
.thread-link { transition: border-color 0.15s ease, transform 0.15s ease; }
.thread-link:hover { border-color: var(--accent); transform: translateY(-2px); }
.tag-pin { background: rgba(245, 158, 11, 0.2); }
.new-thread { margin-top: 28px; text-align: center; }
.new-thread > summary { display: inline-flex; list-style: none; cursor: pointer; }
.new-thread > summary::-webkit-details-marker { display: none; }
.new-thread[open] > summary { display: none; }
.new-thread .form { text-align: left; }

/* ---------- Stories ---------- */
.story { border: 1px solid var(--border); background: var(--surface); border-radius: var(--radius); padding: 20px 22px; margin-bottom: 16px; }
.story.story-op { background: var(--surface-2); border-left: 3px solid var(--accent); }
.story .meta { color: var(--muted-2); font-size: 0.85rem; margin-bottom: 8px; }
.story p:last-child { margin-bottom: 0; }

/* honeypot */
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; }

/* ---------- Forum: thread rows, star, categories, search ---------- */
.thread { align-items: center; }
.thread-main { flex: 1; min-width: 0; }
.thread-main a { display: block; }
.thread-main h3 { font-size: 1.05rem; margin: 0.15rem 0 0.25rem; }
.star-form { display: flex; align-items: center; }
.star {
  background: none; border: 0; color: var(--muted-2); cursor: pointer;
  font-size: 1.5rem; line-height: 1; padding: 4px 6px; transition: color 0.15s, transform 0.15s;
}
.star:hover { color: var(--accent); transform: scale(1.15); }
.star.on { color: var(--accent); }
.star-btn.on { border-color: var(--accent); color: var(--accent); }

.cat-card { display: block; }
.cat-card .cat-count { margin-top: 14px; color: var(--accent); font-weight: 600; font-size: 0.9rem; }

.forum-search { display: flex; gap: 10px; max-width: 560px; margin: 0 auto clamp(28px, 5vw, 44px); }
.forum-search input {
  flex: 1; padding: 0.8em 1.1em; background: var(--surface); border: 1px solid var(--border);
  border-radius: 999px; color: var(--text); font: inherit; font-size: 0.97rem;
}
.forum-search input:focus { outline: none; border-color: var(--accent); }
