@import url('https://fonts.googleapis.com/css2?family=Frank+Ruhl+Libre:wght@400;500&family=Libre+Franklin:wght@300;400;500&display=swap');

/* =========================
   Base
========================= */

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

body {
    font-family: 'Libre Franklin', sans-serif;
    font-weight: 300;
    background: #f5f0e8;
    color: #111;
}

h1, h2, h3, p, nav { margin: 0; }

/* =========================
   Shared Page Layout
========================= */

main {
    width: 100%;
    padding: 1rem 2rem 4rem;
}

/* Home page word grid — full-bleed, no side padding */
main.home-wordmark {
    padding-left: 0;
    padding-right: 0;
}

main.horizontal-gallery { padding-top: 3rem; }

/* =========================
   Header / Navigation
========================= */

header {
    width: 100%;
    padding-top: 3rem;
    padding-bottom: 2rem;
    display: flex;
    flex-direction: column;
    align-items: center;
}

header h1 {
    margin-bottom: 1.25rem;
    user-select: none;
    font-family: 'Frank Ruhl Libre', serif;
    font-size: 3.6rem;
    font-weight: 400;
    line-height: 1;
    letter-spacing: 0.01em;
}

nav {
    display: flex;
    gap: 2rem;
    user-select: none;
}

nav a {
    text-decoration: none;
    color: #111;
    font-family: 'Libre Franklin', sans-serif;
    font-size: 0.92rem;
    font-weight: 400;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    line-height: 1;
    transition: opacity 0.2s ease;
}

nav a:hover { opacity: 0.5; }

nav a.active {
    display: none;
}

/* =========================
   Project Page Back Button
========================= */

.back-btn {
    display: block;
    width: 100%;
    padding: 3rem 2rem 2rem;
    text-align: center;
    font-family: 'Libre Franklin', sans-serif;
    font-size: 0.92rem;
    font-weight: 400;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    text-decoration: none;
    color: #111;
    opacity: 0.5;
    transition: opacity 0.2s ease;
    user-select: none;
}

.back-btn:hover { opacity: 1; }

/* =========================
   Project Gallery Grid
========================= */

.horizontal-gallery {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 300px));
    justify-content: center;
    gap: 2.5rem;
    max-width: 1400px;
    margin: 0 auto;
}

.project-panel {
    height: 320px;
    display: flex;
    flex-direction: column;
    background: white;
    padding: 0.8rem 0.8rem 2.6rem;
    text-decoration: none;
    color: #111;
    box-shadow: 0 3px 12px rgba(0,0,0,0.10);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.project-panel:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 20px rgba(0,0,0,0.14);
}

.project-panel img {
    width: 100%;
    height: 180px;
    object-fit: cover;
    display: block;
    flex-shrink: 0;
}

.project-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding-top: 1rem;
    text-align: center;
}

.project-info h2 {
    font-family: 'Libre Franklin', sans-serif;
    font-size: 0.92rem;
    font-weight: 400;
    margin-bottom: 0.4rem;
    letter-spacing: 0.1em;
}

.project-info p {
    font-family: 'Libre Franklin', sans-serif;
    font-size: 0.92rem;
    font-weight: 300;
    line-height: 1.7;
    color: #555;
}

/* =========================
   Project Intro
========================= */

.project-intro {
    max-width: 700px;
    margin: 0 auto 3rem;
    text-align: center;
    line-height: 1.7;
    font-size: 0.95rem;
}

/* =========================
   Static Gallery Grid
========================= */

.gallery {
    display: grid;
    grid-template-columns: repeat(3, 220px);
    gap: 1rem;
    justify-content: center;
}

.gallery-img {
    width: 220px;
    height: 220px;
    object-fit: cover;
    display: block;
    cursor: pointer;
    transition: opacity 0.2s ease;
}

.gallery-img:hover { opacity: 0.9; }

/* =========================
   Lightbox
========================= */

#lightbox {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.92);
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

#lightbox-img { max-width: 90%; max-height: 90%; }

#close {
    position: absolute;
    top: 20px;
    right: 30px;
    color: white;
    font-size: 3rem;
    cursor: pointer;
}

/* =========================
   Postcards Page
========================= */

.postcards-page {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2rem;
    width: 100%;
}

/* =========================
   Postcard Stack
   A plain block container — no position:relative, no explicit height.
   Height comes naturally from the scene's canvas children.
========================= */

.postcard-stack {
    display: block;
}

/* =========================
   Flip Scene
   CSS Grid stacks both canvas faces in the same cell.
   The scene sits in normal document flow — it can never
   overflow downward and overlap the nav buttons.
========================= */

.postcard-scene {
    display: grid;
    grid-template-areas: "card";
    cursor: pointer;
    transform-origin: 50% 50%;
    border-radius: 6px;
    box-shadow:
        0 2px 6px  rgba(0,0,0,0.14),
        0 8px 28px rgba(0,0,0,0.12);
}

/* =========================
   Canvas Faces
   Both occupy the same grid cell and are exactly the card size.
   Back face starts hidden; JS swaps opacity at the flip midpoint.
========================= */

.postcard-face {
    grid-area: card;
    width: 560px;
    height: 350px;
    border-radius: 6px;
    display: block;
    transition: opacity 0s;
    flex-shrink: 0;
}

.postcard-face--back {
    opacity: 0;
}

/* =========================
   Navigation Controls
========================= */

.postcard-controls {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.postcard-controls button {
    font-family: 'Libre Franklin', sans-serif;
    font-weight: 400;
    font-size: 0.88rem;
    letter-spacing: 0.1em;
    padding: 0.55rem 1.1rem;
    background: white;
    border: 1px solid #d0ccc4;
    border-radius: 3px;
    cursor: pointer;
    color: #444;
    transition: background 0.15s;
}

.postcard-controls button:hover { background: #f5f0e8; }

#card-counter {
    font-size: 0.82rem;
    color: #999;
    min-width: 52px;
    text-align: center;
    letter-spacing: 0.03em;
}

/* =========================
   Postcard Form
========================= */

.postcard-form {
    width: 560px;
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
    margin-top: 2rem;
}

.postcard-form .form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
}

.postcard-form .form-group {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}

.postcard-form label {
    font-family: 'Libre Franklin', sans-serif;
    font-size: 0.85rem;
    font-weight: 400;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: #888;
}

.postcard-form input,
.postcard-form textarea {
    font-family: 'Libre Franklin', sans-serif;
    font-weight: 300;
    font-size: 1.05rem;
    padding: 0.62rem 0.78rem;
    border: 1px solid #d0ccc4;
    background: #fdfaf5;
    color: #1a1612;
    border-radius: 3px;
    transition: border-color 0.15s;
}

.postcard-form input:focus,
.postcard-form textarea:focus {
    outline: none;
    border-color: #a89878;
}

.postcard-form textarea {
    min-height: 88px;
    resize: vertical;
}

.postcard-form button[type="submit"] {
    font-family: 'Libre Franklin', sans-serif;
    font-weight: 400;
    font-size: 0.88rem;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    padding: 0.7rem 1.5rem;
    background: #2a1f0f;
    color: #f6e8cd;
    border: none;
    border-radius: 3px;
    cursor: pointer;
    align-self: flex-end;
    transition: opacity 0.15s;
}

.postcard-form button[type="submit"]:hover { opacity: 0.85; }

/* =========================
   Mobile
========================= */

@media (max-width: 620px) {

    header {
        padding-top: 2rem;
        padding-bottom: 1.25rem;
    }

    header h1 {
        font-size: 2.6rem;
        margin-bottom: 0.9rem;
    }

    main {
        padding: 0.75rem 1rem 3rem;
    }

    /* Postcard canvas is scaled in JS — stack just needs to
       be centred and not add side padding */
    .postcards-page {
        gap: 1.25rem;
    }

    .postcard-stack {
        width: 100%;
        display: flex;
        justify-content: center;
    }

    /* Form: full width, single column */
    .postcard-form {
        width: 100%;
    }

    .postcard-form .form-row {
        grid-template-columns: 1fr;
    }

    /* Controls: tighter */
    .postcard-controls {
        gap: 0.6rem;
    }

    .postcard-controls button {
        padding: 0.55rem 0.75rem;
        font-size: 0.82rem;
    }

    /* Gallery: single column, auto height so image isn't cropped */
    .horizontal-gallery {
        grid-template-columns: 1fr;
        max-width: 400px;
    }

    .project-panel {
        height: auto;
    }

    .project-panel img {
        height: auto;
        aspect-ratio: 4 / 3;
    }

    /* Diary strip */
    .diary-strip {
        gap: 4px;
    }

}
