/* ==========================================================================
   EMBER & OLIVE — components: buttons, header, mobile menu, lightbox
   ========================================================================== */

/* --------------------------------------------------------------------------
   Buttons
   -------------------------------------------------------------------------- */

.btn {
  --bg: var(--terra);
  --fg: var(--cream);
  --bg-hover: var(--olive);
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.9em;
  min-height: 54px;
  padding: 0.95em 1.75em;
  background: var(--bg);
  color: var(--fg);
  border: 1px solid var(--bg);
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  line-height: 1;
  white-space: nowrap;
  overflow: hidden;
  isolation: isolate;
  transition: color 0.4s var(--ease), border-color 0.4s var(--ease);
}

.btn::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: var(--bg-hover);
  transform: scaleY(0);
  transform-origin: bottom;
  transition: transform 0.5s var(--ease);
}

.btn:hover::before,
.btn:focus-visible::before {
  transform: scaleY(1);
}

.btn:hover,
.btn:focus-visible {
  border-color: var(--bg-hover);
  color: var(--cream);
}

.btn svg {
  width: 16px;
  height: 16px;
  flex: none;
  transition: transform 0.45s var(--ease);
}

.btn:hover svg,
.btn:focus-visible svg {
  transform: translateX(4px);
}

.btn--ghost {
  --bg: transparent;
  --fg: currentColor;
  --bg-hover: var(--cream);
  border-color: currentColor;
}

.btn--ghost:hover,
.btn--ghost:focus-visible {
  color: var(--ink);
  border-color: var(--cream);
}

.btn--olive {
  --bg: var(--olive);
  --bg-hover: var(--terra);
}

.btn--cream {
  --bg: var(--cream);
  --fg: var(--ink);
  --bg-hover: var(--terra);
}

.btn--sm {
  min-height: 44px;
  padding: 0.8em 1.35em;
  font-size: 0.72rem;
}

.btn--lg {
  min-height: 64px;
  padding-inline: 2.3em;
  font-size: 0.82rem;
}

.link-arrow {
  display: inline-flex;
  align-items: center;
  gap: 0.75em;
  padding-block: 0.5em;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: inherit;
  background: linear-gradient(currentColor, currentColor) left bottom / 100% 1px no-repeat;
  transition: color 0.3s var(--ease), background-size 0.5s var(--ease);
}

.link-arrow svg {
  width: 15px;
  height: 15px;
  transition: transform 0.45s var(--ease);
}

.link-arrow:hover,
.link-arrow:focus-visible {
  color: var(--terra);
  background-size: 40% 1px;
}

.on-dark .link-arrow:hover,
.on-dark .link-arrow:focus-visible {
  color: var(--terra-lt);
}

.link-arrow:hover svg,
.link-arrow:focus-visible svg {
  transform: translateX(5px);
}

/* --------------------------------------------------------------------------
   Header: transparent over the hero, cream once scrolled
   -------------------------------------------------------------------------- */

.site-header {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 60;
  padding-block: 24px;
  color: var(--cream);
  border-bottom: 1px solid transparent;
  transition: padding 0.5s var(--ease), background-color 0.5s var(--ease), color 0.4s var(--ease),
    border-color 0.5s var(--ease);
}

.site-header.is-scrolled,
[data-header="solid"] .site-header,
.menu-open .site-header {
  color: var(--ink);
}

.site-header.is-scrolled,
[data-header="solid"] .site-header {
  padding-block: 14px;
  background: rgba(246, 240, 228, 0.95);
  border-bottom-color: var(--line);
}

.menu-open .site-header {
  background: transparent;
  border-bottom-color: transparent;
}

.site-header__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 2rem;
}

.logo {
  position: relative;
  z-index: 2;
  display: inline-flex;
  align-items: baseline;
  gap: 0.5em;
  font-family: var(--font-serif);
  font-size: 1.28rem;
  font-weight: 400;
  letter-spacing: 0.22em;
  line-height: 1;
  white-space: nowrap;
}

.logo i {
  font-size: 1.45em;
  font-weight: 300;
  letter-spacing: 0;
  color: var(--terra-lt);
  transform: translateY(0.04em);
  transition: color 0.4s var(--ease), transform 0.6s var(--ease);
}

.site-header.is-scrolled .logo i,
[data-header="solid"] .logo i,
.footer .logo i {
  color: var(--terra);
}

.footer .logo i {
  color: var(--terra-lt);
}

.logo:hover i {
  transform: translateY(0.04em) rotate(-8deg);
}

.nav {
  display: none;
}

.nav__list {
  display: flex;
  align-items: center;
  gap: clamp(1.6rem, 3vw, 3.2rem);
}

.nav__link {
  position: relative;
  display: inline-block;
  padding-block: 0.6em;
  font-size: 0.78rem;
  font-weight: 500;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: inherit;
  opacity: 0.86;
  transition: opacity 0.3s var(--ease);
}

.nav__link::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: 0.1em;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--terra-lt);
  transform: translateX(-50%) scale(0);
  transition: transform 0.4s var(--ease);
}

.site-header.is-scrolled .nav__link::after,
[data-header="solid"] .nav__link::after {
  background: var(--terra);
}

.nav__link:hover,
.nav__link:focus-visible,
.nav__link.is-active {
  opacity: 1;
}

.nav__link:hover::after,
.nav__link:focus-visible::after,
.nav__link.is-active::after {
  transform: translateX(-50%) scale(1);
}

.site-header__cta {
  display: none;
}

.menu-toggle {
  position: relative;
  z-index: 2;
  width: 48px;
  height: 48px;
  margin-right: -10px;
  display: grid;
  place-items: center;
}

.menu-toggle__bars {
  position: relative;
  width: 28px;
  height: 10px;
}

.menu-toggle__bars::before,
.menu-toggle__bars::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  height: 1.5px;
  background: currentColor;
  transition: transform 0.55s var(--ease), top 0.55s var(--ease);
}

.menu-toggle__bars::before {
  top: 0;
}

.menu-toggle__bars::after {
  top: 9px;
}

.menu-open .menu-toggle__bars::before {
  top: 4px;
  transform: rotate(45deg);
}

.menu-open .menu-toggle__bars::after {
  top: 4px;
  transform: rotate(-45deg);
}

/* Mobile menu: warm cream sheet, serif links */
.mobile-menu {
  position: fixed;
  inset: 0;
  z-index: 1;
  display: flex;
  flex-direction: column;
  padding: calc(var(--header-h) + 24px) var(--gutter) 32px;
  background: var(--cream);
  visibility: hidden;
  clip-path: inset(0 0 100% 0);
  transition: clip-path 0.7s var(--ease-in-out), visibility 0s linear 0.7s;
  overflow-y: auto;
}

.menu-open .mobile-menu {
  visibility: visible;
  clip-path: inset(0 0 0 0);
  transition: clip-path 0.7s var(--ease-in-out), visibility 0s;
}

.mobile-menu__list {
  display: grid;
  margin-block: auto;
}

.mobile-menu__link {
  display: flex;
  align-items: baseline;
  gap: 1rem;
  padding-block: 0.22em;
  font-family: var(--font-serif);
  font-weight: 350;
  font-size: clamp(2.5rem, 12vw, 3.8rem);
  line-height: 1.12;
  letter-spacing: -0.02em;
  color: var(--ink);
  opacity: 0;
  transform: translateY(22px);
  transition: opacity 0.35s var(--ease), transform 0.35s var(--ease), color 0.3s;
}

.mobile-menu__link span {
  font-family: var(--font-sans);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.2em;
  color: var(--terra);
}

.mobile-menu__link:hover,
.mobile-menu__link.is-active {
  color: var(--terra);
  font-style: italic;
}

.menu-open .mobile-menu__link {
  opacity: 1;
  transform: none;
  transition: opacity 0.8s var(--ease), transform 0.8s var(--ease), color 0.3s;
  transition-delay: calc(0.25s + var(--i) * 60ms);
}

.mobile-menu__foot {
  display: grid;
  gap: 1.4rem;
  margin-top: 2rem;
  padding-top: 2rem;
  border-top: 1px solid var(--line);
  color: var(--ink-2);
  font-size: 0.95rem;
}

.mobile-menu__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 1.8rem;
}

.mobile-menu__meta a:hover {
  color: var(--terra);
}

/* Sticky reserve bar, mobile only */
.reserve-bar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 55;
  padding: 12px var(--gutter) calc(12px + env(safe-area-inset-bottom));
  background: rgba(246, 240, 228, 0.97);
  border-top: 1px solid var(--line);
  transform: translateY(101%);
  transition: transform 0.55s var(--ease);
}

.reserve-bar.is-visible {
  transform: none;
}

.reserve-bar .btn {
  width: 100%;
}

.menu-open .reserve-bar {
  transform: translateY(101%);
}

@media (min-width: 1020px) {
  .nav {
    display: block;
  }

  .site-header__cta {
    display: inline-flex;
  }

  .site-header:not(.is-scrolled) .site-header__cta.btn--ghost-hero {
    color: var(--cream);
  }

  .menu-toggle,
  .mobile-menu,
  .reserve-bar {
    display: none;
  }
}

/* Header CTA over the hero: outlined so it stays quiet until scrolled */
.site-header__cta {
  --bg: transparent;
  --fg: currentColor;
  --bg-hover: var(--terra);
  border-color: currentColor;
}

.site-header.is-scrolled .site-header__cta,
[data-header="solid"] .site-header__cta {
  --bg: var(--terra);
  --fg: var(--cream);
  --bg-hover: var(--olive);
  border-color: var(--terra);
}

.site-header__cta:hover,
.site-header__cta:focus-visible {
  color: var(--cream);
}

/* --------------------------------------------------------------------------
   Lightbox (native <dialog>)
   -------------------------------------------------------------------------- */

.lightbox {
  width: 100vw;
  max-width: 100vw;
  height: 100dvh;
  max-height: 100dvh;
  margin: 0;
  padding: 0;
  border: 0;
  background: rgba(24, 22, 17, 0.985);
  color: var(--cream);
}

.lightbox[open] {
  display: grid;
  grid-template-rows: 1fr auto;
  animation: lb-in 0.45s var(--ease) both;
}

.lightbox::backdrop {
  background: transparent;
}

@keyframes lb-in {
  from {
    opacity: 0;
  }
}

.lightbox__stage {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 0;
  overflow: hidden;
  padding: 72px clamp(16px, 8vw, 120px) 16px;
}

.lightbox__img {
  max-width: 100%;
  max-height: calc(100dvh - 190px);
  width: auto;
  height: auto;
  object-fit: contain;
  transition: opacity 0.35s var(--ease);
}

.lightbox__img.is-swapping {
  opacity: 0;
}

.lightbox__bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 16px var(--gutter) calc(20px + env(safe-area-inset-bottom));
  font-size: 0.85rem;
}

.lightbox__cap b {
  display: block;
  font-family: var(--font-serif);
  font-weight: 400;
  font-size: 1.3rem;
  letter-spacing: -0.01em;
}

.lightbox__cap span {
  color: rgba(246, 240, 228, 0.7);
}

.lightbox__count {
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.2em;
  color: rgba(246, 240, 228, 0.7);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.lightbox__btn {
  position: absolute;
  z-index: 2;
  width: 52px;
  height: 52px;
  display: grid;
  place-items: center;
  color: var(--cream);
  border: 1px solid var(--line-inv);
  background: rgba(24, 22, 17, 0.5);
  transition: background-color 0.3s, border-color 0.3s;
}

.lightbox__btn:hover {
  background: var(--terra);
  border-color: var(--terra);
}

.lightbox__btn svg {
  width: 20px;
  height: 20px;
}

.lightbox__btn--close {
  top: 16px;
  right: 16px;
}

.lightbox__btn--prev,
.lightbox__btn--next {
  top: 50%;
  margin-top: -26px;
}

.lightbox__btn--prev {
  left: 16px;
}

.lightbox__btn--next {
  right: 16px;
}

.lightbox__btn--prev svg {
  transform: scaleX(-1);
}

@media (max-width: 700px) {
  .lightbox__stage {
    padding-inline: 12px;
  }

  .lightbox__btn--prev,
  .lightbox__btn--next {
    top: auto;
    bottom: 12px;
    margin-top: 0;
  }

  .lightbox__btn--prev {
    left: auto;
    right: 76px;
  }

  .lightbox__btn--next {
    right: 16px;
  }

  .lightbox__bar {
    padding-right: 150px;
  }
}
