/* ============================================================
   Velvet & candlelight theme
   ============================================================ */
:root {
  --ink: #f5ebde;
  --muted: #c4b0a0;
  --gold: #d2a964;
  --gold-2: #f1d197;
  --wine: #2a0d14;
  --line: rgba(210, 169, 100, .28);
  --panel: rgba(22, 8, 12, .76);
  --panel-2: rgba(30, 11, 16, .9);
  --field: rgba(255, 245, 230, .06);
  --danger: #e7837b;
  --ok: #96cfa0;
  --radius: 14px;
  --serif: 'Cormorant Garamond', Georgia, 'Times New Roman', serif;
  --sans: 'Jost', system-ui, -apple-system, 'Segoe UI', sans-serif;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0; min-height: 100vh; display: flex; flex-direction: column;
  background: #12060a; color: var(--ink);
  font: 300 17px/1.65 var(--sans);
}
img, video { max-width: 100%; display: block; }
a { color: var(--gold-2); text-underline-offset: 3px; }
a:hover { color: #fff; }
h1, h2, h3 { font-family: var(--serif); font-weight: 600; line-height: 1.1; color: var(--gold-2); margin: 0 0 .5em; }
h2 { font-size: 1.9rem; }
h3 { font-size: 1.35rem; }
p { margin: 0 0 1em; }
code { font-family: ui-monospace, 'SF Mono', Menlo, Consolas, monospace; font-size: .92em; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.center { text-align: center; }
.nowrap { white-space: nowrap; }
.eyebrow { text-transform: uppercase; letter-spacing: .32em; font-size: .75rem; color: var(--gold); margin-bottom: .6em; font-weight: 400; }

/* ---------- background ---------- */
.bg { position: fixed; inset: 0; z-index: -2; background: #12060a url(../img/background.jpg) center right / cover no-repeat; }
.bg-shade {
  position: fixed; inset: 0; z-index: -1;
  background:
    linear-gradient(90deg, rgba(14,5,8,.94) 0%, rgba(14,5,8,.72) 36%, rgba(14,5,8,.18) 68%, rgba(14,5,8,.4) 100%),
    linear-gradient(0deg, rgba(14,5,8,.9), transparent 40%);
}
body:not(.page-index) .bg-shade { background: rgba(14, 5, 8, .8); }
body.admin .bg-shade { background: rgba(12, 5, 7, .94); }

/* ---------- header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; justify-content: space-between; gap: 20px;
  padding: 18px clamp(16px, 4vw, 48px);
  background: linear-gradient(180deg, rgba(14,5,8,.85), rgba(14,5,8,0));
}
.brand { font-family: var(--serif); font-size: 1.7rem; font-weight: 600; color: var(--gold-2); text-decoration: none; letter-spacing: .04em; }
.site-nav { display: flex; gap: clamp(14px, 2.4vw, 32px); }
.site-nav a {
  color: var(--ink); text-decoration: none; text-transform: uppercase; letter-spacing: .18em; font-size: .78rem;
  padding: 6px 0; border-bottom: 1px solid transparent; display: inline-flex; align-items: center; gap: 6px;
}
.site-nav a:hover, .site-nav a.active { color: var(--gold-2); border-color: var(--gold); }
.ico { width: 13px; height: 13px; fill: none; stroke: currentColor; stroke-width: 2; }
.nav-toggle { display: none; background: none; border: 0; padding: 8px; cursor: pointer; }
.nav-toggle span:not(.sr) { display: block; width: 24px; height: 2px; background: var(--gold-2); margin: 5px 0; transition: .25s; }
.nav-toggle[aria-expanded="true"] span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-toggle[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.nav-toggle[aria-expanded="true"] span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }


/* ---------- layout ---------- */
.site-main { flex: 1; width: 100%; max-width: 1240px; margin: 0 auto; padding: 24px clamp(16px, 3vw, 24px) 64px; }
.panel {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: clamp(20px, 4vw, 40px); margin-bottom: 24px;
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  box-shadow: 0 24px 60px rgba(0,0,0,.4);
}
.panel.narrow { max-width: 620px; }
.panel-head { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.page-title { font-size: clamp(2.3rem, 5vw, 3.4rem); }
.page-head { margin-bottom: 28px; }
.page-head.with-aside { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; }
.section-title { margin-top: 40px; }
.actions { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }
.more { text-decoration: none; font-size: .9rem; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5em;
  padding: .78em 1.6em; border-radius: 999px; border: 1px solid transparent; cursor: pointer;
  background: linear-gradient(135deg, var(--gold-2), var(--gold)); color: var(--wine);
  font: 500 .95rem/1.2 var(--sans); letter-spacing: .06em; text-decoration: none;
  transition: transform .15s, box-shadow .2s, background .2s;
}
.btn:hover { color: var(--wine); transform: translateY(-1px); box-shadow: 0 8px 24px rgba(210,169,100,.25); }
.btn.ghost { background: transparent; color: var(--gold-2); border-color: var(--gold); }
.btn.ghost:hover { background: rgba(210,169,100,.12); color: #fff; }
.btn.danger { background: transparent; color: var(--danger); border-color: rgba(231,131,123,.55); }
.btn.danger:hover { background: rgba(231,131,123,.12); color: #fff; }
.btn.small { padding: .42em .95em; font-size: .8rem; }
.btn.block { width: 100%; }
.linklike { background: none; border: 0; padding: 0; color: var(--muted); font: inherit; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
.linklike:hover { color: #fff; }

/* ---------- hero ---------- */
.hero { min-height: calc(100vh - 190px); min-height: calc(100svh - 190px); display: flex; flex-direction: column; justify-content: center; max-width: 560px; padding: 24px 0 48px; }
.hero h1 { font-size: clamp(3.4rem, 9vw, 6.2rem); line-height: .92; margin-bottom: .35em; text-shadow: 0 4px 30px rgba(0,0,0,.6); }
.hero-text h2 { font-size: 1.6rem; font-style: italic; font-weight: 500; color: var(--ink); }
.hero-text { margin-bottom: 28px; font-size: 1.06rem; text-shadow: 0 1px 12px rgba(0,0,0,.7); }
.upcoming { margin-top: 8px; }

/* ---------- bio ---------- */
.bio.has-photo { display: grid; grid-template-columns: minmax(220px, 380px) 1fr; gap: clamp(24px, 4vw, 48px); align-items: start; }
.bio-photo { margin: 0; border-radius: 10px; overflow: hidden; border: 1px solid var(--line); }
.bio-photo img { width: 100%; height: auto; }
.prose { max-width: 68ch; font-size: 1.05rem; }
@media (max-width: 760px) { .bio.has-photo { grid-template-columns: 1fr; } }

/* ---------- events ---------- */
.event-list { list-style: none; margin: 0; padding: 0; }
.event-list li { display: grid; grid-template-columns: 64px 1fr; gap: 18px; padding: 18px 0; border-top: 1px solid rgba(255,255,255,.07); scroll-margin-top: 90px; }
.event-list li:first-child { border-top: 0; }
.event-list li:target, .event-list li.flash-target { background: rgba(210,169,100,.08); border-radius: 8px; padding-left: 10px; padding-right: 10px; }
.ev-date { text-align: center; border: 1px solid var(--line); border-radius: 10px; padding: 6px 0; line-height: 1.1; height: fit-content; }
.ev-date span { display: block; font-size: .68rem; text-transform: uppercase; letter-spacing: .15em; color: var(--muted); }
.ev-date strong { display: block; font-family: var(--serif); font-size: 1.8rem; color: var(--gold-2); font-weight: 600; }
.ev-body h3 { margin-bottom: .2em; }
.ev-body p { margin-bottom: .5em; }
.ev-meta { color: var(--gold); font-size: .9rem; }
.ev-link { font-size: .9rem; }

/* ---------- calendar ---------- */
.cal-nav { display: flex; align-items: center; justify-content: center; gap: 24px; margin-bottom: 12px; }
.cal-nav h2 { margin: 0; min-width: 9ch; text-align: center; }
.cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; }
.cal-dow { text-align: center; font-size: .7rem; letter-spacing: .16em; text-transform: uppercase; color: var(--muted); padding: 6px 0; }
.cal-day { min-height: 100px; padding: 8px; border-radius: 8px; background: rgba(255,255,255,.03); border: 1px solid rgba(255,255,255,.06); min-width: 0; }
.cal-day.blank { background: transparent; border-color: transparent; }
.cal-day.today { border-color: var(--gold); box-shadow: inset 0 0 0 1px var(--gold); }
.cal-day .num { font-size: .85rem; color: var(--muted); }
.cal-dots { display: none; }
.cal-day.has-events[data-target] { cursor: pointer; }
.cal-day.today .num { color: var(--gold-2); font-weight: 500; }
.cal-day a {
  display: block; margin-top: 4px; padding: 2px 6px; border-radius: 4px; font-size: .74rem; line-height: 1.35;
  background: rgba(210,169,100,.18); color: var(--gold-2); text-decoration: none;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.cal-day a:hover { background: rgba(210,169,100,.35); color: #fff; }

/* ---------- gallery ---------- */
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; }
.tile { position: relative; aspect-ratio: 4 / 5; overflow: hidden; border-radius: 10px; border: 1px solid var(--line); background: #000; display: block; }
.tile img, .tile video { width: 100%; height: 100%; object-fit: cover; transition: transform .6s ease, opacity .3s; }
.tile:hover img, .tile:hover video { transform: scale(1.04); }
.tile .cap { position: absolute; left: 0; right: 0; bottom: 0; padding: 32px 12px 10px; background: linear-gradient(transparent, rgba(0,0,0,.85)); color: var(--ink); font-size: .88rem; }
.play { position: absolute; top: 50%; left: 50%; width: 56px; height: 56px; margin: -28px 0 0 -28px; border-radius: 50%; background: rgba(0,0,0,.55); border: 1px solid var(--gold); pointer-events: none; }
.play::after { content: ''; position: absolute; left: 22px; top: 17px; border-style: solid; border-width: 11px 0 11px 17px; border-color: transparent transparent transparent var(--gold-2); }
.protected img, .protected video { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
@media (max-width: 520px) { .gallery { grid-template-columns: repeat(2, 1fr); gap: 8px; } }

/* ---------- lightbox ---------- */
.lightbox { position: fixed; inset: 0; z-index: 150; background: #0b0406; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 56px 16px 24px; }
.lightbox[hidden] { display: none; }
.lb-stage { flex: 1; min-height: 0; width: 100%; display: flex; align-items: center; justify-content: center; }
.lb-stage img, .lb-stage video { max-width: 100%; max-height: 100%; object-fit: contain; border-radius: 6px; box-shadow: 0 20px 60px rgba(0,0,0,.7); }
.lb-caption { color: var(--ink); text-align: center; margin-top: 14px; min-height: 1.4em; max-width: 70ch; }
.lb-btn { position: absolute; background: rgba(0,0,0,.4); border: 1px solid var(--line); color: var(--gold-2); width: 48px; height: 48px; border-radius: 50%; font-size: 1.4rem; cursor: pointer; display: flex; align-items: center; justify-content: center; }
.lb-btn:hover { background: rgba(210,169,100,.2); }
.lb-close { top: 12px; right: 12px; }
.lb-prev { left: 12px; top: 50%; transform: translateY(-50%); }
.lb-next { right: 12px; top: 50%; transform: translateY(-50%); }
body.lb-open { overflow: hidden; }

/* ---------- forms ---------- */
label { display: block; font-size: .85rem; color: var(--muted); letter-spacing: .03em; }
input:not([type=checkbox]):not([type=radio]):not([type=file]), select, textarea {
  display: block; width: 100%; margin-top: 6px; padding: .7em .9em;
  background: var(--field); color: var(--ink); border: 1px solid rgba(255,255,255,.14); border-radius: 8px;
  font: 400 1rem/1.4 var(--sans);
}
textarea { resize: vertical; line-height: 1.55; }
select option { background: #1d0a0f; }
input:focus, select, textarea:focus { outline: none; }
input:focus-visible, select:focus-visible, textarea:focus-visible { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(210,169,100,.2); }
input[type=file] { display: block; margin-top: 8px; color: var(--muted); font: inherit; max-width: 100%; }
input[type=file]::file-selector-button { background: transparent; border: 1px solid var(--gold); color: var(--gold-2); border-radius: 999px; padding: .4em 1em; margin-right: 12px; cursor: pointer; font: inherit; }
input[type=date]::-webkit-calendar-picker-indicator, input[type=time]::-webkit-calendar-picker-indicator { filter: invert(.8); }
.check { display: flex; align-items: center; gap: 10px; color: var(--ink); font-size: .95rem; margin-top: 10px; }
.check input { width: 18px; height: 18px; accent-color: var(--gold); }
.pad-top { padding-top: 26px; }
.stack > * + * { margin-top: 16px; }
.grid-2, .grid-3 { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
@media (max-width: 700px) { .grid-2, .grid-3 { grid-template-columns: 1fr; } }
.grid-2 + .grid-2, .panel > label + label, .panel > label + .grid-2, .panel > .grid-2 + label, .panel > .upload-row + .grid-2 { margin-top: 16px; }
.panel > h2 + label, .panel > h2 + .grid-2 { margin-top: 0; }

.flash { padding: 12px 16px; border-radius: 10px; margin-bottom: 16px; border: 1px solid; font-size: .95rem; }
.flash.ok { border-color: rgba(150,207,160,.5); background: rgba(150,207,160,.1); color: #d9f1dc; }
.flash.error { border-color: rgba(231,131,123,.6); background: rgba(231,131,123,.12); color: #ffd9d5; }

/* ---------- unlock ---------- */
.unlock { margin: 6vh auto; text-align: center; }
.lock-ico { width: 44px; height: 44px; fill: none; stroke: var(--gold); stroke-width: 1.5; margin: 0 auto 12px; }
.unlock-form { display: flex; flex-direction: column; gap: 14px; margin-top: 20px; }
.code-input { font-family: ui-monospace, Menlo, Consolas, monospace !important; text-transform: uppercase; letter-spacing: .22em; text-align: center; font-size: 1.35rem !important; }

/* ---------- footer ---------- */
.site-footer { text-align: center; padding: 28px 20px 36px; font-size: .82rem; color: var(--muted); border-top: 1px solid rgba(210,169,100,.12); background: rgba(14,5,8,.6); }
.site-footer p { margin: .3em 0; }
.footer-links { list-style: none; padding: 0; margin: 0 0 12px; display: flex; flex-wrap: wrap; justify-content: center; gap: 8px 24px; }
.footer-links a { text-transform: uppercase; letter-spacing: .16em; font-size: .75rem; text-decoration: none; }
.adult-note { opacity: .7; }

/* ---------- age gate ---------- */
.age-gate { position: fixed; inset: 0; z-index: 300; display: none; align-items: center; justify-content: center; padding: 20px; background: rgba(10,4,6,.82); backdrop-filter: blur(28px); -webkit-backdrop-filter: blur(28px); }
.age-card { max-width: 480px; text-align: center; background: var(--panel-2); border: 1px solid var(--line); border-radius: var(--radius); padding: clamp(24px, 5vw, 44px); }
.age-card h2 { font-size: 2.6rem; }
.age-card .actions { justify-content: center; margin-top: 8px; }
html.gated .age-gate { display: flex; }
html.gated body { overflow: hidden; }

/* ============================================================
   Admin
   ============================================================ */
.admin-wrap { display: grid; grid-template-columns: 240px minmax(0, 1fr); min-height: 100vh; }
.admin-side { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 24px; padding: 28px 18px; background: var(--panel-2); border-right: 1px solid var(--line); }
.admin-side .brand { font-size: 1.5rem; line-height: 1.1; }
.admin-side .brand small { display: block; font-family: var(--sans); font-size: .68rem; letter-spacing: .3em; text-transform: uppercase; color: var(--muted); margin-top: 4px; }
.admin-nav { display: flex; flex-direction: column; gap: 2px; }
.admin-nav a { padding: 9px 12px; border-radius: 8px; color: var(--ink); text-decoration: none; font-size: .95rem; }
.admin-nav a:hover { background: rgba(255,255,255,.05); }
.admin-nav a.active { background: rgba(210,169,100,.16); color: var(--gold-2); }
.admin-side-foot { margin-top: auto; display: flex; flex-direction: column; gap: 10px; font-size: .9rem; }
.admin-side-foot a { color: var(--muted); }
.admin-main { padding: 32px clamp(16px, 4vw, 48px) 80px; max-width: 1120px; width: 100%; }
.admin-main .panel { box-shadow: none; }
.admin-main .page-title { margin-bottom: 20px; }
.auth-wrap { min-height: 100vh; min-height: 100svh; display: flex; align-items: center; justify-content: center; padding: 20px; }
.auth-card { width: 100%; max-width: 420px; }
.auth-card label { margin-top: 14px; }
.auth-card .btn { margin-top: 22px; }
.narrow-left { max-width: 560px; }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 14px; margin-bottom: 24px; }
.stat { display: block; padding: 20px; border-radius: var(--radius); border: 1px solid var(--line); background: var(--panel); text-decoration: none; color: var(--ink); }
.stat:hover { border-color: var(--gold); color: var(--ink); }
.stat strong { display: block; font-family: var(--serif); font-size: 2.6rem; line-height: 1; color: var(--gold-2); }
.stat span { font-size: .85rem; color: var(--muted); }
.checks { list-style: none; padding: 0; margin: 0 0 12px; display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 6px 20px; }
.checks li::before { display: inline-block; width: 1.4em; font-weight: 500; }
.checks li.ok::before { content: '✓'; color: var(--ok); }
.checks li.bad { color: #ffd9d5; }
.checks li.bad::before { content: '✕'; color: var(--danger); }

.upload-row { display: flex; gap: 18px; align-items: center; margin-top: 16px; flex-wrap: wrap; }
.thumb { width: 96px; height: 96px; object-fit: cover; border-radius: 8px; border: 1px solid var(--line); }
.thumb-wide { width: 200px; aspect-ratio: 16/9; object-fit: cover; border-radius: 8px; border: 1px solid var(--line); }
.sticky-save { position: sticky; bottom: 0; padding: 16px 0; background: linear-gradient(transparent, rgba(12,5,7,.95) 40%); }

.dropzone { display: flex; flex-direction: column; align-items: center; gap: 8px; text-align: center; padding: 28px 16px; border: 1.5px dashed var(--line); border-radius: var(--radius); cursor: pointer; color: var(--ink); font-size: 1rem; }
.dropzone:hover { border-color: var(--gold); background: rgba(210,169,100,.05); }
.dropzone small { color: var(--muted); }

.media-admin { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 16px; }
.media-card { border: 1px solid rgba(255,255,255,.08); border-radius: 10px; padding: 10px; background: rgba(255,255,255,.02); display: flex; flex-direction: column; gap: 8px; }
.media-thumb { position: relative; display: block; aspect-ratio: 1; border-radius: 6px; overflow: hidden; background: #000; }
.media-thumb img, .media-thumb video { width: 100%; height: 100%; object-fit: cover; }
.caption-form { display: flex; gap: 6px; align-items: center; }
.caption-form input { margin-top: 0 !important; padding: .45em .6em !important; font-size: .88rem !important; }
.media-tools { display: flex; gap: 6px; justify-content: flex-end; }

.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: .92rem; }
.table th { text-align: left; font-weight: 400; color: var(--muted); font-size: .75rem; letter-spacing: .12em; text-transform: uppercase; padding: 8px 10px; border-bottom: 1px solid var(--line); }
.table td { padding: 12px 10px; border-bottom: 1px solid rgba(255,255,255,.06); vertical-align: top; }
.table tr.hl td { background: rgba(210,169,100,.1); }
.row-actions { text-align: right; white-space: nowrap; }
.row-actions > * { display: inline-block; vertical-align: middle; margin: 0 0 4px 4px; }
.codes code { font-size: 1rem; letter-spacing: .08em; color: var(--gold-2); }
.badge { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: .75rem; white-space: nowrap; border: 1px solid; }
.badge.active { color: var(--ok); border-color: rgba(150,207,160,.5); }
.badge.unused { color: var(--gold-2); border-color: var(--line); }
.badge.expired { color: var(--muted); border-color: rgba(255,255,255,.15); }
.badge.revoked { color: var(--danger); border-color: rgba(231,131,123,.5); }
.new-codes { border-color: var(--gold); }
.code-chips { display: flex; flex-direction: column; gap: 10px; margin-bottom: 14px; }
.code-chip { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.code-chip code { font-size: 1.35rem; letter-spacing: .14em; color: var(--gold-2); margin-right: 6px; }

.toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); z-index: 400; background: var(--gold-2); color: var(--wine); padding: 10px 18px; border-radius: 999px; font-weight: 500; box-shadow: 0 10px 30px rgba(0,0,0,.4); }

/* ============================================================
   Responsive & touch refinements
   ============================================================ */

/* Notched phones: keep content clear of the notch and home bar */
.site-header {
  padding-top: max(18px, env(safe-area-inset-top));
  padding-left: max(clamp(16px, 4vw, 48px), env(safe-area-inset-left));
  padding-right: max(clamp(16px, 4vw, 48px), env(safe-area-inset-right));
}
.site-main { padding-left: max(clamp(16px, 3vw, 24px), env(safe-area-inset-left)); padding-right: max(clamp(16px, 3vw, 24px), env(safe-area-inset-right)); }
.site-footer { padding-bottom: max(36px, calc(env(safe-area-inset-bottom) + 20px)); }
.lb-stage img { touch-action: pinch-zoom; }

/* Hover effects only on devices that can hover (no "stuck" hovers after a tap) */
@media (hover: none) {
  .tile:hover img, .tile:hover video { transform: none; }
  .btn:hover { transform: none; box-shadow: none; }
}

/* Comfortable touch targets on touchscreens */
@media (pointer: coarse) {
  .btn.small { min-height: 40px; padding: .55em 1.1em; }
  .site-nav a { min-height: 44px; }
  .footer-links a, .more, .ev-link { display: inline-block; padding: 10px 2px; }
  .check input { width: 22px; height: 22px; }
  .cal-nav .btn { min-width: 44px; min-height: 44px; }
  .admin-side-foot a, .admin-side-foot .linklike { display: inline-block; padding: 10px 0; }
  input[type=file] { font-size: 16px; }
  .caption-form input { font-size: 16px !important; min-height: 40px; }
  .admin-nav a { min-height: 40px; display: flex; align-items: center; }
}

/* ---------- Phones ---------- */
@media (max-width: 760px) {
  body { font-size: 16px; }
  .site-header { padding-top: max(12px, env(safe-area-inset-top)); padding-bottom: 12px; background: rgba(14,5,8,.92); }
  .brand { font-size: 1.45rem; }
  .nav-toggle { display: block; margin-right: -8px; }
  .site-nav {
    display: none; position: fixed; left: 0; right: 0; bottom: 0; top: var(--header-h, 62px);
    flex-direction: column; gap: 0; overflow-y: auto; overscroll-behavior: contain;
    padding: 8px 28px calc(28px + env(safe-area-inset-bottom));
    background: rgba(16,6,9,.97); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  }
  .site-nav.open { display: flex; }
  .site-nav a { padding: 18px 0; font-size: 1rem; letter-spacing: .22em; border-bottom: 1px solid rgba(210,169,100,.14); }
  .site-nav a.active { border-bottom-color: rgba(210,169,100,.14); }
  .ico { width: 15px; height: 15px; }
  body.nav-open { overflow: hidden; }

  .site-main { padding-top: 16px; padding-bottom: 40px; }
  .panel { padding: 22px 18px; border-radius: 12px; margin-bottom: 16px; }
  .page-title { font-size: 2.3rem; }
  .page-head { margin-bottom: 20px; }
  .page-head.with-aside { flex-wrap: wrap; }
  h2 { font-size: 1.6rem; }
  .prose { font-size: 1rem; }
  .event-list li { grid-template-columns: 52px 1fr; gap: 14px; }
  .ev-date strong { font-size: 1.5rem; }
  .unlock { margin: 3vh auto; }
  .unlock-form .btn { width: 100%; }
  .gallery { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .tile { border-radius: 8px; }
  .tile .cap { font-size: .8rem; padding: 24px 8px 8px; }
  .play { width: 44px; height: 44px; margin: -22px 0 0 -22px; }
  .play::after { left: 17px; top: 13px; border-width: 9px 0 9px 14px; }
  .age-card h2 { font-size: 2.1rem; }
  .age-card .btn { width: 100%; }
  .site-footer { font-size: .78rem; }

  /* Lightbox: controls move to the bottom, within thumb reach; swipe also works */
  .lightbox { padding: calc(58px + env(safe-area-inset-top)) 0 calc(76px + env(safe-area-inset-bottom)); }
  .lb-close { top: calc(8px + env(safe-area-inset-top)); right: 10px; }
  .lb-prev, .lb-next { top: auto; bottom: calc(14px + env(safe-area-inset-bottom)); transform: none; }
  .lb-prev { left: 20px; }
  .lb-next { right: 20px; }
  .lb-stage img, .lb-stage video { border-radius: 0; }
  .lb-caption { padding: 0 72px; font-size: .9rem; }
}

/* Home page on phones and portrait tablets: photo up top, text anchored at the bottom */
@media (max-width: 760px), (max-width: 1024px) and (orientation: portrait) {
  .page-index .bg { background-position: 68% center; }
  .page-index .bg-shade {
    background: linear-gradient(180deg, rgba(14,5,8,.55) 0%, rgba(14,5,8,.05) 22%, rgba(14,5,8,.45) 50%, rgba(14,5,8,.94) 78%, rgba(14,5,8,.98) 100%);
  }
  .hero { min-height: calc(100vh - 80px); min-height: calc(100svh - 80px); justify-content: flex-end; padding: 24px 0 28px; }
  .hero h1 { font-size: clamp(3rem, 14vw, 5rem); }
  .hero-text { font-size: 1rem; }
  .hero .actions .btn { flex: 1 1 180px; }
}

/* Calendar on small screens: compact squares with dots; tap a day to jump to its events */
@media (max-width: 640px) {
  .cal-nav { gap: 12px; }
  .cal-nav h2 { font-size: 1.5rem; }
  .cal-grid { gap: 4px; }
  .cal-dow { font-size: .62rem; letter-spacing: .06em; }
  .cal-day { min-height: 0; aspect-ratio: 1; padding: 4px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; }
  .cal-day a { display: none; }
  .cal-dots { display: flex; gap: 3px; }
  .cal-dots i { width: 6px; height: 6px; border-radius: 50%; background: var(--gold-2); }
  .cal-day.has-events { background: rgba(210,169,100,.14); border-color: rgba(210,169,100,.35); }
}

/* Phones turned sideways */
@media (max-height: 500px) and (orientation: landscape) {
  .site-header { position: static; }
  .hero { min-height: auto; padding: 24px 0 32px; justify-content: flex-start; }
  .age-gate { align-items: flex-start; overflow-y: auto; }
}

/* ---------- Tablets ---------- */
@media (min-width: 761px) and (max-width: 1024px) {
  .site-nav { gap: 20px; }
  .site-nav a { padding: 10px 0; }
  .gallery { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

/* ---------- Large desktops ---------- */
@media (min-width: 1600px) {
  html { font-size: 17px; }
  body { font-size: 18px; }
  .site-main { max-width: 1400px; }
  .hero { max-width: 660px; }
  .gallery { grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); gap: 18px; }
}

/* ---------- Admin on tablets & phones ---------- */
@media (max-width: 860px) {
  .admin-wrap { grid-template-columns: minmax(0, 1fr); }
  .admin-side {
    position: sticky; top: 0; z-index: 40; height: auto;
    flex-direction: row; flex-wrap: wrap; align-items: center; gap: 2px 16px;
    padding: max(10px, env(safe-area-inset-top)) 16px 0;
    border-right: 0; border-bottom: 1px solid var(--line);
    backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  }
  .admin-side .brand { flex: 1; font-size: 1.25rem; }
  .admin-side .brand small { display: inline; margin: 0 0 0 8px; }
  .admin-side-foot { order: 2; margin: 0; flex-direction: row; gap: 16px; font-size: .85rem; }
  .admin-nav { order: 3; flex: 0 0 calc(100% + 32px); flex-direction: row; gap: 4px; margin: 0 -16px; padding: 6px 16px 10px; overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
  .admin-nav::-webkit-scrollbar { display: none; }
  .admin-nav a { white-space: nowrap; padding: 7px 14px; font-size: .9rem; }
  .admin-main { padding: 20px 16px calc(64px + env(safe-area-inset-bottom)); }
  .admin-main .page-title { font-size: 2rem; margin-bottom: 14px; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .stat { padding: 14px; }
  .stat strong { font-size: 2rem; }
  .media-admin { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .media-card { padding: 8px; }
  .caption-form { flex-wrap: wrap; }
  .caption-form input { flex: 1 1 100%; }
  .caption-form .btn { flex: 1; }
  .media-tools { flex-wrap: wrap; }
  .media-tools form { flex: 1; }
  .media-tools .btn { width: 100%; }
  .sticky-save { padding-bottom: calc(16px + env(safe-area-inset-bottom)); }
  .sticky-save .btn { width: 100%; }
  .upload-row > div { flex: 1 1 220px; }
  .thumb-wide { width: 100%; max-width: 360px; }
  .code-chip code { flex: 1 1 100%; font-size: 1.2rem; }
  .actions .btn { flex: 1 1 auto; }
}

/* Admin tables become stacked cards on narrower screens */
@media (max-width: 1100px) {
  .table-cards thead { display: none; }
  .table-cards, .table-cards tbody, .table-cards tr, .table-cards td { display: block; width: 100%; }
  .table-cards tr { position: relative; margin-bottom: 12px; padding: 12px 14px; border: 1px solid rgba(255,255,255,.09); border-radius: 10px; background: rgba(255,255,255,.02); }
  .table-cards tr.hl { border-color: var(--gold); }
  .table-cards tr.hl td { background: none; }
  .table-cards td { position: relative; border: 0; padding: 4px 0 4px 96px; font-size: .92rem; white-space: normal; text-align: left; }
  .table-cards td[data-label]::before { content: attr(data-label); position: absolute; left: 0; top: 7px; color: var(--muted); font-size: .7rem; letter-spacing: .12em; text-transform: uppercase; }
  .table-cards td:not([data-label]) { padding-left: 0; }
  .table-cards .code-cell code { font-size: 1.2rem; }
  .table-cards td.row-actions { margin-top: 8px; text-align: left; }
  .table-cards .row-actions > * { margin: 0 6px 6px 0; }
  .table-wrap { overflow: visible; }
}

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

/* ---------- HTML edition: loading states & upload progress ---------- */
html.loading [data-bind], html.loading [data-html] { visibility: hidden; }
.loading-note { color: var(--muted); padding: 24px 0; }
.loading-note::before { content: ''; display: inline-block; width: 14px; height: 14px; margin-right: 10px; vertical-align: -2px; border: 2px solid var(--line); border-top-color: var(--gold-2); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.progress { height: 6px; border-radius: 999px; overflow: hidden; background: rgba(255,255,255,.08); }
.progress i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--gold), var(--gold-2)); transition: width .2s; }
.noscript { margin: 20px; text-align: center; }
.editing-note { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.admin-side-foot .linklike { text-align: left; align-self: flex-start; }

/* ============================================================
   Reviews
   ============================================================ */
.reviews-head .page-head { margin-bottom: 0; }
.reviews-head .page-head > div > :last-child p:last-child { margin-bottom: 0; }
.reviews-layout { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 24px; align-items: start; }
.reviews-layout.closed { grid-template-columns: minmax(0, 1fr); }
.review-form-panel { position: sticky; top: 92px; }
#write { scroll-margin-top: 92px; }
.closed-note, .empty-note { margin: 0; }

/* Average + breakdown */
.review-summary { display: flex; flex-wrap: wrap; align-items: center; gap: 20px 40px; margin-top: 24px; padding-top: 24px; border-top: 1px solid rgba(210,169,100,.18); }
.summary-score { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 14px; }
.summary-score .avg { font-family: var(--serif); font-size: 3.4rem; line-height: 1; color: var(--gold-2); font-weight: 600; }
.summary-score p { margin: 0; flex-basis: 100%; }
.summary-dist { list-style: none; margin: 0; padding: 0; flex: 1 1 260px; max-width: 380px; display: grid; gap: 4px; }
.summary-dist li { display: grid; grid-template-columns: 2.4em 1fr 2.4em; align-items: center; gap: 10px; font-size: .85rem; }
.summary-dist li span:last-child { text-align: right; }
.dist-bar { height: 6px; border-radius: 999px; background: rgba(255,255,255,.08); overflow: hidden; }
.dist-bar i { display: block; height: 100%; background: var(--gold); border-radius: 999px; }

/* Stars (supports fractions via --pct) */
.star-bar { position: relative; display: inline-block; font-size: 1rem; line-height: 1; letter-spacing: 2px; white-space: nowrap; }
.star-bar::before { content: '★★★★★'; color: rgba(255,255,255,.18); }
.star-bar::after { content: '★★★★★'; color: var(--gold-2); position: absolute; left: 0; top: 0; width: var(--pct); overflow: hidden; }
.star-bar.big { font-size: 1.5rem; }

/* Review cards */
.review { padding: 20px 0; border-top: 1px solid rgba(255,255,255,.07); }
.review:first-child { border-top: 0; padding-top: 0; }
.review.fresh { animation: fresh 2.4s ease; border-radius: 8px; }
@keyframes fresh { 0% { background: rgba(210,169,100,.18); } 100% { background: transparent; } }
.review-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 14px; margin-bottom: 8px; }
.review-name { font-family: var(--serif); font-size: 1.3rem; font-weight: 600; color: var(--gold-2); overflow-wrap: anywhere; }
.review-meta time { margin-left: auto; }
.review-text { overflow-wrap: anywhere; }
.review-text p { margin-bottom: .7em; }
.review-text p:last-child { margin-bottom: 0; }
#reviews-more { margin-top: 16px; }

/* Review form */
.review-form-panel form > * + * { margin-top: 16px; }
.rating-field { border: 0; margin: 16px 0 0; padding: 0; min-width: 0; }
.rating-field legend { padding: 0; font-size: .85rem; color: var(--muted); letter-spacing: .03em; }
.stars-input { display: flex; flex-wrap: wrap; align-items: center; gap: 0 2px; margin-top: 2px; }
.stars-input input { position: absolute; opacity: 0; width: 1px; height: 1px; pointer-events: none; }
.stars-input label { display: flex; align-items: center; justify-content: center; width: 44px; height: 44px; margin: 0; font-size: 2rem; line-height: 1; color: rgba(255,255,255,.2); cursor: pointer; transition: color .12s, transform .12s; }
.stars-input label.on { color: var(--gold-2); }
.stars-input label:active { transform: scale(.9); }
.stars-input input:focus-visible + label { outline: 2px solid var(--gold); outline-offset: -4px; border-radius: 8px; }
.stars-note { margin-left: 10px; font-size: .9rem; color: var(--muted); }
#stars-clear { margin-left: 10px; }
.char-count { text-align: right; margin-top: 4px !important; }
.char-count.warn { color: var(--gold-2); }
.hp { position: absolute !important; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

@media (max-width: 960px) {
  .reviews-layout { grid-template-columns: minmax(0, 1fr); gap: 16px; }
  .review-form-panel { position: static; }
}
@media (max-width: 760px) {
  .reviews-head .page-head.with-aside { align-items: stretch; }
  .reviews-head #write-btn { width: 100%; }
  .summary-score .avg { font-size: 2.8rem; }
  .review-meta time { margin-left: 0; flex-basis: 100%; }
  #reviews-more { width: 100%; }
}

/* ---------- Admin: reviews ---------- */
.nav-badge { display: inline-flex; align-items: center; justify-content: center; min-width: 20px; height: 20px; padding: 0 6px; margin-left: 8px; border-radius: 999px; background: var(--gold-2); color: var(--wine); font-size: .72rem; font-weight: 500; }
.seg { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 16px; }
.seg button { background: transparent; border: 1px solid rgba(255,255,255,.14); color: var(--ink); border-radius: 999px; padding: .5em 1.1em; font: 400 .9rem var(--sans); cursor: pointer; min-height: 40px; }
.seg button:hover { border-color: var(--gold); }
.seg button.active { background: rgba(210,169,100,.18); border-color: var(--gold); color: var(--gold-2); }
.seg button .n { opacity: .7; margin-left: 4px; }
.review-admin { border: 1px solid rgba(255,255,255,.09); border-radius: 10px; padding: 16px; background: rgba(255,255,255,.02); }
.review-admin + .review-admin { margin-top: 12px; }
.review-admin.pending { border-color: rgba(210,169,100,.45); }
.review-admin .review-meta { margin-bottom: 6px; }
.review-admin .review-meta time { margin-left: 0; }
.review-admin .reason { color: var(--gold-2); font-size: .85rem; margin: 0 0 8px; }
.review-admin .poster { font-size: .8rem; color: var(--muted); }
.review-admin .review-text { font-size: .95rem; }
.review-admin .row-actions { text-align: left; margin-top: 12px; white-space: normal; }
.review-admin .row-actions > * { margin: 0 6px 6px 0; }
.badge.published { color: var(--ok); border-color: rgba(150,207,160,.5); }
.badge.pending { color: var(--gold-2); border-color: var(--line); }
.badge.hidden { color: var(--muted); border-color: rgba(255,255,255,.15); }
.badge.blocked { color: var(--danger); border-color: rgba(231,131,123,.5); }
.bulk-row { display: flex; flex-wrap: wrap; gap: 8px; justify-content: space-between; align-items: center; margin-bottom: 14px; }
details.settings-box > summary { cursor: pointer; list-style: none; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
details.settings-box > summary::-webkit-details-marker { display: none; }
details.settings-box > summary h2 { margin: 0; }
details.settings-box > summary::after { content: '+'; font-size: 1.6rem; color: var(--gold); line-height: 1; }
details.settings-box[open] > summary::after { content: '–'; }
details.settings-box[open] > summary { margin-bottom: 18px; }
@media (min-width: 961px) { .reviews-head #write-btn { display: none; } }
