/*
 * Homepage-specific styles.
 * Kept separate from styles.css to avoid changing the appearance
 * or behavior of the other website pages.
 */

/*
 * Keep the original fallback image from flashing while home.json is loaded.
 * home.js removes .home-loading after it has decided which homepage to show.
 */
.home-loading #home-content {
    visibility: hidden;
}

/* Original homepage fallback image */
.home-painting {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: calc(100vh - 170px);
    padding: 1rem 1.5rem 2rem;
}

.home-painting > img {
    display: block;
    width: auto;
    height: auto;
    max-width: 100%;
    max-height: calc(100vh - 190px);
    object-fit: contain;
}

/* Homepage feed */
.home-feed {
    width: min(100%, 1500px);
    margin: 0 auto;
    padding: 2rem clamp(1.25rem, 4vw, 4rem) 3rem;
}

.home-item {
    display: grid;
    grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.2fr);
    align-items: start;
    column-gap: clamp(2rem, 4vw, 4.5rem);
    padding: clamp(2rem, 4vw, 4rem) 0;
    border-bottom: 1px solid var(--color-border);
}

.home-item:first-child {
    padding-top: 1rem;
}

.home-item:last-child {
    border-bottom: none;
}

.home-item-media {
    min-width: 0;
}

.home-main-image {
    display: block;
    width: 100%;
    height: auto;
    max-height: 60vh;
    object-fit: contain;
    object-position: center;
}

.home-gallery {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.75rem;
    margin-top: 0.75rem;
}

.home-gallery-image {
    display: block;
    width: 100%;
    height: clamp(90px, 12vw, 175px);
    object-fit: contain;
    object-position: center;
    background: rgba(0, 0, 0, 0.06);
    cursor: zoom-in;
}

.home-gallery-image:focus-visible {
    outline: 2px solid var(--color-text);
    outline-offset: 3px;
}

.home-item-text {
    min-width: 0;
    color: var(--color-text-muted, var(--color-text));
    font-size: 1.2rem;
    line-height: 1.8;
    overflow-wrap: anywhere;
}

.home-item-text > :first-child {
    margin-top: 0;
}

.home-item-text h1,
.home-item-text h2,
.home-item-text h3,
.home-item-text h4,
.home-item-text h5,
.home-item-text h6 {
    color: var(--color-text);
    font-weight: 400;
    line-height: 1.35;
    margin: 0 0 1.25rem;
}

.home-item-text h1 { font-size: 2rem; }
.home-item-text h2 { font-size: 1.8rem; }
.home-item-text h3 { font-size: 1.55rem; }
.home-item-text h4 { font-size: 1.35rem; }

.home-item-text p {
    margin: 0 0 1.25rem;
}

.home-item-text ul,
.home-item-text ol {
    margin: 0 0 1.25rem 1.5rem;
}

.home-item-text blockquote {
    margin: 0 0 1.25rem;
    padding-left: 1rem;
    border-left: 2px solid var(--color-border);
    opacity: 0.9;
}

.home-item-text a {
    color: inherit;
    text-decoration: underline;
    text-underline-offset: 0.15em;
}

.home-item-text code {
    font-family: Consolas, Monaco, monospace;
    font-size: 0.9em;
}

/* The existing styles.css supplies the shared .lightbox, .viewer,
   .nav and .close appearance. These rules only tune the homepage popup. */
#home-lightbox .viewer {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
}

#home-lightbox .viewer img {
    display: block;
    max-width: 90vw;
    max-height: 90vh;
    object-fit: contain;
}

#home-lightbox [hidden] {
    display: none;
}

@media (max-width: 700px) {
    .home-painting {
        min-height: calc(100vh - 130px);
        padding: 0.5rem 0.75rem 1rem;
    }

    .home-painting > img {
        max-height: calc(100vh - 150px);
    }

    .home-feed {
        padding: 0.5rem 1.25rem 2rem;
    }

    .home-item {
        grid-template-columns: minmax(0, 1fr);
        row-gap: 1.5rem;
        padding: 2rem 0;
    }

    .home-main-image {
        max-height: none;
    }

    .home-gallery {
        gap: 0.5rem;
        margin-top: 0.5rem;
    }

    .home-gallery-image {
        height: clamp(85px, 27vw, 135px);
    }

    .home-item-text {
        font-size: 1.05rem;
        line-height: 1.7;
    }

    .home-item-text h1 { font-size: 1.7rem; }
    .home-item-text h2 { font-size: 1.55rem; }
    .home-item-text h3 { font-size: 1.35rem; }
    .home-item-text h4 { font-size: 1.2rem; }

    #home-lightbox {
        padding: 20px;
    }

    #home-lightbox .nav {
        font-size: 30px;
        padding: 10px;
    }

    #home-lightbox .prev {
        left: 0;
    }

    #home-lightbox .next {
        right: 0;
    }

    #home-lightbox .close {
        top: 12px;
        right: 15px;
    }
}
