/* ==========================================================================
   Timeless Beach Hotel — Bespoke Navigation
   Slim transparent bar  ->  condensing frosted bar on scroll
   Full-screen overlay menu with staggered links + hover image preview.
   ========================================================================== */

/* hide Palatio's native header + footer entirely (we render our own) */
body.tbh .top_panel.top_panel_default,
body.tbh .top_panel_default,
body.tbh .menu_mobile,
body.tbh .menu_mobile_overlay,
body.tbh .footer_wrap,
body.tbh .footer_default,
body.tbh .footer_custom,
body.tbh .sidebar.widget_area { display: none !important; }
/* full-width content once the sidebar is suppressed */
body.tbh .content_wrap > .content { width: 100% !important; float: none !important; }

/* ---------- Fixed bar ---------- */
.tbh-nav {
  position: fixed; inset: 0 0 auto 0; z-index: var(--tbh-z-nav);
  padding: var(--tbh-nav-pad) 0;
  color: var(--tbh-on-dark);
  transition: transform .5s var(--tbh-ease-luxe),
              background-color .5s var(--tbh-ease-luxe),
              backdrop-filter .5s, padding .5s var(--tbh-ease-luxe),
              box-shadow .5s, color .5s;
}
.tbh-nav__inner {
  width: min(100% - (var(--tbh-gutter) * 2), 1720px);
  margin-inline: auto;
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center;
}

/* scrolled state — frosted sand bar, dark ink text/logo */
.tbh-nav.is-scrolled {
  background: rgba(var(--tbh-on-dark-rgb),.82);
  backdrop-filter: saturate(140%) blur(14px);
  -webkit-backdrop-filter: saturate(140%) blur(14px);
  padding: clamp(.5rem, .9vw, .85rem) 0;
  color: var(--tbh-ink);
  box-shadow: 0 1px 0 var(--tbh-line), 0 18px 40px -34px rgba(var(--tbh-dark-rgb),.5);
}
/* hide on scroll-down, reveal on scroll-up */
.tbh-nav.is-hidden { transform: translateY(-105%); }
/* The overlay is the TOP layer; the bar sits beneath it while open (so the
   overlay's own × close + links receive clicks). The overlay carries its own
   centered logo, so the bar can hide cleanly underneath. */
.tbh-nav.is-open { color: var(--tbh-on-dark); background: transparent; backdrop-filter: none; box-shadow: none; }
/* While open, drop back to the unscrolled row geometry. The overlay's close
   button is positioned from --tbh-nav-pad / --tbh-nav-logo, so if the bar were
   still condensed the × would land where the burger no longer is. */
.tbh-nav.is-open { padding: var(--tbh-nav-pad) 0; }
.tbh-nav.is-open .tbh-nav__logo { height: var(--tbh-nav-logo); }

/* ---------- Brand / logo ---------- */
.tbh-nav__brand { justify-self: center; display: inline-flex; }
.tbh-nav__brand a { display: block; line-height: 0; position: relative; }
.tbh-nav__logo { height: clamp(44px, 4.4vw, 60px); width: auto; display: block; transition: opacity .45s var(--tbh-ease-luxe); }
.tbh-nav.is-scrolled .tbh-nav__logo { height: clamp(38px, 3.6vw, 50px); }
.tbh-nav__logo--dark { position: absolute; inset: 0; opacity: 0; }
.tbh-nav.is-scrolled .tbh-nav__logo--light { opacity: 0; }
.tbh-nav.is-scrolled .tbh-nav__logo--dark  { opacity: 1; }
.tbh-nav.is-open .tbh-nav__logo--light { opacity: 1; }
.tbh-nav.is-open .tbh-nav__logo--dark   { opacity: 0; }

/* ---------- Menu trigger (left) ---------- */
.tbh-nav__trigger {
  justify-self: start;
  display: inline-flex; align-items: center; gap: .8rem;
  background: none; border: 0; cursor: pointer; color: inherit;
  font-family: var(--tbh-font-display); font-weight: 500;
  letter-spacing: var(--tbh-track-wide); text-transform: uppercase; font-size: .76rem;
  padding: .4rem 0;
}
.tbh-burger { position: relative; width: 26px; height: 12px; flex: none; }
.tbh-burger span {
  position: absolute; left: 0; height: 1.5px; width: 100%; background: currentColor;
  transition: transform .5s var(--tbh-ease-luxe), width .4s var(--tbh-ease-luxe), opacity .3s;
}
.tbh-burger span:nth-child(1) { top: 0; }
.tbh-burger span:nth-child(2) { top: 5px; width: 70%; }
.tbh-burger span:nth-child(3) { top: 10px; }
.tbh-nav__trigger:hover .tbh-burger span:nth-child(2) { width: 100%; }
.tbh-nav__label-close { display: none; }
.tbh-nav.is-open .tbh-burger span:nth-child(1) { top: 5px; transform: rotate(45deg); }
.tbh-nav.is-open .tbh-burger span:nth-child(2) { opacity: 0; }
.tbh-nav.is-open .tbh-burger span:nth-child(3) { top: 5px; transform: rotate(-45deg); }
.tbh-nav.is-open .tbh-nav__label-open  { display: none; }
.tbh-nav.is-open .tbh-nav__label-close { display: inline; }

/* ---------- CTA (right) ---------- */
.tbh-nav__cta { justify-self: end; display: inline-flex; align-items: center; gap: 1.4rem; }
.tbh-nav__phone {
  font-family: var(--tbh-font-display); font-size: .78rem; letter-spacing: .12em;
  text-transform: uppercase; color: inherit; text-decoration: none; opacity: .85;
}
.tbh-nav__phone:hover { opacity: 1; color: var(--tbh-accent); }
/* frosted light bar: cyan is 1.68 on it, so use the deep cyan (5.59) */
.tbh-nav.is-scrolled .tbh-nav__phone:hover { color: var(--tbh-accent-deep); }
@media (max-width: 720px){ .tbh-nav__phone { display: none; } }

/* ---------- Reserve button (shared pill) ---------- */
.tbh-btn {
  --bg: var(--tbh-accent); --fg: var(--tbh-dark);
  position: relative; display: inline-flex; align-items: center; gap: .6em;
  font-family: var(--tbh-font-display); font-weight: 600; font-size: .78rem;
  letter-spacing: .16em; text-transform: uppercase; text-decoration: none;
  color: var(--fg); padding: .9em 1.7em; border-radius: var(--tbh-radius-pill);
  background: var(--bg); border: 1px solid var(--tbh-ink); overflow: hidden;
  transition: color .5s var(--tbh-ease-luxe), border-color .4s, transform .3s var(--tbh-ease-out);
  isolation: isolate;
}
.tbh-btn::before {
  content: ""; position: absolute; inset: 0; z-index: -1; border-radius: inherit;
  background: var(--tbh-ink);
  transform: translateY(101%); transition: transform .55s var(--tbh-ease-luxe);
}
.tbh-btn:hover { color: var(--tbh-on-dark); }
.tbh-btn:hover::before { transform: translateY(0); }
.tbh-btn--ghost {
  --bg: transparent; --fg: currentColor;
  border-color: currentColor;
}
.tbh-btn--ghost::before { background: var(--tbh-accent); }
.tbh-btn--ghost:hover { color: var(--tbh-dark); border-color: var(--tbh-accent); }
.tbh-btn--lg { padding: 1.15em 2.3em; font-size: .82rem; }

/* ---------- Full-screen overlay ---------- */
.tbh-overlay {
  position: fixed; inset: 0; z-index: var(--tbh-z-overlay);
  visibility: hidden; pointer-events: none;
  color: var(--tbh-on-dark);
}
.tbh-overlay.is-open { visibility: visible; pointer-events: auto; }
.tbh-overlay__bg {
  position: absolute; inset: 0;
  background:
    radial-gradient(120% 130% at 88% 8%, rgba(var(--tbh-accent-rgb),.18), transparent 46%),
    radial-gradient(120% 120% at 0% 100%, rgba(var(--tbh-ink-rgb),.42), transparent 55%),
    linear-gradient(180deg, #081F20, var(--tbh-dark) 60%, #123F40);
  clip-path: inset(0 0 100% 0);
  transition: clip-path .9s var(--tbh-ease-luxe);
}
.tbh-overlay.is-open .tbh-overlay__bg { clip-path: inset(0 0 0% 0); }
.tbh-overlay__grain {
  position: absolute; inset: 0; opacity: .05; pointer-events: none; mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='2'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

.tbh-overlay__inner {
  position: relative; height: 100%;
  width: min(100% - (var(--tbh-gutter) * 2), 1720px); margin-inline: auto;
  display: grid; grid-template-columns: 1.15fr 1fr;
  align-items: center; gap: clamp(2rem, 5vw, 6rem);
  padding: clamp(4.5rem, 8vh, 6rem) 0 clamp(4rem, 9vh, 5.5rem);
}

/* nav links */
.tbh-menu { list-style: none; margin: 0; padding: 0; }
.tbh-menu__item { overflow: hidden; }
.tbh-menu__link {
  display: flex; align-items: baseline; text-decoration: none;
  color: var(--tbh-on-dark); padding: clamp(.05rem,.3vh,.3rem) 0;
  font-family: var(--tbh-font-display); font-weight: 300;
  font-size: clamp(2.1rem, 1.2rem + 3.4vw, 4.4rem); line-height: 1.04;
  letter-spacing: -.01em; position: relative; width: max-content; max-width: 100%;
  transition: color .4s var(--tbh-ease-luxe), padding-left .5s var(--tbh-ease-luxe);
}
.tbh-menu__link::after {
  content: ""; position: absolute; left: 0; bottom: .18em; height: 1px; width: 0;
  background: var(--tbh-accent); transition: width .5s var(--tbh-ease-luxe);
}
.tbh-menu__link:hover { color: var(--tbh-accent-glow); padding-left: .9rem; }
.tbh-menu__link:hover::after { width: 100%; }
/* dim siblings on hover for focus */
.tbh-menu:hover .tbh-menu__link { color: var(--tbh-on-dark-faint); }
.tbh-menu:hover .tbh-menu__item:hover .tbh-menu__link { color: var(--tbh-accent-glow); }

/* media preview panel — height-capped so it never forces a tall row that
   pushes the menu links down */
.tbh-overlay__media {
  position: relative; aspect-ratio: 4 / 5; height: min(62vh, 600px); width: auto;
  justify-self: end; max-width: 100%; border-radius: var(--tbh-radius-lg);
  overflow: hidden; box-shadow: var(--tbh-shadow-lift);
  background: #14494A;
  /* sit the panel above the menu's optical centre — with align-items:center a
     negative top margin shifts the box up by half its value */
  margin-top: clamp(-110px, -10vh, -50px);
}
/* <figure> inherits a 1em bottom margin from the parent theme. With
   `inset: 0` on an absolutely positioned box that margin shrinks the used
   height, leaving a 17px band of the panel's own background showing under the
   photo. Reset it. */
.tbh-overlay__fig { position: absolute; inset: 0; margin: 0; opacity: 0; transition: opacity .7s var(--tbh-ease-luxe); }
.tbh-overlay__fig.is-active { opacity: 1; }
.tbh-overlay__fig img { width: 100%; height: 100%; object-fit: cover; transform: scale(1.04); transition: transform 1.2s var(--tbh-ease-luxe); }
.tbh-overlay__fig.is-active img { transform: scale(1); }
.tbh-overlay__media::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(180deg, transparent 55%, rgba(var(--tbh-scrim-rgb),.55));
}
.tbh-overlay__cap {
  position: absolute; left: 1.4rem; bottom: 1.2rem; z-index: 2;
  font-family: var(--tbh-font-display); letter-spacing: .16em; text-transform: uppercase;
  font-size: .72rem; color: var(--tbh-on-dark); opacity: .9;
}

/* foot row: contact + socials + reserve */
.tbh-overlay__foot {
  position: absolute; left: 0; right: 0; bottom: clamp(1.4rem, 4vh, 2.6rem);
  width: min(100% - (var(--tbh-gutter) * 2), 1720px); margin-inline: auto;
  display: flex; flex-wrap: wrap; gap: 1.2rem 2.4rem; align-items: center;
  justify-content: space-between;
  border-top: 1px solid var(--tbh-line-dark); padding-top: clamp(1rem,2.2vh,1.6rem);
  font-size: .82rem;
}
.tbh-overlay__contact { display: flex; flex-wrap: wrap; gap: .4rem 2.2rem; color: var(--tbh-on-dark-soft); }
.tbh-overlay__contact a { color: inherit; text-decoration: none; transition: color .3s; }
.tbh-overlay__contact a:hover { color: var(--tbh-accent); }
.tbh-overlay__social { display: flex; gap: 1.5rem; }
.tbh-overlay__social a {
  color: var(--tbh-on-dark-soft); text-decoration: none; font-family: var(--tbh-font-display);
  letter-spacing: .14em; text-transform: uppercase; font-size: .72rem; transition: color .3s;
}
.tbh-overlay__social a:hover { color: var(--tbh-accent); }

/* centered brand logo inside the overlay (mirrors the bar, which is hidden beneath) */
.tbh-overlay__brand {
  position: absolute; top: clamp(.85rem, 1.4vw, 1.5rem); left: 50%; transform: translateX(-50%) translateY(-8px);
  z-index: 3; line-height: 0; opacity: 0; transition: opacity .5s var(--tbh-ease-luxe) .35s, transform .5s var(--tbh-ease-luxe) .35s;
}
.tbh-overlay.is-open .tbh-overlay__brand { opacity: 1; transform: translateX(-50%) translateY(0); }
.tbh-overlay__brand img { height: clamp(44px, 4.4vw, 60px); width: auto; display: block; }

/* close (×) button — top-LEFT, directly over the Menu trigger it replaces.
   `left` is matched to the nav bar's own inner edge (which is capped at 1720px
   and centred) so the × lands exactly where the burger was, not merely at the
   page gutter. */
.tbh-overlay__close {
  position: absolute; top: var(--tbh-nav-pad); height: var(--tbh-nav-logo);
  left: max(var(--tbh-gutter), calc((100% - 1720px) / 2)); z-index: 3;
  display: inline-flex; align-items: center; gap: .75rem;
  background: none; border: 0; cursor: pointer; color: var(--tbh-on-dark);
  font-family: var(--tbh-font-display); font-weight: 500; letter-spacing: var(--tbh-track-wide);
  text-transform: uppercase; font-size: .72rem;
  opacity: 0; transform: translateY(-8px); transition: opacity .5s var(--tbh-ease-luxe) .4s, transform .5s var(--tbh-ease-luxe) .4s, color .3s;
}
.tbh-overlay.is-open .tbh-overlay__close { opacity: 1; transform: translateY(0); }
.tbh-overlay__close:hover { color: var(--tbh-accent); }
.tbh-overlay__close-x { position: relative; width: 22px; height: 22px; flex: none; }
.tbh-overlay__close-x::before, .tbh-overlay__close-x::after {
  content: ""; position: absolute; top: 50%; left: 0; width: 100%; height: 1.5px;
  background: currentColor; transition: transform .4s var(--tbh-ease-luxe);
}
.tbh-overlay__close-x::before { transform: rotate(45deg); }
.tbh-overlay__close-x::after { transform: rotate(-45deg); }
.tbh-overlay__close:hover .tbh-overlay__close-x::before { transform: rotate(135deg); }
.tbh-overlay__close:hover .tbh-overlay__close-x::after { transform: rotate(45deg); }
@media (max-width: 560px) { .tbh-overlay__close-label { display: none; } }

/* ---------- responsive ---------- */
@media (max-width: 960px) {
  .tbh-overlay__inner { grid-template-columns: 1fr; align-content: center; gap: 1.5rem; padding-top: 6.5rem; }
  .tbh-overlay__media { display: none; }
  .tbh-menu__link { font-size: clamp(1.9rem, 8vw, 3rem); }
}
@media (max-width: 560px) {
  .tbh-nav__trigger .tbh-nav__label-open,
  .tbh-nav__trigger .tbh-nav__label-close { display: none; }
  .tbh-overlay__foot { font-size: .76rem; gap: .8rem 1.4rem; }
  .tbh-overlay__social { gap: 1rem; }
}

/* ==========================================================================
   OVERLAY CHOREOGRAPHY
   The background is a 0.9s CSS clip-path wipe while the menu items started at
   0.18s via GSAP — so the text overtook the curtain on open, and on close the
   overlay's visibility was killed at 0.55s before the curtain could wipe back.
   When GSAP is driving (html.tbh-gsap) the transition is handed over to the
   timeline so both are sequenced from one clock.
   ========================================================================== */
html.tbh-gsap .tbh-overlay__bg { transition: none; }

/* The centred logo and the × were also outside the timeline: CSS transitions
   keyed to `is-open`, with a .35s/.4s delay. Since `is-open` is only dropped at
   the END of the close, both sat at opacity 1 through the whole retraction —
   left stranded on the bare page — then snapped out with `visibility:hidden`.
   Hand them to GSAP too; the CSS below stays as the no-GSAP fallback. */
html.tbh-gsap .tbh-overlay__brand,
html.tbh-gsap .tbh-overlay__close { transition: color .3s; }

/* ==========================================================================
   PAGE TRANSITION VEIL
   One continuous upward sweep across a navigation:
     leaving  — veil rises from the bottom to cover
     arriving — veil keeps rising, uncovering the new page
   Resting state is collapsed at the bottom, ready to rise again.
   ========================================================================== */
.tbh-veil {
  position: fixed; inset: 0; z-index: var(--tbh-z-veil);
  pointer-events: none;
  background: linear-gradient(180deg, #081F20 0%, var(--tbh-dark) 55%, #123F40 100%);
  clip-path: inset(100% 0 0 0);
  display: grid; place-items: center;
  will-change: clip-path;
}
.tbh-veil__mark {
  opacity: 0; transform: translateY(10px) scale(.98);
  transition: opacity .45s var(--tbh-ease-luxe), transform .45s var(--tbh-ease-luxe);
}
.tbh-veil__mark img { height: clamp(58px, 8vw, 84px); width: auto; display: block; }
.tbh-veil.is-covering .tbh-veil__mark { opacity: 1; transform: none; }

/* set from the critical head script when we arrived via a transition, so the
   veil is already covering at first paint and the new page never flashes */
html.tbh-veiled .tbh-veil { clip-path: inset(0 0 0 0); }
/* ...and the mark stays lit across the navigation boundary. Without this it
   reverts to its opacity:0 default on the incoming page and JS fades it back
   in — which read as a blink. Declared again here (it is also inlined in the
   critical CSS) so the rule survives if the head style is ever trimmed. */
html.tbh-veiled .tbh-veil__mark { opacity: 1; transform: none; }
html.tbh-revealing .tbh-veil__mark { opacity: 0; transform: translateY(-8px); }

/* the custom cursor sits at z-index 4000, above the veil's 3500 — it would
   ride on top of the transition. Hide it while a transition is running. */
html.tbh-leaving .tbh-cursor,
html.tbh-veiled .tbh-cursor { opacity: 0 !important; transition: opacity .2s linear; }

@media (prefers-reduced-motion: reduce) {
  .tbh-veil { display: none !important; }
}
