/* Layout: phone first. A single column "shoebox" of everyone's photos by year,
   with the Add photos button pinned under the thumb. Wider screens get more columns. */
/* Always dark: deep indigo like the group's block-print fabric, with its pattern
   repeated very faintly behind everything (pattern.svg). */
:root {
  --bg: #14171F;
  --surface: #1D2130;
  --ink: #ECE6D8;
  --muted: #A09C90;
  --line: #313648;
  --accent: #A9B4FF;
  --accent-ink: #12162B;
  --tab: #E2B934;
  --danger: #FF8A80;
  --display: "Gloock", Georgia, "Times New Roman", serif;
  --body: "Hanken Grotesk", system-ui, -apple-system, "Segoe UI", sans-serif;
  --hand: "Kalam", "Segoe Print", "Comic Sans MS", cursive;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg) url("pattern.svg") repeat; background-size: 176px 176px;
  color: var(--ink); font-family: var(--body); font-size: 16px; line-height: 1.5;
  -webkit-text-size-adjust: 100%;
  padding-top: env(safe-area-inset-top, 0px);
}
img { max-width: 100%; }
[hidden] { display: none !important; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; -webkit-tap-highlight-color: transparent; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.wrap {
  max-width: 1100px; margin: 0 auto;
  padding-block: 20px 120px;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
}
.eyebrow { font-size: 12px; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); font-weight: 600; }
h1 { font-family: var(--display); font-weight: 400; font-size: clamp(32px, 8vw, 48px); line-height: 1.05; margin: 2px 0 6px; text-wrap: balance; }
.lede { color: var(--muted); margin: 0; max-width: 60ch; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 10px 18px; border-radius: 10px;
  border: 1px solid var(--line); background: var(--surface); font-weight: 600; font-size: 15px;
}
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.btn.danger { color: var(--danger); }
.btn.danger.armed { background: var(--danger); color: var(--surface); border-color: var(--danger); }
.btn.ghost { background: transparent; border-color: transparent; }
.btn.block { width: 100%; }
.btn:disabled { opacity: .55; cursor: default; }

/* Sign-in and name screens */
.gate { min-height: 100svh; display: grid; place-items: center; padding: 24px max(16px, env(safe-area-inset-right, 0px)) 24px max(16px, env(safe-area-inset-left, 0px)); }
.gate-card { width: min(420px, 100%); display: grid; gap: 18px; }
.gate-card h1 { font-size: clamp(36px, 10vw, 52px); }
.field { display: grid; gap: 6px; }
.field label, .lbl { font-size: 12px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); font-weight: 600; }
.field input, .field textarea {
  width: 100%; min-height: 48px; padding: 10px 12px; border-radius: 10px;
  border: 1px solid var(--line); background: var(--surface); font-size: 16px; /* 16px stops iPhone zooming in */
}
.field textarea { font-family: var(--hand); font-size: 18px; min-height: 110px; resize: vertical; line-height: 1.4; }
.error { color: var(--danger); font-size: 14px; margin: 0; }
.hint { color: var(--muted); font-size: 14px; margin: 0; }

/* Shoebox */
.top { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.top > div { min-width: 0; }
.me-btn { display: inline-flex; align-items: center; gap: 8px; border: 1px solid var(--line); background: var(--surface); border-radius: 999px; padding: 6px 12px 6px 6px; font-size: 14px; font-weight: 600; flex: none; max-width: 45%; }
.me-btn span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dot { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; font-size: 13px; font-weight: 700; color: #fff; flex: none; }
.dot.sm { width: 20px; height: 20px; font-size: 10px; }

.stats { display: flex; flex-wrap: wrap; gap: 6px 16px; align-items: center; margin: 16px 0 4px; font-size: 14px; color: var(--muted); font-variant-numeric: tabular-nums; }
.meter { flex: 1 1 160px; max-width: 260px; height: 6px; border-radius: 3px; background: var(--line); overflow: hidden; }
.meter i { display: block; height: 100%; background: var(--tab); }
.chips { display: flex; gap: 8px; overflow-x: auto; padding: 12px 0 6px; margin: 0 -4px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip { flex: none; display: inline-flex; align-items: center; gap: 6px; min-height: 36px; padding: 4px 14px 4px 6px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); font-size: 14px; font-weight: 500; margin: 0 4px; }
.chip.plain { padding-left: 14px; }
.chip[aria-pressed="true"] { background: var(--ink); color: var(--bg); border-color: var(--ink); }

.progress { margin: 14px 0; padding: 14px 16px; border-radius: 12px; background: var(--surface); border: 1px solid var(--line); display: grid; gap: 8px; }
.progress .bar { height: 6px; border-radius: 3px; background: var(--line); overflow: hidden; }
.progress .bar i { display: block; height: 100%; background: var(--accent); transition: width .2s; }
.progress ul { margin: 0; padding-left: 18px; color: var(--danger); font-size: 14px; }

.year { padding: 18px 0 6px; }
.year h2 { font-family: var(--display); font-weight: 400; font-size: 30px; line-height: 1; margin: 0 0 10px; display: flex; align-items: baseline; gap: 10px; }
.year h2 small { font-family: var(--body); font-size: 13px; color: var(--muted); }
.grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 4px; }
@media (min-width: 600px) { .grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; } }
.tile { position: relative; border: 0; padding: 0; background: var(--line); aspect-ratio: 1; overflow: hidden; border-radius: 4px; }
.tile img { width: 100%; height: 100%; object-fit: cover; display: block; }
/* Press-and-hold to drag on phones: no "Save image" menu or text selection getting in the way. */
.tile { -webkit-touch-callout: none; -webkit-user-select: none; user-select: none; }
.tile.drag-chosen { outline: 3px solid var(--tab); outline-offset: -3px; }
.tile.drag-ghost { opacity: .35; }
.arrange-hint { margin-top: 10px; }
.tile .who { position: absolute; left: 4px; bottom: 4px; }
.tile .cap-n { position: absolute; right: 4px; bottom: 4px; background: rgb(0 0 0 / .55); color: #fff; font-size: 12px; padding: 0 6px; border-radius: 999px; font-weight: 600; }

/* Caption bubble: appears above a photo when the mouse rests on it (computers only). */
.bubble {
  position: fixed; z-index: 30; pointer-events: none;
  max-width: min(300px, calc(100vw - 32px));
  background: var(--ink); color: var(--bg);
  padding: 10px 14px; border-radius: 14px;
  box-shadow: 0 10px 30px rgb(0 0 0 / .45);
  display: grid; gap: 8px;
}
.bubble::after {
  content: ""; position: absolute; left: var(--tail-x, 50%); bottom: -8px;
  border: 8px solid transparent; border-bottom: 0; border-top-color: var(--ink);
}
.bubble.below::after { bottom: auto; top: -8px; border-top: 0; border-bottom: 8px solid var(--ink); }
.bubble p { margin: 0; font-family: var(--hand); font-size: 16px; line-height: 1.3; overflow-wrap: anywhere; }
.bubble .by { font-size: 12px; font-weight: 600; opacity: .7; }

.empty { text-align: center; color: var(--muted); padding: 48px 8px; max-width: 460px; margin: 0 auto; }
.empty h2 { font-family: var(--display); font-weight: 400; color: var(--ink); font-size: 28px; margin: 0 0 8px; }

.dock {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
  padding: 12px max(16px, env(safe-area-inset-right, 0px)) calc(12px + env(safe-area-inset-bottom, 0px)) max(16px, env(safe-area-inset-left, 0px));
  background: linear-gradient(to top, var(--bg) 70%, transparent);
  display: flex; justify-content: center;
}
.dock .btn { width: min(420px, 100%); min-height: 52px; font-size: 17px; box-shadow: 0 6px 20px rgb(0 0 0 / .18); }
.add-btn { flex-direction: column; gap: 0; line-height: 1.2; padding-block: 8px; }
.add-btn small { font-size: 12.5px; font-weight: 500; opacity: .8; }

/* Bottom sheet (photo details, account) */
.sheet-bg { position: fixed; inset: 0; z-index: 40; background: rgb(10 14 12 / .55); display: flex; align-items: flex-end; justify-content: center; }
.sheet {
  background: var(--surface); width: min(760px, 100%); max-height: 92svh; overflow: auto;
  border-radius: 18px 18px 0 0; padding: 8px max(16px, env(safe-area-inset-right, 0px)) calc(20px + env(safe-area-inset-bottom, 0px)) max(16px, env(safe-area-inset-left, 0px));
  box-shadow: 0 -10px 40px rgb(0 0 0 / .3);
}
@media (min-width: 760px) { .sheet-bg { align-items: center; } .sheet { border-radius: 18px; max-height: 90vh; } }
.sheet-head { display: flex; align-items: center; gap: 12px; position: sticky; top: -8px; background: var(--surface); padding: 8px 0; z-index: 1; }
.sheet-head h3 { flex: 1; margin: 0; font-family: var(--display); font-weight: 400; font-size: 22px; min-width: 0; }
.sheet-body { display: grid; gap: 16px; }
.sheet .photo { width: 100%; max-height: 60svh; object-fit: contain; background: var(--bg); border-radius: 8px; min-height: 200px; }
.caps { display: grid; gap: 12px; }
.cap { display: grid; grid-template-columns: 20px 1fr; gap: 10px; }
.cap p { margin: 0; font-family: var(--hand); font-size: 18px; line-height: 1.35; overflow-wrap: anywhere; }
.cap .by { font-size: 13px; color: var(--muted); }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row .grow { flex: 1; }
hr { border: 0; border-top: 1px solid var(--line); margin: 4px 0; width: 100%; }

.toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(88px + env(safe-area-inset-bottom, 0px)); z-index: 60; background: var(--ink); color: var(--bg); padding: 10px 16px; border-radius: 10px; font-size: 15px; max-width: calc(100% - 32px); box-shadow: 0 8px 24px rgb(0 0 0 / .3); }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
