:root {
    --ink: #171716;
    --muted: #77736c;
    --paper: #f5f2eb;
    --cream: #ebe5d9;
    --line: rgba(23, 23, 22, .13);
    --accent: #d36b44;
    --dark: #10110f;
    --serif: 'Iowan Old Style', 'Palatino Linotype', Georgia, serif;
    --sans: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

* { box-sizing: border-box; }
html { color-scheme: light; }
body { margin: 0; min-height: 100vh; font-family: var(--sans); color: var(--ink); background: var(--paper); }
button, input { font: inherit; }
button { cursor: pointer; }

.brand { display: inline-flex; align-items: center; gap: 10px; color: inherit; text-decoration: none; font-weight: 600; letter-spacing: -.02em; }
.brand-mark { display: grid; place-items: center; width: 31px; height: 31px; border: 1px solid currentColor; border-radius: 50%; font: italic 600 16px var(--serif); }
.eyebrow { display: block; margin-bottom: 15px; text-transform: uppercase; letter-spacing: .17em; font-size: 11px; font-weight: 600; color: var(--accent); }

.login-shell { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: #0c0d0f; }
.login-card { width: min(430px, 100%); }
.login-form { display: flex; gap: 10px; width: 100%; }
.login-form .password-field { flex: 1; }
.login-form .password-field input { height: 58px; padding: 0 17px; color: #fff; border-color: rgba(255,255,255,.2); background: rgba(255,255,255,.07); }
.login-form .password-field input:focus { border-color: rgba(255,255,255,.65); box-shadow: 0 0 0 3px rgba(255,255,255,.1); }
.login-form .primary-button { flex: 0 0 58px; width: 58px; min-height: 58px; margin: 0; padding: 0; color: var(--dark); background: #fff; border-radius: 11px; }
.login-form .primary-button span { margin: 0; }
.login-form.has-error .password-field input { border-color: #df725e; box-shadow: 0 0 0 3px rgba(223,114,94,.12); animation: login-error .28s ease; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
@keyframes login-error { 25% { transform: translateX(-5px); } 75% { transform: translateX(5px); } }
.login-art { position: relative; overflow: hidden; display: flex; flex-direction: column; justify-content: flex-end; padding: 56px; color: #f9f5eb; background: linear-gradient(155deg, rgba(20,22,18,.05), rgba(20,22,18,.82)), url('data:image/svg+xml,%3Csvg xmlns="http://www.w3.org/2000/svg" width="900" height="1100" viewBox="0 0 900 1100"%3E%3Cdefs%3E%3CradialGradient id="a" cx="30%25" cy="20%25" r="80%25"%3E%3Cstop offset="0" stop-color="%23cfa67c"/%3E%3Cstop offset=".5" stop-color="%236d7461"/%3E%3Cstop offset="1" stop-color="%23181d19"/%3E%3C/radialGradient%3E%3Cfilter id="n"%3E%3CfeTurbulence baseFrequency=".7" numOctaves="3" stitchTiles="stitch"/%3E%3CfeColorMatrix values="1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 .12 0"/%3E%3C/filter%3E%3C/defs%3E%3Crect width="900" height="1100" fill="url(%23a)"/%3E%3Ccircle cx="690" cy="280" r="250" fill="%23e8c9a1" opacity=".25"/%3E%3Cpath d="M0 780 Q230 610 420 760 T900 650 V1100 H0Z" fill="%23131613" opacity=".7"/%3E%3Crect width="900" height="1100" filter="url(%23n)" opacity=".55"/%3E%3C/svg%3E'); background-size: cover; }
.login-art::after { content: ''; position: absolute; inset: 18px; border: 1px solid rgba(255,255,255,.25); border-radius: 19px; }
.art-label { position: relative; z-index: 1; font-size: 11px; letter-spacing: .18em; text-transform: uppercase; opacity: .72; }
.login-art p { position: relative; z-index: 1; margin: 14px 0 0; font: 500 clamp(34px, 4vw, 54px)/1.02 var(--serif); letter-spacing: -.03em; }
.art-orb { position: absolute; border-radius: 50%; filter: blur(1px); border: 1px solid rgba(255,255,255,.28); }
.orb-one { width: 280px; height: 280px; right: -50px; top: 90px; }
.orb-two { width: 95px; height: 95px; right: 110px; top: 250px; background: rgba(255,255,255,.08); }
.login-form-wrap { display: flex; flex-direction: column; padding: 52px 64px 38px; }
.login-copy { margin: auto 0 34px; }
.login-copy h1 { margin: 0 0 16px; font: 600 clamp(40px, 4vw, 58px)/.98 var(--serif); letter-spacing: -.035em; }
.login-copy p, .modal-card > p { color: var(--muted); line-height: 1.6; }
.login-form label { display: block; margin-bottom: 9px; font-size: 12px; font-weight: 600; letter-spacing: .04em; }
.password-field { position: relative; }
.password-field input { width: 100%; height: 56px; padding: 0 70px 0 17px; border: 1px solid var(--line); border-radius: 11px; background: #fbfaf7; outline: none; transition: border-color .2s, box-shadow .2s; }
.password-field input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(211,107,68,.13); }
.icon-button { position: absolute; top: 50%; right: 10px; transform: translateY(-50%); padding: 9px; color: var(--muted); background: none; border: 0; font-size: 12px; }
.primary-button, .secondary-button { display: inline-flex; justify-content: center; align-items: center; gap: 16px; border: 0; border-radius: 12px; font-weight: 600; transition: transform .2s, background .2s; }
.primary-button { width: 100%; min-height: 56px; margin-top: 14px; padding: 14px 20px; color: #fff; background: var(--dark); }
.primary-button:hover, .secondary-button:hover { transform: translateY(-1px); }
.primary-button span { margin-left: auto; font-size: 20px; font-weight: 400; }
.privacy-note { margin: auto 0 0; padding-top: 30px; text-align: center; color: #96918a; font-size: 11px; }
.privacy-note span { color: #76a06b; font-size: 8px; }
.alert, .toast { padding: 12px 14px; border-radius: 10px; font-size: 13px; }
.alert { margin-bottom: 15px; color: #8c3326; background: #fff0eb; }

.topbar { position: sticky; z-index: 10; top: 0; display: flex; align-items: center; justify-content: space-between; height: 76px; padding: 0 clamp(20px, 5vw, 72px); border-bottom: 1px solid var(--line); background: rgba(245,242,235,.88); backdrop-filter: blur(18px); }
.top-actions { display: flex; align-items: center; gap: 12px; }
.top-actions form { margin: 0; }
.secondary-button { min-height: 43px; padding: 0 18px; color: #fff; background: var(--dark); }
.quiet-button { padding: 10px; border: 0; color: var(--muted); background: transparent; font-size: 13px; }
.gallery-shell { width: min(1380px, 100%); margin: 0 auto; padding: clamp(42px, 7vw, 90px) clamp(20px, 5vw, 72px) 90px; }
.gallery-heading { display: flex; align-items: flex-end; justify-content: space-between; margin-bottom: 45px; }
.gallery-heading h1 { margin: 0; font: 600 clamp(52px, 8vw, 94px)/.92 var(--serif); letter-spacing: -.055em; }
.gallery-heading p { margin: 18px 0 0; color: var(--muted); font-size: 13px; }
.floating-add { display: none; width: 52px; height: 52px; border: 0; border-radius: 50%; color: #fff; background: var(--accent); font-size: 25px; box-shadow: 0 10px 30px rgba(211,107,68,.3); }
.toast { margin: -22px 0 30px; color: #365233; background: #e7efe3; }
.photo-grid { columns: 4 260px; column-gap: 18px; }
.photo-card { break-inside: avoid; margin: 0 0 18px; overflow: hidden; border-radius: 16px; background: #fff; box-shadow: 0 8px 30px rgba(25,20,14,.06); opacity: 0; transform: translateY(12px); animation: reveal .55s ease forwards; }
.photo-card:nth-child(2n) { animation-delay: 35ms; }
.photo-card:nth-child(3n) { animation-delay: 70ms; }
.photo-card:nth-child(5n) { animation-delay: 105ms; }
.photo-open { display: block; width: 100%; padding: 0; border: 0; background: #ddd; }
.photo-open img { display: block; width: 100%; min-height: 180px; max-height: 520px; object-fit: cover; transition: transform .5s ease; user-select: none; -webkit-user-drag: none; }
.photo-card:hover img { transform: scale(1.018); }
.photo-meta { display: flex; align-items: center; justify-content: space-between; padding: 13px 15px; color: var(--muted); font-size: 10px; letter-spacing: .08em; text-transform: uppercase; }
.delete-form { margin: 0; }
.delete-button { padding: 4px; border: 0; color: #a05849; background: transparent; font-size: 10px; text-transform: uppercase; letter-spacing: .08em; }
.empty-state { display: grid; place-items: center; max-width: 640px; margin: 70px auto; padding: 65px 30px; text-align: center; border: 1px dashed rgba(23,23,22,.2); border-radius: 24px; }
.empty-icon { display: grid; place-items: center; width: 55px; height: 55px; border-radius: 50%; color: var(--accent); background: #eee1d6; font-size: 23px; }
.empty-state h2 { margin: 20px 0 8px; font: 600 32px var(--serif); }
.empty-state p { max-width: 430px; margin: 0 0 12px; color: var(--muted); line-height: 1.6; }
.empty-state .primary-button { width: auto; min-width: 210px; }

.modal, .lightbox { padding: 0; border: 0; background: transparent; }
.modal::backdrop, .lightbox::backdrop { background: rgba(10,10,9,.72); backdrop-filter: blur(8px); }
.modal-card { position: relative; width: min(520px, calc(100vw - 28px)); padding: 38px; border-radius: 22px; background: var(--paper); box-shadow: 0 30px 80px rgba(0,0,0,.25); }
.modal-card h2 { margin: 0; font: 600 38px var(--serif); }
.modal-close, .lightbox-close { position: absolute; top: 16px; right: 16px; z-index: 2; width: 38px; height: 38px; border: 0; border-radius: 50%; font-size: 24px; }
.modal-close { color: var(--ink); background: var(--cream); }
.dropzone { display: grid; place-items: center; min-height: 200px; margin: 25px 0 6px; padding: 25px; text-align: center; border: 1px dashed rgba(23,23,22,.25); border-radius: 15px; background: rgba(255,255,255,.55); }
.dropzone input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.drop-icon { display: grid; place-items: center; width: 45px; height: 45px; margin-bottom: 12px; border-radius: 50%; color: #fff; background: var(--accent); font-size: 22px; }
.file-summary { margin-top: 5px; color: var(--muted); font-size: 12px; }
.lightbox { width: 100vw; height: 100vh; max-width: none; max-height: none; color: #fff; }
.lightbox[open] { display: grid; grid-template-rows: minmax(0, 1fr) auto; place-items: center; padding: 54px 22px 22px; }
.lightbox-stage { display: grid; grid-template-columns: 52px minmax(0, 1fr) 52px; align-items: center; gap: clamp(8px, 2vw, 24px); width: min(1220px, 100%); min-height: 0; }
.lightbox img { justify-self: center; max-width: 100%; max-height: calc(100vh - 145px); border-radius: 10px; box-shadow: 0 30px 90px #000; user-select: none; -webkit-user-drag: none; }
.lightbox-close { position: fixed; color: #fff; background: rgba(0,0,0,.45); }
.lightbox-nav { display: grid; place-items: center; width: 52px; height: 52px; padding: 0 0 5px; border: 1px solid rgba(255,255,255,.22); border-radius: 50%; color: #fff; background: rgba(0,0,0,.42); font: 300 44px/1 var(--sans); backdrop-filter: blur(10px); transition: background .2s, transform .2s; }
.lightbox-nav:hover { background: rgba(255,255,255,.18); transform: scale(1.04); }
.lightbox-nav[hidden], .lightbox-play[hidden] { display: none; }
.lightbox-toolbar { position: relative; display: grid; grid-template-columns: 65px auto 65px; align-items: center; gap: 15px; min-width: 260px; margin-top: 13px; padding: 9px 13px 13px; border: 1px solid rgba(255,255,255,.14); border-radius: 999px; background: rgba(0,0,0,.48); backdrop-filter: blur(12px); }
.lightbox-counter { text-align: center; color: rgba(255,255,255,.75); font-size: 12px; font-variant-numeric: tabular-nums; }
.lightbox-play { display: inline-flex; align-items: center; justify-content: center; gap: 7px; padding: 5px 10px; border: 0; color: #fff; background: transparent; font-size: 11px; font-weight: 700; letter-spacing: .12em; }
.play-icon { min-width: 12px; font-size: 10px; letter-spacing: -.15em; }
.play-progress { position: absolute; right: 16px; bottom: 7px; left: 16px; height: 2px; overflow: hidden; border-radius: 2px; background: rgba(255,255,255,.18); }
.play-progress span { display: block; width: 100%; height: 100%; background: var(--accent); transform: scaleX(0); transform-origin: left; }
.play-progress.is-running span { animation: slideshow-progress 5s linear forwards; }
@keyframes slideshow-progress { to { transform: scaleX(1); } }
@keyframes reveal { to { opacity: 1; transform: none; } }

@media (max-width: 800px) {
    .topbar { height: 66px; }
    .topbar .secondary-button { display: none; }
    .gallery-shell { padding-top: 45px; }
    .gallery-heading { align-items: center; margin-bottom: 30px; }
    .gallery-heading h1 { font-size: 54px; }
    .floating-add { display: block; }
    .photo-grid { columns: 2 145px; column-gap: 10px; }
    .photo-card { margin-bottom: 10px; border-radius: 11px; }
    .photo-meta { padding: 10px; }
    .modal-card { padding: 30px 22px 24px; }
    .lightbox[open] { padding: 54px 12px 16px; }
    .lightbox-stage { display: block; width: 100%; }
    .lightbox img { display: block; max-height: calc(100vh - 145px); margin: auto; }
    .lightbox-nav { position: fixed; z-index: 2; top: 50%; width: 44px; height: 44px; padding-bottom: 4px; font-size: 38px; transform: translateY(-50%); }
    .lightbox-nav:hover { transform: translateY(-50%) scale(1.04); }
    .lightbox-prev { left: 12px; }
    .lightbox-next { right: 12px; }
    .lightbox-toolbar { margin-top: 10px; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
