:root {
    --bg: #f8f9fa;
    --bg-card: #ffffff;
    --bg-muted: #f1f5f9;
    --text: #1a1a2e;
    --text-muted: #64748b;
    --text-faint: #94a3b8;
    --border: #e2e8f0;
    --border-strong: #cbd5e1;
    --primary: #2563eb;
    --primary-hover: #1d4ed8;
    --primary-light: #eff6ff;
    --primary-light-border: #93c5fd;
    --success-bg: #dcfce7;
    --success-text: #166534;
    --success-border: #86efac;
    --warn-bg: #fef9c3;
    --warn-text: #854d0e;
    --warn-border: #fde68a;
    --error-bg: #fee2e2;
    --error-text: #991b1b;
    --error-border: #fca5a5;
    --badge-bg: #dbeafe;
    --badge-text: #1e40af;
    --formula-bg: #f1f5f9;
    --header-bg: #1a1a2e;
    --header-text: #ffffff;
    --header-nav: #cccccc;
    --footer-bg: #1a1a2e;
    --footer-text: #aaaaaa;
    --footer-nl-bg: #1e293b;
    --shadow: 0 4px 12px rgba(0,0,0,0.1);
    --hero-header-gap: 1.75rem;
}

[data-theme="dark"] {
    --bg: #0f172a;
    --bg-card: #1e293b;
    --bg-muted: #1e293b;
    --text: #e2e8f0;
    --text-muted: #94a3b8;
    --text-faint: #64748b;
    --border: #334155;
    --border-strong: #475569;
    --primary: #60a5fa;
    --primary-hover: #93c5fd;
    --primary-light: #172554;
    --primary-light-border: #1d4ed8;
    --success-bg: #14532d;
    --success-text: #86efac;
    --success-border: #166534;
    --warn-bg: #422006;
    --warn-text: #fde68a;
    --warn-border: #92400e;
    --error-bg: #450a0a;
    --error-text: #fca5a5;
    --error-border: #7f1d1d;
    --badge-bg: #1e3a8a;
    --badge-text: #93c5fd;
    --formula-bg: #1e293b;
    --header-bg: #020617;
    --header-text: #f1f5f9;
    --header-nav: #94a3b8;
    --footer-bg: #020617;
    --footer-text: #64748b;
    --footer-nl-bg: #0f172a;
    --shadow: 0 4px 12px rgba(0,0,0,0.4);
}

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

/* Skip-to-content link for keyboard users */
.skip-link {
    position: absolute;
    top: -100%;
    left: 0;
    padding: 0.5rem 1rem;
    background: var(--primary);
    color: #fff;
    font-weight: 600;
    z-index: 9999;
    border-radius: 0 0 4px 0;
}
.skip-link:focus { top: 0; }

/* Visible keyboard focus indicator */
*:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    line-height: 1.6;
    color: var(--text);
    background: var(--bg);
    transition: background 0.2s, color 0.2s;
}

.container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 20px;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── Header ── */
.site-header {
    background: var(--header-bg);
    color: var(--header-text);
    padding: 1rem 0;
    position: sticky;
    top: 0;
    z-index: 100;
}

.site-header .container {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.logo {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--header-text) !important;
    flex-shrink: 0;
    text-decoration: none;
}
.logo:hover { text-decoration: none; }

.site-header nav {
    display: flex;
    gap: 1.2rem;
    align-items: center;
}

.site-header nav a {
    color: var(--header-nav);
    font-size: 0.95rem;
}
.site-header nav a:hover { color: var(--header-text); text-decoration: none; }

.search-form {
    display: flex;
    margin-left: auto;
    position: relative;
}

.search-form input {
    padding: 0.4rem 0.8rem;
    border: 1px solid var(--border);
    border-radius: 4px 0 0 4px;
    font-size: 0.9rem;
    width: 200px;
    background: var(--bg-card);
    color: var(--text);
}

.search-form button {
    padding: 0.4rem 0.8rem;
    border: none;
    background: #3b82f6;
    color: #fff;
    border-radius: 0 4px 4px 0;
    cursor: pointer;
}

/* Autocomplete dropdown */
.search-suggest {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 0 0 6px 6px;
    box-shadow: var(--shadow);
    z-index: 200;
    max-height: 300px;
    overflow-y: auto;
}
.search-suggest a {
    display: block;
    padding: 0.5rem 0.8rem;
    color: #1a1a2e;
    font-size: 0.9rem;
    border-bottom: 1px solid #f1f5f9;
}
.search-suggest a:hover { background: #eff6ff; text-decoration: none; }
.search-suggest a strong { color: var(--primary); }
.search-suggest-empty { padding: 0.5rem 0.8rem; color: #94a3b8; font-size: 0.85rem; }

/* Header actions (dark toggle + hamburger) */
.header-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-left: auto;
}

.btn-icon {
    background: none;
    border: none;
    color: var(--header-nav);
    cursor: pointer;
    padding: 0.3rem;
    border-radius: 4px;
    font-size: 1.2rem;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}
.btn-icon:hover { color: var(--header-text); }

.hamburger { display: none; flex-direction: column; gap: 5px; }
.hamburger span { display: block; width: 22px; height: 2px; background: var(--header-nav); border-radius: 2px; transition: 0.2s; }
.hamburger.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.hamburger.open span:nth-child(2) { opacity: 0; }
.hamburger.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* ── Reusable page hero (category, listing pages) ── */
.page-hero {
    position: relative;
    margin: var(--hero-header-gap) 0 2rem;
    padding: 2.6rem 2rem;
    border-radius: 16px;
    background: radial-gradient(circle at 25% 0%, #e6f0ff 0%, #f3f8ff 42%, #f8f9fc 78%);
    color: #0c1728;
    border: 1px solid rgba(37, 99, 235, .12);
    box-shadow: 0 18px 48px rgba(2, 32, 71, .08);
    overflow: hidden;
}
.page-hero::after {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
    opacity: .35;
    background: repeating-linear-gradient(90deg, transparent 0 22px, rgba(37, 99, 235, .08) 23px 35px, transparent 36px 50px);
    -webkit-mask-image: linear-gradient(90deg, transparent, #000 60%, transparent);
    mask-image: linear-gradient(90deg, transparent, #000 60%, transparent);
}
.page-hero > * { position: relative; z-index: 1; }
.page-hero h1 { color: #0c1728; font-size: clamp(28px, 5vw, 46px); margin: 0 0 .5rem; letter-spacing: -.02em; border: none; padding: 0; line-height: 1.1; }
.page-hero p { color: #475569; max-width: 680px; margin: 0; font-size: 1rem; line-height: 1.55; }
.page-hero-lead { font-size: 1.05rem; }
.page-hero a { color: #2563eb; }
.page-hero a:hover { color: #1d4ed8; }
.page-hero-kicker { font-size: .8rem; text-transform: uppercase; letter-spacing: .08em; color: #2563eb; margin: 0 0 .4rem; font-weight: 700; }
.page-hero-stats {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem 1.8rem;
    margin: 1.1rem 0 0;
    padding: 0;
}
.page-hero-stat { margin: 0; }
.page-hero-stat dt {
    margin: 0;
    font-size: .72rem;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: #2563eb;
    font-weight: 600;
}
.page-hero-stat dd {
    margin: .15rem 0 0;
    font-size: 1.45rem;
    font-weight: 800;
    color: #0c1728;
    line-height: 1.1;
}
.page-hero-perks { display: flex; flex-wrap: wrap; gap: .45rem 1.4rem; list-style: none; margin: .85rem 0 0; padding: 0; }
.page-hero-perks li { color: #334155; font-size: .88rem; }
.page-hero-perks li::before { content: "✓ "; color: #2563eb; font-weight: 700; }
.page-hero-actions { display: flex; flex-wrap: wrap; gap: .6rem; margin-top: 1.1rem; }
.page-hero-btn {
    display: inline-flex;
    align-items: center;
    padding: .65rem 1.15rem;
    border-radius: 10px;
    background: linear-gradient(180deg, #4ea9ff, #2776ed);
    color: #fff !important;
    font-weight: 700;
    text-decoration: none;
    box-shadow: 0 8px 22px rgba(39, 118, 237, .32);
    border: 0;
}
.page-hero-btn:hover { color: #fff !important; text-decoration: none; filter: brightness(1.06); }
.page-hero-btn-ghost {
    background: rgba(255, 255, 255, .85);
    border: 1px solid rgba(37, 99, 235, .2);
    box-shadow: none;
    color: #1d4ed8 !important;
}
.page-hero-btn-ghost:hover { background: #fff; color: #1d4ed8 !important; }
.hero-letter { color: #2563eb; }

@media (max-width: 560px) {
    :root { --hero-header-gap: 1.25rem; }
    .page-hero { padding: 1.8rem 1.3rem; }
    .page-hero-stat dd { font-size: 1.25rem; }
}

/* ── Body ── */
.hero { text-align: center; margin-top: var(--hero-header-gap); padding: 2.5rem 0 2rem; }
.hero h1 { font-size: 2.5rem; margin-bottom: 1rem; }
.hero .tagline { font-size: 1.15rem; color: var(--text-muted); max-width: 700px; margin: 0 auto; }

.categories-overview, .recent-articles { padding: 2rem 0; }

h2 {
    font-size: 1.5rem;
    margin-bottom: 1.5rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--border);
    color: var(--text);
}

.category-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 1rem;
}

.category-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    padding: 1.2rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    font-weight: 600;
    color: var(--text);
    transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}
.category-card::after { content: "→"; color: var(--primary); opacity: 0.45; transition: transform 0.18s ease, opacity 0.18s ease; }
.category-card:hover { box-shadow: var(--shadow); text-decoration: none; transform: translateY(-2px); border-color: var(--primary-light-border); }
.category-card:hover::after { opacity: 1; transform: translateX(3px); }

.term-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 1rem; }

.term-card {
    background: var(--bg-card);
    padding: 1.3rem;
    border: 1px solid var(--border);
    border-radius: 12px;
    color: var(--text);
    display: flex;
    flex-direction: column;
    text-decoration: none;
    transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}
.term-card:hover { transform: translateY(-3px); box-shadow: var(--shadow); border-color: var(--primary-light-border); text-decoration: none; }
.term-card h3 { margin-bottom: 0.5rem; font-size: 1.1rem; line-height: 1.3; color: var(--text); transition: color 0.15s; }
.term-card:hover h3 { color: var(--primary); }
.term-card h3 a { color: var(--text); }
.term-card h3 a:hover { color: var(--primary); text-decoration: none; }
.term-card > p { color: var(--text-muted); font-size: 0.92rem; }
.term-card .category-badge { align-self: flex-start; }

.category-badge {
    display: inline-block;
    font-size: 0.8rem;
    background: var(--badge-bg);
    color: var(--badge-text);
    padding: 0.15rem 0.5rem;
    border-radius: 4px;
    margin-bottom: 0.5rem;
}

/* ── Article page ── */
.finance-article {
    background: var(--bg-card);
    padding: 2rem;
    border-radius: 8px;
    margin: 2rem 0;
    border: 1px solid var(--border);
}

.breadcrumb { font-size: 0.9rem; color: var(--text-muted); margin-bottom: 1.5rem; }
.breadcrumb a { color: var(--primary); }

.finance-article h1 { font-size: 2rem; margin-bottom: 1rem; color: var(--text); }

.finance-article .article-content { font-size: 1rem; line-height: 1.65; }
.finance-article[data-font-size="0"] .article-content { font-size: 0.85rem; }
.finance-article[data-font-size="1"] .article-content { font-size: 0.925rem; }
.finance-article[data-font-size="2"] .article-content { font-size: 1rem; }
.finance-article[data-font-size="3"] .article-content { font-size: 1.125rem; }
.finance-article[data-font-size="4"] .article-content { font-size: 1.25rem; }
.finance-article .article-content h2 { font-size: 1.3em; margin-top: 2rem; margin-bottom: 0.8rem; border: none; padding: 0; color: var(--text); }
.finance-article .article-content h2:first-of-type { margin-top: 0; }
.finance-article .article-content h3 { font-size: 1.1em; margin: 1rem 0 0.5rem; color: var(--text); }
.finance-article .article-content .formula { font-size: 1.1em; }

.difficulty-badge {
    display: inline-block;
    font-size: 0.8rem;
    padding: 0.2rem 0.6rem;
    border-radius: 4px;
    margin-bottom: 1rem;
    font-weight: 500;
}
.difficulty-beginner { background: var(--success-bg); color: var(--success-text); }
.difficulty-intermediate { background: var(--warn-bg); color: var(--warn-text); }
.difficulty-advanced { background: var(--error-bg); color: var(--error-text); }

.short-definition, .key-takeaways, .article-body, .formula-section,
.example-section, .mistakes-section, .related-terms, .faq-section,
.sources, .source-notes { margin-bottom: 2rem; }

.finance-article h2 {
    font-size: 1.3rem; margin-top: 2rem; margin-bottom: 0.8rem; border: none; padding: 0; color: var(--text);
}
.finance-article h2:first-of-type { margin-top: 0; }
.finance-article h3 { font-size: 1.1rem; margin: 1rem 0 0.5rem; color: var(--text); }

.key-takeaways ul, .related-terms ul { list-style: disc; padding-left: 1.5rem; }
.key-takeaways li, .related-terms li { margin-bottom: 0.3rem; }
.related-group { margin-bottom: 1.2rem; }
.related-group-highlight {
    background: var(--primary-light, #eff6ff);
    border: 1px solid var(--primary-light-border, #bfdbfe);
    border-radius: 8px;
    padding: 0.8rem 1rem 0.4rem;
}
.related-group-highlight h2 { margin-top: 0; color: var(--primary, #2563eb); }

.formula {
    background: var(--formula-bg);
    padding: 1rem;
    border-radius: 6px;
    font-family: 'Courier New', monospace;
    font-size: 1.1rem;
    color: var(--text);
}

/* Formula calculator */
.formula-calc {
    background: var(--bg-muted);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 1rem 1.2rem;
    margin-top: 1rem;
}
.formula-calc h3 { font-size: 0.95rem; margin-bottom: 0.8rem; color: var(--text-muted); }
.calc-fields { display: flex; flex-wrap: wrap; gap: 0.8rem; align-items: flex-end; }
.calc-field { display: flex; flex-direction: column; gap: 0.2rem; }
.calc-field label { font-size: 0.8rem; color: var(--text-muted); }
.calc-field input { padding: 0.4rem 0.6rem; border: 1px solid var(--border); border-radius: 4px; width: 110px; font-size: 0.95rem; background: var(--bg-card); color: var(--text); }
.calc-result { margin-top: 0.8rem; font-size: 1.1rem; font-weight: 700; color: var(--primary); }
.calc-btn { padding: 0.4rem 1rem; background: var(--primary); color: #fff; border: none; border-radius: 4px; cursor: pointer; font-size: 0.9rem; }

.faq-item { margin-bottom: 1rem; padding-bottom: 1rem; border-bottom: 1px solid var(--border); }
.faq-item:last-child { border: none; }

/* Bookmark button */
.bookmark-btn {
    background: none;
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 0.3rem 0.7rem;
    cursor: pointer;
    font-size: 0.85rem;
    color: var(--text-muted);
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    transition: 0.15s;
}
.bookmark-btn:hover { border-color: var(--primary); color: var(--primary); }
.bookmark-btn.bookmarked { background: var(--primary-light); border-color: var(--primary-light-border); color: var(--primary); }

/* Difficulty / reading mode toggle */
.reading-mode-group {
    display: inline-flex;
    border: 1px solid var(--border);
    border-radius: 6px;
    overflow: hidden;
}
.reading-mode-toggle {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    border: none;
    border-right: 1px solid var(--border);
    border-radius: 0;
    font-size: 0.8rem;
    padding: 0.3rem 0.7rem;
    cursor: pointer;
    background: var(--bg-muted);
    color: var(--text-muted);
    transition: background 0.15s, color 0.15s;
}
.reading-mode-group .reading-mode-toggle:last-child { border-right: none; }
.reading-mode-toggle:hover { color: var(--primary); background: var(--bg-card); }
.reading-mode-toggle.is-active,
.reading-mode-toggle[aria-pressed="true"] { background: var(--primary-light); color: var(--primary); }

/* Relationship graph */
.term-graph-section { margin: 1.5rem 0; }
.term-graph-canvas { display: block; width: 100%; height: 280px; border: 1px solid var(--border); border-radius: 8px; background: var(--bg-muted); cursor: pointer; }

/* Search page */
.search-page-form { display: flex; gap: 0.5rem; margin-bottom: 2rem; }
.search-page-form input { flex: 1; padding: 0.6rem 1rem; border: 1px solid var(--border-strong); border-radius: 6px; font-size: 1rem; background: var(--bg-card); color: var(--text); }
.search-page-form button { padding: 0.6rem 1.5rem; background: var(--primary); color: #fff; border: none; border-radius: 6px; cursor: pointer; font-size: 1rem; }

/* ── Footer ── */
.site-footer {
    background: var(--footer-bg);
    color: var(--footer-text);
    padding: 2rem 0;
    margin-top: 3rem;
    text-align: center;
    font-size: 0.9rem;
}
.site-footer a { color: #93c5fd; }

.article-body ul { margin: 0.75rem 0; padding-left: 1.5rem; list-style: none; }
.article-body ul li { position: relative; padding: 0.3rem 0 0.3rem 1.5rem; line-height: 1.6; }
.article-body ul li::before { content: ""; position: absolute; left: 0; top: 0.65rem; width: 8px; height: 8px; background: var(--primary); border-radius: 2px; opacity: 0.6; }
.article-body ol { margin: 0.75rem 0; padding-left: 1.5rem; }
.article-body ol li { padding: 0.3rem 0; line-height: 1.6; }

/* Tables */
.finans-tabell { width: 100%; margin: 1.5rem 0; border-collapse: collapse; background: var(--bg-card); border: 1px solid var(--border); border-radius: 8px; overflow: hidden; font-size: 0.95rem; }
.finans-tabell thead { background: var(--bg-muted); }
.finans-tabell th { padding: 0.75rem 1rem; text-align: left; font-weight: 700; border-bottom: 2px solid var(--border); color: var(--text); font-size: 0.9rem; text-transform: uppercase; letter-spacing: 0.03em; }
.finans-tabell td { padding: 0.7rem 1rem; border-bottom: 1px solid var(--border); vertical-align: top; color: var(--text); }
.finans-tabell .cell-num { text-align: right; font-variant-numeric: tabular-nums; }
.finans-tabell tbody tr:last-child td { border-bottom: none; }
.finans-tabell tbody tr:hover { background: var(--bg-muted); }
.finans-tabell tbody tr:nth-child(even) { background: var(--bg-muted); }
.finans-tabell ul { margin: 0; padding-left: 1.2rem; }
.finans-tabell li { margin-bottom: 0; }

/* ===== Berikelse (enriched_json): grafer, tabeller, nøkkelfakta, callouts, formler, diagrammer ===== */
.enriched-section { margin: 2.5rem 0; }
.enriched-section > h2 { border-bottom: 2px solid var(--border); padding-bottom: 0.4rem; }
.enriched-section figure { margin: 1.5rem 0; }
.enriched-section figure > h3 { margin: 0 0 0.6rem; font-size: 1.05rem; }
.enriched-section figcaption { margin-top: 0.5rem; font-size: 0.85rem; color: var(--text-muted); font-style: italic; }

/* Diagram (Chart.js) – responsivt, tema-bevisst */
.enrich-chart .chart-container { position: relative; width: 100%; max-width: 720px; aspect-ratio: 16 / 10; margin: 0 auto; }
.enrich-chart .chart-container canvas { width: 100% !important; height: 100% !important; }
.enrich-chart .chart-data { margin-top: 0.75rem; font-size: 0.9rem; }
.enrich-chart .chart-data summary { cursor: pointer; color: var(--primary); font-weight: 600; }
.enrich-chart .chart-data .finans-tabell { margin-top: 0.6rem; }

/* Nøkkelfakta-kort */
.enrich-stat .stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 1rem; }
.stat-card { display: flex; flex-direction: column; gap: 0.2rem; padding: 1.1rem 1.2rem; background: var(--bg-card); border: 1px solid var(--border); border-radius: 10px; }
.stat-card .stat-value { font-size: 1.7rem; font-weight: 800; color: var(--text); line-height: 1.1; }
.stat-card .stat-unit { font-size: 0.9rem; font-weight: 600; color: var(--text-muted); margin-left: 0.25rem; }
.stat-card .stat-label { font-size: 0.85rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.03em; }
.stat-card .stat-delta { font-size: 0.85rem; font-weight: 600; color: var(--text-muted); }
.stat-card .stat-delta.trend-up { color: var(--green, #16a34a); }
.stat-card .stat-delta.trend-down { color: #dc2626; }
.stat-card .stat-note { font-size: 0.78rem; color: var(--text-faint); }

/* Callouts */
.enrich-callout { margin: 1.5rem 0; padding: 1rem 1.2rem; border: 1px solid var(--border); border-left-width: 4px; border-radius: 8px; background: var(--bg-card); }
.enrich-callout .callout-title { font-weight: 700; margin-bottom: 0.3rem; }
.enrich-callout .callout-body { color: var(--text); overflow-x: auto; }
.enrich-callout .callout-body .finans-tabell { margin: 0.75rem 0; }
.enrich-callout.callout-tip { border-left-color: #16a34a; }
.enrich-callout.callout-warning { border-left-color: #ea580c; }
.enrich-callout.callout-info { border-left-color: var(--primary); }
.enrich-callout.callout-example { border-left-color: #7c3aed; }

/* Formler (KaTeX) */
.enrich-formula { text-align: center; }
.enrich-formula .katex-target { overflow-x: auto; padding: 0.3rem 0; }
.enrich-formula .formula-explain { margin-top: 0.4rem; font-size: 0.9rem; color: var(--text-muted); text-align: left; }

/* Diagram / flyt – ren CSS/HTML, ingen JS */
.flow-steps { list-style: none; counter-reset: none; margin: 1.2rem 0; padding: 0; }
.flow-steps li { position: relative; display: flex; gap: 0.9rem; padding: 0 0 1.4rem 0; }
.flow-steps li:last-child { padding-bottom: 0; }
.flow-steps li::before { content: ""; position: absolute; left: 0.85rem; top: 1.8rem; bottom: 0; width: 2px; background: var(--border); }
.flow-steps li:last-child::before { display: none; }
.flow-steps .step-n { flex: 0 0 auto; width: 1.8rem; height: 1.8rem; border-radius: 50%; background: var(--primary); color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 0.9rem; z-index: 1; }
.flow-steps .step-body { display: flex; flex-direction: column; gap: 0.2rem; padding-top: 0.15rem; }
.flow-steps .step-label { font-weight: 600; color: var(--text); }
.flow-steps .step-detail { font-size: 0.9rem; color: var(--text-muted); }

/* Tool cards */
.tools-section { margin: 2rem 0; }
.tool-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 1rem; }
.tool-card { display: flex; flex-direction: column; padding: 1.2rem; background: var(--bg-card); border: 1px solid var(--border); border-radius: 10px; text-decoration: none; color: var(--text); transition: all 0.2s; }
.tool-card:hover { border-color: var(--primary); box-shadow: var(--shadow); transform: translateY(-2px); text-decoration: none; }
.tool-card strong { font-size: 1rem; margin-bottom: 0.3rem; }
.tool-card span { font-size: 0.8rem; color: var(--text-muted); }

/* Daily term */
.daily-term { margin: 2rem 0; }
.daily-term-card { background: linear-gradient(135deg, var(--primary-light), #dbeafe); border: 1px solid var(--primary-light-border); border-radius: 12px; padding: 1.5rem; position: relative; }
[data-theme="dark"] .daily-term-card { background: linear-gradient(135deg, #172554, #1e3a8a); }
.daily-term-card .category-badge { display: inline-block; font-size: 0.75rem; background: var(--primary); color: #fff; padding: 0.15rem 0.5rem; border-radius: 4px; margin-bottom: 0.5rem; }
.daily-term-card h3 { font-size: 1.4rem; margin-bottom: 0.5rem; color: var(--text); }
.daily-term-card p { color: var(--text-muted); margin-bottom: 0.8rem; }
.daily-term-card .read-more { color: var(--primary); font-weight: 600; }
.daily-term-card .read-more:hover { text-decoration: underline; }

/* Popular articles */
.popular-articles { margin: 2rem 0; }

/* Aliases */
.aliases-section { margin: 1.5rem 0; }
.aliases-section h2 { font-size: 1.05rem; color: var(--text-muted); }
.alias-list { list-style: none; margin: 0.5rem 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 0.4rem; }
.alias-item { display: inline-flex; align-items: baseline; gap: 0.35rem; background: var(--bg-muted); border: 1px solid var(--border); border-radius: 20px; padding: 0.2rem 0.75rem; font-size: 0.88rem; color: var(--text-muted); }
.alias-item .alias-text { color: var(--text-muted); }
.alias-item small { font-size: 0.65rem; color: var(--text-faint); text-transform: uppercase; }

/* Footer newsletter */
.footer-nl { margin: 1rem 0; padding: 0.8rem; background: var(--footer-nl-bg); border-radius: 8px; }
.footer-nl p { margin-bottom: 0.5rem; color: #e2e8f0; }
.footer-nl-form { display: flex; gap: 0.3rem; max-width: 350px; }
.footer-nl-form input { flex: 1; padding: 0.4rem 0.6rem; border: 1px solid #475569; border-radius: 4px; background: #0f172a; color: #e2e8f0; font-size: 0.85rem; }
.footer-nl-form button { padding: 0.4rem 0.8rem; background: var(--primary); color: #fff; border: none; border-radius: 4px; cursor: pointer; font-size: 0.8rem; }

/* Flashcards */
.fc-container { max-width: 760px; margin: 1.5rem auto; }
.fc-card, .fc-inner, .fc-front, .fc-back { min-height: 320px; }
.fc-topbar { display: flex; justify-content: space-between; align-items: center; gap: 0.5rem; flex-wrap: wrap; }
.fc-fullscreen-btn { display: inline-flex; align-items: center; gap: 0.35rem; padding: 0.35rem 0.8rem; border: 1px solid var(--border-strong); border-radius: 8px; background: var(--bg-card); color: var(--text-muted); font-size: 0.82rem; cursor: pointer; transition: 0.15s; }
.fc-fullscreen-btn:hover { border-color: var(--primary); color: var(--primary); }
/* Fullscreen-modus: sentrer og forstørr */
.fc-container:fullscreen { max-width: none; width: 100%; height: 100%; display: flex; flex-direction: column; justify-content: center; padding: 4vh 6vw; background: var(--bg); box-sizing: border-box; }
.fc-container:fullscreen .fc-stack { flex: 1; max-height: 60vh; display: flex; align-items: center; }
.fc-container:fullscreen .fc-card, .fc-container:fullscreen .fc-inner, .fc-container:fullscreen .fc-front, .fc-container:fullscreen .fc-back { min-height: 50vh; width: 100%; }
.fc-container:fullscreen .fc-term { font-size: 2.2rem; }
.fc-container:fullscreen .fc-definition { font-size: 1.3rem; }
.fc-progress { font-size: 0.9rem; color: var(--text-muted); margin-bottom: 1rem; }
.fc-stack { perspective: 1000px; min-height: 280px; margin-bottom: 1rem; }
.fc-card { width: 100%; min-height: 260px; cursor: pointer; display: none; }
.fc-card.active { display: block; }
.fc-card.flipped .fc-inner { transform: rotateY(180deg); }
.fc-card.done { opacity: 0.3; pointer-events: none; }
.fc-card.done .fc-inner { transform: rotateY(180deg); }
.fc-inner { position: relative; width: 100%; min-height: 260px; transition: transform 0.5s; transform-style: preserve-3d; }
.fc-front, .fc-back { position: absolute; top: 0; left: 0; width: 100%; min-height: 260px; backface-visibility: hidden; border-radius: 12px; padding: 1.5rem; box-sizing: border-box; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.fc-front { background: linear-gradient(135deg, var(--primary-light), #dbeafe); border: 2px solid var(--primary-light-border); }
.fc-back { background: var(--success-bg); border: 2px solid var(--success-border); transform: rotateY(180deg); }
[data-theme="dark"] .fc-front { background: linear-gradient(135deg, #172554, #1e3a8a); }
[data-theme="dark"] .fc-back { background: #14532d; }
.fc-badge { align-self: flex-start; font-size: 0.7rem; background: var(--primary); color: #fff; padding: 0.15rem 0.5rem; border-radius: 4px; margin-bottom: 1rem; }
.fc-term { font-size: 1.5rem; font-weight: 700; color: var(--text); text-align: center; margin-bottom: 1rem; }
.fc-hint { color: var(--text-faint); font-size: 0.8rem; }
.fc-definition { font-size: 1rem; color: var(--success-text); text-align: center; line-height: 1.5; }
.fc-takeaway { margin-top: 1rem; color: var(--success-text); }
.fc-actions { display: flex; gap: 0.5rem; justify-content: center; }
.fc-done { text-align: center; padding: 2rem; background: var(--success-bg); border: 2px solid var(--success-border); border-radius: 12px; color: var(--text); }
.fc-done h2 { font-size: 1.5rem; margin-bottom: 0.5rem; }

/* Buttons */
.btn { display: inline-block; padding: 0.6rem 1.5rem; border: none; border-radius: 6px; cursor: pointer; font-size: 0.95rem; text-decoration: none; text-align: center; background: var(--primary); color: #fff; }
.btn:hover { background: var(--primary-hover); text-decoration: none; }
.btn-gray { background: #6b7280; color: #fff; }
.btn-gray:hover { background: #4b5563; }

/* Alerts */
.alert { padding: 0.8rem; border-radius: 4px; margin-bottom: 1rem; }
.alert-success { background: var(--success-bg); color: var(--success-text); }
.alert-error { background: var(--error-bg); color: var(--error-text); }
.alert-info { background: var(--primary-light); color: var(--badge-text); }

/* Reading history chips */
.history-list { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 0.5rem; }
.history-chip { display: inline-block; padding: 0.25rem 0.7rem; background: var(--bg-muted); border: 1px solid var(--border); border-radius: 20px; font-size: 0.85rem; color: var(--text); text-decoration: none; }
.history-chip:hover { border-color: var(--primary); color: var(--primary); text-decoration: none; }

/* Embed promo */
.embed-promo { background: var(--bg-muted); border: 1px solid var(--border); border-radius: 8px; padding: 1rem; margin: 1.5rem 0; font-size: 0.85rem; }
.embed-promo code { background: var(--bg-card); border: 1px solid var(--border); border-radius: 4px; padding: 0.5rem; display: block; margin-top: 0.5rem; font-family: monospace; word-break: break-all; color: var(--text); }

/* ── Shared modern components (theme-aware) ── */
.card { background: var(--bg-card); border: 1px solid var(--border); border-radius: 12px; padding: 1.3rem; box-shadow: var(--shadow); color: var(--text); }
.card-muted { background: var(--bg-muted); border: 1px solid var(--border); border-radius: 12px; padding: 1.2rem; color: var(--text); }
.card-pad-lg { padding: 1.75rem; }

/* Section header with icon */
.section-head { display: flex; align-items: center; gap: 0.6rem; margin: 2.2rem 0 0.3rem; }
.section-head svg { width: 22px; height: 22px; color: var(--primary); flex: 0 0 auto; }
.section-head h2 { margin: 0; border: 0; padding: 0; font-size: 1.4rem; }
.section-intro { color: var(--text-muted); font-size: 0.95rem; margin: 0.1rem 0 1.2rem; }

/* Form kit */
.form-field { display: flex; flex-direction: column; gap: 0.35rem; margin-bottom: 1rem; }
.form-label { font-size: 0.85rem; font-weight: 600; color: var(--text-muted); }
.form-input,
.form-field input[type="text"], .form-field input[type="email"], .form-field input[type="search"],
.form-field input[type="password"], .form-field textarea, .form-field select {
    width: 100%; padding: 0.65rem 0.9rem; border: 1px solid var(--border-strong); border-radius: 8px;
    background: var(--bg-card); color: var(--text); font-size: 0.95rem; font-family: inherit;
    transition: border-color 0.15s, box-shadow 0.15s;
}
.form-input:focus,
.form-field input:focus, .form-field textarea:focus, .form-field select:focus {
    outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-light);
}
.form-hint { font-size: 0.8rem; color: var(--text-faint); }

/* Centered auth/standalone card (login, suggest, newsletter) */
.auth-card { max-width: 480px; margin: 2rem auto; }

/* Empty state */
.empty-state { text-align: center; padding: 2.5rem 1.5rem; background: var(--bg-muted); border: 1px dashed var(--border-strong); border-radius: 12px; color: var(--text-muted); }
.empty-state svg { width: 40px; height: 40px; color: var(--text-faint); margin-bottom: 0.6rem; }
.empty-state p { margin: 0.3rem 0; }

/* Badge variants */
.badge { display: inline-block; font-size: 0.72rem; padding: 0.15rem 0.55rem; border-radius: 6px; font-weight: 600; }
.badge-success { background: var(--success-bg); color: var(--success-text); }
.badge-error { background: var(--error-bg); color: var(--error-text); }
.badge-warn { background: var(--warn-bg); color: var(--warn-text); }
.badge-muted { background: var(--bg-muted); color: var(--text-muted); }
.badge-primary { background: var(--badge-bg); color: var(--badge-text); }

/* Stat tiles */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 1rem; }
.stat-tile { background: var(--bg-card); border: 1px solid var(--border); border-radius: 12px; padding: 1.1rem; text-align: center; box-shadow: var(--shadow); }
.stat-tile .stat-num { font-size: 1.7rem; font-weight: 800; color: var(--primary); line-height: 1.1; }
.stat-tile .stat-label { font-size: 0.8rem; color: var(--text-muted); }

/* ── Responsive ── */
@media (max-width: 768px) {
    .site-header .container { flex-wrap: nowrap; gap: 1rem; }
    .site-header nav { display: none; flex-direction: column; position: absolute; top: 100%; left: 0; right: 0; background: var(--header-bg); padding: 1rem; gap: 0.5rem; border-top: 1px solid rgba(255,255,255,0.1); }
    .site-header nav.open { display: flex; }
    .site-header nav a { font-size: 1rem; padding: 0.4rem 0; }
    .hamburger { display: flex; }
    .search-form { display: none; }
    .search-form.open { display: flex; position: absolute; top: 100%; left: 0; right: 0; background: var(--header-bg); padding: 0.5rem 1rem; border-top: 1px solid rgba(255,255,255,0.1); }
    .search-form.open input { flex: 1; width: 100%; }
    .hero h1 { font-size: 1.8rem; }
    .calc-fields { flex-direction: column; }
    .calc-field input { width: 100%; }
}
