/* Wedding website questionnaire · styled after the invitation suite, built for phones */
:root {
  --cream: #F0E6DA;
  --paper: #FAF5EE;
  --card: #FFFDF9;
  --blush: #D9ADAC;
  --blush-soft: #F6E4E2;
  --rose: #C34F64;
  --rose-deep: #A63F54;
  --wine: #64162A;
  --olive-deep: #6E6B2A;
  --ink: #3B2126;
  --ink-soft: #6A4B4F;
  --line: rgba(59, 33, 38, 0.14);
  --line-strong: rgba(59, 33, 38, 0.24);
  --ok: #4F7A45;
  --error: #B3261E;
  --font-display: "Cormorant Garamond", Garamond, "Times New Roman", serif;
  --font-body: "EB Garamond", Garamond, Georgia, serif;
  --font-script: "Pinyon Script", "Snell Roundhand", cursive;
  --font-thai: "Noto Serif Thai", Thonburi, serif;
  --stripes: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='40' height='240'%3E%3Cpath fill='%23D9ADAC' d='M11 0Q15 60 11 120T11 240H29Q25 180 29 120T29 0Z'/%3E%3C/svg%3E");
  --shadow: 0 16px 36px -22px rgba(100, 22, 42, 0.45);
  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 18px;
  line-height: 1.5;
  font-variant-numeric: lining-nums;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
img { max-width: 100%; height: auto; display: block; }
a { color: var(--rose); }
p { margin: 0 0 0.7em; }
h1, h2, h3 { margin: 0; }
ul, ol, dl, dd { margin: 0; padding: 0; list-style: none; }
button, input, textarea, select { font: inherit; color: inherit; touch-action: manipulation; }
[hidden] { display: none !important; }
[lang="th"] { font-family: var(--font-thai); }
:focus-visible { outline: 2px solid var(--rose); outline-offset: 3px; }
h1:focus { outline: none; }
.sr-only { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.small { font-size: 0.9rem; color: var(--ink-soft); }
.muted { color: var(--ink-soft); }

/* =========================================================
   Couple's flow: one question per screen
   ========================================================= */
.flow { min-height: 100dvh; }

.bar {
  position: sticky; top: 0; z-index: 10;
  display: grid; grid-template-columns: 44px 1fr auto; align-items: center; gap: 12px;
  height: 56px;
  padding: env(safe-area-inset-top) 16px 0 6px;
  box-sizing: content-box;
  background: rgba(250, 245, 238, 0.96);
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
}
.bar__back {
  width: 44px; height: 44px;
  display: grid; place-items: center;
  border: 0; border-radius: 50%; background: none;
  color: var(--wine); cursor: pointer;
}
.bar__back:active { background: var(--blush-soft); }
.bar__track { height: 6px; border-radius: 3px; background: var(--blush-soft); overflow: hidden; }
.bar__fill { height: 100%; width: 0; background: var(--rose); border-radius: 3px; transition: width 0.35s ease; }
.bar__count { font-size: 0.92rem; color: var(--ink-soft); font-variant-numeric: tabular-nums; min-width: 3.2em; text-align: right; }

.stage {
  max-width: 560px;
  margin: 0 auto;
  padding: 20px 20px calc(40px + env(safe-area-inset-bottom));
}
.loading { text-align: center; padding: 30vh 0 0; color: var(--ink-soft); }
.loading img { margin: 0 auto 12px; width: 26px; animation: pulse 1.4s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: 0.35; } }

.screen.enter { animation: enter 0.28s ease both; }
.screen.enter-back { animation: enter-back 0.28s ease both; }
@keyframes enter { from { opacity: 0; transform: translateX(24px); } }
@keyframes enter-back { from { opacity: 0; transform: translateX(-24px); } }

.group {
  font-size: 0.78rem; font-weight: 600; letter-spacing: 0.16em; text-transform: uppercase;
  color: var(--rose);
  margin: 6px 0 8px;
}
.question {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: clamp(1.85rem, 1.5rem + 1.6vw, 2.35rem);
  line-height: 1.12;
  color: var(--wine);
  margin-bottom: 10px;
  text-wrap: balance;
}
.help { font-size: 1.05rem; color: var(--ink-soft); margin-bottom: 18px; }

/* Text answers */
.answer {
  display: block;
  width: 100%;
  margin-top: 6px;
  padding: 14px 16px;
  font-size: 1.12rem; /* 16px+ stops iPhones zooming in */
  line-height: 1.45;
  background: var(--card);
  border: 1.5px solid var(--line-strong);
  border-radius: 14px;
  transition: border-color 0.2s, box-shadow 0.2s;
}
textarea.answer { min-height: 132px; resize: none; }
.answer:focus { outline: none; border-color: var(--rose); box-shadow: 0 0 0 4px rgba(195, 79, 100, 0.14); }
.answer::placeholder { color: #A99294; }
.date-field {
  position: relative;
  display: flex; align-items: center; gap: 12px;
  min-height: 60px;
  margin-top: 6px;
  padding: 0 16px;
  background: var(--card);
  border: 1.5px solid var(--line-strong);
  border-radius: 14px;
  cursor: pointer;
}
.date-field:focus-within { border-color: var(--rose); box-shadow: 0 0 0 4px rgba(195, 79, 100, 0.14); }
.date-field__icon { flex: none; width: 26px; height: 26px; color: var(--rose); }
.date-field__hint { display: none; font-size: 1.12rem; color: #A99294; pointer-events: none; }
.date-field__input {
  flex: 1; min-width: 0; min-height: 56px;
  border: 0; background: transparent; outline: none;
  font-size: 1.12rem; color: var(--ink);
  -webkit-appearance: none; appearance: none;
}
/* Empty: show "Tap to choose a date" over the (invisible but tappable) date input */
.date-field.is-empty .date-field__hint { display: block; }
.date-field.is-empty .date-field__input { position: absolute; inset: 0; opacity: 0; width: 100%; cursor: pointer; }

/* Next / Skip */
.btn-next {
  display: flex; align-items: center; justify-content: center;
  width: 100%;
  min-height: 56px;
  margin-top: 20px;
  padding: 14px 20px;
  border: 1.5px solid var(--rose);
  border-radius: 14px;
  background: var(--rose);
  color: #FFF6EA;
  font-size: 1.1rem; font-weight: 600; letter-spacing: 0.04em;
  cursor: pointer;
  transition: background-color 0.2s, color 0.2s, transform 0.1s;
}
.btn-next:active { transform: scale(0.99); }
.btn-next:hover { background: var(--rose-deep); border-color: var(--rose-deep); }
.btn-next.is-skip { background: transparent; color: var(--rose); }
.btn-next.is-skip:hover { background: var(--blush-soft); }
.btn-next[disabled] { opacity: 0.6; }
.btn-quiet {
  display: block; margin: 14px auto 0; padding: 12px;
  border: 0; background: none; cursor: pointer;
  color: var(--rose); font-size: 1.02rem;
  text-decoration: underline; text-underline-offset: 3px;
}

/* Tap options */
.options { display: grid; gap: 10px; margin-top: 6px; }
.option {
  display: flex; align-items: center; gap: 14px;
  width: 100%;
  min-height: 60px;
  padding: 14px 18px;
  text-align: left;
  font-size: 1.12rem; line-height: 1.3;
  background: var(--card);
  border: 1.5px solid var(--line-strong);
  border-radius: 14px;
  cursor: pointer;
  transition: border-color 0.15s, background-color 0.15s, color 0.15s;
}
.option:hover { border-color: var(--blush); }
.option__dot {
  flex: none;
  width: 22px; height: 22px;
  border-radius: 50%;
  border: 2px solid var(--blush);
  background: var(--card);
  transition: all 0.15s;
}
.option[aria-checked="true"] { border-color: var(--rose); background: #FBEFEF; color: var(--wine); font-weight: 600; }
.option[aria-checked="true"] .option__dot { border-color: var(--rose); background: var(--rose); box-shadow: inset 0 0 0 4px var(--card); }
.more { margin-top: 12px; }
.more .answer { min-height: 104px; }

/* "Is this right?" card */
.showcard {
  margin: 4px 0 14px;
  padding: 6px 18px;
  background: var(--cream);
  border-radius: 14px;
}
.showcard > div { padding: 12px 0; }
.showcard > div + div { border-top: 1px solid rgba(59, 33, 38, 0.1); }
.showcard dt { font-family: var(--font-display); font-weight: 600; font-size: 1.25rem; color: var(--wine); line-height: 1.2; }
.showcard dd { color: var(--ink-soft); font-size: 1rem; }

/* Heads-up list */
.fixes { display: grid; gap: 10px; margin: 4px 0 4px; }
.fixes li {
  position: relative;
  padding: 14px 16px 14px 42px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  font-size: 1.04rem;
}
.fixes li::before {
  content: "";
  position: absolute; left: 20px; top: 23px;
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--blush);
}

/* Photos */
.btn-add {
  display: flex; align-items: center; justify-content: center; gap: 12px;
  width: 100%; min-height: 64px;
  margin-top: 6px;
  border: 2px dashed var(--blush);
  border-radius: 14px;
  background: var(--card);
  color: var(--wine);
  font-family: var(--font-display); font-weight: 600; font-size: 1.35rem;
  cursor: pointer;
}
.btn-add:active, .btn-add:hover { border-color: var(--rose); background: #FBEFEF; }
input[type="file"]:focus-visible + .btn-add { outline: 2px solid var(--rose); outline-offset: 3px; }
.btn-add__plus {
  width: 32px; height: 32px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--rose); color: #FFF6EA;
  font-family: var(--font-body); font-size: 1.4rem; line-height: 1;
}
.tiles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 14px 0 10px; }
.tiles:empty { display: none; }
.tile { position: relative; aspect-ratio: 1; }
.tile__face {
  width: 100%; height: 100%;
  border-radius: 12px; overflow: hidden;
  background: var(--cream) var(--stripes); background-size: 24px 144px;
  display: grid; place-items: center;
}
.tile__face img { width: 100%; height: 100%; object-fit: cover; }
.tile__ext { font-weight: 700; letter-spacing: 0.08em; color: var(--wine); background: var(--paper); padding: 2px 8px; border-radius: 4px; }
.tile__remove {
  position: absolute; top: 4px; right: 4px;
  width: 32px; height: 32px;
  border: 0; border-radius: 50%;
  background: rgba(59, 33, 38, 0.72); color: #fff;
  font-size: 1.3rem; line-height: 1; cursor: pointer;
  display: grid; place-items: center;
}
.tile.is-loading .tile__face { opacity: 0.6; }
.tile__bar { position: absolute; left: 8px; right: 8px; bottom: 8px; height: 5px; border-radius: 3px; background: rgba(255, 255, 255, 0.8); overflow: hidden; }
.tile__bar > span { display: block; height: 100%; width: 3%; background: var(--rose); transition: width 0.2s; }
.tile.is-error .tile__face { outline: 2px solid var(--error); }
.stage .small { margin-top: 10px; }

/* Welcome, finish, thanks */
.welcome { text-align: center; padding-top: 4px; }
.welcome__art { width: 120px; margin: 0 auto 6px; }
.script { font-family: var(--font-script); font-size: 2.3rem; line-height: 1; color: var(--rose); margin: 0 0 2px; }
.welcome__names {
  font-family: var(--font-display); font-weight: 600;
  font-size: clamp(2.2rem, 1.8rem + 2vw, 2.9rem); line-height: 1.05;
  color: var(--wine); margin-bottom: 14px;
}
.welcome__intro { font-size: 1.12rem; color: var(--ink-soft); max-width: 26em; margin: 0 auto 18px; }
.welcome__facts { display: grid; gap: 8px; text-align: left; max-width: 340px; margin: 0 auto 6px; }
.welcome__facts li { position: relative; padding-left: 30px; color: var(--ink); }
.welcome__facts li::before {
  content: "✓"; position: absolute; left: 0; top: 0;
  width: 20px; height: 20px; border-radius: 50%;
  background: var(--blush-soft); color: var(--rose-deep);
  display: grid; place-items: center; font-size: 0.8rem; font-weight: 700; margin-top: 3px;
}
.welcome__peek { display: inline-block; margin-top: 18px; padding: 8px; font-size: 1rem; }
.note { background: var(--cream); padding: 12px 14px; border-radius: 12px; font-size: 1rem; margin: 10px 0 0; }
.form-status { min-height: 1.4em; margin: 10px 0 0; color: var(--error); text-align: center; }
.thanks { text-align: center; padding-top: 12vh; }
.thanks img { width: 30px; margin: 0 auto 16px; }

.offline {
  position: fixed; left: 12px; right: 12px; bottom: calc(12px + env(safe-area-inset-bottom)); z-index: 20;
  margin: 0; padding: 12px 16px;
  background: var(--wine); color: #FFF6EA;
  border-radius: 12px; text-align: center; font-size: 0.98rem;
  box-shadow: var(--shadow);
}

@media (min-width: 700px) {
  .stage { padding-top: 48px; }
  .bar { padding-left: max(6px, calc(50vw - 300px)); padding-right: max(16px, calc(50vw - 280px)); }
  .welcome__art { width: 150px; }
}

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

/* =========================================================
   Admin
   ========================================================= */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 44px; padding: 10px 20px;
  font: 600 0.82rem/1 var(--font-body);
  letter-spacing: 0.14em; text-transform: uppercase;
  border: 1.5px solid var(--rose); border-radius: 3px;
  background: var(--rose); color: #FFF6EA;
  cursor: pointer; text-decoration: none;
}
.btn:hover { background: var(--rose-deep); border-color: var(--rose-deep); }
.btn[disabled] { opacity: 0.6; cursor: progress; }
.btn--line { background: transparent; color: var(--rose); }
.btn--line:hover { background: rgba(195, 79, 100, 0.08); color: var(--rose-deep); }
.btn--sm { min-height: 38px; padding: 8px 14px; font-size: 0.74rem; letter-spacing: 0.12em; }
.link-btn { border: 0; background: none; padding: 4px 0; cursor: pointer; color: var(--rose); text-decoration: underline; text-underline-offset: 3px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 6px; box-shadow: var(--shadow); }
.narrow { max-width: 440px; width: 100%; margin: 0 auto; padding: 32px 28px; text-align: center; }
.page-center { min-height: 100dvh; display: grid; place-items: center; padding: 24px 16px; background: var(--cream) var(--stripes); }
.h2 { font-family: var(--font-display); font-weight: 600; font-size: clamp(1.7rem, 1.4rem + 1.4vw, 2.3rem); line-height: 1.1; color: var(--wine); }
.field { display: grid; gap: 6px; margin-bottom: 14px; text-align: left; }
.field label { font-size: 0.76rem; font-weight: 600; letter-spacing: 0.14em; text-transform: uppercase; color: var(--ink-soft); }
.field input { width: 100%; min-height: 48px; padding: 11px 13px; font-size: 1.05rem; background: var(--paper); border: 1px solid var(--line-strong); border-radius: 6px; }
.field input:focus { outline: none; border-color: var(--rose); box-shadow: 0 0 0 3px rgba(195, 79, 100, 0.15); }
.login img { margin: 0 auto 12px; width: 30px; }
.login .btn { width: 100%; margin-top: 4px; }
.login .form-status { color: var(--error); }

.topbar { position: sticky; top: 0; z-index: 40; background: rgba(250, 245, 238, 0.95); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.topbar__inner { height: 60px; max-width: 1100px; margin: 0 auto; padding: 0 16px; display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--wine); font-family: var(--font-display); font-weight: 600; font-size: 1.2rem; white-space: nowrap; overflow: hidden; }
.brand img { width: 15px; flex: none; }
.brand__short { display: none; }
.topbar__right { display: flex; align-items: center; gap: 8px; }
.progress--inline { height: 6px; border-radius: 3px; overflow: hidden; margin-top: 8px; background: var(--blush-soft); }
.progress__bar { height: 100%; width: 0; background: var(--rose); transition: width 0.4s ease; }

.admin-main { max-width: 1100px; margin: 0 auto; padding: 24px 16px 80px; }
.viewbar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 12px; padding: 14px 18px; margin-bottom: 14px; box-shadow: none; }
.viewbar__label { font-size: 0.72rem; font-weight: 600; letter-spacing: 0.16em; text-transform: uppercase; color: var(--ink-soft); }
.viewbar select { flex: 1 1 240px; min-height: 44px; padding: 8px 12px; font-size: 1.02rem; background: var(--paper); border: 1px solid var(--line-strong); border-radius: 6px; }
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.stat { padding: 16px 18px; display: grid; gap: 2px; align-content: start; }
.stat__label { font-size: 0.72rem; font-weight: 600; letter-spacing: 0.16em; text-transform: uppercase; color: var(--ink-soft); }
.stat__value { font-family: var(--font-display); font-weight: 700; font-size: 2rem; line-height: 1.1; color: var(--wine); }
.stat__value--sm { font-size: 1.2rem; }
.stat__value[data-tone="done"] { color: var(--ok); }
.stat__value[data-tone="active"] { color: var(--rose); }
.toolbar { margin-top: 14px; padding: 16px 18px; display: grid; gap: 12px; }
.toolbar__link { display: grid; gap: 4px; min-width: 0; }
.toolbar__link code { font-size: 0.85rem; background: var(--cream); padding: 8px 10px; border-radius: 4px; overflow-wrap: anywhere; user-select: all; }
.toolbar__actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.toggle { display: inline-flex; align-items: center; gap: 6px; font-size: 0.95rem; margin-left: 6px; cursor: pointer; }
.toggle input { width: 18px; height: 18px; accent-color: var(--rose); }
.admin-section { margin-top: 36px; }
.admin-section > .h2 { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 12px; border-bottom: 1px solid var(--line); padding-bottom: 6px; }
.admin-section__count { font-family: var(--font-body); font-size: 0.95rem; font-weight: 500; color: var(--ink-soft); }
.admin-section > .answer-card + .answer-card { margin-top: 10px; }
.answer-card { padding: 16px 18px; box-shadow: none; }
.answer-card.is-open { background: transparent; border-style: dashed; }
.answer-card__head { display: grid; grid-template-columns: auto 1fr; gap: 10px; align-items: start; }
.q__num { display: inline-grid; place-items: center; min-width: 30px; height: 30px; padding: 0 6px; border-radius: 99px; background: var(--blush-soft); color: var(--rose-deep); font: 600 0.85rem var(--font-body); }
.answer-card:not(.is-open) .q__num { background: var(--rose); color: #FFF6EA; }
.answer-card__q { font-family: var(--font-display); font-weight: 600; font-size: 1.2rem; line-height: 1.25; color: var(--wine); }
.answer-card__current, .answer-card__body, .answer-card__meta, .history { margin-left: 40px; }
.answer-card__current { margin-top: 6px; }
.answer-card__body { margin-top: 10px; }
.answer-card__meta { margin-top: 10px; }
.answer-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.answer-chip { display: inline-block; padding: 3px 11px; border-radius: 99px; background: var(--blush-soft); color: var(--rose-deep); font-size: 0.92rem; }
.answer-text { white-space: pre-wrap; margin: 0; }
.history { margin-top: 10px; padding: 10px 14px; background: var(--paper); border-radius: 4px; display: grid; gap: 6px; list-style: none; }
.admin-files { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 12px; }
.admin-file { display: grid; grid-template-columns: 110px 1fr; gap: 14px; padding: 12px; box-shadow: none; }
.file__thumb { width: 110px; height: 110px; border-radius: 4px; overflow: hidden; background: var(--cream) var(--stripes); background-size: 24px 144px; display: grid; place-items: center; }
.file__thumb img { width: 100%; height: 100%; object-fit: cover; }
.file__thumb.is-doc { font: 700 0.9rem var(--font-body); letter-spacing: 0.1em; color: var(--wine); }
.file__name { font-weight: 600; margin: 0; overflow-wrap: anywhere; }
.admin-file__info { display: grid; gap: 4px; justify-items: start; min-width: 0; }
.admin-file__info p { margin: 0; }
[data-comments] { padding: 16px 18px; }

@media (max-width: 900px) { .stats { grid-template-columns: 1fr 1fr; } }
@media (max-width: 560px) {
  .brand__long, .admin [data-refreshed] { display: none; }
  .brand__short { display: inline; }
  .answer-card__current, .answer-card__body, .answer-card__meta, .history { margin-left: 0; }
  .admin-file { grid-template-columns: 84px 1fr; }
  .file__thumb { width: 84px; height: 84px; }
}
@media print {
  .topbar, .toolbar, .stats, .admin-file .btn, .link-btn { display: none !important; }
  body { background: #fff; font-size: 12pt; }
  .card { box-shadow: none; }
  .answer-card { break-inside: avoid; }
}
