/* ==========================================================================
   Castle Building Centres — The Great Canadian Home Renovation Contest
   Modern, mobile-first redesign.
   ========================================================================== */

/* ---------- Fonts ---------- */
@font-face {
  font-family: "Gotham-Medium";
  src: url("../fonts/gotham-medium/Gotham-Medium.woff") format("woff"),
       url("../fonts/gotham-medium/Gotham-Medium.ttf") format("truetype");
  font-display: swap;
  font-weight: 500;
  font-style: normal;
}
@font-face {
  font-family: "Gotham-Ultra";
  src: url("../fonts/gotham-ultra/Gotham-Ultra.woff") format("woff"),
       url("../fonts/gotham-ultra/Gotham-Ultra.ttf") format("truetype");
  font-display: swap;
  font-weight: 900;
  font-style: normal;
}
@font-face {
  font-family: "Gotham-Book";
  src: url("../fonts/gotham-book/Gotham-Book.woff") format("woff"),
       url("../fonts/gotham-book/Gotham-Book.ttf") format("truetype");
  font-display: swap;
  font-weight: 400;
  font-style: normal;
}

/* ---------- Design tokens ---------- */
:root {
  --castle-red:      #C8102E;
  --castle-red-dk:   #A00C24;
  --castle-navy:     #0F3161;
  --castle-navy-dk:  #082244;
  --castle-navy-lt:  #185290;
  --castle-cream:    #FFFCEE;

  --ink:             #1A1F2C;
  --ink-soft:        #4A5568;
  --ink-muted:       #6B7280;
  --line:            #E2E8F0;
  --line-strong:     #CBD5E1;
  --surface:         #FFFFFF;
  --surface-2:       #F8FAFC;
  --surface-3:       #EEF2F7;
  --bg:              #F1F4F9;

  --success:         #15803D;
  --error:           #B91C1C;
  --error-bg:        #FEF2F2;

  --radius-sm: 6px;
  --radius:    12px;
  --radius-lg: 20px;

  --shadow-sm: 0 1px 2px rgba(15, 49, 97, .06), 0 1px 1px rgba(15, 49, 97, .04);
  --shadow:    0 10px 25px -10px rgba(15, 49, 97, .25), 0 4px 8px -4px rgba(15, 49, 97, .10);
  --shadow-lg: 0 25px 50px -12px rgba(15, 49, 97, .25);

  --font-sans: "Gotham-Book", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-display: "Gotham-Ultra", "Gotham-Medium", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-medium:  "Gotham-Medium", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;

  --header-h: 72px;

  --easing: cubic-bezier(.22, 1, .36, 1);
}

/* ---------- Reset & base ---------- */
*, *::before, *::after { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  scroll-behavior: smooth;
  /* Belt-and-braces — clips any child that escapes the viewport so the page
     can never gain horizontal scroll on mobile (e.g. the 304px h-captcha
     widget or an absolute-positioned decoration). */
  overflow-x: hidden;
}

body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.5;
  color: var(--ink);
  background-color: var(--castle-navy-dk);
  min-height: 100vh;
  overflow-x: hidden;
  position: relative;
}

/* Full-bleed castle backdrop with navy scrim for legibility */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -2;
  background-image: url("../images/bg.jpg");
  background-size: cover;
  background-position: center center;
  background-repeat: no-repeat;
}
body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    linear-gradient(180deg, rgba(8, 34, 68, .55) 0%, rgba(8, 34, 68, .35) 40%, rgba(241, 244, 249, .92) 100%);
}

/* iOS doesn't honor background-attachment: fixed reliably on body, so we
   use a fixed pseudo-element above. On mobile we want the scrim brighter
   so cards pop against the photo. */
@media (max-width: 720px) {
  body::after {
    background:
      linear-gradient(180deg, rgba(8, 34, 68, .60) 0%, rgba(8, 34, 68, .35) 30%, rgba(241, 244, 249, .96) 80%);
  }
}

img { max-width: 100%; height: auto; display: block; }

button { font: inherit; cursor: pointer; }

a { color: var(--castle-navy); }
a:hover { color: var(--castle-red); }

.sr-only {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0);
  white-space: nowrap; border: 0;
}

:focus-visible {
  outline: 3px solid var(--castle-red);
  outline-offset: 2px;
  border-radius: 4px;
}

/* ---------- Header ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(255, 255, 255, .92);
  -webkit-backdrop-filter: saturate(160%) blur(10px);
  backdrop-filter: saturate(160%) blur(10px);
  border-bottom: 1px solid rgba(15, 49, 97, .12);
  box-shadow: 0 2px 12px -4px rgba(8, 34, 68, .25);
  /* Bleed background under the iOS notch / status bar so there's no
     transparent strip when the page is scrolled. viewport-fit=cover on the
     meta tag is what makes env() return a non-zero value on notched devices. */
  padding-top: env(safe-area-inset-top);
  padding-left: env(safe-area-inset-left);
  padding-right: env(safe-area-inset-right);
}
.site-header__inner {
  max-width: 1080px;
  margin: 0 auto;
  height: var(--header-h);
  padding: 0 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.site-header__logo {
  display: inline-flex;
  align-items: center;
  height: 100%;
}
.site-header__logo img {
  display: block;
  height: 48px;
  width: auto;
  max-width: 240px;
}
@media (max-width: 480px) {
  .site-header__logo img { height: 40px; }
}

/* Segmented language toggle */
.lang-toggle {
  display: inline-flex;
  padding: 4px;
  background: var(--surface-3);
  border-radius: 999px;
  border: 1px solid var(--line);
}
.lang-toggle__btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  height: 32px;
  padding: 0 12px;
  border-radius: 999px;
  font-family: var(--font-medium);
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-soft);
  text-decoration: none;
  letter-spacing: .04em;
  transition: background-color .2s var(--easing), color .2s var(--easing);
}
.lang-toggle__btn:hover {
  color: var(--castle-navy);
}
.lang-toggle__btn.is-active {
  background: var(--castle-navy);
  color: #fff;
  box-shadow: var(--shadow-sm);
}

/* ---------- Hero ---------- */
.hero {
  padding: 40px 16px 0;
}
.hero__inner {
  max-width: 720px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  text-align: center;
}
.hero__badge {
  display: flex;
  justify-content: center;
  flex: 0 0 auto;
}
.hero__badge img {
  width: 160px;
  height: 160px;
  border-radius: 50%;
  background: rgba(255, 255, 255, .92);
  padding: 10px;
  box-shadow: var(--shadow);
}
.hero__copy {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  width: 100%;
}
.hero__eyebrow {
  font-family: var(--font-medium);
  text-transform: uppercase;
  letter-spacing: .14em;
  font-size: 11px;
  font-weight: 600;
  color: #FFD2D8;
  margin: 0;
  text-shadow: 0 1px 2px rgba(0, 0, 0, .35);
}
.hero__title {
  margin: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  color: #fff;
  text-transform: uppercase;
  line-height: 1.05;
  text-shadow: 0 2px 12px rgba(8, 34, 68, .6);
  text-wrap: balance;
}
.hero__title-line {
  font-family: var(--font-medium);
  /* FR copy runs ~30% longer than EN — keep upper bound a touch smaller */
  font-size: clamp(18px, 4.2vw, 26px);
  letter-spacing: .02em;
  max-width: 28ch;
}
.hero__title-money {
  position: relative;
  display: inline-flex;
  align-items: baseline;
  font-family: var(--font-display);
  font-size: clamp(48px, 12vw, 88px);
  letter-spacing: .04em;
  line-height: 1;

  /* White fill */
  color: #fff;
  -webkit-text-fill-color: #fff;

  /* Layered drop shadow for depth (text-shadow doesn't work with clip:text) */
  filter:
    drop-shadow(0 1px 0   rgba(255, 255, 255, .35))
    drop-shadow(0 2px 4px rgba(0, 0, 0, .35))
    drop-shadow(0 12px 22px rgba(8, 34, 68, .45));
}

/* Dollar sign sits a touch smaller and aligned to the cap-height of the digits */
.hero__title-money__sym {
  font-size: .62em;
  align-self: flex-start;
  line-height: 1;
  margin-top: .12em;
  letter-spacing: 0;
}
.hero__title-money__num {
  letter-spacing: .04em;
}
.hero__visit {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 12px 0 0;
  padding: 8px 16px 8px 12px;
  background: #fff;
  border: 1px solid rgba(15, 49, 97, .15);
  color: var(--castle-navy);
  font-family: var(--font-medium);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .06em;
  text-transform: uppercase;
  border-radius: 999px;
  line-height: 1;
  box-shadow: 0 6px 16px -8px rgba(8, 34, 68, .45);
}
.hero__visit-icon {
  flex: 0 0 auto;
  color: var(--castle-red);
}


@media (min-width: 720px) {
  .hero { padding: 56px 24px 0; }
  .hero__inner {
    /* Side-by-side badge + copy, but centered as a tight unit on the page */
    max-width: 760px;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    gap: 32px;
    text-align: left;
  }
  .hero__badge img { width: 180px; height: 180px; }
  .hero__copy { align-items: flex-start; width: auto; }
  .hero__title { align-items: flex-start; }
  .hero__visit { margin: 0; }
}

/* ---------- Main / content ---------- */
.content {
  padding: 32px 16px 64px;
}
.content__inner {
  max-width: 800px;
  margin: 0 auto;
}

/* ---------- Step indicator ---------- */
.steps {
  list-style: none;
  margin: 0 0 20px;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}
.steps__item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 8px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--ink-muted);
  font-size: 12px;
  transition: background-color .2s var(--easing), color .2s var(--easing), border-color .2s var(--easing);
  justify-content: center;
}
.steps__num {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--surface-3);
  color: var(--ink-soft);
  font-family: var(--font-medium);
  font-weight: 700;
  font-size: 12px;
}
.steps__label {
  font-family: var(--font-medium);
  font-weight: 600;
  letter-spacing: .02em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 12ch;
}
.steps__item.is-done {
  color: var(--castle-navy);
  border-color: rgba(15, 49, 97, .25);
}
.steps__item.is-done .steps__num {
  background: var(--castle-navy);
  color: #fff;
}
.steps__item.is-active {
  color: #fff;
  background: var(--castle-navy);
  border-color: var(--castle-navy);
  box-shadow: var(--shadow-sm);
}
.steps__item.is-active .steps__num {
  background: var(--castle-red);
  color: #fff;
}

@media (max-width: 480px) {
  .steps__label { display: none; }
  .steps__item { padding: 8px; }
}

/* ---------- Card / tabs ---------- */
.tabs { position: relative; }

.tab { display: none; }
.tab.is-active { display: block; animation: fade-in .25s var(--easing); }

@keyframes fade-in {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: none; }
}

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow);
}

.card__title {
  font-family: var(--font-medium);
  font-weight: 600;
  font-size: 20px;
  line-height: 1.25;
  color: var(--castle-navy);
  margin: 0 0 6px;
}
.card__title--lg { font-size: 26px; }

.card__help {
  margin: 0 0 20px;
  color: var(--ink-soft);
  font-size: 14px;
}

.card__legal {
  margin: 16px 0 0;
  font-size: 12px;
  color: var(--ink-soft);
  text-align: center;
  line-height: 1.5;
}
.card__legal--muted { color: var(--ink-muted); }

.card__footer {
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
  text-align: center;
}

.card__actions {
  margin-top: 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.card__actions--row {
  flex-direction: column-reverse;
}
.card__actions--center {
  align-items: center;
}
@media (min-width: 600px) {
  .card { padding: 32px; }
  .card__actions--row {
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
  }
}

/* ---------- Buttons ---------- */
.btn {
  -webkit-appearance: none;
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 12px 24px;
  border-radius: 999px;
  border: 2px solid transparent;
  background: transparent;
  font-family: var(--font-medium);
  font-weight: 600;
  font-size: 14px;
  letter-spacing: .04em;
  text-transform: uppercase;
  text-decoration: none;
  text-align: center;
  cursor: pointer;
  transition: background-color .2s var(--easing), color .2s var(--easing), transform .1s var(--easing), box-shadow .2s var(--easing);
}
.btn:active { transform: translateY(1px); }
.btn[disabled], .btn.is-loading {
  cursor: not-allowed;
  opacity: .7;
}
.btn--primary {
  background: var(--castle-red);
  border-color: var(--castle-red);
  color: #fff;
  box-shadow: 0 6px 16px -6px rgba(200, 16, 46, .55);
}
.btn--primary:hover {
  background: var(--castle-red-dk);
  border-color: var(--castle-red-dk);
  color: #fff;
}
.btn--navy {
  background: var(--castle-navy);
  border-color: var(--castle-navy);
  color: #fff;
  box-shadow: 0 6px 16px -6px rgba(15, 49, 97, .55);
}
.btn--navy:hover {
  background: var(--castle-navy-dk);
  border-color: var(--castle-navy-dk);
  color: #fff;
}
.btn--ghost {
  background: var(--surface);
  border-color: var(--line-strong);
  color: var(--castle-navy);
}
.btn--ghost:hover {
  background: var(--surface-3);
  color: var(--castle-navy-dk);
}
/* "View list of participating stores (PDF)" — centered text link sitting
   directly under the Continue button. Subdued navy, hovers to red. */
.card__pdf {
  margin: 14px 0 0;
  text-align: center;
  font-size: 13px;
}
.card__pdf a {
  color: var(--castle-navy);
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 3px;
}
.card__pdf a:hover { color: var(--castle-red); }

.link {
  appearance: none;
  background: transparent;
  border: 0;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  font-family: var(--font-medium);
  font-weight: 600;
  font-size: 13px;
  color: var(--castle-navy);
  text-decoration: none;
  text-transform: uppercase;
  letter-spacing: .06em;
  padding: 8px 4px;
  display: inline-block;
  transition: color .2s var(--easing), border-color .2s var(--easing);
}
.link:hover {
  color: var(--castle-red);
  border-bottom-color: var(--castle-red);
}

/* ---------- Form fields ---------- */
.form-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
}
.field { display: flex; flex-direction: column; }
.field label {
  font-family: var(--font-medium);
  font-weight: 600;
  font-size: 12px;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--ink-soft);
  margin-bottom: 6px;
}

.field input,
.field select,
.field textarea {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  min-height: 48px;
  padding: 12px 14px;
  font: inherit;
  font-size: 16px; /* prevent iOS zoom-in */
  line-height: 1.4;
  color: var(--ink);
  background: var(--surface);
  border: 1.5px solid var(--line-strong);
  border-radius: var(--radius);
  transition: border-color .2s var(--easing), box-shadow .2s var(--easing), background-color .2s var(--easing);
}
.field input::placeholder { color: var(--ink-muted); opacity: 1; }
.field input:hover,
.field select:hover,
.field textarea:hover { border-color: var(--castle-navy-lt); }
.field input:focus,
.field select:focus,
.field textarea:focus {
  outline: none;
  border-color: var(--castle-navy);
  box-shadow: 0 0 0 4px rgba(15, 49, 97, .15);
}

/* Input with a non-editable prefix (e.g. "+1" before a phone number). The
   prefix sits inside the bordered group; the input itself has no border so
   the two visually merge into a single field. Focus styles move to the group
   when the inner input is focused. */
.input-group {
  display: flex;
  align-items: stretch;
  width: 100%;
  background: var(--surface);
  border: 1.5px solid var(--line-strong);
  border-radius: var(--radius);
  overflow: hidden;
  transition: border-color .2s var(--easing), box-shadow .2s var(--easing);
}
.input-group:hover { border-color: var(--castle-navy-lt); }
.input-group:focus-within {
  border-color: var(--castle-navy);
  box-shadow: 0 0 0 4px rgba(15, 49, 97, .15);
}
.input-group__prefix {
  display: inline-flex;
  align-items: center;
  padding: 0 12px;
  background: var(--surface-2, #f3f4f6);
  color: var(--ink-muted);
  font-size: 15px;
  font-weight: 600;
  border-right: 1px solid var(--line);
  user-select: none;
}
.input-group input {
  border: 0 !important;
  border-radius: 0 !important;
  box-shadow: none !important;
  background: transparent !important;
  flex: 1 1 auto;
  min-width: 0;            /* lets the flex item shrink below content width */
}
.field select {
  background-image:
    linear-gradient(45deg, transparent 50%, var(--ink-soft) 50%),
    linear-gradient(135deg, var(--ink-soft) 50%, transparent 50%);
  background-position:
    calc(100% - 18px) 50%,
    calc(100% - 12px) 50%;
  background-size: 6px 6px, 6px 6px;
  background-repeat: no-repeat;
  padding-right: 36px;
}

.field.has-error input,
.field.has-error select,
.field.has-error textarea {
  border-color: var(--error);
  background: var(--error-bg);
}
.field.has-error input:focus,
.field.has-error select:focus,
.field.has-error textarea:focus {
  box-shadow: 0 0 0 4px rgba(185, 28, 28, .15);
}
.field__error {
  display: block;
  margin-top: 6px;
  font-size: 12px;
  color: var(--error);
  font-family: var(--font-medium);
  font-weight: 600;
}

/* Big code input (tab 1) */
.field--code input {
  text-align: center;
  text-transform: uppercase;
  letter-spacing: .35em;
  font-family: var(--font-medium);
  font-weight: 600;
  font-size: 22px;
  min-height: 60px;
  background: var(--surface-2);
}
/* The placeholder "ENTER YOUR CODE" + 0.35em letter-spacing overflows a
   narrow viewport (iPhone SE / 320px). Tighten on small screens so the
   prompt fits without sacrificing iOS focus-zoom protection (≥ 16px). */
@media (max-width: 480px) {
  .field--code input {
    font-size: 17px;
    letter-spacing: .22em;
  }
  /* Tighter registration-form inputs on narrow screens so labels + values
     don't crowd a 320–375px viewport. Safe because the maximum-scale=1
     viewport meta blocks iOS focus-zoom regardless of font-size. */
  .field input,
  .field select,
  .field textarea {
    font-size: 15px;
    min-height: 44px;
    padding: 10px 12px;
  }
}

@media (min-width: 640px) {
  .form-grid {
    grid-template-columns: repeat(4, 1fr);
  }
  .field--full    { grid-column: span 4; }
  .field--half    { grid-column: span 2; }
  .field--quarter { grid-column: span 1; }
}
@media (min-width: 640px) and (max-width: 819px) {
  /* On tablet, drop quarter fields into 2-col layout so they stay tappable */
  .field--quarter { grid-column: span 2; }
}

/* ---------- hCaptcha ---------- */
.captcha-wrap {
  display: flex;
  justify-content: center;
  margin: 16px 0 4px;
}

/* ---------- Modal (Rules) ---------- */
html.modal-open { overflow: hidden; }

.modal {
  /* Native <dialog> resets */
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  max-width: min(720px, calc(100% - 32px));
  width: 100%;
  /* dvh = "dynamic viewport height" — already excludes iOS Safari's
     toolbars/URL bar, so we only need a small visual inset (16px) for it to
     not press flush against the screen edges. Falls back to vh on older
     browsers. The body's own safe-area-bottom padding handles the home
     indicator gap, so we don't subtract it twice here. */
  max-height: calc(100vh  - 16px);
  max-height: calc(100dvh - 16px);
  border-radius: var(--radius-lg);
  overflow: visible;
}
.modal::backdrop {
  background: rgba(8, 34, 68, .65);
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
  animation: modal-fade .25s var(--easing);
}
.modal[open] {
  animation: modal-rise .3s var(--easing);
}
/* Fullscreen variant — used by the stores-PDF modal so the iframe has room.
   On mobile fills the viewport edge-to-edge; on desktop leaves a small inset. */
.modal--full {
  max-width: calc(100% - 24px);
  max-height: calc(100% - 24px);
  width: 100%;
  height: 100%;
}
.modal--full .modal__panel { max-height: 100%; height: 100%; }
@media (min-width: 900px) {
  .modal--full { max-width: 1100px; max-height: calc(100% - 48px); }
}
/* Right side of the modal header — close button + optional "Open in new tab"
   fallback link for browsers that won't render PDFs inline. */
.modal__header-actions {
  display: inline-flex;
  align-items: center;
  gap: 14px;
}
.modal__header-link {
  font-size: 13px;
  font-weight: 600;
  color: var(--castle-navy);
  text-decoration: underline;
  text-underline-offset: 3px;
}
.modal__header-link:hover { color: var(--castle-red); }
/* Modal body that should fill — no padding, no scroll wrapper (the iframe
   handles its own scrolling). Used by PDF previews. */
.modal__body--full { padding: 0; overflow: hidden; }
.pdf-frame {
  width: 100%;
  height: 100%;
  border: 0;
  display: block;
  background: var(--surface-3);
}
@keyframes modal-fade {
  from { opacity: 0; }
  to   { opacity: 1; }
}
@keyframes modal-rise {
  from { opacity: 0; transform: translateY(12px) scale(.98); }
  to   { opacity: 1; transform: none; }
}

.modal__panel {
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  /* Match .modal — tight 16px inset, no double-counted safe-area math. */
  max-height: calc(100vh  - 16px);
  max-height: calc(100dvh - 16px);
  overflow: hidden;
}
.modal__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 20px;
  border-bottom: 1px solid var(--line);
  background: var(--surface-2);
}
.modal__title {
  margin: 0;
  font-family: var(--font-medium);
  font-weight: 600;
  font-size: 18px;
  color: var(--castle-navy);
}
.modal__close {
  appearance: none;
  background: transparent;
  border: 0;
  padding: 6px;
  margin: -6px;
  border-radius: 999px;
  color: var(--ink-soft);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background-color .15s var(--easing), color .15s var(--easing);
}
.modal__close:hover {
  background: var(--surface-3);
  color: var(--castle-navy);
}
.modal__body {
  padding: 20px;
  /* Extra bottom inset on phones so the last line clears the home indicator
     and Safari's bottom toolbar when scrolled all the way down. */
  padding-bottom: calc(20px + env(safe-area-inset-bottom));
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  flex: 1 1 auto;
  min-height: 0;
}
.modal__body .rules-text {
  max-height: none;
  padding: 0;
  margin: 0;
  background: transparent;
  border: 0;
  font-size: 14px;
  color: var(--ink);
}
.modal__body .rules-text b { color: var(--castle-navy); }
.modal__footer {
  padding: 16px 20px;
  border-top: 1px solid var(--line);
  background: var(--surface-2);
  display: flex;
  justify-content: flex-end;
}
@media (min-width: 600px) {
  .modal__header { padding: 20px 24px; }
  .modal__body   { padding: 24px; padding-bottom: calc(24px + env(safe-area-inset-bottom)); }
  .modal__footer { padding: 18px 24px; }
}

/* ---------- Rules text ---------- */
.rules-text {
  max-height: 60vh;
  overflow-y: auto;
  padding: 16px;
  margin: 0 -8px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  font-size: 13px;
  line-height: 1.55;
  color: var(--ink-soft);
  -webkit-overflow-scrolling: touch;
}
.rules-text p { margin: 0 0 12px; }
.rules-text p:last-child { margin-bottom: 0; }
.rules-text a { color: var(--castle-navy); }
.rules-text b { color: var(--ink); }

/* Custom scrollbar on rules */
.rules-text::-webkit-scrollbar { width: 8px; }
.rules-text::-webkit-scrollbar-thumb {
  background: var(--line-strong);
  border-radius: 4px;
}
.rules-text::-webkit-scrollbar-thumb:hover { background: var(--castle-navy-lt); }

/* ---------- Success card ---------- */
.card--success {
  text-align: center;
}
.success-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 72px;
  height: 72px;
  margin: 0 auto 16px;
  color: #fff;
  background: var(--success);
  border-radius: 50%;
  box-shadow: 0 10px 24px -8px rgba(21, 128, 61, .5);
}

/* ---------- Holding overlay ---------- */
/* iOS scroll lock — `overflow: hidden` alone doesn't stop mobile Safari from
   rubber-banding the body and revealing a gap behind the sticky header. The
   `position: fixed` body + `overscroll-behavior: none` combo is what actually
   pins everything. We mirror the lock on <html> so the document element can't
   scroll either. */
html.is-holding,
body.is-holding {
  overflow: hidden;
  overscroll-behavior: none;
  -webkit-overflow-scrolling: auto;
}
body.is-holding {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
}

.holding {
  position: fixed;
  /* Cover the full viewport so the notch-bleed background stays consistent
     even when iOS bounces. Inner content is pushed below the header via
     padding-top, instead of starting at top: var(--header-h). */
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 40; /* below site-header (z-index: 50) */
  display: flex;
  align-items: center;
  justify-content: center;
  /* --holding-gutter is overridden on small screens below so the countdown
     card hugs the edge on iPhone. Stays at 24px on desktop. */
  --holding-gutter: 24px;
  padding:
    calc(env(safe-area-inset-top) + var(--header-h) + 24px)
    calc(env(safe-area-inset-right) + var(--holding-gutter))
    calc(env(safe-area-inset-bottom) + 24px)
    calc(env(safe-area-inset-left)  + var(--holding-gutter));
  /* Translucent navy scrim — the page behind shows through, blurred */
  background:
    radial-gradient(80% 70% at 50% 60%, rgba(200, 16, 46, .15) 0%, rgba(200, 16, 46, 0) 65%),
    linear-gradient(180deg, rgba(8, 34, 68, .42) 0%, rgba(8, 34, 68, .57) 100%);
  -webkit-backdrop-filter: blur(15px) saturate(118%);
          backdrop-filter: blur(15px) saturate(118%);
  color: #fff;
  text-align: center;
  -webkit-user-select: none;
          user-select: none;
  overflow: auto; /* internal scroll if countdown + copy overflows on short viewports */
  overscroll-behavior: contain;
  animation: holding-in .6s var(--easing) both;
}

.holding__inner {
  position: relative;
  max-width: 720px;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
}
.holding__badge {
  margin: 0 0 6px;
  animation: holding-rise .7s var(--easing) .05s both;
}
.holding__badge img {
  display: block;
  width: 140px;
  height: 140px;
  border-radius: 50%;
  background: rgba(255, 255, 255, .92);
  padding: 10px;
  box-shadow: 0 18px 36px -16px rgba(0, 0, 0, .55);
}
@media (min-width: 720px) {
  .holding__badge img { width: 160px; height: 160px; }
}
.holding__title {
  margin: 6px 0 0;
  font-family: var(--font-display);
  font-weight: 900;
  font-size: clamp(32px, 6vw, 56px);
  line-height: 1.1;
  letter-spacing: -.01em;
  text-wrap: balance;
  animation: holding-rise .8s var(--easing) .22s both;
}
.holding__subtitle {
  margin: 0;
  max-width: 48ch;
  font-size: clamp(15px, 1.6vw, 17px);
  color: rgba(255, 255, 255, .85);
  line-height: 1.5;
  text-wrap: balance;
  animation: holding-rise .8s var(--easing) .32s both;
}

/* Countdown */
.countdown {
  margin-top: 18px;
  display: inline-flex;
  align-items: flex-start;
  gap: 8px;
  padding: 18px 22px;
  background: rgba(255, 255, 255, .08);
  border: 1px solid rgba(255, 255, 255, .18);
  -webkit-backdrop-filter: blur(10px);
          backdrop-filter: blur(10px);
  border-radius: var(--radius-lg);
  box-shadow: 0 20px 50px -20px rgba(0, 0, 0, .55);
  animation: holding-rise .9s var(--easing) .45s both;
}
.countdown__unit {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  min-width: 64px;
}
.countdown__num {
  font-family: var(--font-display);
  font-weight: 900;
  font-size: clamp(32px, 6vw, 48px);
  line-height: 1;
  letter-spacing: .02em;
  color: #fff;
  font-variant-numeric: tabular-nums;
  text-shadow: 0 4px 14px rgba(0, 0, 0, .45);
  display: inline-block;
}
.countdown__num.tick {
  animation: cd-tick .35s var(--easing);
}
.countdown__lbl {
  font-family: var(--font-medium);
  font-weight: 600;
  font-size: 10px;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, .65);
}
.countdown__sep {
  font-family: var(--font-display);
  font-weight: 900;
  font-size: clamp(28px, 5vw, 40px);
  line-height: 1;
  /* Was .35 alpha — invisible on the navy scrim once the device drops the
     backdrop-filter (older iOS, low-power mode). Bumped to .7 so the colons
     read at a glance even when the blur is degraded. */
  color: rgba(255, 255, 255, .7);
  margin-top: 4px;
  animation: sep-blink 1s ease-in-out infinite;
}

@media (max-width: 480px) {
  /* Hug the screen edge on phones — was 24px before, leaving a big inset
     either side of the countdown card. */
  .holding { --holding-gutter: 10px; }
  .countdown {
    padding: 12px 10px;
    gap: 4px;
  }
  .countdown__unit { min-width: 50px; }
  /* Keep the colons visible on mobile — they were `display: none` before,
     which is why iPhone users couldn't see the separators between units.
     Scaled down to fit alongside the tighter unit spacing. */
  .countdown__sep {
    font-size: 24px;
    margin-top: 6px;
  }
}

.holding__rules {
  appearance: none;
  background: transparent;
  border: 0;
  border-bottom: 1px solid rgba(255, 255, 255, .35);
  margin-top: 18px;
  padding: 4px 2px;
  color: rgba(255, 255, 255, .85);
  font-family: var(--font-medium);
  font-weight: 600;
  font-size: 11px;
  letter-spacing: .12em;
  text-transform: uppercase;
  cursor: pointer;
  transition: color .2s var(--easing), border-color .2s var(--easing);
  animation: holding-rise .9s var(--easing) .55s both;
}
.holding__rules:hover {
  color: #fff;
  border-bottom-color: #fff;
}

/* Holding animations */
@keyframes holding-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}
@keyframes holding-rise {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: none; }
}
@keyframes cd-tick {
  0%   { transform: translateY(-6px); opacity: .25; }
  60%  { transform: translateY(2px);  opacity: 1; }
  100% { transform: none; opacity: 1; }
}
@keyframes sep-blink {
  0%, 100% { opacity: .35; }
  50%      { opacity: .12; }
}
/* ---------- Animations ---------- */
@keyframes rise-in {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: none; }
}

@keyframes badge-float {
  0%, 100% { transform: translateY(0)    rotate(-1.5deg); }
  50%      { transform: translateY(-8px) rotate(1.5deg); }
}


@keyframes shine-sweep {
  0%   { transform: translateX(-120%) skewX(-20deg); }
  60%  { transform: translateX(220%)  skewX(-20deg); }
  100% { transform: translateX(220%)  skewX(-20deg); }
}

/* Staggered hero entrance */
.hero__badge,
.hero__eyebrow,
.hero__title-line,
.hero__title-money,
.hero__visit {
  opacity: 0;
  animation: rise-in .7s var(--easing) forwards;
}
.hero__badge        { animation-delay: .05s; }
.hero__eyebrow      { animation-delay: .18s; }
.hero__title-line:nth-of-type(1) { animation-delay: .28s; }
.hero__title-money  { animation-delay: .38s; }
.hero__title-line:nth-of-type(3) { animation-delay: .48s; }
.hero__visit        { animation-delay: .60s; }

/* Continuous loops — kick in after the entrance */
.hero__badge img {
  transform-origin: center center;
  animation: badge-float 5s ease-in-out 1s infinite;
  transition: transform .4s var(--easing);
}
.hero__badge img:hover {
  animation-play-state: paused;
  transform: scale(1.04) rotate(0deg);
}
.hero__title-money {
  animation: rise-in .7s var(--easing) .38s forwards;
}

/* Primary button shine */
.btn--primary {
  position: relative;
  overflow: hidden;
  isolation: isolate;
}
.btn--primary::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(110deg,
    transparent 0%,
    rgba(255, 255, 255, .25) 45%,
    rgba(255, 255, 255, .55) 50%,
    rgba(255, 255, 255, .25) 55%,
    transparent 100%);
  transform: translateX(-120%) skewX(-20deg);
  animation: shine-sweep 4s ease-in-out 2s infinite;
  z-index: -1;
}
.btn--primary:hover::after {
  animation-duration: 1.6s;
}

/* Step indicator: subtle pulse on the active number badge */
@keyframes dot-pulse {
  0%, 100% { box-shadow: 0 0 0 0   rgba(200, 16, 46, .55); }
  70%      { box-shadow: 0 0 0 10px rgba(200, 16, 46, 0); }
}
.steps__item.is-active .steps__num {
  animation: dot-pulse 2.2s ease-out infinite;
}

/* Success card icon: gentle bounce on first appearance */
@keyframes pop-in {
  0%   { opacity: 0; transform: scale(.6); }
  60%  { opacity: 1; transform: scale(1.08); }
  100% { opacity: 1; transform: scale(1); }
}
.tab.complete.is-active .success-icon {
  animation: pop-in .5s var(--easing) both;
}

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
    scroll-behavior: auto !important;
  }
  .hero__badge,
  .hero__eyebrow,
  .hero__title-line,
  .hero__title-money,
  .hero__visit { opacity: 1; transform: none; }
}
