:root {
  --forest: #233927;
  --forest-deep: #14241a;
  --leaf: #5e7e52;
  --cranberry: #8b2f3c;
  --gold: #d8a331;
  --cream: #f7f1e4;
  --paper: #fffdf8;
  --ink: #20241f;
  --muted: #667064;
  --line: #d9d8ca;
  --danger: #b8323f;
  --shadow: 0 18px 48px rgba(20, 36, 26, .18);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; color: var(--ink); background: var(--paper); font: 16px/1.55 Inter, "Segoe UI", Arial, sans-serif; }
button, input, select, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; }
[hidden] { display: none !important; }

.site-header { position: absolute; inset: 0 0 auto; z-index: 10; min-height: 78px; display: flex; align-items: center; justify-content: space-between; gap: 24px; padding: 14px clamp(20px, 4vw, 72px); color: white; border-bottom: 1px solid rgba(255,255,255,.25); background: rgba(19, 29, 21, .38); backdrop-filter: blur(8px); }
.brand { display: flex; align-items: center; gap: 12px; color: inherit; text-decoration: none; }
.brand-mark { width: 42px; height: 42px; display: grid; place-items: center; border: 1px solid var(--gold); color: var(--gold); font: 700 24px Georgia, serif; }
.brand span:last-child { display: grid; }
.brand strong { font: 700 19px Georgia, serif; }
.brand small { color: rgba(255,255,255,.72); font-size: 11px; text-transform: uppercase; letter-spacing: 0; }
.site-header nav { display: flex; align-items: center; gap: 6px; }
.nav-button, .icon-button { min-height: 42px; border: 0; color: white; background: transparent; }
.nav-button { padding: 8px 12px; border-bottom: 2px solid transparent; }
.nav-button:hover, .nav-button.active { border-color: var(--gold); }
.icon-button { width: 42px; font-size: 24px; }

.hero { position: relative; min-height: min(760px, 92vh); display: grid; align-items: center; color: white; background: #30432d url('/assets/erntedankfest-hero.png') center/cover no-repeat; overflow: hidden; }
.hero-shade { position: absolute; inset: 0; background: linear-gradient(90deg, rgba(9,17,12,.78) 0%, rgba(9,17,12,.38) 50%, rgba(9,17,12,.08) 100%), linear-gradient(0deg, rgba(9,17,12,.55), transparent 45%); }
.hero-content { position: relative; z-index: 1; width: min(680px, calc(100% - 40px)); margin: 70px max(20px, calc((100vw - 1240px)/2)); padding-top: 40px; }
.eyebrow { margin: 0 0 8px; color: var(--gold); font-weight: 800; font-size: 12px; text-transform: uppercase; letter-spacing: 0; }
.hero h1 { margin: 0; font: 700 clamp(54px, 8vw, 108px)/.95 Georgia, serif; }
.hero-content > p:not(.eyebrow) { max-width: 580px; margin: 24px 0 30px; font-size: clamp(18px, 2vw, 23px); text-wrap: balance; }
.hero-caption { position: absolute; z-index: 1; left: max(20px, calc((100vw - 1240px)/2)); bottom: 24px; margin: 0; color: rgba(255,255,255,.76); font-size: 13px; }

.primary-button, .secondary-button, .danger-button { min-height: 46px; padding: 11px 18px; border: 1px solid transparent; border-radius: 5px; font-weight: 750; }
.primary-button { color: #182117; background: var(--gold); box-shadow: 0 7px 18px rgba(91, 61, 10, .22); }
.primary-button:hover { background: #edb941; }
.secondary-button { color: var(--forest); border-color: #9ba999; background: white; }
.danger-button { color: white; background: var(--danger); }

.content-band { max-width: 1280px; margin: 0 auto; padding: 80px 24px 100px; }
.section-heading, .admin-heading, .panel-heading { display: flex; align-items: end; justify-content: space-between; gap: 28px; }
.section-heading { margin-bottom: 34px; }
.section-heading h2, .admin-heading h2 { margin: 0; font: 700 clamp(34px, 5vw, 58px)/1.05 Georgia, serif; }
.section-copy { max-width: 560px; margin: 12px 0 0; color: var(--muted); }
.segmented { display: flex; border: 1px solid var(--line); border-radius: 6px; overflow: hidden; }
.segmented button { min-height: 42px; padding: 8px 15px; border: 0; border-right: 1px solid var(--line); background: white; color: var(--muted); }
.segmented button:last-child { border: 0; }
.segmented button.active { color: white; background: var(--forest); }

.media-grid { display: grid; grid-template-columns: repeat(12, 1fr); gap: 18px; }
.media-card { grid-column: span 4; min-width: 0; border: 1px solid var(--line); border-radius: 6px; background: white; overflow: hidden; box-shadow: 0 8px 22px rgba(32,36,31,.07); }
.media-card.image-card button { width: 100%; padding: 0; border: 0; background: #dfe5db; }
.media-card img { display: block; width: 100%; aspect-ratio: 4/3; object-fit: cover; }
.media-body { padding: 18px; }
.media-body h3 { margin: 0 0 6px; font: 700 23px/1.2 Georgia, serif; }
.media-body p { margin: 0; color: var(--muted); }
.media-meta { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 14px; color: var(--muted); font-size: 12px; }
.privacy-tag { padding: 3px 8px; color: #6b4216; border: 1px solid #d9a866; border-radius: 4px; background: #fff3dc; font-weight: 700; }
.audio-card { grid-column: span 6; display: grid; grid-template-columns: 108px 1fr; align-items: stretch; }
.audio-art { display: grid; place-items: center; color: white; background: linear-gradient(145deg, var(--cranberry), var(--forest)); font: 700 44px Georgia, serif; }
.audio-card audio { width: 100%; margin-top: 16px; }
.empty-state { min-height: 230px; display: grid; place-content: center; gap: 6px; text-align: center; color: var(--muted); border-block: 1px solid var(--line); }
.empty-state strong { color: var(--ink); font: 700 23px Georgia, serif; }

.protected-view { min-height: 650px; }
.access-badge { padding: 7px 12px; color: white; border-radius: 4px; background: var(--cranberry); font-weight: 750; }
.locked-panel { max-width: 720px; padding: 44px; color: white; background: var(--forest); border-left: 5px solid var(--gold); box-shadow: var(--shadow); }
.locked-panel h3 { margin: 0; font: 700 32px Georgia, serif; }
.locked-panel p { max-width: 560px; color: #d6e0d4; }

.admin-view { padding: 110px 24px; color: #edf3eb; background: var(--forest-deep); }
.admin-shell { max-width: 1180px; margin: auto; }
.admin-heading { margin-bottom: 34px; }
.admin-heading .eyebrow { color: #efbd54; }
.admin-tabs { display: flex; gap: 2px; border-bottom: 1px solid #485a49; }
.admin-tabs button { min-height: 48px; padding: 10px 22px; border: 0; border-bottom: 3px solid transparent; color: #b8c5b7; background: transparent; font-weight: 750; }
.admin-tabs button.active { color: white; border-color: var(--gold); }
.admin-panel { padding: 34px 0; }
.panel-heading { margin-bottom: 24px; }
.panel-heading h3 { margin: 0; font: 700 28px Georgia, serif; }
.panel-heading span { color: #aeb9ad; }
.admin-media-list { display: grid; gap: 10px; }
.admin-media-row { display: grid; grid-template-columns: 70px minmax(0, 1fr) auto; align-items: center; gap: 16px; padding: 10px; border: 1px solid #435044; border-radius: 5px; background: #1b2d20; }
.admin-thumb { width: 70px; height: 58px; display: grid; place-items: center; object-fit: cover; color: white; background: var(--cranberry); font: 700 22px Georgia, serif; }
.admin-media-row h4 { margin: 0; font-size: 17px; }
.admin-media-row p { margin: 2px 0 0; color: #aeb9ad; font-size: 13px; }
.row-actions { display: flex; gap: 8px; }

label { display: grid; gap: 7px; }
label > span { font-weight: 750; font-size: 13px; }
input, select, textarea { width: 100%; min-height: 46px; padding: 10px 12px; color: var(--ink); border: 1px solid #9ea99d; border-radius: 5px; background: white; }
textarea { resize: vertical; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; padding: 28px; color: var(--ink); background: var(--cream); border-top: 4px solid var(--gold); }
.wide { grid-column: 1 / -1; }
.form-actions { display: flex; justify-content: flex-end; }
.progress-panel { margin-top: 16px; padding: 20px; color: var(--ink); background: white; }
.progress-panel > div { display: flex; justify-content: space-between; }
progress { width: 100%; height: 14px; accent-color: var(--leaf); }
.status { min-height: 24px; margin: 12px 0; color: #bfd3bc; }
.status.error { color: #ff9ca5; }
.invite-form { display: grid; grid-template-columns: 1fr 220px auto; align-items: end; gap: 14px; }
.invite-result { display: grid; grid-template-columns: 1fr auto; align-items: end; gap: 12px; margin-top: 20px; }
.people-columns { display: grid; grid-template-columns: 1fr 1fr; gap: 30px; margin-top: 38px; }
.people-columns h4 { font: 700 20px Georgia, serif; }
.person-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 0; border-bottom: 1px solid #435044; }
.person-row span { display: block; color: #aeb9ad; font-size: 12px; }
.compact { min-height: 140px; color: #b7c1b6; border-color: #435044; }

footer { display: flex; justify-content: space-between; gap: 20px; padding: 30px clamp(20px, 4vw, 72px); color: #cdd8cb; background: #0e1711; }
footer strong { color: var(--gold); font-family: Georgia, serif; }

dialog { width: min(520px, calc(100% - 32px)); padding: 0; border: 0; border-radius: 7px; box-shadow: 0 28px 90px rgba(0,0,0,.42); }
dialog::backdrop { background: rgba(8,15,10,.74); backdrop-filter: blur(4px); }
.dialog-form { position: relative; display: grid; gap: 16px; padding: 34px; }
.dialog-form h2 { margin: 0; font: 700 34px Georgia, serif; }
.dialog-form > p { margin: 0; color: var(--muted); }
.dialog-close, .lightbox-close { position: absolute; top: 10px; right: 12px; width: 42px; height: 42px; border: 0; color: var(--muted); background: transparent; font-size: 28px; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 10px; }
.lightbox { width: min(1040px, calc(100% - 32px)); color: white; background: #101611; }
.lightbox img { display: block; width: 100%; max-height: 72vh; object-fit: contain; background: black; }
.lightbox > div { padding: 18px 24px 24px; }
.lightbox h2 { margin: 0; font: 700 28px Georgia, serif; }
.lightbox p { margin: 6px 0 0; color: #bdc7bc; }
.lightbox-close { z-index: 2; color: white; background: rgba(0,0,0,.45); }

@media (max-width: 860px) {
  .site-header { align-items: flex-start; }
  .brand small { display: none; }
  .nav-button { padding-inline: 8px; }
  .media-card { grid-column: span 6; }
  .audio-card { grid-column: 1 / -1; }
  .invite-form { grid-template-columns: 1fr 1fr; }
  .invite-form button { grid-column: 1 / -1; }
}

@media (max-width: 600px) {
  .site-header { min-height: 68px; padding: 10px 12px; gap: 8px; }
  .brand-mark { width: 38px; height: 38px; }
  .brand strong { font-size: 16px; }
  .site-header nav { gap: 0; }
  .nav-button { min-height: 40px; font-size: 13px; }
  .hero { min-height: 680px; background-position: 60% center; }
  .hero-shade { background: linear-gradient(0deg, rgba(9,17,12,.82), rgba(9,17,12,.22) 72%); }
  .hero-content { align-self: end; margin: 0 20px 100px; padding: 0; }
  .hero h1 { font-size: clamp(50px, 16vw, 72px); overflow-wrap: anywhere; }
  .hero-caption { left: 20px; right: 20px; bottom: 20px; }
  .content-band { padding: 58px 16px 72px; }
  .section-heading { align-items: flex-start; flex-direction: column; }
  .segmented { width: 100%; }
  .segmented button { flex: 1; }
  .media-card, .audio-card { grid-column: 1 / -1; }
  .audio-card { grid-template-columns: 82px 1fr; }
  .audio-art { font-size: 34px; }
  .locked-panel { padding: 28px 22px; }
  .admin-view { padding: 72px 14px; }
  .admin-heading { align-items: flex-start; }
  .admin-tabs { overflow-x: auto; }
  .form-grid { grid-template-columns: 1fr; padding: 20px 16px; }
  .wide { grid-column: auto; }
  .admin-media-row { grid-template-columns: 56px minmax(0, 1fr); }
  .admin-thumb { width: 56px; height: 52px; }
  .row-actions { grid-column: 1 / -1; justify-content: flex-end; }
  .invite-form, .invite-result, .people-columns { grid-template-columns: 1fr; }
  .invite-form button { grid-column: auto; }
  footer { flex-direction: column; }
}

