/* ---------- Design tokens ---------- */
:root {
    --color-bg: #ffffff;
    --color-bg-alt: #f5f4f1;
    --color-surface: #ffffff;
    --color-text: #14151a;
    --color-text-muted: #5b5f6b;
    --color-border: #e6e4e0;
    --color-accent: #2b6cb0;
    --color-accent-contrast: #ffffff;

    --font-display: -apple-system, "Segoe UI", ui-sans-serif, system-ui, Roboto, Helvetica, Arial, sans-serif;
    --font-body: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;

    --space-1: 0.25rem;
    --space-2: 0.5rem;
    --space-3: 1rem;
    --space-4: 1.5rem;
    --space-5: 2.5rem;
    --space-6: 4rem;
    --space-7: 6rem;

    --radius: 16px;
    --radius-sm: 10px;
    --shadow: 0 20px 45px -20px rgba(20, 21, 26, 0.35);
    --shadow-sm: 0 8px 20px -12px rgba(20, 21, 26, 0.3);
    --max-width: 1200px;
}

@media (prefers-color-scheme: dark) {
    :root {
        --color-bg: #0e1014;
        --color-bg-alt: #15171d;
        --color-surface: #1a1d24;
        --color-text: #f2f1ee;
        --color-text-muted: #a3a7b3;
        --color-border: #272a33;
        --shadow: 0 20px 45px -18px rgba(0, 0, 0, 0.6);
        --shadow-sm: 0 8px 20px -12px rgba(0, 0, 0, 0.55);
    }
}

/* ---------- Reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { color-scheme: light dark; }
body {
    margin: 0;
    background: var(--color-bg);
    color: var(--color-text);
    font-family: var(--font-body);
    font-size: 17px;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
ul { margin: 0; padding: 0; list-style: none; }
h1, h2, h3, h4 { font-family: var(--font-display); font-weight: 800; line-height: 1.15; margin: 0 0 var(--space-3); letter-spacing: -0.01em; }
p { margin: 0 0 var(--space-3); }

.wrap { max-width: var(--max-width); margin: 0 auto; padding: 0 var(--space-4); }

/* ---------- Site header ---------- */
.site-header {
    position: sticky;
    top: 0;
    z-index: 20;
    backdrop-filter: blur(10px);
    background: color-mix(in srgb, var(--color-bg) 85%, transparent);
    border-bottom: 1px solid var(--color-border);
}
.site-header .wrap { display: flex; align-items: center; justify-content: space-between; padding-block: var(--space-3); }
.site-brand { font-family: var(--font-display); font-weight: 800; font-size: 1.25rem; letter-spacing: -0.02em; }
.site-nav { display: flex; gap: var(--space-4); }
.site-nav a { font-weight: 600; color: var(--color-text-muted); transition: color 0.15s ease; }
.site-nav a:hover, .site-nav a:focus-visible { color: var(--color-text); }

/* ---------- Hero ---------- */
.hero {
    position: relative;
    display: flex;
    align-items: flex-end;
    min-height: clamp(280px, 45vh, 640px);
    color: #fff;
    background: linear-gradient(135deg, var(--color-accent), #14151a);
    background-size: cover;
    background-position: center;
    overflow: hidden;
}
.hero::after {
    content: "";
    position: absolute;
    inset: 0;
    z-index: 0;
    background: linear-gradient(0deg, rgba(10, 10, 14, 0.85) 0%, rgba(10, 10, 14, 0.45) 55%, rgba(10, 10, 14, 0.3) 100%);
}
.hero-content { position: relative; z-index: 1; padding-block: var(--space-6) var(--space-5); width: 100%; text-shadow: 0 2px 16px rgba(0, 0, 0, 0.6), 0 1px 3px rgba(0, 0, 0, 0.5); }
.hero-eyebrow { font-weight: 700; text-transform: uppercase; letter-spacing: 0.14em; font-size: 0.8rem; color: #f2f1ee; opacity: 0.85; margin-bottom: var(--space-2); }
.hero h1 { font-size: clamp(2.25rem, 5vw, 4rem); color: #f2f1ee; margin-bottom: var(--space-3); max-width: 20ch; }
.hero p { font-size: 1.15rem; max-width: 60ch; color: #f2f1ee; opacity: 1; }
.hero-content .more { display: inline-block; margin-top: var(--space-2); font-weight: 700; text-decoration: underline; text-underline-offset: 3px; }
.hero-content .more:hover, .hero-content .more:focus-visible { opacity: 0.85; }

/* ---------- Sections ---------- */
.section { padding-block: var(--space-6); }
.section-heading { display: flex; align-items: baseline; justify-content: space-between; gap: var(--space-3); margin-bottom: var(--space-4); flex-wrap: wrap; }
.section-heading h2 { font-size: 1.75rem; margin: 0; }
.section-heading .more { font-weight: 700; color: var(--color-accent); }

/* ---------- Collection cards ---------- */
.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: var(--space-4); }
.collection-card {
    position: relative;
    border-radius: var(--radius);
    overflow: hidden;
    min-height: 320px;
    display: flex;
    align-items: flex-end;
    background: var(--color-accent);
    background-size: cover;
    background-position: center;
    box-shadow: var(--shadow-sm);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.collection-card:hover, .collection-card:focus-visible { transform: translateY(-4px); box-shadow: var(--shadow); }
.collection-card::after {
    content: "";
    position: absolute; inset: 0;
    z-index: 0;
    background: linear-gradient(0deg, rgba(0,0,0,0.78) 0%, rgba(0,0,0,0.3) 60%);
}
.collection-card-body { position: relative; z-index: 1; padding: var(--space-4); color: #f2f1ee; text-shadow: 0 1px 8px rgba(0, 0, 0, 0.5); }
.collection-card-tag {
    display: inline-block;
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    padding: 0.25em 0.7em;
    border-radius: 999px;
    background: rgba(255,255,255,0.18);
    margin-bottom: var(--space-2);
}
.collection-card h3 { color: #f2f1ee; font-size: 1.4rem; margin-bottom: var(--space-1); }
.collection-card p { color: rgba(242,241,238,0.85); font-size: 0.95rem; margin: 0; }

/* ---------- Gallery grid ---------- */
.gallery-meta { color: var(--color-text-muted); margin-bottom: var(--space-4); }
.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: var(--space-3);
}
.gallery-grid a {
    position: relative;
    display: block;
    border-radius: var(--radius-sm);
    overflow: hidden;
    aspect-ratio: 4 / 3;
    background: var(--color-bg-alt);
    box-shadow: var(--shadow-sm);
}
.gallery-grid img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.35s ease; }
.gallery-grid a:hover img, .gallery-grid a:focus-visible img { transform: scale(1.06); }
.gallery-grid figcaption {
    position: absolute; left: 0; right: 0; bottom: 0;
    padding: var(--space-2) var(--space-2) var(--space-1);
    font-size: 0.82rem;
    color: #fff;
    background: linear-gradient(0deg, rgba(0,0,0,0.75), transparent);
    opacity: 0;
    transition: opacity 0.2s ease;
}
.gallery-grid a:hover figcaption, .gallery-grid a:focus-visible figcaption { opacity: 1; }

/* ---------- Gallery card (used on collection page) ---------- */
.gallery-card { display: block; border-radius: var(--radius); overflow: hidden; background: var(--color-surface); box-shadow: var(--shadow-sm); transition: transform 0.2s ease; }
.gallery-card:hover, .gallery-card:focus-visible { transform: translateY(-3px); }
.gallery-card img { aspect-ratio: 4 / 3; object-fit: cover; }
.gallery-card-body { padding: var(--space-3); }
.gallery-card-body h3 { font-size: 1.1rem; margin-bottom: 0.2em; }
.gallery-card-body .count { color: var(--color-text-muted); font-size: 0.85rem; }

/* ---------- Lightbox ---------- */
.lightbox {
    position: fixed; inset: 0; z-index: 100;
    display: none;
    align-items: center; justify-content: center;
    background: rgba(6, 7, 10, 0.92);
    padding: var(--space-4);
}
.lightbox.is-open { display: flex; }
.lightbox img { max-width: min(92vw, 1400px); max-height: 78vh; border-radius: 6px; box-shadow: var(--shadow); }
.lightbox-figure { display: flex; flex-direction: column; align-items: center; gap: var(--space-2); max-width: 100%; }
.lightbox-caption { color: #f2f1ee; text-align: center; max-width: 70ch; }
.lightbox-close, .lightbox-prev, .lightbox-next {
    position: fixed;
    background: rgba(255,255,255,0.1);
    border: none;
    color: #fff;
    font-size: 1.5rem;
    line-height: 1;
    width: 48px; height: 48px;
    border-radius: 999px;
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    transition: background 0.15s ease;
}
.lightbox-close:hover, .lightbox-prev:hover, .lightbox-next:hover { background: rgba(255,255,255,0.22); }
.lightbox-close { top: var(--space-4); right: var(--space-4); }
.lightbox-prev { left: var(--space-4); top: 50%; transform: translateY(-50%); }
.lightbox-next { right: var(--space-4); top: 50%; transform: translateY(-50%); }
@media (max-width: 640px) {
    .lightbox-prev, .lightbox-next { width: 40px; height: 40px; font-size: 1.2rem; }
}

/* ---------- Diary ---------- */
.diary-list { display: flex; flex-direction: column; gap: var(--space-3); }
.diary-row {
    display: grid;
    grid-template-columns: 140px 1fr;
    gap: var(--space-3);
    align-items: baseline;
    padding-block: var(--space-2);
    border-bottom: 1px solid var(--color-border);
}
.diary-row time { color: var(--color-text-muted); font-size: 0.9rem; }
.diary-row h3 { font-size: 1.05rem; margin: 0 0 0.2em; }
.diary-row .collection-tag { font-size: 0.78rem; font-weight: 700; color: var(--color-accent); text-transform: uppercase; letter-spacing: 0.06em; }
@media (max-width: 560px) {
    .diary-row { grid-template-columns: 1fr; gap: var(--space-1); }
}

article.diary-entry { max-width: 72ch; }
article.diary-entry h1 { font-size: clamp(2rem, 4vw, 2.75rem); }
article.diary-entry p { font-size: 1.05rem; }

/* ---------- Diary entry layout (photos run down the side on wide screens) ---------- */
.diary-layout {
    display: grid;
    grid-template-columns: 1fr;
    grid-template-areas: "header" "photos" "body";
    gap: var(--space-4);
    align-items: start;
}
.diary-header { grid-area: header; max-width: 72ch; }
.diary-header .entry-meta { color: var(--color-text-muted); margin-bottom: var(--space-2); }
.diary-header h1 { font-size: clamp(2rem, 4vw, 2.75rem); margin: 0; }
.diary-photos { grid-area: photos; display: flex; flex-direction: column; gap: var(--space-3); }
.diary-photos a { display: block; border-radius: var(--radius-sm); overflow: hidden; box-shadow: var(--shadow-sm); }
.diary-photos img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; }
.diary-photos figcaption { padding: 0.5em 0.1em 0; font-size: 0.85rem; color: var(--color-text-muted); }
.diary-entry-body { grid-area: body; max-width: 72ch; }

@media (min-width: 860px) {
    .diary-layout {
        grid-template-columns: minmax(0, 1fr) 280px;
        grid-template-areas: "header header" "body photos";
    }
    .diary-photos { position: sticky; top: calc(64px + var(--space-3)); }
}

.pagination { display: flex; justify-content: space-between; margin-top: var(--space-5); }
.pagination a, .pagination span {
    padding: 0.6em 1.1em;
    border-radius: 999px;
    border: 1px solid var(--color-border);
    font-weight: 600;
}
.pagination a:hover { border-color: var(--color-accent); color: var(--color-accent); }
.pagination .disabled { opacity: 0.4; }

/* Diary entry prev/next: pinned under the site header so it's reachable without scrolling to the end of a long entry. */
.diary-entry-nav {
    position: sticky;
    top: 64px;
    z-index: 15;
    margin-top: 0;
    margin-bottom: var(--space-4);
    padding-block: var(--space-2);
    background: var(--color-bg);
    border-bottom: 1px solid var(--color-border);
}
.diary-entry-nav a, .diary-entry-nav span { font-size: 0.92rem; }

/* ---------- Footer ---------- */
.site-footer { border-top: 1px solid var(--color-border); padding-block: var(--space-4); color: var(--color-text-muted); font-size: 0.9rem; }

/* ---------- Misc ---------- */
.btn {
    display: inline-block;
    padding: 0.75em 1.4em;
    border-radius: 999px;
    background: var(--color-accent);
    color: #fff;
    font-weight: 700;
}
.empty-state { color: var(--color-text-muted); padding-block: var(--space-5); }
