/* /apply · One Brunch application flow. Tokens (colours, fonts) come from /styles.css. */

.ap { min-height: 100svh; overflow-x: hidden; }
.ap [hidden]:not(.ap-back) { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- Top bar: back, progress, logo ---------- */
.ap-top {
  position: fixed;
  inset: 0 0 auto;
  z-index: 50;
  height: 60px;
  display: grid;
  grid-template-columns: 44px 1fr auto;
  align-items: center;
  gap: 14px;
  padding: env(safe-area-inset-top) var(--gutter) 0;
  background: linear-gradient(#050505 60%, #05050500);
}
.ap-back {
  width: 40px; height: 40px;
  display: grid; place-items: center;
  border: 1px solid var(--border2);
  border-radius: 50%;
  background: transparent;
  color: #fff;
  cursor: pointer;
}
.ap-back svg { width: 18px; height: 18px; }
.ap-back:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.ap-back[hidden] { display: grid; visibility: hidden; }
.ap-progress { grid-column: 2; height: 4px; border-radius: 4px; background: rgba(255, 255, 255, .14); overflow: hidden; }
.ap-progress span { display: block; height: 100%; width: 0; background: var(--accent); border-radius: inherit; transition: width .5s cubic-bezier(.22, 1, .36, 1); }
.ap-logo { justify-self: end; font-size: 28px; }

/* ---------- Steps: one screen at a time, slide in ---------- */
.ap-stage { position: relative; min-height: 100svh; }
.ap-step {
  position: absolute;
  inset: 0;
  min-height: 100svh;
  padding: calc(76px + env(safe-area-inset-top)) var(--gutter) calc(32px + env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  visibility: hidden;
  opacity: 0;
  transform: translateX(40px);
  pointer-events: none;
  transition: opacity .35s ease, transform .45s cubic-bezier(.22, 1, .36, 1), visibility 0s linear .45s;
}
.ap-step.is-back { transform: translateX(-40px); }
.ap-step.is-active {
  position: relative;
  visibility: visible;
  opacity: 1;
  transform: none;
  pointer-events: auto;
  transition: opacity .35s ease, transform .45s cubic-bezier(.22, 1, .36, 1), visibility 0s;
}
.ap-inner { width: 100%; max-width: 520px; margin: 0 auto; display: flex; flex-direction: column; gap: 18px; flex: 1; }
.ap-inner--center { align-items: center; text-align: center; }
.ap-title { font-family: var(--display); font-weight: 500; letter-spacing: -.04em; line-height: .97; font-size: clamp(48px, 13vw, 76px); margin: 0 0 6px; }
.ap-title:focus { outline: none; }
.ap-sub { margin: -6px 0 6px; color: var(--text2); font-size: 17px; max-width: 420px; }
.ap-lead { margin: 0; font-size: 19px; line-height: 1.45; color: rgba(255, 255, 255, .86); }
.ap-fine { margin: 6px 0 0; font-size: 13px; color: var(--text3); max-width: 380px; }
.ap-fine--left { font-size: 15px; color: var(--text2); }
.eyebrow { margin-bottom: 0; }

/* ---------- Fields ---------- */
.ap-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.ap-field { display: grid; gap: 7px; align-content: start; margin: 0; padding: 0; border: 0; min-width: 0; }
.ap-field--age { max-width: 100%; }
.ap-field > label, .ap-field > legend { padding: 0; font-size: 13px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--text2); }
.ap-field > legend { margin-bottom: 7px; }
.ap input[type="text"], .ap input[type="number"], .ap input[type="tel"], .ap input[type="url"] {
  width: 100%;
  height: 54px;
  padding: 0 16px;
  border: 1px solid var(--border2);
  border-radius: 14px;
  background: var(--bg2);
  color: #fff;
  font: 500 17px/1 var(--font);
  appearance: none;
  transition: border-color .15s;
}
.ap input:focus { outline: none; border-color: var(--accent); }
.ap input::placeholder { color: var(--text3); }
.ap [aria-invalid="true"] { border-color: #ff7a7a !important; }
.ap-prefix { position: relative; }
.ap-prefix span { position: absolute; left: 16px; top: 50%; transform: translateY(-50%); color: var(--text3); font-weight: 600; pointer-events: none; }
.ap-prefix input { padding-left: 34px !important; }
.ap-hint { margin: 0; font-size: 13px; color: var(--text3); }
.ap-field--age input { max-width: 160px; }

/* City search with flags */
.ap-combo { position: relative; }
.ap-combo-flag { position: absolute; left: 14px; top: 27px; transform: translateY(-50%); font-size: 20px; line-height: 1; pointer-events: none; }
.ap-combo input { padding-left: 46px !important; }
.ap-combo-list {
  position: absolute;
  z-index: 20;
  left: 0; right: 0; top: calc(100% + 6px);
  max-height: 320px;
  overflow-y: auto;
  margin: 0; padding: 6px;
  list-style: none;
  border: 1px solid var(--border2);
  border-radius: 16px;
  background: #141414;
  box-shadow: 0 18px 40px rgba(0, 0, 0, .55);
}
.ap-combo-head { padding: 8px 12px 4px; font-size: 12px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--text3); }
.ap-combo-opt { display: flex; align-items: center; gap: 10px; padding: 11px 12px; border-radius: 10px; cursor: pointer; }
.ap-combo-opt:hover, .ap-combo-opt.is-active { background: rgba(255, 255, 255, .07); }
.ap-combo-oflag { font-size: 20px; line-height: 1; }
.ap-combo-name { font-weight: 600; }
.ap-combo-country { color: var(--text3); font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ap-combo-chip { margin-left: auto; flex: none; padding: 3px 9px; border-radius: 999px; font-size: 12px; font-weight: 600; border: 1px solid var(--border2); color: var(--text2); }
.ap-combo-chip.is-open { background: var(--accent); border-color: var(--accent); color: #000; }

/* WhatsApp: country code + local number */
.ap-phone { display: grid; grid-template-columns: auto 1fr; gap: 8px; }
.ap-dial { position: relative; display: flex; align-items: center; height: 54px; padding: 0 14px; border: 1px solid var(--border2); border-radius: 14px; background: var(--bg2); cursor: pointer; }
.ap-dial:focus-within { border-color: var(--accent); }
.ap-dial-face { display: flex; align-items: center; gap: 6px; font-weight: 600; white-space: nowrap; }
.ap-dial-face [data-dial-flag] { font-size: 20px; line-height: 1; }
.ap-dial-face::after { content: ""; width: 7px; height: 7px; margin-left: 4px; border-right: 2px solid var(--text3); border-bottom: 2px solid var(--text3); transform: rotate(45deg) translateY(-2px); }
.ap-dial select { position: absolute; inset: 0; width: 100%; opacity: 0; cursor: pointer; font-size: 16px; }
.ap-err { margin: 0; min-height: 0; font-size: 14px; color: #ff9a9a; }
.ap-err:empty { display: none; }
.ap-err--center { text-align: center; }

.ap-toggles { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.ap-toggles--3 { grid-template-columns: repeat(3, 1fr); }
.ap-toggle { position: relative; cursor: pointer; }
.ap-toggle input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.ap-toggle span {
  display: flex; align-items: center; justify-content: center;
  height: 58px;
  border: 1px solid var(--border2);
  border-radius: 999px;
  font-weight: 600; font-size: 16px;
  transition: background .15s, color .15s, border-color .15s, transform .1s;
}
.ap-toggle input:checked + span { background: var(--accent); border-color: var(--accent); color: #000; }
.ap-toggle input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 3px; }
.ap-toggle:active span { transform: scale(.97); }
.ap-next { margin-top: auto; }
form.ap-inner .ap-next { margin-top: 10px; }

/* ---------- Question chips (shown over the generating animation) ---------- */
.ap-chips { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; }
.ap-chip {
  min-height: 52px;
  padding: 12px 20px;
  border: 1px solid var(--border2);
  border-radius: 999px;
  background: rgba(20, 20, 20, .82);
  color: #fff;
  font: 600 16px/1.2 var(--font);
  cursor: pointer;
  transition: background .2s, border-color .2s, color .2s, transform .12s;
}
.ap-chip:hover { border-color: rgba(255, 255, 255, .5); }
.ap-chip:active { transform: scale(.97); }
.ap-chip:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.ap-chip.is-picked { background: var(--accent); border-color: var(--accent); color: #000; }

/* ---------- Selfie ---------- */
.ap-frame {
  position: relative;
  width: min(72vw, 300px);
  aspect-ratio: 4 / 5;
  margin: 8px auto 0;
  border-radius: 999px / 46%;
  border: 2px dashed rgba(255, 255, 255, .3);
  overflow: hidden;
  display: grid; place-items: center;
  cursor: pointer;
  background: var(--bg2);
  transition: border-color .2s;
}
.ap-frame:hover { border-color: var(--accent); }
.ap-frame.has-photo { border: 3px solid var(--accent); box-shadow: 0 0 0 8px rgba(255, 224, 138, .12); }
.ap-frame img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.ap-frame-empty { display: grid; gap: 10px; justify-items: center; color: var(--text2); font-weight: 600; }
.ap-frame-empty svg { width: 46px; height: 46px; color: var(--accent); }
.ap-file { position: absolute; width: 1px; height: 1px; opacity: 0; }
.ap-file:focus-visible + .ap-err, .ap-frame:focus-within { outline: 2px solid var(--accent); }
.ap-link { background: none; border: 0; color: var(--accent); font: 600 15px var(--font); text-decoration: underline; cursor: pointer; padding: 6px; }
.ap .pill[disabled] { opacity: .35; cursor: not-allowed; }

/* ---------- Generating ---------- */
.ap-gen { align-items: center; justify-content: center; gap: 34px; overflow: hidden; text-align: center; }
.gen-orb { --orb: min(56vw, 260px); position: relative; width: var(--orb); height: var(--orb); }
.gen-particles { position: absolute; left: 50%; top: 50%; width: calc(var(--orb) * 2.2); height: calc(var(--orb) * 2.2); transform: translate(-50%, -50%); pointer-events: none; }
.gen-ring { position: absolute; inset: -14px; width: calc(100% + 28px); height: calc(100% + 28px); transform: rotate(-90deg); }
.gen-ring circle { fill: none; stroke-width: 3; }
.gen-ring-track { stroke: rgba(255, 255, 255, .1); }
.gen-ring-fill { stroke: var(--accent); stroke-linecap: round; stroke-dasharray: 578.05; stroke-dashoffset: 578.05; filter: drop-shadow(0 0 8px rgba(255, 224, 138, .6)); }
.gen-photo { position: absolute; inset: 0; border-radius: 50%; overflow: hidden; background: var(--bg2); }
.gen-photo img { width: 100%; height: 100%; object-fit: cover; }
.gen-status {
  margin: 0;
  min-height: 1em;
  font-family: var(--display);
  font-size: clamp(32px, 9vw, 52px);
  letter-spacing: -.03em;
  line-height: 1;
}
/* while the questions are up the orb steps back, then grows again once they are answered */
.gen-orb { transition: width .6s cubic-bezier(.22, 1, .36, 1), height .6s cubic-bezier(.22, 1, .36, 1); }
.ap-gen.is-asking { justify-content: flex-start; gap: 22px; }
.ap-gen.is-asking .gen-orb { --orb: min(34vw, 150px); margin-top: 18px; }
.ap-gen.is-asking .gen-status { font-size: clamp(22px, 6vw, 30px); color: var(--text2); }
.gen-q { width: 100%; max-width: 480px; display: grid; gap: 14px; }
.gen-q-k { margin: 0; font-size: 13px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--accent); }
.gen-q-title { margin: 0 0 6px; font-family: var(--display); font-weight: 500; font-size: clamp(36px, 10vw, 54px); letter-spacing: -.03em; line-height: 1; }
.gen-error { display: grid; gap: 18px; justify-items: center; max-width: 360px; }
.gen-error p { margin: 0; color: var(--text2); font-size: 17px; }
.gen-error-actions { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; }
.gen-flash { position: fixed; inset: 0; background: var(--accent); opacity: 0; pointer-events: none; z-index: 60; }

/* ---------- Report ---------- */
.ap-report { padding-top: calc(70px + env(safe-area-inset-top)); }
.ap-inner--report { align-items: center; gap: 20px; max-width: 460px; }
.ap-actions { width: 100%; max-width: 420px; display: grid; gap: 12px; }
.ap-saved { margin: 0; text-align: center; font-size: 15px; color: var(--accent); }
.ap-report.is-dim::before { content: ""; position: fixed; inset: 0; background: radial-gradient(circle at 50% 40%, #1a1406, #050505 70%); z-index: -1; }

/* the Love Report card styles live in /styles.css (shared with the home page example) */
/* the card holds the full report: as tall as it needs on screen */
.lr-card--full { aspect-ratio: auto; }
.lr-card--full .lr-id { margin-bottom: calc(var(--u) * 6); }
/* sections breathe; items are one quiet pattern: dot + title, words underneath, a hairline between them */
.lr-body .lr-sec { margin-bottom: calc(var(--u) * 7); }
.lr-body .lr-sec h4 { margin-bottom: calc(var(--u) * 3.4); }
.lr-item { position: relative; padding-left: calc(var(--u) * 4.2); }
.lr-item + .lr-item { margin-top: calc(var(--u) * 3.6); padding-top: calc(var(--u) * 3.6); border-top: 1px solid rgba(246, 241, 231, .07); }
.lr-item h5::before { content: ""; display: inline-block; width: calc(var(--u) * 1.5); height: calc(var(--u) * 1.5); margin: 0 calc(var(--u) * 2.7) 0 calc(var(--u) * -4.2); border-radius: 50%; vertical-align: middle; position: relative; top: -.08em; }
.lr-item--good h5::before { background: #9fd38c; box-shadow: 0 0 0 calc(var(--u) * .8) rgba(159, 211, 140, .14); }
.lr-item--warn h5::before { background: #f0927d; box-shadow: 0 0 0 calc(var(--u) * .8) rgba(240, 146, 125, .14); }
.lr-item h5 { margin: 0 0 calc(var(--u) * 1.2); font: 600 calc(var(--u) * 3.6)/1.3 var(--font); letter-spacing: -.005em; color: var(--ink); }
.lr-item p { margin: 0; font: 400 calc(var(--u) * 3.3)/1.55 var(--font); color: var(--ink2); }
.lr-item small { display: block; margin: calc(var(--u) * 2.2) 0 calc(var(--u) * .6); font: 600 calc(var(--u) * 2.3)/1 var(--font); letter-spacing: .12em; text-transform: uppercase; color: rgba(246, 241, 231, .4); }
.lr-item h5 + small { margin-top: calc(var(--u) * 1.6); }
.lr-foot { margin-top: calc(var(--u) * 2); }

/* export copy: never on screen. Each story slide is a fixed 540x956 card (drawn at 960x1700 on the 1080x1920 image) */
.lr-export-host { position: fixed; left: -10000px; top: 0; width: 540px; pointer-events: none; display: grid; gap: 20px; }
.lr-export-host .lr-card { --u: 5.4px; aspect-ratio: auto; box-shadow: none; transition: none; }
.lr-export-host .lr-in { height: 956px; min-height: 0; overflow: hidden; }
.lr-export-host .lr-foot { display: block; margin-top: auto; padding-top: calc(var(--u) * 2); }
/* html2canvas draws flex pseudo-elements a little off: plainer rules for the image */
/* html2canvas draws inline-block pseudo-elements higher than the browser (same fix as the footer line) */
.lr-export-host .lr-item h5::before { top: .3em; }
/* slides after the first have no photo row: keep the same space under the header */
.lr-card--slide .lr-head + .lr-body { margin-top: calc(var(--u) * 6); }
.lr-export-host .lr-foot::before { display: inline-block; vertical-align: middle; position: relative; top: -.15em; margin-right: calc(var(--u) * 1.4); }

@media (min-width: 821px) {
  .ap-top { height: 72px; }
  .ap-step { padding-top: 110px; }
}

@media (prefers-reduced-motion: reduce) {
  .ap-step, .ap-step.is-back { transform: none; }
}

/* ---------- Request code (last step) ---------- */
.ap-code { display: grid; justify-items: start; gap: 6px; padding: 18px 20px; border: 1px dashed var(--accent); border-radius: 18px; }
.ap-code[hidden] { display: none; }
.ap-code-label { margin: 0; font-size: 13px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--text2); }
.ap-code-value { margin: 0; font-family: var(--display); font-size: clamp(48px, 14vw, 64px); line-height: 1; letter-spacing: .04em; color: var(--accent); user-select: all; }

/* Seat requested: the check draws itself, then the message rises */
.ap-done { display: grid; justify-items: start; gap: 10px; }
.ap-done[hidden] { display: none; }
.ap-done-mark { width: 64px; height: 64px; fill: none; stroke: var(--accent); stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }
.ap-done-mark circle { stroke-dasharray: 151; stroke-dashoffset: 151; animation: ap-draw .6s ease-out forwards; }
.ap-done-mark path { stroke-dasharray: 36; stroke-dashoffset: 36; animation: ap-draw .35s .5s ease-out forwards; }
.ap-done-title { margin: 6px 0 0; font-family: var(--display); font-size: clamp(36px, 10vw, 48px); line-height: 1; color: var(--text); }
.ap-done > p { opacity: 0; animation: ap-rise .45s .7s ease-out forwards; }
.ap-done > p + p { animation-delay: .85s; }
@keyframes ap-draw { to { stroke-dashoffset: 0; } }
@keyframes ap-rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) {
  .ap-done-mark circle, .ap-done-mark path, .ap-done > p { animation: none; stroke-dashoffset: 0; opacity: 1; }
}
