/* ============================================================
   MAIN.CSS — Global Design System
   Client-First naming · Golden Ratio spacing · Quiet Luxury palette
   ============================================================ */

/* ── Fonts ─────────────────────────────────────────────────── */
/* Loaded via <link> in HTML when possible; @import kept as fallback.
   size-adjust keeps layout stable if Brave Shields blocks Google/Fontshare. */
@import url('https://api.fontshare.com/v2/css?f[]=switzer@400,500,600,700&display=swap');
@import url('https://fonts.googleapis.com/css2?family=Bebas+Neue&display=swap');

@font-face {
  font-family: 'Display Fallback';
  src: local('Arial Narrow'), local('Helvetica Neue Condensed'), local('Arial');
  size-adjust: 92%;
  ascent-override: 90%;
  descent-override: 20%;
  line-gap-override: 0%;
}

@font-face {
  font-family: 'Body Fallback';
  src: local('Segoe UI'), local('Helvetica Neue'), local('Arial');
  size-adjust: 100%;
}

/* ── Custom Properties ──────────────────────────────────────── */
:root {
  /* Palette */
  --c-bg:           #EDE7DE;
  --c-text:         #1A1A1A;
  --c-text-muted:   #6B6560;
  --c-text-light:   #9A9490;
  --c-border:       rgba(26, 26, 26, 0.12);
  --c-border-hover: rgba(26, 26, 26, 0.3);
  --c-overlay:      rgba(26, 26, 26, 0.88);
  --c-surface:      rgba(237, 231, 222, 0.9);

  /* Typography */
  --f-body:    'Switzer', 'Body Fallback', system-ui, sans-serif;
  --f-display: 'Bebas Neue', 'Display Fallback', Impact, sans-serif;

  /* Golden Ratio Spacing (base 1rem = 16px) */
  --phi:      0.618;
  --s-3xs:    0.25rem;    /* 4px  */
  --s-2xs:    0.382rem;   /* 6px  */
  --s-xs:     0.618rem;   /* 10px */
  --s-sm:     1rem;       /* 16px */
  --s-md:     1.618rem;   /* 26px */
  --s-lg:     2.618rem;   /* 42px */
  --s-xl:     4.236rem;   /* 68px */
  --s-2xl:    6.854rem;   /* 110px */
  --s-3xl:    11.09rem;   /* 177px */

  /* Layout */
  --w-content:  90rem;      /* 1440px max */
  --w-text:     44rem;      /* readable line length */
  --nav-h:      5rem;       /* 80px */
  --radius-sm:  0.25rem;
  --radius-md:  0.5rem;
  --radius-lg:  1rem;

  /* Motion */
  --ease-out-expo:    cubic-bezier(0.16, 1, 0.3, 1);
  --ease-in-out-expo: cubic-bezier(0.87, 0, 0.13, 1);
  --ease-out-quart:   cubic-bezier(0.25, 1, 0.5, 1);
  --dur-fast:   0.25s;
  --dur-base:   0.55s;
  --dur-slow:   0.9s;
}

/* ── Reset & Base ───────────────────────────────────────────── */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  scroll-behavior: auto; /* Lenis handles smooth scroll */
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  background-color: var(--c-bg);
  color: var(--c-text);
  font-family: var(--f-body);
  font-size: 1rem;
  line-height: 1.618; /* Golden ratio */
  overflow-x: hidden;
  /* FOUC prevention — GSAP fades this in on DOMContentLoaded */
  opacity: 0;
}

img, video {
  display: block;
  max-width: 100%;
}

a {
  color: inherit;
  text-decoration: none;
}

button {
  cursor: pointer;
  font: inherit;
  background: none;
  border: none;
}

ul, ol {
  list-style: none;
}

/* ── Accessibility ──────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  white-space: nowrap;
  border: 0;
}

/* ── Page Curtain (Transition Overlay) ──────────────────────── */
.c-curtain {
  position: fixed;
  inset: 0;
  background-color: var(--c-text);
  z-index: 9999;
  transform: scaleY(0);
  transform-origin: bottom center;
  pointer-events: none;
  will-change: transform;
  transition: transform 0.9s cubic-bezier(0.76, 0, 0.24, 1);
}

/* CSS-only fallback transitions */
html:not(.has-gsap) .c-curtain {
  transform-origin: top center;
  animation: curtainReveal 1s cubic-bezier(0.76, 0, 0.24, 1) forwards;
}

@keyframes curtainReveal {
  from {
    transform: scaleY(1);
  }
  to {
    transform: scaleY(0);
  }
}

/* Smooth page transitions */
body {
  transition: opacity 0.3s ease-out;
}

body.is-transitioning {
  opacity: 0.96;
  pointer-events: none;
}

/* Prevent flash during page load */
html.is-loading body {
  opacity: 0;
}

html.is-loaded body {
  opacity: 1;
  transition: opacity 0.6s ease-out;
}

/* ── Island Menu (site-wide) ────────────────────────────────── */

/* Fixed top bar — mid grey site-wide (R128 G128 B128) */
.c-topbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--nav-h);
  z-index: 1200;
  display: flex;
  align-items: center;
  padding: 0 var(--s-lg);
  box-sizing: border-box;
  background: rgb(128, 128, 128);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid rgba(26, 26, 26, 0.12);
  pointer-events: none; /* bar itself doesn't block; children do */
}

.c-topbar > * {
  pointer-events: auto;
}

body:has(.c-hero) .c-topbar,
body:has(.c-hero) .c-topbar.is-scrolled,
.c-topbar.is-scrolled {
  background: rgb(128, 128, 128);
  border-bottom-color: rgba(26, 26, 26, 0.16);
}

/* Brand mark — left side of top bar */
.c-home-logo {
  position: relative;
  top: auto;
  left: auto;
  height: 3.25rem;
  width: auto;
  z-index: 1;
  display: block;
  flex-shrink: 0;
}

.c-home-logo img {
  height: 100%;
  width: auto;
  display: block;
  object-fit: contain;
}

/* Island — centered in the top bar */
.c-island {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.5rem;
  background: #1A1A1A;
  border: 1.5px solid rgba(237, 231, 222, 0.18);
  border-radius: 99px;
  white-space: nowrap;
  width: auto;
  overflow: hidden;
  box-shadow: 0 10px 36px rgba(0, 0, 0, 0.4);
}

.c-island__logo-cont {
  position: relative;
  width: 0;
  height: 22px;
  pointer-events: none;
  flex-shrink: 0;
  overflow: visible;
}

.c-island.is-open .c-island__logo-cont {
  pointer-events: auto;
}

.c-island__logo-link {
  display: block;
  width: 100%;
  height: 100%;
  position: relative;
}

.c-island__logo {
  position: absolute;
  left: 0.65rem;
  top: 50%;
  width: 20px;
  height: 20px;
  margin-top: -10px;
  opacity: 0;
  object-fit: contain;
  display: block;
  transform-origin: center center;
  will-change: transform, opacity;
  filter: brightness(0) invert(0.93) sepia(0.12) saturate(0.35);
}

.c-island__btn {
  width: 100%;
  height: 34px;
  margin: 0;
  padding: 0;
  background: transparent;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-shrink: 0;
  color: rgba(237, 231, 222, 0.7);
}

.c-island__btn-hit {
  width: 34px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.c-island__btn:hover { color: #EDE7DE; }
.c-island__btn:focus-visible {
  outline: 2px solid #F5821F;
  outline-offset: 3px;
}

.c-island__icon {
  display: block;
  overflow: visible;
}

.c-island__burger,
.c-island__close {
  transition: opacity 0.2s ease;
}

.c-island__close {
  opacity: 0;
  pointer-events: none;
}

.c-island.is-open .c-island__btn { color: #EDE7DE; }
.c-island.is-open .c-island__burger { opacity: 0; }
.c-island.is-open .c-island__close { opacity: 1; }

.c-menu {
  position: fixed;
  inset: 0;
  z-index: 1100;
  pointer-events: none;
}

.c-menu__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(26, 26, 26, 0.88);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  opacity: 0;
}

.c-menu__panel {
  border: 1.5px solid rgba(237, 231, 222, 0.18);
  position: absolute;
  top: 5rem;
  left: 50%;
  opacity: 0;
  visibility: hidden;
  background: #1A1A1A;
  border-radius: 18px;
  padding: 0.375rem;
  width: max-content;
  max-width: 90vw;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.5);
  z-index: 1;
}

.c-menu__nav {
  display: flex;
  flex-direction: column;
  width: max-content;
}

.c-menu__link,
.menu-link {
  display: block;
  width: auto;
  padding: 0.85rem 1.15rem;
  border-radius: 10px;
  text-decoration: none;
  color: #EDE7DE;
  font-family: var(--f-body);
  font-weight: 500;
  font-size: 1rem;
  line-height: 1.2;
  white-space: nowrap;
  opacity: 1;
  visibility: visible;
  box-sizing: border-box;
  transition: color 0.2s ease;
}

.c-menu__link + .c-menu__link,
.menu-link + .menu-link {
  border-top: 1px solid rgba(237, 231, 222, 0.1);
  border-radius: 0;
}
.c-menu__link:first-child,
.menu-link:first-child { border-radius: 10px 10px 0 0; }
.c-menu__link:last-child,
.menu-link:last-child { border-radius: 0 0 10px 10px; }
.c-menu__link:focus-visible,
.menu-link:focus-visible {
  outline: 2px solid currentColor;
  outline-offset: -2px;
  border-radius: 10px;
}
.c-menu__link.is-active,
.menu-link.is-active {
  color: #F5821F;
}

.c-island.no-gsap.is-open { width: max-content; }
.c-island.no-gsap.is-open .c-island__logo-cont { width: 36px; }
.c-island.no-gsap.is-open .c-island__logo {
  opacity: 1;
  transform: rotate(-360deg);
  transition: opacity 0.35s ease, transform 0.7s cubic-bezier(0.22, 1, 0.36, 1);
}
.c-island.no-gsap:not(.is-open) .c-island__logo {
  opacity: 0;
  transform: rotate(0deg);
  transition: opacity 0.25s ease, transform 0.55s ease;
}
.c-menu.no-gsap.is-open { pointer-events: auto; }
.c-menu.no-gsap .c-menu__backdrop,
.c-menu.no-gsap .c-menu__panel {
  transition: opacity 0.35s ease, transform 0.5s cubic-bezier(0.34, 1.4, 0.64, 1), visibility 0.35s;
}
.c-menu.no-gsap .c-menu__panel {
  transform: translateX(-50%);
}
.c-menu.no-gsap.is-open .c-menu__backdrop { opacity: 1; }
.c-menu.no-gsap.is-open .c-menu__panel {
  visibility: visible;
  opacity: 1;
  transform: translateX(-50%) translateY(0) scale(1);
}
.c-menu.no-gsap.is-open .menu-link {
  opacity: 1;
  visibility: visible;
}
.c-menu.no-gsap:not(.is-open) .c-menu__panel {
  opacity: 0;
  transform: translateX(-50%) translateY(-10%) scale(0.6);
}

/* ── Typography Scale ───────────────────────────────────────── */
.u-display {
  font-family: var(--f-display);
  font-size: clamp(4rem, 12vw, 10rem);
  line-height: 0.9;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.u-heading-xl {
  font-family: var(--f-display);
  font-size: clamp(3rem, 8vw, 7rem);
  line-height: 0.95;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.u-heading-lg {
  font-family: var(--f-display);
  font-size: clamp(2rem, 5vw, 4rem);
  line-height: 1;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.u-heading-md {
  font-size: 1.25rem;
  font-weight: 600;
  line-height: 1.3;
  letter-spacing: -0.01em;
}

.u-label {
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--c-text-muted);
}

.u-body {
  font-size: 1rem;
  line-height: 1.75;
  color: var(--c-text-muted);
}

.u-body-lg {
  font-size: 1.125rem;
  line-height: 1.75;
}

/* ── Layout Utilities ───────────────────────────────────────── */
.u-container {
  max-width: var(--w-content);
  margin: 0 auto;
  padding: 0 var(--s-lg);
}

.u-grid {
  display: grid;
}

.u-flex {
  display: flex;
}

/* ── Image Aspect Ratio Wrappers (CLS Prevention) ───────────── */
.u-ratio {
  position: relative;
  overflow: hidden;
}

.u-ratio > img,
.u-ratio > video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.u-ratio--16-9  { aspect-ratio: 16 / 9; }
.u-ratio--4-3   { aspect-ratio: 4 / 3; }
.u-ratio--3-2   { aspect-ratio: 3 / 2; }
.u-ratio--1-1   { aspect-ratio: 1 / 1; }
.u-ratio--2-3   { aspect-ratio: 2 / 3; }
.u-ratio--3-4   { aspect-ratio: 3 / 4; }
.u-ratio--golden { aspect-ratio: 1.618 / 1; }

/* ── Button Component ───────────────────────────────────────── */
.c-btn {
  display: inline-flex;
  align-items: center;
  gap: var(--s-xs);
  padding: var(--s-sm) var(--s-md);
  font-size: 0.8125rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  border: 1px solid var(--c-text);
  transition: background var(--dur-fast) ease,
              color var(--dur-fast) ease;
}

.c-btn:hover {
  background: var(--c-text);
  color: var(--c-bg);
}

.c-btn--ghost {
  border-color: var(--c-border);
  color: var(--c-text-muted);
}

.c-btn--ghost:hover {
  border-color: var(--c-text);
  color: var(--c-bg);
  background: var(--c-text);
}

/* ── Footer ─────────────────────────────────────────────────── */
.c-footer {
  padding: var(--s-md) var(--s-lg);
  display: flex;
  flex-direction: column;
  gap: var(--s-md);
}

.c-footer__top {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: var(--s-lg);
  flex-wrap: wrap;
}

.c-footer__logo img {
  height: 1.5rem;
  width: auto;
  object-fit: contain;
}

.c-footer__nav {
  display: flex;
  gap: var(--s-lg);
}

.c-footer__link {
  font-size: 0.8125rem;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--c-text-muted);
  transition: color var(--dur-fast) ease;
}

.c-footer__link:hover {
  color: var(--c-text);
}

.c-footer__bottom {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--s-sm);
  padding-top: var(--s-md);
  border-top: 1px solid var(--c-border);
}

.c-footer__copy {
  font-size: 0.75rem;
  color: var(--c-text-light);
  letter-spacing: 0.04em;
}

/* ── Page Padding ───────────────────────────────────────────── */
.u-page-top {
  padding-top: var(--nav-h);
}

/* ── Responsive Breakpoints ─────────────────────────────────── */
@media (max-width: 768px) {
  :root {
    --s-lg: 1.618rem;
    --s-xl: 2.618rem;
    --s-2xl: 4.236rem;
    --nav-h: 4rem;
  }

  .c-footer__top {
    flex-direction: column;
    align-items: flex-start;
  }
}
