/* Fase 2 — Página principal. Un solo mundo visual: taller nocturno, latón, madera oscura. */

/* --- Splash de arranque ------------------------------------------------ */
.splash {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  background: var(--bg);
  transition: opacity 420ms ease, visibility 420ms ease;
}
.splash.is-gone {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}
.splash__mark {
  width: 88px;
  height: 88px;
  display: grid;
  place-items: center;
  border-radius: 26px;
  background: linear-gradient(145deg, var(--brand), var(--brand-deep));
  color: var(--on-brand);
  font-size: 2rem;
  font-weight: 800;
  letter-spacing: -0.05em;
  box-shadow: 0 20px 50px -20px rgba(0, 0, 0, 0.9);
  animation: splash-in 620ms var(--spring-settle) both;
}
@keyframes splash-in {
  from { opacity: 0; transform: scale(0.82); }
  to { opacity: 1; transform: scale(1); }
}
@media (prefers-reduced-motion: reduce) {
  .splash__mark { animation: none; }
}

.home {
  max-width: 520px;
  margin: 0 auto;
  padding: calc(var(--s5) + env(safe-area-inset-top)) var(--s5) 140px;
}

/* --- Cabecera ---------------------------------------------------------- */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s4);
  margin-bottom: var(--s6);
}

.topbar__hello {
  color: var(--text-2);
  font-size: 0.875rem;
  font-weight: 500;
  letter-spacing: 0.01em;
  margin-bottom: 2px;
}

.brandmark {
  flex: none;
  width: var(--tap);
  height: var(--tap);
  display: grid;
  place-items: center;
  border-radius: var(--r-md);
  background: linear-gradient(145deg, var(--brand), var(--brand-deep));
  color: var(--on-brand);
  font-size: 0.9rem;
  font-weight: 800;
  letter-spacing: -0.04em;
  box-shadow: 0 8px 20px -10px rgba(0, 0, 0, 0.9);
  border-top: 1px solid rgba(255, 255, 255, 0.28);
}

/* --- Hero -------------------------------------------------------------- */
.hero { margin-bottom: var(--s7); }

.hero__tag {
  font-size: clamp(2rem, 10vw, 2.6rem);
  line-height: 1.04;
  letter-spacing: -0.035em;
  font-weight: 700;
  max-width: 9ch;
  margin-bottom: var(--s5);
  text-wrap: balance;
}

.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s5);
  min-height: var(--tap);
  padding: 0 var(--s4) 0 var(--s5);
  border-radius: var(--r-pill);
  background: var(--brand);
  color: var(--on-brand);
  font-weight: 700;
  letter-spacing: -0.01em;
  box-shadow: 0 12px 26px -14px rgba(0, 0, 0, 0.85);
  border-top: 1px solid rgba(255, 255, 255, 0.24);
  transition: transform var(--dur-fast) var(--spring-snap), box-shadow var(--dur-fast) ease;
}
.btn-primary:active { transform: scale(0.97); box-shadow: 0 6px 14px -8px rgba(0, 0, 0, 0.8); }
.btn-primary--wide { width: 100%; margin-top: var(--s5); }
.btn-primary__icon {
  width: 20px; height: 20px; display: grid; place-items: center;
}
.btn-primary__icon svg { width: 20px; height: 20px; }

/* --- Próxima cita ------------------------------------------------------ */
.section-title {
  font-size: 1.125rem;
  letter-spacing: -0.02em;
  font-weight: 650;
}
.appt .section-title { margin-bottom: var(--s3); }

.appt__wrap { position: relative; border-radius: var(--r-lg); }
.appt__actions {
  position: absolute;
  inset: 0 0 0 auto;
  display: flex;
  width: 180px;
  border-radius: var(--r-lg);
  overflow: hidden;
}
.appt__action {
  flex: 1;
  color: var(--text);
  font-size: 0.8125rem;
  font-weight: 600;
  padding: var(--s4) var(--s2);
  display: grid;
  place-items: center;
  text-align: center;
}
.appt__action--edit { background: var(--brand-deep); }
.appt__action--cancel { background: #6d2f2a; }

.appt__card {
  position: relative;
  z-index: 1;
  padding: var(--s4);
  border-radius: var(--r-lg);
  background: var(--surface);
  backdrop-filter: blur(22px) saturate(150%);
  -webkit-backdrop-filter: blur(22px) saturate(150%);
  border: 1px solid var(--hairline);
  box-shadow: var(--elevation);
  touch-action: none;
  cursor: grab;
  will-change: transform;
}
.appt__card:active { cursor: grabbing; }
.appt__top { display: flex; align-items: center; justify-content: space-between; }
.appt__when { color: var(--text-2); font-size: 0.8125rem; font-weight: 600; }
.appt__badge {
  font-size: 0.6875rem;
  font-weight: 700;
  color: var(--brand);
  background: var(--brand-tint);
  padding: 4px 10px;
  border-radius: var(--r-pill);
}
.appt__main { display: flex; align-items: center; gap: var(--s4); margin: var(--s3) 0 var(--s4); }
.appt__time { font-size: 2.5rem; line-height: 1; letter-spacing: -0.04em; font-weight: 700; }
.appt__meta { display: flex; flex-direction: column; gap: 2px; }
.appt__meta strong { font-size: 0.9375rem; font-weight: 650; }
.appt__meta span { color: var(--text-2); font-size: 0.8125rem; }
.appt__foot {
  display: flex; align-items: center; gap: var(--s2);
  padding-top: var(--s3);
  border-top: 1px solid var(--hairline);
  color: var(--text-2);
  font-size: 0.8125rem;
}
.appt__chev { margin-left: auto; width: 16px; height: 16px; color: var(--text-3); }
.appt__chev svg { width: 16px; height: 16px; }
.appt__hint { color: var(--text-3); font-size: 0.75rem; margin-top: var(--s2); }

.avatar {
  flex: none;
  display: grid; place-items: center;
  border-radius: 50%;
  background: var(--surface-hi);
  border: 1px solid var(--hairline);
  color: var(--brand);
  font-weight: 700;
  letter-spacing: -0.03em;
}
.avatar--xs { width: 24px; height: 24px; font-size: 0.625rem; }
.avatar--sm { width: 28px; height: 28px; font-size: 0.6875rem; }
.avatar--lg { width: 62px; height: 62px; font-size: 1rem; margin-bottom: var(--s2); }

/* --- Secciones --------------------------------------------------------- */
.section { margin-top: var(--s7); }
.section__head { margin-bottom: var(--s3); }
.section__sub { color: var(--text-2); font-size: 0.875rem; margin-top: 2px; }

.service-list, .team { list-style: none; margin: 0; padding: 0; }
.service-list {
  border-radius: var(--r-lg);
  background: var(--surface);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border: 1px solid var(--hairline);
  overflow: hidden;
}
.service + .service { border-top: 1px solid var(--hairline); }
.service__btn {
  width: 100%;
  display: flex;
  align-items: center;
  gap: var(--s3);
  min-height: 68px;
  padding: var(--s3) var(--s4);
  text-align: left;
  transition: background var(--dur-fast) ease;
}
.service__btn:active { background: var(--surface-hi); }
.service__icon {
  flex: none; width: 40px; height: 40px;
  display: grid; place-items: center;
  border-radius: var(--r-sm);
  background: var(--brand-tint);
  color: var(--brand);
}
.service__icon svg { width: 21px; height: 21px; }
.service__body { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.service__body strong { font-size: 0.9375rem; font-weight: 600; }
.service__body span { color: var(--text-2); font-size: 0.75rem; }
.service__price { margin-left: auto; font-size: 0.9375rem; font-weight: 650; color: var(--brand); }
.service__chev { width: 14px; height: 14px; color: var(--text-3); }
.service__chev svg { width: 14px; height: 14px; }

.team {
  display: flex;
  gap: var(--s4);
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  padding-bottom: var(--s2);
  margin-right: calc(-1 * var(--s5));
}
.team__item {
  flex: 0 0 88px;
  display: flex; flex-direction: column; align-items: center; text-align: center;
  scroll-snap-align: start;
}
.team__item strong { font-size: 0.8125rem; font-weight: 650; }
.team__item > span:last-child { color: var(--text-3); font-size: 0.6875rem; }

.demo-notice {
  text-align: center;
  color: var(--text-3);
  font-size: 0.6875rem;
  margin-top: var(--s7);
  letter-spacing: 0.02em;
}

/* --- Tab bar ----------------------------------------------------------- */
.tabbar {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 20;
  display: flex;
  justify-content: space-around;
  padding: var(--s2) var(--s3) calc(var(--s2) + env(safe-area-inset-bottom));
  background: rgba(20, 18, 16, 0.78);
  backdrop-filter: blur(24px) saturate(160%);
  -webkit-backdrop-filter: blur(24px) saturate(160%);
  border-top: 1px solid var(--hairline);
  -webkit-mask-image: linear-gradient(to bottom, transparent 0, #000 10px);
  mask-image: linear-gradient(to bottom, transparent 0, #000 10px);
}
.tabbar__item {
  flex: 1;
  min-height: var(--tap);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 3px;
  color: var(--text-3);
  font-size: 0.625rem;
  font-weight: 600;
  transition: color var(--dur-fast) ease, transform var(--dur-fast) var(--spring-snap);
}
.tabbar__item svg { width: 23px; height: 23px; }
.tabbar__item:active { transform: scale(0.92); }
.tabbar__item.is-active { color: var(--brand); }

/* --- Hoja modal -------------------------------------------------------- */
.sheet { position: fixed; inset: 0; z-index: 40; --scrim: 1; }
.sheet[hidden] { display: none; }
.sheet__backdrop {
  position: absolute; inset: 0;
  background: rgba(0, 0, 0, calc(0.58 * var(--scrim)));
  backdrop-filter: blur(calc(6px * var(--scrim)));
  -webkit-backdrop-filter: blur(calc(6px * var(--scrim)));
  opacity: 0;
  transition: opacity var(--dur-sheet) ease;
}
.sheet.is-open .sheet__backdrop { opacity: 1; }
.sheet__panel {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  max-height: 88vh;
  overflow-y: auto;
  padding: var(--s2) var(--s5) calc(var(--s6) + env(safe-area-inset-bottom));
  border-radius: var(--r-lg) var(--r-lg) 0 0;
  background: var(--surface-solid);
  border-top: 1px solid var(--hairline);
  box-shadow: 0 -20px 60px -20px rgba(0, 0, 0, 0.8);
  transform: translate3d(0, 100%, 0);
  will-change: transform;
}
.sheet.is-open .sheet__panel { transform: translate3d(0, 0, 0); }
.sheet__grabber {
  width: 40px; height: 5px;
  margin: var(--s2) auto var(--s4);
  border-radius: var(--r-pill);
  background: var(--hairline);
  cursor: grab;
  touch-action: none;
}
.sheet__head { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--s3); }
.iconbtn {
  flex: none; width: var(--tap); height: var(--tap);
  display: grid; place-items: center;
  border-radius: 50%;
  background: var(--surface-hi);
  color: var(--text-2);
  transition: transform var(--dur-fast) var(--spring-snap);
}
.iconbtn:active { transform: scale(0.92); }
.iconbtn svg { width: 19px; height: 19px; }
.sheet__label {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-3);
  margin: var(--s5) 0 var(--s2);
}
.chips { display: flex; flex-wrap: wrap; gap: var(--s2); }
.chip {
  display: inline-flex; align-items: center; gap: var(--s2);
  min-height: 40px;
  padding: 0 var(--s3);
  border-radius: var(--r-pill);
  background: var(--surface-hi);
  border: 1px solid var(--hairline);
  color: var(--text-2);
  font-size: 0.8125rem;
  font-weight: 600;
  transition: background var(--dur-fast) ease, color var(--dur-fast) ease, transform var(--dur-fast) var(--spring-snap), border-color var(--dur-fast) ease;
}
.chip:active { transform: scale(0.95); }
.chip.is-selected {
  background: var(--brand-tint);
  border-color: var(--brand);
  color: var(--brand);
}
.chip--time { min-width: 68px; justify-content: center; }
.sheet__loading { color: var(--text-3); font-size: 0.8125rem; padding: var(--s2) 0; }
.chips--time { max-height: 132px; overflow-y: auto; padding-right: 2px; }
.chip--date {
  flex-direction: column;
  gap: 0;
  min-width: 56px;
  min-height: 66px;
  padding: var(--s2) var(--s3);
  border-radius: var(--r-md);
  line-height: 1.15;
}
.chip__weekday { font-size: 0.625rem; font-weight: 600; color: var(--text-3); text-transform: uppercase; letter-spacing: 0.04em; }
.chip__day { font-size: 1.25rem; font-weight: 700; letter-spacing: -0.03em; }
.chip__month { font-size: 0.625rem; color: var(--text-2); }
.chip--date.is-selected .chip__weekday, .chip--date.is-selected .chip__month { color: var(--brand); }
.sheet__example { text-align: center; color: var(--text-3); font-size: 0.6875rem; margin-top: var(--s3); }

/* --- Toast ------------------------------------------------------------- */
.toast {
  position: fixed;
  left: 50%; bottom: calc(96px + env(safe-area-inset-bottom));
  z-index: 60;
  transform: translate(-50%, 12px);
  opacity: 0;
  padding: var(--s2) var(--s4);
  border-radius: var(--r-pill);
  background: var(--surface-solid);
  border: 1px solid var(--hairline);
  box-shadow: var(--elevation);
  color: var(--text);
  font-size: 0.8125rem;
  white-space: nowrap;
  transition: opacity 200ms ease, transform 240ms var(--spring-settle);
  pointer-events: none;
}
.toast.is-visible { opacity: 1; transform: translate(-50%, 0); }
.toast[hidden] { display: none; }

body.is-locked { overflow: hidden; }

@media (prefers-reduced-motion: reduce) {
  .sheet__panel { transform: translate3d(0, 100%, 0); }
  .sheet.is-open .sheet__panel { transform: none; opacity: 1; transition: opacity 160ms ease; }
  .hero, .btn-primary, .chip, .tabbar__item { transform: none !important; }
}

@media (prefers-reduced-transparency: reduce) {
  .appt__card, .service-list, .tabbar, .sheet__backdrop { backdrop-filter: none; -webkit-backdrop-filter: none; }
  .appt__card, .service-list { background: var(--surface-solid); }
  .tabbar { background: #141210; }
}
