/* =========================================================
   Dream Beauty Studio — componentes compartidos
   font-size en em · layout en rem · line-height sin unidad.
   Responsive por data-bp (js/breakpoints.js) + grillas
   intrínsecas: sin media queries de ancho.
   ========================================================= */

/* ---------- 1. Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font-family: var(--font-body); font-size: 1em; line-height: 1.6;
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
}
img, svg { display: block; max-width: 100%; }
a { color: inherit; text-underline-offset: 0.2em; text-decoration-thickness: 0.1rem; }
h1, h2, h3, h4 { font-family: var(--font-display); font-weight: 400; margin: 0; line-height: 1.1; text-wrap: balance; }
h1 { font-size: clamp(2.4em, 6vw, 4.4em); letter-spacing: -0.02em; }
h2 { font-size: clamp(1.8em, 3.6vw, 2.6em); letter-spacing: -0.01em; }
h3 { font-size: 1.5em; }
h1 em, h2 em { font-style: italic; }
p { margin: 0; text-wrap: pretty; }
.wrap { width: 100%; max-width: var(--wrap); margin-inline: auto; padding-inline: 2rem; }
[data-bp="xs"] .wrap { padding-inline: 1.2rem; }
.sr-only { position: absolute; width: 0.1rem; height: 0.1rem; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.eyebrow { font-size: 0.75em; font-weight: 600; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); }
.lead { font-size: 1.1em; color: var(--ink-2); max-width: 38rem; }
.muted { color: var(--muted); }
.ic { width: 1.2rem; height: 1.2rem; flex: none; stroke: currentColor; fill: none; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.ic-s { width: 1rem; height: 1rem; }
.rule { border: 0; border-top: 0.1rem solid var(--line); margin: 0; }
:focus-visible { outline: 0.2rem solid var(--ink); outline-offset: 0.2rem; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; } }

/* ---------- 2. Cabecera y navegación ---------- */
.top { position: sticky; top: 0; z-index: 40; background: color-mix(in oklab, var(--bg) 92%, transparent); backdrop-filter: blur(0.8rem); border-bottom: 0.1rem solid var(--line); }
.top__in { display: flex; align-items: center; gap: 1.6rem; min-height: 4.4rem; }
.brand { display: inline-flex; flex-direction: column; text-decoration: none; line-height: 1; }
.brand__name { font-family: var(--font-display); font-size: 1.45em; letter-spacing: -0.01em; }
.brand__name i { font-style: italic; }
.brand__sub { font-size: 0.62em; letter-spacing: 0.22em; text-transform: uppercase; color: var(--muted); margin-top: 0.3rem; font-weight: 600; }
.nav { display: flex; gap: 0.4rem; margin-left: auto; align-items: center; }
.nav a:not(.btn) { text-decoration: none; font-size: 0.92em; font-weight: 500; padding: 0.6rem 0.8rem; border-radius: var(--radius-pill); min-height: 2.8rem; display: inline-flex; align-items: center; }
.nav a:not(.btn):hover { background: var(--sunk); }
.nav a[aria-current="page"]:not(.btn) { box-shadow: inset 0 -0.2rem 0 var(--rose); border-radius: 0; }
.top .nav-toggle { display: none; margin-left: auto; }
[data-bp="xs"] .nav, [data-bp="sm"] .nav { display: none; }
[data-bp="xs"] .top .nav-toggle, [data-bp="sm"] .top .nav-toggle { display: inline-flex; }

.drawer { position: fixed; inset: 0; z-index: 60; display: grid; grid-template-columns: 1fr min(22rem, 86vw); }
.drawer__scrim { background: color-mix(in oklab, var(--ink) 40%, transparent); border: 0; }
.drawer__panel { background: var(--surface); padding: 1.2rem 1.4rem 2rem; display: flex; flex-direction: column; gap: 0.4rem; box-shadow: var(--shadow-overlay); overflow-y: auto; }
.drawer__panel a:not(.btn) { text-decoration: none; font-family: var(--font-display); font-size: 1.6em; padding: 0.6rem 0; border-bottom: 0.1rem solid var(--line); }
.drawer__head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1rem; }

/* Barra inferior de reserva en celular */
.dock { display: none; }
[data-bp="xs"] .dock { display: flex; position: fixed; z-index: 30; left: 0; right: 0; bottom: 0; gap: 0.8rem; align-items: center; padding: 0.8rem 1.2rem calc(0.8rem + env(safe-area-inset-bottom)); background: var(--surface); border-top: 0.1rem solid var(--line); }
[data-bp="xs"] body.has-dock { padding-bottom: 5.6rem; }
.dock .btn { flex: 1; }

/* ---------- 3. Botones (5 estados) ---------- */
.btn {
  --b-bg: var(--action); --b-fg: var(--on-action); --b-bd: var(--action);
  display: inline-flex; align-items: center; justify-content: center; gap: 0.6rem;
  min-height: 2.8rem; padding: 0.6rem 1.4rem; border-radius: var(--radius-pill);
  background: var(--b-bg); color: var(--b-fg); border: 0.1rem solid var(--b-bd);
  font: inherit; font-size: 0.95em; font-weight: 600; letter-spacing: 0.02em;
  text-decoration: none; cursor: pointer; position: relative;
  transition: background 0.15s, transform 0.1s, box-shadow 0.15s;
}
.btn:hover { --b-bg: color-mix(in oklab, var(--action) 86%, var(--ink)); box-shadow: 0 0 0 0.3rem var(--rose-soft); }
.btn:focus-visible { outline: 0.2rem solid var(--ink); outline-offset: 0.3rem; box-shadow: none; }
.btn:active { transform: translateY(0.1rem); }
.btn[disabled], .btn[aria-disabled="true"] { --b-bg: var(--sunk); --b-fg: var(--muted); --b-bd: var(--line); cursor: not-allowed; box-shadow: none; transform: none; }
.btn[aria-busy="true"] { color: transparent; pointer-events: none; }
.btn[aria-busy="true"]::after { content: ""; position: absolute; width: 1.2rem; height: 1.2rem; border-radius: 50%; border: 0.2rem solid var(--on-action); border-right-color: transparent; animation: spin 0.8s linear infinite; }
.btn--ghost { --b-bg: transparent; --b-fg: var(--ink); --b-bd: var(--control); }
.btn--ghost:hover { --b-bg: var(--sunk); box-shadow: none; }
.btn--ghost[aria-busy="true"]::after { border-color: var(--ink); border-right-color: transparent; }
.btn--text { --b-bg: transparent; --b-fg: var(--ink); --b-bd: transparent; padding-inline: 0.6rem; text-decoration: underline; text-decoration-color: var(--rose); }
.btn--text:hover { --b-bg: var(--sunk); box-shadow: none; }
.btn--danger { --b-bg: transparent; --b-fg: var(--danger); --b-bd: var(--danger); }
.btn--danger:hover { --b-bg: color-mix(in oklab, var(--danger) 8%, var(--surface)); box-shadow: none; }
.btn--lg { min-height: 3.2rem; padding-inline: 1.8rem; font-size: 1em; }
.btn--icon { padding: 0; width: 2.8rem; }
.btn--block { width: 100%; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- 4. Formularios ---------- */
.field { display: grid; gap: 0.4rem; }
.field label, .label { font-size: 0.85em; font-weight: 600; color: var(--ink); }
.input, .select, .textarea {
  font: inherit; font-size: 1em; color: var(--ink); background: var(--surface);
  border: 0.1rem solid var(--control); border-radius: var(--radius-s);
  min-height: 3rem; padding: 0.6rem 0.9rem; width: 100%;
}
.textarea { min-height: 6rem; resize: vertical; }
.input:hover, .select:hover { border-color: var(--ink-2); }
.input:focus-visible, .select:focus-visible, .textarea:focus-visible { outline: 0.2rem solid var(--ink); outline-offset: 0.1rem; }
.input[aria-invalid="true"] { border-color: var(--danger); background: color-mix(in oklab, var(--danger) 5%, var(--surface)); }
.field__err { font-size: 0.82em; color: var(--danger); font-weight: 600; display: flex; gap: 0.4rem; align-items: center; }
.field__hint { font-size: 0.82em; color: var(--muted); }
.form-grid { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(min(100%, 14rem), 1fr)); }

.stepper { display: inline-flex; align-items: center; border: 0.1rem solid var(--control); border-radius: var(--radius-pill); }
.stepper button { width: 2.8rem; height: 2.8rem; border: 0; background: transparent; color: var(--ink); font: inherit; font-size: 1.2em; cursor: pointer; border-radius: 50%; }
.stepper button:hover { background: var(--sunk); }
.stepper button:disabled { color: var(--line); cursor: not-allowed; }
.stepper output { min-width: 2rem; text-align: center; font-weight: 700; font-variant-numeric: tabular-nums; }

.check { display: flex; gap: 0.8rem; align-items: center; min-height: 2.8rem; cursor: pointer; }
.check input { width: 1.3rem; height: 1.3rem; accent-color: var(--action); flex: none; }

/* ---------- 5. Chips, avisos, estados ---------- */
.chip { display: inline-flex; align-items: center; gap: 0.4rem; padding: 0.2rem 0.7rem; border-radius: var(--radius-pill); background: var(--rose-soft); color: var(--ink); font-size: 0.78em; font-weight: 600; letter-spacing: 0.02em; }
.chip--line { background: transparent; border: 0.1rem solid var(--control); }
.chip--ok { background: color-mix(in oklab, var(--ok) 12%, var(--surface)); color: var(--ok); }
.chip--warn { background: color-mix(in oklab, var(--warn) 12%, var(--surface)); color: var(--warn); }
.chip--danger { background: color-mix(in oklab, var(--danger) 10%, var(--surface)); color: var(--danger); }
.tbc { font-style: italic; color: var(--muted); font-size: 0.92em; }
.notice { display: flex; gap: 0.8rem; align-items: flex-start; padding: 1rem 1.2rem; border: 0.1rem solid var(--line); border-radius: var(--radius-m); background: var(--surface); }
.notice > span:first-child { flex: none; display: inline-flex; padding-top: 0.2rem; }
.notice--warn { border-color: color-mix(in oklab, var(--warn) 40%, var(--line)); background: color-mix(in oklab, var(--warn) 6%, var(--surface)); }
.notice--warn .ic { color: var(--warn); }
.notice--danger { border-color: color-mix(in oklab, var(--danger) 40%, var(--line)); background: color-mix(in oklab, var(--danger) 5%, var(--surface)); }
.notice--danger .ic { color: var(--danger); }
.notice--ok .ic { color: var(--ok); }
.skel { background: linear-gradient(90deg, var(--sunk), var(--surface), var(--sunk)); background-size: 200% 100%; animation: shimmer 1.2s linear infinite; border-radius: var(--radius-s); }
@keyframes shimmer { to { background-position: -200% 0; } }
.falla, .aviso-almacen { margin-block: 1.2rem; }
.toast { position: fixed; z-index: 80; left: 50%; bottom: 6.4rem; transform: translateX(-50%); background: var(--ink); color: var(--surface); padding: 0.8rem 1.2rem; border-radius: var(--radius-pill); font-size: 0.9em; box-shadow: var(--shadow-overlay); max-width: calc(100vw - 2.4rem); }

/* ---------- 6. Foto de referencia (reemplazable) ---------- */
.foto { position: relative; overflow: hidden; border-radius: var(--radius-m); background:
  radial-gradient(120% 90% at 20% 15%, var(--ph-1), transparent 60%),
  radial-gradient(90% 80% at 85% 90%, var(--ph-3), transparent 70%),
  var(--ph-2); aspect-ratio: 4 / 5; }
.foto > img { position: absolute; inset: 0; display: block; width: 100%; height: 100%; object-fit: cover; }
.foto--wide { aspect-ratio: 16 / 10; }
.foto--sq { aspect-ratio: 1; }
.foto__cap { position: absolute; left: 0.8rem; bottom: 0.8rem; right: 0.8rem; display: flex; gap: 0.4rem; align-items: flex-start; font-size: 0.72em; line-height: 1.4; color: var(--ink); background: color-mix(in oklab, var(--surface) 88%, transparent); padding: 0.5rem 0.7rem; border-radius: var(--radius-s); }
.foto__cap .ic { width: 0.9rem; height: 0.9rem; margin-top: 0.1rem; }

/* ---------- 7. Carta (listas editoriales) ---------- */
.menu-group { display: grid; gap: 0.2rem; }
.menu-group__head { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; padding-bottom: 0.6rem; border-bottom: 0.1rem solid var(--ink); }
.menu-row { display: grid; grid-template-columns: 1fr auto; gap: 0.2rem 1rem; align-items: baseline; padding: 0.8rem 0; border-bottom: 0.1rem solid var(--line); }
.menu-row__name { font-weight: 600; }
.menu-row__meta { font-size: 0.85em; color: var(--muted); }
.menu-row__price { font-variant-numeric: tabular-nums; font-weight: 600; text-align: right; white-space: nowrap; }
.unit { font-size: 0.72em; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-2); border: 0.1rem solid var(--rose); border-radius: var(--radius-pill); padding: 0.1rem 0.6rem; white-space: nowrap; }

/* ---------- 8. Pie ---------- */
.foot { margin-top: 4rem; border-top: 0.1rem solid var(--line); padding: 2.4rem 0 3rem; font-size: 0.9em; color: var(--ink-2); }
.foot__grid { display: grid; gap: 2rem; grid-template-columns: repeat(auto-fit, minmax(min(100%, 13rem), 1fr)); }
.foot h4 { font-family: var(--font-body); font-size: 0.75em; letter-spacing: 0.12em; text-transform: uppercase; font-weight: 700; margin-bottom: 0.6rem; color: var(--muted); }
.editable { border-bottom: 0.1rem dashed var(--rose); padding: 0 0.2rem; outline-offset: 0.2rem; }
.editable:hover { background: var(--rose-soft); }

/* ---------- 9. Utilidades de layout ---------- */
.section { padding-block: clamp(3rem, 8vw, 6rem); }
.stack { display: grid; gap: 1rem; }
.stack-l { display: grid; gap: 2rem; }
.row { display: flex; gap: 0.8rem; align-items: center; flex-wrap: wrap; }
.between { justify-content: space-between; }
.card { background: var(--surface); border: 0.1rem solid var(--line); border-radius: var(--radius-m); padding: 1.4rem; }
.num { font-variant-numeric: tabular-nums; }

/* ---------- Que nada estire la página de costado ----------
   El hijo de una grilla no se achica por debajo de su contenido si no se le da permiso:
   una fila ancha estira la columna y la página se desplaza de costado en un teléfono.
   Medido en WebKit a 320 px en Reservar y en la guía del panel (pruebas/medir-pantallas.js). */
:where(.rs__grid, .panel, .opts, .guia, .gsec, .terms, .terms > div, .cat, .cat__side, .cat__lists,
  .menu-group, .cierre, .stack-l, .contacto dl, .blk, .blk__label, .pieza, .lz, .grp) > * { min-width: 0; }

/* Las grillas de una sola columna declaran minmax(0, 1fr): con «auto», un hijo que no puede
   partirse (una fila de botones, un rótulo sin corte) ensancha la columna más que la pantalla. */
.panel, .stack, .stack-l { grid-template-columns: minmax(0, 1fr); }

/* Que baje de línea en lugar de encogerse: la base en rem acompaña el tamaño de letra. */
.menu-group__head { flex-wrap: wrap; }
.menu-group__head > h3 { flex: 1 1 10rem; }

/* ---------- Instalada como aplicación ----------
   El área segura se suma sólo en modo aplicación. En el navegador env() vale 0
   y, puesto sin esta condición, pisaría el espacio que la cabecera ya tiene. */
@media (display-mode: standalone) { body { padding-top: env(safe-area-inset-top, 0); } }
