/* Spacing: 8px grid for components, 4px for fine detail.
   Type: major third (1.25) from 16px. Text lines capped near 66 characters, line height 1.5. */
/* Look: "disposable camera". White like a flash, black ink, flash-yellow highlights, chunky grotesque type,
   photos as white-bordered prints with the orange date stamp film cameras burned into the corner. */
:root {
  --bg: #FFFFFF;
  --surface: #FFFFFF;
  --ink: #161616;
  --muted: #6B6B66;
  --line: #E6E5E0;
  --accent: #161616;          /* primary buttons are ink */
  --accent-ink: #FFE14D;      /* ...with flash-yellow text */
  --accent-soft: #FFF6C7;
  --flash: #FFE14D;
  --flash-ink: #161616;
  --stamp: #FF8A1F;
  --print: #FFFFFF;
  --warn: #B4410E;
  --warn-soft: #FDEEE4;
  --ok: #1F7A4D;
  --ok-soft: #E4F4EA;
  --photo-bg: #0E0E0E;
  --shadow-1: 0 1px 2px rgba(22, 22, 22, .08);
  --shadow-2: 0 1px 2px rgba(22, 22, 22, .08), 0 6px 18px rgba(22, 22, 22, .08);

  --s1: 4px; --s2: 8px; --s3: 16px; --s4: 24px; --s5: 32px; --s6: 40px; --s7: 48px;
  --t-sm: 0.8rem; --t-base: 1rem; --t-md: 1.25rem; --t-lg: 1.5625rem; --t-xl: 2.25rem;
  --radius: 12px;
  --measure: 66ch;
  --font: "Bricolage Grotesque", system-ui, -apple-system, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #111110; --surface: #1B1B19; --ink: #F4F3EE; --muted: #A3A29B; --line: #2C2C29;
    --accent: #FFE14D; --accent-ink: #111110; --accent-soft: #2E2A12;
    --print: #F4F3EE;
    --warn: #F0A06A; --warn-soft: #3A2618; --ok: #6FD3A0; --ok-soft: #173326;
    --shadow-1: 0 1px 2px rgba(0, 0, 0, .4);
    --shadow-2: 0 1px 2px rgba(0, 0, 0, .4), 0 6px 18px rgba(0, 0, 0, .4);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 500 var(--t-base)/1.5 var(--font);
  font-feature-settings: "tnum" 1;
}
a { color: var(--accent); text-underline-offset: 3px; }
img { display: block; max-width: 100%; }
h1, h2, h3 { line-height: 1.2; margin: 0; font-weight: 600; letter-spacing: -0.01em; }
h1 { font-size: var(--t-xl); }
h2 { font-size: var(--t-md); }
h3 { font-size: var(--t-base); }
p { margin: 0; max-width: var(--measure); }
.muted { color: var(--muted); }
.small { font-size: var(--t-sm); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }

/* ---------- frame ---------- */
.top {
  position: sticky; top: 0; z-index: 10; background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(12px); border-bottom: 1px solid var(--line);
}
.top-in {
  max-width: 1120px; margin: 0 auto; padding: var(--s2) var(--s3);
  display: flex; align-items: center; gap: var(--s3); min-height: 56px;
}
.brand { font-weight: 600; color: var(--ink); text-decoration: none; margin-right: auto; white-space: nowrap; }
@media (max-width: 560px) {
  .top-in { flex-wrap: wrap; gap: 0; padding-bottom: 0; }
  .brand { padding: var(--s1) 0; }
  .nav { width: 100%; margin: 0 calc(var(--s2) * -1); padding-bottom: var(--s1); }
}
.nav { display: flex; gap: var(--s1); overflow-x: auto; scrollbar-width: none; }
.nav button { margin-left: auto; }
.nav a, .nav button {
  font: inherit; font-size: var(--t-sm); font-weight: 500; color: var(--muted); text-decoration: none;
  padding: var(--s2) var(--s2); border-radius: 6px; background: none; border: 0; cursor: pointer; white-space: nowrap;
}
.nav a[aria-current="page"] { color: var(--ink); background: var(--surface); box-shadow: var(--shadow-1); }
.badge {
  display: inline-block; min-width: 20px; padding: 0 6px; margin-left: var(--s1); border-radius: 10px;
  background: var(--accent); color: var(--accent-ink); font-size: 11px; line-height: 20px; text-align: center;
}
main { max-width: 1120px; margin: 0 auto; padding: var(--s4) var(--s3) var(--s7); }
.stack > * + * { margin-top: var(--s3); }
.stack-lg > * + * { margin-top: var(--s5); }
.devbar { background: var(--warn-soft); color: var(--warn); font-size: var(--t-sm); text-align: center; padding: var(--s1) var(--s3); }

/* ---------- controls ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--s2);
  font: inherit; font-weight: 600; font-size: var(--t-base); min-height: 48px; padding: 0 var(--s4);
  border-radius: var(--radius); border: 1px solid transparent; cursor: pointer; text-decoration: none;
  background: var(--accent); color: var(--accent-ink); box-shadow: var(--shadow-1);
}
.btn:disabled { opacity: .5; cursor: default; }
.btn.secondary { background: var(--surface); color: var(--ink); border-color: var(--line); }
.btn.quiet { background: none; color: var(--accent); box-shadow: none; padding: 0 var(--s2); }
.btn.danger { background: var(--surface); color: var(--warn); border-color: var(--line); }
.btn.sm { min-height: 36px; padding: 0 var(--s3); font-size: var(--t-sm); }
.btn.block { width: 100%; }
.row { display: flex; gap: var(--s2); flex-wrap: wrap; align-items: center; }
label.field { display: block; }
label.field > span { display: block; font-size: var(--t-sm); font-weight: 500; color: var(--muted); margin-bottom: var(--s1); }
input[type=text], input[type=email], input[type=date], input[type=datetime-local], input[type=number], input[type=search], textarea {
  font: inherit; width: 100%; min-height: 48px; padding: var(--s2) var(--s3); color: var(--ink);
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
}
textarea { min-height: 96px; resize: vertical; }
.choice {
  display: flex; gap: var(--s3); align-items: flex-start; padding: var(--s3);
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); cursor: pointer;
}
.choice:has(input:checked) { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.choice input { margin-top: 4px; accent-color: var(--accent); width: 18px; height: 18px; flex: none; }

.panel { background: var(--surface); border-radius: 12px; padding: var(--s4); box-shadow: var(--shadow-2); }
.note { padding: var(--s3); border-radius: var(--radius); background: var(--accent-soft); }
.note.warn { background: var(--warn-soft); color: var(--warn); }
.note.ok { background: var(--ok-soft); color: var(--ok); }
.narrow { max-width: 560px; }
.toast {
  position: fixed; left: 50%; bottom: var(--s4); transform: translateX(-50%); z-index: 100;
  background: var(--ink); color: var(--bg); padding: var(--s2) var(--s3); border-radius: var(--radius);
  box-shadow: var(--shadow-2); font-size: var(--t-sm); max-width: calc(100% - 32px);
}

/* ---------- landing ---------- */
.landing { min-height: calc(100vh - 160px); display: grid; align-content: center; gap: var(--s5); }
.landing h1 { font-size: clamp(var(--t-xl), 9vw, 3.815rem); letter-spacing: -0.03em; max-width: 12ch; }
.strip { display: grid; grid-template-columns: repeat(6, 1fr); gap: 4px; max-width: 520px; }
.strip i { aspect-ratio: 3 / 4; border-radius: 4px; background: var(--line); }
.strip i:nth-child(3n) { background: color-mix(in srgb, var(--accent) 22%, var(--line)); }

/* ---------- my photos ---------- */
.days {
  display: flex; gap: var(--s2); overflow-x: auto; padding: var(--s1) var(--s3) var(--s3);
  margin: 0 calc(var(--s3) * -1); scroll-snap-type: x proximity; scrollbar-width: none;
}
.day {
  flex: none; scroll-snap-align: start; width: 72px; padding: var(--s2) 0 var(--s2);
  text-align: center; text-decoration: none; color: var(--muted);
  border-radius: 12px; background: var(--surface); border: 1px solid var(--line);
}
.day b { display: block; font-size: var(--t-lg); line-height: 1.2; color: var(--ink); font-weight: 600; }
.day small { display: block; font-size: 11px; }
.day[aria-current="true"] { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); box-shadow: var(--shadow-2); }
.day[aria-current="true"] b { color: var(--accent-ink); }

.grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 2px; margin: 0 calc(var(--s3) * -1); }
@media (min-width: 640px) { .grid { grid-template-columns: repeat(4, 1fr); gap: 4px; margin: 0; } }
@media (min-width: 960px) { .grid { grid-template-columns: repeat(5, 1fr); } }
.tile { position: relative; aspect-ratio: 1; background: var(--line); border: 0; padding: 0; cursor: pointer; overflow: hidden; }
@media (min-width: 640px) { .tile { border-radius: 4px; } }
.tile img { width: 100%; height: 100%; object-fit: cover; }

.empty { text-align: center; padding: var(--s7) var(--s3); display: grid; justify-items: center; gap: var(--s3); }
.empty p { color: var(--muted); }

/* ---------- viewer ---------- */
.viewer { position: fixed; inset: 0; z-index: 50; background: var(--photo-bg); color: #EEF1F6; display: none; flex-direction: column; }
.viewer.open { display: flex; }
.viewer-top, .viewer-bottom { display: flex; align-items: center; gap: var(--s2); padding: var(--s2) var(--s3); }
.viewer-top { justify-content: space-between; }
.viewer-stage { flex: 1; min-height: 0; display: flex; align-items: center; justify-content: center; position: relative; touch-action: pan-y; }
.viewer-stage img { max-width: 100%; max-height: 100%; object-fit: contain; }
.viewer .icon { width: 48px; height: 48px; border-radius: 24px; border: 0; background: rgba(255,255,255,.08); color: inherit; font-size: 22px; cursor: pointer; }
.viewer .nav-l, .viewer .nav-r { position: absolute; top: 50%; transform: translateY(-50%); }
.viewer .nav-l { left: var(--s2); } .viewer .nav-r { right: var(--s2); }
@media (hover: none) { .viewer .nav-l, .viewer .nav-r { display: none; } }
.viewer-bottom { flex-direction: column; align-items: stretch; padding-bottom: max(var(--s3), env(safe-area-inset-bottom)); }
.viewer-bottom .btn { background: #FFFFFF; color: #0E1117; }
.viewer .meta { white-space: pre-line; font-size: var(--t-sm); color: #A6AEBC; text-align: center; }
.viewer .links { display: flex; justify-content: center; gap: var(--s4); }
.viewer .links button { background: none; border: 0; color: #A6AEBC; font: inherit; font-size: var(--t-sm); text-decoration: underline; text-underline-offset: 3px; cursor: pointer; padding: var(--s2); }

/* ---------- sheets (bottom dialogs) ---------- */
dialog.sheet {
  border: 0; padding: var(--s4); border-radius: 16px; background: var(--surface); color: var(--ink);
  width: min(480px, calc(100% - 32px)); box-shadow: var(--shadow-2);
}
dialog.sheet::backdrop { background: rgba(14, 17, 23, .55); }

/* ---------- admin ---------- */
.head { display: flex; align-items: end; justify-content: space-between; gap: var(--s3); flex-wrap: wrap; }
.list { background: var(--surface); border-radius: 12px; box-shadow: var(--shadow-2); overflow: hidden; }
.list > * { display: flex; gap: var(--s3); align-items: center; padding: var(--s3); border-top: 1px solid var(--line); color: inherit; text-decoration: none; }
.list > *:first-child { border-top: 0; }
.list .grow { flex: 1; min-width: 0; }
.status { display: inline-block; font-size: 11px; font-weight: 600; padding: 2px 8px; border-radius: 10px; background: var(--line); color: var(--muted); white-space: nowrap; }
.status.ok { background: var(--ok-soft); color: var(--ok); }
.status.warn { background: var(--warn-soft); color: var(--warn); }
.status.accent { background: var(--accent-soft); color: var(--accent); }
.drop {
  display: grid; place-items: center; text-align: center; gap: var(--s2); padding: var(--s6) var(--s3);
  border: 2px dashed var(--line); border-radius: 12px; background: var(--surface); cursor: pointer;
}
.drop.over { border-color: var(--accent); background: var(--accent-soft); }
.bar { height: 8px; border-radius: 4px; background: var(--line); overflow: hidden; }
.bar > i { display: block; height: 100%; width: 0; background: var(--accent); transition: width .2s; }
.uplog { max-height: 240px; overflow: auto; font-size: var(--t-sm); }
.uplog div { display: flex; justify-content: space-between; gap: var(--s2); padding: var(--s1) 0; border-bottom: 1px solid var(--line); }

.rgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: var(--s3); }
.rcard { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow-1); overflow: hidden; }
.rcard .img { position: relative; aspect-ratio: 4 / 3; background: var(--line); }
.rcard .img img { width: 100%; height: 100%; object-fit: cover; }
.rcard .img .status { position: absolute; left: var(--s2); top: var(--s2); }
.rcard.excluded .img img { opacity: .3; filter: grayscale(1); }
.rcard .body { padding: var(--s2); font-size: var(--t-sm); display: grid; gap: var(--s1); }
.rcard .body .row { gap: var(--s1); }
.toggle { display: flex; align-items: center; gap: var(--s2); cursor: pointer; font-weight: 500; }
.toggle input { width: 18px; height: 18px; accent-color: var(--accent); }
.face { width: 96px; height: 96px; border-radius: var(--radius); object-fit: cover; background: var(--line); flex: none; }
.filters { display: flex; gap: var(--s1); flex-wrap: wrap; }
.filters button { font: inherit; font-size: var(--t-sm); padding: var(--s1) var(--s3); border-radius: 16px; border: 1px solid var(--line); background: var(--surface); color: var(--muted); cursor: pointer; }
.filters button[aria-pressed="true"] { background: var(--ink); color: var(--bg); border-color: var(--ink); }
table.simple { width: 100%; border-collapse: collapse; font-size: var(--t-sm); }
table.simple td, table.simple th { text-align: left; padding: var(--s2); border-bottom: 1px solid var(--line); }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; scroll-behavior: auto !important; } }

/* ---------- face scan ---------- */
.scan { position: relative; width: min(260px, 70vw); aspect-ratio: 1; max-width: 100%; margin: 0 auto; border-radius: 50%;
  padding: 6px; background: conic-gradient(var(--accent) calc(var(--p, 0) * 1%), var(--line) 0); }
.scan video, .scan .scan-idle { width: 100%; height: 100%; border-radius: 50%; display: block; object-fit: cover; background: var(--surface); }
.scan video { transform: scaleX(-1); }
.scan video:not([data-live]) { display: none; }
.scan video[data-live] + .scan-idle { display: none; }
.scan .scan-idle { display: grid; place-items: center; color: var(--muted); font-size: var(--t-sm); text-align: center; padding: var(--s4); }
.scan-hint { text-align: center; font-weight: 500; min-height: 3em; margin: 0 auto; }
.selfie-strip { height: 88px; width: auto; max-width: 100%; border-radius: var(--radius); object-fit: cover; background: var(--line); flex: none; }

.viewer .dl-file { color: #A6AEBC; font-size: var(--t-sm); text-align: center; text-underline-offset: 3px; }
.viewer-bottom .btn.loading { opacity: .85; }

.publish-foot { display: grid; gap: var(--s2); padding: var(--s4); margin-top: var(--s2); background: var(--surface); border-radius: 12px; box-shadow: var(--shadow-2); }
@media (max-width: 640px) { .publish-foot { position: sticky; bottom: max(var(--s2), env(safe-area-inset-bottom)); } }
.or { display: flex; align-items: center; gap: var(--s3); color: var(--muted); font-size: var(--t-sm); max-width: none; }
.or::before, .or::after { content: ""; flex: 1; height: 1px; background: var(--line); }

.day-all b { font-size: var(--t-md); line-height: 1.5; }
.list > a.person { display: flex; gap: var(--s3); align-items: center; padding: var(--s3); border-top: 1px solid var(--line); color: inherit; text-decoration: none; flex-wrap: wrap; }
.list > a.person:first-child { border-top: 0; }
.list > a.person:hover { background: var(--bg); }
.chev { color: var(--muted); font-size: var(--t-md); margin-left: auto; }
.pgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: var(--s3); }
.pcard { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow-1); overflow: hidden; min-width: 0; }
.pcard img { width: 100%; aspect-ratio: 1; object-fit: cover; display: block; background: var(--line); }
.pcard .body { padding: var(--s2); font-size: var(--t-sm); display: grid; gap: var(--s1); }


/* ================= disposable-camera look: component overrides ================= */
h1, h2, h3 { font-weight: 800; letter-spacing: -.03em; }
h1 { font-size: var(--t-xl); line-height: 1; }
h2 { font-size: var(--t-md); }
.top { background: color-mix(in srgb, var(--bg) 92%, transparent); }
.brand { display: inline-flex; align-items: center; gap: var(--s2); font-weight: 800; font-size: var(--t-md); letter-spacing: -.03em; }
.brand .flash { width: 26px; height: 26px; border-radius: 13px; background: var(--flash); color: var(--flash-ink); display: grid; place-items: center; font-size: 14px; }
.nav a, .nav button { font-weight: 700; color: var(--muted); }
.nav a[aria-current="page"] { background: var(--ink); color: var(--bg); box-shadow: none; }
.btn { font-weight: 800; border-radius: var(--radius); box-shadow: none; }
.btn.secondary { border: 2px solid var(--ink); }
.btn.danger { border: 2px solid var(--line); }
.btn.quiet { color: var(--ink); text-decoration: underline; text-underline-offset: 3px; }
a { color: var(--ink); }
input[type=text], input[type=email], input[type=date], input[type=datetime-local], input[type=number], input[type=search], textarea {
  border: 2px solid var(--line); border-radius: var(--radius); font-weight: 500; }
input:focus { outline: none; border-color: var(--ink); }
.note { background: var(--accent-soft); font-weight: 700; }
.panel { border-radius: 16px; box-shadow: none; border: 2px solid var(--line); }
.list { box-shadow: none; border: 2px solid var(--line); border-radius: 16px; }
.status { font-weight: 800; border-radius: 6px; }
.badge { background: var(--flash); color: var(--flash-ink); }
.choice { border-width: 2px; }
.choice:has(input:checked) { border-color: var(--ink); box-shadow: none; }
.choice input, .toggle input { accent-color: var(--ink); }

/* day chips: inline, chunky, outlined */
.days { gap: var(--s2); padding-top: var(--s2); }
.day { width: auto; display: inline-flex; align-items: baseline; gap: 5px; padding: 7px 12px; border-radius: 10px;
  border: 2px solid var(--ink); background: var(--surface); color: var(--ink); font-weight: 800; font-size: var(--t-sm); text-transform: lowercase; }
.day b, .day-all b { display: inline; font-size: var(--t-sm); line-height: 1.2; color: inherit; }
.day small { display: inline; font-size: var(--t-sm); }
.day small:last-child { display: none; }
.day[aria-current="true"] { background: var(--ink); color: var(--flash); box-shadow: none; }
.day[aria-current="true"] b { color: var(--flash); }

/* photos as prints */
.grid { grid-template-columns: repeat(2, 1fr); gap: 10px; margin: 0; }
@media (min-width: 640px) { .grid { grid-template-columns: repeat(3, 1fr); gap: 16px; } }
@media (min-width: 960px) { .grid { grid-template-columns: repeat(4, 1fr); } }
.tile { aspect-ratio: auto; background: var(--print); padding: 6px 6px 0; border-radius: 3px; overflow: visible;
  box-shadow: 0 1px 2px rgba(22, 22, 22, .14), 0 5px 14px rgba(22, 22, 22, .09); text-align: left; position: relative; }
@media (min-width: 640px) { .tile { border-radius: 3px; } }
.tile .ph { position: relative; aspect-ratio: 4 / 5; overflow: hidden; background: var(--line); }
.tile img { width: 100%; height: 100%; object-fit: cover; }
.tile .cap { display: block; padding: 6px 2px 7px; font: 700 11px/1 var(--font); color: #6B6B66; text-transform: lowercase; }
.stamp { position: absolute; right: 7px; bottom: 6px; font: 700 11px/1 ui-monospace, "SF Mono", Menlo, monospace; letter-spacing: .04em;
  color: var(--stamp); text-shadow: 0 0 4px rgba(255, 120, 0, .6); pointer-events: none; }
.rcard { border-radius: 3px; background: var(--print); padding: 6px 6px 0; box-shadow: 0 1px 2px rgba(22, 22, 22, .14), 0 5px 14px rgba(22, 22, 22, .09); }
.rcard .img { aspect-ratio: 4 / 5; }
.rcard .body { padding: 8px 2px; color: #161616; }
.rcard .body .muted { color: #6B6B66; }
.rcard .btn.quiet, .rcard .toggle { color: #161616; }
.pcard { border-radius: 3px; background: var(--print); padding: 6px 6px 0; box-shadow: 0 1px 2px rgba(22, 22, 22, .14), 0 5px 14px rgba(22, 22, 22, .09); }
.pcard img { aspect-ratio: 4 / 5; }
.pcard .body { padding: 8px 2px; color: #161616; }
.pcard .body .muted { color: #6B6B66; }
.pcard .btn.quiet { color: #161616; }

/* landing */
.landing h1 { font-size: clamp(2.5rem, 12vw, 4.5rem); line-height: .92; letter-spacing: -.045em; max-width: 9ch; text-transform: lowercase; }
.strip { grid-template-columns: repeat(3, 1fr); gap: 12px; max-width: 360px; }
.strip i { aspect-ratio: 4 / 5; border-radius: 3px; background: var(--line); border: 6px solid var(--print); border-bottom-width: 18px;
  box-shadow: 0 1px 2px rgba(22, 22, 22, .14), 0 5px 14px rgba(22, 22, 22, .09); }
.strip i:nth-child(1) { transform: rotate(-4deg); background: #D9A441; }
.strip i:nth-child(2) { transform: rotate(2deg) translateY(-6px); background: #7FB8A6; }
.strip i:nth-child(3) { transform: rotate(-1deg); background: #C8785A; }
.strip i:nth-child(n+4) { display: none; }

/* viewer + scan */
.viewer-bottom .btn { background: var(--flash); color: #161616; }
.scan { background: conic-gradient(var(--flash) calc(var(--p, 0) * 1%), var(--line) 0); }
.drop { border: 2px dashed var(--ink); border-radius: 16px; }
.drop.over { background: var(--accent-soft); }
.bar i { background: var(--ink); }
.publish-foot { box-shadow: none; border: 2px solid var(--ink); }
.or::before, .or::after { height: 2px; }
.selfie-strip { border-radius: 6px; }
.tile .ph { display: block; width: 100%; }
.tile .ph img { position: absolute; inset: 0; }
