/* ── Page entrance animations ── */
@keyframes fade-in-down {
  from { opacity: 0; transform: translateY(-18px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes fade-in-up {
  from { opacity: 0; transform: translateY(24px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes fade-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}

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

:root {
  --bg: #06211A;
  --text: #F2F0EF;
  --muted: #7a8a84;
  --font: 'Panchang-Variable', 'Helvetica Neue', Arial, sans-serif;
  --font-display: 'Panchang-Variable', 'Helvetica Neue', Arial, sans-serif;
  --font-ui: 'Author-Bold', 'Helvetica Neue', Arial, sans-serif;
}

html, body {
  width: 100%; height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 13px;
  letter-spacing: 0.1em;
  overflow: hidden;
  user-select: none;
  -webkit-font-smoothing: antialiased;
}

/* ── Corner vignette — darkens edges/corners only, avoids panel shadow area ── */
.bg-vignette {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 1;
  background:
    radial-gradient(ellipse 70% 70% at top left,  rgba(0,0,0,0.38) 0%, transparent 65%),
    radial-gradient(ellipse 70% 70% at top right, rgba(0,0,0,0.38) 0%, transparent 65%);
}

.bg-grid {
  position: fixed;
  inset: 0;
  background-image:
    linear-gradient(rgba(255,255,255,0.018) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.018) 1px, transparent 1px);
  background-size: 80px 80px;
  pointer-events: none;
  z-index: 0;
  -webkit-mask-image: radial-gradient(ellipse 75% 75% at 50% 50%, black 40%, transparent 100%);
  mask-image: radial-gradient(ellipse 75% 75% at 50% 50%, black 40%, transparent 100%);
}

/* ── Decorative corner marks ── */
.deco {
  position: fixed;
  color: rgba(255,255,255,0.18);
  font-size: 16px;
  font-weight: 300;
  z-index: 50;
  pointer-events: none;
}
.deco-tl { top: 22px; left: 22px; }
.deco-tr { top: 22px; right: 22px; }
.deco-bl { bottom: 22px; left: 22px; }
.deco-br { bottom: 22px; right: 22px; }

/* ── Nav ── */
.nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 32px 48px;
  z-index: 100;
  animation: fade-in-down 0.8s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.nav-brand {
  color: var(--text);
  text-decoration: none;
  font-family: var(--font);
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.2em;
  display: flex;
  align-items: center;
}

.nav-logo {
  height: 48px;
  width: auto;
  opacity: 1;
  transition: opacity 0.4s ease;
}
.nav-logo--dim {
  opacity: 0.45;
}
.nav-brand:hover .nav-logo {
  opacity: 1 !important;
}

.nav-right {
  display: flex;
  gap: 28px;
  align-items: center;
}

.nav-link {
  color: var(--muted);
  text-decoration: none;
  font-size: 11px;
  letter-spacing: 0.18em;
  font-weight: 700;
  padding: 8px 20px;
  transition: color 0.2s;
}
.nav-link:hover { color: var(--text); }
.nav-right .nav-link:last-child { padding-right: 0; }

.nav-active {
  color: var(--text);
}

/* ── Counter ── */
.counter {
  position: fixed;
  top: 108px; left: 48px;
  z-index: 100;
  line-height: 1;
  animation: fade-in 0.8s cubic-bezier(0.22, 1, 0.36, 1) 0.2s both;
}
.counter-current {
  font-size: 34px;
  font-weight: 900;
  letter-spacing: -0.02em;
}
.counter-sep, .counter-total {
  font-size: 14px;
  font-weight: 400;
  color: var(--muted);
  letter-spacing: 0.05em;
}

/* ── Slides ── */
.slider-wrapper {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
}

.slide {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding-top: 55px;
  padding-bottom: 16px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.55s cubic-bezier(0.4, 0, 0.2, 1);
}
.slide.active {
  opacity: 1;
  pointer-events: all;
}

/* ── 3D Screen wrapper ── */
.screen-3d {
  width: min(67vw, 890px);
  aspect-ratio: 16 / 10;
  perspective: 900px;
  cursor: default;
  animation: fade-in-up 0.9s cubic-bezier(0.22, 1, 0.36, 1) 0.15s both;
}

/* ── Tablet bezel ── */
.screen-bezel {
  width: 100%;
  height: 100%;
  background: linear-gradient(160deg, #242424 0%, #181818 60%, #141414 100%);
  border-radius: 24px;
  padding: 15px;
  transform-style: preserve-3d;
  position: relative;
  border: 1px solid rgba(255,255,255,0.14);
  box-shadow:
    inset 1px 1px 0 rgba(255,255,255,0.12),
    inset -1px -1px 0 rgba(0,0,0,0.55),
    0 0 0 1px rgba(0,0,0,0.5),
    0 24px 55px rgba(0,0,0,0.55),
    0 8px 20px rgba(0,0,0,0.35);
}


/* ── Screen surface ── */
.screen-inner {
  width: 100%;
  height: 100%;
  position: relative;
  border-radius: 12px;
  overflow: hidden;
  background: #7a9bb8;
}

/* ── Placeholder ── */
.screen-placeholder {
  width: 100%;
  height: 100%;
  background: #7a9bb8;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}
.screen-placeholder::before,
.screen-placeholder::after {
  content: '';
  position: absolute;
  background: rgba(255,255,255,0.12);
}
.screen-placeholder::before { width: 100%; height: 1px; top: 50%; }
.screen-placeholder::after  { height: 100%; width: 1px; left: 50%; }

.placeholder-label {
  font-family: var(--font);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.22em;
  color: rgba(255,255,255,0.45);
  text-transform: uppercase;
  position: relative;
  z-index: 1;
}

/* ── Shine + shadow overlay ── */
.glare {
  position: absolute;
  inset: 0;
  border-radius: 12px;
  pointer-events: none;
  opacity: 0;
  mix-blend-mode: screen;
  z-index: 5;
}
.glare.visible { filter: blur(8px); }

.bezel-glare {
  position: absolute;
  inset: 0;
  border-radius: 24px;
  pointer-events: none;
  opacity: 0;
  mix-blend-mode: screen;
  z-index: 0;
}
.bezel-glare.visible { filter: blur(10px); }

/* ── Caption — sits just over the bezel border ── */
.slide-caption {
  position: relative;
  z-index: 20;
  text-align: center;
  margin-top: -20px;
  width: 100%;
  animation: fade-in-up 0.8s cubic-bezier(0.22, 1, 0.36, 1) 0.4s both;
}

.slide-title {
  font-family: var(--font-display);
  font-size: clamp(35px, 5.5vw, 70px);
  font-weight: 900;
  line-height: 0.9;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  text-align: center;
  white-space: nowrap;
  margin-top: 2px;
  color: #fff;
  text-shadow: 0 4px 18px rgba(0,0,0,0.55);
  transition: opacity 0.5s ease, transform 0.5s ease;
}

.slide:not(.active) .slide-title {
  opacity: 0;
  transform: translateY(18px);
}

/* ── Scroll hint ── */
.scroll-hint {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  animation: fade-in 0.8s cubic-bezier(0.22, 1, 0.36, 1) 0.6s both;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  font-size: 7px;
  font-weight: 700;
  letter-spacing: 0.22em;
  color: var(--muted);
  z-index: 100;
}
.scroll-line {
  width: 1px;
  height: 22px;
  background: linear-gradient(to bottom, transparent, var(--muted));
  animation: scroll-drop 2.2s ease-in-out infinite;
}
@keyframes scroll-drop {
  0%   { transform: scaleY(0); transform-origin: top; opacity: 1; }
  50%  { transform: scaleY(1); transform-origin: top; }
  51%  { transform-origin: bottom; }
  100% { transform: scaleY(0); transform-origin: bottom; opacity: 0.3; }
}

/* ── Home page hero layout ── */

/* 3D model: right half of screen */
.page-home .hero-model {
  position: fixed;
  top: 0; right: 0;
  width: 55%;
  height: 100%;
  z-index: 5;
  pointer-events: none;
}

#model-canvas {
  width: 100%;
  height: 100%;
  display: block;
}

/* Hero text: bottom-left, like the works page title */
.page-home .hero-text {
  position: fixed;
  bottom: 48px;
  left: 48px;
  z-index: 20;
  line-height: 0.88;
}

.hero-title {
  font-family: var(--font-display);
  font-size: clamp(56px, 8vw, 124px);
  font-weight: 800;
  line-height: 0.88;
  letter-spacing: 0.01em;
  text-transform: uppercase;
  color: var(--text);
  text-align: left;
  display: block;
  text-shadow: 0 4px 18px rgba(0,0,0,0.55);
  animation: fade-in-up 0.9s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.hero-title--second {
  animation-delay: 0.12s;
}

/* ── Arrows ── */
.arrow {
  position: fixed;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  cursor: pointer;
  z-index: 100;
  padding: 16px 20px;
  font-size: 0;
  transition: transform 0.42s cubic-bezier(0.4,0,0.2,1);
}
.arrow:hover { transform: translateY(-50%) scale(1.35); }
.arrow::before {
  content: '';
  display: block;
  width: 0;
  height: 0;
  transition: border-color 0.35s cubic-bezier(0.4,0,0.2,1);
}
.arrow-prev {
  left: calc(50% - min(36vw, 480px) - 88px);
}
.arrow-prev::before {
  border-top: 14px solid transparent;
  border-bottom: 14px solid transparent;
  border-right: 22px solid rgba(242,240,239,0.18);
}
.arrow-prev:hover::before {
  border-right-color: rgba(242,240,239,1.0);
}
.arrow-next {
  right: calc(50% - min(36vw, 480px) - 88px);
}
.arrow-next::before {
  border-top: 14px solid transparent;
  border-bottom: 14px solid transparent;
  border-left: 22px solid rgba(242,240,239,0.18);
}
.arrow-next:hover::before {
  border-left-color: rgba(242,240,239,1.0);
}

/* ── Burger button (hidden on desktop) ── */
.nav-burger {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 6px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px;
  z-index: 200;
  position: relative;
}
.nav-burger span {
  display: block;
  width: 26px;
  height: 2px;
  background: var(--text);
  border-radius: 2px;
  transform-origin: center;
  transition: transform 0.38s cubic-bezier(0.22,1,0.36,1),
              opacity 0.25s ease,
              width 0.3s ease;
}

/* Mobile menu overlay (hidden by default) */
.mobile-menu {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 150;
  background-color: #06211A;
  background-image:
    linear-gradient(rgba(255,255,255,0.018) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.018) 1px, transparent 1px);
  background-size: 80px 80px;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 36px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.4s cubic-bezier(0.22,1,0.36,1);
}
.mobile-menu::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 70% 70% at top left,    rgba(0,0,0,0.38) 0%, transparent 65%),
    radial-gradient(ellipse 70% 70% at top right,   rgba(0,0,0,0.38) 0%, transparent 65%),
    radial-gradient(ellipse 70% 70% at bottom left, rgba(0,0,0,0.32) 0%, transparent 65%),
    radial-gradient(ellipse 70% 70% at bottom right,rgba(0,0,0,0.32) 0%, transparent 65%);
  pointer-events: none;
}
.mobile-menu.open {
  opacity: 1;
  pointer-events: all;
}
.mobile-menu-link {
  font-family: var(--font-display);
  font-size: clamp(22px, 7vw, 38px);
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: rgba(242,240,239,0.65);
  text-decoration: none;
  opacity: 0;
  transform: translateY(18px);
  text-shadow: 0 2px 12px rgba(0,0,0,0.4);
  transition: opacity 0.4s cubic-bezier(0.22,1,0.36,1),
              transform 0.45s cubic-bezier(0.22,1,0.36,1),
              color 0.2s ease;
  position: relative;
  z-index: 1;
}
.mobile-menu-link:hover { color: rgba(242,240,239,0.9); }

.mobile-menu.open #mob-nav-about           { opacity: 1; transform: none; transition-delay: 0.08s; }
.mobile-menu.open #mob-nav-services        { opacity: 1; transform: none; transition-delay: 0.14s; }
.mobile-menu.open #mob-nav-works           { opacity: 1; transform: none; transition-delay: 0.20s; }
.mobile-menu.open #mob-nav-contact         { opacity: 1; transform: none; transition-delay: 0.26s; }

.status-line--right { display: none; }

/* ── Tablet / small-laptop overrides (768 px – 1100 px) ── */
@media (min-width: 768px) and (max-width: 1100px) {
  /* Works — shrink screen and pull arrows inward so they don't clip */
  .screen-3d {
    width: min(74vw, 780px);
  }
  .arrow-prev {
    left: calc(50% - min(38vw, 430px) - 60px);
  }
  .arrow-next {
    right: calc(50% - min(38vw, 430px) - 60px);
  }

  /* Works — tighten caption so title doesn't overflow narrow viewports */
  .slide-title {
    font-size: clamp(28px, 4.5vw, 60px);
  }

  /* Nav — less padding on smaller viewports */
  .nav {
    padding: 24px 32px;
  }
  .status-bar {
    left: 32px;
    right: 32px;
  }
}

/* ── Mobile overrides ── */
@media (max-width: 767px) {
  .scroll-hint { display: none; }
  .status-coords { display: none; }
  .status-line--right { display: block; }
  .nav-right { display: none; }
  .nav-burger { display: flex; }
  .mobile-menu { display: flex; }
  .nav {
    z-index: 200;
    padding-top: calc(32px + env(safe-area-inset-top));
  }
  .deco { z-index: 160; }

  .nav-burger.open span:nth-child(1) { transform: translateY(8px) rotate(45deg); }
  .nav-burger.open span:nth-child(2) { opacity: 0; transform: scaleX(0); }
  .nav-burger.open span:nth-child(3) { transform: translateY(-8px) rotate(-45deg); }

  .page-home .hero-text {
    left: 24px;
    bottom: calc(53px + env(safe-area-inset-bottom));
    right: 24px;
    overflow: hidden;
  }

  .about-label {
    margin-bottom: 0.35rem;
  }
  .about-title {
    font-size: clamp(22px, 6.5vw, 32px);
    margin: 0 0 0.65rem;
  }
  .about-bio {
    max-width: none;
    font-size: clamp(0.72rem, 2.2vw, 0.85rem);
    line-height: 1.45;
    margin: 0 0 0.55rem;
  }
  .about-bio:last-of-type {
    margin-bottom: 0;
  }
  .about-stats {
    gap: 1.6rem;
  }
  .hero-title {
    font-size: clamp(28px, 10vw, 48px);
    white-space: nowrap;
  }

  /* ── Works — mobile layout ── */

  /* Thinner bezel on mobile */
  .screen-bezel {
    padding: 7px;
    border-radius: 14px;
  }
  .screen-inner { border-radius: 8px; }

  /* Panel: almost full width, square */
  .screen-3d {
    width: calc(100vw - 32px);
    aspect-ratio: 1 / 1;
  }

  /* Slide: panel centered, shifted up slightly */
  .slide {
    justify-content: center;
    padding-top: 0;
    padding-bottom: 80px;
    padding-left: 0;
    padding-right: 0;
    overflow: visible;
    gap: 8px;
  }

  /* Dots: visible, in flex flow above panel */
  .slide-dots {
    display: flex;
  }

  /* Title pinned to bottom, outside flex flow */
  .slide-caption {
    position: absolute;
    bottom: calc(50% - 50vw - 70px);
    left: 16px;
    right: 16px;
    width: auto;
    margin-top: 0;
    padding: 0;
    text-align: center;
  }

  .slide-title {
    font-size: clamp(28px, 9vw, 46px);
    white-space: normal;
    text-align: center;
    margin-top: 0;
  }

  /* Remove greyscale tint on mobile */
  .screen-inner { filter: none; }

  /* Arrows: circular button style matching services carousel */
  .arrow {
    top: calc(50% - 50vw - 50px);
    bottom: auto;
    width: 40px;
    height: 40px;
    padding: 0;
    border-radius: 50%;
    border: 1px solid rgba(242,240,239,0.18);
    color: rgba(242,240,239,0.55);
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transform: none !important;
    transition: border-color 0.2s, color 0.2s;
    touch-action: manipulation;
  }
  .arrow::before { display: none; }
  .arrow:hover,
  .arrow:focus,
  .arrow:active { transform: none !important; border-color: rgba(242,240,239,0.5); color: rgba(242,240,239,0.9); }
  .arrow-prev { left: calc(50% - 120px); }
  .arrow-next { right: calc(50% - 120px); }
}
