/* ============================================================
   Coffee Connect — DEN BDTA Alumni check-in
   Identity taken from the B.O.L.D event flyer:
   navy + gold, heavy condensed caps, brush script used sparingly,
   coffee beans as the recurring mark.
   ============================================================ */
:root {
  --navy:      #13294B;
  --navy-deep: #0B1B33;
  --navy-soft: #3A5480;
  --navy-mute: #7288A8;

  --gold:      #C69A3E;
  --gold-hi:   #E0B75A;
  --gold-lo:   #9E7828;

  --cream:     #F4F2EE;
  --cream-hi:  #FBFAF8;
  --cream-lo:  #E8E4DC;

  --rule:      rgba(19, 41, 75, 0.16);
  --rule-soft: rgba(19, 41, 75, 0.08);
  --alert:     #B3402C;

  --display: 'Archivo Black', 'Archivo', system-ui, sans-serif;
  --script:  'Kaushan Script', cursive;
  --body:    'Archivo', system-ui, -apple-system, 'Segoe UI', sans-serif;

  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --thud: cubic-bezier(0.34, 1.56, 0.64, 1);
  --pad:  clamp(1.25rem, 5.5vw, 2.25rem);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }

/* App shell pinned to the viewport. With min-height the layout box can grow
   taller than the screen, and centred content then drifts downward — which
   left a dead gap above the hero. Fixed height + a scrollable <main> keeps
   centring honest and still handles screens taller than the phone. */
body {
  margin: 0;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--cream);
  color: var(--navy);
  font-family: var(--body);
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
  /* Kills the double-tap-to-zoom gesture (and its 300ms tap delay) while
     leaving normal taps and scrolling untouched. */
  touch-action: manipulation;
}

input, textarea, button { font: inherit; color: inherit; }

.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;
}

/* Warm ambient wash — a hint of the flyer's café photography, no image weight.
   Promoted to its own compositor layer: as a plain fixed element the browser
   repaints these gradients on every keystroke, which reads as a page flicker. */
.fibers {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(70% 45% at 88% 4%,  rgba(198, 154, 62, 0.16), transparent 70%),
    radial-gradient(65% 45% at 4% 100%, rgba(19, 41, 75, 0.09),  transparent 70%);
  transform: translateZ(0);
  backface-visibility: hidden;
  contain: strict;
}

/* ============================================================
   Top bar — back · bean card · count
   ============================================================ */
.bar {
  position: relative;
  z-index: 3;
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding: max(0.9rem, env(safe-area-inset-top)) var(--pad) 0.9rem;
  border-bottom: 1px solid var(--rule-soft);
}

/* Welcome, saving and done screens have nothing to put in the bar — showing
   an empty strip there just eats vertical space above the hero. */
body.no-chrome .bar { display: none; }

.back {
  flex: none;
  display: grid;
  place-items: center;
  width: 38px; height: 38px;
  border-radius: 50%;
  border: 1.5px solid var(--rule);
  background: transparent;
  color: var(--navy-soft);
  cursor: pointer;
  transition: background 0.2s, color 0.2s, transform 0.15s var(--ease);
  -webkit-tap-highlight-color: transparent;
}
.back:hover { background: var(--cream-lo); color: var(--navy); }
.back:active { transform: scale(0.9); }
.back[hidden] { display: none; }

/* ---- signature: the bean card ----
   One bean per question. Beans fill with gold as you go — the same
   bean mark that runs along the bottom of the printed flyer. */
.card {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: clamp(3px, 1.4vw, 8px);
  padding: 0.45rem 0.75rem;
  border: 1.5px solid var(--rule-soft);
  border-radius: 999px;
  background: var(--cream-hi);
}
.card[hidden] { display: none; }

.bean {
  flex: none;
  width: clamp(15px, 4.3vw, 19px);
  color: var(--navy-mute);
  opacity: 0.4;
  transition: color 0.3s, opacity 0.3s;
}
.bean svg { display: block; width: 100%; height: auto; }
.bean .shell { fill: none; stroke: currentColor; stroke-width: 1.8; }
.bean .crack { fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; }

/* A filled bean drops in with a slight overshoot and a crooked tilt */
.bean.filled {
  color: var(--gold);
  opacity: 1;
  animation: bean-drop 0.42s var(--thud) both;
}
.bean.filled .shell { fill: var(--gold); stroke: var(--gold-lo); }
.bean.filled .crack { stroke: rgba(19, 41, 75, 0.55); }
@keyframes bean-drop {
  0%   { transform: rotate(-30deg) scale(2); opacity: 0; }
  55%  { transform: rotate(6deg) scale(0.86); opacity: 1; }
  100% { transform: rotate(var(--tilt, 0deg)) scale(1); opacity: 1; }
}

.bean.active {
  color: var(--gold);
  opacity: 1;
  animation: bean-wait 1.9s ease-in-out infinite;
}
@keyframes bean-wait { 50% { opacity: 0.42; } }

.count {
  flex: none;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  font-variant-numeric: tabular-nums;
  color: var(--navy-mute);
}
.count[hidden] { display: none; }

/* ============================================================
   Stage
   ============================================================ */
main {
  position: relative;
  z-index: 2;
  flex: 1 1 auto;
  min-height: 0;              /* lets the flex child actually scroll */
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  padding: 0 var(--pad) max(1.25rem, env(safe-area-inset-bottom));
}

.screen {
  min-height: 100%;           /* centre when short, grow when tall */
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 1.4rem;
  width: 100%;
  max-width: 33rem;
  margin: 0 auto;
  padding: 1.25rem 0 1.5rem;
}

.screen.enter        { animation: in-fwd  0.44s var(--ease) both; }
.screen.leaving      { animation: out-fwd 0.24s ease-in both; }
.screen.back-enter   { animation: in-bwd  0.44s var(--ease) both; }
.screen.back-leaving { animation: out-bwd 0.24s ease-in both; }

@keyframes in-fwd  { from { opacity: 0; transform: translate3d(22px, 0, 0); } }
@keyframes out-fwd { to   { opacity: 0; transform: translate3d(-16px, 0, 0); } }
@keyframes in-bwd  { from { opacity: 0; transform: translate3d(-22px, 0, 0); } }
@keyframes out-bwd { to   { opacity: 0; transform: translate3d(16px, 0, 0); } }

.screen.enter > *, .screen.back-enter > * { animation: rise 0.5s var(--ease) both; }
.screen > *:nth-child(1) { animation-delay: 0.05s; }
.screen > *:nth-child(2) { animation-delay: 0.11s; }
.screen > *:nth-child(3) { animation-delay: 0.17s; }
.screen > *:nth-child(4) { animation-delay: 0.23s; }
.screen > *:nth-child(5) { animation-delay: 0.29s; }
@keyframes rise { from { opacity: 0; transform: translate3d(0, 12px, 0); } }

/* ============================================================
   Type
   ============================================================ */
.eyebrow {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  margin: 0 0 0.9rem;
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--gold-lo);
}
.eyebrow .rule { flex: 1; height: 1px; background: var(--rule); }

h1, h2 {
  font-family: var(--display);
  font-weight: 400;   /* Archivo Black is already the weight */
  letter-spacing: -0.025em;
  line-height: 1.03;
  margin: 0;
  text-wrap: balance;
}
h1 { font-size: clamp(2.2rem, 9.5vw, 3.4rem); }
h2 { font-size: clamp(1.85rem, 7.6vw, 2.6rem); }

/* The flyer lockup: COFFEE stacked with a script "Connect" tucked under it */
.lockup { margin: 0; line-height: 0.9; }
.lockup .coffee {
  display: block;
  font-family: var(--display);
  font-size: clamp(3rem, 16vw, 5rem);
  letter-spacing: -0.03em;
  text-transform: uppercase;
  color: var(--navy);
}
.lockup .connect {
  display: block;
  margin-top: -0.24em;
  margin-left: 0.06em;
  font-family: var(--script);
  font-size: clamp(2.6rem, 14vw, 4.4rem);
  font-weight: 400;
  letter-spacing: 0;
  line-height: 1.15;
  color: var(--gold);
}

.tagline {
  margin: 0;
  font-size: 0.76rem;
  font-weight: 600;
  letter-spacing: 0.17em;
  text-transform: uppercase;
  color: var(--navy-soft);
}

.lede {
  margin: 0;
  max-width: 32ch;
  font-size: 1.02rem;
  line-height: 1.55;
  color: var(--navy-soft);
}

.help {
  margin: 0.8rem 0 0;
  font-size: 0.88rem;
  line-height: 1.5;
  color: var(--navy-mute);
}

.optional {
  display: inline-block;
  margin-left: 0.55rem;
  padding: 0.3em 0.62em;
  border: 1.5px solid var(--rule);
  border-radius: 4px;
  font-family: var(--body);
  font-size: 0.55rem;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--navy-mute);
  vertical-align: 0.4em;
}

/* Event details block on the welcome screen */
.details {
  display: grid;
  gap: 0.7rem;
  padding: 1.1rem 1.2rem;
  background: var(--cream-hi);
  border: 1px solid var(--rule-soft);
  border-left: 3px solid var(--gold);
  border-radius: 10px;
}
.details .row { display: flex; gap: 0.8rem; align-items: flex-start; }
.details .key {
  flex: none;
  width: 4.6rem;
  font-size: 0.63rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--navy-mute);
  padding-top: 0.22em;
}
.details .val { font-size: 0.92rem; font-weight: 500; line-height: 1.4; }
.details .val small {
  display: block;
  margin-top: 0.15rem;
  font-size: 0.82rem;
  font-weight: 400;
  color: var(--navy-mute);
}

/* ============================================================
   Inputs
   ============================================================ */
.field { position: relative; }

input[type="text"], input[type="tel"], input[type="email"], input[type="url"] {
  width: 100%;
  padding: 0.7rem 0.1rem;
  font-family: var(--body);
  font-size: clamp(1.3rem, 5.2vw, 1.6rem);  /* >=16px: no iOS zoom-on-focus */
  font-weight: 600;
  letter-spacing: -0.015em;
  background: transparent;
  border: none;
  border-bottom: 2.5px solid var(--rule);
  border-radius: 0;
  outline: none;
  transition: border-color 0.25s;
  -webkit-appearance: none;
}
input::placeholder { color: var(--navy-mute); opacity: 0.5; font-weight: 500; }
input:focus { border-bottom-color: var(--gold); }

textarea {
  width: 100%;
  min-height: 6rem;
  padding: 0.9rem 1rem;
  font-size: 1rem;
  line-height: 1.5;
  resize: none;
  background: var(--cream-hi);
  border: 1.5px solid var(--rule);
  border-radius: 10px;
  outline: none;
  transition: border-color 0.25s;
  -webkit-appearance: none;
}
textarea::placeholder { color: var(--navy-mute); opacity: 0.8; }
textarea:focus { border-color: var(--gold); }

.field.invalid input, .field.invalid textarea { border-color: var(--alert); }
.field.invalid input { animation: nudge 0.32s ease; }
@keyframes nudge { 25% { transform: translateX(-5px); } 75% { transform: translateX(5px); } }

.error {
  margin: 0.65rem 0 0;
  min-height: 1.2em;
  font-size: 0.83rem;
  font-weight: 500;
  color: var(--alert);
}

/* Honeypot — offscreen, only bots fill it */
.hp { position: absolute !important; left: -9999px; opacity: 0; height: 0; pointer-events: none; }

/* ============================================================
   Choices
   ============================================================ */
.options { display: grid; gap: 0.65rem; }
.options.two { grid-template-columns: 1fr 1fr; }

.opt {
  display: flex;
  align-items: flex-start;
  gap: 0.8rem;
  padding: 1.1rem;
  text-align: left;
  background: var(--cream-hi);
  border: 1.5px solid var(--rule);
  border-radius: 12px;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s, transform 0.14s var(--ease);
  -webkit-tap-highlight-color: transparent;
}
.opt:hover { border-color: var(--navy-soft); }
.opt:active { transform: scale(0.98); }
.opt[aria-pressed="true"] {
  border-color: var(--gold);
  background: rgba(198, 154, 62, 0.11);
  box-shadow: inset 0 0 0 1px var(--gold);
}

.opt .tick {
  flex: none;
  display: grid;
  place-items: center;
  width: 21px; height: 21px;
  margin-top: 1px;
  border: 1.5px solid var(--rule);
  border-radius: 5px;
  color: var(--navy);
  transition: background 0.18s, border-color 0.18s;
}
.opt .tick svg { opacity: 0; transform: scale(0.4); transition: all 0.22s var(--thud); }
.opt[aria-pressed="true"] .tick { background: var(--gold); border-color: var(--gold); }
.opt[aria-pressed="true"] .tick svg { opacity: 1; transform: scale(1); }

.opt .label { flex: 1; font-weight: 600; font-size: 1.02rem; line-height: 1.25; }
.opt .sub {
  display: block;
  margin-top: 0.3rem;
  font-size: 0.8rem;
  font-weight: 400;
  line-height: 1.35;
  color: var(--navy-mute);
}

.chips { display: flex; flex-wrap: wrap; gap: 0.45rem; }

.chip {
  padding: 0.62rem 0.95rem;
  background: var(--cream-hi);
  border: 1.5px solid var(--rule);
  border-radius: 999px;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--navy-soft);
  cursor: pointer;
  transition: all 0.18s var(--ease);
  -webkit-tap-highlight-color: transparent;
}
.chip:hover { border-color: var(--navy-soft); color: var(--navy); }
.chip:active { transform: scale(0.95); }
.chip[aria-pressed="true"] {
  background: var(--navy);
  border-color: var(--navy);
  color: var(--cream-hi);
  font-weight: 600;
}
.chips.years .chip { font-variant-numeric: tabular-nums; }

/* ============================================================
   Actions
   ============================================================ */
.actions { display: flex; align-items: center; gap: 1.1rem; margin-top: 0.4rem; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  padding: 1.05rem 1.9rem;
  background: var(--navy);
  color: var(--cream-hi);
  border: none;
  border-radius: 999px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.16s var(--ease), background 0.2s;
  -webkit-tap-highlight-color: transparent;
}
.btn:hover { background: var(--navy-deep); }
.btn:active { transform: scale(0.96); }
.btn[disabled] { opacity: 0.5; cursor: default; }
.btn svg { transition: transform 0.22s var(--ease); }
.btn:hover svg { transform: translateX(3px); }

.btn-gold { background: var(--gold); color: var(--navy-deep); }
.btn-gold:hover { background: var(--gold-hi); }

.btn-ghost {
  background: none;
  border: none;
  border-bottom: 1.5px solid var(--rule);
  border-radius: 0;
  padding: 0.55rem 0.1rem;
  font-size: 0.76rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--navy-mute);
  cursor: pointer;
  transition: color 0.2s, border-color 0.2s;
  -webkit-tap-highlight-color: transparent;
}
.btn-ghost:hover { color: var(--navy); border-color: var(--navy); }

.hint {
  margin: 0;
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.06em;
  color: var(--navy-mute);
}
@media (hover: none) { .hint.desktop-only { display: none; } }

:focus-visible { outline: 2.5px solid var(--gold); outline-offset: 3px; border-radius: 4px; }

/* ============================================================
   Welcome / done / error
   ============================================================ */

/* The flyer's gold-ringed navy badge */
.badge {
  flex: none;
  display: grid;
  place-items: center;
  width: 168px; height: 168px;
  margin: 0 auto;
  padding: 1.4rem;
  border-radius: 50%;
  background: var(--navy);
  box-shadow: 0 0 0 3px var(--cream), 0 0 0 6px var(--gold), 0 18px 40px -18px rgba(19,41,75,0.6);
  animation: badge-land 0.6s var(--thud) both;
}
@keyframes badge-land {
  0%   { transform: rotate(-16deg) scale(0.4); opacity: 0; }
  60%  { transform: rotate(4deg) scale(1.08); opacity: 1; }
  100% { transform: rotate(0) scale(1); opacity: 1; }
}
.badge .script {
  font-family: var(--script);
  font-size: 1.45rem;
  line-height: 1.15;
  color: var(--cream-hi);
  text-align: center;
}
.badge .strong {
  margin-top: 0.4rem;
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--gold-hi);
  text-align: center;
}

.done-card {
  padding: 1.15rem;
  border: 1px solid var(--rule-soft);
  border-radius: 12px;
  background: var(--cream-hi);
}
.done-card .card-row { display: flex; justify-content: center; gap: 7px; margin-bottom: 0.85rem; }
.done-card .card-row .bean { width: 20px; }
.done-card .cap {
  margin: 0;
  font-size: 0.66rem;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  text-align: center;
  color: var(--navy-mute);
}

.spinner {
  flex: none;
  margin: 0 auto;
  width: 34px; height: 34px;
  border: 3px solid var(--rule);
  border-top-color: var(--gold);
  border-radius: 50%;
  animation: spin 0.75s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Flex column, not just text-align: fixed-width children (the spinner, the
   badge) are block boxes and text-align cannot centre them. */
.center {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1.15rem;
  text-align: center;
  width: 100%;
}
.center > * { margin: 0; }
.center .lede { max-width: 34ch; }
.center .actions { justify-content: center; flex-wrap: wrap; }
.center .eyebrow { justify-content: center; margin-bottom: 0; }
.center .eyebrow .rule { width: 2.5rem; flex: none; }
.center .done-card { width: 100%; }

/* ============================================================
   Preferences
   ============================================================ */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

@media (prefers-contrast: more) {
  :root { --rule: rgba(19,41,75,0.42); --navy-soft: #22375C; --navy-mute: #4A6180; }
}
