/* ==========================================================
   MEMORIAL WEBSITE - GLOBAL STYLES

   File:
       main.css

   Purpose:
       Shared styling for Jerry Herron's memorial website.
========================================================== */


/* ==========================================================
   DESIGN VARIABLES
========================================================== */

:root {
    --black: #1a1717;
    --red: #681818;
    --red-light: #8b2424;
    --white: #f7f4f1;
    --muted: #c9c1bd;
    --panel: #252020;
}


/* ==========================================================
   GLOBAL RESET
========================================================== */

* {
    box-sizing: border-box;
}


/* ==========================================================
   HTML
========================================================== */

html {
    scroll-behavior: smooth;
}


/* ==========================================================
   BODY
========================================================== */

body {
    margin: 0;

    background: #eed7d7bf;

    color: #040404;

    font-family:
        Georgia,
        "Times New Roman",
        serif;

    line-height: 1.65;
}


/* ==========================================================
   GLOBAL LINKS
========================================================== */

a {
    color: inherit;
}


/* ==========================================================
   RESPONSIVE MEDIA
========================================================== */

img,
video {
    display: block;

    max-width: 100%;
}


/* ==========================================================
   SITE HEADER
========================================================== */

.site-header {
    position: fixed;

    top: 0;
    left: 0;
    right: 0;

    z-index: 1000;

    background:
        rgba(1, 1, 39, 0.98);

    text-align: center;
}


/* ==========================================================
   SITE TITLE
========================================================== */

.site-title {
    display: block;

    padding:
        0.65rem
        5%
        0.25rem;

    color: #ffffff;

    font-size:
        clamp(
            1rem,
            3vw,
            1.3rem
        );

    letter-spacing: 0.04em;

    text-decoration: none;
}


/* ==========================================================
   SITE NAVIGATION
========================================================== */

.site-nav {
    display: flex;

    justify-content: center;
    align-items: center;

    flex-wrap: wrap;
}


/* ==========================================================
   NAVIGATION LINKS
========================================================== */

.site-nav a {
    display: block;

    padding:
        0.35rem
        0.7rem;

    color: var(--muted);

    font-size: 0.82rem;

    text-decoration: none;
}


/* ==========================================================
   NAVIGATION HOVER / CURRENT PAGE
========================================================== */

.site-nav a:hover,
.site-nav a[aria-current="page"] {
    background:
        var(--red-light);

    color: white;
}


/* ==========================================================
   MAIN CONTENT
========================================================== */

main {
    width:
        min(
            1050px,
            90%
        );

    margin:
        0
        auto;

    padding:
        105px
        0
        50px;
}


/* ==========================================================
   CENTERED CONTENT
========================================================== */

.hero,
.center {
    text-align: center;
}


/* ==========================================================
   HERO TITLE
========================================================== */

.hero h1 {
    margin:
        0.3rem
        0;

    font-size:
        clamp(
            2rem,
            7vw,
            4.5rem
        );
}


/* ==========================================================
   LIFE DATES
========================================================== */

.dates {
    color: #1a1717;

    letter-spacing: 0.12em;
}


/* ==========================================================
   MAIN PORTRAIT
========================================================== */

.portrait-frame {
    width: min(420px, 90%);
    margin: 2rem auto;
    padding: 10px;

    background: #111;
    border: 3px solid var(--red);

    display: flex;
    justify-content: center;
    align-items: center;

    overflow: hidden;
}


/* Jerry's main portrait */
.main-portrait {
    display: block;

    width: 100%;
    height: auto;

    margin: 0 auto;

    object-fit: contain;
}


/* ==========================================================
   CONTENT SECTION
========================================================== */

.section {
    margin:
        3rem
        0;

    padding:
        clamp(
            1.3rem,
            4vw,
            2.3rem
        );

    background:
        linear-gradient(
            145deg,
            #fffefe,
            #aa4646
        );

    border-top:
        3px
        solid
        var(--red);
}


/* ==========================================================
   SECTION HEADINGS
========================================================== */

.section h2,
.section h3 {
    margin-top: 0;
}


/* ==========================================================
   SUBSECTION
========================================================== */

.subsection {
    margin-top: 2rem;

    padding-top: 1rem;

    border-top:
        1px
        solid
        #944b4b;
}


/* ==========================================================
   FAMILY / MEMORY GRIDS
========================================================== */

.family-grid,
.memory-grid {
    display: grid;

    grid-template-columns:
        repeat(
            auto-fit,
            minmax(
                240px,
                1fr
            )
        );

    gap: 1rem;

    background:
        #eed7d7bf;
}


/* ==========================================================
   FAMILY / MEMORY CARDS
========================================================== */

.family-card,
.memory-card {
    padding: 1.25rem;

    background: #cdc9c9;

    border:
        1px
        solid
        #820808;
}


/* ==========================================================
   FAMILY INFORMATION
========================================================== */

.family-line {
    display: flex;

    align-items: flex-start;

    margin-bottom: 0.5rem;
}


.family-label {
    flex:
        0
        0
        110px;

    font-weight: bold;
}


.family-names {
    flex: 1;
}


/* ==========================================================
   PURPOSE SECTION
========================================================== */

.purpose {
    border-left:
        4px
        solid
        var(--red-light);
}


/* ==========================================================
   PAGE NAVIGATION
========================================================== */

.page-nav {
    display: flex;

    justify-content: space-between;

    gap: 1rem;

    margin:
        3rem
        0
        1rem;
}


/* ==========================================================
   BUTTONS
========================================================== */

.button,
.page-nav a {
    display: inline-block;

    padding:
        0.75rem
        1rem;

    background: #040081;

    color: white;

    border:
        1px
        solid
        #5e44aa;

    border-radius: 4px;

    text-decoration: none;
}


.button:hover,
.page-nav a:hover {
    background:
        var(--red-light);
}


/* ==========================================================
   GALLERY PAGE INTRODUCTION
========================================================== */

.page-intro {
    margin-bottom: 1.5rem;

    text-align: center;
}


.page-intro h1 {
    margin-bottom: 0.5rem;
}


.page-intro p {
    max-width: 700px;

    margin:
        0
        auto;

    color: #463f3f;
}


/* ==========================================================
   GALLERY FILTER BAR
========================================================== */

.filter-bar {
    display: flex;

    flex-wrap: wrap;

    justify-content: center;

    gap: 0.6rem;

    margin:
        1.5rem
        0
        2rem;
}


/* ==========================================================
   GALLERY FILTER BUTTON
========================================================== */

.filter-button {
    padding:
        0.6rem
        1rem;

    background: #1a1955;

    color: white;

    border:
        1px
        solid
        var(--red-light);

    border-radius: 4px;

    font-family: inherit;

    font-size: 0.9rem;

    cursor: pointer;

    transition:
        background 0.2s ease,
        border-color 0.2s ease,
        transform 0.2s ease;
}


.filter-button:hover {
    background:
        var(--red-light);

    transform:
        translateY(-1px);
}


.filter-button.active {
    background:
        var(--red);

    border-color:
        var(--red);
}


.filter-button:focus-visible {
    outline:
        2px
        solid
        #ffffff;

    outline-offset: 3px;
}


/* ==========================================================
   GALLERY GRID
========================================================== */

.gallery-grid {
    display: grid;

    grid-template-columns:
        repeat(
            auto-fill,
            minmax(
                220px,
                1fr
            )
        );

    gap: 1.2rem;

    width: 100%;

    margin:
        0
        auto;
}


/* ==========================================================
   GALLERY ITEM
========================================================== */

.gallery-item {
    margin: 0;

    overflow: hidden;

    background: #1d1919;

    border:
        1px
        solid
        #5d3030;

    border-radius: 4px;

    box-shadow:
        0
        4px
        12px
        rgba(0, 0, 0, 0.18);
}


/* ==========================================================
   HIDDEN GALLERY ITEMS
========================================================== */

.gallery-item[hidden] {
    display: none;
}


/* ==========================================================
   CLICKABLE GALLERY PHOTO
========================================================== */

.gallery-photo {
    width: 100%;

    aspect-ratio: 4 / 3;

    object-fit: cover;

    cursor: pointer;

    transition:
        transform 0.25s ease,
        opacity 0.25s ease;
}


.gallery-photo:hover {
    transform:
        scale(1.03);

    opacity: 0.92;
}


.gallery-photo:focus-visible {
    outline:
        3px
        solid
        white;

    outline-offset: -3px;
}


/* ==========================================================
   GALLERY PLACEHOLDER
========================================================== */

.gallery-placeholder {
    aspect-ratio: 4 / 3;

    display: grid;

    place-items: center;

    padding: 1rem;

    background: #2b2222;

    color: var(--muted);

    text-align: center;
}


/* ==========================================================
   GALLERY CAPTION
========================================================== */

.gallery-item figcaption {
    padding: 1rem;

    color: #ddd;

    line-height: 1.5;
}


/* ==========================================================
   PHOTO / MEMORY CREDIT
========================================================== */

.credit {
    margin-top: 0.6rem;

    color: #aaa;

    font-size: 0.9rem;
}


/* ==========================================================
   LIGHTBOX

   Full-screen photo viewer.
========================================================== */

.lightbox {
    position: fixed;

    inset: 0;

    z-index: 5000;

    display: flex;

    align-items: center;

    justify-content: center;

    padding:
        3rem
        5rem;

    background:
        rgba(
            0,
            0,
            0,
            0.94
        );
}


/* ==========================================================
   HIDDEN LIGHTBOX
========================================================== */

.lightbox[hidden] {
    display: none;
}


/* ==========================================================
   LIGHTBOX CONTENT

   Holds the photograph and optional caption together.
========================================================== */

.lightbox-content {
    display: flex;

    flex-direction: column;

    align-items: center;

    justify-content: center;

    max-width: 90vw;

    max-height: 90vh;
}


/* ==========================================================
   LIGHTBOX IMAGE

   Full photograph is displayed without cropping.
========================================================== */

.lightbox-image {
    display: block;

    width: auto;

    height: auto;

    max-width: 90vw;

    max-height: 78vh;

    object-fit: contain;

    box-shadow:
        0
        0
        30px
        rgba(
            0,
            0,
            0,
            0.7
        );
}


/* ==========================================================
   OPTIONAL LIGHTBOX CAPTION

   Appears underneath the enlarged photograph only when
   gallery.js finds a caption for that filename.
========================================================== */

.lightbox-caption {
    width: min(
        700px,
        85vw
    );

    margin-top: 0.8rem;

    padding:
        0.7rem
        1rem;

    background:
        rgba(
            0,
            0,
            0,
            0.75
        );

    color: white;

    border-radius: 4px;

    text-align: center;

    font-size: 1rem;

    line-height: 1.5;
}


.lightbox-caption[hidden] {
    display: none;
}


/* ==========================================================
   LIGHTBOX CLOSE BUTTON
========================================================== */

.lightbox-close {
    position: absolute;

    top: 1rem;

    right: 1.5rem;

    z-index: 2;

    padding: 0;

    background: transparent;

    color: white;

    border: none;

    font-family:
        Arial,
        sans-serif;

    font-size: 3rem;

    line-height: 1;

    cursor: pointer;
}


/* ==========================================================
   LIGHTBOX PREVIOUS / NEXT
========================================================== */

.lightbox-nav {
    position: absolute;

    top: 50%;

    transform:
        translateY(-50%);

    z-index: 2;

    width: 50px;

    height: 70px;

    background:
        rgba(
            0,
            0,
            0,
            0.55
        );

    color: white;

    border:
        1px
        solid
        rgba(
            255,
            255,
            255,
            0.4
        );

    border-radius: 4px;

    font-size: 2rem;

    cursor: pointer;

    transition:
        background 0.2s ease,
        border-color 0.2s ease;
}


.lightbox-prev {
    left: 1.5rem;
}


.lightbox-next {
    right: 1.5rem;
}


/* Previous / Next hidden on first / last photo. */

.lightbox-nav[hidden] {
    display: none;
}


.lightbox-nav:hover {
    background:
        rgba(
            104,
            24,
            24,
            0.9
        );

    border-color: white;
}


.lightbox-close:hover {
    color: #d7d7d7;
}


.lightbox-nav:focus-visible,
.lightbox-close:focus-visible {
    outline:
        2px
        solid
        white;

    outline-offset: 3px;
}


/* ==========================================================
   LIGHTBOX PHOTO COUNTER

   Example:
       4 / 58
========================================================== */

.lightbox-counter {
    position: absolute;

    bottom: 0.7rem;

    left: 50%;

    transform:
        translateX(-50%);

    padding:
        0.3rem
        0.7rem;

    background:
        rgba(
            0,
            0,
            0,
            0.65
        );

    color: white;

    border-radius: 4px;

    font-family:
        Arial,
        sans-serif;

    font-size: 0.9rem;
}


/* ==========================================================
   PREVENT PAGE SCROLLING WHILE LIGHTBOX IS OPEN
========================================================== */

body.lightbox-open {
    overflow: hidden;
}


/* ==========================================================
   MEMORY MEDIA
========================================================== */

.memory-media {
    margin-top: 1rem;

    padding: 0.8rem;

    background: #2e2658;

    color: #bbb;
}


/* ==========================================================
   CONTACT OPTIONS
========================================================== */

.contact-options {
    display: grid;

    grid-template-columns:
        repeat(
            auto-fit,
            minmax(
                250px,
                1fr
            )
        );

    gap: 1rem;
}


/* ==========================================================
   CONTACT CARD
========================================================== */

.contact-card {
    padding: 1.5rem;

    background: #cdc9c9;

    border:
        1px
        solid
        #5d3030;
}


/* ==========================================================
   FOOTER
========================================================== */

.footer {
    padding:
        2rem
        1rem
        3rem;

    color: #6c7191;

    border-top:
        1px
        solid
        #443838;

    text-align: center;
}


/* ==========================================================
   MOBILE RESPONSIVE DESIGN
========================================================== */

@media (max-width: 600px) {


    /* ======================================================
       MAIN CONTENT
    ====================================================== */

    main {
        width: 94%;

        padding-top: 100px;
    }


    /* ======================================================
       SITE TITLE
    ====================================================== */

    .site-title {
        padding:
            0.55rem
            3%
            0.2rem;

        font-size: 1rem;
    }


    /* ======================================================
       MOBILE NAVIGATION
    ====================================================== */

    .site-nav {
        flex-wrap: nowrap;

        justify-content: flex-start;

        overflow-x: auto;

        scrollbar-width: thin;
    }


    .site-nav a {
        flex:
            0
            0
            auto;

        padding:
            0.3rem
            0.6rem;

        font-size: 0.75rem;
    }


    /* ======================================================
       FAMILY INFORMATION
    ====================================================== */

    .family-label {
        flex:
            0
            0
            95px;
    }


    /* ======================================================
       MOBILE GALLERY FILTERS
    ====================================================== */

    .filter-bar {
        gap: 0.4rem;

        margin:
            1.25rem
            0
            1.5rem;
    }


    .filter-button {
        padding:
            0.5rem
            0.75rem;

        font-size: 0.8rem;
    }


    /* ======================================================
       MOBILE GALLERY

       Two photographs per row.
    ====================================================== */

    .gallery-grid {
        grid-template-columns:
            repeat(
                2,
                minmax(
                    0,
                    1fr
                )
            );

        gap: 0.7rem;
    }


    /* Square gallery thumbnails on phones. */

    .gallery-photo {
        aspect-ratio: 1 / 1;
    }


    /* ======================================================
       MOBILE LIGHTBOX
    ====================================================== */

    .lightbox {
        padding:
            3.5rem
            0.75rem;
    }


    .lightbox-content {
        max-width: 96vw;

        max-height: 88vh;
    }


    .lightbox-image {
        max-width: 96vw;

        max-height: 72vh;
    }


    /* Optional caption */

    .lightbox-caption {
        width: 90vw;

        margin-top: 0.6rem;

        padding:
            0.6rem
            0.8rem;

        font-size: 0.9rem;
    }


    /* Previous / Next */

    .lightbox-nav {
        width: 42px;

        height: 58px;

        font-size: 1.5rem;
    }


    .lightbox-prev {
        left: 0.4rem;
    }


    .lightbox-next {
        right: 0.4rem;
    }


    /* Close button */

    .lightbox-close {
        top: 0.5rem;

        right: 0.8rem;

        font-size: 2.5rem;
    }


    /* Counter */

    .lightbox-counter {
        bottom: 0.4rem;

        font-size: 0.8rem;
    }


    /* ======================================================
       PAGE NAVIGATION
    ====================================================== */

    .page-nav {
        flex-direction: column;
    }


    .page-nav a {
        text-align: center;
    }

}