/* ==========================================================================
   LAYOUT.CSS — Navigation, Sections, Chapter Grid, Transitions
   Ulises Paiz Portfolio — Dark Cinematic Theme
   ========================================================================== */

/* --------------------------------------------------------------------------
   Navigation — Fixed Glassmorphism Bar
   -------------------------------------------------------------------------- */
.nav {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  z-index: 100;
  padding: 1.25rem 3rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(8, 8, 10, 0.6);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid rgba(0, 212, 255, 0.06);
  opacity: 0;
  transform: translateY(-100%);
  transition: padding 0.4s var(--ease-out-expo),
              background 0.4s var(--ease-out-expo),
              opacity 0.5s var(--ease-out-expo),
              transform 0.5s var(--ease-out-expo);
}

/* JS toggles .visible when scrolling past hero */
.nav.visible {
  opacity: 1;
  transform: translateY(0);
  padding: 0.8rem 3rem;
  background: rgba(8, 8, 10, 0.9);
}

.nav-logo {
  font-family: var(--font-display);
  font-size: 1.1rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--text-primary);
  position: relative;
  z-index: 110;
}

.nav-logo span {
  color: var(--accent);
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 2.5rem;
}

.nav-links a {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  color: var(--text-secondary);
  position: relative;
  transition: color 0.3s var(--ease-out-expo);
}

.nav-links a:hover,
.nav-links a.active {
  color: var(--accent);
}

.nav-links a::after {
  content: '';
  position: absolute;
  bottom: -4px;
  left: 0;
  width: 0;
  height: 1px;
  background: var(--accent);
  transition: width 0.4s var(--ease-out-expo);
}

.nav-links a:hover::after,
.nav-links a.active::after {
  width: 100%;
}

/* --------------------------------------------------------------------------
   Chapter Dot Navigation (Right Side) — .chapter-nav
   -------------------------------------------------------------------------- */
.chapter-nav {
  position: fixed;
  right: 2rem;
  top: 50%;
  transform: translateY(-50%);
  z-index: 90;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 1.5rem;
}

.chapter-dot {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  cursor: pointer;
  background: none;
  border: none;
  padding: 0;
  position: relative;
}

/* The dot indicator rendered via ::after pseudo-element */
.chapter-dot::after {
  content: '';
  display: block;
  width: 6px;
  height: 6px;
  border-radius: 1px;
  background: var(--text-muted);
  transition: background 0.3s var(--ease-out-expo),
              box-shadow 0.3s var(--ease-out-expo),
              transform 0.3s var(--ease-out-expo);
  flex-shrink: 0;
}

/* JS toggles .active on chapter dots */
.chapter-dot.active::after {
  background: var(--text-primary);
  box-shadow: 0 0 8px rgba(0, 212, 255, 0.4),
              0 0 20px rgba(0, 212, 255, 0.15);
  transform: scale(1.3);
}

.chapter-dot-label {
  font-family: var(--font-mono);
  font-size: 0.6rem;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  color: var(--text-muted);
  opacity: 0;
  transform: translateX(5px);
  transition: opacity 0.3s var(--ease-out-expo),
              transform 0.3s var(--ease-out-expo),
              color 0.3s var(--ease-out-expo);
  white-space: nowrap;
  order: -1;
}

.chapter-dot:hover .chapter-dot-label,
.chapter-dot.active .chapter-dot-label {
  opacity: 1;
  transform: translateX(0);
  color: var(--accent);
}

/* --------------------------------------------------------------------------
   Mobile Nav Toggle (Hamburger / X)
   -------------------------------------------------------------------------- */
.nav-toggle {
  display: none;
  flex-direction: column;
  gap: 5px;
  width: 24px;
  cursor: pointer;
  position: relative;
  z-index: 110;
  background: none;
  border: none;
  padding: 4px 0;
}

.nav-toggle-bar {
  display: block;
  width: 100%;
  height: 1px;
  background: var(--text-primary);
  transition: transform 0.4s var(--ease-out-expo),
              opacity 0.3s;
}

/* Hamburger to X transition — JS toggles .open */
.nav-toggle.open .nav-toggle-bar:nth-child(1) {
  transform: translateY(6px) rotate(45deg);
}

.nav-toggle.open .nav-toggle-bar:nth-child(2) {
  opacity: 0;
}

.nav-toggle.open .nav-toggle-bar:nth-child(3) {
  transform: translateY(-6px) rotate(-45deg);
}

/* --------------------------------------------------------------------------
   Mobile Nav Overlay — .mobile-nav
   -------------------------------------------------------------------------- */
.mobile-nav {
  position: fixed;
  inset: 0;
  z-index: 105;
  background: rgba(8, 8, 10, 0.97);
  backdrop-filter: blur(30px);
  -webkit-backdrop-filter: blur(30px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.5s var(--ease-out-expo),
              visibility 0.5s;
}

/* JS toggles .open */
.mobile-nav.open {
  opacity: 1;
  visibility: visible;
}

.mobile-nav-link {
  display: block;
  font-family: var(--font-display);
  font-size: clamp(2rem, 6vw, 3.5rem);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-secondary);
  padding: 0.75rem 0;
  transition: color 0.3s var(--ease-out-expo);
}

.mobile-nav-link:hover {
  color: var(--text-primary);
}

.mobile-nav-num {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  letter-spacing: 0.15em;
  color: var(--text-muted);
  margin-right: 1rem;
  vertical-align: middle;
}

.mobile-nav-divider {
  width: 40px;
  height: 1px;
  background: rgba(0, 212, 255, 0.06);
  margin: 0.5rem 0;
}

/* Lock body scroll when nav is open */
body.nav-open {
  overflow: hidden;
}

/* --------------------------------------------------------------------------
   Section Base
   -------------------------------------------------------------------------- */
.section {
  min-height: 100vh;
  position: relative;
  padding: 8rem 2rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

.container {
  max-width: 1100px;
  width: 100%;
  margin: 0 auto;
  position: relative;
}

/* --------------------------------------------------------------------------
   Chapter Content Layout — 2-Column Grid
   -------------------------------------------------------------------------- */
.chapter-content {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4rem;
  align-items: center;
}

.chapter-content.reverse {
  direction: rtl;
}

.chapter-content.reverse > * {
  direction: ltr;
}

.chapter-text {
  position: relative;
}

.chapter-visual {
  position: relative;
}

/* --------------------------------------------------------------------------
   Chapter Labels & Watermark Number
   -------------------------------------------------------------------------- */
.chapter-label {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.3em;
  color: var(--text-muted);
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.chapter-label::before {
  content: '';
  display: inline-block;
  width: 30px;
  height: 1px;
  background: var(--accent);
}

.chapter-number-bg {
  position: absolute;
  top: -0.5em;
  left: -0.3em;
  font-family: var(--font-display);
  font-size: clamp(8rem, 18vw, 16rem);
  color: rgba(0, 212, 255, 0.03);
  line-height: 1;
  pointer-events: none;
  user-select: none;
  z-index: -1;
}

/* --------------------------------------------------------------------------
   Chapter Text Styles
   -------------------------------------------------------------------------- */
.chapter-text h2 {
  font-family: var(--font-display);
  font-size: clamp(3rem, 7vw, 5.5rem);
  line-height: 0.95;
  letter-spacing: 0.02em;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-primary);
  margin-bottom: 2rem;
}

.chapter-text .highlight {
  color: var(--accent);
  transition: color 0.5s;
}

.chapter-text p {
  color: var(--text-secondary);
  font-size: clamp(1.05rem, 1.5vw, 1.2rem);
  line-height: 1.85;
  font-weight: 300;
  margin-bottom: 1.2rem;
  max-width: 540px;
}

.chapter-text p:last-child {
  margin-bottom: 0;
}

/* --------------------------------------------------------------------------
   Chapter Wipe Transitions
   -------------------------------------------------------------------------- */
.chapter-wipe {
  position: relative;
  min-height: 40vh;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  background: var(--bg-primary);
}

.wipe-line {
  width: 60px;
  height: 1px;
  background: var(--accent);
  opacity: 0.2;
}

.wipe-number {
  font-family: var(--font-display);
  font-size: clamp(4rem, 10vw, 8rem);
  color: rgba(255, 255, 255, 0.03);
  position: absolute;
  pointer-events: none;
  user-select: none;
}

/* --------------------------------------------------------------------------
   Section Image (shared style for photos with dark overlays)
   -------------------------------------------------------------------------- */
.section-image {
  width: 100%;
  border-radius: 8px;
  overflow: hidden;
  position: relative;
  border: 1px solid rgba(0, 212, 255, 0.1);
  border-top: 2px solid var(--accent);
  box-shadow: 0 20px 60px rgba(0,0,0,0.4);
  transition: border-color 0.5s, box-shadow 0.5s;
}

.section-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.section-image::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, transparent 40%, rgba(8, 8, 10, 0.6) 100%);
  pointer-events: none;
}

/* --------------------------------------------------------------------------
   Back to Top Button
   -------------------------------------------------------------------------- */
.back-to-top {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--bg-elevated);
  border: 1px solid rgba(0, 212, 255, 0.08);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 80;
  opacity: 0;
  visibility: hidden;
  transform: translateY(10px);
  transition: opacity 0.4s var(--ease-out-expo),
              visibility 0.4s,
              transform 0.4s var(--ease-out-expo),
              background 0.3s;
  cursor: pointer;
}

/* JS toggles .visible */
.back-to-top.visible {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.back-to-top:hover {
  background: rgba(0, 212, 255, 0.08);
}

.back-to-top svg {
  width: 16px;
  height: 16px;
  stroke: var(--text-secondary);
  fill: none;
  stroke-width: 1.5;
}
