:root {
  /* Mesmo mundo do site do casamento: preto e branco, serifada em caixa alta,
     caligrafia para os nomes, sem serifa espaçada para o texto. Uma coluna, pensada para o polegar. */
  --ink: #141412;
  --ink-2: #1f1f1c;
  --paper: #ffffff;
  --ash: #8f8f89;
  --line: rgba(255, 255, 255, 0.18);
  --line-dark: rgba(20, 20, 18, 0.14);
  --alert: #ff6b5e;
  --font-script: 'Pinyon Script', 'Snell Roundhand', 'Apple Chancery', cursive;
  --font-display: 'Instrument Serif', 'Bodoni 72', Didot, 'Times New Roman', serif;
  --font-body: 'Montserrat', 'Avenir Next', 'Helvetica Neue', Arial, sans-serif;
  --gutter: 24px;
  --tabbar-h: 58px;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  background: var(--ink);
  color: var(--paper);
  font-family: var(--font-body);
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior-y: none;
}
img, video { max-width: 100%; display: block; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid currentColor; outline-offset: 3px; }
.sr { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; overflow: hidden; }
[hidden] { display: none !important; }

.app { height: 100%; display: flex; flex-direction: column; max-width: 520px; margin: 0 auto; position: relative; }
.view { flex: 1; min-height: 0; overflow-y: auto; -webkit-overflow-scrolling: touch; outline: none; }

/* Fundo com o padrão de desenhos do site, bem discreto */
.dark {
  background-color: var(--ink);
  background-image: url('assets/estampa.png');
  background-size: 460px auto;
  background-position: center top;
  color: var(--paper);
}
.light { background: var(--paper); color: var(--ink); color-scheme: light; }

/* Tipografia */
.script { font-family: var(--font-script); font-weight: 400; line-height: 1.1; }
.display { font-family: var(--font-display); font-weight: 400; text-transform: uppercase; letter-spacing: 0.01em; line-height: 0.98; }
.caps { text-transform: uppercase; letter-spacing: 0.16em; font-size: 11px; font-weight: 500; }
.muted { color: var(--ash); }
h1, h2, p { margin: 0; text-wrap: balance; }

.lockup { display: flex; align-items: baseline; gap: 8px; }
.lockup .display { font-size: 34px; }
.lockup .script { font-size: 46px; transform: translateY(4px); }

/* Entrada */
.welcome { min-height: 100%; display: flex; flex-direction: column; gap: 28px; padding: calc(36px + env(safe-area-inset-top)) var(--gutter) calc(28px + env(safe-area-inset-bottom)); }
.welcome .names { margin: 0; display: flex; justify-content: center; }
.names-img { width: 100%; max-width: 360px; height: auto; }
.names-small { width: 168px; height: auto; flex: none; }
.welcome-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; }
.motto { font-size: 30px; }
.motto .script { font-size: 40px; text-transform: none; display: inline-block; transform: translateY(3px); }
.date { text-align: right; font-size: 30px; line-height: 1.15; font-weight: 400; font-variant-numeric: tabular-nums; }
.date b { font-style: italic; font-weight: 700; display: block; }
.blurb { text-align: justify; max-width: 34em; }
.sprig { width: 84px; height: auto; align-self: center; }
.light .sprig { filter: invert(1); }

.form { display: flex; flex-direction: column; gap: 18px; margin-top: auto; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field input, .field select {
  background: transparent; border: 0; border-bottom: 1px solid var(--line); border-radius: 0;
  padding: 10px 0; font-size: 18px; width: 100%; appearance: none; -webkit-appearance: none;
}
.field select option { color: #141412; }
.field input::placeholder { color: var(--ash); }
.field input:focus, .field select:focus { outline: none; border-bottom-color: currentColor; }
.light .field input, .light .field select { border-bottom-color: var(--line-dark); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 52px; padding: 0 22px; border: 1px solid currentColor; background: transparent;
  text-transform: uppercase; letter-spacing: 0.2em; font-size: 12px; font-weight: 600; border-radius: 0;
  text-decoration: none; color: inherit;
}
.btn.solid { background: var(--paper); color: var(--ink); border-color: var(--paper); }
.light .btn.solid { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.btn.small { min-height: 40px; padding: 0 14px; font-size: 10.5px; }
.btn.danger { color: var(--alert); }
.btn:disabled { opacity: 0.4; cursor: default; }
.link { background: none; border: 0; padding: 6px 0; text-decoration: underline; text-underline-offset: 4px; color: inherit; }
.notice { border: 1px solid var(--line); padding: 10px 12px; font-size: 11.5px; line-height: 1.5; }
.light .notice { border-color: var(--line-dark); }
.notice.alert { border-color: var(--alert); color: var(--alert); }

/* Câmera */
.camera { min-height: 100%; display: flex; flex-direction: column; gap: 18px; padding: calc(18px + env(safe-area-inset-top)) var(--gutter) 22px; }
.topline { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.who { text-align: right; line-height: 1.5; }
.camera .stage { display: flex; flex-direction: column; gap: 10px; }
.counter { font-variant-numeric: tabular-nums; }

.strip { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.shot { position: relative; aspect-ratio: 1; background: var(--ink-2); overflow: hidden; border: 0; padding: 0; }
.shot img { width: 100%; height: 100%; object-fit: cover; filter: grayscale(0.15); }
.shot .state { position: absolute; inset: 0; display: grid; place-items: center; background: rgba(20, 20, 18, 0.55); font-size: 10px; letter-spacing: 0.14em; text-transform: uppercase; font-weight: 600; text-align: center; padding: 4px; }
.shot.done .state { background: none; place-items: end; padding: 5px; }
.shot.done .state::after { content: '✓'; background: var(--paper); color: var(--ink); width: 18px; height: 18px; border-radius: 50%; display: grid; place-items: center; font-size: 11px; letter-spacing: 0; }
.shot.error .state { color: var(--alert); }
.shot .bar { position: absolute; left: 0; bottom: 0; height: 3px; background: var(--paper); transition: width 0.25s linear; }
.empty-strip { border: 1px dashed var(--line); padding: 22px 16px; text-align: center; }

.controls { margin-top: auto; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 12px; padding-top: 8px; }
.side { display: flex; flex-direction: column; align-items: center; gap: 8px; background: none; border: 0; padding: 8px 0; }
.side svg { width: 28px; height: 28px; }
.shutter { width: 92px; height: 92px; border-radius: 50%; border: 2px solid var(--paper); background: transparent; padding: 6px; display: grid; }
.shutter span { border-radius: 50%; background: var(--paper); transition: transform 0.12s ease; }
.shutter:active span { transform: scale(0.9); }
.hint { text-align: center; }

/* Álbum */
.album { min-height: 100%; padding: calc(22px + env(safe-area-inset-top)) 0 24px; display: flex; flex-direction: column; gap: 16px; }
.album > .pad { padding: 0 var(--gutter); display: flex; flex-direction: column; gap: 12px; }
.album-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; }
.chips { display: flex; gap: 8px; overflow-x: auto; padding: 2px var(--gutter); scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip { flex: none; min-height: 36px; padding: 0 14px; border: 1px solid var(--line-dark); background: transparent; text-transform: uppercase; letter-spacing: 0.14em; font-size: 10.5px; font-weight: 600; white-space: nowrap; }
.chip[aria-pressed="true"] { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 2px; }
.tile { position: relative; aspect-ratio: 1; padding: 0; border: 0; background: #ececea; overflow: hidden; }
.tile img { width: 100%; height: 100%; object-fit: cover; }
.tile .badge { position: absolute; right: 6px; bottom: 6px; background: rgba(20, 20, 18, 0.75); color: #fff; font-size: 9px; letter-spacing: 0.12em; padding: 3px 6px; text-transform: uppercase; font-weight: 600; }
.tile.is-hidden img { opacity: 0.3; }
.tile .novid { width: 100%; height: 100%; display: grid; place-items: center; background: var(--ink); color: #fff; }
.empty { padding: 48px var(--gutter); text-align: center; display: flex; flex-direction: column; gap: 14px; align-items: center; }
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.stat { border-top: 1px solid var(--ink); padding-top: 8px; }
.stat b { display: block; font-family: var(--font-display); font-weight: 400; font-size: 34px; line-height: 1; font-variant-numeric: tabular-nums; }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }

/* Abas */
.tabbar { flex: none; display: grid; grid-template-columns: 1fr 1fr; background: var(--ink); border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom); }
.tabbar a { height: var(--tabbar-h); display: grid; place-items: center; color: var(--ash); text-decoration: none; text-transform: uppercase; letter-spacing: 0.24em; font-size: 11px; font-weight: 600; }
.tabbar a[aria-current="page"] { color: var(--paper); box-shadow: inset 0 2px 0 var(--paper); }

/* Visualizador */
.lightbox { position: fixed; inset: 0; z-index: 30; background: #0b0b0a; color: #fff; display: flex; flex-direction: column; color-scheme: dark; }
.lb-top { display: flex; justify-content: space-between; align-items: center; padding: calc(10px + env(safe-area-inset-top)) 12px 10px; }
.lb-top button, .lb-nav button { background: none; border: 0; min-width: 44px; min-height: 44px; font-size: 22px; }
.lb-stage { flex: 1; min-height: 0; display: grid; place-items: center; position: relative; }
.lb-stage img, .lb-stage video { max-height: 100%; max-width: 100%; object-fit: contain; }
.lb-nav { position: absolute; inset: 0; display: flex; justify-content: space-between; align-items: center; pointer-events: none; }
.lb-nav button { pointer-events: auto; background: rgba(11, 11, 10, 0.45); height: 64px; }
.lb-bottom { padding: 12px var(--gutter) calc(16px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 12px; }
.lb-bottom .script { font-size: 30px; }

/* Confirmação e avisos */
.sheet-wrap { position: fixed; inset: 0; z-index: 40; background: rgba(0, 0, 0, 0.6); display: flex; align-items: flex-end; justify-content: center; }
.sheet { background: var(--paper); color: var(--ink); width: 100%; max-width: 520px; padding: 24px var(--gutter) calc(24px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 16px; color-scheme: light; }
.sheet .display { font-size: 28px; }
.toasts { position: fixed; left: 0; right: 0; bottom: calc(var(--tabbar-h) + 16px + env(safe-area-inset-bottom)); z-index: 50; display: flex; flex-direction: column; align-items: center; gap: 8px; pointer-events: none; padding: 0 16px; }
.toast { background: var(--paper); color: var(--ink); padding: 10px 16px; font-size: 12px; font-weight: 500; max-width: 420px; text-align: center; box-shadow: 0 6px 24px rgba(0, 0, 0, 0.35); }

@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }
