/* ============================================================
   KAIVOPUISTON ANTIIKKI – MODERNI, MOBIILIOPTIMOITU CSS
   ============================================================ */

/* -------------------------------------
   TYPOGRAFIA & PERUSASETUKSET
-------------------------------------- */
body {
    margin: 0;
    padding: 0;
    font-family: "Inter", Arial, sans-serif;
    background-color: #ffffff;
    color: #111;
    text-align: center;
    line-height: 1.65;
    -webkit-font-smoothing: antialiased;
}

h1, h2, h3 {
    font-family: "Georgia", serif;
    letter-spacing: 0.5px;
}

/* -------------------------------------
   LINKIT
-------------------------------------- */
a {
    color: #000;
    text-decoration: none;
    transition: opacity .2s ease;
}

a:hover {
    opacity: 0.7;
}

/* -------------------------------------
   CONTAINER
-------------------------------------- */
.container {
    max-width: 900px;
    margin: 0 auto;
    background-color: #586E89;
    border: 1px solid #000;
    padding: clamp(16px, 3vw, 28px);
    box-sizing: border-box;
}

/* -------------------------------------
   OTSIKKO
-------------------------------------- */
.site-title {
    font-size: clamp(42px, 6vw, 64px);
    font-weight: normal;
    color: #fff;
    margin: 20px 0 10px 0;
}

/* -------------------------------------
   NAVIGAATIO
-------------------------------------- */
.navbar {
    background-color: #fff;
    padding: 14px 0;
    border-bottom: 2px solid #586E89;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 22px;
}

.navbar a {
    font-size: 16px;
    font-weight: 600;
}

/* -------------------------------------
   SISÄLTÖ
-------------------------------------- */
.content {
    background-color: #fff;
    padding: clamp(20px, 4vw, 32px);
    font-size: 16px;
}

/* -------------------------------------
   GALLERIA GRID
-------------------------------------- */
.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 22px;
    margin-top: 20px;
}

.gallery-grid a {
    position: relative;
    display: block;
}

.gallery-grid img {
    width: 100%;
    height: auto;
    border-radius: 4px;
    border: 1px solid #000;
    cursor: pointer;
    transition: transform .25s ease;
}

.gallery-grid img:hover {
    transform: scale(1.04);
}

/* Hover-teksti */
.gallery-grid a::after {
    content: attr(data-caption);
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;

    background: rgba(0,0,0,0.55);
    color: #fff;

    font-size: clamp(0.70rem, 2.2vw, 0.95rem);
    padding: clamp(4px, 1vw, 8px) clamp(6px, 1.4vw, 12px);

    opacity: 0;
    transition: opacity .25s ease;
}

.gallery-grid a:hover::after {
    opacity: 1;
}

/* -------------------------------------
   LIGHTBOX
-------------------------------------- */
.lightbox {
    display: none;
    position: fixed;
    z-index: 9999;
    padding-top: 60px;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow-y: auto;
    background-color: rgba(0,0,0,0.92);
    animation: fadeIn .35s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}

.lightbox:target {
    display: block;
}

.lightbox picture {
    position: relative;
    display: block;
    max-width: min(92vw, 900px);
    max-height: calc(100vh - 100px);
    margin: 0 auto;
}

.lightbox img {
    width: auto;
    max-width: 100%;
    height: auto;
    max-height: calc(100vh - 100px);
    object-fit: contain;
    border-radius: 4px;
    display: block;
    margin: 0 auto;
}

/* Close button */
.lightbox-close {
    position: absolute;
    top: 20px;
    right: 40px;
    color: #fff;
    font-size: 42px;
    text-decoration: none;
    opacity: 0.8;
    transition: opacity .2s ease;
}

.lightbox-close:hover {
    opacity: 1;
}

/* -------------------------------------
   CAPTION-UNDER (hover)
-------------------------------------- */
.caption-under {
    position: fixed;
    left: 50%;
    bottom: 16px;
    transform: translateX(-50%);
    width: min(92vw, 900px);
    max-height: 42vh;
    overflow-y: auto;
    margin: 0;
    padding: clamp(10px, 2vw, 16px) clamp(12px, 2.2vw, 18px);

    font-weight: 500;
    font-size: clamp(0.85rem, 2.4vw, 1.08rem);
    line-height: 1.55;

    text-align: left;
    color: #fff;
    background: linear-gradient(to top, rgba(0,0,0,0.92), rgba(0,0,0,0.64));
    border: 1px solid rgba(255,255,255,0.22);
    border-radius: 6px;

    opacity: 0;
    transition: opacity .35s ease;
    pointer-events: auto;
}


.lightbox picture:hover + .caption-under {
    opacity: 1;
}

.caption-under:hover {
    opacity: 1;
}

.caption-under h3 {
    margin: 0.8rem 0 0.3rem 0;
    font-weight: 600;
    font-size: clamp(1rem, 2.8vw, 1.15rem);
}


.caption-under p {
    margin: 0.3rem 0;
}

/* -------------------------------------
   MOBIILI
-------------------------------------- */
@media (max-width: 600px) {

    .navbar {
        gap: 14px;
    }

    .lightbox-close {
        right: 20px;
        font-size: 36px;
    }

    .caption-under {
        bottom: 10px;
        font-size: 1rem;
        max-height: 45vh;
    }
}

@media (hover: none) {
    .caption-under {
        opacity: 1;
    }
}
