@import url('https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;600;700&family=Playfair+Display:wght@500;600;700&display=swap');

:root {
    color-scheme: light dark;
    --ink: #24231f;
    --muted: #77766f;
    --paper: #f6f5f2;
    --white: #fff;
    --line: #e8e6e1;
    --accent: #c66855;
    --accent-dark: #a34a3b;
    --shadow: 0 18px 50px rgba(32, 29, 23, .08);
    font-family: "DM Sans", sans-serif;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    min-width: 320px;
    color: var(--ink);
    background: var(--paper);
}

a { color: inherit; text-decoration: none; }
button, select { font: inherit; }

.site-header {
    height: 76px;
    padding: 0 clamp(22px, 6vw, 92px);
    border-bottom: 1px solid rgba(36, 35, 31, .07);
}

.site-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 100%;
    max-width: 1440px;
    margin: 0 auto;
}

.site-preferences { display: flex; align-items: center; gap: 8px; }
.preference-select, .theme-toggle { min-height: 36px; border: 1px solid var(--line); border-radius: 6px; color: var(--ink); background: var(--white); font-size: 12px; }
.preference-select { padding: 0 8px; cursor: pointer; }
.theme-toggle { display: inline-flex; align-items: center; gap: 7px; padding: 0 10px; cursor: pointer; }
.theme-toggle:hover, .preference-select:hover { border-color: #c9c4ba; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; clip-path: inset(50%); }

.brand {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font-family: "Playfair Display", Georgia, serif;
    font-size: 25px;
    font-weight: 700;
    letter-spacing: -.7px;
}

.brand-mark { color: var(--accent); font-family: sans-serif; font-size: 21px; }
.nav-caption, .eyebrow { color: var(--muted); font-size: 10px; font-weight: 700; letter-spacing: 1.8px; }

.site-main {
    width: min(1240px, calc(100% - 48px));
    min-height: calc(100vh - 76px);
    margin: 0 auto;
    padding: 64px 0 96px;
}

.page-heading { margin: 0 0 40px; }
.page-heading .eyebrow, .album-heading .eyebrow { margin: 0 0 12px; }
h1, h2, p { margin-top: 0; }
h1, .album-card h2, .empty-state h2 { font-family: "Playfair Display", Georgia, serif; }
h1 { margin-bottom: 10px; font-size: clamp(38px, 6vw, 58px); font-weight: 600; letter-spacing: -1.6px; }
.subheading { color: var(--muted); font-size: 15px; }

.album-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 27px;
}

.album-card {
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--white);
    transition: transform .2s ease, box-shadow .2s ease;
}

.album-card:hover { transform: translateY(-4px); box-shadow: var(--shadow); }
.album-cover { position: relative; display: grid; height: 220px; place-items: center; overflow: hidden; background: #e9e6df; }
.album-cover img { width: 100%; height: 100%; object-fit: cover; transition: transform .35s ease; }
.album-card:hover .album-cover img { transform: scale(1.035); }
.photo-count { position: absolute; right: 12px; bottom: 12px; padding: 6px 10px; border-radius: 20px; color: #fff; background: rgba(25, 24, 21, .64); font-size: 11px; }
.album-card-copy { padding: 17px 19px 19px; }
.album-card h2 { margin: 0; font-size: 21px; font-weight: 600; }
.album-card-copy p { margin: 6px 0 0; color: var(--muted); font-size: 13px; }

.empty-state {
    padding: 68px 24px;
    border: 1px dashed #d8d5ce;
    border-radius: 14px;
    text-align: center;
    background: rgba(255,255,255,.55);
}

.empty-state h2 { margin: 14px 0 8px; font-size: 27px; }
.empty-state p { margin: 0; color: var(--muted); }
.empty-icon { color: #b6b1a6; font-size: 40px; }
.empty-state.compact { margin-top: 26px; padding: 48px 24px; }

.back-link { display: inline-block; margin-bottom: 27px; color: var(--muted); font-size: 13px; }
.back-link:hover { color: var(--accent-dark); }
.album-heading { display: flex; align-items: end; justify-content: space-between; gap: 24px; margin-bottom: 34px; }
.album-heading h1 { margin-bottom: 8px; }
.album-subtitle { margin: 0 0 10px; color: var(--muted); font-size: 17px; line-height: 1.5; }
.album-heading .subheading { margin-bottom: 0; }
.album-actions { display: flex; flex-wrap: wrap; align-items: center; justify-content: end; gap: 14px; }
.selection-count { color: var(--muted); font-size: 13px; }

.button { display: inline-flex; align-items: center; justify-content: center; gap: 9px; min-height: 43px; padding: 0 17px; border: 0; border-radius: 7px; cursor: pointer; font-size: 13px; font-weight: 600; transition: background .15s, color .15s; }
.button-primary { color: #fff; background: var(--accent); }
.button-primary:hover:not(:disabled) { background: var(--accent-dark); }
.button-primary:disabled { cursor: not-allowed; opacity: .46; }
.button-secondary { border: 1px solid var(--line); color: var(--ink); background: var(--white); }
.button-secondary:hover { border-color: #c9c4ba; }

.toolbar { display: flex; align-items: center; justify-content: space-between; gap: 18px; margin-bottom: 18px; padding: 14px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); color: var(--muted); font-size: 12px; }
.selection-controls { display: flex; align-items: center; gap: 8px; }
.selection-controls .button { min-height: 38px; padding: 0 12px; font-size: 12px; }
.selection-controls .button:disabled { cursor: default; opacity: .48; }
.slideshow-controls { display: flex; align-items: center; gap: 10px; }
.slideshow-controls select { min-height: 38px; padding: 0 28px 0 10px; border: 1px solid var(--line); border-radius: 6px; color: var(--ink); background: var(--white); }
.slideshow-controls label { white-space: nowrap; }

.photo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(205px, 1fr)); gap: 14px; }
.photo-card { position: relative; aspect-ratio: 4 / 3; overflow: hidden; border-radius: 9px; background: #e8e5df; }
.photo-open { display: block; width: 100%; height: 100%; padding: 0; border: 0; cursor: zoom-in; background: transparent; }
.photo-open img { display: block; width: 100%; height: 100%; object-fit: cover; transition: transform .3s ease; }
.photo-card:hover .photo-open img { transform: scale(1.035); }
.favorite-button { position: absolute; top: 10px; right: 10px; display: grid; width: 38px; height: 38px; place-items: center; border: 0; border-radius: 50%; color: #282520; background: rgba(255,255,255,.92); box-shadow: 0 2px 9px rgba(0,0,0,.14); cursor: pointer; font-size: 25px; line-height: 1; }
.favorite-button[aria-pressed="true"] { color: #fff; background: var(--accent); }
.favorite-button[aria-pressed="true"] span { transform: scale(1.05); }

.viewer { position: fixed; inset: 0; align-items: center; justify-content: center; width: 100vw; height: 100vh; height: 100dvh; max-width: none; max-height: none; margin: 0; padding: 60px 76px; overflow: hidden; border: 0; color: #fff; background: rgba(16, 16, 15, .96); }
.viewer:not([open]) { display: none; }
.viewer::backdrop { background: rgba(16,16,15,.96); }
.viewer[open] { display: flex; }
.viewer-topbar { position: absolute; top: 15px; right: 22px; left: 22px; display: flex; align-items: center; justify-content: space-between; color: rgba(255,255,255,.8); font-size: 13px; }
.viewer-close, .viewer-nav { display: grid; place-items: center; border: 0; color: #fff; background: transparent; cursor: pointer; }
.viewer-close { width: 42px; height: 42px; font-size: 34px; }
#viewer-image { display: block; width: auto; height: auto; max-width: min(100%, calc(100vw - 152px), 1920px); max-height: min(100%, calc(100dvh - 120px), 1080px); object-fit: contain; }
.viewer-nav { position: absolute; top: 50%; width: 54px; height: 70px; transform: translateY(-50%); font-size: 54px; font-weight: 300; }
.viewer-prev { left: 10px; }
.viewer-next { right: 10px; }
.viewer-nav:hover, .viewer-close:hover { color: #f0a08c; }
.slideshow-status { position: absolute; bottom: 18px; color: rgba(255,255,255,.68); font-size: 12px; }
.consent-dialog { width: min(520px, calc(100vw - 32px)); max-width: none; padding: 0; border: 1px solid var(--line); border-radius: 14px; color: var(--ink); background: var(--white); box-shadow: var(--shadow); }
.consent-dialog::backdrop { background: rgba(16, 16, 15, .66); backdrop-filter: blur(3px); }
.consent-content { padding: clamp(24px, 5vw, 36px); }
.consent-content .eyebrow { margin-bottom: 12px; }
.consent-content h2 { margin: 0 0 12px; font-family: "Playfair Display", Georgia, serif; font-size: 27px; }
.consent-content > p:not(.eyebrow) { color: var(--muted); font-size: 14px; line-height: 1.65; }
.consent-check { display: flex; align-items: flex-start; gap: 10px; margin: 22px 0; font-size: 13px; line-height: 1.5; cursor: pointer; }
.consent-check input { flex: 0 0 auto; width: 17px; height: 17px; margin: 1px 0 0; accent-color: var(--accent); }
.consent-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 10px; }
.consent-actions .button-primary:disabled { opacity: .46; cursor: not-allowed; }
.transition-fade { animation: fade-in .35s ease; }
.transition-slide { animation: slide-in .35s ease; }
@keyframes fade-in { from { opacity: .2; } to { opacity: 1; } }
@keyframes slide-in { from { opacity: .3; transform: translateX(24px); } to { opacity: 1; transform: translateX(0); } }

@media (max-width: 700px) {
    .site-header { height: 64px; padding: 0 20px; }
    .nav-caption { display: none; }
    .theme-toggle-label { display: none; }
    .site-main { width: min(100% - 36px, 540px); padding-top: 42px; }
    .album-grid { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 17px; }
    .album-cover { height: 190px; }
    .album-heading { align-items: start; flex-direction: column; }
    .album-actions { justify-content: start; }
    .toolbar { align-items: start; flex-direction: column; }
    .selection-controls { flex-wrap: wrap; }
    .slideshow-controls { flex-wrap: wrap; }
    .photo-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; }
    .viewer { padding: 56px 42px; }
    #viewer-image { max-width: min(100%, calc(100vw - 84px)); max-height: min(100%, calc(100dvh - 112px)); }
    .viewer-nav { width: 35px; }
    .viewer-prev { left: 0; }
    .viewer-next { right: 0; }
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        --ink: #eeece7;
        --muted: #aaa79e;
        --paper: #191a19;
        --white: #252624;
        --line: #393a37;
        --accent: #e48a72;
        --accent-dark: #f0a08c;
        --shadow: 0 18px 50px rgba(0, 0, 0, .3);
    }

    :root:not([data-theme="light"]) .site-header { border-bottom-color: rgba(255,255,255,.09); }
    :root:not([data-theme="light"]) .empty-state { border-color: #464741; background: rgba(255,255,255,.025); }
    :root:not([data-theme="light"]) .album-cover, :root:not([data-theme="light"]) .photo-card { background: #343531; }
    :root:not([data-theme="light"]) .photo-count { background: rgba(0,0,0,.72); }
    :root:not([data-theme="light"]) .favorite-button { color: #282520; }
}

:root[data-theme="dark"] {
    color-scheme: dark;
    --ink: #eeece7;
    --muted: #aaa79e;
    --paper: #191a19;
    --white: #252624;
    --line: #393a37;
    --accent: #e48a72;
    --accent-dark: #f0a08c;
    --shadow: 0 18px 50px rgba(0, 0, 0, .3);
}

:root[data-theme="light"] { color-scheme: light; }
:root[data-theme="dark"] .site-header { border-bottom-color: rgba(255,255,255,.09); }
:root[data-theme="dark"] .empty-state { border-color: #464741; background: rgba(255,255,255,.025); }
:root[data-theme="dark"] .album-cover, :root[data-theme="dark"] .photo-card { background: #343531; }
:root[data-theme="dark"] .photo-count { background: rgba(0,0,0,.72); }
:root[data-theme="dark"] .favorite-button { color: #282520; }

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
