/* Generell regel for å sikre at ingen bilder strekker seg utenfor foreldreelementet */
img {
    max-width: 100%; /* Sikrer at bildet aldri blir bredere enn sin beholder */
    height: auto; /* Sikrer at bildet skaleres proporsjonalt */
    display: block; /* Fjerner unødvendig plass under bildet */
}


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

body {
  font-family: Arial, sans-serif;
  line-height: 1.6;
  background: #f4f4f4;
  color: #333;
}


/* --- NAVIGASJON (HEADER) --- */

.navbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: white;
  padding: 15px 30px;
  box-shadow: 0 2px 5px rgba(0,0,0,0.1);
  position: sticky;
  top: 0;
  z-index: 1000;
}

/* Skriftstørrelser */
.hero-content h1 {
    font-size: 5rem;
    margin-bottom: 0.1em;
}

.cta-button { 
  font-size: 1.5em; 
  padding: 20px 40px;
}

.logo img {
  height: 40px; 
}

/* KUN SYNBAR PÅ STOR SKJERM: Sikrer at menyen vises til venstre */
.menu {
  list-style: none;
  display: flex; 
  gap: 20px;
}

.menu li a {
  text-decoration: none;
  color: #333;
  font-weight: bold;
}

.menu li a:hover {
  color: #004c8c;
}

/* --- HERO/SLIDER (Bildekarusell) --- */

.hero {
  width: 100%;
  height: 800px;
  position: relative;
  overflow: hidden;
  text-align: center;
}

.carousel-item {
  position: absolute;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  transition: opacity 1s ease-in-out;
}

.carousel-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.carousel-item.active {
  opacity: 1;
}

.hero-content {
    position: absolute; 
    top: 50%; 
    left: 50%; 
    transform: translate(-50%, -50%); 
    z-index: 10; 
    color: white; 
    text-shadow: 2px 2px 4px #000000;
    max-width: 90%;
}

.cta-button { 
  padding: 15px 30px; 
  background-color: #e43d40; 
  color: white; 
  text-decoration: none; 
  font-weight: bold; 
  border-radius: 5px; 
  font-size: 1.2em; 
  display: inline-block; 
  margin-top: 10px; 
}

/* --- HOVEDINNHOLD (SECTION) --- */

.main-content { 
  padding: 20px; 
  max-width: 1200px; 
  margin: 0 auto; 
}

.news-section, .shortcuts-section { 
  margin-top: 40px; 
}

.shortcuts-grid { 
  display: grid; 
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); 
  gap: 20px; 
  margin-top: 20px; 
}

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

/* NYE STILER FOR RULLENDE NYHETSFEEED */
.scrolling-news {
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 20px;
    height: 450px; 
    overflow: hidden; 
    position: relative;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1); 
}

.news-feed {
    position: absolute; 
    width: 95%; 
    animation: news-scroll 35s linear infinite; 
    padding-bottom: 20px;
}

.news-item {
    margin-bottom: 30px;
    border-bottom: 1px dashed #eee;
    padding-bottom: 15px;
}

.news-item h3 {
    color: #e43d40;
    margin-bottom: 5px;
}

@keyframes news-scroll {
    0% {
        transform: translateY(0);
    }
    100% {
        transform: translateY(calc(-100% + 450px)); 
    }
}
/* SLUTT NYE STILER */


/* --- FOOTER --- */

.site-footer {
  background: #004c8c;
  color: white;
  font-size: 0.9em;
  padding: 30px 0;
  margin-top: 50px;
}

.footer-contact {
  padding: 15px 30px;
  text-align: left;
  line-height: 1.8;
}

.site-footer a {
    color: lightgray;
    text-decoration: none;
}
.site-footer a:hover {
    color: white;
}

/* --- STIL FOR NYHETER.HTML --- */
.full-news-item {
    background-color: white;
    padding: 25px;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    margin-bottom: 30px;
}

.full-news-item h2 {
    color: #004c8c;
    margin-top: 5px;
    margin-bottom: 10px;
    border-bottom: 2px solid #eee;
    padding-bottom: 5px;
}

.news-date {
    display: block;
    font-size: 0.9em;
    color: #888;
    font-weight: bold;
}


/* --- GENERELLE STILER FOR INNHOLD (Fikser listepunktene) --- */

.main-content p {
    margin-bottom: 1em; /* LEGGER TIL LUFT UNDER ALLE AVNSNITT */
}

.main-content ul {
    list-style-position: inside; 
    padding-left: 20px; 
    margin: 15px 0;
}

.main-content li {
    margin-bottom: 5px;
}


/* --- STIL FOR GRENDAHUSET.HTML / DOKUMENTER.HTML (GRID OG HERO) --- */

.grendahus-hero {
    background: url('./images/grendahuset.jpg') no-repeat center center/cover; 
    height: 300px; 
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    color: white;
    text-shadow: 2px 2px 4px #000;
    margin-bottom: 50px;
}

.documents-hero {
    background: url('./images/dokumenter.jpg') no-repeat center center/cover;
}

.grendahus-grid {
    display: grid;
    grid-template-columns: 1fr; 
    gap: 30px;
    margin-top: 30px;
}

@media (min-width: 768px) {
    .grendahus-grid {
        grid-template-columns: repeat(2, 1fr); 
    }
}

.grendahus-card {
    background-color: #f8f8f8;
    padding: 25px;
    border-radius: 8px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.grendahus-card h3 {
    color: #004c8c;
    border-bottom: 2px solid #ddd;
    padding-bottom: 10px;
    margin-bottom: 15px;
}

.grendahus-card ul {
    list-style: disc;
    margin-left: 20px;
    padding-left: 40px; 
}

/* --- STIL FOR RESPONSIV GOOGLE KALENDER --- */
.calendar-container{
  position: relative;
  width: 100%;
  max-width: 900px;
  padding-bottom: 65%;
  height: 0;
  overflow: hidden;
  margin: 0 auto;
}
.calendar-container iframe{
  position: absolute;
  top:0;
  left:0;
  width:100%;
  height:100%;
  border:0;
}


/* --- MOBIL NAVIGASJON (Gjelder skjermer under 768px bredde) --- */

.menu-toggle {
    display: none; /* Skjult på stor skjerm */
    cursor: pointer;
}

.menu-toggle span {
    display: block;
    width: 30px;
    height: 3px;
    background: black;
    margin: 6px 0;
    transition: 0.4s;
}

/* ------------------------------------------------------------- */
/* MEDIA QUERY: AKTIVERER MOBILVISNING NÅR SKJERMEN ER SMAL */
/* ------------------------------------------------------------- */

@media (max-width: 768px) {
    
    .navbar {
        padding: 10px 20px;
        /* VIKTIG: Sikrer at elementene holdes fra hverandre */
        justify-content: space-between;
    }
    
    /* SKJULER MENYLISTEN PÅ MOBIL */
    .menu {
        display: none; 
        
        position: absolute;
        top: 60px;
        left: 0;
        width: 100%;
        background-color: white;
        box-shadow: 0 4px 8px rgba(0,0,0,0.1);
        flex-direction: column;
        text-align: center;
        padding-bottom: 10px;
        z-index: 900; 
        order: 3; /* Setter den skjulte menyen bakerst */
    }

    /* VISER HAMBURGER KNAPPEN PÅ MOBIL */
    .menu-toggle {
        display: block;
        z-index: 1100; 
        position: relative; 
        order: 1; /* Setter knappen først (VENSTRE) */
    }
    
    /* LOGOEN (som er til høyre) */
    .logo {
        order: 2; /* Setter logoen nest sist (HØYRE) */
    }
    
    .menu li {
        border-bottom: 1px solid #eee;
    }

    .menu li a {
        display: block;
        padding: 15px 0;
        font-size: 1.1em;
    }
    
    .menu.active {
        display: flex; /* VISER MENYEN NÅR JS LEGGER TIL KLASSEN 'active' */
    }

    .hero-content h1 {
        font-size: 2.5rem; 
    }
    
    .hero-content h3 {
        font-size: 1rem;
    }
    
    .cta-button {
        padding: 10px 20px;
        font-size: 1em;
    }

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


/* Tvinger alle Jotform-agent-containere til å ligge øverst */
div[id*="jotform-agent"] {
    z-index: 2147483647 !important;
}
