/* ============================================================
   layout.css v3
   Navigation, Cursor, Preloader, Progress
   ============================================================ */

/* ─── NAVIGATION ─────────────────────────────────────────── */
.nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--nav-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 2.5rem;
  z-index: var(--z-nav);
  background: rgba(245, 243, 239, 0.92);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border-bottom: 1px solid var(--color-border);
  transition: background var(--dur-slow) ease,
              border-color var(--dur-slow) ease;
}

/* Transparent over hero / full-bleed images */
.nav--over-hero {
  background: transparent;
  border-bottom-color: transparent;
}

/* Brand */
.nav__brand {
  font-family: var(--font-body);
  font-size: var(--text-sm);
  font-weight: 400;
  
  text-transform: uppercase;
  color: var(--color-text);
  transition: color var(--dur-slow) ease, opacity var(--dur-fast) ease;
  white-space: nowrap;
  flex-shrink: 0;
}
.nav--over-hero .nav__brand { color: var(--hero-text); }
.nav__brand:hover { opacity: 0.55; }

/* Center links */
.nav__center {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: var(--space-lg);
}

.nav__link {
  font-family: var(--font-body);
  font-size: var(--text-sm);
  font-weight: 300;
  
  text-transform: uppercase;
  color: var(--color-text);
  opacity: 0.5;
  transition: opacity var(--dur-fast) ease, color var(--dur-slow) ease;
  position: relative;
}
.nav--over-hero .nav__link { color: var(--hero-text); }
.nav__link::after {
  content: '';
  position: absolute;
  bottom: -3px; left: 0;
  width: 0; height: 1px;
  background: currentColor;
  transition: width var(--dur-normal) var(--ease-out);
}
.nav__link:hover, .nav__link.is-active { opacity: 1; }
.nav__link:hover::after, .nav__link.is-active::after { width: 100%; }

/* Contact right */
.nav__contact {
  font-family: var(--font-body);
  font-size: var(--text-sm);
  font-weight: 400;
  
  text-transform: uppercase;
  color: var(--color-text);
  opacity: 0.5;
  transition: opacity var(--dur-fast) ease, color var(--dur-slow) ease;
  flex-shrink: 0;
}
.nav--over-hero .nav__contact { color: var(--hero-text); }
.nav__contact:hover, .nav__contact.is-active { opacity: 1; }

/* ─── HAMBURGER ──────────────────────────────────────────── */
.nav__hamburger {
  display: none;
  flex-direction: column;
  gap: 5px;
  padding: 10px;
  -webkit-tap-highlight-color: transparent;
}
.nav__hamburger span {
  display: block;
  width: 22px; height: 1px;
  background: var(--color-text);
  transition: transform var(--dur-normal) var(--ease-out),
              opacity var(--dur-normal) ease;
}
.nav--over-hero .nav__hamburger span { background: var(--hero-text); }

.mobile-menu {
  position: fixed;
  inset: 0;
  background: var(--color-bg);
  z-index: calc(var(--z-nav) - 1);
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  padding: 0 var(--space-md);
  gap: var(--space-md);
  opacity: 0;
  pointer-events: none;
  transform: translateY(-10px);
  transition: opacity var(--dur-slow) var(--ease-out),
              transform var(--dur-slow) var(--ease-out);
}
.mobile-menu.is-open {
  opacity: 1;
  pointer-events: all;
  transform: translateY(0);
}
.mobile-menu a {
  font-family: var(--font-display);
  font-size: var(--text-2xl);
  font-weight: 300;
  
  color: var(--color-text);
  border-bottom: 1px solid var(--color-border);
  width: 100%;
  padding-bottom: var(--space-sm);
  transition: color var(--dur-fast) ease;
}
.mobile-menu a:hover { color: var(--color-accent); }

@media (max-width: 1023px) {
  .nav__center, .nav__contact { display: none; }
  .nav__hamburger { display: flex; }
}
@media (min-width: 1024px) {
  .nav__hamburger { display: none; }
  .mobile-menu    { display: none; }
}

/* ─── CUSTOM CURSOR ──────────────────────────────────────── */
.cursor {
  position: fixed;
  top: 0; left: 0;
  pointer-events: none;
  z-index: var(--z-cursor);
}
.cursor__dot {
  position: absolute;
  width: 5px; height: 5px;
  background: var(--color-text);
  border-radius: 50%;
  transform: translate(-50%, -50%);
  transition: width var(--dur-fast) ease, height var(--dur-fast) ease,
              background var(--dur-normal) ease;
}
.cursor__ring {
  position: absolute;
  width: 32px; height: 32px;
  border: 1px solid rgba(17, 16, 14, 0.30);
  border-radius: 50%;
  transform: translate(-50%, -50%);
  transition: width var(--dur-normal) var(--ease-out),
              height var(--dur-normal) var(--ease-out),
              border-color var(--dur-normal) ease;
}
.cursor--light .cursor__dot  { background: var(--hero-text); }
.cursor--light .cursor__ring { border-color: rgba(240,237,232,0.4); }
.cursor.is-hovering .cursor__ring  { width: 52px; height: 52px; border-color: var(--color-accent); }
.cursor.is-image .cursor__dot      { width: 44px; height: 44px; background: rgba(17,16,14,0.06); border: 1px solid rgba(17,16,14,0.20); }
.cursor.is-image .cursor__ring     { opacity: 0; }
.cursor--light.is-image .cursor__dot { background: rgba(240,237,232,0.10); border-color: rgba(240,237,232,0.30); }
@media (hover: none) { .cursor { display: none; } }

/* ─── PROGRESS BAR ───────────────────────────────────────── */
.progress-bar {
  position: fixed;
  bottom: 0; left: 0;
  width: 100%; height: 2px;
  background: var(--color-border);
  z-index: var(--z-nav);
  pointer-events: none;
}
.progress-bar__fill {
  height: 100%;
  width: 0%;
  background: var(--color-text);
  transition: width 40ms linear;
}

/* ─── PRELOADER — seamless SVG square mask reveal, index only ─ */
.preloader {
  position: fixed;
  inset: 0;
  z-index: var(--z-preloader);
  pointer-events: all;
  overflow: hidden;
  background: transparent;
}

.preloader__svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  overflow: hidden;
}

.preloader__overlay {
  fill: #F0EEE6;
  shape-rendering: crispEdges;
  will-change: opacity;
}

.preloader__mask-full,
.preloader__mask-window {
  shape-rendering: crispEdges;
}

/* ─── PAGE TRANSITION OVERLAY ────────────────────────────── */
.page-overlay {
  position: fixed;
  inset: 0;
  background: var(--color-bg);
  z-index: calc(var(--z-preloader) - 1);
  transform: translateX(100%);
  pointer-events: none;
}

/* ─── EXPLORE HINT ───────────────────────────────────────── */
.explore-hint {
  position: fixed;
  right: 2rem;
  top: 50%;
  transform: translateY(-50%);
  z-index: var(--z-raised);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.6rem;
  color: rgba(240,237,232,0.5);
  cursor: auto;
  opacity: 0;
  transition: color var(--dur-normal) ease;
}
.explore-hint:hover { color: var(--hero-text); }
.explore-hint__label {
  writing-mode: vertical-rl;
  transform: rotate(180deg);
  font-family: var(--font-body);
  font-size: var(--text-xs);
  font-weight: 400;
  
  text-transform: uppercase;
}
.explore-hint__arrow {
  width: 1px; height: 44px;
  background: currentColor;
  position: relative;
  animation: hintPulse 2.4s ease-in-out infinite;
}
.explore-hint__arrow::after {
  content: '';
  position: absolute;
  bottom: 0; left: -3px;
  width: 7px; height: 7px;
  border-right: 1px solid currentColor;
  border-bottom: 1px solid currentColor;
  transform: rotate(45deg) translateY(-2px);
}
@keyframes hintPulse {
  0%, 100% { opacity: 0.4; }
  50%       { opacity: 1; }
}
@media (max-width: 767px) { .explore-hint { display: none; } }

/* V12 — default cursor */
.cursor { display: none !important; }

/* V13.9 — force arrow cursor everywhere, including selectable text */
*, *::before, *::after,
a, button, input, textarea, select, label,
p, span, h1, h2, h3, h4, h5, h6,
[role="button"], [data-cursor], .project-link, .nav-link, .contact-direct__link {
  cursor: default !important;
}


/* V14.1 — prevent first-frame flash before page-entry animations.
   Project detail already behaved correctly; these states make Projects/About/Contact behave the same way. */
body.page-about .about-bg__img,
body.page-about .about-statement,
body.page-about .about-details,
body.page-about .about-explore,
body.page-contact .contact-info,
body.page-contact .contact-form,
body.page-projects .projects-header {
  opacity: 0;
  visibility: hidden;
}

body.page-about.is-page-ready .about-bg__img,
body.page-about.is-page-ready .about-statement,
body.page-about.is-page-ready .about-details,
body.page-about.is-page-ready .about-explore,
body.page-contact.is-page-ready .contact-info,
body.page-contact.is-page-ready .contact-form,
body.page-projects.is-page-ready .projects-header {
  visibility: visible;
}

/* V15 — Bone background loader for inner pages. */
.page-bg-loader {
  position: fixed;
  inset: 0;
  z-index: var(--z-preloader);
  background: #E5D7C4;
  pointer-events: none;
  opacity: 1;
  transform: translateY(0);
  transition:
    opacity 0.3s ease,
    transform 0.3s cubic-bezier(0.76, 0, 0.24, 1);
  will-change: opacity, transform;
}

body.page-bg-loaded .page-bg-loader {
  opacity: 0;
  transform: translateY(-100%);
}

/* V17 — index horizontal panels: dark nav/explore over light project panels */
body.page-index.index-on-light-panel .nav,
body.page-index .nav.nav--on-light {
  background: transparent !important;
  border-bottom-color: transparent !important;
}

body.page-index.index-on-light-panel .nav .nav__brand,
body.page-index.index-on-light-panel .nav .nav__link,
body.page-index.index-on-light-panel .nav .nav__contact,
body.page-index .nav.nav--on-light .nav__brand,
body.page-index .nav.nav--on-light .nav__link,
body.page-index .nav.nav--on-light .nav__contact {
  color: var(--color-text) !important;
}

body.page-index.index-on-light-panel .nav .nav__hamburger span,
body.page-index .nav.nav--on-light .nav__hamburger span {
  background: var(--color-text) !important;
}

body.page-index.index-on-light-panel .explore-hint,
body.page-index .explore-hint.explore-hint--on-light {
  color: rgba(17, 16, 14, 0.55) !important;
}

body.page-index.index-on-light-panel .explore-hint:hover,
body.page-index .explore-hint.explore-hint--on-light:hover {
  color: var(--color-text) !important;
}


/* V20.5 Typography */
h1, h2, h3, .hero-title, .project-title {
  font-family: 'Cal Sans', sans-serif;
}

body, p, span, a, .menu, .small-text {
  font-family: 'Quicksand', sans-serif;
  font-weight: 300;
}

/* V2.2 — prevent About statement descenders from clipping */
body.page-about .about-statement,
body.page-about .about-statement .line-wrap,
body.page-about .about-statement .line { overflow: visible !important; }
