/*
 * SIKI Therapy Bookings – front end.
 * The SIKI theme already styles .booking__form, .form-grid, .field, .checks and .btn.
 * The :where() rules below are low-priority fallbacks for any other theme.
 */

/* ---- Fallback layout (other themes) ---- */
:where(.stb-form, .stb-done) { max-width: 880px; margin: 0 auto; padding: clamp(20px, 3vw, 36px); border-radius: 24px; background: #fff; box-shadow: 0 12px 32px -12px rgba(27, 23, 24, .15); text-align: left; }
:where(.stb-form) .form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px 20px; }
:where(.stb-form) .field { margin: 0; }
:where(.stb-form) .field--full { grid-column: 1 / -1; }
:where(.stb-form) .field label, :where(.stb-form) legend { display: block; margin-bottom: 6px; font-size: 13px; font-weight: 600; }
:where(.stb-form) input:not([type="checkbox"]):not([type="radio"]), :where(.stb-form) select, :where(.stb-form) textarea { width: 100%; padding: 12px 14px; border: 1px solid #e6dfe0; border-radius: 12px; background: #fff; font: inherit; font-size: 14px; box-sizing: border-box; }
:where(.stb-form) .checks label { display: flex; gap: 10px; align-items: flex-start; margin: 8px 0; font-size: 13.5px; }
:where(.stb-form) .booking__foot { display: flex; flex-wrap: wrap; gap: 18px; align-items: flex-end; justify-content: space-between; margin-top: 22px; }
:where(.stb-form) .btn { display: inline-flex; gap: 12px; align-items: center; padding: 12px 24px; border: 0; border-radius: 999px; background: #D62839; color: #fff; font-weight: 600; cursor: pointer; }

/* ---- Shared ---- */
.stb-form [hidden], .stb-done [hidden] { display: none !important; }
.stb-form fieldset { margin: 0; padding: 0; border: 0; min-width: 0; }
.stb-form input[aria-invalid="true"], .stb-form select[aria-invalid="true"] { border-color: var(--red, #D62839); }
.stb-step { display: flex; align-items: center; gap: 10px; margin: 28px 0 14px; padding: 0; font-weight: 600; color: var(--ink, #1B1718); font-size: 15px; }
.stb-form > .stb-step:first-of-type, .stb-form .stb-notice + input + .stb-step { margin-top: 4px; }
.stb-step span { display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; background: var(--ink, #1B1718); color: #fff; font-size: 13px; }
.stb-hint { display: block; margin-top: 6px; font-size: 12px; color: var(--muted, #7a7173); }
.stb-error { display: block; margin-top: 6px; font-size: 12.5px; color: var(--red-700, #ab2030); font-weight: 500; }
.stb-muted { font-size: 13px; color: var(--muted, #7a7173); }
.stb-crisis { margin: 18px 0 0; padding-top: 14px; border-top: 1px solid var(--line, #eee7e8); }
.stb-hp { position: absolute !important; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

.stb-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.stb-chip { position: relative; margin: 0 !important; cursor: pointer; }
.stb-chip input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.stb-form .field .stb-chip span, .stb-chip span { display: inline-block; padding: 9px 18px; border: 1px solid var(--line, #e6dfe0); border-radius: 999px; background: #fff; font-size: 13.5px; font-weight: 500; color: var(--ink, #1B1718); transition: background .2s, border-color .2s, color .2s; }
.stb-form .field .stb-chip:hover span, .stb-chip:hover span { border-color: var(--red-200, #f6c8cd); }
.stb-form .field .stb-chip input:checked + span, .stb-chip input:checked + span { background: var(--ink, #1B1718); border-color: var(--ink, #1B1718); color: #fff; }
.stb-chip input:focus-visible + span { outline: 2px solid var(--red, #D62839); outline-offset: 2px; }
.stb-choice legend { margin-bottom: 10px !important; font-size: 13px; font-weight: 600; color: var(--ink, #1B1718); }

.stb-notice { padding: 16px 18px; border-radius: 14px; background: var(--red-50, #fdf3f4); color: var(--ink, #1B1718); }
.stb-notice p { margin: 0 0 8px; }
.stb-notice p:last-child { margin-bottom: 0; }
.stb-notice--err { color: var(--red-700, #ab2030); }
.stb-notice--ok { background: #e9f6ee; color: #1d6a39; }
.stb-notice--info { max-width: 640px; margin: 0 auto; text-align: center; }

.stb-done { text-align: center; }
.stb-done__icon { display: inline-grid; place-items: center; width: 56px; height: 56px; border-radius: 50%; background: #e9f6ee; color: #1d6a39; font-size: 26px; font-weight: 700; }
.stb-done__title { margin: 16px 0 8px; font-size: clamp(22px, 2.4vw, 28px); }
.stb-done__ref { font-size: 15px; }
.stb-done p { margin: 0 auto 10px; max-width: 52ch; }

/* ---- Consent ---- */
.stb-consent__head p { margin: 0 0 10px; }
.stb-consent__body { max-height: 420px; overflow-y: auto; margin: 18px 0 8px; padding: 18px 22px; border: 1px solid var(--line, #eee7e8); border-radius: 16px; background: var(--soft, #f7f4f4); font-size: 14px; line-height: 1.7; }
.stb-consent__body h3 { margin: 18px 0 6px; font-size: 16px; font-family: inherit; font-weight: 600; letter-spacing: 0; }
.stb-consent__body h3:first-child { margin-top: 0; }
.stb-consent__body p { margin: 0 0 10px; }
.stb-guardian { margin-top: 8px !important; padding: 4px 18px 16px !important; border-radius: 16px !important; background: var(--red-50, #fdf3f4); }
.stb-guardian legend { float: left; width: 100%; }
.stb-guardian legend + * { clear: both; }
.stb-items label { padding: 10px 14px; border-radius: 12px; background: var(--soft, #f7f4f4); }
.stb-signature { font-family: "Segoe Script", "Brush Script MT", "Snell Roundhand", cursive; font-size: 20px !important; }
.stb-sign { margin-top: 18px; }

@media (max-width: 640px) {
	:where(.stb-form) .form-grid { grid-template-columns: 1fr; }
	.stb-consent__body { max-height: 360px; padding: 14px 16px; }
}

/* Inline validation */
.stb-form :is(input, select, textarea) { scroll-margin: 140px 0; }
.stb-form [aria-invalid="true"]:not([type="checkbox"]):not([type="radio"]) { border-color: var(--red, #D62839) !important; box-shadow: 0 0 0 3px var(--red-100, #fbe7e9); }
.stb-form input[type="checkbox"][aria-invalid="true"] { outline: 2px solid var(--red, #D62839); outline-offset: 2px; }
.stb-summary { flex-basis: 100%; margin: 0 0 4px; font-size: 13.5px; }
.stb-choice > .stb-error { margin-top: 8px; }
