/* Miller Family Album — shared tokens and primitives (viewer + admin). */
:root {
  --paper: #f6f1e9;
  --paper-2: #efe8dc;
  --card: #fffdf9;
  --ink: #221d18;
  --ink-2: #4a4239;
  --muted: #8a7f72;
  --line: #e4dbcd;
  --line-2: #d6cbb9;
  --accent: #a4502e;
  --accent-2: #c46a43;
  --accent-ink: #fffaf5;
  --danger: #b23a2a;
  --ok: #3f7a52;
  --shadow-sm: 0 1px 2px rgba(60, 40, 20, .06), 0 2px 8px rgba(60, 40, 20, .05);
  --shadow: 0 2px 6px rgba(60, 40, 20, .07), 0 12px 32px -8px rgba(60, 40, 20, .18);
  --shadow-lg: 0 24px 60px -12px rgba(30, 20, 10, .35);
  --r-sm: 8px; --r: 14px; --r-lg: 22px; --pill: 999px;
  --script: "Great Vibes", cursive;
  --serif: "Fraunces", Georgia, serif;
  --sans: "Instrument Sans", ui-sans-serif, -apple-system, "Segoe UI", sans-serif;
  --ease: cubic-bezier(.2, .8, .2, 1);
  --safe-b: env(safe-area-inset-bottom, 0px);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --paper: #15120f; --paper-2: #1c1814; --card: #221d18;
    --ink: #f4ede3; --ink-2: #d5cabb; --muted: #9d9182;
    --line: #322b24; --line-2: #443a30;
    --accent: #e08a5f; --accent-2: #eea27c; --accent-ink: #1a120c;
    --danger: #ef7b66; --ok: #7cc293;
    --shadow-sm: 0 1px 2px rgba(0,0,0,.4);
    --shadow: 0 2px 6px rgba(0,0,0,.35), 0 12px 32px -8px rgba(0,0,0,.6);
    --shadow-lg: 0 24px 60px -12px rgba(0,0,0,.8);
    color-scheme: dark;
  }
}

*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  background: var(--paper);
  color: var(--ink);
  font: 400 16px/1.5 var(--sans);
  -webkit-font-smoothing: antialiased;
  min-height: 100dvh;
}
/* Fine paper grain, fixed so it never repaints on scroll. */
body::before {
  content: ""; position: fixed; inset: 0; pointer-events: none; z-index: 0; opacity: .5;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0.4 0 0 0 0 0.3 0 0 0 0 0.2 0 0 0 .05 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}
body > * { position: relative; z-index: 1; }
img, video { display: block; max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
a { color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
[hidden] { display: none !important; }

.script { font-family: var(--script); font-weight: 400; line-height: 1.05; letter-spacing: 0; }
.serif { font-family: var(--serif); font-optical-sizing: auto; }
.eyebrow { font-size: 12px; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }
.muted { color: var(--muted); }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 0 18px; border-radius: var(--pill);
  font-weight: 600; font-size: 15px; white-space: nowrap; text-decoration: none;
  background: var(--card); color: var(--ink); border: 1px solid var(--line-2);
  transition: transform .15s var(--ease), background .2s, border-color .2s, box-shadow .2s;
}
.btn:hover { border-color: var(--ink-2); }
.btn:active { transform: scale(.97); }
.btn--primary { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.btn--primary:hover { background: var(--ink-2); border-color: var(--ink-2); }
.btn--accent { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.btn--ghost { background: transparent; border-color: transparent; }
.btn--ghost:hover { background: var(--paper-2); border-color: transparent; }
.btn--danger { color: var(--danger); }
.btn--sm { min-height: 36px; padding: 0 14px; font-size: 14px; }
.btn[disabled] { opacity: .45; pointer-events: none; }
.icon-btn {
  width: 44px; height: 44px; display: inline-grid; place-items: center; border-radius: var(--pill);
  color: var(--ink-2); transition: background .2s, transform .15s var(--ease);
}
.icon-btn:hover { background: var(--paper-2); }
.icon-btn:active { transform: scale(.92); }
.icon { width: 22px; height: 22px; stroke: currentColor; fill: none; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }

/* Inputs */
.field { display: grid; gap: 6px; }
.field > span { font-size: 13px; font-weight: 600; color: var(--ink-2); }
.input, .select, .textarea {
  width: 100%; min-height: 46px; padding: 10px 14px; border-radius: 12px;
  background: var(--card); border: 1px solid var(--line-2); font-size: 16px; /* 16px stops iOS zoom */
  transition: border-color .2s, box-shadow .2s;
}
.textarea { min-height: 96px; resize: vertical; line-height: 1.45; }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 18%, transparent); }
.select { appearance: none; padding-right: 40px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' fill='none' stroke='%238a7f72' stroke-width='1.8'%3E%3Cpath d='M1 1.5l5 5 5-5'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 16px center; }

/* Chips */
.chip {
  display: inline-flex; align-items: center; gap: 6px; height: 36px; padding: 0 14px;
  border-radius: var(--pill); border: 1px solid var(--line-2); background: var(--card);
  font-size: 14px; font-weight: 500; color: var(--ink-2); white-space: nowrap;
  transition: background .2s, color .2s, border-color .2s, transform .15s var(--ease);
}
.chip:active { transform: scale(.96); }
.chip[aria-pressed="true"] { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.chip small { font-size: 12px; opacity: .6; }
.tag { display: inline-flex; align-items: center; height: 26px; padding: 0 10px; border-radius: var(--pill); background: var(--paper-2); color: var(--ink-2); font-size: 13px; }

/* Toast */
.toast {
  position: fixed; left: 50%; bottom: calc(24px + var(--safe-b)); z-index: 100; transform: translate(-50%, 20px);
  background: var(--ink); color: var(--paper); padding: 12px 18px; border-radius: var(--pill);
  font-size: 14px; font-weight: 500; box-shadow: var(--shadow-lg); opacity: 0; pointer-events: none;
  transition: opacity .25s, transform .3s var(--ease); max-width: calc(100vw - 32px);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* Thumbs */
.thumb { position: relative; overflow: hidden; background: var(--paper-2); }
.thumb img { width: 100%; height: 100%; object-fit: cover; opacity: 0; transition: opacity .4s, transform .5s var(--ease); }
.thumb img.ready { opacity: 1; }
.badge {
  position: absolute; left: 8px; bottom: 8px; display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 8px 3px 6px; border-radius: var(--pill); font-size: 12px; font-weight: 600;
  background: rgba(20, 14, 10, .62); color: #fff; backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
}
.badge svg { width: 12px; height: 12px; fill: #fff; }

@keyframes rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
.rise { animation: rise .6s var(--ease) both; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }
