/* ============================================================
   Components — header, menu, footer, hero pieces, cards.
   ============================================================ */

/* ----------------------------------------------------------------
   Hero background — fixed video + readability gradient
   ---------------------------------------------------------------- */

/* Hero background layer — fixed-position container for the video
   AND a fallback poster background-image. Sits at z-index 0
   (NOT negative — see tokens.css for why). Content above is
   z-index 1+ and either transparent (the .hero section) or
   opaque (everything below) so it scrolls over cleanly. */
.hero-bg {
  position: fixed;
  inset: 0;
  z-index: var(--z-bg);
  pointer-events: none;
  background-color: var(--color-bg);
  background-image: url("../assets/videos/hero-poster.png");
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  /* Force a new compositing layer so paints stay smooth across
     browsers (Safari especially benefits from this). */
  will-change: transform;
  transform: translate3d(0, 0, 0);
}

/* The <video> sits inside .hero-bg, filling it via inset:0.
   It's always opacity:1 — the poster on both the element and the
   .hero-bg background-image guarantees something visible is
   painted from the very first frame, even before any video data
   has loaded. */
.hero-video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  /* Source footage is genuinely dark nighttime cityscape — lift
     exposure so it reads as video instead of a black canvas. */
  filter: brightness(1.6) saturate(1.25) contrast(1.1);
  opacity: 1;
  /* GPU-promote so iOS Safari composites video frames smoothly */
  -webkit-transform: translate3d(0, 0, 0);
  transform: translate3d(0, 0, 0);
}

.hero-overlay {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(180deg,
      rgba(10,10,10,0.20) 0%,
      transparent 40%,
      transparent 60%,
      rgba(10,10,10,0.65) 100%
    );
  pointer-events: none;
}

/* Tap-to-play fallback — invisible by default, shown only when autoplay
   was actually blocked. position: fixed so it escapes the hero-bg's
   negative-z stacking context and stays clickable. */
.hero-bg__tap {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-1);
  padding: var(--space-3) var(--space-4);
  background: rgba(10, 10, 10, 0.7);
  border: 1px solid rgba(240, 237, 230, 0.25);
  color: var(--color-text);
  cursor: pointer;
  pointer-events: none;
  opacity: 0;
  transition: opacity 240ms var(--ease-out);
  z-index: 40;
  border-radius: 0;
  font-family: var(--font-sans);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.hero-bg__tap.is-visible {
  opacity: 1;
  pointer-events: auto;
}

.hero-bg__tap-icon {
  font-size: 18px;
  line-height: 1;
  color: var(--color-brand);
}

.hero-bg__tap-label {
  font-size: var(--fs-xs);
  letter-spacing: var(--tr-eyebrow);
  text-transform: uppercase;
  color: var(--color-text-muted);
}

.hero-bg__tap:hover { background: rgba(10, 10, 10, 0.85); }

/* On internal pages, no video — solid bg only */
body:not(.page-home) .hero-bg { background: var(--color-bg); }
body:not(.page-home) .hero-video,
body:not(.page-home) .hero-overlay { display: none; }

/* ----------------------------------------------------------------
   Animated hero logo (homepage only).
   Fixed at viewport center; GSAP animates transform from
   center scale 1 → top-bar position scale ~0.32.
   ---------------------------------------------------------------- */

.hero-logo {
  position: fixed;
  top: 50%;
  left: 50%;
  z-index: var(--z-overlay);
  width: 22vw;
  max-width: 380px;
  min-width: 180px;
  pointer-events: none;
  opacity: 0;
  transform: translate(-50%, -50%) scale(0.94);
  will-change: transform, opacity;
}

.hero-logo img {
  width: 100%;
  height: auto;
  display: block;
}

body:not(.page-home) .hero-logo { display: none; }

/* ----------------------------------------------------------------
   Site header (top bar)
   ---------------------------------------------------------------- */

.site-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--header-h);
  z-index: var(--z-header);
  background: transparent;
  transition:
    background-color var(--dur-short) var(--ease-out),
    backdrop-filter  var(--dur-short) var(--ease-out);
}

.site-header.is-visible {
  background: var(--color-overlay);
  backdrop-filter: blur(14px) saturate(1.2);
  -webkit-backdrop-filter: blur(14px) saturate(1.2);
  border-bottom: 1px solid rgba(255,255,255,0.04);
}

.site-header__inner {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  height: 100%;
  padding-inline: var(--gutter-x);
  max-width: var(--content-max);
  margin-inline: auto;
}

/* On homepage, top-bar elements start hidden — JS fades them in */
.page-home .site-header .lang-toggle,
.page-home .site-header .header-logo,
.page-home .site-header .menu-toggle {
  opacity: 0;
}

@media (max-width: 768px) {
  .site-header { height: var(--header-h-mobile); }
}

/* ----------------------------------------------------------------
   Header logo (static, in top bar)
   ---------------------------------------------------------------- */

.header-logo {
  display: block;
  justify-self: center;
  height: 38px;
  line-height: 0;
}

.header-logo img {
  height: 100%;
  width: auto;
  display: block;
}

@media (max-width: 768px) {
  .header-logo { height: 32px; }
}

/* ----------------------------------------------------------------
   Language toggle (left of header)
   ---------------------------------------------------------------- */

.lang-toggle {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 4px;
  border: 1px solid rgba(240, 237, 230, 0.12);
  border-radius: 999px;
  background: rgba(10, 10, 10, 0.4);
  justify-self: start;
}

.lang-toggle__btn {
  font-family: var(--font-sans);
  font-size: var(--fs-xs);
  font-weight: 500;
  letter-spacing: 0.05em;
  color: var(--color-text-muted);
  padding: 8px 14px;
  border-radius: 999px;
  cursor: pointer;
  /* Tap target — Apple HIG says 44px min. We lift the button to that
     hit area without inflating its visual size. */
  min-height: 32px;
  min-width: 32px;
  transition:
    color var(--dur-micro) var(--ease-micro),
    background-color var(--dur-micro) var(--ease-micro);
}

@media (hover: none) and (pointer: coarse) {
  .lang-toggle__btn { min-height: 36px; min-width: 36px; padding: 9px 14px; }
}

.lang-toggle__btn:hover {
  color: var(--color-text);
}

.lang-toggle__btn[aria-pressed="true"] {
  color: var(--color-text);
  background: rgba(240, 237, 230, 0.08);
}

@media (max-width: 480px) {
  .lang-toggle { padding: 3px; }
  .lang-toggle__btn { padding: 4px 9px; font-size: 11px; }
}

/* ----------------------------------------------------------------
   Menu toggle (hamburger, right of header)
   ---------------------------------------------------------------- */

.menu-toggle {
  justify-self: end;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: transparent;
  cursor: pointer;
  transition: background-color var(--dur-micro) var(--ease-micro);
}

/* When the menu overlay is open, lift the entire header above it
   so the hamburger (now an X) stays visible and clickable. */
body.no-scroll .site-header {
  z-index: calc(var(--z-modal) + 1);
}
body.no-scroll .site-header.is-visible {
  background: transparent;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  border-bottom: none;
}

.menu-toggle:hover {
  background: rgba(240, 237, 230, 0.06);
}

.menu-toggle__icon {
  position: relative;
  display: block;
  width: 22px;
  height: 14px;
}

/* Both bars are centered vertically; spacing comes from transform only.
   Animating a single property (transform) prevents the jitter that
   shows up when top/bottom and transform animate concurrently. */
.menu-toggle__icon span {
  position: absolute;
  top: 50%;
  left: 0;
  width: 100%;
  height: 1.5px;
  background: var(--color-text);
  transform-origin: center;
  will-change: transform;
  transition: transform 320ms cubic-bezier(0.65, 0, 0.35, 1);
}

/* Closed: spread apart by ±5px from center */
.menu-toggle__icon span:first-child { transform: translateY(calc(-50% - 5px)); }
.menu-toggle__icon span:last-child  { transform: translateY(calc(-50% + 5px)); }

/* Open: collapse to center and rotate into an X */
.menu-toggle[aria-expanded="true"] .menu-toggle__icon span:first-child {
  transform: translateY(-50%) rotate(45deg);
}
.menu-toggle[aria-expanded="true"] .menu-toggle__icon span:last-child {
  transform: translateY(-50%) rotate(-45deg);
}

/* ----------------------------------------------------------------
   Full-screen menu overlay
   ---------------------------------------------------------------- */

.menu-overlay {
  position: fixed;
  inset: 0;
  z-index: var(--z-modal);
  background: rgba(10, 10, 10, 0.96);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  display: flex;
  flex-direction: column;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition:
    opacity var(--dur-short) var(--ease-out);
}

.menu-overlay[hidden] { display: none; }

.menu-overlay.is-open {
  opacity: 1;
  pointer-events: auto;
}

.menu-overlay__inner {
  max-width: var(--content-max);
  margin-inline: auto;
  padding-inline: var(--gutter-x);
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: var(--space-12);
}

.menu-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.menu-list a {
  font-family: var(--font-display);
  font-size: clamp(2.5rem, 8vw, 5.5rem);
  font-weight: 500;
  line-height: 1;
  letter-spacing: var(--tr-display);
  display: inline-block;
  position: relative;
  padding-bottom: 4px;
  opacity: 0;
  transform: translateY(40px);
}

.menu-overlay.is-open .menu-list a {
  opacity: 1;
  transform: translateY(0);
  transition:
    transform var(--dur-long) var(--ease-out),
    color var(--dur-micro) var(--ease-micro);
}

/* Stagger menu items */
.menu-overlay.is-open .menu-list li:nth-child(1) a { transition-delay: 100ms; }
.menu-overlay.is-open .menu-list li:nth-child(2) a { transition-delay: 180ms; }
.menu-overlay.is-open .menu-list li:nth-child(3) a { transition-delay: 260ms; }
.menu-overlay.is-open .menu-list li:nth-child(4) a { transition-delay: 340ms; }
.menu-overlay.is-open .menu-list li:nth-child(5) a { transition-delay: 420ms; }

.menu-list a:hover {
  color: var(--color-brand-hover);
}

.menu-list a::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: 0;
  width: 100%;
  height: 2px;
  background: var(--color-brand);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform var(--dur-short) var(--ease-out);
}

.menu-list a:hover::after { transform: scaleX(1); }

.menu-list a[aria-current="page"] {
  color: var(--color-text);
}
.menu-list a[aria-current="page"]::before {
  content: "";
  display: inline-block;
  width: 8px;
  height: 8px;
  background: var(--color-brand);
  margin-right: 0.5em;
  vertical-align: middle;
  margin-bottom: 0.15em;
}

.menu-overlay__footer {
  font-size: var(--fs-sm);
  letter-spacing: var(--tr-label);
  text-transform: uppercase;
  opacity: 0;
  transition: opacity var(--dur-long) var(--ease-out) 500ms;
}

.menu-overlay.is-open .menu-overlay__footer { opacity: 1; }

@media (max-width: 768px) {
  .menu-overlay__inner { gap: var(--space-8); }
  .menu-list { gap: var(--space-2); }
}

/* ----------------------------------------------------------------
   CTA buttons (mailto cards) — used on home + contact
   ---------------------------------------------------------------- */

.cta-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-2);
}

.cta-btn {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  background: var(--color-bg-elevated);
  border: 1px solid var(--color-divider);
  color: var(--color-text);
  text-decoration: none;
  overflow: hidden;
  transition:
    border-color var(--dur-micro) var(--ease-micro),
    transform     var(--dur-short) var(--ease-out),
    background-color var(--dur-short) var(--ease-out);
}

.cta-btn::before {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--color-brand);
  transform: scaleY(0);
  transform-origin: bottom;
  transition: transform var(--dur-short) var(--ease-out);
  z-index: 0;
}

.cta-btn > * { position: relative; z-index: 1; }

.cta-btn__label {
  font-family: var(--font-sans);
  font-size: var(--fs-md);
  font-weight: 500;
  letter-spacing: -0.005em;
  color: var(--color-text);
  flex: 1;
  min-width: 0;
}

.cta-btn__arrow {
  flex-shrink: 0;
  font-size: var(--fs-xl);
  line-height: 1;
  color: var(--color-brand);
  transition:
    transform var(--dur-short) var(--ease-out),
    color var(--dur-micro) var(--ease-micro);
}

.cta-btn:hover {
  border-color: var(--color-brand);
}
.cta-btn:hover::before { transform: scaleY(1); }
.cta-btn:hover .cta-btn__arrow {
  color: var(--color-text);
  transform: translateX(6px);
}

@media (max-width: 640px) {
  .cta-row { grid-template-columns: 1fr; }
}

/* ----------------------------------------------------------------
   Custom cursor (hidden on touch devices)
   ---------------------------------------------------------------- */

.cursor-dot,
.cursor-ring {
  position: fixed;
  top: 0;
  left: 0;
  pointer-events: none;
  z-index: var(--z-modal);
  mix-blend-mode: difference;
}

.cursor-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--color-brand);
  transform: translate(-50%, -50%) translate3d(0, 0, 0);
  transition: opacity var(--dur-micro) var(--ease-micro);
  opacity: 0;
}

.cursor-ring {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid rgba(240, 237, 230, 0.55);
  transform: translate(-50%, -50%) translate3d(0, 0, 0);
  transition:
    width var(--dur-short) var(--ease-out),
    height var(--dur-short) var(--ease-out),
    border-color var(--dur-micro) var(--ease-micro),
    opacity var(--dur-micro) var(--ease-micro),
    background-color var(--dur-short) var(--ease-out);
  opacity: 0;
}

.cursor-ready .cursor-dot,
.cursor-ready .cursor-ring { opacity: 1; }

/* Hover state — ring grows, dot fades */
.cursor-hover .cursor-dot { opacity: 0; }
.cursor-hover .cursor-ring {
  width: 64px;
  height: 64px;
  border-color: var(--color-brand);
  background: rgba(194, 0, 14, 0.08);
}

/* Hide native cursor on devices with fine pointer */
@media (hover: hover) and (pointer: fine) {
  html.cursor-ready,
  html.cursor-ready *,
  html.cursor-ready a,
  html.cursor-ready button {
    cursor: none !important;
  }
}

/* Touch devices — hide entirely */
@media (hover: none), (pointer: coarse) {
  .cursor-dot, .cursor-ring { display: none; }
}

/* Reduced motion — hide custom cursor, restore native */
@media (prefers-reduced-motion: reduce) {
  .cursor-dot, .cursor-ring { display: none; }
  html.cursor-ready, html.cursor-ready * { cursor: auto !important; }
}

/* ----------------------------------------------------------------
   Site footer
   ---------------------------------------------------------------- */

.site-footer {
  position: relative;
  z-index: var(--z-content);
  background: var(--color-bg);
  padding-block: var(--space-12) var(--space-6);
  border-top: 1px solid var(--color-divider);
}

.site-footer .container {
  max-width: var(--content-max);
}

/* Three columns on desktop: brand | address | email
   Address and email are siblings of equal width, so their
   labels share a baseline and their content aligns vertically. */
.site-footer__grid {
  display: grid;
  grid-template-columns: 1.4fr 1fr 1fr;
  column-gap: var(--space-8);
  row-gap: var(--space-8);
  padding-bottom: var(--space-10);
  align-items: start;
}

.site-footer__brand {
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: var(--space-2);
}

/* Logo above the tagline — anchored to the same left edge as
   the tagline text. Bigger size so it reads as a brand anchor
   rather than just a small mark. */
.site-footer__mark {
  display: block;
  width: 96px;
  height: auto;
  margin: 0 0 var(--space-1) 0;
  padding: 0;
}

@media (max-width: 640px) {
  .site-footer__mark { width: 80px; }
}

.site-footer__tagline {
  font-size: var(--fs-xl);
  line-height: 1.15;
  max-width: 18ch;
  margin: 0;
}

.site-footer__col {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  min-width: 0;
}

.site-footer__col .label {
  font-size: var(--fs-xs);
  margin: 0 0 var(--space-1) 0;
  line-height: 1.2;
}

.site-footer__col > p,
.site-footer__col > a {
  font-size: var(--fs-sm);
  line-height: 1.55;
  max-width: none;
  margin: 0;
}

.site-footer__col a {
  display: inline-block;
  align-self: flex-start;
  border-bottom: 1px solid transparent;
  padding-bottom: 1px;
  width: fit-content;
  transition:
    color var(--dur-micro) var(--ease-micro),
    border-color var(--dur-micro) var(--ease-micro);
}
.site-footer__col a:hover {
  color: var(--color-brand-hover);
  border-color: var(--color-brand-hover);
}

.site-footer .divider { margin-block: var(--space-4); }

.site-footer__legal {
  font-size: var(--fs-xs);
  letter-spacing: 0.05em;
  text-align: left;
  margin: 0;
}

/* Tablet: brand on top, address+email side-by-side below */
@media (max-width: 1024px) {
  .site-footer__grid {
    grid-template-columns: 1fr 1fr;
    grid-template-areas:
      "brand brand"
      "addr  email";
    column-gap: var(--space-6);
    row-gap: var(--space-6);
  }
  .site-footer__brand   { grid-area: brand; }
  .site-footer__col--address { grid-area: addr; }
  .site-footer__col--contact { grid-area: email; }
}

/* Mobile: everything stacks */
@media (max-width: 640px) {
  .site-footer__grid {
    grid-template-columns: 1fr;
    grid-template-areas:
      "brand"
      "addr"
      "email";
    row-gap: var(--space-5);
  }
}
