/* ==========================================================================
   RITZ BARBERSHOP — PHYSICAL 3D "BOOK NOW" DOCKING & FLIGHT SYSTEM
   State Model: DOCK -> HOLD -> LIFT-OFF -> FLIGHT -> LANDING -> DOCK
   ========================================================================== */

/* 1. VISIBLE PHYSICAL DOCKING CRADLES (Page Elements)
   Precision-sized sockets (198px x 54px) that receive the 186px x 48px button.
   When empty, they display an architectural recessed well and dock index. */
.booknow-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 198px;
  height: 54px;
  margin: 1.4rem 0;
  position: relative;
  box-sizing: border-box;
}

.booknow-placeholder[data-booknow-align="center"] {
  margin-left: auto;
  margin-right: auto;
}

.booknow-placeholder[data-booknow-align="right"] {
  margin-left: auto;
  margin-right: 0;
}

.booknow-placeholder[data-booknow-align="left"] {
  margin-left: 0;
  margin-right: auto;
}

/* Cradle Socket Shell */
.booknow-cradle {
  width: 100%;
  height: 100%;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-pill);
  box-sizing: border-box;
  pointer-events: none;
  transition: border-color 0.3s ease, box-shadow 0.3s ease, background 0.3s ease;
}

/* Light Theme Cradle (Trust Bar, Locations, Chapters, Final CTA) */
.booknow-placeholder--light .booknow-cradle {
  background: rgba(9, 9, 11, 0.04);
  border: 1px dashed rgba(9, 9, 11, 0.24);
  box-shadow: inset 0 2px 6px rgba(9, 9, 11, 0.09),
              0 1px 0 rgba(255, 255, 255, 0.8);
}

/* Dark Theme Cradle (Service Menu) */
.booknow-placeholder--dark .booknow-cradle {
  background: rgba(0, 0, 0, 0.4);
  border: 1px dashed rgba(255, 255, 255, 0.22);
  box-shadow: inset 0 2px 7px rgba(0, 0, 0, 0.65),
              0 1px 0 rgba(255, 255, 255, 0.08);
}

/* Inner Recessed Well Content */
.booknow-cradle__well {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  width: 100%;
  height: 100%;
  padding: 0 1rem;
  transition: opacity 0.25s ease;
}

.booknow-cradle__text {
  font-family: var(--sans);
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  user-select: none;
}

.booknow-placeholder--light .booknow-cradle__text {
  color: rgba(9, 9, 11, 0.42);
}

.booknow-placeholder--dark .booknow-cradle__text {
  color: rgba(255, 255, 255, 0.38);
}

.booknow-cradle__pip {
  width: 4px;
  height: 4px;
  border-radius: 50%;
}

.booknow-placeholder--light .booknow-cradle__pip {
  background: rgba(9, 9, 11, 0.3);
}

.booknow-placeholder--dark .booknow-cradle__pip {
  background: rgba(255, 255, 255, 0.35);
}

/* When the button is docked, fade the well label and let the button sit flush */
.booknow-placeholder.is-docked .booknow-cradle {
  border-color: rgba(255, 255, 255, 0.06);
  background: transparent;
  box-shadow: none;
}

.booknow-placeholder.is-docked .booknow-cradle__well {
  opacity: 0;
}

/* 2. THE 3D VIEWPORT STAGE & RIG CONTAINER
   Rendering layer allowing smooth GPU flight between section coordinates.
   Strictly hidden during Hero. */
.booknow-stage {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 940;
  overflow: visible;
  perspective: 1200px;
  -webkit-perspective: 1200px;
  opacity: 0;
  visibility: hidden;
  will-change: opacity, transform;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

.booknow-stage.is-active {
  opacity: 1;
  visibility: visible;
}

.booknow-rig {
  position: absolute;
  top: 0;
  left: 0;
  width: 186px;
  height: 48px;
  transform-origin: center center;
  transform-style: preserve-3d;
  -webkit-transform-style: preserve-3d;
  will-change: transform;
  pointer-events: none;
}

/* 3. THE 3D BUTTON OBJECT (BookNow3D) */
.booknow-3d {
  display: block;
  width: 186px;
  height: 48px;
  position: relative;
  text-decoration: none;
  color: #ffffff;
  pointer-events: auto;
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
  transform-style: preserve-3d;
  -webkit-transform-style: preserve-3d;
  transform-origin: center center;
  will-change: transform;
  outline: none;
  -webkit-tap-highlight-color: transparent;
}

.booknow-3d:focus-visible {
  outline: 2px solid #ffffff;
  outline-offset: 6px;
  border-radius: var(--radius-pill);
}

/* Contact Shadow (Sharp, snug inside cradle when docked) */
.booknow-3d__contact-shadow {
  position: absolute;
  inset: 1px 2px;
  border-radius: var(--radius-pill);
  transform: translateZ(-8px);
  background: rgba(0, 0, 0, 0.88);
  box-shadow: 0 10px 24px -4px rgba(0, 0, 0, 0.8),
              0 3px 8px -2px rgba(0, 0, 0, 0.55);
  pointer-events: none;
  will-change: transform, opacity, filter;
  transition: opacity 0.25s ease, transform 0.25s ease, filter 0.25s ease;
}

/* Elevation Shadow (Expands into soft cloud when in flight) */
.booknow-3d__elevation-shadow {
  position: absolute;
  inset: -6px -12px;
  border-radius: var(--radius-pill);
  transform: translateZ(-40px) translateY(22px);
  background: radial-gradient(ellipse at center, rgba(0, 0, 0, 0.65) 0%, rgba(0, 0, 0, 0) 72%);
  filter: blur(18px);
  opacity: 0;
  pointer-events: none;
  will-change: opacity, transform;
  transition: opacity 0.3s ease, transform 0.3s ease;
}

/* 3D Body Container */
.booknow-3d__body {
  position: absolute;
  inset: 0;
  transform-style: preserve-3d;
  -webkit-transform-style: preserve-3d;
  border-radius: var(--radius-pill);
  transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Chamfer / Bevel Extrusions (Creating 14px physical depth) */
.booknow-3d__rim {
  position: absolute;
  inset: 0;
  border-radius: var(--radius-pill);
  pointer-events: none;
  box-sizing: border-box;
}

.booknow-3d__rim--1 {
  transform: translateZ(4px);
  background: #1a1b24;
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.booknow-3d__rim--2 {
  transform: translateZ(1px);
  background: #111218;
  border: 1px solid rgba(255, 255, 255, 0.12);
}

.booknow-3d__rim--3 {
  transform: translateZ(-2px);
  background: #0a0b0e;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

/* Front Face: Polished Luxury Obsidian */
.booknow-3d__face--front {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.7rem;
  border-radius: var(--radius-pill);
  background: linear-gradient(148deg, #242735 0%, #13141b 50%, #0c0d12 100%);
  border: 1px solid rgba(255, 255, 255, 0.28);
  box-shadow: inset 0 1px 1.5px rgba(255, 255, 255, 0.5),
              inset 0 -1px 2px rgba(0, 0, 0, 0.9),
              0 2px 6px rgba(0, 0, 0, 0.4);
  transform: translateZ(7px);
  overflow: hidden;
  white-space: nowrap;
}

/* Back Face: Ground Plate */
.booknow-3d__face--back {
  position: absolute;
  inset: 0;
  border-radius: var(--radius-pill);
  background: #050608;
  border: 1px solid rgba(255, 255, 255, 0.05);
  transform: translateZ(-7px) rotateY(180deg);
}

/* Physical Edge Faces (Visible when pitching & yawing during flight) */
.booknow-3d__face--top {
  position: absolute;
  left: 20px;
  right: 20px;
  top: -7px;
  height: 14px;
  background: linear-gradient(90deg, #181922 0%, #3a3e52 45%, #4c5169 50%, #3a3e52 55%, #181922 100%);
  border-top: 1px solid rgba(255, 255, 255, 0.45);
  transform: rotateX(90deg);
  transform-origin: center center;
  pointer-events: none;
}

.booknow-3d__face--bottom {
  position: absolute;
  left: 20px;
  right: 20px;
  bottom: -7px;
  height: 14px;
  background: #07080b;
  border-bottom: 1px solid rgba(0, 0, 0, 0.8);
  transform: rotateX(-90deg);
  transform-origin: center center;
  pointer-events: none;
}

/* Front Face Elements */
.booknow-3d__text {
  position: relative;
  z-index: 2;
  font-family: var(--sans);
  font-size: 0.80rem;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: #ffffff;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.8);
}

.booknow-3d__crown {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  position: relative;
  z-index: 2;
  color: #ffffff;
  opacity: 0.95;
  transform: translateY(-0.5px);
  transition: transform 0.25s var(--ease);
}

.booknow-3d__arrow {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  position: relative;
  z-index: 2;
  color: #ffffff;
  opacity: 0.85;
  transition: transform 0.25s var(--ease);
}

.booknow-3d__sheen {
  position: absolute;
  inset: 0;
  z-index: 3;
  pointer-events: none;
  background: linear-gradient(
    115deg,
    transparent 20%,
    rgba(255, 255, 255, 0.35) 48%,
    rgba(255, 255, 255, 0.06) 58%,
    transparent 80%
  );
  opacity: 0.7;
  mix-blend-mode: overlay;
  transform: translateX(-100%);
  transition: transform 0.6s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.3s ease;
}

/* 4. HOVER & PRESS INTERACTIONS */
.booknow-3d:hover .booknow-3d__body {
  transform: translateZ(3px);
}

.booknow-3d:hover .booknow-3d__face--front {
  border-color: rgba(255, 255, 255, 0.5);
  background: linear-gradient(148deg, #2c3042 0%, #171822 50%, #0f1017 100%);
  box-shadow: inset 0 1px 2px rgba(255, 255, 255, 0.65),
              inset 0 -1px 2px rgba(0, 0, 0, 0.9),
              0 4px 12px rgba(0, 0, 0, 0.5);
}

.booknow-3d:hover .booknow-3d__crown {
  transform: translateY(-1px) scale(1.08);
}

.booknow-3d:hover .booknow-3d__arrow {
  transform: translateX(2px);
}

.booknow-3d:hover .booknow-3d__sheen {
  transform: translateX(100%);
  opacity: 0.95;
}

/* Tactile Click / Physical Press */
.booknow-3d--pressed .booknow-3d__body {
  transform: translateZ(-6px) scale(0.96) !important;
  transition: transform 0.08s ease-out !important;
}

.booknow-3d--pressed .booknow-3d__face--front {
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.95) !important;
  background: #0c0d12 !important;
}

.booknow-3d--pressed .booknow-3d__contact-shadow {
  transform: translateZ(-3px) scale(0.92) !important;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.9) !important;
  transition: all 0.08s ease-out !important;
}

/* 5. HOMEPAGE COORDINATION WITH .smart-book-pill
   When 3D button is actively travelling/docked on desktop, smoothly hide the static pill */
@media (min-width: 861px) {
  body.booknow-travel-active .smart-book-pill {
    opacity: 0;
    pointer-events: none;
    transform: translate(-50%, 20px);
    transition: opacity 0.4s var(--ease), transform 0.4s var(--ease);
  }
}

/* 6. MOBILE RESPONSIVENESS (< 860px) */
@media (max-width: 860px) {
  .booknow-placeholder {
    width: 178px;
    height: 48px;
    margin: 1rem auto;
  }
  
  .booknow-rig,
  .booknow-3d {
    width: 170px;
    height: 42px;
  }
  
  .booknow-3d__text {
    font-size: 0.72rem;
    letter-spacing: 0.16em;
  }
  
  .booknow-3d__crown svg {
    width: 13px;
    height: 11px;
  }
  
  .booknow-3d__arrow svg {
    width: 10px;
    height: 10px;
  }
}

/* 7. PREFERS-REDUCED-MOTION */
@media (prefers-reduced-motion: reduce) {
  .booknow-stage {
    display: none !important;
  }
  
  .booknow-placeholder {
    display: flex !important;
    visibility: visible !important;
    opacity: 1 !important;
  }
}

/* 8. DEBUG MODE OVERLAY (Activated by body[data-booknow-debug="true"]) */
body[data-booknow-debug="true"] .booknow-placeholder {
  outline: 2px solid #00ff88 !important;
}

body[data-booknow-debug="true"] .booknow-rig {
  outline: 2px solid #ff0055 !important;
}
