/* "Paper & Dots": white paper, 1px ink lines, square content boxes, pill actions, a soft green accent.
   Tokens come from UI/Claude outputs/wedding-tokens-v2.css. */
:root {
  color-scheme: light;
  /* colour: paper (home) */
  --c-paper: #ffffff; --c-paper-2: #f6f5f1; --c-ink: #111111; --c-ink-2: #57544f;
  --c-dot: #7d7975; --c-line: #111111; --c-line-soft: rgba(17, 17, 17, .14);
  --c-accent: #ccd898; --c-accent-press: #b8c67e; --c-on-accent: #111111;
  --c-ok: #2fbf71; --c-err: #b03a2e; --c-rec: #e5483a;
  /* colour: camera */
  --c-night: #0e0e0d; --c-on-dark: #ffffff;
  --c-smoke: rgba(14, 14, 13, .62); --c-smoke-line: rgba(255, 255, 255, .55);
  /* type */
  --f-display: "Inter Tight", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --f-serif: "EB Garamond", Georgia, "Times New Roman", serif;
  --f-tag: "Barlow Condensed", "Arial Narrow", sans-serif;
  --ls-tag: .06em;
  /* radius: content is a square box, actions are pills */
  --r-pill: 999px;
  /* size */
  --h-btn: 60px; --h-btn-hero: 76px; --h-btn-sm: 48px; --h-field: 56px; --tap: 44px;
  --gutter: 28px;
  --e-cam: 0 6px 24px rgba(0, 0, 0, .28);
  --blur: blur(12px);
  --ease-out: cubic-bezier(.22, 1, .36, 1);
  font-family: var(--f-display);
  font-weight: 300;
  -webkit-text-size-adjust: 100%;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { background: var(--c-paper); color: var(--c-ink); line-height: 1.5; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }

h1 { font-size: 2.5rem; font-weight: 300; line-height: 1.05; letter-spacing: -.015em; margin: 0 0 .5rem; }
p { margin: 0 0 .75rem; }
strong { font-weight: 500; }
.eyebrow, .tag { font-family: var(--f-tag); font-size: .875rem; letter-spacing: var(--ls-tag); text-transform: uppercase; font-weight: 500; margin: 0 0 .5rem; }
.note { color: var(--c-ink-2); font-size: .9rem; }
.error-text { color: var(--c-err); }

.screen {
  min-height: 100dvh;
  padding: max(54px, calc(env(safe-area-inset-top) + 24px)) var(--gutter) max(30px, calc(env(safe-area-inset-bottom) + 24px));
  max-width: 520px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.center { justify-content: center; align-items: center; text-align: center; }

.actions { display: flex; flex-direction: column; gap: 12px; margin-top: auto; width: 100%; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  min-height: var(--h-btn); padding: 0 24px; width: 100%;
  border: 1px solid var(--c-ink); border-radius: var(--r-pill);
  background: var(--c-accent); color: var(--c-on-accent);
  font: inherit; font-size: 1.375rem; font-weight: 300; letter-spacing: -.01em;
  cursor: pointer; transition: background .16s;
}
.btn:active { background: var(--c-accent-press); }
.btn:disabled { opacity: .5; }
.btn-ghost { background: var(--c-paper); color: var(--c-ink); }
.btn-ghost:active, .btn-special:not([hidden]) + .btn:active { background: var(--c-paper-2); }
/* With Special on screen it is the main action, so Scan steps back to an outline. */
.btn-special:not([hidden]) + .btn { background: var(--c-paper); }
.btn-special { min-height: var(--h-btn-hero); font-size: 1.75rem; animation: ring 2.4s ease-in-out infinite; }
@keyframes ring { 50% { box-shadow: 0 0 0 6px rgba(204, 216, 152, .55); } }
@keyframes pulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(229, 72, 58, .55); } 50% { box-shadow: 0 0 0 14px rgba(229, 72, 58, 0); } }
.btn-small { width: auto; min-height: var(--h-btn-sm); padding: 0 20px; font-size: 1.0625rem; }
.btn-small-spacer { width: 80px; }

/* Loading is a ring of dots. */
.spinner {
  width: 48px; height: 48px; border-radius: 50%;
  border: 3px dotted var(--c-ink);
  animation: spin 2.4s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.home-head { padding-bottom: 14px; border-bottom: 1px solid var(--c-line); }
.home-butterfly { display: flex; flex-direction: column; align-items: center; text-align: center; }
.butterfly-canvas { width: 100%; aspect-ratio: 1; display: block; touch-action: pan-y; }
.butterfly-canvas.big { flex: 1; min-height: 0; aspect-ratio: auto; }

/* Dial: a ring of dots with a hairline circle inside, around the butterfly. */
.dial { position: relative; width: 100%; padding: 14%; }
.dial::before, .dial::after { content: ""; position: absolute; border-radius: 50%; pointer-events: none; }
.dial::before { inset: 0; border: 3px dotted var(--c-dot); }
.dial::after { inset: 6%; border: 1px solid var(--c-line-soft); }
.dial .butterfly-canvas { position: relative; z-index: 1; }

.couple { white-space: nowrap; font-size: clamp(1.7rem, 8.8vw, 3.25rem); line-height: 1.02; letter-spacing: -.02em; margin-bottom: .35rem; }
.date { font-family: var(--f-tag); font-size: .875rem; font-weight: 500; letter-spacing: var(--ls-tag); text-transform: uppercase; margin: 0 0 .6rem; }

.countdown { text-align: center; padding: 14px 0; border-bottom: 1px solid var(--c-line-soft); }
.countdown .eyebrow { margin-bottom: .2rem; color: var(--c-ink-2); }
.countdown time { display: block; font-size: 2.5rem; font-weight: 300; line-height: 1.1; letter-spacing: -.01em; font-variant-numeric: tabular-nums; }

.home-invite { border: 1px solid var(--c-ink); padding: 18px 20px; }
.home-invite p { margin: 0; font-family: var(--f-serif); font-size: 1.1875rem; line-height: 1.45; font-weight: 400; }
.home-invite strong { font-weight: 400; font-family: var(--f-tag); text-transform: uppercase; letter-spacing: var(--ls-tag); font-size: 1.05em; }

/* The guest's name and wish read like a card line: a tag-style name, then the wish in serif. */
.guest-message {
  display: grid; grid-template-columns: auto minmax(0, 1fr); gap: .7em;
  width: 100%; max-width: 30rem; margin: 20px 0 0;
  text-align: left; font-family: var(--f-serif); font-weight: 400; font-size: 1.1875rem; line-height: 1.45;
}
.home-butterfly .guest-message { border: 1px solid var(--c-ink); padding: 18px 20px; }
.guest-message .prompt { color: var(--c-ink-2); }
.guest-message > span:last-child { white-space: pre-wrap; overflow-wrap: anywhere; }
.guest-message strong { font-family: var(--f-tag); font-weight: 500; font-size: .95em; text-transform: uppercase; letter-spacing: var(--ls-tag); }
.guest-message .wish:not(:empty)::before { content: ": \201C"; }
.guest-message .wish:not(:empty)::after { content: "\201D"; }
.home-butterfly .note { margin-top: 16px; }
.banner { border: 1px solid var(--c-ink); padding: 10px 16px; font-size: .9rem; }

/* Scan: full-screen camera with a line overlay (white strokes, no fills) */
.scan { position: fixed; inset: 0; max-width: none; padding: 0; background: #000; color: #fff; }
.scan-video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.scan-overlay { position: absolute; inset: 0; width: 100%; height: 100%; }
.scan-overlay .frame { fill: none; stroke: rgba(255, 255, 255, .6); stroke-width: 1; stroke-dasharray: 6 8; }
.scan-overlay .ring { fill: none; stroke: #fff; stroke-width: 3; filter: drop-shadow(0 0 2px rgba(0, 0, 0, .5)); transition: stroke .15s; }
.scan-overlay .ring.locked { stroke: var(--c-ok); filter: drop-shadow(0 0 8px rgba(47, 191, 113, .65)); }
.scan-hint {
  position: absolute; left: 50%; top: max(20px, calc(env(safe-area-inset-top) + 8px)); transform: translateX(-50%);
  width: max-content; max-width: calc(100% - 2 * var(--gutter)); margin: 0; padding: 8px 18px; text-align: center;
  background: var(--c-smoke); border: 1px solid var(--c-smoke-line); border-radius: 24px; backdrop-filter: var(--blur);
  font-size: .95rem; font-weight: 400; line-height: 1.35;
}
.scan-bar {
  position: absolute; left: 0; right: 0; bottom: 0;
  padding: 16px var(--gutter) max(28px, calc(env(safe-area-inset-bottom) + 12px));
  display: flex; align-items: center; justify-content: space-between;
}
.scan-bar .btn-ghost, .special .btn-ghost { color: #fff; background: var(--c-smoke); border-color: var(--c-smoke-line); backdrop-filter: var(--blur); }
.shutter {
  width: 76px; height: 76px; border-radius: 50%; padding: 5px;
  border: 3px solid #fff; background: #fff; background-clip: content-box; cursor: pointer;
  transition: border-color .15s, background-color .15s;
}
.shutter.ready { border-color: var(--c-ok); background-color: var(--c-ok); }
.toast {
  position: absolute; left: 50%; bottom: 140px; transform: translateX(-50%);
  background: var(--c-smoke); color: #fff; padding: 10px 20px; border-radius: 24px; border: 1px solid var(--c-smoke-line); backdrop-filter: var(--blur);
  max-width: 90%; text-align: center; font-size: .95rem;
}
.scan-busy { position: absolute; inset: 0; background: rgba(14, 14, 13, .72); display: flex; flex-direction: column; gap: 12px; }
.scan-busy .spinner { border-color: #fff; }
.scan-busy-inline { display: flex; flex-direction: column; align-items: center; gap: 8px; }

/* Form */
.field { display: flex; flex-direction: column; gap: 8px; margin-bottom: 14px; }
.field span { font-family: var(--f-tag); font-size: .875rem; font-weight: 500; letter-spacing: var(--ls-tag); text-transform: uppercase; display: flex; justify-content: space-between; }
.field small { color: var(--c-ink-2); font-weight: 500; letter-spacing: var(--ls-tag); }
.field input, .field textarea {
  font-family: var(--f-serif); font-size: 1.1875rem; /* over 16px, so iOS does not zoom on focus */
  min-height: var(--h-field); padding: 0 16px; border-radius: 0; border: 1px solid var(--c-ink); background: var(--c-paper); color: var(--c-ink);
}
.field textarea { padding: 14px 16px; line-height: 1.45; resize: none; }
.field input:focus, .field textarea:focus { outline: 2px solid var(--c-accent-press); outline-offset: 2px; }

/* Special: full-screen camera canvas on the same dark ground as scan */
.special {
  position: fixed; inset: 0; max-width: none; padding: 0; color: #fff;
  background:
    radial-gradient(120% 60% at 50% -10%, rgba(255, 255, 255, .14), transparent 60%),
    linear-gradient(180deg, #24241f 0%, #161613 55%, var(--c-night) 100%);
}
.special-video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; pointer-events: none; }
.special-canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; }
.special-top {
  position: absolute; left: 0; right: 0; top: 0; z-index: 2;
  display: flex; align-items: center; gap: 14px;
  padding: max(20px, calc(env(safe-area-inset-top) + 8px)) var(--gutter) 12px;
}
.special-icon {
  width: var(--tap); height: var(--tap); padding: 0; border-radius: 50%; border: 1px solid var(--c-smoke-line); flex: none; display: grid; place-items: center;
  background: var(--c-smoke); backdrop-filter: var(--blur); color: #fff; cursor: pointer;
}
.special-icon svg { width: 16px; height: 16px; }
.special-icon:disabled { opacity: .4; }
.special-eye { margin-left: auto; }
.special-eye svg { width: 20px; height: 20px; }
.special-eye.on { background: #fff; color: var(--c-ink); border-color: #fff; }

/* Name labels: corner brackets, a thin line and a small box, in the accent colour like a tracking overlay. */
.special-names { position: absolute; inset: 0; width: 100%; height: 100%; z-index: 2; pointer-events: none; }
.nl-shadow, .nl-lines { fill: none; }
.nl-shadow { stroke: rgba(0, 0, 0, .4); stroke-width: 3; }
.nl-lines { stroke: var(--c-accent); stroke-width: 1; }
.nl-box { fill: rgba(14, 14, 13, .72); stroke: var(--c-accent); stroke-width: 1; }
.nl-text { fill: #fff; font-family: var(--f-tag); font-size: 11px; font-weight: 500; letter-spacing: var(--ls-tag); text-transform: uppercase; }
/* Loading shows as a single hairline filling up, with no label. */
.special-progress { flex: 1; position: relative; height: 2px; border-radius: 1px; background: rgba(255, 255, 255, .3); overflow: hidden; }
.special-progress > div { position: absolute; inset: 0 auto 0 0; width: 0; background: #fff; transition: width .2s; }
.special-progress > span { display: none; }
.special-message {
  position: absolute; left: var(--gutter); right: var(--gutter); top: 45%; z-index: 2; text-align: center;
  background: var(--c-smoke); border: 1px solid var(--c-smoke-line); backdrop-filter: var(--blur); padding: 14px 18px;
}
.special-bottom {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 2;
  display: flex; flex-direction: column; align-items: center; gap: 10px;
  padding: 12px var(--gutter) max(28px, calc(env(safe-area-inset-bottom) + 12px));
}
/* Video: the bigger button, in the middle. Photo: smaller, just to its left. */
.special-record, .special-shoot {
  padding: 0; border-radius: 50%; display: grid; place-items: center; cursor: pointer; color: #fff;
  border: 3px solid #fff;
}
.special-record { grid-column: 2; width: 84px; height: 84px; background: var(--c-rec); }
.special-record svg { width: 38px; height: 38px; }
.special-record .icon-stop, .special-record.on .icon-video { display: none; }
.special-record.on .icon-stop { display: block; }
.special-shoot { grid-column: 1; justify-self: end; margin-right: 22px; width: 58px; height: 58px; border-width: 1px; border-color: var(--c-smoke-line); background: var(--c-smoke); backdrop-filter: var(--blur); }
.special-shoot svg { width: 26px; height: 26px; }
.special-shoot:disabled { opacity: .4; }
/* Without video recording the photo button takes the middle. */
.special-row:has(.special-record[hidden]) .special-shoot { grid-column: 2; margin-right: 0; }
.special-hint {
  position: absolute; left: 50%; top: 50%; z-index: 2; transform: translate(-50%, -50%);
  width: max-content; max-width: calc(100% - 2 * var(--gutter)); text-align: center;
  margin: 0; padding: 10px 20px; border-radius: 24px; font-size: 1.05rem; line-height: 1.35;
  background: var(--c-smoke); border: 1px solid var(--c-smoke-line); backdrop-filter: var(--blur);
  opacity: 0; transition: opacity .6s; pointer-events: none;
}
.special-hint.on { opacity: 1; }
.special-flash { position: absolute; inset: 0; z-index: 3; background: #fff; opacity: 0; pointer-events: none; }
.special-flash.on { animation: shutter .35s ease-out; }
@keyframes shutter { from { opacity: .85; } to { opacity: 0; } }
.special-record.on { animation: pulse 1s ease-in-out infinite; }
.special-timer { font-variant-numeric: tabular-nums; font-size: .95rem; letter-spacing: .04em; text-shadow: 0 1px 4px rgba(0, 0, 0, .7); min-height: 1.2em; }
.special-saved { display: flex; flex-direction: column; gap: 8px; width: 100%; max-width: 360px; }
.special-row { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; width: 100%; }
/* The guest's card floats over the camera like a piece of paper. */
.special-card {
  display: flex; gap: 14px; align-items: center; width: 100%; max-width: 360px;
  background: var(--c-paper); color: var(--c-ink); border: 1px solid var(--c-ink); box-shadow: var(--e-cam);
  padding: 14px 18px 14px 14px; opacity: 0; transform: translateY(10px); transition: opacity .45s, transform .45s var(--ease-out); pointer-events: none;
}
.special-card.on { opacity: 1; transform: none; }
.special-card canvas { width: 64px; height: 64px; flex: none; border-radius: 50%; box-shadow: inset 0 0 0 1px var(--c-line-soft); }
.special-card .guest-message { margin: 0; font-size: 1.125rem; line-height: 1.4; }

@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }
