/* ============================================
   PUZZLE TEXT ASSEMBLY - Design #073
   ACN Agency
   ============================================ */

@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:wght@400;500;600;700&display=swap');

/* ---------- CSS Variables ---------- */
:root {
  --midnight: #0d1b2a;
  --gold: #c9a84c;
  --cream: #f5f5dc;
  --shadow: rgba(13, 27, 42, 0.4);
  --font: 'Playfair Display', Georgia, serif;
}

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

html {
  scroll-behavior: smooth;
}

body {
  font-family: var(--font);
  background: var(--midnight);
  color: var(--cream);
  overflow-x: hidden;
  line-height: 1.6;
}

/* ---------- Page Sections ---------- */
section {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 4rem 2rem;
  position: relative;
}

section:nth-child(even) {
  background: linear-gradient(180deg, var(--midnight) 0%, #132238 50%, var(--midnight) 100%);
}

/* ---------- Puzzle Text Container ---------- */
.puzzle-text {
  position: relative;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.1em;
  padding: 2rem;
}

/* ---------- Individual Letter Pieces ---------- */
.letter {
  display: inline-block;
  font-size: clamp(3rem, 10vw, 8rem);
  font-weight: 600;
  color: var(--cream);
  position: relative;
  transition: transform 0.8s cubic-bezier(0.34, 1.56, 0.64, 1),
              color 0.4s ease,
              text-shadow 0.4s ease;
  text-shadow: 
    2px 2px 4px var(--shadow),
    4px 4px 8px rgba(0, 0, 0, 0.3);
  will-change: transform, opacity;
  cursor: default;
}

/* Gold accent for specific letters */
.letter.gold {
  color: var(--gold);
  text-shadow: 
    2px 2px 4px var(--shadow),
    4px 4px 8px rgba(0, 0, 0, 0.3),
    0 0 20px rgba(201, 168, 76, 0.3);
}

/* Letter depth/shadow layers */
.letter::before {
  content: attr(data-letter);
  position: absolute;
  top: 3px;
  left: 3px;
  color: rgba(0, 0, 0, 0.3);
  z-index: -1;
  transition: transform 0.8s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* ---------- Assembled State (scrolled to) ---------- */
.letter.assembled {
  color: var(--cream);
  text-shadow: 
    3px 3px 6px var(--shadow),
    6px 6px 12px rgba(0, 0, 0, 0.4),
    0 0 30px rgba(245, 245, 220, 0.1);
  transform: translate(0, 0) !important;
  opacity: 1 !important;
}

.letter.assembled::before {
  transform: translate(0, 0) !important;
}

/* ---------- Scattered State (initial) ---------- */
.letter.scattered {
  opacity: 0.3;
}

/* ---------- Hover Effect ---------- */
.letter:hover {
  color: var(--gold);
  transform: scale(1.1) translateY(-5px);
  text-shadow: 
    3px 3px 6px var(--shadow),
    6px 6px 12px rgba(0, 0, 0, 0.4),
    0 0 25px rgba(201, 168, 76, 0.5);
}

.letter:hover::before {
  transform: translate(2px, 2px);
}

/* ---------- Subtitle Text ---------- */
.subtitle {
  font-size: clamp(1rem, 2.5vw, 1.5rem);
  font-weight: 400;
  color: var(--gold);
  letter-spacing: 0.3em;
  text-transform: uppercase;
  margin-top: 2rem;
  opacity: 0;
  transform: translateY(30px);
  transition: all 1s ease 0.5s;
}

.subtitle.visible {
  opacity: 1;
  transform: translateY(0);
}

/* ---------- Decorative Line ---------- */
.line {
  width: 60px;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--gold), transparent);
  margin: 2rem auto;
  opacity: 0;
  transition: opacity 1s ease 0.8s;
}

.line.visible {
  opacity: 1;
}

/* ---------- Navigation ---------- */
nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  padding: 1.5rem 3rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: linear-gradient(180deg, var(--midnight) 0%, transparent 100%);
}

nav .logo {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--cream);
  text-decoration: none;
  letter-spacing: 0.1em;
}

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

nav ul {
  display: flex;
  list-style: none;
  gap: 2.5rem;
}

nav ul li a {
  color: var(--cream);
  text-decoration: none;
  font-size: 0.9rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  opacity: 0.7;
  transition: all 0.3s ease;
  position: relative;
}

nav ul li a::after {
  content: '';
  position: absolute;
  bottom: -5px;
  left: 0;
  width: 0;
  height: 1px;
  background: var(--gold);
  transition: width 0.3s ease;
}

nav ul li a:hover {
  opacity: 1;
  color: var(--gold);
}

nav ul li a:hover::after {
  width: 100%;
}

/* ---------- Page Footer ---------- */
footer {
  text-align: center;
  padding: 3rem 2rem;
  color: var(--cream);
  opacity: 0.5;
  font-size: 0.85rem;
  letter-spacing: 0.1em;
  border-top: 1px solid rgba(245, 245, 220, 0.1);
}

footer span {
  color: var(--gold);
}

/* ---------- Scroll Progress ---------- */
.scroll-progress {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  width: 50px;
  height: 50px;
  z-index: 100;
}

.scroll-progress svg {
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}

.scroll-progress circle {
  fill: none;
  stroke-width: 2;
}

.scroll-progress .bg {
  stroke: rgba(245, 245, 220, 0.2);
}

.scroll-progress .progress {
  stroke: var(--gold);
  stroke-linecap: round;
  transition: stroke-dashoffset 0.3s ease;
}

/* ---------- Scroll Indicator ---------- */
.scroll-indicator {
  position: absolute;
  bottom: 3rem;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  animation: bounce 2s infinite;
}

.scroll-indicator span {
  font-size: 0.7rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--gold);
  opacity: 0.7;
}

.scroll-indicator .arrow {
  width: 20px;
  height: 20px;
  border-right: 2px solid var(--gold);
  border-bottom: 2px solid var(--gold);
  transform: rotate(45deg);
  opacity: 0.7;
}

@keyframes bounce {
  0%, 20%, 50%, 80%, 100% { transform: translateX(-50%) translateY(0); }
  40% { transform: translateX(-50%) translateY(-10px); }
  60% { transform: translateX(-50%) translateY(-5px); }
}

/* ---------- Responsive ---------- */
@media (max-width: 768px) {
  nav {
    padding: 1rem 1.5rem;
  }
  
  nav ul {
    display: none;
  }
  
  section {
    padding: 2rem 1rem;
  }
  
  .puzzle-text {
    padding: 1rem;
  }
}
