/* =========================================================
   STYLE SHEET
   ---------------------------------------------------------
   1.  Colours & basics
   2.  Shared bits (sections, headings)
   3.  Photo frames & placeholders
   4.  Hero
   5.  Gallery
   6.  Letter
   7.  Lightbox
   8.  Fade-in animation
   9.  Phones & small screens
   ========================================================= */


/* ---------- 1. COLOURS & BASICS ---------- */

:root {
    /* Change these to change the whole colour theme */
    /* Christmas colours: pine green night, berry red and warm gold */
    --pine-dark:   #07160f;
    --pine:        #0e2a1c;
    --pine-light:  #17402a;
    --berry:       #c0262f;
    --gold:        #e9c46a;
    --snow:        #f8f6f0;

    --bg:          var(--pine-dark);
    --surface:     rgba(255, 255, 255, 0.06);
    --border:      rgba(248, 246, 240, 0.14);
    --text:        var(--snow);
    --text-muted:  #c4cfc6;
    --gradient:    linear-gradient(90deg, var(--snow), var(--gold));

    --font: "Inter", system-ui, sans-serif;
    --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

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

html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--font);
    font-weight: 300;
    background: linear-gradient(to bottom, var(--pine-light) 0%, var(--pine) 40%, var(--pine-dark) 100%) fixed;
    background-color: var(--pine-dark);
    color: var(--text);
    line-height: 1.7;
    -webkit-font-smoothing: antialiased;
}

/* Warm glows, like fairy lights in the distance */
body::before {
    content: "";
    position: fixed;
    inset: -20%;
    z-index: -1;
    background:
        radial-gradient(ellipse at 20% 15%, rgba(192, 38, 47, 0.28), transparent 40%),
        radial-gradient(ellipse at 80% 20%, rgba(233, 196, 106, 0.18), transparent 40%),
        radial-gradient(ellipse at 70% 85%, rgba(192, 38, 47, 0.18), transparent 45%);
    filter: blur(40px);
    animation: glow 30s ease-in-out infinite alternate;
}

@keyframes glow {
    from { transform: translateX(-3%) scale(1); }
    to   { transform: translateX(3%) scale(1.05); }
}

/* Gentle falling snow (three layers of flakes falling at different speeds).
   It sits behind the photos and text, so it never covers them. */
body::after {
    content: "";
    position: fixed;
    inset: 0;
    z-index: -1;
    pointer-events: none;
    background-image:
        /* small, slow flakes */
        radial-gradient(1.5px 1.5px at 20px 40px,  rgba(255, 255, 255, 0.8), transparent 100%),
        radial-gradient(1.5px 1.5px at 110px 130px, rgba(255, 255, 255, 0.7), transparent 100%),
        radial-gradient(1.5px 1.5px at 70px 90px,  rgba(255, 255, 255, 0.6), transparent 100%),
        /* medium flakes */
        radial-gradient(2.5px 2.5px at 60px 50px,  rgba(255, 255, 255, 0.85), transparent 100%),
        radial-gradient(2.5px 2.5px at 200px 180px, rgba(255, 255, 255, 0.75), transparent 100%),
        /* big, faster flakes */
        radial-gradient(3.5px 3.5px at 150px 80px, rgba(255, 255, 255, 0.9), transparent 100%),
        radial-gradient(3.5px 3.5px at 40px 260px, rgba(255, 255, 255, 0.8), transparent 100%);
    background-size:
        150px 150px, 150px 150px, 150px 150px,
        250px 250px, 250px 250px,
        350px 350px, 350px 350px;
    animation: snowfall 30s linear infinite;
}

/* each layer moves down by a whole number of tiles, so the loop is seamless */
@keyframes snowfall {
    from {
        background-position:
            0 0, 0 0, 0 0,
            0 0, 0 0,
            0 0, 0 0;
    }
    to {
        background-position:
            0 600px, 0 600px, 0 600px,
            250px 1000px, 250px 1000px,
            -350px 1400px, -350px 1400px;
    }
}

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


/* ---------- 2. SHARED BITS ---------- */

.section {
    max-width: 1300px;
    margin: 0 auto;
    padding: 120px 5vw;
    scroll-margin-top: 40px;
}

.section-head {
    margin-bottom: 50px;
}

.section-head h2,
.letter h2 {
    font-size: clamp(2rem, 4vw, 2.8rem);
    font-weight: 600;
    letter-spacing: -0.5px;
    width: fit-content;
    background: var(--gradient);
    -webkit-background-clip: text;
            background-clip: text;
    color: transparent;
}

.letter h2 {
    margin-left: auto;
    margin-right: auto;
}

.section-head p {
    color: var(--text-muted);
    margin-top: 6px;
}


/* ---------- 3. PHOTO FRAMES & PLACEHOLDERS ---------- */

/* Every photo sits inside a .photo-frame */
.photo-frame {
    position: relative;
    overflow: hidden;
    background: var(--surface);
}

.photo-frame img {
    width: 100%;
    height: auto;
}

/* When a photo hasn't been added yet, the script adds .is-missing
   and a grey box shows the file name instead */
.photo-frame.is-missing {
    aspect-ratio: 4 / 5;
    border: 1px dashed var(--border);
    backdrop-filter: blur(6px);
}

.photo-frame.is-missing img {
    display: none;
}

.photo-frame.is-missing::after {
    content: attr(data-file);
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    font-size: 0.85rem;
    letter-spacing: 1px;
}


/* ---------- 4. HERO ---------- */

.hero {
    position: relative;
    height: 100vh;
    min-height: 520px;
    display: flex;
    align-items: flex-end;
    overflow: hidden;
}

/* big photo filling the whole screen */
.hero-photo {
    position: absolute;
    inset: 0;
    background: transparent;

    /* photo fades out at the bottom into the colourful background */
    -webkit-mask-image: linear-gradient(to bottom, black 88%, transparent 100%);
            mask-image: linear-gradient(to bottom, black 88%, transparent 100%);
}

.hero-photo img {
    height: 100%;
    object-fit: contain;           /* shows the whole photo, never cropped */
    object-position: center;
}

.hero-photo.is-missing {
    aspect-ratio: auto;
    border: none;
}

/* soft shade at the bottom so the text is readable */
.hero::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(to top, rgba(7, 22, 15, 0.55) 0%, transparent 60%);
}

.hero-text {
    position: relative;
    z-index: 1;
    padding: 0 5vw 9vh;
}

.eyebrow {
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 4px;
    font-size: 0.8rem;
}

.hero h1 {
    font-size: clamp(3.5rem, 11vw, 8rem);
    font-weight: 600;
    letter-spacing: -3px;
    line-height: 1.05;
    margin: 8px 0 18px;
    background: var(--gradient);
    -webkit-background-clip: text;
            background-clip: text;
    color: transparent;
}

.together {
    color: var(--text-muted);
    font-size: 1rem;
}

.together #count-days {
    color: var(--text);
    font-weight: 500;
}


/* ---------- 5. GALLERY ---------- */
/* A "masonry" layout: photos stack in columns and keep their own shape */

/* the gallery gets a little more width than the other sections */
#gallery {
    max-width: 1600px;
    padding-left: 3vw;
    padding-right: 3vw;
}

.gallery {
    columns: 3;
    column-gap: 16px;
}

.gallery-item {
    break-inside: avoid;
    margin-bottom: 16px;
    cursor: pointer;
    border-radius: 10px;
    overflow: hidden;
    transition: box-shadow 0.5s ease, transform 0.5s var(--ease);
}

.gallery-item img {
    transition: transform 0.8s var(--ease);
}

.gallery-item:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 34px rgba(233, 196, 106, 0.3);
}

.gallery-item:hover img {
    transform: scale(1.04);
}

/* placeholders vary in height so the layout looks natural */
.gallery-item:nth-child(3n + 1) .is-missing { aspect-ratio: 4 / 5; }
.gallery-item:nth-child(3n + 2) .is-missing { aspect-ratio: 1 / 1; }
.gallery-item:nth-child(3n + 3) .is-missing { aspect-ratio: 3 / 4; }


/* ---------- 6. LETTER ---------- */

.letter {
    max-width: 700px;
    text-align: center;
}

.letter h2 {
    margin-bottom: 30px;
}

.letter p {
    color: var(--text-muted);
    font-size: 1.1rem;
    margin-bottom: 18px;
}

.letter .signoff {
    color: var(--text);
    margin-top: 30px;
}


/* ---------- 7. LIGHTBOX ---------- */

.lightbox {
    position: fixed;
    inset: 0;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(7, 22, 15, 0.94);
    backdrop-filter: blur(10px);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.35s ease;
}

.lightbox.show {
    opacity: 1;
    pointer-events: auto;
}

.lightbox img {
    max-width: 88vw;
    max-height: 86vh;
    border-radius: 4px;
    transform: scale(0.96);
    transition: transform 0.45s var(--ease), opacity 0.25s ease;
}

.lightbox.show img {
    transform: scale(1);
}

.lightbox-btn {
    position: absolute;
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 3rem;
    line-height: 1;
    padding: 10px 18px;
    cursor: pointer;
    transition: color 0.3s ease;
}

.lightbox-btn:hover {
    color: var(--text);
}

.lightbox-close { top: 14px; right: 14px; }
.lightbox-prev  { left: 10px; top: 50%; transform: translateY(-50%); }
.lightbox-next  { right: 10px; top: 50%; transform: translateY(-50%); }

.lightbox-count {
    position: absolute;
    bottom: 20px;
    color: var(--text-muted);
    font-size: 0.85rem;
    letter-spacing: 2px;
}


/* ---------- 8. FADE-IN ANIMATION ---------- */
/* Things with class="fade" glide in as you scroll to them */

.fade {
    opacity: 0;
    translate: 0 40px;
    transition: opacity 1s var(--ease), translate 1s var(--ease);
}

.fade.visible {
    opacity: 1;
    translate: 0 0;
}

/* respect people who prefer less motion */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation: none !important;
        transition: none !important;
    }

    html {
        scroll-behavior: auto;
    }

    .fade {
        opacity: 1;
        translate: 0 0;
    }
}


/* ---------- 9. PHONES & SMALL SCREENS ---------- */

@media (max-width: 900px) {

    .gallery {
        columns: 2;
        column-gap: 10px;
    }

    .gallery-item {
        margin-bottom: 10px;
    }
}

@media (max-width: 700px) {

    .section {
        padding: 80px 16px;
    }

    .hero-text {
        padding: 0 16px 8vh;
    }

    .hero h1 {
        letter-spacing: -1.5px;
    }

    .lightbox-prev,
    .lightbox-next {
        top: auto;
        bottom: 6px;
        transform: none;
    }
}
