/* --- Variabler og grunnstiler --- */
:root {
    --primary-color: #A41300; 
    --secondary-color: #f8f8f8; 
    --text-color: #333;
    --text-light: #ffffff;
    --header-bg: #fff;
    --footer-bg: #333;
    --link-hover-color: #7f0f00; 

    --font-primary: 'Open Sans', sans-serif;
    --container-width: 1100px;
    --header-height: 160px;
}

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

html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-primary);
    line-height: 1.6;
    color: var(--text-color);
    background-color: #fff;
}

.container {
    max-width: var(--container-width);
    margin: 0 auto;
    padding: 0 20px;
}

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

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

img {
    max-width: 100%;
    height: auto;
    display: block;
}

h1, h2, h3 {
    margin-bottom: 1rem;
}

/* --- Header --- */
.site-header {
    background-color: var(--header-bg);
    height: var(--header-height);
    min-height: 160px; /* Good practice: ensures minimum height */
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    position: static; /* Endret fra fixed til static */
    width: 100%;
    top: 0;
    z-index: 1000;
}

.site-header .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 100%;
}

.site-header .logo img {
    height: calc(var(--header-height) - 30px);
    width: auto;
}

.main-nav ul {
    list-style: none;
    display: flex;
}

.main-nav li {
    margin-left: 20px;
}

.main-nav a {
    color: var(--text-color);
    font-weight: bold;
    text-transform: uppercase;
    font-size: 0.9rem;
    padding: 10px 0;
    border-bottom: 2px solid transparent;
    transition: color 0.3s ease, border-color 0.3s ease;
}

.main-nav a:hover,
.main-nav a.active { /* Aktiv klasse legges til senere med JS */
    color: var(--primary-color);
    border-bottom-color: var(--primary-color);
    text-decoration: none;
}

.menu-toggle {
    display: none; /* Skjult på desktop */
    background: none;
    border: none;
    font-size: 2rem;
    cursor: pointer;
    color: var(--text-color);
}

/* --- Hovedinnhold og seksjoner --- */
main {
    padding-top: 0; /* Fjern offset for fast header */
}

.hero {
    background-image: url('assets/hero_5_red.png');
    background-size: cover;
    background-position: center center;
    background-repeat: no-repeat;
    padding: 8rem 0;
    text-align: center;
    color: var(--text-light); /* Endret til lys tekst for kontrast */
    position: relative; /* Nødvendig for overlay hvis lagt til */
    z-index: 1; /* Sikrer at tekst er over bakgrunn */
}

/* Valgfritt: Legg til et subtilt overlay for bedre tekstlesbarhet */
.hero::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.103);
    backdrop-filter: blur(3px);
    -webkit-backdrop-filter: blur(3px); /* For Safari-støtte */
    z-index: -1; /* Plasser overlay bak innhold */
}

.hero h1 {
    font-size: 3.2rem;
    margin-bottom: 0.5rem;
    text-shadow: 1px 1px 3px rgba(0,0,0,0.5);
}

.hero p {
    font-size: 1.3rem;
    margin-bottom: 2.5rem;
    text-shadow: 1px 1px 3px rgba(0,0,0,0.5);
}

.cta-button {
    background-color: var(--primary-color);
    color: var(--text-light);
    padding: 12px 25px;
    border-radius: 5px;
    font-weight: bold;
    text-transform: uppercase;
    transition: background-color 0.3s ease;
}

.cta-button:hover {
    background-color: var(--link-hover-color);
    color: var(--text-light);
    text-decoration: none;
}

.content-section {
    padding: 4rem 0;
    border-bottom: 1px solid #eee;
}

.content-section:last-of-type {
    border-bottom: none;
}

.aktuelt-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1em; /* Juster etter behov */
}

.archive-link {
    font-size: 1rem;
    color: var(--primary-color);
    text-decoration: none;
}

.archive-link:hover {
    text-decoration: underline;
}

/* --- Hurtiglenker-seksjon --- */
.quick-links {
    background-color: var(--secondary-color);
    padding: 3rem 0;
    border-bottom: 1px solid #eee;
}

.quick-links-grid {
    list-style: none;
    display: grid;
    grid-template-columns: repeat(4, 1fr); /* 4 kolonner på desktop */
    gap: 2rem;
    text-align: center;
}

.quick-links-grid li a {
    display: block;
    padding: 1.5rem 1rem;
    color: var(--text-color);
    background-color: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    text-decoration: none;
}

.quick-links-grid li a:hover {
    transform: translateY(-5px);
    box-shadow: 0 4px 10px rgba(0,0,0,0.15);
    color: var(--primary-color);
}

.quick-links-grid .icon {
    font-size: 2.5rem; /* Plassholder-stil */
    display: block;
    margin-bottom: 0.5rem;
    color: var(--primary-color);
    /* Bytt ut med faktiske ikoner senere (f.eks. Font Awesome) */
}

.quick-links-grid h3 {
    font-size: 1.1rem;
    margin-bottom: 0;
}

/* --- Fremhevet innhold-seksjon --- */
.featured-content {
    padding: 4rem 0;
    background-color: #fff;
}

.featured-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
}

.featured-card {
    background-color: #fff;
    border: 1px solid #eee;
    border-radius: 8px;
    overflow: hidden; /* Hold bildehjørner avrundede */
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    display: flex;
    flex-direction: column;
    transition: box-shadow 0.3s ease;
}

.featured-card:hover {
     box-shadow: 0 5px 15px rgba(0,0,0,0.12);
}

.featured-card img {
    width: 100%;
    height: 200px; /* Fast høyde for bilder */
    object-fit: cover; /* Dekker området, kan beskjære */
}

.featured-card .card-content {
    padding: 1.5rem;
    flex-grow: 1; /* La innhold vokse */
    display: flex;
    flex-direction: column;
}

.featured-card h4 {
    font-size: 1.3rem;
    margin-bottom: 0.5rem;
    color: var(--primary-color);
}

.featured-card p {
    margin-bottom: 1rem;
    flex-grow: 1; /* Dytt knapp nedover */
}

.featured-card .read-more {
    align-self: flex-start; /* Juster knapp til start */
    font-weight: bold;
    text-transform: uppercase;
    font-size: 0.85rem;
    color: var(--primary-color);
}

.featured-card .read-more:hover {
    text-decoration: underline;
}

/* --- Footer --- */
.site-footer {
    background-color: var(--footer-bg);
    color: var(--text-light);
    text-align: center;
    padding: 2rem 0;
    margin-top: 2rem;
}

.site-footer p {
    font-size: 0.9rem;
}


/* --- Responsivt design --- */
@media (max-width: 1024px) {
    .quick-links-grid {
        grid-template-columns: repeat(2, 1fr); /* 2 kolonner på tablet */
    }
}

@media (max-width: 768px) {
    .menu-toggle {
        display: block; /* Vis hamburger-ikon */
    }

    .quick-links-grid {
        grid-template-columns: 1fr; /* 1 kolonne på mobil */
        gap: 1.5rem;
    }

    .main-nav ul {
        display: none; /* Skjul meny som standard */
        flex-direction: column;
        position: absolute;
        top: var(--header-height);
        left: 0;
        width: 100%;
        background-color: var(--header-bg);
        box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
        padding: 1rem 0;
    }

    .main-nav ul.active { /* Klasse lagt til av JS */
        display: flex;
        z-index: 1001;
    }

    .main-nav li {
        margin: 0;
        text-align: center;
    }

    .main-nav a {
        display: block;
        padding: 1rem;
        border-bottom: 1px solid #eee; /* Skillelinje for mobil */
    }
     .main-nav a:hover,
     .main-nav a.active {
        border-bottom-color: var(--primary-color); /* Behold kant */
     }

    .hero h1 {
        font-size: 2.5rem; /* Justert for mobil */
    }
    .hero p {
        font-size: 1.1rem; /* Justert for mobil */
    }
}

/* --- Kontaktside-stiler --- */
.contact-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
    margin-top: 2rem;
}

.contact-card {
    background-color: var(--secondary-color);
    padding: 1.5rem;
    border-radius: 8px;
    border-left: 4px solid var(--primary-color);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.contact-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.contact-card h3 {
    color: var(--primary-color);
    margin-bottom: 1rem;
    font-size: 1.1rem;
}

.contact-card p {
    margin-bottom: 0;
    line-height: 1.5;
}

.contact-card a {
    font-weight: bold;
}

/* Responsive tilpasninger for kontaktkort */
@media (max-width: 768px) {
    .contact-grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
    
    .contact-card {
        padding: 1.25rem;
    }
}

/* --- Arkivside-stiler --- */
.archive-grid {
    margin-top: 2rem;
}

.archive-category {
    margin-bottom: 3rem;
}

.archive-category h3 {
    color: var(--primary-color);
    font-size: 1.5rem;
    margin-bottom: 1.5rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--primary-color);
}

.archive-item {
    background-color: #f9f9f9;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    transition: box-shadow 0.3s ease, transform 0.3s ease;
}

.archive-item:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    transform: translateY(-2px);
}

.archive-item h4 {
    margin-bottom: 1rem;
}

.archive-item h4 a {
    color: var(--text-color);
    font-size: 1.2rem;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.archive-item h4 a:hover {
    color: var(--primary-color);
    text-decoration: none;
}

.archive-item h4 a i {
    color: var(--primary-color);
    font-size: 1.1rem;
}

.archive-description {
    color: #666;
    line-height: 1.6;
    margin-bottom: 1rem;
}

.file-type {
    display: inline-block;
    background-color: var(--primary-color);
    color: white;
    padding: 0.25rem 0.75rem;
    border-radius: 15px;
    font-size: 0.85rem;
    font-weight: 500;
}

@media (max-width: 768px) {
    .archive-item {
        padding: 1rem;
        margin-bottom: 1rem;
    }

    .archive-item h4 a {
        font-size: 1.1rem;
    }

    .archive-category h3 {
        font-size: 1.3rem;
    }
}

/* --- Page Content (CMS Editable) --- */
.page-content {
    margin-top: 2rem;
    line-height: 1.8;
}

.page-content h3,
.page-content h4,
.page-content h5 {
    margin-top: 2rem;
    margin-bottom: 1rem;
    color: var(--primary-color);
}

.page-content p {
    margin-bottom: 1rem;
}

.page-content ul,
.page-content ol {
    margin-left: 2rem;
    margin-bottom: 1rem;
}

.page-content li {
    margin-bottom: 0.5rem;
}

.page-content img {
    max-width: 100%;
    height: auto;
    margin: 1.5rem 0;
    border-radius: 4px;
}

.page-content a {
    color: var(--primary-color);
    text-decoration: underline;
}

.page-content a:hover {
    color: var(--link-hover-color);
}

.page-content blockquote {
    border-left: 4px solid var(--primary-color);
    padding-left: 1.5rem;
    margin: 1.5rem 0;
    font-style: italic;
    color: #666;
}

.page-content code {
    background-color: var(--secondary-color);
    padding: 0.2rem 0.4rem;
    border-radius: 3px;
    font-family: monospace;
    font-size: 0.9em;
}

.page-content pre {
    background-color: var(--secondary-color);
    padding: 1rem;
    border-radius: 4px;
    overflow-x: auto;
    margin: 1rem 0;
}

.page-content pre code {
    background-color: transparent;
    padding: 0;
}

.page-content table {
    width: 100%;
    border-collapse: collapse;
    margin: 1.5rem 0;
}

.page-content table th,
.page-content table td {
    padding: 0.75rem;
    border: 1px solid #ddd;
    text-align: left;
}

.page-content table th {
    background-color: var(--primary-color);
    color: white;
    font-weight: bold;
}

.page-content table tr:nth-child(even) {
    background-color: var(--secondary-color);
}

/* --- Member Content Sections --- */
.member-news,
.document-category,
.member-list,
.reference-groups,
.archive-link-section {
    margin-bottom: 3rem;
    padding: 2rem;
    background-color: var(--secondary-color);
    border-radius: 8px;
    border-left: 4px solid var(--primary-color);
}

.member-news h3,
.document-category h3,
.member-list h3,
.reference-groups h3,
.archive-link-section h3 {
    color: var(--primary-color);
    margin-bottom: 1rem;
    font-size: 1.5rem;
}

.member-news h4 {
    color: var(--text-color);
    margin-top: 1.5rem;
    margin-bottom: 0.5rem;
}

/* News Items */
.news-item {
    margin-bottom: 2rem;
}

.news-item img {
    margin-top: 1rem;
    border-radius: 4px;
}

/* Document Lists */
.document-list {
    list-style: none;
    margin-top: 1rem;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1rem;
}

.document-list li {
    margin-bottom: 0;
}

.document-list a {
    display: flex;
    align-items: center;
    padding: 0.75rem 1rem;
    background-color: white;
    border-radius: 4px;
    transition: all 0.3s ease;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    width: 100%;
}

.document-list a:hover {
    background-color: #fff;
    box-shadow: 0 2px 8px rgba(164, 19, 0, 0.2);
    transform: translateY(-2px);
    text-decoration: none;
}

.document-list i {
    margin-right: 0.75rem;
    font-size: 1.2rem;
    color: var(--primary-color);
}

/* Button Styling */
.btn-primary {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    background-color: var(--primary-color);
    color: white;
    border-radius: 4px;
    font-weight: 600;
    transition: all 0.3s ease;
    text-decoration: none;
}

.btn-primary:hover {
    background-color: var(--link-hover-color);
    color: white;
    text-decoration: none;
    box-shadow: 0 4px 12px rgba(164, 19, 0, 0.3);
    transform: translateY(-2px);
}

.btn-primary i {
    font-size: 1rem;
}

/* Text utilities */
.text-muted {
    color: #6c757d;
    font-size: 0.9rem;
}

/* Reference Groups Grid */
.groups-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
    margin-top: 1.5rem;
}

.group-card {
    background-color: white;
    padding: 1.5rem;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.group-card h4 {
    color: var(--primary-color);
    margin-bottom: 0.75rem;
}

/* Responsive adjustments for member content */
@media (max-width: 768px) {
    .member-news,
    .document-category,
    .member-list,
    .reference-groups {
        padding: 1.5rem;
        margin-bottom: 2rem;
    }

    .document-list {
        grid-template-columns: 1fr;
    }

    .document-list a {
        padding: 0.5rem 0.75rem;
        font-size: 0.9rem;
    }

    .btn-primary {
        width: 100%;
        justify-content: center;
    }

    .groups-grid {
        grid-template-columns: 1fr;
    }
}

/* --- Medlemsblad / Newsletter grid --- */
.magazine-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 1.5em;
    margin-top: 2em;
}

.magazine-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-decoration: none;
    color: inherit;
    background: transparent;
    outline: none;
    border: none;
    transition: transform 0.15s ease;
}

.magazine-card:visited {
    color: inherit;
}

.magazine-card:hover {
    transform: translateY(-4px);
    text-decoration: none;
}

.magazine-card img {
    width: 100%;
    border: none;
    border-radius: 4px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
    transition: box-shadow 0.15s ease;
}

.magazine-card:hover img {
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2);
}

.magazine-label {
    margin-top: 0.5em;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-color);
    text-align: center;
}