/* ===================================== */
/* STYLING FÖR LASSES MATTEGREJOR (v14)  */
/* ===================================== */

/* --- Färgschema och typsnittsvariabler --- */
:root {
    --primary-color: #007bff; /* Blå */
    --secondary-color: #28a745; /* Grön */
    --tertiary-color: #ffc107; /* Gul (Används för GeoGebra) */
    --background-light: #f8f9fa;
    --text-dark: #343a40;
    --border-color: #dee2e6;
    
    /* Årskursfärger */
    --ak6-color: #6f42c1; /* Lila */
    --ak7-color: #007bff; /* Blå */
    --ak8-color: #dc3545; /* Röd */
    --ak9-color: #28a745; /* Grön */
}


/* --- Grundläggande Typografi & Layout --- */
* {
    box-sizing: border-box;
}

body {
    font-family: 'Roboto', sans-serif; 
    color: var(--text-dark);
    background-color: var(--background-light);
    margin: 0;
    padding: 0;
}

h1, h2, h3 {
    font-family: 'Love Ya Like A Sister', cursive; 
}

#main-content {
    max-width: 1200px;
    margin: 30px auto;
    padding: 0 20px;
}

a {
    text-decoration: none;
}


/* ===================================== */
/* 1. HEADER MED BAKGRUNDSBILD (Startsida) */
/* ===================================== */

#site-header {
    text-align: center;
    padding: 60px 20px 40px; 
    color: white; 
    
    /* KORRIGERAD: Tog bort det extra 'img.'-prefixet */
    background-image: url('img/matte_header_bg.jpg'); 
    background-size: cover; 
    background-position: center;
    position: relative;
    overflow: hidden;
}

/* OVERLAY: Mörk toning för att garantera läsbarhet */
#site-header::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5); 
    z-index: 1;
}

#site-header h1 {
    position: relative;
    z-index: 2;
    font-size: 55px; 
    margin: 0;
    padding-bottom: 10px;
    text-shadow: 2px 2px 5px rgba(0, 0, 0, 0.8); 
}

#site-header .general-info {
    position: relative;
    z-index: 2;
    color: #f8f9fa; 
    font-family: 'Varela Round', sans-serif;
    max-width: 700px;
    margin: 20px auto 0;
    font-size: 1.1rem;
}


/* ===================================== */
/* 2. ÅRSKURS-LÄNKAR MED MÖNSTER (Startsida) */
/* ===================================== */

.grade-links-container {
    display: flex;
    flex-wrap: wrap; 
    justify-content: center;
    gap: 30px; 
    padding: 20px 0;
}

.grade-link {
    display: block;
    width: 200px; 
    padding: 20px;
    border-radius: 12px;
    text-align: center;
    text-decoration: none;
    color: var(--text-dark); 
    background-color: white; 
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
    transition: transform 0.2s, box-shadow 0.2s;
    position: relative;
    overflow: hidden; 
}

.grade-link:hover {
    transform: translateY(-5px); 
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.2);
}

.grade-image-wrapper {
    position: relative;
    height: 100px; 
    margin-bottom: 10px;
}

.grade-pattern-img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover; 
    opacity: 0.2; 
    z-index: 1;
    transition: opacity 0.3s;
}

.grade-link:hover .grade-pattern-img {
    opacity: 0.35; 
}

.grade-link h2, .grade-link p, .grade-number {
    position: relative;
    z-index: 2; 
}

.grade-number {
    display: block;
    font-family: 'Love Ya Like A Sister', cursive;
    font-size: 4rem; 
    line-height: 100px; 
    font-weight: 700;
}

/* FÄRGKODNING AV SIFFRAN */
.ak6-color .grade-number { color: var(--ak6-color); }
.ak7-color .grade-number { color: var(--ak7-color); }
.ak8-color .grade-number { color: var(--ak8-color); }
.ak9-color .grade-number { color: var(--ak9-color); }


/* --- GeoGebra Snabblänk (Startsida) --- */

.geogebra-link-promo {
    display: flex;
    align-items: center;
    max-width: 500px;
    margin: 40px auto 20px;
    padding: 15px 20px;
    background-color: var(--tertiary-color);
    color: var(--text-dark);
    text-decoration: none;
    border-radius: 8px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    transition: background-color 0.2s;
}

.geogebra-link-promo:hover {
    background-color: #ffdb58; 
}

.geogebra-icon {
    font-size: 2.5rem;
    margin-right: 15px;
}

.geogebra-link-promo h3 {
    margin: 0;
    font-size: 1.3rem;
}

.geogebra-link-promo p {
    margin: 0;
    font-family: 'Roboto', sans-serif;
    font-size: 0.85rem;
    color: #6c757d;
}


/* ===================================== */
/* 3. NAVIGATION (HUVUDMENY FÖR UNDERSIDOR) */
/* ===================================== */

#main-nav {
    background-color: var(--text-dark); 
    width: 100%;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

#main-nav ul {
    list-style: none;
    padding: 0;
    margin: 0 auto;
    display: flex; 
    justify-content: center;
    max-width: 1200px;
}

#main-nav li {
    position: relative;
}

#main-nav li a {
    display: block;
    padding: 15px 20px;
    text-decoration: none;
    color: white;
    font-family: 'Varela Round', sans-serif; 
    transition: background-color 0.2s;
}

#main-nav li a:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

/* MARKERAR AKTIV SIDA */
#main-nav li.active > a {
    background-color: var(--primary-color); 
    font-weight: 700;
}

/* --- Dropdown-innehåll --- */

.dropdown-content {
    display: none; 
    position: absolute;
    top: 100%; 
    left: 0;
    background-color: #f9f9f9; 
    min-width: 250px;
    box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2);
    z-index: 1000; 
    border-top: 3px solid var(--primary-color); 
    border-radius: 0 0 5px 5px;
}

#main-nav li:hover > .dropdown-content {
    display: block;
}

.dropdown-content a {
    color: var(--text-dark);
    padding: 12px 16px;
    text-decoration: none;
    display: block;
    text-align: left;
    font-family: 'Roboto', sans-serif;
}

.dropdown-content a:hover {
    background-color: #e2e6ea; 
    color: var(--primary-color);
}

/* --- Subpage Header (Utan bild) --- */
.subpage-header {
    background-color: #e9ecef;
    padding: 20px;
    text-align: center;
    border-bottom: 3px solid var(--primary-color);
}

.subpage-header h1 {
    font-size: 2.5rem;
    margin: 10px 0;
}

.back-link {
    display: inline-block;
    margin-top: 10px;
    color: var(--primary-color);
    font-weight: 500;
    font-family: 'Roboto', sans-serif;
    transition: color 0.2s;
}

.back-link:hover {
    color: var(--text-dark);
}

/* ===================================== */
/* 4. MOBILRESPONSIVITET */
/* ===================================== */

@media (max-width: 800px) {
    
    /* Navigation: Vertikal meny */
    #main-nav ul {
        flex-direction: column; 
        align-items: center;
    }

    #main-nav li {
        width: 100%;
        text-align: center;
    }
    
    #main-nav li a {
        padding: 12px 0; 
    }

    .dropdown-content {
        position: relative; 
        width: 100%;
        min-width: auto;
        border-top: none; 
        border-radius: 0;
    }
}

@media (max-width: 576px) {
    /* Startsida: Länkar staplas */
    .grade-links-container {
        flex-direction: column;
        align-items: center;
    }
    .grade-link {
        width: 90%; 
    }
}

/* ===================================== */
/* 5. Footer (Stil från tidigare) */
/* ===================================== */

#site-footer {
    padding: 20px;
    text-align: center;
    background-color: #e9ecef;
    border-top: 1px solid #dee2e6;
    margin-top: 50px;
}

/* ===================================== */
/* 6. KAPITELRESURSER (ACCORDION) */
/* ===================================== */

.chapter-accordion-wrapper {
    margin-top: 40px;
    max-width: 900px;
    margin-left: auto;
    margin-right: auto;
}

.section-title {
    text-align: center;
    color: var(--primary-color);
    margin-bottom: 25px;
    font-size: 2.2rem;
}

.accordion-item {
    margin-bottom: 10px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    overflow: hidden; /* Snyggar till kanterna */
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.accordion-header {
    display: block;
    width: 100%;
    padding: 15px 25px;
    text-align: left;
    background-color: white;
    color: var(--text-dark);
    font-size: 1.1rem;
    font-family: 'Varela Round', sans-serif;
    font-weight: 500;
    cursor: pointer;
    border: none;
    transition: background-color 0.2s, color 0.2s;
    /* Lägg till en pil/ikon för att indikera att den är klickbar */
    position: relative;
}

/* Hover-effekt på rubriken */
.accordion-header:hover {
    background-color: #f1f1f1;
}

/* Stil för när knappen är expanderad (öppen) */
.accordion-header[aria-expanded="true"] {
    background-color: var(--primary-color); /* Blå bakgrund när den är öppen */
    color: white; /* Vit text när den är öppen */
    font-weight: 700;
}

/* Visuell pil/ikon (roterar när den är öppen) */
.accordion-header::after {
    content: '▼'; /* Nedåtriktad triangel */
    position: absolute;
    right: 20px;
    font-size: 0.7rem;
    line-height: 1;
    top: 50%;
    transform: translateY(-50%) rotate(0deg);
    transition: transform 0.3s ease;
}

.accordion-header[aria-expanded="true"]::after {
    transform: translateY(-50%) rotate(180deg); /* Roterar pilen när den är öppen */
}

/* --- Innehåll (Accordion Content) --- */

.accordion-content {
    padding: 20px 25px;
    border-top: 1px solid var(--border-color);
    background-color: #ffffff;
    line-height: 1.6;
}

/* Stil för länkar inuti innehållet (t.ex. till YouTube-filmer) */
.accordion-content a {
    color: var(--ak9-color); /* Använd årskursens färg för länkar */
    text-decoration: underline;
    display: block;
    margin-bottom: 8px;
}

.accordion-content a:hover {
    color: var(--ak8-color); /* En annan färg vid hovring för dynamik */
}