:root {
  --blue-deep: #04203f;
  --blue: #0c5ca8;
  --blue-bright: #1c7fd6;
  --blue-pale: #eaf3fb;
  --gold: #d99a2b;
  --paper: #f7f9fc;
  --card: #ffffff;
  --ink: #10182b;
  --ink-soft: #4c5670;
  --line: #d8e1ee;
  --error: #b3261e;
  --error-bg: #fdecea;
  --heading: #04203f;
  --radius: 14px;
  --font-display: "Kanit", "Anuphan", sans-serif;
  --font-body: "Anuphan", sans-serif;
  color-scheme: light;
}

/* Dark theme: applied automatically when the OS/browser prefers dark and
   the visitor hasn't explicitly picked light, or explicitly via the
   light/dark toggle button setting data-theme on <html>. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --blue: #4f9eff;
    --blue-pale: #16233a;
    --paper: #0b1220;
    --card: #131d2e;
    --ink: #eef2f8;
    --ink-soft: #9aa7bd;
    --line: #263248;
    --error: #ff6b6b;
    --error-bg: rgba(255, 107, 107, 0.16);
    --heading: #eef2f8;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --blue: #4f9eff;
  --blue-pale: #16233a;
  --paper: #0b1220;
  --card: #131d2e;
  --ink: #eef2f8;
  --ink-soft: #9aa7bd;
  --line: #263248;
  --error: #ff6b6b;
  --error-bg: rgba(255, 107, 107, 0.16);
  --heading: #eef2f8;
  color-scheme: dark;
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  font-family: var(--font-body);
  color: var(--ink);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

img, svg, video {
  max-width: 100%;
  height: auto;
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}

.pitch-bg {
  position: fixed;
  inset: 0;
  z-index: -1;
  background: var(--blue-deep);
}

/* ---------- HERO ---------- */

.hero {
  position: relative;
  background: linear-gradient(160deg, var(--blue-deep) 0%, var(--blue) 62%, var(--blue-bright) 100%);
  padding: clamp(1.1rem, 4vw, 2rem) clamp(1rem, 4vw, 1.5rem) clamp(2.4rem, 6vw, 3.4rem);
  overflow: hidden;
}

.hero::before {
  content: "";
  position: absolute;
  top: -30%;
  right: -20%;
  width: 70%;
  aspect-ratio: 1;
  background: radial-gradient(circle, rgba(255,255,255,0.10), transparent 70%);
  pointer-events: none;
}

.hero__inner {
  position: relative;
  max-width: 640px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: clamp(0.7rem, 3.5vw, 1.25rem);
  text-align: left;
}

.hero__logo {
  display: block;
  flex: none;
  width: clamp(52px, 17vw, 92px);
  height: auto;
  border-radius: 6px;
}

.hero__text {
  min-width: 0;
  flex: 1 1 auto;
}

.hero__company {
  color: #fff;
  font-weight: 600;
  font-size: clamp(0.62rem, 2.4vw, 0.8rem);
  line-height: 1.25;
  margin: 0 0 0.3rem;
}

.hero__title {
  font-family: var(--font-display);
  font-weight: 800;
  line-height: 1.05;
  margin: 0;
  font-size: clamp(0.98rem, 5vw, 1.9rem);
  white-space: nowrap;
}

.hero__title-shop, .hero__title-get {
  display: inline;
  color: #fff;
}

.hero__title-get {
  color: var(--gold);
}

.hero__campaign {
  color: #fff;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(0.78rem, 3.2vw, 1.05rem);
  margin: 0.3rem 0 0.15rem;
}

.hero__dates {
  color: rgba(255,255,255,0.8);
  font-size: clamp(0.62rem, 2.4vw, 0.8rem);
  line-height: 1.3;
  margin: 0;
}

/* ---------- LAYOUT ---------- */

.wrap {
  max-width: 680px;
  margin: 0 auto;
  padding: 0 clamp(0.9rem, 4vw, 1.5rem) 4rem;
}

/* ---------- TIER CARDS ---------- */

.tiers {
  display: grid;
  gap: 0.6rem;
  margin-top: -2.2rem;
  position: relative;
  z-index: 2;
}

.tier-card {
  background: var(--blue-deep);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: var(--radius);
  padding: 0.75rem 0.85rem 0.85rem;
  box-shadow: 0 18px 30px -18px rgba(4,32,63,0.55);
}

.tier-card__label {
  font-family: var(--font-display);
  color: var(--gold);
  font-weight: 600;
  font-size: 0.72rem;
  margin: 0 0 0.45rem;
}

.tier-card__row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.6rem;
}

.tier-card__amount {
  font-family: var(--font-display);
  color: #fff;
  font-weight: 700;
  font-size: 0.98rem;
  margin: 0 0 0.1rem;
}

.tier-card__gift {
  color: rgba(255,255,255,0.75);
  font-size: 0.72rem;
  margin: 0;
  line-height: 1.35;
}

/* ---------- CONDITIONS (Google Forms description style) ---------- */

.conditions {
  margin-top: 1.4rem;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: clamp(1.1rem, 5vw, 1.75rem) clamp(1rem, 4.5vw, 1.5rem) clamp(1.3rem, 5vw, 2rem);
  color: var(--ink);
  font-family: var(--font-body);
}

.conditions__headline {
  font-family: var(--font-body);
  font-size: clamp(1.55rem, 6vw, 2rem);
  font-weight: 400;
  line-height: 1.3;
  color: var(--ink);
  margin: 0 0 1.25rem;
}

.conditions__title {
  font-size: 1rem;
  font-weight: 700;
  line-height: 1.5;
  color: var(--ink);
  margin: 1.5rem 0 0.55rem;
}
.conditions__headline + .conditions__title { margin-top: 0.25rem; }
.conditions__title--sub { margin-top: 1.25rem; }

.conditions__ol,
.conditions__ul {
  margin: 0;
  padding-left: clamp(1.7rem, 8vw, 2.9rem);
  font-size: 0.9rem;
  line-height: 1.65;
  color: var(--ink);
}
.conditions__ol { list-style: decimal; }
.conditions__ul { list-style: disc; }

.conditions__ol li,
.conditions__ul li {
  margin-bottom: 0.5rem;
  padding-left: 0.35rem;
}
.conditions__ol li:last-child,
.conditions__ul li:last-child { margin-bottom: 0; }

.conditions__text {
  font-size: 0.9rem;
  line-height: 1.65;
  color: var(--ink);
}
.conditions__text p {
  margin: 0 0 0.55rem;
  text-indent: 1.4rem;
}
.conditions__text p:last-child { margin-bottom: 0; }

.conditions__footnote {
  margin: 1.4rem 0 0;
  padding-top: 1rem;
  border-top: 1px solid var(--line);
  font-size: 0.78rem;
  line-height: 1.6;
  color: var(--ink-soft);
}

/* ---------- FORM ---------- */

.form { margin-top: 2.2rem; }

.form-section {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: clamp(1.1rem, 5vw, 1.5rem) clamp(1rem, 4.5vw, 1.3rem);
  margin-bottom: 1.1rem;
}

.form-section__eyebrow {
  font-size: 0.72rem;
  color: var(--blue);
  font-weight: 700;
  letter-spacing: 0.05em;
  margin: 0 0 0.25rem;
}

.form-section__title {
  font-family: var(--font-display);
  font-size: 1.15rem;
  margin: 0 0 1.3rem;
  color: var(--heading);
}

.field { margin-bottom: 1.3rem; }
.field:last-child { margin-bottom: 0; }

.field > label, .field--choice legend {
  display: block;
  font-weight: 600;
  font-size: 0.92rem;
  margin-bottom: 0.4rem;
  color: var(--ink);
}

.field--choice legend a {
  color: var(--blue);
}

/* Replaces the old ยินยอม/ไม่ยินยอม radio choice for the terms & conditions
   question — proceeding past this page is itself taken as acceptance. */
.consent-note {
  background: var(--blue-pale);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.85rem 1rem;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--ink);
  margin: 0 0 1.3rem;
}

.field__hint {
  font-size: 0.8rem;
  color: var(--ink-soft);
  margin: 0 0 0.5rem;
}

.req { color: var(--error); }

input[type="text"],
input[type="email"],
input[type="tel"],
input[type="number"],
input[type="date"],
input[type="file"],
select,
textarea {
  width: 100%;
  font-family: var(--font-body);
  font-size: 0.95rem;
  padding: 0.72rem 0.85rem;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--blue-pale);
  color: var(--ink);
}

textarea { resize: vertical; }

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(12,92,168,0.15);
}

.field--other { margin-top: 0.6rem; }
.field--other-inline { margin-top: 0.5rem; margin-left: 1.7rem; width: calc(100% - 1.7rem); }

.field--choice { border: none; padding: 0; margin: 0 0 1.3rem; }
.field--choice.field--wrap { display: block; }

.choice {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  font-weight: 500;
  font-size: 0.92rem;
  padding: 0.5rem 0;
  cursor: pointer;
}

.choice input { width: 17px; height: 17px; accent-color: var(--blue); flex-shrink: 0; }
.choice--other { flex-wrap: wrap; }

.field__error {
  color: var(--error);
  font-size: 0.8rem;
  margin: 0.4rem 0 0;
  min-height: 0;
}

/* Highlights exactly which field an error belongs to — the red text alone
   is easy to miss, especially after the page auto-scrolls to it. */
.field--invalid > label,
.field--invalid > legend {
  color: var(--error);
}
.field--invalid input:not([type="file"]):not([type="radio"]):not([type="checkbox"]),
.field--invalid select,
.field--invalid textarea {
  border-color: var(--error) !important;
  background: var(--error-bg) !important;
}

/* ---------- SUBMIT ---------- */

.form-submit { text-align: center; margin-top: 0.4rem; }

.btn-submit {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.05rem;
  color: #fff;
  background: var(--blue);
  border: none;
  border-radius: 999px;
  padding: 0.95rem 2.6rem;
  cursor: pointer;
  transition: transform 0.12s ease, background 0.12s ease;
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
}

.btn-submit:hover { background: var(--blue-deep); }
.btn-submit:active { transform: scale(0.98); }
.btn-submit:disabled { opacity: 0.65; cursor: not-allowed; transform: none; }

.btn-submit__spinner {
  width: 16px; height: 16px;
  border: 2px solid rgba(255,255,255,0.4);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

.form-submit__note {
  margin-top: 0.9rem;
  color: var(--error);
  font-size: 0.86rem;
  min-height: 0;
}

/* ---------- DONE SCREEN ---------- */

.done {
  text-align: center;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: clamp(1.8rem, 7vw, 2.6rem) clamp(1.1rem, 5vw, 1.5rem);
  margin-top: 2.2rem;
}

.done__badge {
  width: 56px; height: 56px;
  line-height: 56px;
  border-radius: 50%;
  background: var(--blue);
  color: #fff;
  font-size: 1.6rem;
  margin: 0 auto 1rem;
}

.done h2 {
  font-family: var(--font-display);
  color: var(--heading);
  margin: 0 0 0.6rem;
}

.done p {
  color: var(--ink-soft);
  line-height: 1.6;
  max-width: 440px;
  margin: 0 auto 0.6rem;
}

.done__ref {
  font-weight: 700;
  color: var(--ink);
  margin-top: 1rem !important;
}

.btn-secondary {
  margin-top: 1.4rem;
  background: none;
  border: 1px solid var(--blue);
  color: var(--blue);
  font-weight: 600;
  padding: 0.65rem 1.4rem;
  border-radius: 999px;
  cursor: pointer;
}

/* ---------- FOOTER ---------- */

.footer {
  margin-top: 2.2rem;
  text-align: center;
}

.footer__logo {
  height: 22px;
  width: auto;
  opacity: 0.75;
  margin-bottom: 0.8rem;
}

.footer p {
  font-size: 0.72rem;
  color: var(--ink-soft);
  line-height: 1.6;
}

.footer a {
  color: var(--blue);
}

.footer__credit {
  font-weight: 700;
  color: var(--ink) !important;
  margin-top: 0.9rem !important;
}

.footer__version {
  font-size: 0.68rem !important;
  color: var(--ink-soft) !important;
  margin-top: 0.3rem !important;
}

@media (max-width: 430px) {
  .tier-card__row { grid-template-columns: 1fr; gap: 0.5rem; }
}

/* ---------- BROCHURE ---------- */

.brochure {
  margin-top: -2.2rem;
  position: relative;
  z-index: 2;
}

.brochure__thumb {
  display: block;
  width: 100%;
  padding: 0;
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: var(--radius);
  overflow: hidden;
  cursor: pointer;
  background: var(--blue-deep);
  position: relative;
  box-shadow: 0 18px 34px -18px rgba(4,32,63,0.6);
}

.brochure__thumb img {
  display: block;
  width: 100%;
  height: auto;
  max-height: min(62vh, 640px);
  object-fit: cover;
  object-position: top center;
}

.brochure__badge {
  position: absolute;
  left: 50%;
  bottom: 0.9rem;
  transform: translateX(-50%);
  background: rgba(4,32,63,0.82);
  color: #fff;
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 0.8rem;
  padding: 0.45rem 1rem;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,0.25);
  white-space: nowrap;
}

/* ---------- LIGHTBOX ---------- */

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(2,14,28,0.94);
  display: flex;
}

.lightbox__scroll {
  flex: 1;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 3.4rem 0.6rem 1.4rem;
}

.lightbox__scroll img {
  width: auto;
  max-width: 100%;
  height: auto;
  border-radius: 6px;
}

.lightbox__close {
  position: fixed;
  top: 0.7rem;
  right: 0.9rem;
  z-index: 1;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid rgba(255,255,255,0.35);
  background: rgba(4,32,63,0.7);
  color: #fff;
  font-size: 1.6rem;
  line-height: 1;
  cursor: pointer;
}

/* ---------- WIZARD ---------- */

.form-submit--split {
  display: flex;
  flex-wrap: wrap;
  gap: 0.8rem;
  align-items: center;
  justify-content: space-between;
}
.form-submit--split .btn-submit { flex: 1 1 auto; justify-content: center; }
.form-submit--split .btn-secondary { margin-top: 0; flex: 0 0 auto; }

#purchaseDate { cursor: pointer; }

/* ---------- QUANTITY STEPPER ---------- */

.qty-stepper {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  max-width: 220px;
}

.qty-stepper__btn {
  flex: none;
  width: 44px;
  height: 44px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--blue-pale);
  color: var(--heading);
  font-size: 1.3rem;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
}
.qty-stepper__btn:active { transform: scale(0.96); }

.qty-stepper input[type="number"] {
  flex: 1 1 auto;
  min-width: 0;
  text-align: center;
  -moz-appearance: textfield;
}
.qty-stepper input[type="number"]::-webkit-outer-spin-button,
.qty-stepper input[type="number"]::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

/* ---------- AMOUNT (no up/down spinner) ---------- */

#amount {
  -moz-appearance: textfield;
}
#amount::-webkit-outer-spin-button,
#amount::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

/* ---------- PRODUCT ITEMS (one block per unit when qty > 1) ---------- */

.product-item {
  padding-top: 0.2rem;
}

.product-item__label {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 0.85rem;
  color: var(--blue);
  margin: 0 0 0.8rem;
}

/* Once quantity > 1, give each unit its own highlighted card (numbered
   pill + tinted background) so items 1, 2, 3... are easy to tell apart at
   a glance. A single-item purchase stays plain, with no extra chrome. */
.product-item--multi {
  background: var(--blue-pale);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.1rem 1rem 0.2rem;
  margin-bottom: 1.1rem;
}

.product-item--multi .product-item__label {
  display: inline-block;
  color: #fff;
  background: var(--blue);
  font-size: 0.76rem;
  padding: 0.3rem 0.8rem;
  border-radius: 999px;
}

.field__hint--note {
  margin: -0.4rem 0 1.3rem;
}

/* ---------- RECEIPT SLOTS (3 shown up front, at least 1 required) ---------- */

.receipt-slots { display: grid; gap: 0.8rem; }

.receipt-slot__label {
  display: block;
  font-weight: 600;
  font-size: 0.82rem;
  color: var(--ink-soft);
  margin-bottom: 0.3rem;
}

/* ---------- CONFIRM STEP ---------- */

.confirm-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: clamp(1.1rem, 5vw, 1.5rem) clamp(1rem, 4.5vw, 1.3rem);
  margin-top: 2.2rem;
}

.confirm-card__title {
  font-family: var(--font-display);
  font-size: 1.1rem;
  color: var(--heading);
  margin: 0 0 1rem;
}

.confirm-card__row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.8rem;
  padding: 0.7rem 0;
  border-bottom: 1px solid var(--line);
  font-size: 0.95rem;
}

.confirm-card__row strong {
  font-family: var(--font-display);
  font-size: 1.25rem;
  color: var(--heading);
}

.confirm-card__items {
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--line);
}
.confirm-card__items:empty { display: none; }

.confirm-card__items-label {
  font-weight: 700;
  color: var(--ink);
  margin: 0 0 0.5rem;
}

.confirm-card__items-list {
  margin: 0;
  padding-left: 1.3rem;
  color: var(--ink-soft);
  line-height: 1.6;
  font-size: 0.9rem;
}

.confirm-card__gift { margin-top: 1rem; }

.confirm-card__gift-label {
  font-weight: 700;
  color: var(--ink);
  margin: 0 0 0.5rem;
}

.confirm-card__gift-list {
  margin: 0;
  padding-left: 1.3rem;
  color: var(--ink-soft);
  line-height: 1.6;
}

.confirm-card__gift-empty {
  color: var(--ink-soft);
  font-size: 0.9rem;
  line-height: 1.5;
  margin: 0;
}

.confirm-card__note {
  margin: 1.1rem 0 0;
  font-size: 0.8rem;
  color: var(--ink-soft);
  line-height: 1.5;
}

.confirm-choice {
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px dashed var(--line);
}

.confirm-choice__label {
  font-weight: 600;
  font-size: 0.92rem;
  color: var(--ink);
  margin: 0 0 0.3rem;
}

@media (max-width: 400px) {
  .form-submit--split { flex-direction: column-reverse; }
  .form-submit--split .btn-secondary,
  .form-submit--split .btn-submit { width: 100%; }
  .btn-submit { padding-left: 1.4rem; padding-right: 1.4rem; }
}

/* ---------- UPDATE BANNER ---------- */
/* Shown when this tab has been open across a new deploy — a fresh page
   load already always gets the latest version (see public/_headers), this
   just catches an already-open tab and offers a one-click refresh. */

.update-banner {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 500;
  background: var(--blue-deep);
  color: #fff;
  padding: 0.9rem 1rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.8rem;
  font-size: 0.85rem;
  text-align: center;
  box-shadow: 0 -10px 24px -12px rgba(4, 32, 63, 0.5);
}

.update-banner button {
  background: #fff;
  color: var(--blue-deep);
  border: none;
  border-radius: 999px;
  padding: 0.45rem 1.1rem;
  font-weight: 700;
  font-size: 0.82rem;
  cursor: pointer;
  flex: none;
}

/* ---------- THEME TOGGLE ---------- */

.theme-toggle {
  position: fixed;
  top: 0.9rem;
  right: 0.9rem;
  z-index: 600;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--ink);
  font-size: 1.15rem;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 8px 20px -10px rgba(4, 32, 63, 0.45);
}
.theme-toggle:active { transform: scale(0.94); }
