:root {
    --bg: #0e0f12;
    --fg: #e7e9ee;
    --muted: #b9bec9;
    --accent: #74c0fc;
    --card: #171922;
    --card-border: #262a36;
    --success: #74d99f;
    --warning: #ffd166;
    --danger: #ff6b6b;
    --shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
    --radius: 12px;
    --radius-sm: 8px;
    --gap: 16px;
}
* {
    box-sizing: border-box;
}
html,
body {
    height: 100%;
}
body {
    margin: 0;
    font-family:
        system-ui,
        -apple-system,
        Segoe UI,
        Roboto,
        Inter,
        Arial,
        sans-serif;
    background:
        radial-gradient(
            1000px 600px at 10% -10%,
            rgba(116, 192, 252, 0.08),
            transparent
        ),
        radial-gradient(
            800px 500px at 90% -20%,
            rgba(255, 107, 107, 0.06),
            transparent
        ),
        var(--bg);
    color: var(--fg);
    line-height: 1.6;
}
.container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 32px 20px 64px;
}
header {
    margin-bottom: 28px;
    padding: 32px 24px;
    background: linear-gradient(
        180deg,
        rgba(23, 25, 34, 0.9),
        rgba(23, 25, 34, 0.7)
    );
    border: 1px solid var(--card-border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}
h1 {
    margin: 0 0 8px 0;
    font-size: clamp(28px, 5vw, 40px);
    letter-spacing: 0, 3px;
}
.subtitle {
    color: var(--muted);
    font-style: italic;
    margin: 0;
}
.toolbar {
    display: flex;
    gap: 10px;
    margin-top: 16px;
    flex-wrap: wrap;
}
.toolbar input {
    flex: 1;
    min-width: 220px;
    padding: 10px 12px;
    background: #10121a;
    border: 1px solid var(--card-border);
    color: var(--fg);
    border-radius: var(--radius-sm);
    outline: none;
}
.toolbar button,
.toolbar select {
    padding: 10px 12px;
    background: #10121a;
    border: 1px solid var(--card-border);
    color: var(--fg);
    border-radius: var(--radius-sm);
    cursor: pointer;
}

/* Layout med detaljpanel */
.layout {
    display: grid;
    grid-template-columns: 1fr;
    gap: 16px;
}
@media (min-width: 1000px) {
    .layout {
        grid-template-columns: 2fr 1fr;
        align-items: start;
    }
}

.modules {
    display: grid;
    grid-template-columns: 1fr;
    gap: 16px;
}
@media (min-width: 860px) {
    .modules {
        grid-template-columns: 1fr 1fr;
    }
}
.module {
    background: var(--card);
    border: 1px solid var(--card-border);
    border-radius: var(--radius);
    padding: 18px;
    box-shadow: var(--shadow);
}
.module header {
    background: transparent;
    border: none;
    box-shadow: none;
    padding: 0;
    margin: 0 0 10px 0;
}
.badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 12px;
    border: 1px solid var(--card-border);
    color: var(--muted);
}
.title-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}
.title-row h2 {
    margin: 0;
    font-size: 20px;
}
.section {
    margin-top: 12px;
    padding-top: 10px;
    border-top: 1px dashed #2b2f3c;
}
.section h3 {
    margin: 0 0 6px 0;
    font-size: 16px;
    color: var(--accent);
}
.section ul {
    margin: 0;
    padding-left: 18px;
}
.chips {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 8px;
}
.chip {
    font-size: 12px;
    padding: 4px 8px;
    background: #10121a;
    border: 1px solid var(--card-border);
    border-radius: 999px;
    color: var(--muted);
}
.actions {
    display: flex;
    gap: 8px;
    margin-top: 12px;
    flex-wrap: wrap;
}
.actions button,
.actions select {
    padding: 8px 10px;
    background: #10121a;
    border: 1px solid var(--card-border);
    color: var(--fg);
    border-radius: var(--radius-sm);
    cursor: pointer;
}
.hidden {
    display: none !important;
}

.detail {
    position: sticky;
    top: 20px;
    background: var(--card);
    border: 1px solid var(--card-border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 16px;
    min-height: 120px;
}
.detail-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    border-bottom: 1px dashed #2b2f3c;
    padding-bottom: 8px;
    margin-bottom: 8px;
}
.detail-content {
    max-height: 60vh;
    overflow: auto;
}
footer {
    margin-top: 28px;
    text-align: center;
    color: var(--muted);
}

/* Kort-oppsett (fra tidligere) */
.cards {
    display: grid;
    grid-template-columns: 1fr;
    gap: 14px;
}
@media (min-width: 640px) {
    .cards {
        grid-template-columns: 1fr 1fr;
    }
}
@media (min-width: 980px) {
    .cards {
        grid-template-columns: 1fr 1fr 1fr;
    }
}
.card {
    background: var(--card);
    border: 1px solid var(--card-border);
    border-radius: var(--radius);
    padding: 14px;
    box-shadow: var(--shadow);
    cursor: pointer;
    outline: none;
    transition:
        transform 120ms ease,
        border-color 120ms ease,
        background 120ms ease;
}
.card:hover,
.card:focus {
    transform: translateY(-2px);
    border-color: #2e3343;
    background: #181b26;
}
.card-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}
.card-title {
    margin: 0;
    font-size: 16px;
}

/* Fullskjerm-modal */
.modal {
    position: fixed;
    inset: 0;
    display: none;
    z-index: 1000;
}
.modal[aria-hidden="false"] {
    display: block;
}
.modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(2px);
}
.modal-dialog {
    position: relative;
    margin: 4vh auto;
    max-width: 980px;
    width: calc(100% - 32px);
    background: var(--card);
    border: 1px solid var(--card-border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 16px;
    max-height: 92vh;
    display: flex;
    flex-direction: column;
}
.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    border-bottom: 1px dashed #2b2f3c;
    padding-bottom: 8px;
    margin-bottom: 8px;
}
.modal-title {
    margin: 0;
}
.modal-tools {
    display: flex;
    gap: 8px;
    align-items: center;
}
.modal-tags {
    margin-bottom: 8px;
}
.modal-controls {
    display: flex;
    gap: 8px;
    align-items: center;
    margin-bottom: 8px;
}
.modal-content {
    overflow: auto;
    border: 1px solid var(--card-border);
    border-radius: var(--radius);
    padding: 12px;
    background: #10121a;
    flex: 1;
}
.btn {
    padding: 8px 12px;
    background: #10121a;
    border: 1px solid var(--card-border);
    color: var(--fg);
    border-radius: var(--radius-sm);
    cursor: pointer;
}

/* Skjermleser-hjelp */
.sr-only {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    border: 0 !important;
}

/* Seksjonstitler */
.section-title {
    margin: 8px 4px 8px;
    font-size: 16px;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.home-sections {
    display: grid;
    gap: 20px;
}

/* Reduser bevegelse for de som har satt preferanse */
@media (prefers-reduced-motion: reduce) {
    * {
        animation: none !important;
        transition: none !important;
        scroll-behavior: auto !important;
    }
}

/* =========================
   Kort-animasjoner
   ========================= */
.cards .card {
    transform: translateY(0);
    opacity: 0;
    animation: cardIn 320ms ease-out forwards;
}
.cards .card:nth-child(1) {
    animation-delay: 40ms;
}
.cards .card:nth-child(2) {
    animation-delay: 80ms;
}
.cards .card:nth-child(3) {
    animation-delay: 120ms;
}
.cards .card:nth-child(4) {
    animation-delay: 160ms;
}
.cards .card:nth-child(5) {
    animation-delay: 200ms;
}
.cards .card:nth-child(6) {
    animation-delay: 240ms;
}
@keyframes cardIn {
    from {
        opacity: 0;
        transform: translateY(6px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Finere hover/fokus på kort */
.card {
    transition:
        transform 160ms ease,
        border-color 160ms ease,
        background 160ms ease,
        box-shadow 160ms ease;
}
.card:hover,
.card:focus {
    transform: translateY(-3px);
    border-color: #2e3343;
    background: #181b26;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.35);
}

/* =========================
   Modal-animasjoner
   ========================= */
.modal {
    position: fixed;
    inset: 0;
    display: none;
    z-index: 1000;
}
.modal[aria-hidden="false"] {
    display: block;
}
.modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0);
    backdrop-filter: blur(0px);
    transition:
        background 220ms ease,
        backdrop-filter 220ms ease;
}
.modal[aria-hidden="false"] .modal-backdrop {
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(2px);
}

/* Dialog pop-in */
.modal-dialog {
    position: relative;
    margin: 4vh auto;
    max-width: 980px;
    width: calc(100% - 32px);
    background: var(--card);
    border: 1px solid var(--card-border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 16px;
    max-height: 92vh;
    display: flex;
    flex-direction: column;

    /* starttilstand for animasjon */
    opacity: 0;
    transform: translateY(8px) scale(0.98);
    transition:
        opacity 220ms ease,
        transform 220ms ease;
}
.modal--enter .modal-dialog {
    opacity: 1;
    transform: translateY(0) scale(1);
}

/* Lukk-animasjon (valgfri, via klasse) */
.modal--leave .modal-dialog {
    opacity: 0;
    transform: translateY(8px) scale(0.98);
}

/* =========================
   Innholdsovergang i modal
   ========================= */
.modal-content {
    overflow: auto;
    border: 1px solid var(--card-border);
    border-radius: var(--radius);
    padding: 12px;
    background: #10121a;
    flex: 1;
    opacity: 1;
    transition: opacity 160ms ease;
}
.modal-content.is-loading {
    opacity: 0.35;
}

/* Fin liten markering når underside skifter */
@keyframes contentFlash {
    from {
        box-shadow: 0 0 0 0 rgba(116, 192, 252, 0);
    }
    to {
        box-shadow: 0 0 0 4px rgba(116, 192, 252, 0.15);
    }
}
.modal-content.flash {
    animation: contentFlash 360ms ease-out 1;
}
