/* ── Ambassador Program Application — scout handbook ────────────────
   Khaki canvas weave, vintage slab with stitched underline,
   embroidered merit-badge patches (bronze/silver/gold), field-guide
   checklist, lined handbook page with ribbon bookmark, TROOP
   APPROVED stamp. */

:root {
  --khaki: #ded3b6;
  --khaki-deep: #cfc19e;
  --forest: #33553a;
  --forest-deep: #26402c;
  --campfire: #d96f2e;
  --bronze: #a8703c;
  --silver: #9aa1a8;
  --gold: #c99b2e;
  --ink: #35301f;
  --ink-soft: #7d7458;
  --page: #fbf7ea;
  --err: #b8432c;
  --slab: 'Bitter', serif;
  --sans: 'Karla', sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

.hidden { display: none !important; }

body {
  font-family: var(--sans);
  color: var(--ink);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  background:
    repeating-linear-gradient(0deg, rgba(53, 48, 31, 0.045) 0 1px, transparent 1px 4px),
    repeating-linear-gradient(90deg, rgba(53, 48, 31, 0.045) 0 1px, transparent 1px 4px),
    linear-gradient(180deg, var(--khaki), var(--khaki-deep));
  background-attachment: fixed;
  min-height: 100vh;
}

.handbook { min-height: 100vh; display: flex; flex-direction: column; }

.wrap { width: 100%; max-width: 620px; margin: 0 auto; padding: 0 24px; }

main { flex: 1 0 auto; padding-bottom: 60px; }

/* ── Hero ─────────────────────────────────────────────────────────── */
.hero { text-align: center; padding: 52px 24px 12px; }

.kicker {
  font-weight: 800;
  font-size: 0.7rem;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--campfire);
  margin-bottom: 12px;
}

.hero h1 {
  font-family: var(--slab);
  font-weight: 900;
  font-size: clamp(2.2rem, 8vw, 3.4rem);
  line-height: 1.1;
  color: var(--forest-deep);
}

.stitched {
  position: relative;
  display: inline-block;
}

.stitched::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0.02em;
  height: 5px;
  background: repeating-linear-gradient(90deg, var(--campfire) 0 10px, transparent 10px 16px);
  border-radius: 3px;
}

.sub { color: var(--ink-soft); font-weight: 600; max-width: 460px; margin: 16px auto 0; }
.sub strong { color: var(--forest-deep); }

/* ── Section titles ───────────────────────────────────────────────── */
.section-title {
  font-family: var(--slab);
  font-weight: 800;
  font-size: 1.25rem;
  color: var(--forest-deep);
  text-align: center;
  margin-bottom: 22px;
}

/* ── Tier badges ──────────────────────────────────────────────────── */
.tiers { padding-top: 34px; }

.badge-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
}

.badge-card {
  background: var(--page);
  border: 2px solid #e4dcc4;
  border-radius: 14px;
  padding: 20px 14px 18px;
  text-align: center;
  box-shadow: 0 6px 16px rgba(53, 48, 31, 0.1);
}

.patch {
  position: relative;
  width: 74px;
  height: 74px;
  margin: 0 auto 12px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 10px rgba(53, 48, 31, 0.25);
}

/* stitched border ring */
.patch::before {
  content: '';
  position: absolute;
  inset: 5px;
  border-radius: 50%;
  border: 2px dashed rgba(251, 247, 234, 0.85);
}

.patch-icon { font-size: 1.7rem; color: var(--page); }

.patch-bronze { background: radial-gradient(circle at 35% 30%, #c68d54, var(--bronze)); }
.patch-silver { background: radial-gradient(circle at 35% 30%, #bcc3ca, var(--silver)); }
.patch-gold { background: radial-gradient(circle at 35% 30%, #e3ba55, var(--gold)); }

.badge-card h3 {
  font-family: var(--slab);
  font-weight: 800;
  font-size: 1rem;
  color: var(--ink);
}

.badge-req {
  font-weight: 800;
  font-size: 0.66rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--campfire);
  margin-top: 2px;
}

.badge-perk { font-size: 0.78rem; color: var(--ink-soft); font-weight: 600; margin-top: 8px; line-height: 1.45; }

/* ── Field guide ──────────────────────────────────────────────────── */
.guide { padding-top: 38px; }

.field-guide {
  list-style: none;
  max-width: 420px;
  margin: 0 auto;
  background: var(--page);
  border: 2px solid #e4dcc4;
  border-radius: 14px;
  padding: 10px 22px;
}

.field-guide li {
  display: flex;
  align-items: center;
  gap: 14px;
  font-weight: 700;
  font-size: 0.95rem;
  padding: 13px 0;
  border-bottom: 1.5px dashed #e0d7bd;
}

.field-guide li:last-child { border-bottom: none; }

.pts {
  flex: 0 0 auto;
  font-family: var(--slab);
  font-weight: 800;
  font-size: 0.85rem;
  color: var(--page);
  background: var(--forest);
  border-radius: 8px;
  padding: 4px 10px;
}

/* ── Handbook page ────────────────────────────────────────────────── */
#apply-section { padding-top: 40px; }

.page {
  position: relative;
  background:
    repeating-linear-gradient(0deg, transparent 0 30px, rgba(51, 85, 58, 0.12) 30px 31px),
    var(--page);
  border: 2px solid #e4dcc4;
  border-radius: 8px;
  padding: 34px 30px 30px;
  box-shadow: 0 12px 26px rgba(53, 48, 31, 0.14);
}

.ribbon {
  position: absolute;
  top: -10px;
  right: 34px;
  width: 26px;
  height: 58px;
  background: #b8432c;
  clip-path: polygon(0 0, 100% 0, 100% 100%, 50% 82%, 0 100%);
  box-shadow: 0 4px 8px rgba(53, 48, 31, 0.25);
}

.page-title {
  font-family: var(--slab);
  font-weight: 800;
  font-size: 1.3rem;
  color: var(--forest-deep);
  margin-bottom: 20px;
}

/* ── Form ─────────────────────────────────────────────────────────── */
.field-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }

.field { margin-bottom: 16px; }

label {
  display: block;
  font-weight: 800;
  font-size: 0.68rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--forest);
  margin-bottom: 6px;
}

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

input, select, textarea {
  width: 100%;
  padding: 12px 14px;
  font-family: var(--sans);
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--ink);
  background: #fff;
  border: 2px solid #e0d7bd;
  border-radius: 8px;
  transition: border-color 0.15s ease;
}

textarea { resize: vertical; }

input:focus, select:focus, textarea:focus { outline: none; border-color: var(--forest); }
input.error, textarea.error { border-color: var(--err); }
input::placeholder, textarea::placeholder { color: #bfb598; }

/* ── Button ───────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: var(--sans);
  font-weight: 800;
  font-size: 0.9rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--page);
  background: linear-gradient(180deg, #40684a, var(--forest-deep));
  border: none;
  border-radius: 10px;
  padding: 16px 30px;
  cursor: pointer;
  transition: transform 0.12s ease;
  box-shadow: 0 5px 0 #1b2f20;
  margin-top: 6px;
}

.btn:hover:not(:disabled) { transform: translateY(-2px); }
.btn:disabled { opacity: 0.6; cursor: not-allowed; }
.btn:focus-visible { outline: 3px solid var(--campfire); outline-offset: 3px; }

.btn-block { width: 100%; }

.form-error { color: var(--err); font-weight: 700; text-align: center; margin-top: 12px; }

.spinner {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2.5px solid rgba(251, 247, 234, 0.4);
  border-top-color: var(--page);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

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

/* ── Confirmation ─────────────────────────────────────────────────── */
#confirmation { padding-top: 40px; }

.conf-page { text-align: center; padding: 48px 30px 42px; }

.seal {
  position: absolute;
  top: 18px;
  right: 22px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 84px;
  height: 84px;
  border-radius: 50%;
  border: 3px double var(--campfire);
  color: var(--campfire);
  font-weight: 800;
  font-size: 0.6rem;
  letter-spacing: 0.14em;
  line-height: 1.4;
  text-align: center;
  transform: rotate(10deg);
  opacity: 0.9;
}

.conf-page h2 {
  font-family: var(--slab);
  font-weight: 900;
  font-size: 1.7rem;
  color: var(--forest-deep);
}

.conf-page p { color: var(--ink-soft); font-weight: 600; max-width: 400px; margin: 12px auto 0; }

/* ── Footer ───────────────────────────────────────────────────────── */
.foot {
  text-align: center;
  padding: 30px 20px;
  color: var(--ink-soft);
  font-size: 0.8rem;
  font-weight: 600;
}

#wbx-powered-by-slot { margin-top: 12px; }

/* ── Responsive ───────────────────────────────────────────────────── */
@media (max-width: 560px) {
  .badge-row { grid-template-columns: 1fr; max-width: 260px; margin: 0 auto; }
  .field-grid { grid-template-columns: 1fr; }
}
