/* ==========================================================================
   RESERVATION MODAL — redesigned
   Drop-in replacement for the existing .reserve-modal.
   Markup contract is the new one in Reservation.html (.r-modal).
   ========================================================================== */

:root {
  /* Inherit from main site if present, redefine if not */
  --r-bg:        #0F0A0A;          /* deep warm black                       */
  --r-paper:     #1A1310;          /* modal panel — slightly lifted black   */
  --r-cream:     #F0E0BF;          /* warm cream / candlelight              */
  --r-cream-dim: #C9A876;          /* dimmer cream                          */
  --r-gold:      #D4A05C;          /* bronze gold — the hero color          */
  --r-gold-hi:   #F2D08A;          /* highlight bronze for shimmer          */
  --r-gold-lo:   #8B6F47;          /* dark bronze for borders               */
  --r-red:       #B82A2A;          /* brand red, used as ACCENT only        */
  --r-red-deep:  #6B1414;
  --r-soft:      rgba(212, 160, 92, 0.14);

  --r-easing-settle: cubic-bezier(0.16, 1, 0.3, 1);
  --r-easing-rise:   cubic-bezier(0.22, 1, 0.36, 1);
}

/* --------------------------------------------------------------------------
   Button — adds a "ripple ring" press feedback on click
   -------------------------------------------------------------------------- */
.reserve-btn {
  position: relative;
  overflow: visible;          /* allow ripple to escape */
}

/* The expanding gold ring that bursts outward on click */
.reserve-btn::after {
  content: "";
  position: absolute;
  inset: 0;
  border: 2px solid var(--r-gold-hi);
  border-radius: inherit;
  pointer-events: none;
  opacity: 0;
  transform: scale(1);
}
.reserve-btn.is-firing::after {
  animation: btnRipple 800ms var(--r-easing-rise) forwards;
}
@keyframes btnRipple {
  0%   { opacity: 1;   transform: scale(1);    border-width: 3px; }
  60%  { opacity: 0.6; }
  100% { opacity: 0;   transform: scale(1.6);  border-width: 1px; }
}
.reserve-btn.is-firing {
  animation: btnPress 280ms var(--r-easing-settle);
}
@keyframes btnPress {
  0%   { transform: scale(1); }
  35%  { transform: scale(0.95); }
  100% { transform: scale(1); }
}

/* --------------------------------------------------------------------------
   <dialog> shell — we override default centering to do our own
   so we can animate position + size cleanly.
   -------------------------------------------------------------------------- */
.r-modal[open] {
  display: grid;
  place-items: center;
}

.r-modal {
  /* Reset native dialog chrome */
  border: none;
  padding: 0;
  background: transparent;
  color: var(--r-cream);
  max-width: none;
  max-height: none;
  width: 100vw;
  height: 100vh;
  margin: 0;
  inset: 0;
  overflow: hidden;
  outline: none;
}

/* Backdrop — a dim layer + radial warm "lantern" spotlight behind the panel.
   We render our OWN backdrop via .r-modal__backdrop instead of ::backdrop
   because ::backdrop can't host the radial glow we want behind the panel. */
.r-modal::backdrop { background: transparent; }

.r-modal__backdrop {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(
      ellipse 70% 55% at 50% 50%,
      rgba(212, 160, 92, 0.18) 0%,
      rgba(212, 160, 92, 0.08) 25%,
      rgba(0, 0, 0, 0.55) 60%,
      rgba(0, 0, 0, 0.78) 100%
    ),
    rgba(10, 6, 4, 0.55);
  backdrop-filter: blur(0px) saturate(0.9);
  -webkit-backdrop-filter: blur(0px) saturate(0.9);
  opacity: 0;
  transition:
    opacity 520ms var(--r-easing-rise),
    backdrop-filter 520ms var(--r-easing-rise),
    -webkit-backdrop-filter 520ms var(--r-easing-rise);
}
.r-modal.is-shown .r-modal__backdrop {
  opacity: 1;
  backdrop-filter: blur(8px) saturate(1.05);
  -webkit-backdrop-filter: blur(8px) saturate(1.05);
}

/* The radial "candlelight" pulses subtly while the modal is open */
.r-modal__lantern {
  position: absolute;
  left: 50%;
  top: 50%;
  width: min(90vw, 900px);
  aspect-ratio: 1;
  transform: translate(-50%, -50%);
  background: radial-gradient(
    circle at center,
    rgba(242, 208, 138, 0.22) 0%,
    rgba(212, 160, 92, 0.10) 30%,
    rgba(212, 160, 92, 0.0) 65%
  );
  filter: blur(20px);
  pointer-events: none;
  opacity: 0;
  transition: opacity 700ms var(--r-easing-rise) 80ms;
}
.r-modal.is-shown .r-modal__lantern {
  opacity: 1;
  animation: lanternPulse 5.5s ease-in-out 1s infinite;
}
@keyframes lanternPulse {
  0%, 100% { transform: translate(-50%, -50%) scale(1);    opacity: 1; }
  50%      { transform: translate(-50%, -50%) scale(1.06); opacity: 0.8; }
}

/* --------------------------------------------------------------------------
   Panel
   -------------------------------------------------------------------------- */
.r-modal__panel {
  position: relative;
  width: min(540px, 92vw);
  background:
    linear-gradient(180deg,
      rgba(212, 160, 92, 0.04) 0%,
      rgba(212, 160, 92, 0)   30%,
      rgba(212, 160, 92, 0)   70%,
      rgba(184, 42, 42, 0.04) 100%
    ),
    var(--r-paper);
  border: 1px solid rgba(212, 160, 92, 0.22);
  border-radius: 4px;
  padding: 56px 48px 44px;
  text-align: center;
  box-shadow:
    0 0 0 1px rgba(212, 160, 92, 0.08),
    0 60px 100px -20px rgba(0, 0, 0, 0.85),
    0 0 80px rgba(212, 160, 92, 0.08);

  /* Initial state — animated to identity by .is-shown */
  opacity: 0;
  transform: translateY(28px) scale(0.96);
  filter: blur(10px);
  transition:
    opacity 600ms var(--r-easing-settle),
    transform 700ms var(--r-easing-settle),
    filter 600ms var(--r-easing-settle);
}
.r-modal.is-shown .r-modal__panel {
  opacity: 1;
  transform: translateY(0) scale(1);
  filter: blur(0);
}

/* Inner gold corner accents — barely-there L-shapes in the four corners
   to evoke a calling card / printed invitation */
.r-modal__panel::before,
.r-modal__panel::after {
  content: "";
  position: absolute;
  width: 22px;
  height: 22px;
  border: 1px solid rgba(212, 160, 92, 0.45);
}
.r-modal__panel::before {
  top: 14px; left: 14px;
  border-right: none; border-bottom: none;
}
.r-modal__panel::after {
  bottom: 14px; right: 14px;
  border-left: none; border-top: none;
}

/* The two MISSING corners — added via dedicated decorative element */
.r-modal__corners {
  position: absolute; inset: 0; pointer-events: none;
}
.r-modal__corners::before,
.r-modal__corners::after {
  content: "";
  position: absolute;
  width: 22px; height: 22px;
  border: 1px solid rgba(212, 160, 92, 0.45);
}
.r-modal__corners::before {
  top: 14px; right: 14px;
  border-left: none; border-bottom: none;
}
.r-modal__corners::after {
  bottom: 14px; left: 14px;
  border-right: none; border-top: none;
}

/* --------------------------------------------------------------------------
   Close button
   -------------------------------------------------------------------------- */
.r-modal__close {
  position: absolute;
  top: 18px;
  right: 18px;
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  font-size: 18px;
  color: var(--r-cream-dim);
  background: transparent;
  border: 1px solid rgba(212, 160, 92, 0.25);
  border-radius: 50%;
  transition: all 200ms ease;
  z-index: 2;
}
.r-modal__close:hover {
  color: var(--r-cream);
  border-color: var(--r-gold);
  transform: rotate(90deg);
}

/* --------------------------------------------------------------------------
   Top hairline ornament — animated with a center-out reveal
   -------------------------------------------------------------------------- */
.r-modal__rule {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin: 0 auto 18px;
  width: 70%;

  opacity: 0;
  transition: opacity 500ms var(--r-easing-settle) 380ms;
}
.r-modal.is-shown .r-modal__rule { opacity: 1; }

.r-modal__rule-line {
  flex: 1;
  height: 1px;
  background: linear-gradient(
    var(--dir, 90deg),
    transparent 0%,
    rgba(212, 160, 92, 0.6) 100%
  );
  transform: scaleX(0);
  transform-origin: var(--origin, right);
  transition: transform 800ms var(--r-easing-rise) 380ms;
}
.r-modal__rule-line--right {
  --dir: -90deg;
  --origin: left;
}
.r-modal.is-shown .r-modal__rule-line { transform: scaleX(1); }

.r-modal__rule-dot {
  width: 5px; height: 5px;
  border-radius: 50%;
  background: var(--r-gold);
  box-shadow: 0 0 8px rgba(212, 160, 92, 0.6);

  opacity: 0;
  transform: scale(0);
  transition:
    opacity 400ms ease 700ms,
    transform 400ms var(--r-easing-settle) 700ms;
}
.r-modal.is-shown .r-modal__rule-dot {
  opacity: 1;
  transform: scale(1);
}

/* --------------------------------------------------------------------------
   Title — bilingual, serif, generous letter-spacing
   -------------------------------------------------------------------------- */
.r-modal__title {
  font-family: "Cormorant Garamond", "Noto Serif SC", serif;
  font-weight: 500;
  font-size: 38px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--r-cream);
  margin: 0 0 6px;
  line-height: 1.1;

  opacity: 0;
  transform: translateY(14px);
  transition:
    opacity 600ms var(--r-easing-settle) 460ms,
    transform 700ms var(--r-easing-settle) 460ms;
}
.r-modal.is-shown .r-modal__title {
  opacity: 1;
  transform: translateY(0);
}

.r-modal__title-zh {
  display: block;
  font-family: "Noto Serif SC", "Cormorant Garamond", serif;
  font-size: 18px;
  letter-spacing: 0.5em;
  font-weight: 400;
  color: var(--r-gold);
  margin-top: 4px;
  margin-left: 0.5em; /* compensate for letter-spacing visual offset */
  margin-bottom: 26px;

  opacity: 0;
  transform: translateY(10px);
  transition:
    opacity 500ms var(--r-easing-settle) 540ms,
    transform 600ms var(--r-easing-settle) 540ms;
}
.r-modal.is-shown .r-modal__title-zh {
  opacity: 1;
  transform: translateY(0);
}

/* --------------------------------------------------------------------------
   Greeting / call-to-call
   -------------------------------------------------------------------------- */
.r-modal__greeting,
.r-modal__cta {
  font-family: "Cormorant Garamond", serif;
  font-style: italic;
  font-size: 18px;
  line-height: 1.5;
  color: var(--r-cream);
  margin: 0;
  opacity: 0;
  transform: translateY(8px);
  transition:
    opacity 500ms var(--r-easing-settle),
    transform 600ms var(--r-easing-settle);
}
.r-modal__greeting { transition-delay: 600ms; margin-bottom: 4px; }
.r-modal__cta      { transition-delay: 680ms; margin-bottom: 28px; color: var(--r-cream-dim); font-size: 14px; font-style: normal; letter-spacing: 0.04em; }

.r-modal.is-shown .r-modal__greeting,
.r-modal.is-shown .r-modal__cta {
  opacity: 1;
  transform: translateY(0);
}

/* --------------------------------------------------------------------------
   PHONE — the centerpiece. Bronze gold, tap-to-call, character-stagger reveal,
   plus a single shimmer pass after settle.
   -------------------------------------------------------------------------- */
.r-modal__phone {
  display: inline-block;
  position: relative;
  font-family: "Cormorant Garamond", "Times New Roman", serif;
  font-size: 52px;
  font-weight: 600;
  letter-spacing: 0.06em;
  color: var(--r-gold);
  margin: 0 0 32px;
  padding: 8px 0;
  text-decoration: none;
  white-space: nowrap;

  text-shadow: 0 0 30px rgba(212, 160, 92, 0.35);
  transition: text-shadow 300ms ease, transform 300ms var(--r-easing-settle);
}
.r-modal__phone:hover {
  text-shadow: 0 0 40px rgba(242, 208, 138, 0.6);
  transform: scale(1.02);
}

.r-modal__phone-digit {
  display: inline-block;
  opacity: 0;
  transform: translateY(20px) scale(0.85);
  transition:
    opacity 480ms var(--r-easing-settle),
    transform 600ms var(--r-easing-settle);
}
.r-modal.is-shown .r-modal__phone-digit {
  opacity: 1;
  transform: translateY(0) scale(1);
}

/* Each digit gets a delay via inline --i so they cascade in.
   Base delay 720ms + 50ms per index. */
.r-modal__phone-digit {
  transition-delay: calc(720ms + var(--i, 0) * 55ms);
}

/* SHIMMER — gold-on-gold sweep that runs once after digits settle.
   Uses background-clip:text so it brightens existing letters
   instead of being a separate layer. */
.r-modal__phone-shimmer {
  position: absolute;
  /* Match the parent's `padding: 8px 0` so the shimmer text aligns
     exactly with the digit text underneath — `inset: 0` would put
     the shimmer text 8px above the digits, giving a ghosted overlap. */
  inset: 8px 0;
  display: inline-block;
  background: linear-gradient(
    100deg,
    transparent 30%,
    rgba(255, 240, 200, 1) 48%,
    rgba(255, 248, 220, 1) 52%,
    transparent 70%
  );
  background-size: 200% 100%;
  background-position: 200% 0;
  -webkit-background-clip: text;
          background-clip: text;
  -webkit-text-fill-color: transparent;
          color: transparent;
  pointer-events: none;
  opacity: 0;
}
.r-modal.is-shown .r-modal__phone-shimmer {
  animation: phoneShimmer 1600ms ease 1500ms 1 forwards;
}
@keyframes phoneShimmer {
  0%   { opacity: 0;   background-position: 200% 0; }
  10%  { opacity: 1; }
  90%  { opacity: 1; }
  100% { opacity: 0;   background-position: -100% 0; }
}

/* The "tap to call" hint that pulses subtly under the phone */
.r-modal__hint {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  letter-spacing: 0.32em;
  text-transform: uppercase;
  color: var(--r-gold);
  margin: -18px 0 30px;
  opacity: 0;
  transform: translateY(8px);
  transition:
    opacity 500ms ease 1300ms,
    transform 500ms var(--r-easing-settle) 1300ms;
}
.r-modal.is-shown .r-modal__hint {
  opacity: 0.85;
  transform: translateY(0);
}
.r-modal__hint-icon {
  width: 12px; height: 12px;
  animation: ringPulse 2.4s ease-in-out infinite;
}
@keyframes ringPulse {
  0%, 100% { transform: rotate(0deg); }
  10%, 30% { transform: rotate(-12deg); }
  20%, 40% { transform: rotate(12deg); }
  50%      { transform: rotate(0deg); }
}

/* --------------------------------------------------------------------------
   Info rows — hours + address
   -------------------------------------------------------------------------- */
.r-modal__info {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  padding: 22px 0 0;
  border-top: 1px solid rgba(212, 160, 92, 0.18);

  opacity: 0;
  transform: translateY(10px);
  transition:
    opacity 500ms var(--r-easing-settle) 1100ms,
    transform 600ms var(--r-easing-settle) 1100ms;
}
.r-modal.is-shown .r-modal__info {
  opacity: 1;
  transform: translateY(0);
}

.r-modal__info-row {
  display: grid;
  grid-template-columns: 1fr auto 1.6fr;
  align-items: center;
  gap: 14px;
  font-size: 13px;
  line-height: 1.4;
}
.r-modal__info-label {
  text-align: right;
  font-size: 10px;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--r-gold);
  opacity: 0.85;
}
.r-modal__info-sep {
  width: 1px;
  height: 12px;
  background: rgba(212, 160, 92, 0.35);
}
.r-modal__info-value {
  text-align: left;
  color: var(--r-cream);
  font-family: "Cormorant Garamond", serif;
  font-size: 15px;
  font-style: italic;
}

/* --------------------------------------------------------------------------
   CLOSING animation — when .is-closing is on the dialog,
   we run the reveal in reverse (faster).
   -------------------------------------------------------------------------- */
.r-modal.is-closing .r-modal__panel {
  opacity: 0;
  transform: translateY(20px) scale(0.97);
  filter: blur(6px);
  transition:
    opacity 280ms ease,
    transform 320ms ease,
    filter 280ms ease;
}
.r-modal.is-closing .r-modal__backdrop {
  opacity: 0;
  transition: opacity 320ms ease;
}
.r-modal.is-closing .r-modal__lantern {
  opacity: 0;
  transition: opacity 240ms ease;
}

/* --------------------------------------------------------------------------
   Reduced motion — strip animations, keep states
   -------------------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  .r-modal *,
  .r-modal *::before,
  .r-modal *::after {
    transition-duration: 100ms !important;
    animation: none !important;
  }
}

/* --------------------------------------------------------------------------
   Responsive
   -------------------------------------------------------------------------- */
@media (max-width: 520px) {
  .r-modal__panel { padding: 44px 24px 32px; }
  .r-modal__title { font-size: 28px; }
  .r-modal__phone { font-size: 36px; letter-spacing: 0.04em; }
  .r-modal__info-row { grid-template-columns: 1fr; gap: 2px; text-align: center; }
  .r-modal__info-label { text-align: center; }
  .r-modal__info-sep { display: none; }
  .r-modal__info-value { text-align: center; }
}

/* ==========================================================================
   VARIATIONS — toggled by a class on .r-modal
   ========================================================================== */

/* --- Variation: "Scroll unfurl" — vertical reveal as if a paper unfurls --- */
.r-modal[data-variant="scroll"] .r-modal__panel {
  transform-origin: top center;
  transform: translateY(0) scaleY(0.05) scaleX(0.6);
  filter: blur(4px);
}
.r-modal[data-variant="scroll"].is-shown .r-modal__panel {
  transform: scaleY(1) scaleX(1);
}

/* --- Variation: "Ink bloom" — like ink hitting rice paper --- */
.r-modal[data-variant="ink"] .r-modal__panel {
  transform: scale(1.15);
  filter: blur(20px);
  opacity: 0;
}
.r-modal[data-variant="ink"].is-shown .r-modal__panel {
  transform: scale(1);
  filter: blur(0);
  opacity: 1;
  transition:
    opacity 700ms cubic-bezier(0.4, 0, 0.2, 1),
    transform 900ms cubic-bezier(0.34, 1.3, 0.64, 1),
    filter 700ms cubic-bezier(0.4, 0, 0.2, 1);
}

/* --- Accent palette: cream-on-burgundy --- */
.r-modal[data-accent="burgundy"] .r-modal__panel {
  background:
    linear-gradient(180deg,
      rgba(212, 160, 92, 0.08) 0%,
      rgba(34, 22, 15, 0.94) 42%,
      rgba(16, 10, 8, 0.98) 100%
    ),
    #1f1510;
  border-color: rgba(212, 160, 92, 0.34);
  box-shadow:
    0 0 0 1px rgba(212, 160, 92, 0.10),
    0 60px 100px -20px rgba(0, 0, 0, 0.86),
    0 0 76px rgba(92, 57, 31, 0.28);
}
.r-modal[data-accent="burgundy"] .r-modal__phone { color: var(--r-cream); }
/* --- Accent palette: pure cream --- */
.r-modal[data-accent="cream"] .r-modal__phone { color: var(--r-cream); }
.r-modal[data-accent="cream"] .r-modal__title-zh { color: var(--r-cream); }

/* --------------------------------------------------------------------------
   Address line — same treatment as the footer's .footer-address-link: the
   whole text + Google Maps pin is one link with a slow scale "breathing"
   pulse and a faint golden shimmer behind it. Reuses the existing
   `footer-address-pulse` / `footer-address-shimmer` keyframes (defined in
   css/style.css) so the two pulses stay in lockstep.
   -------------------------------------------------------------------------- */
.r-modal__address-link {
  display: inline-flex;
  align-items: center;
  gap: 0.4em;
  text-decoration: none;
  color: inherit;
  position: relative;
  transform-origin: 50% 50%;
  animation: footer-address-pulse 4.2s ease-in-out infinite;
  transition: filter 200ms ease;
  isolation: isolate;
}
.r-modal__address-link::before {
  content: "";
  position: absolute;
  inset: -0.4em -0.8em;
  z-index: -1;
  border-radius: 999px;
  background: radial-gradient(ellipse at center,
                rgba(212, 160, 92, 0.26),
                rgba(212, 160, 92, 0.08) 55%,
                transparent 75%);
  opacity: 0;
  filter: blur(3px);
  pointer-events: none;
  animation: footer-address-shimmer 4.2s ease-in-out infinite;
}
.r-modal__address-link:hover,
.r-modal__address-link:focus-visible {
  filter: brightness(1.15) drop-shadow(0 1px 4px rgba(234, 67, 53, 0.35));
}
.r-modal__address-pin { flex: 0 0 auto; line-height: 0; }

@media (prefers-reduced-motion: reduce) {
  .r-modal__address-link,
  .r-modal__address-link::before {
    animation: none;
  }
}
