/*
 * Site menu — the right-hand panel opened by the KT logo button.
 *
 * Geometry is authored at 1280×720 and multiplied by --menu-u:
 *   - 1px at ≤1280 wide, growing with the width to 1.5px at 1920 (capped);
 *   - 2160p band (3200–4400 × 1800–2500): the full 1280×720 scale, with
 *     hairlines and shadows (--menu-fx) scaled as well.
 * Between those, ≥1921×1081 screens only enlarge the type (site-wide
 * high-res type scale).
 *
 * State: body.is-menu-open (set by menu.js).
 */

:root {
  --menu-u: clamp(1px, calc(100vw / 1280), 1.5px);
  --menu-fx: 1px;
  --menu-link-size: calc(14.5 * var(--menu-u));
  --menu-small-size: calc(9 * var(--menu-u));
  --menu-ease: cubic-bezier(0.22, 0.61, 0.36, 1);
  --menu-slide-ease: cubic-bezier(0.18, 0.82, 0.22, 1);
  --menu-reveal-ease: cubic-bezier(0.14, 0.9, 0.18, 1);
}

/* ----- Backdrop ----- */

.site-menu-backdrop {
  position: fixed;
  inset: 0;
  z-index: 2147481000;
  background: rgb(12 9 6 / 0.52);
  opacity: 0;
  /* Outside clicks are handled by menu.js, so the backdrop never blocks. */
  pointer-events: none;
  transition: opacity 260ms var(--menu-ease);
}

body.is-menu-open .site-menu-backdrop {
  opacity: 1;
}

/* ----- Panel ----- */

.site-menu {
  position: fixed;
  top: 0;
  right: 0;
  z-index: 2147481001;
  box-sizing: border-box;
  width: calc(376 * var(--menu-u));
  height: 100svh;
  overflow: hidden;
  visibility: hidden;
  pointer-events: none;
  background: rgb(10 10 10 / 0.02);
  border-left: var(--menu-fx) solid rgb(255 255 255 / 0.06);
  box-shadow: calc(-30 * var(--menu-fx)) 0 calc(90 * var(--menu-fx)) rgb(0 0 0 / 0.55);
  transform: translate3d(108%, 0, 0) scaleX(0.982);
  transform-origin: right center;
  backface-visibility: hidden;
  will-change: transform;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  transition: transform 460ms var(--menu-slide-ease), visibility 0s linear 460ms;
}

body.is-menu-open .site-menu {
  visibility: visible;
  pointer-events: auto;
  transform: translate3d(0, 0, 0) scaleX(1);
  transition: transform 460ms var(--menu-slide-ease), visibility 0s;
}

/* Stone texture (only while open) under a warm darkening wash. */
.site-menu::before,
.site-menu::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
}

body.is-menu-open .site-menu::before {
  background: url("../../images/002-dt-stone.webp") center / cover no-repeat;
  opacity: 0.37;
}

.site-menu::after {
  background:
    linear-gradient(180deg, rgb(10 8 6 / 0.3), rgb(10 8 6 / 0.68)),
    linear-gradient(90deg, rgb(255 244 228 / 0.014), rgb(255 255 255 / 0.006)),
    radial-gradient(circle at 0% 16%, rgb(198 139 58 / 0.04), transparent 44%);
}

body.is-menu-open .site-menu::after {
  animation: site-menu-warmth 820ms var(--menu-slide-ease) 80ms both;
}

.site-menu > * {
  position: relative;
  z-index: 1;
}

.site-menu__nav {
  position: relative;
  box-sizing: border-box;
  height: 100%;
  min-height: 0;
  padding: calc(22 * var(--menu-u)) calc(20 * var(--menu-u)) calc(20 * var(--menu-u));
  display: flex;
  flex-direction: column;
  gap: calc(10 * var(--menu-u));
  overflow: hidden auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-y;
  scrollbar-width: thin;
  scrollbar-color: rgb(255 255 255 / 0.12) transparent;
}

/* Items keep their size so short viewports scroll the list instead. */
.site-menu__nav > * {
  flex-shrink: 0;
}

.site-menu__nav::-webkit-scrollbar { width: calc(6 * var(--menu-fx)); }
.site-menu__nav::-webkit-scrollbar-track { background: transparent; }
.site-menu__nav::-webkit-scrollbar-thumb {
  background: rgb(255 255 255 / 0.12);
  border-radius: 999px;
}

.site-menu__top {
  box-sizing: border-box;
  height: calc(44 * var(--menu-u));
  margin-bottom: calc(2 * var(--menu-u));
  border-bottom: var(--menu-fx) solid rgb(255 255 255 / 0.09);
}

.site-menu__item--enquire {
  margin-bottom: calc(18 * var(--menu-u));
}

.site-menu__item--feature {
  margin-top: calc(18 * var(--menu-u));
}

.site-menu__foot {
  margin-top: auto;
  padding-top: calc(20 * var(--menu-u));
}

/* ----- Links ----- */

.site-menu__link {
  --link-shadow:
    inset 0 var(--menu-fx) 0 rgb(255 255 255 / 0.02),
    inset 0 0 0 var(--menu-fx) rgb(255 255 255 / 0.012);
  position: relative;
  box-sizing: border-box;
  display: flex;
  align-items: center;
  flex-wrap: nowrap;
  gap: calc(14 * var(--menu-u));
  overflow: hidden;
  white-space: nowrap;
  padding: calc(12 * var(--menu-u)) calc(28 * var(--menu-u)) calc(12 * var(--menu-u)) calc(14 * var(--menu-u));
  border: var(--menu-fx) solid rgb(255 255 255 / 0.065);
  border-radius: calc(11 * var(--menu-u));
  background: linear-gradient(180deg, rgb(255 255 255 / 0.016), rgb(255 255 255 / 0.009));
  box-shadow: var(--link-shadow);
  color: rgb(255 255 255 / 0.88);
  font-family: var(--font-sans);
  font-size: var(--menu-link-size);
  font-weight: 500;
  letter-spacing: 0.16em;
  line-height: 1;
  text-decoration: none;
  text-transform: uppercase;
  /* Closed: compressed, blurred and shifted left; opening resolves them. */
  opacity: 0;
  transform: translate3d(-38px, 0, 0) scaleX(0.62);
  transform-origin: left center;
  filter: blur(2.5px);
  transition:
    opacity 300ms ease,
    transform 640ms cubic-bezier(0.14, 0.92, 0.18, 1),
    filter 460ms ease,
    background 220ms var(--menu-ease),
    border-color 220ms var(--menu-ease),
    box-shadow 220ms var(--menu-ease),
    color 220ms var(--menu-ease);
}

body.is-menu-open .site-menu__link {
  opacity: 1;
  transform: none;
  filter: none;
}

.site-menu__group .site-menu__link + .site-menu__link {
  margin-top: calc(6 * var(--menu-u));
}

.site-menu__link--enquire {
  --link-shadow:
    inset 0 var(--menu-fx) 0 rgb(255 226 165 / 0.12),
    inset 0 0 0 var(--menu-fx) rgb(200 160 95 / 0.14),
    0 0 0 var(--menu-fx) rgb(12 7 4 / 0.92),
    0 calc(8 * var(--menu-fx)) calc(22 * var(--menu-fx)) rgb(0 0 0 / 0.28);
  border: var(--enquire-border, 1.5px) solid rgb(16 9 5);
  background:
    linear-gradient(180deg, rgb(200 160 95 / 0.42), rgb(200 160 95 / 0.22)),
    rgb(28 20 12 / 0.78);
  color: rgb(255 244 220 / 0.96);
  font-weight: 600;
  letter-spacing: 0.18em;
}

.site-menu__link--feature {
  --link-shadow:
    inset 0 var(--menu-fx) 0 rgb(255 226 165 / 0.08),
    inset 0 0 0 var(--menu-fx) rgb(200 160 95 / 0.14),
    0 calc(8 * var(--menu-fx)) calc(22 * var(--menu-fx)) rgb(0 0 0 / 0.28);
  border-color: rgb(200 160 95 / 0.52);
  background:
    linear-gradient(180deg, rgb(222 150 68 / 0.16), rgb(222 150 68 / 0.05)),
    rgb(14 10 8 / 0.84);
  color: rgb(255 244 220 / 0.94);
}

/* Hover hint that slides out beside the label (other pages). */
.site-menu__meta {
  display: inline-flex;
  align-items: center;
  margin-left: calc(6 * var(--menu-u));
  max-width: 0;
  overflow: hidden;
  white-space: nowrap;
  opacity: 0;
  color: rgb(255 255 255 / 0.62);
  font-size: 0.9em;
  letter-spacing: 0.08em;
  text-transform: none;
  transform: translateX(calc(-6 * var(--menu-fx)));
  transition: opacity 0.2s ease, transform 0.2s ease, max-width 0.25s ease;
}

.site-menu__link:hover .site-menu__meta {
  max-width: 360px;
  opacity: 0.65;
  transform: translateX(0);
}

.site-menu__link--enquire:hover {
  color: rgb(255 248 232 / 0.98);
  background:
    linear-gradient(180deg, rgb(200 160 95 / 0.5), rgb(200 160 95 / 0.3)),
    rgb(32 22 14 / 0.84);
}

.site-menu__link--feature:hover {
  color: rgb(255 248 232 / 0.98);
  background:
    linear-gradient(180deg, rgb(222 150 68 / 0.22), rgb(222 150 68 / 0.08)),
    rgb(18 12 8 / 0.9);
}

.site-menu__link:focus-visible {
  outline: none;
  border-color: rgb(214 171 102 / 0.4);
  box-shadow: inset 0 0 0 1px rgb(214 171 102 / 0.14), 0 0 0 2px rgb(214 171 102 / 0.14);
}

/* Current section / page: brighter frame and a green status dot. */
.site-menu__link.is-active {
  border-color: rgb(255 255 255 / 0.14);
  background: linear-gradient(180deg, rgb(255 255 255 / 0.032), var(--group-active, rgb(255 255 255 / 0.05)));
  box-shadow: inset 0 0 0 1px rgb(255 255 255 / 0.018), 0 0 0 1px rgb(255 255 255 / 0.015);
}

.site-menu__link.is-active::before {
  content: "";
  position: absolute;
  right: calc(14 * var(--menu-u));
  top: 50%;
  width: calc(6 * var(--menu-u));
  height: calc(6 * var(--menu-u));
  border-radius: 50%;
  background: #2ecc71;
  box-shadow: 0 0 calc(6 * var(--menu-fx)) rgb(46 204 113 / 0.6);
  transform: translateY(-50%);
  pointer-events: none;
}

/* Hover inside the navigation group outranks the active state. */
.site-menu__group .site-menu__link:hover {
  border-color: rgb(255 255 255 / 0.12);
  background: linear-gradient(180deg, rgb(255 255 255 / 0.026), rgb(172 150 118 / 0.28));
  box-shadow: inset 0 1px 0 rgb(255 255 255 / 0.026), inset 0 0 0 1px rgb(255 255 255 / 0.012);
}

/* Keyboard focus: a gold ring drawn inside the link (the group clips its
   overflow). Outline is untouched by the hover and active states, so the
   ring stays visible over both without altering size or layout. */
.site-menu__link:focus-visible,
.site-menu__link.is-active:focus-visible {
  outline: max(1.5px, calc(2 * var(--menu-fx))) solid rgb(228 189 116 / 0.9);
  outline-offset: calc(-3 * var(--menu-fx));
}

/* Opened with the pointer: no ring on the link focused for it until a key
   is pressed (js/components/menu.js). */
.site-menu[data-pointer-open] .site-menu__link:focus-visible {
  outline: none;
}

/* ----- Navigation group (frosted glass card) ----- */

.site-menu__group {
  --group-active: rgb(186 168 138 / 0.1);
  --group-radius: calc(16 * var(--menu-u));
  position: relative;
  box-sizing: border-box;
  padding: calc(9 * var(--menu-u));
  overflow: hidden;
  border: var(--menu-fx) solid rgb(168 146 116 / 0.12);
  border-radius: var(--group-radius);
  background: linear-gradient(180deg, rgb(108 98 86 / 0.16), rgb(58 52 46 / 0.2));
  box-shadow:
    inset 0 var(--menu-fx) 0 rgb(255 255 255 / 0.04),
    inset 0 calc(-1 * var(--menu-fx)) 0 rgb(255 255 255 / 0.02),
    0 calc(10 * var(--menu-fx)) calc(26 * var(--menu-fx)) rgb(0 0 0 / 0.14);
  backdrop-filter: blur(calc(12 * var(--menu-fx))) saturate(110%);
  -webkit-backdrop-filter: blur(calc(12 * var(--menu-fx))) saturate(110%);
  /* Closed: wiped away to the left; it snaps back instantly when closing. */
  clip-path: inset(0 100% 0 0 round var(--group-radius));
}

body.is-menu-open .site-menu__group {
  clip-path: inset(0 0 0 0 round var(--group-radius));
  transition: clip-path 690ms var(--menu-reveal-ease);
}

.site-menu__group::before,
.site-menu__group::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
}

.site-menu__group::before {
  background: linear-gradient(180deg, rgb(255 248 235 / 0.03), rgb(255 255 255 / 0.01));
}

.site-menu__group::after {
  background: radial-gradient(120% 90% at 0% 0%, rgb(176 148 108 / 0.24), transparent 58%);
  opacity: 0.9;
}

.site-menu__group > * {
  position: relative;
  z-index: 1;
}

.site-menu__label {
  display: block;
  margin: 0 0 calc(10 * var(--menu-u));
  padding: 0;
  color: rgb(255 255 255 / 0.58);
  font-family: var(--font-sans);
  font-size: var(--menu-small-size);
  font-weight: 600;
  letter-spacing: 0.22em;
  line-height: 1;
  text-align: center;
  text-transform: uppercase;
  pointer-events: none;
  user-select: none;
}

.site-menu__label::before,
.site-menu__label::after {
  content: "";
  display: inline-block;
  vertical-align: middle;
  width: calc(18 * var(--menu-u));
  height: var(--menu-fx);
  margin: 0 calc(8 * var(--menu-u));
  border-radius: 999px;
  background: rgb(255 255 255 / 0.14);
}

/* ----- Foot ----- */

.site-menu__rule {
  height: var(--menu-fx);
  background: linear-gradient(to right, transparent, rgb(255 255 255 / 0.18), transparent);
  opacity: 0.82;
}

.site-menu__footnote {
  margin-top: calc(10 * var(--menu-u));
  color: rgb(255 255 255 / 0.4);
  font-family: var(--font-sans);
  font-size: var(--menu-small-size);
  letter-spacing: 0.18em;
  text-align: center;
  text-transform: uppercase;
}

@keyframes site-menu-warmth {
  0% {
    background:
      linear-gradient(180deg, rgb(7 8 10 / 0.38), rgb(7 8 10 / 0.78)),
      linear-gradient(90deg, rgb(255 255 255 / 0.012), rgb(255 255 255 / 0.003)),
      radial-gradient(circle at -8% 16%, rgb(198 139 58 / 0), transparent 42%);
  }
  46% {
    background:
      linear-gradient(180deg, rgb(7 8 10 / 0.29), rgb(7 8 10 / 0.68)),
      linear-gradient(90deg, rgb(255 255 255 / 0.034), rgb(255 255 255 / 0.007)),
      radial-gradient(circle at 0% 16%, rgb(198 139 58 / 0.15), transparent 47%);
  }
  100% {
    background:
      linear-gradient(180deg, rgb(7 8 10 / 0.32), rgb(7 8 10 / 0.72)),
      linear-gradient(90deg, rgb(255 255 255 / 0.024), rgb(255 255 255 / 0.005)),
      radial-gradient(circle at 0% 16%, rgb(198 139 58 / 0.055), transparent 44%);
  }
}

/* ----- Responsive ----- */

/* Mobile landscape (and compact touch landscape): the short panel scrolls. */
@media (max-width: 900px) and (orientation: landscape),
       (pointer: coarse) and (orientation: landscape) and (min-width: 1100px) and (max-width: 1180px) and (max-height: 780px) {
  .site-menu {
    height: 100dvh;
    max-height: 100dvh;
  }

  .site-menu__nav {
    max-height: 100%;
    padding-bottom: calc(20 * var(--menu-u) + env(safe-area-inset-bottom, 0px));
  }
}

/* Homepage on phones/tablets: no backdrop blur (scrolling performance). */
@media (max-width: 767px), (min-width: 768px) and (max-width: 1180px), (pointer: coarse) and (min-width: 768px) {
  body:has(.site-header--home) .site-menu__group {
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
  }
}

/* ≥1921×1081: type follows the site-wide high-res scale. */
@media (min-width: 1921px) and (min-height: 1081px) {
  :root {
    --menu-link-size: clamp(21.75px, min(1.132813vw, 2.013889vh), 29.36px);
    --menu-small-size: clamp(13.5px, min(0.703125vw, 1.25vh), 20.925px);
  }
}

/* 2160p band: the complete 1280×720 panel, magnified. */
@media (min-width: 3200px) and (max-width: 4400px) and (min-height: 1800px) and (max-height: 2500px) {
  :root {
    --menu-u: min(calc(100vw / 1280), calc(100vh / 720));
    --menu-fx: var(--menu-u);
    --menu-link-size: calc(14.5 * var(--menu-u));
    --menu-small-size: calc(9 * var(--menu-u));
    --enquire-border: var(--menu-u);
  }
}
