/* ════════════════════════════════════════════════════════════════
   FLOW SECTION (#built)
   Tabbed, animated product flow. Guests + Hosts phones animate;
   Promoter panel is static. Sticky-pin scroll on first pass.
   Loaded after styles.css — reuses its tokens (--bone, --accent…).
   ════════════════════════════════════════════════════════════════ */

/* ── Scroll track + sticky stage ────────────────────────── */
.flow {
  padding-top: 0;
  padding-bottom: 0;
}

.flow-track {
  position: relative;
  height: 340vh;            /* drives the pinned scroll (3 stages) */
}

.flow.is-seen .flow-track {
  height: auto;
}

.flow-stage {
  position: sticky;
  top: 0;
  height: 100vh;
  display: grid;
  grid-template-rows: auto 1fr;
  gap: clamp(16px, 3vh, 34px);
  padding: clamp(72px, 9vh, 116px) 0 clamp(30px, 5vh, 60px);
}

.flow.is-seen .flow-stage {
  position: static;
  display: block;
  height: auto;
  min-height: 0;
}

/* ── Tab header ─────────────────────────────────────────── */
.flow-head {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
  text-align: center;
}

.flow-eyebrow { margin: 0; }

.flow-tabs { display: flex; gap: 8px; }

.flow-tab {
  min-height: 44px;
  padding: 0 22px;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  transition: background 0.18s var(--ease), color 0.18s var(--ease), border-color 0.18s var(--ease);
}

.flow-tab:hover { color: var(--bone); border-color: var(--line-strong); }

.flow-tab.is-active { background: var(--bone); color: var(--bg-deep); border-color: var(--bone); }

/* ── Panels ─────────────────────────────────────────────── */
.flow-panels { width: 100%; min-height: 0; }
.flow.is-seen .flow-panels { display: block; }
.flow-panel[hidden] { display: none; }

/* while pinned: center the phone in the row below the tabs, scale to fit */
@media (min-width: 881px) {
  .flow:not(.is-seen) .flow-panels { display: grid; place-items: center; }
  .flow:not(.is-seen) .flow-panel.split { padding: 0; width: min(1180px, calc(100% - 48px)); }
  .flow:not(.is-seen) .flow-stage .phone {
    height: min(66vh, 660px);
    width: auto;
  }
}

/* ── Entrance: phone rises from below ───────────────────── */
.flow-rise {
  opacity: 0;
  transform: translateY(80px);
  transition: opacity 0.95s var(--ease), transform 0.95s var(--ease);
  will-change: transform, opacity;
}
.flow-rise.is-risen { opacity: 1; transform: translateY(0); }

/* ════════════════ GUESTS PHONE ════════════════ */
.g-screen { position: relative; }

.g-event {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.g-cover { height: clamp(120px, 19vh, 168px); }

.app-line.g-doors { margin-bottom: 6px; }

.app-line.g-going {
  margin: 0 0 8px;
  font-size: 16px;
}

.g-maplink {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 10px;
  color: var(--accent);
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.g-maplink-pin {
  width: 8px;
  height: 8px;
  border-radius: 50% 50% 50% 0;
  background: var(--accent);
  transform: rotate(-45deg);
}

/* stylised map */
.g-map {
  position: relative;
  flex: 1 1 auto;
  min-height: 64px;
  border: 1px solid var(--line);
  overflow: hidden;
  background: #0c0b0a;
}
.g-map-svg { position: absolute; inset: 0; }
.g-map-svg svg { display: block; width: 100%; height: 100%; }

.g-map-pin {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 16px;
  height: 16px;
  transform: translate(-50%, -100%) rotate(-45deg);
  background: var(--accent);
  border-radius: 50% 50% 50% 0;
  box-shadow: 0 6px 14px rgba(0, 0, 0, 0.55);
}
.g-map-pin::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 5px;
  height: 5px;
  background: #13110f;
  border-radius: 50%;
  transform: translate(-50%, -50%);
}
@media (prefers-reduced-motion: no-preference) {
  .g-map-pin { animation: mapPin 2.4s ease-in-out infinite; }
}

.g-foot { position: relative; margin-top: auto; min-height: 168px; }

.g-state {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
  opacity: 0;
  transform: translateY(10px);
  pointer-events: none;
  transition: opacity 0.55s var(--ease), transform 0.55s var(--ease);
}
.g-state.is-active { opacity: 1; transform: translateY(0); }

.g-headline { margin: 0; font-size: 32px; line-height: 0.95; font-weight: 500; }

.g-status {
  margin: 0;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}
.g-ok { color: #8fae8c; }
.g-cta { margin-top: 2px; }

.app-btn.is-dark { background: var(--bg-deep); color: var(--accent); border: 1px solid var(--line); }

/* QR ticket overlay */
.g-qr {
  position: absolute;
  inset: 0;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 70px 24px 26px;
  text-align: center;
  background:
    radial-gradient(ellipse at 50% 18%, rgba(232, 220, 196, 0.10), transparent 60%),
    #100e0d;
  opacity: 0;
  transform: scale(0.97);
  pointer-events: none;
  transition: opacity 0.6s var(--ease), transform 0.6s var(--ease);
}
.g-qr.is-active { opacity: 1; transform: scale(1); }
.g-qr-brand { margin: 0; color: var(--accent); font-family: var(--mono); font-size: 11px; letter-spacing: 0.32em; text-transform: uppercase; }
.g-qr-rule { width: 38px; height: 1px; background: var(--line-strong); }
.g-qr-event { margin: 2px 0 0; font-size: 30px; line-height: 0.95; }
.g-qr-meta { margin: 0 0 6px; color: var(--muted); font-family: var(--mono); font-size: 9px; letter-spacing: 0.1em; text-transform: uppercase; }
.g-qr-code { width: clamp(120px, 19vh, 152px); aspect-ratio: 1; padding: 11px; background: var(--bone); border-radius: 12px; box-shadow: 0 18px 50px rgba(0, 0, 0, 0.45); }
.g-qr-code svg { display: block; width: 100%; height: 100%; }
.g-qr-id { margin: 4px 0 0; color: var(--bone-soft); font-family: var(--mono); font-size: 12px; letter-spacing: 0.22em; }
.g-qr-status { display: inline-flex; align-items: center; gap: 8px; padding: 7px 14px; border: 1px solid rgba(143, 174, 140, 0.45); color: #8fae8c; font-family: var(--mono); font-size: 10px; letter-spacing: 0.18em; text-transform: uppercase; }
.g-qr-dot { width: 6px; height: 6px; border-radius: 50%; background: #8fae8c; }
@media (prefers-reduced-motion: no-preference) {
  .g-qr.is-active .g-qr-dot { animation: livePulse 1.8s ease-in-out infinite; }
}

/* ════════════════ HOSTS PHONE ════════════════ */
.h-screen { position: relative; padding: 0; }

.h-frame {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  padding: 70px 20px 24px;
  opacity: 0;
  transform: translateY(12px);
  pointer-events: none;
  transition: opacity 0.55s var(--ease), transform 0.55s var(--ease);
}
.h-frame.is-active { opacity: 1; transform: translateY(0); }

.h-title { margin: 8px 0 18px; font-size: 36px; line-height: 0.92; font-weight: 500; }

/* field rows (create) */
.h-fields { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; }
.h-fields li { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px; border: 1px solid var(--line); }
.h-fields li span { color: var(--muted); font-family: var(--mono); font-size: 10px; letter-spacing: 0.14em; text-transform: uppercase; }
.h-fields li b { font-family: var(--serif); font-size: 19px; font-weight: 500; }
.h-publish { margin-top: auto; }

/* guestlist */
.h-apps { list-style: none; padding: 0; margin: 2px 0 0; display: grid; gap: 10px; }
.h-app { display: grid; grid-template-columns: 34px 1fr auto; gap: 12px; align-items: center; padding: 12px; border: 1px solid var(--line); transition: background 0.45s var(--ease), border-color 0.45s var(--ease), opacity 0.45s var(--ease); }
.h-app .ava { width: 34px; height: 34px; }
.h-app-id { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.h-app-id b { font-family: var(--serif); font-size: 19px; font-weight: 500; }
.h-app-id i { font-style: normal; color: var(--muted); font-family: var(--mono); font-size: 9px; letter-spacing: 0.12em; text-transform: uppercase; }
.h-stamp { font-family: var(--mono); font-size: 9px; letter-spacing: 0.12em; text-transform: uppercase; padding: 5px 9px; border: 1px solid transparent; opacity: 0; transform: scale(0.88); transition: opacity 0.4s var(--ease), transform 0.4s var(--ease); }
.h-stamp.ok { color: #8fae8c; border-color: rgba(143, 174, 140, 0.5); }
.h-stamp.no { color: #c8736f; border-color: rgba(176, 80, 76, 0.5); }
.h-frame.play .h-stamp { opacity: 1; transform: scale(1); transition-delay: 0.35s; }
.h-frame.play .h-app[data-decide="approve"] { border-color: rgba(143, 174, 140, 0.42); background: rgba(143, 174, 140, 0.07); }
.h-frame.play .h-app[data-decide="reject"] { border-color: rgba(176, 80, 76, 0.4); background: rgba(176, 80, 76, 0.06); opacity: 0.55; }
.h-actions { display: grid; grid-template-columns: 0.8fr 1fr; gap: 8px; margin-top: auto; }
.h-actions .app-btn { min-height: 46px; display: flex; }

/* scanner */
.h-scan { position: relative; width: clamp(130px, 20vh, 158px); aspect-ratio: 1; margin: 6px auto 16px; display: grid; place-items: center; border: 1px solid var(--line); overflow: hidden; }
.h-scan-code { width: 74%; aspect-ratio: 1; padding: 8px; background: var(--bone); border-radius: 9px; }
.h-scan-code svg { display: block; width: 100%; height: 100%; }
.h-scanline { position: absolute; left: 8px; right: 8px; top: 0; height: 2px; background: linear-gradient(90deg, transparent, var(--accent), transparent); opacity: 0; }
.h-frame.play .h-scanline { animation: hScan 1.6s var(--ease) 0.2s; }
.h-checkin { display: flex; align-items: center; justify-content: center; gap: 9px; margin: 0; color: #8fae8c; font-family: var(--mono); font-size: 11px; letter-spacing: 0.16em; text-transform: uppercase; opacity: 0; transition: opacity 0.45s var(--ease); }
.h-frame.play .h-checkin { opacity: 1; transition-delay: 0.9s; }
.h-check { width: 9px; height: 5px; border-left: 1.6px solid #8fae8c; border-bottom: 1.6px solid #8fae8c; transform: rotate(-45deg); margin-top: -3px; }
.h-count { margin-top: auto; display: flex; flex-direction: column; align-items: center; gap: 5px; text-align: center; }
.h-num { font-family: var(--serif); font-size: 42px; font-weight: 500; line-height: 0.9; }
.h-count span { color: var(--muted); font-family: var(--mono); font-size: 10px; letter-spacing: 0.14em; text-transform: uppercase; }

/* walk-in: gender tiles + amount */
.h-flabel { display: block; margin: 2px 0 9px; color: var(--muted); font-family: var(--mono); font-size: 10px; letter-spacing: 0.14em; text-transform: uppercase; }
.h-gender { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin-bottom: 14px; }
.h-gtile { min-height: 44px; display: flex; align-items: center; justify-content: center; border: 1px solid var(--line); color: var(--bone-soft); font-family: var(--mono); font-size: 10px; letter-spacing: 0.04em; text-transform: uppercase; transition: background 0.35s var(--ease), color 0.35s var(--ease), border-color 0.35s var(--ease); }
.h-gtile.is-on { background: var(--bone); color: var(--bg-deep); border-color: var(--bone); }
.h-frame.play .h-gtile.is-on { animation: tilePop 0.5s var(--ease) 0.35s; }
.h-amount { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px; border: 1px solid var(--line); }
.h-amount span { color: var(--muted); font-family: var(--mono); font-size: 10px; letter-spacing: 0.14em; text-transform: uppercase; }
.h-amount b { font-family: var(--serif); font-size: 19px; font-weight: 500; }

/* my event (live dashboard) */
.h-live { align-self: center; display: inline-flex; align-items: center; gap: 8px; padding: 5px 13px; border: 1px solid rgba(176, 80, 76, 0.5); color: #c8736f; font-family: var(--mono); font-size: 9px; letter-spacing: 0.18em; text-transform: uppercase; }
.h-dot { width: 6px; height: 6px; border-radius: 50%; background: #c0504c; }
@media (prefers-reduced-motion: no-preference) { .h-frame.is-active .h-dot { animation: livePulse 1.6s ease-in-out infinite; } }
.h-livegrid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; margin: 14px 0; }
.h-livegrid div { display: flex; flex-direction: column; gap: 4px; padding: 13px; border: 1px solid var(--line); }
.h-livegrid b { font-family: var(--serif); font-size: 27px; font-weight: 500; line-height: 0.9; }
.h-livegrid span { color: var(--muted); font-family: var(--mono); font-size: 9px; letter-spacing: 0.12em; text-transform: uppercase; }
.h-ratio { border: 1px solid var(--line); padding: 13px; }
.h-ratio-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.h-ratio-head span:first-child { color: var(--muted); font-family: var(--mono); font-size: 10px; letter-spacing: 0.14em; text-transform: uppercase; }
.h-ratio-val { font-family: var(--serif); font-size: 18px; }
.h-ratio-bar { display: flex; gap: 3px; height: 8px; }
.h-ratio-bar i { display: block; height: 100%; width: 0; transition: width 0.9s var(--ease); }
.h-ratio-bar i.m { background: var(--accent); }
.h-ratio-bar i.f { background: #a06a6a; }
.h-frame.play .h-ratio-bar i { width: var(--w); }
.h-ratio-legend { display: flex; justify-content: space-between; margin-top: 9px; }
.h-ratio-legend span { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-family: var(--mono); font-size: 9px; letter-spacing: 0.12em; text-transform: uppercase; }
.h-ratio-legend span::before { content: ""; width: 7px; height: 7px; }
.h-ratio-legend span:first-child::before { background: var(--accent); }
.h-ratio-legend span:last-child::before { background: #a06a6a; }

/* analytics: line chart + donut */
.h-linewrap { margin-top: 4px; }
.h-chart-cap { display: block; margin-bottom: 8px; color: var(--muted); font-family: var(--mono); font-size: 9px; letter-spacing: 0.14em; text-transform: uppercase; }
.h-line { position: relative; width: 100%; height: clamp(78px, 12vh, 104px); border-bottom: 1px solid var(--line); }
.h-line svg { display: block; width: 100%; height: 100%; overflow: visible; }
.h-line-area { opacity: 0; transition: opacity 0.9s var(--ease) 0.2s; }
.h-frame.play .h-line-area { opacity: 1; }
.h-line-path { fill: none; stroke: var(--accent); stroke-width: 2; stroke-dasharray: 1; stroke-dashoffset: 1; }
.h-frame.play .h-line-path { stroke-dashoffset: 0; transition: stroke-dashoffset 1.15s var(--ease); }
.h-line-dot { opacity: 0; }
.h-frame.play .h-line-dot { opacity: 1; transition: opacity 0.4s var(--ease) 0.95s; }
.h-anarow { display: grid; grid-template-columns: auto 1fr; gap: 20px; align-items: center; margin-top: 20px; }
.h-donut { position: relative; width: clamp(104px, 16vh, 124px); aspect-ratio: 1; }
.h-donut svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.h-donut-track { fill: none; stroke: rgba(242, 237, 228, 0.1); stroke-width: 9; }
.h-donut-arc { fill: none; stroke: var(--accent); stroke-width: 9; stroke-linecap: round; stroke-dasharray: 100; stroke-dashoffset: 100; }
.h-frame.play .h-donut-arc { stroke-dashoffset: 24; transition: stroke-dashoffset 1.15s var(--ease) 0.2s; }
.h-donut-center { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; }
.h-donut-center b { font-family: var(--serif); font-size: 30px; font-weight: 500; line-height: 0.9; }
.h-donut-center b i { font-style: normal; font-size: 15px; }
.h-donut-center span { color: var(--muted); font-family: var(--mono); font-size: 8px; letter-spacing: 0.14em; text-transform: uppercase; }
.h-anastats { list-style: none; padding: 0; margin: 0; display: grid; gap: 11px; }
.h-anastats li { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; padding-bottom: 9px; border-bottom: 1px solid var(--line); }
.h-anastats li:last-child { border-bottom: 0; padding-bottom: 0; }
.h-anastats span { color: var(--muted); font-family: var(--mono); font-size: 10px; letter-spacing: 0.12em; text-transform: uppercase; }
.h-anastats b { font-family: var(--serif); font-size: 18px; font-weight: 500; }

/* staggered field / livegrid entrance when a frame plays */
.h-frame .h-fields li,
.h-frame .h-livegrid div { opacity: 0; transform: translateY(10px); }
.h-frame.play .h-fields li,
.h-frame.play .h-livegrid div { opacity: 1; transform: translateY(0); transition: opacity 0.5s var(--ease) calc(var(--i, 0) * 70ms), transform 0.5s var(--ease) calc(var(--i, 0) * 70ms); }
.h-frame .h-livegrid div:nth-child(1) { --i: 0; }
.h-frame .h-livegrid div:nth-child(2) { --i: 1; }
.h-frame .h-livegrid div:nth-child(3) { --i: 2; }
.h-frame .h-livegrid div:nth-child(4) { --i: 3; }
.h-frame.play .h-publish { animation: btnPress 0.5s var(--ease) 0.6s; }

@keyframes hScan { 0% { transform: translateY(0); opacity: 0; } 12% { opacity: 1; } 88% { opacity: 1; } 100% { transform: translateY(140px); opacity: 0; } }
@keyframes btnPress { 0%, 100% { transform: scale(1); } 45% { transform: scale(0.965); } }
@keyframes tilePop { 0%, 100% { transform: scale(1); } 45% { transform: scale(0.94); } }
@keyframes livePulse { 0%, 100% { opacity: 1; transform: scale(1); } 50% { opacity: 0.45; transform: scale(0.82); } }
@keyframes mapPin { 0%, 100% { transform: translate(-50%, -100%) rotate(-45deg) scale(1); } 50% { transform: translate(-50%, -108%) rotate(-45deg) scale(1.06); } }

/* ── Reduced motion ─────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  .flow-track { height: auto; }
  .flow-stage { position: static; display: block; height: auto; min-height: 0; }
  .flow-panels { display: block; }
  .flow-rise { opacity: 1; transform: none; transition: none; }
  .g-state, .h-frame { transition: none; }
}

/* ── Mobile: no pin, simple flow ────────────────────────── */
@media (max-width: 880px) {
  .flow-track { height: auto; }
  .flow-stage { position: static; display: block; height: auto; min-height: 0; padding: clamp(80px, 11vw, 150px) 0; gap: 40px; }
  .flow-panels { display: block; }
  .flow-stage .phone { height: auto; width: min(330px, 92vw); }
  .flow-tabs { flex-wrap: wrap; justify-content: center; }
}
