/* True Story Tent: the guest-facing look. Kibaruna's way of drawing with TST's own motifs,
   on purple paper (the default) or pale paper. See EXPERIENCE.md before changing anything here. */

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; margin: 0; }
body { background: #6b2d6d; font-family: "Alegreya Sans", system-ui, sans-serif; -webkit-text-size-adjust: 100%; }
button { font: inherit; color: inherit; }

.app {
  --bg: #6b2d6d; --ink: #f3eee8; --soft: #e8dbe3; --quiet: #cdb5c9; --coral: #f2705c; --mint: #a9e4cf; --line: #3a1540; --pale: #f6f0ea;
  --btn: #f3eee8; --btn-ink: #45194a; --choice: rgba(255, 255, 255, .06); --choice-line: rgba(243, 238, 232, .26); --choice-on: rgba(255, 255, 255, .14);
  --field: rgba(255, 255, 255, .08); --grain: .5; --grain-contrast: 1.7; --specks: .18; --logo: #d8d8d4;
  position: fixed; inset: 0; overflow: hidden; isolation: isolate; background: var(--bg); color: var(--ink);
  transition: background-color .5s, color .5s; -webkit-tap-highlight-color: transparent;
}
.app.base-pale {
  --bg: #e3dfd9; --ink: #3e1842; --soft: #4a2150; --quiet: #6e5470; --coral: #ee6e5a; --mint: #8fd6bc; --line: #3e1842; --pale: #ffffff;
  --btn: #662b67; --btn-ink: #f6f0ea; --choice: rgba(255, 255, 255, .45); --choice-line: rgba(62, 24, 66, .2); --choice-on: rgba(255, 255, 255, .9);
  --field: rgba(255, 255, 255, .6); --grain: .85; --grain-contrast: 2.4; --specks: .4; --logo: #662b67;
}
.grain { position: absolute; inset: 0; z-index: -1; pointer-events: none; opacity: var(--grain); mix-blend-mode: overlay;
  background: url(/assets/grain.jpg) center / cover; filter: contrast(var(--grain-contrast)); }
.specks { position: absolute; inset: 0; z-index: -1; pointer-events: none; opacity: var(--specks);
  background-image: radial-gradient(1.2px 1.2px at 12% 18%, var(--pale) 50%, transparent 51%), radial-gradient(1px 1px at 78% 9%, var(--pale) 50%, transparent 51%),
    radial-gradient(1.3px 1.3px at 64% 46%, var(--pale) 50%, transparent 51%), radial-gradient(1px 1px at 22% 63%, var(--pale) 50%, transparent 51%),
    radial-gradient(1.2px 1.2px at 88% 72%, var(--pale) 50%, transparent 51%), radial-gradient(1px 1px at 41% 88%, var(--pale) 50%, transparent 51%),
    radial-gradient(1px 1px at 6% 94%, var(--pale) 50%, transparent 51%), radial-gradient(1.1px 1.1px at 93% 36%, var(--pale) 50%, transparent 51%); }

/* one phone-width column, centred on larger screens */
.frame { position: relative; height: 100%; max-width: 460px; margin: 0 auto; }

.bar { position: absolute; z-index: 5; top: 0; left: 0; right: 0; display: flex; align-items: center; justify-content: space-between;
  height: calc(56px + env(safe-area-inset-top, 0px)); padding: calc(8px + env(safe-area-inset-top, 0px)) 18px 0 14px; }
.bar [hidden] { display: none !important; }
.back { display: flex; align-items: center; gap: 6px; height: 40px; padding: 0 8px; border: 0; background: none; color: var(--quiet); cursor: pointer; font-size: 14.5px; }
.back svg { width: 12px; height: 8px; }
.progress { display: flex; gap: 6px; align-items: flex-end; }
.progress svg { width: 9px; height: 15px; overflow: visible; }
.progress .todo { --cup-fill: transparent; --flame: transparent; --cup-line: var(--quiet); opacity: .75; }
.progress .now { transform-origin: 50% 70%; animation: pop .55s cubic-bezier(.2, .9, .3, 1.25) .25s both; }

.screen { position: absolute; inset: 0; display: flex; flex-direction: column;
  padding: calc(66px + env(safe-area-inset-top, 0px)) max(22px, env(safe-area-inset-right, 0px)) calc(20px + env(safe-area-inset-bottom, 0px)) max(22px, env(safe-area-inset-left, 0px)); }
.screen[hidden] { display: none; }
.screen-body { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: none; }
.screen-body::-webkit-scrollbar { display: none; }
.screen-foot { flex: none; display: grid; gap: 8px; padding-top: 14px; }

.motif { display: block; height: 30px; margin: 8px 0 18px; }
.motif svg { display: block; height: 100%; width: auto; overflow: visible; }
.lead { margin: 0 0 8px; font-size: 14.5px; line-height: 1.45; color: var(--soft); }
.q { margin: 0 0 18px; font-family: "Alegreya", Georgia, serif; font-weight: 500; font-size: 23px; line-height: 1.24; text-wrap: balance; }
.opt { font-family: "Alegreya Sans", system-ui, sans-serif; font-weight: 400; font-size: 14px; color: var(--quiet); white-space: nowrap; }
.body { margin: 0 0 14px; font-size: 15px; line-height: 1.6; color: var(--soft); }
.note { margin: 16px 0 0; font-size: 13px; line-height: 1.5; color: var(--quiet); }
.hint { margin: 9px 4px 0; font-size: 13px; line-height: 1.45; color: var(--quiet); }
.error { position: relative; margin: 9px 4px 0; padding-left: 15px; font-size: 13.5px; line-height: 1.45; color: var(--ink); }
.error[hidden] { display: none; }
.error::before { content: ""; position: absolute; left: 1px; top: .55em; width: 6px; height: 6px; transform: rotate(45deg); background: var(--coral); }
.fields { display: grid; gap: 10px; }
.fields .hint, .fields .error { margin-top: 0; }
.sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

.choices { display: grid; gap: 10px; }
.choice { --cup-fill: transparent; --flame: transparent; --cup-line: var(--quiet);
  display: grid; gap: 3px; width: 100%; padding: 14px 18px; border: 1px solid var(--choice-line); border-radius: 999px; background: var(--choice);
  text-align: left; cursor: pointer; transition: background-color .25s, border-color .25s, transform .15s; }
.choice.tall { border-radius: 22px; padding: 15px 18px 14px; }
.choice:active { transform: scale(.985); }
.choice[aria-pressed="true"] { --cup-fill: var(--coral); --flame: var(--pale); --cup-line: var(--line); background: var(--choice-on); border-color: var(--ink); }
.c-title { display: flex; align-items: center; gap: 11px; font-size: 16px; font-weight: 500; }
.c-title svg { flex: none; width: 10px; height: 17px; overflow: visible; }
.c-sub { padding-left: 21px; font-size: 13.5px; line-height: 1.45; color: var(--quiet); }

.input { width: 100%; height: 50px; padding: 0 18px; border: 1px solid var(--choice-line); border-radius: 999px; background: var(--field); color: var(--ink);
  font: 400 16px/1.2 "Alegreya Sans", system-ui, sans-serif; transition: border-color .25s; }
textarea.input { display: block; height: 104px; padding: 13px 18px; border-radius: 22px; line-height: 1.45; resize: none; }
.input::placeholder { color: var(--quiet); opacity: .85; }
.input:focus { outline: none; border-color: var(--ink); }
.primary { display: flex; align-items: center; justify-content: center; height: 52px; border: 0; border-radius: 999px; background: var(--btn); color: var(--btn-ink);
  cursor: pointer; font-size: 16px; font-weight: 500; text-decoration: none; transition: transform .15s, opacity .3s; }
.primary:active { transform: scale(.985); }
.primary[disabled] { opacity: .75; cursor: progress; }
.secondary { height: 40px; border: 0; background: none; color: var(--quiet); cursor: pointer; font-size: 14.5px; }
.foot-note { margin: 2px 0 0; text-align: center; font-size: 13px; color: var(--quiet); }
.app :focus-visible { outline: 2px solid var(--ink); outline-offset: 3px; }
.app [tabindex="-1"]:focus, .app .input:focus-visible { outline: none; }

/* ---------- the welcome page: an invitation card framed by a doorway ---------- */
.screen.cover { padding-top: calc(34px + env(safe-area-inset-top, 0px)); }
.cover .screen-body { display: flex; flex-direction: column; }
.cover-inner { position: relative; isolation: isolate; flex: 1 0 auto; display: flex; flex-direction: column; align-items: center; justify-content: space-between;
  text-align: center; padding: clamp(30px, 6.5svh, 72px) 22px clamp(12px, 2.5svh, 30px); }
.doorway { position: absolute; inset: 0; z-index: -1; width: 100%; height: 100%; overflow: visible; pointer-events: none; }
.door-mint { fill: none; stroke: var(--mint); stroke-width: 2.5; stroke-linecap: round; }
.door-line { fill: none; stroke: var(--line); stroke-width: 1; stroke-linecap: round; }
.cover-mid { display: flex; flex-direction: column; align-items: center; width: 100%; padding: clamp(6px, 2svh, 30px) 0 clamp(6px, 2svh, 20px); }
.cover-low { display: flex; flex-direction: column; align-items: center; }
.logo { display: block; flex: none; width: 80px; aspect-ratio: 330 / 227; background: var(--logo);
  -webkit-mask: url(/assets/logo-full.png) center / contain no-repeat; mask: url(/assets/logo-full.png) center / contain no-repeat; }
.cover-title { position: relative; flex: none; width: 140px; height: 58px; margin: 0 0 clamp(16px, 3svh, 24px); }
.invite { max-width: 270px; margin: 0 0 10px; font-family: "Alegreya", Georgia, serif; font-size: 16px; line-height: 1.5; color: var(--ink); text-wrap: balance; }
.cover-cup { display: block; flex: none; width: 10px; height: 17px; margin: 0 0 14px; overflow: visible; }
.when { margin: 0; font-size: 13.5px; line-height: 1.6; color: var(--quiet); text-wrap: balance; }
@media (max-height: 680px) { .cover-title { height: 50px; } .invite { font-size: 15.5px; } }

/* ---------- paired Arabic and English titles ---------- */
.paired { margin: 0; font-weight: 400; }
.paired span { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; white-space: nowrap; }
.paired .ar { font-family: "Amiri", "Alegreya", serif; font-weight: 700; font-size: 34px; line-height: 1; color: var(--coral);
  text-shadow: 1.5px 1.5px 0 var(--mint), 3px 3px 0 var(--line); padding-top: 4px; }
.paired .en { font-family: "Alegreya", Georgia, serif; font-weight: 500; font-size: 29px; line-height: 1; color: var(--coral); text-shadow: 1.5px 1.5px 0 var(--line); opacity: 0; }

/* ---------- the confirmation crest ---------- */
.crest { position: relative; margin: 0 -6px 18px; }
.crest svg { display: block; width: 100%; height: auto; overflow: visible; }
.crest .paired { position: absolute; left: 0; right: 0; top: 50%; height: 70px; margin-top: -35px; }
.crest .paired .ar { font-size: 37px; }
.crest .paired .en { font-size: 30px; }
.saved-title { margin: 0 0 8px; font-family: "Alegreya", Georgia, serif; font-weight: 500; font-size: 23px; line-height: 1.24; text-align: center; text-wrap: balance; }
.details { margin: 0 0 16px; padding: 0; list-style: none; text-align: center; font-size: 14.5px; line-height: 1.6; color: var(--soft); }
.details a { color: inherit; }
.details [hidden], .next [hidden] { display: none; }
.next { margin: 0; padding: 14px 0 0; border-top: 1px solid var(--choice-line); list-style: none; font-size: 14px; line-height: 1.5; color: var(--soft); }
.next li { position: relative; margin: 0 0 7px; padding-left: 18px; }
.next li::before { content: ""; position: absolute; left: 2px; top: .58em; width: 6px; height: 6px; transform: rotate(45deg); background: var(--coral); }
.toast { position: absolute; z-index: 9; left: 22px; right: 22px; bottom: calc(96px + env(safe-area-inset-bottom, 0px)); padding: 12px 16px; border-radius: 16px;
  background: var(--btn); color: var(--btn-ink); font-size: 14px; line-height: 1.4; text-align: center; opacity: 0; transform: translateY(6px); transition: opacity .3s, transform .3s; pointer-events: none; }
.toast.on { opacity: 1; transform: none; }
.preview-flag { position: absolute; z-index: 8; top: calc(14px + env(safe-area-inset-top, 0px)); right: 14px; padding: 4px 10px; border-radius: 999px;
  background: var(--btn); color: var(--btn-ink); font-size: 12px; font-weight: 500; }

/* ---------- motion: each step arrives quietly; lines draw themselves ---------- */
.screen.in .anim { animation: rise .55s cubic-bezier(.2, .7, .2, 1) both; animation-delay: calc(var(--d, 0) * 1ms + 120ms); }
.screen.in.back-in .anim { animation-name: rise-back; }
.screen.in .draw { stroke-dasharray: 1 2; stroke-dashoffset: 1.01; animation: draw var(--dur, .9s) cubic-bezier(.45, .05, .25, 1) forwards; animation-delay: calc(var(--dd, 0) * 1ms); }
.screen.in .pop { transform-box: fill-box; transform-origin: 50% 70%; animation: pop .5s cubic-bezier(.2, .9, .3, 1.25) both; animation-delay: calc(var(--dd, 0) * 1ms); }
.screen.in .grow { transform-box: fill-box; transform-origin: center; animation: grow .65s cubic-bezier(.3, .7, .2, 1) both; animation-delay: calc(var(--dd, 0) * 1ms); }
.screen.in .fadein { animation: fade .5s ease both; animation-delay: calc(var(--dd, 0) * 1ms); }
.screen.in .paired .ar { animation: fade .7s ease both, dissolve-out .9s ease forwards; animation-delay: var(--arrive, 0ms), var(--swap, 1600ms); }
.screen.in .paired .en { animation: dissolve-in .9s ease both; animation-delay: calc(var(--swap, 1600ms) + 250ms); }
.screen.out { animation: leave .24s ease forwards; }
.screen.out-back { animation: leave-back .24s ease forwards; }
@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes rise-back { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: none; } }
@keyframes leave { to { opacity: 0; transform: translateY(-8px); } }
@keyframes leave-back { to { opacity: 0; transform: translateY(8px); } }
@keyframes draw { to { stroke-dashoffset: 0; } }
@keyframes pop { from { opacity: 0; transform: scale(.5); } to { opacity: 1; transform: none; } }
@keyframes grow { from { opacity: 0; transform: scaleX(0); } to { opacity: 1; transform: none; } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes fade-out { to { opacity: 0; } }
@keyframes dissolve-out { to { opacity: 0; filter: blur(5px); transform: scale(.985); } }
@keyframes dissolve-in { from { opacity: 0; filter: blur(6px); } to { opacity: 1; filter: blur(0); } }
@media (prefers-reduced-motion: reduce) {
  .screen.in .anim, .screen.in .pop, .screen.in .grow, .screen.in .fadein, .progress .now { animation: fade .3s ease both; animation-delay: 0s; }
  .screen.in .draw { animation: none; stroke-dasharray: none; stroke-dashoffset: 0; }
  .screen.out, .screen.out-back { animation: fade-out .2s ease forwards; }
  .screen.in .paired .ar { animation: fade .3s ease both, fade-out .5s ease forwards; animation-delay: 0s, 1.4s; }
  .screen.in .paired .en { animation: fade .5s ease both; animation-delay: 1.7s; }
}
