/* Tokens come from the Figma design (Desktop - 4): forest green field, maroon, gold accent. */
@font-face { font-family: "Satoshi"; src: url(/fonts/satoshi.woff2) format("woff2"); font-weight: 300 900; font-display: swap; }
@font-face { font-family: "Megrim"; src: url(/fonts/megrim.woff2) format("woff2"); font-weight: 500; font-display: swap; }

:root {
  --bg: #1f2620;
  --bg-2: #213226;
  --ink: #fff;
  --muted: rgba(255, 255, 255, .72);
  --maroon: #581110;
  --maroon-deep: #470101;
  --gold: #ffec8a;          /* "gold accent" in the design */
  --gold-strong: #dfc025;
  --line: rgba(223, 192, 37, .35);
  --radius: 10px;
  --display: "Megrim", "Iowan Old Style", Georgia, serif;
  --sans: "Satoshi", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --max: 1250px;           /* widest any section gets (the details strip is full-bleed on purpose) */
  --gutter: max(16px, calc((100vw - var(--max)) / 2));
}
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; overflow-x: clip; }
body {
  margin: 0; background: var(--bg); color: var(--ink); font: 1rem/1.5 var(--sans); overflow-x: clip;
  padding-bottom: calc(84px + env(safe-area-inset-bottom)); /* clears the floating mobile nav with ~22px to spare */
}
img, canvas { max-width: 100%; display: block; }

/* Floral pattern from the invitation suite, tiled behind everything. Loaded after first paint (CSS background). */
body::before {
  content: ""; position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background: url(/img/pattern.webp) center top / 520px 520px repeat; opacity: .9;
}
@media (prefers-reduced-data: reduce) { body::before { display: none; } }
a { color: inherit; }
h1, h2, h3 { font-weight: 500; line-height: 1.15; margin: 0 0 .5em; }
.display { font-family: var(--display); font-weight: 500; font-size: 2.5rem; line-height: 1.08; letter-spacing: .01em; }
p { margin: 0 0 1em; }
.wrap { width: 100%; max-width: calc(var(--max) + 32px); margin: 0 auto; padding: 0 16px; }
.muted { color: var(--muted); }
.eyebrow { text-transform: uppercase; letter-spacing: .18em; font-size: .75rem; color: var(--gold); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; }


/* ---------- header, logo, liquid-glass nav ---------- */
.site-header { display: flex; align-items: center; height: 84px; padding: 0 var(--gutter); }
.brand { display: inline-block; line-height: 0; }
.brand img { height: 40px; width: auto; }

.nav {
  position: fixed; z-index: 50; display: flex; gap: 2px; padding: 5px; border-radius: 999px; isolation: isolate;
  left: 50%; bottom: max(14px, env(safe-area-inset-bottom)); transform: translateX(-50%);
  background: linear-gradient(135deg, rgba(255, 255, 255, .20), rgba(255, 255, 255, .05) 55%, rgba(255, 255, 255, .12));
  border: 1px solid rgba(255, 255, 255, .22);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, .55),     /* specular rim */
    inset 0 -1px 0 rgba(255, 255, 255, .10),
    inset 0 0 18px rgba(255, 255, 255, .06),
    0 10px 34px rgba(0, 0, 0, .38);
}
/* the blur lives on a static layer of its own so the moving pill never forces it to re-render */
.nav::before {
  content: ""; position: absolute; inset: 0; z-index: -1; border-radius: inherit; pointer-events: none;
  -webkit-backdrop-filter: blur(10px) saturate(1.5); backdrop-filter: blur(10px) saturate(1.5);
}
.nav a {
  position: relative; z-index: 1; padding: 11px 18px; border-radius: 999px; text-decoration: none; color: #fff;
  font-size: clamp(13px, .8125rem, 16px); letter-spacing: .1em; text-transform: capitalize; white-space: nowrap; transition: color .25s, transform .12s;
  -webkit-tap-highlight-color: transparent;
}
.nav a[aria-current="page"] { color: var(--gold); }
.nav .pill {
  position: absolute; z-index: 0; top: 5px; bottom: 5px; left: 0; width: 0; border-radius: 999px; pointer-events: none; transform-origin: 0 50%;
  background: linear-gradient(180deg, rgba(255, 236, 138, .38), rgba(223, 192, 37, .14));
  border: 1px solid rgba(255, 236, 138, .38);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .65), inset 0 0 14px rgba(255, 236, 138, .28), 0 2px 12px rgba(223, 192, 37, .22);
  will-change: transform; opacity: 0;
}
.nav .pill.on { opacity: 1; }
@media (min-width: 900px) {
  body { padding-bottom: 0; }
  .nav { left: auto; bottom: auto; top: 20px; right: var(--gutter); transform: none; }
  .nav a { padding: 8px 15px; }
}
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) { .nav { background: rgba(40, 56, 44, .92); } }

/* ---------- footer ---------- */
.site-footer { display: flex; flex-wrap: wrap; gap: 10px 24px; align-items: center; justify-content: space-between; padding: 56px var(--gutter) 28px; font-size: 0.875rem; }
.site-footer p { margin: 0; }
.site-footer .by { display: flex; gap: 8px; align-items: center; }
.site-footer img { height: 30px; width: auto; }

/* ---------- buttons & forms ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5em; min-height: 44px; padding: 10px 20px;
  border-radius: 999px; border: 1px solid var(--maroon-deep); background: var(--maroon-deep); color: #fff;
  font: 500 0.875rem var(--sans); text-decoration: none; cursor: pointer; -webkit-tap-highlight-color: transparent;
  transition: transform .15s, background .2s, border-color .2s;
}
.btn:hover { background: var(--maroon); border-color: var(--maroon); }
.btn.ghost { background: transparent; border-color: var(--line); }
.btn.block { display: flex; width: 100%; }
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .5; }
.btn.danger { background: #8a2a22; border-color: #8a2a22; }
.field { display: block; margin-bottom: 14px; }
.field > span { display: block; font-size: .85rem; color: var(--muted); margin-bottom: 4px; }
input[type=text], input[type=email], input[type=password], input[type=tel], input[type=number] {
  width: 100%; min-height: 48px; padding: 0 14px; font: inherit; font-size: 1rem;
  border: 1px solid var(--line); border-radius: 10px; background: rgba(255, 255, 255, .06); color: #fff;
}
.check { display: flex; gap: 10px; align-items: flex-start; font-size: .9rem; color: var(--muted); margin-bottom: 16px; }
.check input { width: 22px; height: 22px; margin-top: 2px; flex: none; accent-color: var(--gold-strong); }
.error { color: #ff9d92; min-height: 1.4em; font-size: .9rem; margin: 6px 0 0; }
.card { background: var(--bg-2); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; }
.narrow { max-width: 440px; margin: 0 auto; }
.page-head { padding: 16px 0 18px; }
.page-head h1 { font-family: var(--display); font-size: 2.5rem; }
a.link { color: var(--gold); }

/* ---------- justified photo grid (gallery + home) ---------- */
.jgrid { --rowh: 150px; list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
@media (min-width: 640px) { .jgrid { --rowh: 240px; gap: 14px; } }
@media (min-width: 1100px) { .jgrid { --rowh: 300px; } }
.jgrid > li { flex: calc(var(--r) * 100) 1 calc(var(--r) * var(--rowh)); aspect-ratio: var(--r); min-width: 0; }
.jgrid:not(.fill)::after { content: ""; flex-grow: 1000000; }
.jgrid button { display: block; width: 100%; height: 100%; padding: 0; border: 0; border-radius: 5px; overflow: hidden; background: var(--bg-2); cursor: zoom-in; }
.jgrid img { width: 100%; height: 100%; object-fit: cover; transition: transform .5s; }
.jgrid button:hover img { transform: scale(1.03); }
.empty { text-align: center; padding: 40px 16px; color: var(--muted); }

dialog.lightbox { border: 0; padding: 0; background: transparent; color: #fff; max-width: 100vw; max-height: 100dvh; width: 100%; height: 100%; }
dialog.lightbox[open] { display: flex; flex-direction: column; }
dialog.lightbox::backdrop { background: rgba(10, 14, 11, var(--bd, .96)); }
.lb-stage { position: relative; flex: 1; min-height: 0; display: grid; place-items: center; padding: 64px 64px 8px; touch-action: none; }
.lb-nav, .lb-count, .lb-thumbs, .lightbox .x { opacity: var(--ui, 1); }
.lb-stage > img { position: absolute; inset: 0; margin: auto; width: auto; height: auto; max-width: calc(100% - 128px); max-height: calc(100% - 72px); object-fit: contain; border-radius: 6px; user-select: none; -webkit-user-drag: none; }
.lb-nav {
  position: absolute; top: 50%; translate: 0 -50%; z-index: 2; display: grid; place-items: center; width: 48px; height: 48px; padding: 0; cursor: pointer;
  border-radius: 50%; border: 1px solid rgba(255, 236, 138, .55); background: rgba(31, 38, 32, .55);
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); transition: background .2s, opacity .2s, transform .15s;
}
.lb-nav.prev { left: 14px; }
.lb-nav.next { right: 14px; }
.lb-nav:hover:not(:disabled) { background: rgba(255, 236, 138, .22); }
.lb-nav:active:not(:disabled) { transform: scale(.93); }
.lb-nav:disabled { opacity: .25; cursor: default; }
.lb-count { margin: 0; padding: 6px 0 4px; text-align: center; font-size: 0.75rem; letter-spacing: .12em; color: var(--muted); }
.lb-thumbs { display: flex; justify-content: safe center; gap: 8px; overflow-x: auto; padding: 6px 16px calc(14px + env(safe-area-inset-bottom)); scrollbar-width: thin; scrollbar-color: rgba(255, 236, 138, .35) transparent; }
.lb-thumbs button { flex: none; width: 64px; height: 64px; padding: 0; border: 2px solid transparent; border-radius: 6px; overflow: hidden; background: var(--bg-2); opacity: .55; cursor: pointer; transition: opacity .2s, border-color .2s; }
.lb-thumbs button:hover { opacity: .85; }
.lb-thumbs button[aria-selected="true"] { opacity: 1; border-color: var(--gold); }
.lb-thumbs img { width: 100%; height: 100%; object-fit: cover; }
.lightbox .x { position: absolute; top: calc(10px + env(safe-area-inset-top)); right: 12px; z-index: 3; }
@media (max-width: 640px) {
  .lb-stage > img { max-width: calc(100% - 16px); max-height: calc(100% - 68px); }
  .lb-nav { width: 42px; height: 42px; }
  .lb-nav.prev { left: 8px; }
  .lb-nav.next { right: 8px; }
  .lb-thumbs button { width: 52px; height: 52px; }
}

/* ---------- upload ---------- */
.queue { list-style: none; margin: 16px 0 0; padding: 0; display: grid; gap: 8px; }
.queue li { display: flex; gap: 12px; align-items: center; background: var(--bg-2); border: 1px solid var(--line); border-radius: 10px; padding: 8px; font-size: .9rem; }
.queue img { width: 52px; height: 52px; object-fit: cover; border-radius: 6px; background: var(--bg); flex: none; }
.queue .st { margin-left: auto; color: var(--muted); }
.queue .ok .st { color: #8fe0a8; }
.queue .bad .st { color: #ff9d92; }
.drop { display: block; text-align: center; padding: 34px 16px; border: 1.5px dashed var(--line); border-radius: var(--radius); background: rgba(255, 255, 255, .03); cursor: pointer; }
.drop strong { display: block; font-family: var(--display); font-size: 1.5rem; font-weight: 500; }

/* ---------- filter studio ---------- */
.stage { background: rgba(255, 255, 255, .04); border-radius: var(--radius); padding: 12px; display: grid; place-items: center; min-height: 220px; }
.stage canvas { width: 100%; height: auto; max-height: 68dvh; object-fit: contain; border-radius: 4px; box-shadow: 0 6px 24px rgba(0, 0, 0, .4); }
.controls { display: grid; gap: 14px; margin: 16px 0; }
.seg { display: flex; border: 1px solid var(--line); border-radius: 999px; overflow: hidden; background: rgba(255, 255, 255, .05); }
.seg button { flex: 1; min-height: 44px; border: 0; background: transparent; font: 500 .9rem var(--sans); color: var(--muted); cursor: pointer; }
.seg button[aria-pressed="true"] { background: rgba(223, 192, 37, .18); color: var(--gold); }
input[type=range] { width: 100%; accent-color: var(--gold-strong); height: 32px; }
.row { display: flex; gap: 10px; }
.row > * { flex: 1; }

/* ---------- admin ---------- */
body.admin { padding: 0; }
.admin-bar { position: sticky; top: 0; z-index: 10; background: var(--bg); padding: 10px 0; border-bottom: 1px solid var(--line); }
.admin-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin: 14px 0 90px; }
@media (min-width: 640px) { .admin-grid { grid-template-columns: repeat(4, 1fr); } }
.tile { position: relative; background: var(--bg-2); border: 2px solid transparent; border-radius: 10px; overflow: hidden; text-align: left; padding: 0; cursor: pointer; font: inherit; color: inherit; }
.tile[aria-pressed="true"] { border-color: var(--gold-strong); }
.tile img { width: 100%; aspect-ratio: 1; object-fit: cover; background: var(--bg); }
.tile .meta { display: block; padding: 6px 8px 8px; font-size: .78rem; line-height: 1.3; word-break: break-word; }
.tile .tick { position: absolute; top: 8px; left: 8px; width: 26px; height: 26px; border-radius: 50%; background: rgba(0, 0, 0, .55); border: 2px solid var(--gold-strong); display: grid; place-items: center; font-size: 0.9375rem; color: var(--bg); }
.tile[aria-pressed="true"] .tick { background: var(--gold-strong); }
.actionbar { position: fixed; inset: auto 0 0 0; z-index: 30; background: var(--bg-2); border-top: 1px solid var(--line); padding: 10px 16px calc(10px + env(safe-area-inset-bottom)); display: flex; gap: 8px; }
.actionbar .btn { min-height: 46px; padding: 0 14px; flex: 1; }

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

/* ---------- phone layout (Figma "Mobile-home", 390px wide) ---------- */
@media (max-width: 899px) {
  .site-header { position: relative; justify-content: center; height: 65px; padding: 0 16px; background: #222b24; border-bottom: 1px solid var(--gold); box-shadow: 0 9px 16px rgba(0, 0, 0, .25); }
  .brand img { height: 37px; }
  .nav { bottom: max(12px, env(safe-area-inset-bottom)); padding: 5px 7px; gap: 5px; }
  .nav a { padding: 8px 15px; }
  .nav .pill { top: 5px; bottom: 5px; }
  .site-footer { justify-content: center; text-align: center; font-size: 0.75rem; gap: 12px 10px; padding: 40px 16px 6px; }
  .page-head h1 { font-size: 2rem; }
}

/* ---------- gallery page (Figma "Gallery-page") ---------- */
.page-title { text-align: center; padding: 58px 16px 0; margin-bottom: 19px; }   /* same position as the upload + filter headers */
.page-title .display { margin: 0; }
.page-title .kicker { margin: 12px 0 0; font-weight: 500; font-size: 0.875rem; letter-spacing: .1em; text-transform: uppercase; color: var(--gold); }
@media (max-width: 899px) { .page-title { padding-top: 40px; } .page-title .display { font-size: 2rem; } }
/* desktop: photos keep their shape at one row height, and each row is centred (not stretched to the edges) */
@media (min-width: 900px) {
  .gallery-grid { --rowh: 259px; gap: 9.4px 8.25px; justify-content: center; }
  .gallery-grid > li { flex: 0 0 auto; width: calc(var(--r) * var(--rowh)); }
  .gallery-grid::after { display: none; }
  .gallery-grid button { border-radius: 2.95px; }
}


/* =====================================================================
   v2 - accessibility pack (see APPLE-AUDIT.md)
   ===================================================================== */
:focus-visible { outline: 2px solid #fff; outline-offset: 3px; }              /* white ring: visible on gold borders too */
input::placeholder { color: #9aa39b; }                                         /* 5.3:1 on the field (was 1.9:1) */
.btn { min-height: 2.75rem; }

/* Nav glass with a dimming layer: labels stay readable over a white photo (white text >= 5.5:1 worst case) */
.nav::before { background: rgba(31, 38, 32, .72); -webkit-backdrop-filter: blur(20px) saturate(1.5); backdrop-filter: blur(20px) saturate(1.5); }
.nav a { display: flex; align-items: center; min-height: 44px; }               /* 44px touch target */
.nav a:active { transform: scale(.94); }                                       /* instant press feedback */
@media (min-width: 900px) { .nav a { min-height: 36px; } }
@media (max-width: 899px) {
  .btn { white-space: normal; text-align: center; }
  .hero-copy .display, .memories .display { white-space: normal; }
}

/* Reduce Transparency / Increase Contrast: solid surfaces instead of glass */
@media (prefers-reduced-transparency: reduce), (prefers-contrast: more) {
  .nav::before { -webkit-backdrop-filter: none; backdrop-filter: none; background: #222b24; }
  .nav { border-color: var(--gold); }
  .flip, .lb-nav { -webkit-backdrop-filter: none; backdrop-filter: none; background: #222b24; }
  :root { --muted: rgba(255, 255, 255, .9); --line: rgba(255, 236, 138, .7); }
  .panel, .panel.maroon, .card { border-color: var(--gold); }
}

/* v2: determinate upload progress */
.queue li { position: relative; overflow: hidden; }
.queue li::after { content: ""; position: absolute; left: 0; bottom: 0; height: 2px; width: calc(var(--p, 0) * 100%); background: var(--gold); transition: width .15s linear; }
.queue li.ok::after { width: 100%; background: #8fe0a8; }

/* footer stays at the bottom of the screen on short pages, with the same clearance above the nav as every other page */
body { display: flex; flex-direction: column; min-height: 100dvh; }
body > main { flex: 1 0 auto; width: 100%; }
body > .site-footer { margin-top: auto; }
body.admin { display: block; min-height: 0; }
