:root {
  --ink: #f1eee6;
  --muted: #a9a69e;
  --line: rgba(255,255,255,.12);
  --surface: #151515;
  --surface-2: #1c1c1b;
  --accent: #d7b36a;
  --bg: #0b0b0b;
  --max: 1500px;
}

* { box-sizing: border-box; }
html { background: var(--bg); scroll-behavior: smooth; }
body { margin: 0; min-height: 100vh; color: var(--ink); background: radial-gradient(circle at 15% -10%, #27241e 0, transparent 28rem), var(--bg); font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; }
a { color: inherit; }
img { display: block; max-width: 100%; }
button, input, select { font: inherit; }
button, .button-link { border: 1px solid var(--accent); color: #111; background: var(--accent); border-radius: 999px; padding: .8rem 1.2rem; font-weight: 750; cursor: pointer; text-decoration: none; }
button:hover, .button-link:hover { filter: brightness(1.08); }

.site-header, .site-footer, main { width: min(calc(100% - 2.5rem), var(--max)); margin-inline: auto; }
.site-header { min-height: 92px; display: flex; align-items: center; justify-content: space-between; gap: 2rem; border-bottom: 1px solid var(--line); }
.site-header p { margin: 0; color: var(--muted); font-size: .9rem; letter-spacing: .04em; }
.wordmark { display: inline-flex; align-items: center; gap: .8rem; text-decoration: none; font-family: Georgia, "Times New Roman", serif; font-size: clamp(1.1rem, 2vw, 1.4rem); }
.aperture { width: 1.65rem; aspect-ratio: 1; border: 1px solid var(--accent); border-radius: 50%; position: relative; box-shadow: inset 0 0 0 5px var(--bg); background: var(--accent); }
.aperture::after { content: ""; position: absolute; inset: 7px; background: var(--bg); border-radius: 50%; }
.site-footer { margin-top: 6rem; min-height: 100px; border-top: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; color: var(--muted); font-size: .85rem; }
.admin-link { color: var(--muted); text-decoration: none; border: 1px solid var(--line); border-radius: 999px; padding: .5rem .8rem; }
.admin-link:hover { color: var(--ink); border-color: var(--muted); }

.gallery-shell, .admin-shell { padding-top: 2.5rem; }
.breadcrumbs { display: flex; flex-wrap: wrap; align-items: center; gap: .55rem; color: var(--muted); font-size: .85rem; }
.breadcrumbs a { text-decoration: none; }
.breadcrumbs a:hover { color: var(--ink); }
.section-heading, .admin-heading { margin: 2.5rem 0 2rem; display: flex; align-items: end; justify-content: space-between; gap: 2rem; }
.section-heading h1, .admin-heading h1 { margin: .2rem 0 0; font: 500 clamp(2.4rem, 7vw, 5.5rem)/.95 Georgia, "Times New Roman", serif; letter-spacing: -.04em; }
.eyebrow { margin: 0; color: var(--accent); font-size: .72rem; font-weight: 800; letter-spacing: .18em; text-transform: uppercase; }
.item-count { color: var(--muted); margin: 0; white-space: nowrap; }

.folder-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 290px), 1fr)); gap: 1.2rem; margin-bottom: 4rem; }
.folder-card { min-width: 0; text-decoration: none; border: 1px solid var(--line); border-radius: 4px; padding: .7rem; background: linear-gradient(145deg, rgba(255,255,255,.045), transparent); transition: transform .2s ease, border-color .2s ease; }
.folder-card:hover { transform: translateY(-4px); border-color: rgba(215,179,106,.55); }
.folder-cover { position: relative; aspect-ratio: 4/3; overflow: hidden; background: #201f1c; clip-path: polygon(0 8%, 25% 8%, 30% 0, 54% 0, 59% 8%, 100% 8%, 100% 100%, 0 100%); }
.folder-cover img { width: 100%; height: 100%; object-fit: cover; opacity: .72; filter: saturate(.75); transition: transform .4s ease, opacity .3s ease; }
.folder-card:hover img { transform: scale(1.035); opacity: .92; }
.empty-cover { position: absolute; inset: 0; background: linear-gradient(135deg, #302c23, #181817); }
.folder-label { display: flex; justify-content: space-between; align-items: center; gap: 1rem; padding: 1rem .35rem .35rem; }
.folder-label strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font: 500 1.15rem Georgia, serif; }
.folder-label > span { color: var(--muted); font-size: .75rem; white-space: nowrap; }

.photo-grid { columns: 4 250px; column-gap: 1rem; }
.photo-card { display: inline-block; width: 100%; margin: 0 0 1rem; position: relative; overflow: hidden; background: var(--surface); text-decoration: none; }
.photo-card img { width: 100%; height: auto; transition: transform .45s ease, filter .45s ease; }
.photo-card > span { position: absolute; inset: auto 0 0; padding: 2.8rem .8rem .7rem; color: white; font-size: .82rem; background: linear-gradient(transparent, rgba(0,0,0,.78)); opacity: 0; transform: translateY(.3rem); transition: opacity .2s ease, transform .2s ease; }
.photo-card:hover img { transform: scale(1.02); filter: brightness(.78); }
.photo-card:hover > span, .photo-card:focus-visible > span { opacity: 1; transform: translateY(0); }

.empty-state { min-height: 45vh; display: grid; place-content: center; text-align: center; color: var(--muted); }
.empty-state h1, .empty-state h2 { color: var(--ink); font: 500 clamp(1.8rem, 5vw, 3rem) Georgia, serif; margin: 1rem 0 .4rem; }
.empty-state p { margin: 0 0 1.5rem; }
.empty-mark { font-size: 4rem; color: var(--line); }
.error-state { min-height: 60vh; }

.photo-view-page .site-header { display: none; }
.photo-view-page main { width: 100%; }
.photo-view-page .site-footer { margin-top: 1.5rem; }
.photo-viewer { min-height: calc(100vh - 120px); display: flex; flex-direction: column; }
.viewer-topbar { width: min(calc(100% - 2rem), var(--max)); min-height: 64px; margin: 0 auto; display: flex; align-items: center; justify-content: space-between; color: var(--muted); font-size: .85rem; }
.back-link { text-decoration: none; }
.back-link:hover { color: var(--ink); }
.image-stage { flex: 1; min-height: 65vh; position: relative; display: grid; place-items: center; background: #050505; }
.image-stage > img { max-width: 100%; max-height: calc(100vh - 155px); width: auto; height: auto; object-fit: contain; }
.viewer-arrow { position: absolute; z-index: 2; top: 50%; transform: translateY(-50%); width: 3rem; height: 4.5rem; display: grid; place-items: center; border: 1px solid rgba(255,255,255,.25); background: rgba(10,10,10,.58); backdrop-filter: blur(6px); text-decoration: none; font-size: 2.5rem; border-radius: 3px; }
.viewer-arrow:hover { background: rgba(215,179,106,.88); color: #111; }
.arrow-left { left: 1rem; }
.arrow-right { right: 1rem; }
.image-caption { width: min(calc(100% - 2rem), var(--max)); margin: 0 auto; padding: 1rem 0; display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; }
.image-caption h1 { margin: 0; font: 500 1.2rem Georgia, serif; }
.image-caption p { margin: 0; color: var(--muted); font-size: .75rem; }

.login-shell { min-height: 68vh; display: grid; place-items: center; padding: 3rem 0; }
.panel { border: 1px solid var(--line); border-radius: 6px; padding: clamp(1.3rem, 3vw, 2rem); background: rgba(24,24,23,.9); }
.login-panel { width: min(100%, 460px); }
.panel h1, .panel h2 { font-family: Georgia, serif; font-weight: 500; }
.panel h1 { margin: .5rem 0; font-size: 2.1rem; }
.panel h2 { margin-top: 0; }
.panel-intro, .maintenance-panel p { color: var(--muted); line-height: 1.6; }
label { display: grid; gap: .45rem; margin: 1.1rem 0; color: #d6d3ca; font-size: .85rem; }
input, select { width: 100%; border: 1px solid var(--line); border-radius: 4px; padding: .8rem; color: var(--ink); background: #0d0d0d; outline: none; }
input:focus, select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(215,179,106,.12); }
.notice { border-left: 3px solid var(--accent); background: rgba(215,179,106,.1); padding: .8rem 1rem; }
.notice.error { border-color: #d96b64; background: rgba(217,107,100,.1); }
.notice.success { border-color: #7eba91; background: rgba(126,186,145,.1); }
.button-secondary { color: var(--ink); border-color: var(--line); background: transparent; }

.admin-heading { align-items: center; }
.stat-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; margin: 2rem 0; }
.stat-grid > div { display: grid; padding: 1.5rem; border: 1px solid var(--line); background: rgba(255,255,255,.025); }
.stat-grid strong { font: 500 2.3rem Georgia, serif; color: var(--accent); }
.stat-grid span { color: var(--muted); font-size: .8rem; }
.admin-grid { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(300px, .8fr); gap: 1rem; }
.maintenance-panel code { display: block; overflow-wrap: anywhere; margin: 1rem 0; padding: .8rem; border: 1px solid var(--line); background: #0c0c0c; color: var(--accent); }
.maintenance-panel hr { border: 0; border-top: 1px solid var(--line); margin: 2rem 0; }
.path-help { margin-top: -.4rem; font-size: .8rem; }
.approved-roots { margin: 0 0 1.4rem; padding: 0; list-style: none; }
.approved-roots code { margin: .45rem 0; padding: .55rem .7rem; font-size: .72rem; }

@media (max-width: 740px) {
  .site-header { min-height: 78px; }
  .site-header p { display: none; }
  .section-heading { display: block; }
  .item-count { margin-top: 1rem; white-space: normal; }
  .folder-label > span { display: none; }
  .stat-grid { grid-template-columns: 1fr; }
  .admin-grid { grid-template-columns: 1fr; }
  .viewer-arrow { width: 2.6rem; height: 4rem; }
  .arrow-left { left: .35rem; }
  .arrow-right { right: .35rem; }
  .image-caption { align-items: start; flex-direction: column; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; }
}
