*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  font-size: 100%;
  -webkit-text-size-adjust: 100%;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
}

body {
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 1rem;
  line-height: 1.5;
  letter-spacing: -0.005em;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overscroll-behavior-y: none;
}

h1, h2, h3, p {
  margin: 0;
}

h1 {
  font-size: clamp(1.75rem, 8vw, 2.125rem);
  line-height: 1.06;
  letter-spacing: -0.028em;
  font-weight: 700;
}

h2 {
  font-size: 1.375rem;
  line-height: 1.12;
  letter-spacing: -0.022em;
  font-weight: 650;
}

button {
  font: inherit;
  color: inherit;
  border: 0;
  background: none;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  /* Feedback en el pointer-down, no solo en el click (WWDC Designing Fluid Interfaces). */
  transition: transform 120ms ease-out, opacity 120ms ease-out;
}
button:active { transform: scale(0.98); }

@media (prefers-reduced-motion: reduce) {
  button:active { transform: none; opacity: 0.85; }
}

/* Un `display` de clase gana al [hidden] del navegador: forzamos ocultación
   para que los controles de staff no se vean aunque tengan display propio. */
[hidden] { display: none !important; }

:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 3px;
  border-radius: 4px;
}

::selection {
  background: var(--brand);
  color: var(--on-brand);
}

.tabular {
  font-variant-numeric: tabular-nums;
}

/* Modal de acceso (login para reservar) */
.auth-modal {
  position: fixed; inset: 0; z-index: 80;
  display: grid; place-items: center;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  padding: var(--s4);
}
.auth-modal__box {
  position: relative;
  width: min(100%, 360px);
  display: flex; flex-direction: column; gap: var(--s3);
  padding: var(--s6) var(--s5) var(--s5);
  border-radius: var(--r-lg);
  background: var(--surface-solid);
  border: 1px solid var(--hairline);
  box-shadow: var(--elevation);
}
.auth-modal__box h2 { font-size: 1.25rem; letter-spacing: -0.02em; }
.auth-modal__box input {
  min-height: 48px; padding: 0 var(--s4);
  border-radius: var(--r-md);
  border: 1px solid var(--hairline);
  background: var(--surface-hi);
  color: var(--text);
  font: inherit;
}
.auth-modal__box input::placeholder { color: var(--text-3); }
.auth-modal__actions { display: flex; flex-direction: column; gap: var(--s2); margin-top: var(--s2); }
.auth-modal__actions .btn-primary { width: 100%; justify-content: center; }
.auth-modal__reg {
  min-height: 44px; border-radius: var(--r-pill);
  border: 1px solid var(--hairline); color: var(--text-2);
  font-size: 0.875rem; font-weight: 600;
}
.auth-modal__err { color: #d67570; font-size: 0.8125rem; }
.auth-modal__err[hidden] { display: none; }
.auth-modal__close {
  position: absolute; top: var(--s3); right: var(--s3);
  width: 36px; height: 36px; display: grid; place-items: center;
  border-radius: 50%; color: var(--text-2); background: var(--surface-hi);
}

.page-enter {
  animation: page-in 320ms cubic-bezier(0.2, 0.8, 0.2, 1) both;
}
@keyframes page-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}
@media (prefers-reduced-motion: reduce) {
  .page-enter { animation: none; }
}

/* Scrollbar del propio mundo, no el del navegador. */
* {
  scrollbar-width: thin;
  scrollbar-color: var(--surface-hi) transparent;
}
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-thumb { background: var(--surface-hi); border-radius: var(--r-pill); }
::-webkit-scrollbar-track { background: transparent; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

@media (prefers-contrast: more) {
  :root { --hairline: rgba(255,255,255,0.32); --text-2: #ded6cc; }
}
