/* ==========================================================================
   Val d'Orcia Gravel — modulo di iscrizione e pagamento
   ========================================================================== */

:root {
  --paper: #f3ecdf;
  --surface: #fbf8f2;
  --ink: #221e18;
  --ink-soft: #5e564a;
  --line: #d5c8b0;
  --clay: #a9501f;
  --clay-dark: #8a3f16;
  --clay-soft: #f4e3d6;
  --danger: #9e2a1d;
  --font: 'Archivo', system-ui, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }

body {
  margin: 0;
  padding: 48px 16px 80px;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.55;
}

h1, h3, .participant-title {
  margin: 0;
  font-stretch: 72%;
  font-weight: 800;
  line-height: 1;
  text-transform: uppercase;
}
h1 { font-size: clamp(38px, 6vw, 60px); }
h3, .participant-title { display: flex; justify-content: space-between; align-items: center; gap: 12px; font-size: 26px; }
p { margin: 0; }

a { color: var(--clay); }

/* --- Utilità condivise con i template ----------------------------------- */

.center-text { text-align: center; }
.center-items { display: flex; flex-direction: column; align-items: center; }
.hidden { display: none !important; }
.fullwidth { width: 100%; }
.top-margin-mid { margin-top: 1rem; }
.top-margin-large { margin-top: 1.5rem; }
.top-margin-xl { margin-top: 2.5rem; }
.stack-mid > * + * { margin-top: 1rem; }
.stack-large > * + * { margin-top: 1.5rem; }
.grid-2, .grid-3 { display: grid; gap: 18px; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }

.hyperlink { color: var(--clay); font-weight: 600; text-underline-offset: 4px; }

/* --- Struttura ----------------------------------------------------------- */

.checkout-body { display: block; }
.checkout-wrapper { width: 100%; max-width: 860px; margin: 0 auto; }
.checkout-narrow { max-width: 520px; }

.checkout-logo img { width: auto; height: 88px; }
.checkout-intro { color: var(--ink-soft); font-size: 18px; }
.checkout-kicker {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--clay);
}

/* --- Form ---------------------------------------------------------------- */

label { display: block; }

.label-box label {
  margin-bottom: 6px;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

/* Aspetto di input, select e checkbox: vedi controls.css */
input + input, select + input { margin-top: 8px; }
.label-box input[type="checkbox"] { margin-top: 0; }

form > label, .stack-mid > label, .ticket-block > div > label {
  font-size: 15px;
  color: var(--ink-soft);
}
.ticket-block > div:last-child label { display: inline-block; margin-right: 24px; color: var(--ink); font-weight: 600; }

.box-associazione, .ticket-block {
  padding: 24px;
  background: var(--surface);
  border: 1px solid var(--line);
}
.box-associazione > label { font-weight: 600; color: var(--ink); }
.ticket-block { border-top: 4px solid var(--clay); }

.form-alert {
  margin-bottom: 24px;
  padding: 16px 20px;
  background: #fbe9e5;
  border-left: 4px solid var(--danger);
  color: var(--danger);
}
.form-alert ul { margin: 8px 0 0; padding-left: 20px; }

/* --- Bottoni ------------------------------------------------------------- */

.btn, .grey-btn, .remove-btn {
  font-family: var(--font);
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  cursor: pointer;
  transition: background-color .2s ease, border-color .2s ease, color .2s ease, transform .16s cubic-bezier(0.23, 1, 0.32, 1);
}
.btn:active, .grey-btn:active, .remove-btn:active { transform: scale(.97); }

.btn {
  display: inline-block;
  padding: 18px 28px;
  border: 0;
  background: var(--clay);
  color: #fff;
  font-size: 16px;
  font-stretch: 85%;
  text-align: center;
  text-decoration: none;
}
.btn:hover { background: var(--clay-dark); }
.btn:disabled { opacity: .6; cursor: wait; }

.grey-btn {
  width: 100%;
  padding: 16px;
  border: 2px dashed var(--line);
  background: transparent;
  color: var(--ink);
  font-size: 14px;
}
.grey-btn:hover { border-color: var(--ink); }

.remove-btn {
  padding: 6px 12px;
  border: 1px solid var(--danger);
  background: transparent;
  color: var(--danger);
  font-size: 12px;
}
.remove-btn:hover { background: var(--danger); color: #fff; }

a:focus-visible, button:focus-visible { outline: 3px solid var(--clay); outline-offset: 3px; }

/* --- Riepilogo e pagamento ---------------------------------------------- */

.checkout-summary { padding: 20px 24px; background: var(--surface); border: 1px solid var(--line); }
.checkout-summary-row { display: flex; justify-content: space-between; gap: 16px; }
.checkout-summary-row span { color: var(--ink-soft); }
.checkout-summary-total { padding-top: 14px; border-top: 1px solid var(--line); font-size: 20px; }
.checkout-summary-total span { color: var(--ink); font-weight: 600; }

.stripe-payment-box { padding: 20px; background: #fff; border: 1px solid var(--line); }
.payment-message { padding: 12px 16px; background: #fbe9e5; border-left: 4px solid var(--danger); color: var(--danger); }

@media (max-width: 680px) {
  body { padding-top: 32px; }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .box-associazione, .ticket-block { padding: 18px; }
}

/* Checkbox con testo lungo: la casella resta a sinistra e il testo va a capo accanto */
label:has(> input[type="checkbox"]) { display: flex; align-items: flex-start; }
label:has(> input[type="checkbox"]) > input[type="checkbox"] { margin-top: 1px; }
.ticket-block > div:last-child label:has(> input[type="checkbox"]) { display: inline-flex; }

/* --- Quote del periodo e sezioni del partecipante ------------------------ */

.price-box { display: grid; gap: 12px; }
.price-list { margin: 0; padding: 0; list-style: none; }
.price-list li { display: flex; justify-content: space-between; gap: 16px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.price-list li:last-child { border-bottom: 0; }
.price-list small { margin-left: 6px; color: var(--ink-soft); }
.price-list strong { font-variant-numeric: tabular-nums; }
.small-note { font-size: 14px; color: var(--ink-soft); }
.label-box .small-note { margin-top: 6px; }

.block-title {
  margin: 28px 0 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--line);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--clay);
}
.ticket-block .participant-title + .block-title { margin-top: 18px; }
.field-error { margin-top: 6px; font-size: 14px; font-weight: 600; color: var(--danger); }

/* Campo con errore dopo l'invio */
.label-box:has(> .field-error:not([hidden])) :is(input, select) { border-color: var(--danger); }

/* Tabella di tutti gli scaglioni */
.tier-list li { align-items: baseline; }
.tier-list strong { text-align: right; }
.tier-details summary { cursor: pointer; font-weight: 700; }
.tier-details .tier-list { margin-top: 8px; }
@media (max-width: 560px) {
  .tier-list li { flex-direction: column; gap: 2px; }
  .tier-list strong { text-align: left; }
}

/* Iscrizioni chiuse: data di apertura, percorso scelto e promemoria */
.closed-title { margin: 0; font-size: clamp(24px, 3.4vw, 30px); font-stretch: 80%; font-weight: 800; line-height: 1.15; text-wrap: balance; }
.closed-route { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 4px 16px; padding: 14px 16px; background: var(--paper); border: 1px solid var(--line); font-weight: 700; }
.closed-route strong { color: var(--clay); }
.closed-actions { display: flex; flex-wrap: wrap; gap: 12px; padding-top: 8px; }
.closed-back { font-size: 15px; }
.closed-back a { display: inline-flex; align-items: center; min-height: 44px; }
.btn-ghost { background: transparent; color: var(--ink); box-shadow: inset 0 0 0 2px var(--ink); }
.btn-ghost:hover { background: var(--ink); color: var(--paper); }
@media (max-width: 560px) {
  .closed-actions .btn { width: 100%; }
}
