/* Page CSS: solo lo que el kit no trae (dentro de visuales: agenda en vivo, mini-UI de pasos, vista de WhatsApp, chat). Tokens del kit. */
:root { --ease-out: cubic-bezier(.23, 1, .32, 1); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* fotos */
.svc-photo .frame__img { object-position: 30% 30%; }
.surgery-photo .frame__img { object-position: 62% 18%; }
@media (max-width: 1023px) { .svc-photo, .surgery-photo { aspect-ratio: 4 / 5; } }
.svc-more { margin-top: var(--s-5); }
.rows .rows__value { font-variant-numeric: tabular-nums; }

/* menú: horarios libres en vivo */
.menu-slots { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; padding: var(--s-4); align-content: center; }
.menu-slots span { background: var(--bg); border-radius: var(--r-sm); padding: 8px 10px; font-size: 13px; font-weight: 500; text-align: center; }

/* pasos: mini-UI del propio sistema de reservas */
.step-ui { --p-h: 220px; display: grid; place-items: center; padding: var(--s-5); }
.sui-chips { display: grid; width: min(100%, 300px); }
.sui-chips span { padding: 8px 4px; font-size: 14px; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; }
.sui-chips .on { font-weight: 600; }
.sui-chips .on::after { content: "✓"; color: var(--ink); }
.sui-slots { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1px; width: min(100%, 300px); background: var(--line); border: 1px solid var(--line); }
.sui-slots span { padding: 10px 4px; font-size: 14px; text-align: center; font-variant-numeric: tabular-nums; background: var(--surface); }
.sui-slots .on { font-weight: 700; text-decoration: underline; text-decoration-color: var(--action); text-decoration-thickness: 3px; text-underline-offset: 4px; }
.sui-wa { background: #e7f8dc; border-radius: 14px 14px 14px 4px; padding: 12px 14px; max-width: 290px; font-size: 14px; line-height: 1.45; color: #1d2a1f; }
.sui-wa b { font-size: 13px; color: #1f7a4c; }
.sui-wa p { margin: 4px 0; }
.sui-wa small { display: block; text-align: right; color: #5b7a62; font-size: 13px; }

/* consulta por WhatsApp */
.wa-form { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s-4); }
.wa-form .field--wide, .wa-form .btn-row, .wa-form .form__status { grid-column: 1 / -1; }
.field { display: grid; gap: 6px; }
.field label { font-size: 14px; font-weight: 500; }
.field input, .field select, .field textarea, .bk-row select {
  width: 100%; min-height: 48px; padding: 12px 14px; font: 400 16px/1.4 var(--font-text); color: var(--ink);
  background: var(--bg); border: 1px solid var(--line-strong, #c9ccd6); border-radius: var(--r-sm);
}
.field textarea { min-height: 112px; resize: vertical; }
.field input:focus-visible, .field select:focus-visible, .field textarea:focus-visible, .bk-row select:focus-visible { outline: 2px solid var(--action); outline-offset: 1px; }
.field [aria-invalid="true"] { border-color: #b3261e; }
.field__error { color: #b3261e; font-size: 14px; margin: 0; }
.form__status { font-size: 14px; color: var(--muted); min-height: 1.2em; margin: 0; }
.wa-visual { display: flex; justify-content: center; }
.wa-phone { width: min(100%, 360px); border-radius: 28px; background: #efeae2; border: 1px solid var(--line); overflow: hidden; }
.wa-top { display: flex; gap: 10px; align-items: center; padding: 14px 16px; background: #075e54; color: #fff; }
.wa-top img { width: 40px; height: 40px; border-radius: 50%; object-fit: cover; object-position: 50% 15%; }
.wa-top small { display: block; font-size: 13px; opacity: .8; }
.wa-body { display: grid; gap: 10px; padding: 18px 14px 26px; min-height: 300px; align-content: end; }
.wa-msg { max-width: 82%; padding: 10px 12px; border-radius: 12px 12px 12px 4px; background: #fff; font-size: 15px; line-height: 1.45; color: #1d2a1f; }
.wa-msg.me { justify-self: end; background: #d9fdd3; border-radius: 12px 12px 4px 12px; }

/* agenda en vivo */
.booking { background: var(--surface); border-radius: var(--r-lg); padding: var(--s-6); display: grid; gap: var(--s-5); align-content: start; min-height: 560px; }
.bk-row { display: grid; grid-template-columns: auto 1fr; gap: var(--s-4); align-items: center; }
.bk-label { font-weight: 500; font-size: 14px; }
.bk-week { display: grid; grid-template-columns: auto 1fr auto; gap: 6px; align-items: center; }
.bk-week .icon-btn[disabled] { opacity: .3; pointer-events: none; }
.days { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; }
.day { min-height: 76px; padding: 10px 6px; border-radius: var(--r-md); background: var(--bg); text-align: center; scroll-snap-align: start;
  box-shadow: inset 0 0 0 1px var(--line); transition: transform 160ms var(--ease-out), background-color 150ms ease, color 150ms ease; }
.day:active { transform: scale(.97); }
.day small { display: block; font-size: 13px; color: var(--muted); text-transform: capitalize; }
.day b { display: block; font: var(--display-weight) 24px/1.2 var(--font-display); }
.day i { font-style: normal; font-size: 13px; color: var(--muted); }
.day[disabled] { opacity: .45; pointer-events: none; }
.day[aria-selected="true"] { background: var(--ink); color: var(--bg); box-shadow: none; }
.day[aria-selected="true"] small, .day[aria-selected="true"] i { color: inherit; opacity: .8; }
.slots { display: flex; flex-wrap: wrap; gap: 8px; align-content: start; }
.slot { flex: 1 1 84px; min-height: 48px; border-radius: var(--r-sm); background: var(--bg); font: 500 16px var(--font-text); color: var(--ink); font-variant-numeric: tabular-nums;
  box-shadow: inset 0 0 0 1px var(--line); transition: transform 160ms var(--ease-out), background-color 150ms ease, color 150ms ease, opacity 200ms ease; }
.slot:active { transform: scale(.96); }
.slot[aria-pressed="true"] { background: var(--action); color: var(--action-ink); box-shadow: none; }
.slot.gone { opacity: 0; transform: scale(.95); pointer-events: none; }
@media (hover: hover) and (pointer: fine) {
  .day:not([aria-selected="true"]):hover, .slot:not([aria-pressed="true"]):hover { box-shadow: inset 0 0 0 1px var(--ink); }
}
.empty { color: var(--muted); grid-column: 1 / -1; padding: var(--s-5) 0; }
.bk-form { display: grid; gap: var(--s-4); padding-top: var(--s-5); border-top: 1px solid var(--line); }
.bk-summary { margin: 0; padding: 12px 14px; border-radius: var(--r-sm); background: var(--bg); font-weight: 500; }
.bk-grid { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s-4); }
.bk-done { display: grid; gap: var(--s-3); justify-items: start; }
.bk-done h3 { font: var(--display-weight) var(--t-h3)/1.2 var(--font-display); margin: 0; }
.visit-side { display: grid; gap: var(--s-2); align-content: start; }
.visit-side .t-label:not(:first-child) { margin-top: var(--s-4); }
.visit-side address { font-style: normal; font-size: var(--t-lead); line-height: 1.4; }
@media (max-width: 1023px) { .booking { padding: var(--s-5); } }
@media (max-width: 639px) {
  .wa-form, .bk-grid { grid-template-columns: 1fr; }
  .wa-visual { margin-top: var(--s-6); }
  .booking { padding: var(--s-4); min-height: 0; }
  .bk-row { grid-template-columns: 1fr; gap: 6px; }
  .day { min-height: 64px; padding: 8px 2px; }
  .day b { font-size: 18px; }
  .day i, .day small { font-size: 0; }
  .day small::after { content: attr(data-d); font-size: 13px; }
  .day i::after { content: attr(data-n); font-size: 13px; }
}

/* chat: origen en la esquina del botón */
.chat-fab { position: fixed; right: max(16px, env(safe-area-inset-right)); bottom: calc(max(16px, env(safe-area-inset-bottom)) + var(--bar, 0px)); z-index: 30;
  width: 60px; height: 60px; border-radius: 50%; padding: 3px; background: var(--bg); border: 0; box-shadow: 0 0 0 2px var(--action), 0 12px 32px -8px rgba(31, 43, 77, .35);
  cursor: pointer; transition: transform 200ms var(--ease-out), opacity 200ms ease; }
.chat-fab:active { transform: scale(.94); }
.fab-photo { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; object-position: 50% 15%; display: block; }
.fab-dot { position: absolute; right: 2px; top: 2px; width: 14px; height: 14px; border-radius: 50%; background: #2fa865; box-shadow: 0 0 0 2px var(--bg); }
.chat-open .chat-fab { opacity: 0; transform: scale(.9); pointer-events: none; }
.chat { position: fixed; right: max(16px, env(safe-area-inset-right)); bottom: max(16px, env(safe-area-inset-bottom)); z-index: 40;
  width: min(400px, calc(100vw - 32px)); height: min(640px, calc(100dvh - 32px)); display: flex; flex-direction: column; overflow: hidden;
  background: var(--bg); border-radius: 20px; border: 1px solid var(--line); box-shadow: 0 30px 80px -20px rgba(31, 43, 77, .4);
  transform-origin: bottom right; transform: scale(.95) translateY(8px); opacity: 0; pointer-events: none; transition: transform 240ms var(--ease-out), opacity 180ms ease; }
.chat-open .chat { transform: none; opacity: 1; pointer-events: auto; }
.chat-head { display: flex; align-items: center; gap: 12px; padding: 14px 14px 14px 16px; border-bottom: 1px solid var(--line); }
.chat-head > div { flex: 1; line-height: 1.3; }
.chat-head small { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); }
.chat-head .dot { width: 8px; height: 8px; border-radius: 50%; background: #2fa865; }
.chat-avatar { width: 40px; height: 40px; border-radius: 50%; object-fit: cover; object-position: 50% 15%; }
.icon-btn { width: 44px; height: 44px; display: grid; place-items: center; border: 0; border-radius: 12px; background: none; color: var(--ink); cursor: pointer; transition: transform 160ms var(--ease-out), background-color 150ms ease; }
.icon-btn:active { transform: scale(.94); }
@media (hover: hover) and (pointer: fine) { .icon-btn:hover { background: var(--surface); } }
.chat-log { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 8px; overscroll-behavior: contain; }
.msg { max-width: 86%; padding: 10px 13px; border-radius: 16px; font-size: 15px; line-height: 1.45; white-space: pre-line; overflow-wrap: anywhere; animation: msgIn 240ms var(--ease-out) both; }
.msg.bot { background: var(--surface); border-bottom-left-radius: 6px; align-self: flex-start; }
.msg.me { background: var(--ink); color: var(--bg); border-bottom-right-radius: 6px; align-self: flex-end; }
.msg a { color: inherit; text-decoration: underline; }
.msg.typing { display: flex; gap: 4px; padding: 14px; }
.msg.typing i { width: 6px; height: 6px; border-radius: 50%; background: var(--muted); animation: blink 1s infinite; }
.msg.typing i:nth-child(2) { animation-delay: .15s; } .msg.typing i:nth-child(3) { animation-delay: .3s; }
@keyframes blink { 50% { opacity: .25; } }
@keyframes msgIn { from { opacity: 0; transform: translateY(6px); } }
.chat-options { display: flex; flex-wrap: wrap; gap: 6px; padding: 0 16px 10px; max-height: 42%; overflow-y: auto; }
.chat-options :is(button, a) { min-height: 40px; padding: 8px 13px; border-radius: 999px; border: 0; background: var(--bg); box-shadow: inset 0 0 0 1px var(--line-strong, #c9ccd6);
  font: 500 14px var(--font-text); color: var(--ink); text-decoration: none; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; transition: transform 160ms var(--ease-out), background-color 150ms ease; }
.chat-options :is(button, a):active { transform: scale(.97); }
.chat-options a.wa { background: #1f7a4c; color: #fff; box-shadow: none; }
@media (hover: hover) and (pointer: fine) { .chat-options button:hover { box-shadow: inset 0 0 0 1px var(--ink); } }
.chat-input { display: flex; gap: 8px; padding: 10px 12px; border-top: 1px solid var(--line); }
.chat-input input { flex: 1; min-height: 44px; padding: 10px 14px; border-radius: 999px; border: 1px solid var(--line-strong, #c9ccd6); font: 16px var(--font-text); background: var(--bg); color: var(--ink); }
/* móvil: el botón del chat es una pestaña lateral (no tapa la barra inferior ni el contenido)
   y el chat abre como hoja inferior por encima del menú y la barra, con su botón de cerrar a la vista */
@media (max-width: 639px) {
  .chat-fab { right: 0; top: 58%; bottom: auto; width: 52px; height: 56px; padding: 4px 6px 4px 4px; border-radius: 28px 0 0 28px;
    box-shadow: -1px 0 0 1px var(--action), 0 8px 24px -8px rgba(31, 43, 77, .35); transform: translateY(-50%); }
  .chat-fab:active { transform: translateY(-50%) scale(.94); }
  .chat-open .chat-fab { transform: translate(100%, -50%); }
  .fab-photo { width: 48px; height: 48px; }
  .fab-dot { right: 6px; top: 4px; width: 12px; height: 12px; }
  .chat { left: 0; right: 0; bottom: 0; z-index: 60; width: 100%; height: min(88dvh, calc(100dvh - var(--nav) - 8px));
    border-radius: 20px 20px 0 0; border-bottom: 0; padding-bottom: env(safe-area-inset-bottom);
    transform-origin: bottom center; transform: translateY(24px); }
  .chat-open .chat { transform: none; }
  .chat-open .actionbar { visibility: hidden; }
}
.send { background: var(--ink); color: var(--bg); border-radius: 50%; }
@media (hover: hover) and (pointer: fine) { .send:hover { background: var(--ink); opacity: .9; } }

.toast { position: fixed; left: 50%; bottom: 24px; z-index: 50; transform: translate(-50%, calc(100% + 40px)); background: var(--ink); color: var(--bg);
  padding: 12px 18px; border-radius: 12px; font-size: 15px; max-width: calc(100vw - 32px); transition: transform 300ms var(--ease-out); }
.toast.show { transform: translate(-50%, 0); }

@media (prefers-reduced-motion: reduce) {
  .chat { transition: opacity 150ms ease; transform: none; }
  .toast { transition: none; }
  .msg, .slot { animation: none; }
}

/* foco visible con contraste 3:1 sobre blanco (el naranja de la paleta queda en 2:1) */
:focus-visible { outline-color: var(--ink) !important; }

/* alturas: cada sección llena su pantalla a 1440 (huecos parejos entre secciones) */
@media (min-width: 1024px) {
  .surgery-photo { min-height: 640px; }
  .booking { min-height: 700px; }
  .wa-phone { height: 640px; display: flex; flex-direction: column; }
  .wa-body { flex: 1; }
}
@media (max-width: 639px) {
  .svc-photo { aspect-ratio: auto; height: 680px; }
  #pasos .step-ui { --p-h: 290px; }
  .wa-phone { height: 620px; display: flex; flex-direction: column; }
  .wa-body { flex: 1; }
}

/* ===== v4: más contenido en el inicio ===== */
/* hero: los tres datos al pie de la columna de texto */
.hero__text { display: flex; flex-direction: column; align-self: stretch; height: 100%; }
.hero__text .hero-facts { margin-top: auto; padding-top: var(--s-6); border-top: 1px solid var(--line); }
@media (max-width: 1023px) { .hero__text .hero-facts { margin-top: var(--s-6); } }
@media (max-width: 639px) { .hero__text .hero-facts { display: none; } }

/* servicios: disponibilidad de la semana en vivo (datos reales de la agenda) */
.week-card { background: var(--surface); border-radius: var(--r-lg); padding: var(--s-6); display: grid; gap: var(--s-5); align-content: start; }
.wk-head { display: flex; justify-content: space-between; align-items: flex-start; gap: var(--s-4); }
.wk-head b { display: block; font: var(--display-weight) var(--t-h3)/1.2 var(--font-display); letter-spacing: var(--display-tracking); margin-top: 6px; }
.wk-live { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 500; color: #1f7a4c; }
.wk-live .dot { width: 8px; height: 8px; border-radius: 50%; background: #2fa865; position: relative; }
.wk-live .dot::after { content: ""; position: absolute; inset: 0; border-radius: 50%; background: inherit; animation: wkPulse 2.4s var(--ease-out) infinite; }
@keyframes wkPulse { from { transform: scale(1); opacity: .6; } to { transform: scale(2.6); opacity: 0; } }
.wk-total { font: var(--display-weight) 40px/1 var(--font-display); letter-spacing: var(--display-tracking); font-variant-numeric: tabular-nums; text-align: right; }
.wk-total small { display: block; font: 400 13px var(--font-text); color: var(--muted); letter-spacing: 0; margin-top: 4px; }
.wk-bars { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 8px; height: 200px; align-items: end; }
.wk-bar { display: grid; grid-template-rows: auto 1fr auto; gap: 6px; height: 100%; text-align: center; font-size: 13px; }
.wk-bar b { font-weight: 500; font-variant-numeric: tabular-nums; }
.wk-bar span { color: var(--muted); text-transform: capitalize; }
.wk-track { position: relative; border-radius: var(--r-sm); background: var(--bg); overflow: hidden; }
.wk-fill { position: absolute; inset: 0; background: var(--ink); border-radius: var(--r-sm); transform-origin: bottom; transform: scaleY(var(--v, 0));
  transition: transform 700ms var(--ease-out); }
.wk-bar.today .wk-fill { background: var(--action); }
.wk-bar.full .wk-fill { background: var(--line); }
.wk-next { display: grid; gap: 2px; padding-top: var(--s-4); border-top: 1px solid var(--line); }
.wk-next small, .wk-list small { color: var(--muted); font-size: 13px; }
.wk-next b { font-size: var(--t-lead); font-weight: 500; }
.wk-list { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.wk-slot { background: var(--bg); border-radius: var(--r-sm); padding: 10px 12px; display: grid; gap: 2px; transition: transform 300ms var(--ease-out), opacity 300ms ease; }
.wk-slot b { font-variant-numeric: tabular-nums; font-weight: 500; }
.wk-slot.enter { opacity: 0; transform: translateY(6px); }
@media (max-width: 639px) { .week-card { padding: var(--s-4); } .wk-bars { height: 320px; gap: 4px; } .wk-list { grid-template-columns: 1fr; } .wk-total { font-size: 32px; } }

/* doctora: la foto se revela (picture-develops) */
.develop { margin: 0; border-radius: var(--r-lg); overflow: hidden; height: min(640px, var(--ly-fit, 640px)); }
.develop > img { display: block; width: 100%; height: 100%; object-fit: cover; object-position: 30% 28%; }
@media (max-width: 1023px) { .develop { height: auto; aspect-ratio: 4 / 5; margin-top: var(--s-7); } }
.doc-sign { margin-top: var(--s-5); color: var(--muted); font-size: 15px; }
@media (prefers-reduced-motion: reduce) { .wk-fill, .wk-slot { transition: none; } .wk-live .dot::after { display: none; } }
