/* Public link experience: focused, private-feeling, and distraction-free. */

body.public { min-height: 100dvh; background: var(--bg-tint); }
.public::before { content: ""; position: fixed; inset: 0 0 auto; z-index: -1; height: 360px; background: #e9efff; clip-path: polygon(0 0, 100% 0, 100% 56%, 0 100%); opacity: .58; }

.preview-banner { padding: 9px var(--sp-4); background: #fffaeb; color: var(--warn); font-size: var(--step--1); font-weight: 620; text-align: center; }
.progress { position: fixed; inset: 0 0 auto; z-index: 40; height: 4px; background: transparent; }
.preview-banner + .progress { top: 39px; }
.progress-bar { width: 0; height: 100%; border-radius: 0 var(--r-pill) var(--r-pill) 0; background: var(--accent); transition: width .35s var(--ease); }

.public-topbar { display: flex; max-width: 1120px; align-items: center; justify-content: space-between; gap: var(--sp-4); margin-inline: auto; padding: 24px 28px; }
.public-brand { display: inline-flex; align-items: center; color: var(--text); }
.public-brand:hover { text-decoration: none; }
.public-brand__mark { display: block; width: 154px; height: 64px; flex: none; overflow: hidden; border-radius: 5px; transition: transform .16s ease, box-shadow .16s ease; }
.public-brand:hover .public-brand__mark { transform: translateY(-1px) scale(1.025); box-shadow: 0 12px 28px rgb(5 6 7 / 12%); }
.public-brand__mark img { display: block; width: 100%; height: 100%; object-fit: contain; }
.public-status { display: inline-flex; align-items: center; gap: 7px; padding: 7px 10px; border: 1px solid rgb(255 255 255 / 70%); border-radius: var(--r-pill); background: rgb(255 255 255 / 65%); color: var(--muted); font-size: .72rem; font-weight: 600; backdrop-filter: blur(12px); }
.public-status svg { width: 13px; height: 13px; fill: none; stroke: var(--ok); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

.form-shell { display: grid; grid-template-columns: minmax(250px, 340px) minmax(0, 680px); gap: clamp(32px, 7vw, 88px); max-width: 1120px; align-items: start; margin-inline: auto; padding: 54px 28px 72px; }
.form-context { position: sticky; top: 40px; display: grid; gap: var(--sp-5); padding-top: 22px; }
.form-context h1 { font-size: var(--step-4); }
.form-context .lede { font-size: var(--step-0); line-height: 1.65; white-space: pre-line; }
.form-context .lede a { color: var(--accent); text-decoration: underline; text-underline-offset: .18em; overflow-wrap: anywhere; }
.form-meta { display: grid; gap: 10px; padding-top: var(--sp-5); border-top: 1px solid color-mix(in srgb, var(--border-strong) 70%, transparent); }
.form-meta__item { display: flex; align-items: center; gap: 9px; color: var(--muted); font-size: .78rem; }
.form-meta__item svg { width: 16px; height: 16px; fill: none; stroke: var(--accent); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

.sender { display: flex; align-items: center; gap: var(--sp-3); }
.sender__badge { display: grid; width: 42px; height: 42px; flex: none; place-items: center; border: 1px solid color-mix(in srgb, var(--accent) 20%, transparent); border-radius: 50%; background: var(--brand-soft); color: var(--accent); font-weight: 720; }
.sender__name { font-size: var(--step--1); font-weight: 650; }
.sender__role { color: var(--muted); font-size: .72rem; }

.form-panel { overflow: hidden; border: 1px solid var(--border); border-radius: var(--r-xl); background: var(--surface); box-shadow: var(--shadow-lg); }
.form-panel__head { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3); padding: 17px 24px; border-bottom: 1px solid var(--border); background: var(--surface-2); }
.form-panel__head span { color: var(--muted); font-size: .72rem; font-weight: 620; }
.form-panel__head strong { color: var(--text-2); }
#form { padding: clamp(24px, 5vw, 42px); }
.form-intro { display: none; }

/* Steps */
.step { display: grid; gap: var(--sp-6); padding: 0; margin: 0; border: 0; }
.step + .step { margin-top: var(--sp-7); padding-top: var(--sp-7); border-top: 1px solid var(--border); }
.step.enter { animation: rise .3s var(--ease); }
@keyframes rise { from { opacity: 0; transform: translateY(9px); } to { opacity: 1; transform: none; } }
.section-legend { display: grid; gap: 6px; padding: 0 0 var(--sp-2); }
.section-legend h2 { font-size: var(--step-2); }
.section-legend p { color: var(--muted); font-size: var(--step--1); }

/* Fields */
.field { display: grid; gap: 9px; }
.field-label { color: var(--text); font-size: var(--step-0); font-weight: 640; line-height: 1.4; }
.field-label > .req { display: inline; margin-left: 3px; color: var(--danger); }
.field-help { margin-top: -4px; color: var(--muted); font-size: var(--step--1); }
.field input:not([type="radio"]):not([type="checkbox"]), .field select, .field textarea { min-height: 48px; border-radius: 10px; background: #fff; }
.field.has-error input, .field.has-error select, .field.has-error textarea { border-color: var(--danger); }
.field-error { margin: 0; color: var(--danger); font-size: var(--step--1); }

.choices { display: grid; gap: 9px; }
.choice { display: flex; align-items: center; gap: 11px; min-height: 48px; padding: 12px 14px; border: 1px solid var(--border-strong); border-radius: 10px; background: var(--surface); cursor: pointer; transition: border-color .16s var(--ease), background .16s var(--ease), box-shadow .16s var(--ease); }
.choice:hover { border-color: color-mix(in srgb, var(--accent) 50%, var(--border-strong)); }
.choice input { width: auto; margin: 0; accent-color: var(--accent); }
.choice:has(input:checked) { border-color: var(--accent); background: var(--brand-soft); box-shadow: 0 0 0 1px var(--accent); }
.scale { display: flex; flex-wrap: wrap; gap: var(--sp-2); }
.scale-item input, .star input { position: absolute; opacity: 0; pointer-events: none; }
.scale-item span { display: grid; width: 46px; height: 46px; place-items: center; border: 1px solid var(--border-strong); border-radius: 10px; background: var(--surface); font-weight: 620; cursor: pointer; transition: all .16s var(--ease); }
.scale-item:hover span { border-color: var(--accent); }
.scale-item:has(input:checked) span { border-color: var(--accent); background: var(--accent); color: #fff; }
.rating { display: flex; gap: 4px; }
.star span { color: var(--surface-3); font-size: 2rem; line-height: 1; cursor: pointer; transition: color .13s var(--ease), transform .13s var(--ease); }
.star.on span, .star:has(input:checked) span { color: var(--highlight); }
.star:hover span { transform: scale(1.1); }

.form-nav { display: flex; align-items: center; gap: var(--sp-3); margin-top: var(--sp-7); padding-top: var(--sp-5); border-top: 1px solid var(--border); }
.form-nav--booking { display: none; }
.form-nav .btn { min-width: 116px; }
.form-nav .hint { margin-left: auto; color: var(--muted); font-size: var(--step--1); }
.form-nav kbd { padding: 3px 6px; border: 1px solid var(--border); border-bottom-width: 2px; border-radius: 5px; background: var(--surface-2); }

.done { display: grid; min-height: 520px; justify-items: center; align-content: center; gap: var(--sp-4); padding: var(--sp-7); text-align: center; animation: rise .35s var(--ease); }
.done .media { width: 170px; aspect-ratio: 1; border-radius: 24px; }
.done h2 { max-width: 18ch; font-size: var(--step-2); }
.done p { max-width: 42ch; color: var(--muted); font-size: var(--step--1); }
.booking-block { display: grid; gap: var(--sp-4); margin-top: var(--sp-7); padding-top: var(--sp-7); border-top: 1px solid var(--border); }
.booking-block__head { display: grid; gap: 7px; text-align: left; }
.booking-block__head h2 { font-size: var(--step-2); }
.booking-block__head > p:last-child, .booking-status { color: var(--muted); font-size: var(--step--1); }
.calendly-inline-widget { width: 100%; overflow: hidden; border: 1px solid var(--border); border-radius: var(--r-lg); background: var(--surface-2); }
.google-calendar-embed { width: 100%; min-height: 720px; border: 1px solid var(--border); border-radius: var(--r-lg); background: var(--surface-2); }
.booking-link { justify-self: start; }
.booking-block[data-provider="google_api"] { gap: 20px; margin: 0; padding: clamp(28px, 5vw, 42px); border-top: 0; }
.booking-block[data-provider="google_api"] .booking-block__head { gap: 9px; }
.booking-block[data-provider="google_api"] .booking-block__head h2 { font-size: clamp(1.65rem, 3vw, 2.1rem); letter-spacing: -.035em; }
.booking-block[data-provider="google_api"] .booking-block__head > p:last-of-type { max-width: 62ch; line-height: 1.6; }
.booking-facts { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 5px; }
.booking-facts span { display: inline-flex; align-items: center; gap: 6px; padding: 7px 10px; border: 1px solid var(--border); border-radius: var(--r-pill); background: var(--surface-2); color: var(--text-2); font-size: .75rem; font-weight: 650; }
.booking-facts svg { width: 14px; height: 14px; fill: none; stroke: var(--accent); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

.native-booking { min-width: 0; container: native-booking / inline-size; }
.native-booking__picker { display: grid; grid-template-columns: minmax(0, 1fr) 238px; min-height: 420px; overflow: hidden; border: 1px solid var(--border-strong); border-radius: 18px; background: var(--surface); box-shadow: 0 14px 34px rgb(14 22 42 / 8%); }
.booking-calendar { min-width: 0; padding: 26px 28px 30px; }
.booking-calendar__head { display: grid; grid-template-columns: 44px 1fr 44px; align-items: center; gap: 10px; margin-bottom: 23px; }
.booking-calendar__head h3 { margin: 0; font-size: var(--step-0); font-weight: 700; text-align: center; }
.booking-calendar__nav { display: grid; width: 44px; height: 44px; place-items: center; border: 0; border-radius: 50%; background: transparent; color: var(--text); cursor: pointer; transition: background .15s var(--ease), color .15s var(--ease); }
.booking-calendar__nav:hover:not(:disabled) { background: var(--brand-soft); color: var(--accent); }
.booking-calendar__nav:disabled { color: var(--faint); cursor: default; opacity: .45; }
.booking-calendar__nav svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.booking-calendar__weekdays, .booking-calendar__grid { display: grid; grid-template-columns: repeat(7, minmax(38px, 1fr)); gap: 5px; }
.booking-calendar__weekdays { margin-bottom: 8px; }
.booking-calendar__weekdays span { color: var(--faint); font-size: .68rem; font-weight: 700; text-align: center; text-transform: uppercase; }
.booking-calendar__day, .booking-calendar__spacer { display: grid; min-width: 0; min-height: 44px; place-items: center; border-radius: 50%; }
.booking-calendar__day { border: 0; background: transparent; color: var(--text-2); font: inherit; font-size: .82rem; font-weight: 640; }
.booking-calendar__day.is-unavailable { color: color-mix(in srgb, var(--faint) 55%, transparent); }
.booking-calendar__day.is-available { color: var(--accent); cursor: pointer; }
.booking-calendar__day.is-available:hover { background: var(--brand-soft); }
.booking-calendar__day.is-today { box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 45%, var(--border)); }
.booking-calendar__day.is-selected { background: var(--accent); color: #fff; box-shadow: 0 8px 18px color-mix(in srgb, var(--accent) 26%, transparent); }

.booking-times { min-width: 0; padding: 25px 18px; border-left: 1px solid var(--border); background: color-mix(in srgb, var(--surface-2) 64%, #fff); }
.booking-times > p { margin: 0 0 4px; color: var(--faint); font-size: .68rem; font-weight: 720; letter-spacing: .08em; text-transform: uppercase; }
.booking-times h3 { margin: 0 0 18px; font-size: .98rem; line-height: 1.35; }
.booking-times__list { display: grid; max-height: 330px; gap: 9px; overflow-y: auto; padding: 2px 4px 2px 2px; scrollbar-width: thin; }
.native-booking__time { display: flex; min-height: 50px; align-items: center; justify-content: space-between; gap: 10px; padding: 11px 13px; border: 1px solid color-mix(in srgb, var(--accent) 45%, var(--border-strong)); border-radius: 10px; background: var(--surface); color: var(--accent); font: inherit; cursor: pointer; transition: transform .14s var(--ease), border-color .14s var(--ease), background .14s var(--ease), color .14s var(--ease), box-shadow .14s var(--ease); }
.native-booking__time strong { font-size: .86rem; font-weight: 700; }
.native-booking__time span { color: var(--muted); font-size: .68rem; font-weight: 620; }
.native-booking__time:hover { border-color: var(--accent); transform: translateY(-1px); box-shadow: 0 8px 16px rgb(14 22 42 / 7%); }
.native-booking__time.is-selected { border-color: var(--accent); background: var(--accent); color: #fff; box-shadow: 0 8px 20px color-mix(in srgb, var(--accent) 22%, transparent); }
.native-booking__time.is-selected span { color: rgb(255 255 255 / 78%); }
.booking-calendar__nav:focus-visible, .booking-calendar__day.is-available:focus-visible, .native-booking__time:focus-visible { outline: 3px solid color-mix(in srgb, var(--accent) 35%, transparent); outline-offset: 2px; }

.native-booking__loading { position: relative; display: grid; grid-template-columns: minmax(0, 1fr) 238px; min-height: 420px; overflow: hidden; border: 1px solid var(--border); border-radius: 18px; }
.native-booking__loading > span { position: absolute; inset: auto 0 20px; color: var(--muted); font-size: .78rem; font-weight: 620; text-align: center; }
.booking-skeleton { background: linear-gradient(100deg, var(--surface-2) 18%, #fff 42%, var(--surface-2) 66%); background-size: 240% 100%; animation: booking-shimmer 1.15s linear infinite; }
.booking-skeleton--calendar { margin: 28px; border-radius: 14px; }
.booking-skeleton--times { border-left: 1px solid var(--border); }
@keyframes booking-shimmer { to { background-position-x: -240%; } }

.native-booking__empty { padding: 38px var(--sp-5); border: 1px dashed var(--border-strong); border-radius: var(--r-lg); color: var(--muted); text-align: center; }
.booking-timezone { justify-self: center; margin: -4px 0 0; padding: 7px 12px; border-radius: var(--r-pill); background: var(--surface-2); color: var(--muted); font-size: .72rem; line-height: 1.4; text-align: center; }
.booking-retry { justify-self: center; }
.booking-selection { display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 15px 17px; border: 1px solid color-mix(in srgb, var(--accent) 26%, var(--border)); border-radius: 14px; background: var(--brand-soft); }
.booking-selection > div { display: grid; min-width: 0; gap: 3px; }
.booking-selection span { color: var(--muted); font-size: .68rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; }
.booking-selection strong { font-size: .84rem; line-height: 1.45; }
.booking-selection .btn { flex: none; }
.booking-selection.is-retry { background: #fffaeb; }
.booking-confirmation { display: grid; min-height: 360px; justify-items: center; align-content: center; gap: 12px; padding: clamp(32px, 7vw, 64px); border: 1px solid color-mix(in srgb, var(--ok) 35%, var(--border)); border-radius: 18px; background: color-mix(in srgb, var(--ok) 8%, var(--surface)); text-align: center; }
.booking-confirmation h3 { font-size: var(--step-2); }
.booking-confirmation p { max-width: 46ch; color: var(--muted); }
.booking-status { margin: 0; text-align: center; }
.booking-stage .form-shell { grid-template-columns: minmax(230px, 300px) minmax(0, 780px); max-width: 1180px; gap: clamp(28px, 5vw, 64px); }
.booking-stage .form-context h1 { font-size: clamp(2rem, 3.5vw, 3.15rem); }
.booking-stage .form-panel__head, .booking-stage .done { display: none; }
.form-footer { grid-column: 1 / -1; padding-top: var(--sp-2); color: var(--faint); font-size: .72rem; text-align: center; }
.form-footer a { color: inherit; font-weight: 650; }

/* The booking panel can become narrow inside the two-column page even when
   the viewport itself is still desktop-sized (for example, in a split pane).
   Respond to the component's real width so the calendar is never clipped. */
@container native-booking (max-width: 620px) {
  .native-booking__picker, .native-booking__loading { grid-template-columns: 1fr; }
  .native-booking__picker { min-height: 0; }
  .booking-calendar { padding: 22px 18px 25px; }
  .booking-calendar__weekdays, .booking-calendar__grid { grid-template-columns: repeat(7, minmax(36px, 1fr)); gap: 3px; }
  .booking-times { padding: 22px 18px; border-top: 1px solid var(--border); border-left: 0; }
  .booking-times__list { max-height: 420px; grid-template-columns: repeat(2, minmax(0, 1fr)); overflow-y: auto; overscroll-behavior: contain; }
  .booking-skeleton--calendar { min-height: 310px; }
  .booking-skeleton--times { min-height: 210px; border-top: 1px solid var(--border); border-left: 0; }
}

.not-found-shell { display: grid; min-height: 100dvh; place-items: center; padding: var(--sp-5); }
.not-found-card { display: grid; width: min(520px, 100%); justify-items: center; gap: var(--sp-4); padding: var(--sp-7); border: 1px solid var(--border); border-radius: var(--r-xl); background: var(--surface); box-shadow: var(--shadow-md); text-align: center; }
.not-found-code { display: grid; width: 64px; height: 64px; place-items: center; border-radius: 18px; background: var(--brand-soft); color: var(--accent); font-size: 1.2rem; font-weight: 760; }

@media (max-width: 820px) {
  .form-shell { grid-template-columns: 1fr; max-width: 720px; gap: var(--sp-6); padding-top: var(--sp-5); }
  .booking-stage .form-shell { grid-template-columns: 1fr; max-width: 760px; gap: var(--sp-5); }
  .form-context { position: static; padding: 0; }
  .form-context h1 { font-size: var(--step-3); }
  .form-meta { display: flex; flex-wrap: wrap; gap: 12px 22px; }
}

@media (max-width: 680px) {
  .booking-block[data-provider="google_api"] { padding: 24px 20px 28px; }
  .native-booking__picker, .native-booking__loading { grid-template-columns: 1fr; }
  .native-booking__picker { min-height: 0; }
  .booking-calendar { padding: 22px 18px 25px; }
  .booking-calendar__weekdays, .booking-calendar__grid { grid-template-columns: repeat(7, minmax(36px, 1fr)); gap: 3px; }
  .booking-times { padding: 22px 18px; border-top: 1px solid var(--border); border-left: 0; }
  .booking-times__list { max-height: 420px; grid-template-columns: repeat(2, minmax(0, 1fr)); overflow-y: auto; overscroll-behavior: contain; }
  .booking-skeleton--calendar { min-height: 310px; }
  .booking-skeleton--times { min-height: 210px; border-top: 1px solid var(--border); border-left: 0; }
  .booking-selection { position: sticky; z-index: 5; bottom: 10px; align-items: stretch; flex-direction: column; box-shadow: 0 12px 32px rgb(14 22 42 / 16%); }
  .booking-selection .btn { width: 100%; }
}

@media (max-width: 560px) {
  .public::before { height: 280px; }
  .public-topbar { padding: 18px 16px; }
  .public-brand__mark { width: 126px; height: 56px; }
  .public-status span { display: none; }
  .form-shell { padding: 28px 14px 48px; }
  .form-panel { border-radius: var(--r-lg); }
  .form-panel__head { padding: 14px 18px; }
  #form { padding: 24px 18px 28px; }
  .form-nav { flex-wrap: wrap; }
  .form-nav .btn { flex: 1; }
  .form-nav .hint { display: none; }
  .done { min-height: 460px; padding: 32px 20px; }
  .booking-stage .form-shell { padding-top: 18px; }
  .booking-stage .form-context .lede { font-size: .9rem; }
  .booking-block[data-provider="google_api"] { padding: 22px 16px 26px; }
  .booking-calendar { padding-inline: 12px; }
  .booking-calendar__weekdays, .booking-calendar__grid { grid-template-columns: repeat(7, minmax(34px, 1fr)); }
  .booking-calendar__day, .booking-calendar__spacer { min-height: 42px; }
  .booking-times__list { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  .booking-skeleton { animation: none; }
  .native-booking__time { transition: none; }
}
