/* --- Grundläggande Stilar --- */
body {
    margin: 0;
    padding: 0;
    font-family: sans-serif;
    background-color: #ffffff;
}
#background-image-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1; /* Läggs bakom allt annat innehåll */
    opacity: 0; /* Börjar osynlig, styrs av JS */
}
#background-image-container img {
    width: 100%;
    height: 100%;
    object-fit: cover; /* Täcker hela ytan */
    display: block;
}

/* --- 1. Välkomstbild --- */
.welcome-box {
    position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%);
    background-color: transparent; padding: 0; box-shadow: none;
    z-index: 1000; opacity: 1;
    transition: opacity 0.5s ease-out;
}
#welcomeImage { width: 200px; height: auto; display: block; }

/* --- Introduktionstext (Fixerad) --- */
#intro-text {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 80%; /* Begränsa bredden */
    max-width: 600px; /* Max bredd */
    text-align: center;
    z-index: 950; /* Under welcomeBox men över mycket annat */
    opacity: 0; /* Börjar osynlig, styrs av JS */
    transition: opacity 0.5s ease-out; /* Mjuk övergång */
    pointer-events: none; /* Klick går igenom */
    color: hwb(55 5% 63%); /* Standardtextfärg */
}
#intro-text h2 {
     margin-top: 0;
     margin-bottom: 1em;
}
/* Lägg till detta i din styles.css */
#intro-text p {
    line-height: 1.6; /* Behåll befintlig stil */
    /* Lägger till en vit skugga med lite luddighet (blur) */
    text-shadow: 0 0 5px rgba(255, 255, 255, 0.9), /* Mjukt sken runt om */
                 0 0 10px rgba(255, 255, 255, 0.7); /* Lite bredare, svagare sken */
    /* Du kan behöva justera textfärgen om den är för ljus */
    /* color: #333; */ /* Exempel: Mörkare färg för bättre kontrast mot skuggan */
}

/* --- 2. Videospelare (Podcast) --- */
.podcast-box {
    position: fixed;
    top: 50%;
    left: 50%;
    width: 320px; height: 180px;
    background-color: transparent; padding: 0; box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
    z-index: 900;
    opacity: 0; /* Styrs helt av JS (scroll) */
    transform: translate(-50%, calc(-50% + 20px));
    transition: transform 0.8s ease-in; /* Endast transform animeras mjukt */
}
.podcast-box.is-visible {
    transform: translate(-50%, -50%); /* Glider till mitten */
}
.podcast-box video {
    display: block;
    width: 100%;
    height: 100%;
    border: none;
    object-fit: cover;
}

/* --- Fixerad Rubrik för Scroll Buffer --- */
#fixed-buffer-title-container {
    position: fixed;
    left: 50%;
    transform: translateX(-50%);
    top: 100px; /* Justera detta värde efter behov */
    width: 80%;
    max-width: 600px;
    text-align: center;
    z-index: 980;
    opacity: 0; /* Starta osynlig, styrs av JS */
    transition: opacity 0.5s ease-out; /* Mjuk intoning */
    pointer-events: none;
    color: #f0f0f0; /* Ljus text för mörk bakgrund */
}
#fixed-buffer-title-container h2 {
    margin: 0;
    font-size: 1.5em; /* Justera storlek vid behov */
    text-shadow: 0 1px 3px rgba(0,0,0,0.7); /* För läsbarhet */
}

/* --- 3. Sidans Innehåll & Scroll-yta --- */
.content {
    /* padding: 50px; (Behövs ej om tom) */
    min-height: 50vh;
    padding-top: 100vh; /* Behålls för scroll-avstånd */
}
/* Standard textfärg för content h2 (om den används igen) */
/* .content h2 { color: hwb(55 5% 63%); margin-top: 20px; transition: color 0.2s linear; } */

.scroll-buffer {
    height: 100vh;
    background-color: #ffffff; /* Standard vit, styrs av JS */
    text-align: center; padding-top: 50px; font-size: 14px;
    color: hwb(55 5% 63%); /* Standard textfärg, styrs av JS */
    transition: color 0.2s linear; /* Mjuk övergång för textfärg */
}
 .scroll-buffer h2 { /* Gäller den dolda original-h2 */
     color: hwb(55 5% 63%);
     transition: color 0.2s linear;
 }

 /* --- 4. Scroll-styrda Cirklar (Startanimation) --- */
#circle-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1001;
    pointer-events: none;
    isolation: isolate;
}
.scroll-circle {
    position: fixed;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    opacity: 0; /* Styrs av JS (scroll) */
    pointer-events: none;
    mix-blend-mode: screen;
}
#circle-red { background-color: rgba(255, 0, 0, 1); }
#circle-green { background-color: rgba(0, 255, 0, 1); }
#circle-blue { background-color: rgba(0, 0, 255, 1); }

/* --- 5. Fotoalbum --- */
.photo-album {
    padding: 40px 10px;
    background-color: #ffffff;
    text-align: center;
}
.photo-album h2 {
    color: #8d7e31;
    margin-bottom: 30px;
    text-align: center;
}

.album-spread {
    display: flex;
    flex-wrap: wrap;
    max-width: 600px;
    margin: 0 auto 50px auto;
    background: #ffffff;
    box-shadow: 0 5px 15px rgba(0,0,0,0.15);
    border: 8px groove rgba(164, 11, 11, 0.053);
    border-radius: 5px;
}

.album-page {
    flex: 1;
    min-width: 250px;
    padding: 15px;
    display: grid;
    grid-template-columns: 1fr;
    gap: 15px;
}
.album-page.left { border-right: 1px dashed #ccc; }
.album-page.right { border-left: 1px dashed #ccc; }

.fotoficka {
    position: relative;
    background-color: #f8f8f8;
    padding: 5px;
    border: 1px solid #ccc;
    box-shadow:
        0 1px 3px rgba(0, 0, 0, 0.1),
        inset 0 0 8px rgba(0, 0, 0, 0.05);
    transition: transform 0.2s ease-out, box-shadow 0.2s ease-out, filter 0.2s ease-out;
    width: 100%;
    padding-bottom: 56.25%; /* 16:9 aspect ratio */
    height: 0;
    overflow: hidden;
    filter: url(#noiseFilter); /* Ojämn yta som standard */
    cursor: pointer;
}
.fotoficka:hover {
    transform: scale(1.03);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
    z-index: 10;
    filter: none; /* Ta bort ojämn yta vid hover */
}

.fotoficka .bild-wrapper {
    position: absolute;
    top: 5px; left: 5px; right: 5px; bottom: 5px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid #bbaeae;
}
.fotoficka img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover; /* Fyller fickan */
    border: none;
    max-width: 100%;
    max-height: 100%;
}

/* Plastglans */
.fotoficka::before {
    content: "";
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: linear-gradient( 45deg, rgba(255, 255, 255, 0.15) 0%, rgba(255, 255, 255, 0.01) 30%, transparent 50%, rgba(255, 255, 255, 0.02) 70%, rgba(255, 255, 255, 0.1) 100% );
    pointer-events: none;
    mix-blend-mode: overlay;
    opacity: 1;
}
/* Sidoöppning */
.fotoficka::after {
    content: '';
    position: absolute;
    top: 5px; bottom: 5px; width: 8px;
    box-shadow: inset 3px 0 4px rgba(0,0,0,0.1);
}
.album-page.left .fotoficka::after { left: 5px; }
.album-page.right .fotoficka::after { right: 5px; box-shadow: inset -3px 0 4px rgba(0,0,0,0.1); }

/* --- 6. Galleri-Cirklar (Pulserande vid album) --- */

/* Keyframes för puls-animationerna */
@keyframes pulse-from-left {
    0% { transform: translateX(-40vw); opacity: 0; }
    50% { transform: none; opacity: 1; }
    100% { transform: translateX(-40vw); opacity: 0; }
}
@keyframes pulse-from-right {
    0% { transform: translateX(40vw); opacity: 0; }
    50% { transform: none; opacity: 1; }
    100% { transform: translateX(40vw); opacity: 0; }
}
/* @keyframes pulse-from-top { ... } Används ej nu */

/* Basstil för galleri-cirklar */
.gallery-circle {
    position: fixed; /* Position (top/left) sätts av JS */
    width: 80px;
    height: 80px;
    border-radius: 50%;
    pointer-events: none;
    mix-blend-mode: screen;
    animation-timing-function: ease-in-out;
    animation-iteration-count: infinite;
    animation-play-state: paused; /* Startas av JS */
}
/* Klass för att starta animationen */
.gallery-circle.is-sweeping {
    animation-play-state: running;
}

/* Specifika animationer och färger */
#gallery-circle-red {
    background-color: rgba(255, 0, 0, 0.9);
    animation-name: pulse-from-left;
    animation-duration: 4.5s;
}
#gallery-circle-green {
    background-color: rgba(0, 255, 0, 0.9);
    animation-name: pulse-from-right;
    animation-duration: 4s;
}
#gallery-circle-blue {
    background-color: rgba(0, 0, 255, 0.9);
    animation-name: pulse-from-left;
    animation-duration: 3.0s;
    animation-delay: 0.8s;
}

/* --- 7. Kontaktsektion med Flippande Kort --- */
.contact-section {
    padding: 50px 20px;
    background-color: #ffffff;
    text-align: center;
}
.contact-section h2 {
    color: hwb(55 5% 63%);
    margin-bottom: 40px;
}

.contact-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 30px;
    max-width: 1200px;
    margin: 0 auto;
    justify-items: center;
}

.contact-card {
    background-color: transparent;
    width: 200px;
    height: 250px;
    perspective: 1000px;
    cursor: pointer;
}

.card-inner {
    position: relative;
    width: 100%;
    height: 100%;
    text-align: center;
    transition: transform 0.6s;
    transform-style: preserve-3d;
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
    border-radius: 10px;
}

.contact-card:hover .card-inner {
    transform: rotateY(180deg);
}

.card-front, .card-back {
    position: absolute;
    width: 100%;
    height: 100%;
    -webkit-backface-visibility: hidden; /* Safari */
    backface-visibility: hidden;
    border-radius: 10px;
    overflow: hidden;
}

.card-front {
    background-color: #bbb;
    color: black;
}
.card-front img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Baksida med bildbakgrund */
.card-back {
    /* Lätt genomskinlig vit bakgrund FÖR TEXTEN */
    background-color: rgba(255, 255, 255, 0.85);
    color: hwb(55 5% 63%);
    padding: 20px;
    transform: rotateY(180deg);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    box-sizing: border-box;
    position: relative; /* Viktigt för .card-back-bg */
    z-index: 2; /* Lägg texten ovanpå bakgrundsbilden */
}
.card-back h3 {
    margin-top: 0;
    margin-bottom: 15px;
    font-size: 1.1em;
}
.card-back p {
    font-size: 0.9em;
    margin: 5px 0;
    word-break: break-all;
}
.card-back a {
    color: #021d2f;
    text-decoration: none;
}
.card-back a:hover {
    text-decoration: underline;
}

/* Bakgrundsbilden på baksidan */
.card-back-bg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1; /* Under texten */
    overflow: hidden;
    border-radius: 10px;
}
.card-back-bg img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0.2; /* Svag opacitet */
    transform: scaleX(-1); /* Flippa bilden */
}

/* --- Sidfot --- */
.foten {
    text-align: center;
    padding: 20px;
    font-size: 0.9em;
    color: #555;
    margin-top: 30px;
}
/* --- NYTT: Animation för kontaktkort vid scroll --- */

        /* Keyframes för en hel rotation */
        @keyframes rotateCardOnce {
            from {
                transform: rotateY(0deg);
            }
            to {
                transform: rotateY(360deg);
            }
        }

        /* Klass som applicerar engångsrotationen */
        .contact-card .card-inner.animate-rotation {
            animation-name: rotateCardOnce;
            animation-duration: 0.8s; /* Justera hastigheten här */
            animation-timing-function: ease-in-out;
            animation-iteration-count: 1; /* Kör bara en gång */
            /* animation-fill-mode: forwards; Behövs ej då 360deg = 0deg */
        }