/* ═══════════════════════════════════════════════════════════════════
   LAYOUT — preloader, navigation, mobile menu, page hero, footer
   ═══════════════════════════════════════════════════════════════════ */

/* ═══════════════════════════════════════════════
   PRELOADER
   Covers the page while fonts settle, then wipes
   upward. Removed from the DOM by JS afterwards.
   ═══════════════════════════════════════════════ */
#preloader {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: grid;
  place-items: center;
  background: var(--bg-0);
  transition: clip-path 900ms var(--ease-glide), opacity 500ms var(--ease-out);
  clip-path: inset(0 0 0 0);
}

#preloader.is-done {
  clip-path: inset(0 0 100% 0);
  pointer-events: none;
}

.pre-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--sp-6);
  transition: opacity 400ms var(--ease-out), transform 600ms var(--ease-out);
}

#preloader.is-done .pre-inner {
  opacity: 0;
  transform: translateY(-24px);
}

/* Rotating dual ring around the monogram */
.pre-ring {
  position: relative;
  width: 108px;
  height: 108px;
  display: grid;
  place-items: center;
}

.pre-ring::before,
.pre-ring::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 2px solid transparent;
}

.pre-ring::before {
  border-top-color: var(--ac-1);
  border-right-color: rgba(var(--ac-1-rgb), 0.25);
  animation: spin 1.1s linear infinite;
}

.pre-ring::after {
  inset: 12px;
  border-bottom-color: var(--ac-2);
  border-left-color: rgba(var(--ac-2-rgb), 0.25);
  animation: spin 1.6s linear infinite reverse;
}

@keyframes spin { to { transform: rotate(360deg); } }

.pre-mono {
  font-family: var(--font-display);
  font-size: 1.75rem;
  font-weight: 700;
  letter-spacing: -0.04em;
  background: var(--grad-brand);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: var(--ac-1);
}

.pre-meta {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--sp-3);
}

.pre-label {
  font-family: var(--font-mono);
  font-size: var(--fs-3xs);
  letter-spacing: var(--ls-caps);
  text-transform: uppercase;
  color: var(--tx-3);
}

.pre-bar {
  width: 190px;
  height: 2px;
  border-radius: var(--r-full);
  background: var(--glass-3);
  overflow: hidden;
}

.pre-bar i {
  display: block;
  height: 100%;
  width: var(--pct, 0%);
  background: var(--grad-brand);
  box-shadow: 0 0 10px rgba(var(--ac-1-rgb), 0.7);
  transition: width 220ms var(--ease-out);
}

.pre-pct {
  font-family: var(--font-mono);
  font-size: var(--fs-2xs);
  color: var(--tx-2);
  font-variant-numeric: tabular-nums;
}

/* No-JS: never leave the page covered */
.no-js #preloader { display: none; }

/* ═══════════════════════════════════════════════
   NAVIGATION — floating glass bar
   ═══════════════════════════════════════════════ */
#nav {
  position: fixed;
  top: 0;
  inset-inline: 0;
  z-index: 1000;
  padding-block: var(--sp-4);
  transition: padding var(--t-base);
}

#nav.is-scrolled { padding-block: var(--sp-2); }

.nav-inner {
  display: flex;
  align-items: center;
  gap: var(--sp-4);
  width: min(var(--max-w-wide), 100% - var(--sp-gutter) * 2);
  margin-inline: auto;
  padding: 0.55rem 0.55rem 0.55rem 1.1rem;
  border-radius: var(--r-full);
  background: transparent;
  border: 1px solid transparent;
  transition: background-color var(--t-base), border-color var(--t-base),
              box-shadow var(--t-base), backdrop-filter var(--t-base);
}

/* The bar only materialises once you start scrolling —
   at the top it sits invisibly over the hero. */
#nav.is-scrolled .nav-inner {
  background: var(--surface-nav);
  border-color: var(--brd-1);
  backdrop-filter: blur(var(--blur-lg)) saturate(160%);
  -webkit-backdrop-filter: blur(var(--blur-lg)) saturate(160%);
  box-shadow: var(--sh-md), inset 0 1px 0 rgba(255, 255, 255, 0.07);
}

/* ── LOGO ── */
.nav-logo {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  flex-shrink: 0;
  transition: transform var(--t-base);
}

.nav-logo:hover { transform: scale(1.02); }

.nav-sig {
  height: 34px;
  width: auto;
  /* Signature PNG is dark ink; invert it for the dark theme */
  filter: invert(1) brightness(1.9) drop-shadow(0 0 10px rgba(var(--ac-1-rgb), 0.35));
  transition: filter var(--t-base);
}

[data-theme='light'] .nav-sig { filter: none; }

.nav-name {
  font-family: var(--font-display);
  font-size: var(--fs-md);
  font-weight: 700;
  letter-spacing: var(--ls-tight);
  color: var(--tx-0);
}

.nav-dot {
  color: var(--ac-1);
  text-shadow: 0 0 12px rgba(var(--ac-1-rgb), 0.8);
}

/* ── LINKS ── */
.nav-links {
  display: flex;
  align-items: center;
  gap: 2px;
  margin-inline: auto;
}

.nav-link {
  position: relative;
  display: block;
  padding: 0.55rem 0.9rem;
  border-radius: var(--r-full);
  font-size: var(--fs-sm);
  font-weight: 500;
  color: var(--tx-2);
  transition: color var(--t-base), background-color var(--t-base);
}

.nav-link:hover {
  color: var(--tx-0);
  background: var(--glass-2);
}

.nav-link.is-active { color: var(--tx-0); font-weight: 600; }

/* Underline dot for the current page */
.nav-link.is-active::after {
  content: '';
  position: absolute;
  bottom: 2px;
  left: 50%;
  transform: translateX(-50%);
  width: 16px;
  height: 2px;
  border-radius: var(--r-full);
  background: var(--grad-brand);
  box-shadow: 0 0 10px rgba(var(--ac-1-rgb), 0.8);
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  flex-shrink: 0;
}

/* Compact icon button inside the nav */
.nav-btn {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--glass-2);
  border: 1px solid var(--brd-1);
  color: var(--tx-2);
  transition: all var(--t-base);
}

.nav-btn:hover {
  background: var(--glass-4);
  color: var(--ac-1);
  border-color: var(--brd-accent);
  transform: scale(1.07);
}

.nav-btn svg { width: 17px; height: 17px; }

/* Theme toggle shows one icon per state */
.nav-btn .ico-sun  { display: none; }
[data-theme='light'] .nav-btn .ico-moon { display: none; }
[data-theme='light'] .nav-btn .ico-sun  { display: block; }

/* Muted state for the sound toggle */
.nav-btn.is-muted { color: var(--tx-3); }
.nav-btn .ico-mute { display: none; }
.nav-btn.is-muted .ico-mute { display: block; }
.nav-btn.is-muted .ico-audio { display: none; }

/* ── HAMBURGER ── */
.burger {
  display: none;
  width: 40px;
  height: 40px;
  position: relative;
  border-radius: 50%;
  background: var(--glass-2);
  border: 1px solid var(--brd-1);
}

.burger i {
  position: absolute;
  left: 11px;
  width: 18px;
  height: 1.75px;
  border-radius: 2px;
  background: var(--tx-0);
  transition: transform var(--t-base), opacity var(--t-fast), width var(--t-base);
}

.burger i:nth-child(1) { top: 14px; }
.burger i:nth-child(2) { top: 19px; width: 13px; }
.burger i:nth-child(3) { top: 24px; }

.burger.is-open i:nth-child(1) { transform: translateY(5px) rotate(45deg); }
.burger.is-open i:nth-child(2) { opacity: 0; transform: translateX(-8px); }
.burger.is-open i:nth-child(3) { transform: translateY(-5px) rotate(-45deg); width: 18px; }

/* ═══════════════════════════════════════════════
   MOBILE MENU — full-screen glass sheet
   ═══════════════════════════════════════════════ */
.m-menu {
  position: fixed;
  inset: 0;
  z-index: 990;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: var(--sp-8);
  padding: calc(var(--nav-h) + var(--sp-8)) var(--sp-gutter) var(--sp-12);
  background: rgba(5, 6, 10, 0.86);
  backdrop-filter: blur(var(--blur-xl)) saturate(140%);
  -webkit-backdrop-filter: blur(var(--blur-xl)) saturate(140%);
  opacity: 0;
  visibility: hidden;
  transition: opacity var(--t-base), visibility var(--t-base);
  overflow-y: auto;
}

[data-theme='light'] .m-menu { background: rgba(242, 245, 250, 0.9); }

.m-menu.is-open { opacity: 1; visibility: visible; }

.m-list {
  display: flex;
  flex-direction: column;
  gap: var(--sp-1);
}

.m-link {
  display: flex;
  align-items: center;
  gap: var(--sp-4);
  padding: var(--sp-4) var(--sp-4);
  border-radius: var(--r-lg);
  font-family: var(--font-display);
  font-size: clamp(1.5rem, 6vw, 2.1rem);
  font-weight: 600;
  letter-spacing: var(--ls-tight);
  color: var(--tx-2);
  border: 1px solid transparent;
  /* Each link flies in, staggered by --i set in the markup */
  opacity: 0;
  transform: translateX(-28px);
  transition: opacity 460ms var(--ease-out), transform 460ms var(--ease-out),
              color var(--t-fast), background-color var(--t-fast);
}

.m-menu.is-open .m-link {
  opacity: 1;
  transform: none;
  transition-delay: calc(var(--i, 0) * 55ms + 90ms);
}

.m-link:hover,
.m-link.is-active {
  color: var(--tx-0);
  background: var(--glass-2);
  border-color: var(--brd-1);
}

.m-link .m-num {
  font-family: var(--font-mono);
  font-size: var(--fs-2xs);
  color: var(--ac-1);
  opacity: 0.7;
}

.m-foot {
  display: flex;
  flex-direction: column;
  gap: var(--sp-4);
  opacity: 0;
  transform: translateY(20px);
  transition: all 500ms var(--ease-out) 480ms;
}

.m-menu.is-open .m-foot { opacity: 1; transform: none; }

.m-socials {
  display: flex;
  gap: var(--sp-3);
}

.m-social {
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  border-radius: var(--r-md);
  background: var(--glass-2);
  border: 1px solid var(--brd-1);
  color: var(--tx-1);
  transition: all var(--t-base);
}

.m-social:hover {
  background: var(--ac-1-dim);
  border-color: var(--brd-accent);
  color: var(--ac-1);
  transform: translateY(-3px);
}

/* ── NAV RESPONSIVE ── */
@media (max-width: 1080px) {
  .nav-links { display: none; }
  .burger { display: block; }
  .nav-cta { display: none; }
  .nav-inner { padding-left: 0.9rem; }
}

@media (max-width: 480px) {
  .nav-name { display: none; }
  .nav-sig { height: 30px; }
}

/* ═══════════════════════════════════════════════
   PAGE HERO — the banner on every inner page
   ═══════════════════════════════════════════════ */
.page-hero {
  position: relative;
  padding-top: calc(var(--nav-h) + clamp(3.5rem, 8vw, 6.5rem));
  padding-bottom: clamp(2.5rem, 6vw, 4.5rem);
  overflow: hidden;
  isolation: isolate;
}

/* Perspective grid floor receding into the distance */
.page-hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(var(--grid-line) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid-line) 1px, transparent 1px);
  background-size: 64px 64px;
  mask-image: radial-gradient(ellipse 90% 70% at 50% 0%, #000 0%, transparent 78%);
  -webkit-mask-image: radial-gradient(ellipse 90% 70% at 50% 0%, #000 0%, transparent 78%);
  z-index: -1;
  pointer-events: none;
}

.page-hero-inner {
  display: flex;
  flex-direction: column;
  gap: var(--sp-5);
  max-width: 900px;
}

.page-title {
  font-size: var(--fs-4xl);
  line-height: var(--lh-tight);
  letter-spacing: var(--ls-tight);
  margin: 0;
}

.page-desc {
  font-size: var(--fs-md);
  line-height: var(--lh-loose);
  color: var(--tx-2);
  max-width: 68ch;
  margin: 0;
}

/* ═══════════════════════════════════════════════
   FOOTER
   ═══════════════════════════════════════════════ */
.footer {
  position: relative;
  margin-top: var(--sp-16);
  padding-top: clamp(3.5rem, 7vw, 5.5rem);
  padding-bottom: var(--sp-8);
  border-top: 1px solid var(--brd-1);
  background: linear-gradient(180deg, transparent, var(--bg-1) 55%);
  overflow: hidden;
  isolation: isolate;
}

/* Aurora pool bleeding up from the bottom edge */
.footer::before {
  content: '';
  position: absolute;
  bottom: -55%;
  left: 50%;
  transform: translateX(-50%);
  width: min(1100px, 130%);
  aspect-ratio: 2 / 1;
  background: radial-gradient(
    ellipse at center,
    rgba(var(--ac-1-rgb), 0.16) 0%,
    rgba(var(--ac-2-rgb), 0.08) 45%,
    transparent 72%
  );
  filter: blur(50px);
  z-index: -1;
  pointer-events: none;
}

.footer-grid {
  display: grid;
  grid-template-columns: minmax(260px, 1.4fr) repeat(2, minmax(150px, 1fr)) minmax(200px, 1fr);
  gap: clamp(2rem, 4vw, 3.5rem);
  padding-bottom: clamp(2.5rem, 5vw, 4rem);
}

.footer-brand {
  display: flex;
  flex-direction: column;
  gap: var(--sp-4);
}

.footer-sig {
  height: 46px;
  width: auto;
  max-width: 160px;
  object-fit: contain;
  object-position: left center;
  filter: invert(1) brightness(1.9) drop-shadow(0 0 14px rgba(var(--ac-1-rgb), 0.3));
}

[data-theme='light'] .footer-sig { filter: none; }

.footer-tagline {
  font-size: var(--fs-sm);
  color: var(--tx-2);
  max-width: 34ch;
  line-height: 1.65;
}

.footer-col-title {
  font-family: var(--font-mono);
  font-size: var(--fs-3xs);
  letter-spacing: var(--ls-caps);
  text-transform: uppercase;
  color: var(--tx-3);
  margin-bottom: var(--sp-4);
}

.footer-links {
  display: flex;
  flex-direction: column;
  gap: var(--sp-3);
}

.footer-link {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  width: fit-content;
  font-size: var(--fs-sm);
  color: var(--tx-2);
  transition: color var(--t-fast), transform var(--t-fast);
}

.footer-link:hover {
  color: var(--ac-1);
  transform: translateX(4px);
}

.footer-link svg { width: 14px; height: 14px; }

.footer-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: var(--sp-4);
  padding-top: var(--sp-6);
  border-top: 1px solid var(--brd-1);
}

.footer-copy {
  font-family: var(--font-mono);
  font-size: var(--fs-2xs);
  color: var(--tx-3);
}

.footer-socials {
  display: flex;
  gap: var(--sp-2);
}

.footer-social {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: var(--r-sm);
  background: var(--glass-2);
  border: 1px solid var(--brd-1);
  color: var(--tx-2);
  transition: all var(--t-base);
}

.footer-social:hover {
  background: var(--ac-1-dim);
  border-color: var(--brd-accent);
  color: var(--ac-1);
  transform: translateY(-3px);
}

.footer-social svg { width: 16px; height: 16px; }

@media (max-width: 900px) {
  .footer-grid { grid-template-columns: 1fr 1fr; }
  .footer-brand { grid-column: 1 / -1; }
}

@media (max-width: 520px) {
  .footer-grid { grid-template-columns: 1fr; }
  .footer-bar { flex-direction: column; align-items: flex-start; }
}
