:root {
  --ink: #2b2724;
  --ink-soft: #6f665e;
  --ink-faint: #9c9289;
  --paper: #fbf8f4;
  --card: #ffffff;
  --line: #e7e0d6;
  --accent: #6b7f6e;
  --accent-deep: #4e6152;
  --accent-wash: #eef1ec;
  --warn: #a4562f;
  --warn-wash: #faf0e9;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(43, 39, 36, .05), 0 8px 24px -12px rgba(43, 39, 36, .18);
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, "Times New Roman", serif;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --ink: #ece7e1;
    --ink-soft: #b1a89f;
    --ink-faint: #8a8079;
    --paper: #1a1917;
    --card: #232120;
    --line: #38342f;
    --accent: #9db79f;
    --accent-deep: #b6cbb8;
    --accent-wash: #262d27;
    --warn: #e0a077;
    --warn-wash: #302620;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px -12px rgba(0, 0, 0, .6);
  }
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

.wrap {
  width: 100%;
  max-width: 680px;
  margin: 0 auto;
  padding: 28px 20px 64px;
}

.wrap--wide { max-width: 1080px; }

/*
 * The landing page fills the screen rather than huddling at the top.
 * dvh tracks the real viewport as mobile browser chrome slides away; vh is the
 * fallback. `margin-block: auto` on .page centres it while still allowing the page
 * to scroll normally once the upload queue grows — which `justify-content: center`
 * would clip.
 */
.wrap--landing {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100dvh;
  padding-top: max(20px, env(safe-area-inset-top));
  padding-bottom: max(20px, env(safe-area-inset-bottom));
}

.wrap--landing .page { margin-block: auto; width: 100%; }

/* ---------- header ---------- */

header.masthead { text-align: center; margin-bottom: clamp(26px, 5vh, 38px); }

.eyebrow {
  font-size: 12px;
  letter-spacing: .22em;
  text-transform: uppercase;
  color: var(--ink-faint);
  margin: 0 0 12px;
}

h1 {
  font-family: var(--serif);
  font-weight: 400;
  /* 13vw keeps this genuinely large on a 375px phone, where the old 8vw floor
     pinned it at its 30px minimum. */
  font-size: clamp(38px, 13vw, 58px);
  line-height: 1.08;
  margin: 0 0 8px;
  letter-spacing: -.015em;
}

.lede {
  margin: 0 auto;
  max-width: 26em;
  color: var(--ink-soft);
  font-size: clamp(17px, 4.6vw, 19px);
  line-height: 1.5;
}

.rule {
  width: 52px;
  height: 1px;
  background: var(--line);
  border: 0;
  margin: clamp(18px, 3.5vh, 26px) auto;
}

/* ---------- cards & controls ---------- */

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: clamp(20px, 5vw, 26px);
  margin-bottom: 16px;
}

label.field { display: block; margin-bottom: 18px; }

label.field > span {
  display: block;
  font-size: 12.5px;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--ink-faint);
  margin-bottom: 8px;
}

input[type="text"], textarea {
  width: 100%;
  font: inherit;
  font-size: 17px; /* never below 16px, or iOS Safari zooms the page on focus */
  color: var(--ink);
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 14px 15px;
}

textarea { resize: vertical; min-height: 62px; }

input[type="text"]:focus, textarea:focus {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
  border-color: transparent;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  min-height: 64px; /* comfortably past the ~44px minimum touch target */
  padding: 16px 20px;
  font: inherit;
  font-size: clamp(18px, 4.8vw, 20px);
  font-weight: 600;
  color: #fff;
  background: var(--accent-deep);
  border: 0;
  border-radius: 14px;
  cursor: pointer;
  text-decoration: none;
  -webkit-tap-highlight-color: transparent;
}

.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: default; }

.btn--ghost {
  background: transparent;
  color: var(--accent-deep);
  border: 1px solid var(--line);
  font-weight: 500;
  min-height: 54px;
  font-size: 16.5px;
}

@media (prefers-color-scheme: dark) {
  .btn { color: #16211a; }
  .btn--ghost { color: var(--accent-deep); }
}

.btn--small { width: auto; min-height: 38px; padding: 8px 14px; font-size: 14px; }

.hint { font-size: 14.5px; color: var(--ink-faint); margin: 12px 0 0; text-align: center; }

.stack > * + * { margin-top: 10px; }

/* ---------- upload queue ---------- */

.queue { list-style: none; margin: 18px 0 0; padding: 0; }

.queue li {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  border-top: 1px solid var(--line);
}

.queue li:first-child { border-top: 0; }

.thumb {
  flex: 0 0 auto;
  width: 46px;
  height: 46px;
  border-radius: 8px;
  object-fit: cover;
  background: var(--accent-wash);
  display: grid;
  place-items: center;
  font-size: 18px;
  color: var(--accent-deep);
  overflow: hidden;
}

.queue .meta { flex: 1 1 auto; min-width: 0; }

.queue .name {
  display: block;
  font-size: 14px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.queue .sub { font-size: 12.5px; color: var(--ink-faint); }

.bar {
  height: 3px;
  border-radius: 2px;
  background: var(--line);
  overflow: hidden;
  margin-top: 5px;
}

.bar > i {
  display: block;
  height: 100%;
  width: 0;
  background: var(--accent);
  transition: width .18s ease-out;
}

.state { flex: 0 0 auto; font-size: 18px; line-height: 1; }
.state--ok { color: var(--accent); }
.state--err { color: var(--warn); }

/* ---------- notices ---------- */

.notice {
  border-radius: 10px;
  padding: 12px 14px;
  font-size: 14px;
  margin-bottom: 16px;
  border: 1px solid var(--line);
  background: var(--accent-wash);
}

.notice--warn { background: var(--warn-wash); border-color: var(--warn); color: var(--warn); }

/* ---------- gallery ---------- */

.day-heading {
  font-family: var(--serif);
  font-size: 20px;
  font-weight: 400;
  margin: 30px 0 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--line);
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(112px, 1fr));
  gap: 8px;
}

.tile {
  position: relative;
  aspect-ratio: 1;
  border: 0;
  padding: 0;
  border-radius: 10px;
  overflow: hidden;
  background: var(--accent-wash);
  cursor: pointer;
}

.tile img { width: 100%; height: 100%; object-fit: cover; display: block; }

.tile .stamp {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  padding: 18px 6px 5px;
  font-size: 11px;
  color: #fff;
  text-align: left;
  line-height: 1.3;
  background: linear-gradient(to top, rgba(0, 0, 0, .7), rgba(0, 0, 0, .35) 55%, transparent);
}

.tile .stamp .time { display: block; font-weight: 600; }

.tile .stamp .who {
  display: block;
  font-size: 10px;
  opacity: .92;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tile .badge {
  position: absolute;
  top: 5px; right: 5px;
  background: rgba(0, 0, 0, .6);
  color: #fff;
  font-size: 10px;
  letter-spacing: .04em;
  padding: 2px 6px;
  border-radius: 20px;
}

.empty { text-align: center; color: var(--ink-faint); padding: 56px 20px; }

/* ---------- lightbox ---------- */

dialog.lightbox {
  border: 0;
  padding: 0;
  background: transparent;
  max-width: 100vw;
  max-height: 100vh;
  width: 100%;
  height: 100%;
}

dialog.lightbox::backdrop { background: rgba(20, 18, 16, .93); }

.lightbox .frame {
  display: flex;
  flex-direction: column;
  height: 100%;
  padding: 12px;
}

.lightbox .media {
  flex: 1 1 auto;
  display: grid;
  place-items: center;
  min-height: 0;
}

.lightbox img, .lightbox video { max-width: 100%; max-height: 100%; object-fit: contain; }

.lightbox .caption {
  flex: 0 0 auto;
  color: #f1ece6;
  font-size: 13.5px;
  text-align: center;
  padding: 12px 8px 4px;
}

.lightbox .caption .who { color: #b9b1a8; }

.lightbox .controls {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding-top: 8px;
}

.lightbox .controls button {
  font: inherit;
  font-size: 15px;
  color: #f1ece6;
  background: rgba(255, 255, 255, .12);
  border: 0;
  border-radius: 10px;
  padding: 12px 18px;
  cursor: pointer;
  min-width: 64px;
}

/* ---------- admin ---------- */

.kv { display: grid; grid-template-columns: minmax(120px, auto) 1fr; gap: 8px 16px; font-size: 14.5px; }
.kv dt { color: var(--ink-faint); }
.kv dd { margin: 0; word-break: break-word; }

.pill {
  display: inline-block;
  font-size: 12px;
  padding: 2px 9px;
  border-radius: 20px;
  background: var(--accent-wash);
  color: var(--accent-deep);
}

.pill--bad { background: var(--warn-wash); color: var(--warn); }

.qr-holder { text-align: center; }
.qr-holder img { width: 220px; max-width: 100%; border-radius: 10px; background: #fff; padding: 10px; }

code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 13px;
  background: var(--accent-wash);
  padding: 1px 5px;
  border-radius: 4px;
  word-break: break-all;
}

.footer-link { text-align: center; margin-top: 22px; padding-top: 8px; }
.footer-link a { color: var(--ink-faint); font-size: 14.5px; }

.sr-only {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap;
}

/* ---------- short screens ----------
 * Older iPhones and small Androids. Trim the vertical rhythm so the landing page
 * still lands on one screen, without shrinking any tap target.
 * This block must stay last in the file: it overrides the clamp() values above,
 * which share its specificity and would otherwise win on source order.
 */

@media (max-height: 720px) {
  .wrap--landing { padding-top: max(12px, env(safe-area-inset-top)); }
  .wrap--landing header.masthead { margin-bottom: 18px; }
  .wrap--landing .rule { margin: 13px auto; }
  .wrap--landing .lede { font-size: 16.5px; }
  .wrap--landing .card { padding: 18px; }
  .wrap--landing label.field { margin-bottom: 14px; }
  .wrap--landing .btn { min-height: 58px; }
  .wrap--landing .footer-link { margin-top: 14px; }
}
