/* ============================================
   ARCHITECTURAL DRAWING ANIMATION
   From Drawing to Living Space
   ============================================ */

/* Section Container */
.architectural-animation-section {
  position: relative;
  min-height: 40vh;
  background: var(--color-deep-charcoal, #191A18);
  overflow: hidden;
  padding: var(--spacing-xl) 0;
}

.architectural-animation-section .container {
  position: relative;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--spacing-2xl);
}

.architectural-animation-section .section-header {
  flex: 1;
  max-width: 50%;
  margin-bottom: 0;
}

/* Animation Canvas */
.architecture-canvas {
  position: relative;
  width: 100%;
  max-width: 1400px;
  aspect-ratio: 16/9;
  margin: 0 auto;
}

/* Stage A - Blank Canvas */
.stage-canvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: var(--color-deep-charcoal, #191A18);
  opacity: 1;
  transition: opacity 1s ease;
}

.stage-canvas.hidden {
  opacity: 0;
}

/* Technical Grid */
.technical-grid {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  transition: opacity 1s ease;
}

.technical-grid.visible {
  opacity: 0.1;
}

/* Geometric Square */
.geo-center-square {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0);
  width: 200px;
  height: 200px;
  border: 2px solid var(--color-bronze);
  opacity: 0;
  transition: all 1s ease;
}

.geo-center-square.visible {
  transform: translate(-50%, -50%) scale(1);
  opacity: 0.3;
}

/* Measurement Ticks */
.measurement-ticks {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  transition: opacity 1s ease;
}

.measurement-ticks.visible {
  opacity: 0.15;
}

/* Stage B - Floor Plan */
.floor-plan-svg {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  transition: opacity 1s ease;
}

.floor-plan-svg.visible {
  opacity: 1;
}

.floor-plan-line {
  stroke: var(--color-bronze);
  stroke-width: 2;
  fill: none;
  stroke-dasharray: 1000;
  stroke-dashoffset: 1000;
  opacity: 0.8;
}

.floor-plan-line.animate {
  animation: drawPath 3s ease forwards;
}

.floor-plan-wall {
  stroke: var(--color-white);
  stroke-width: 3;
  fill: none;
  stroke-dasharray: 1500;
  stroke-dashoffset: 1500;
  opacity: 0.9;
}

.floor-plan-wall.animate {
  animation: drawPath 4s ease forwards;
}

@keyframes drawPath {
  to {
    stroke-dashoffset: 0;
  }
}

/* Stage C - Building Elevation */
.elevation-svg {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  transition: opacity 1.5s ease;
}

.elevation-svg.visible {
  opacity: 1;
}

.elevation-line {
  stroke: var(--color-white);
  stroke-width: 2;
  fill: none;
  stroke-dasharray: 800;
  stroke-dashoffset: 800;
  opacity: 0.9;
}

.elevation-line.animate {
  animation: drawPath 2.5s ease forwards;
}

.elevation-line.animate-delay-1 {
  animation-delay: 0.5s;
}

.elevation-line.animate-delay-2 {
  animation-delay: 1s;
}

.elevation-line.animate-delay-3 {
  animation-delay: 1.5s;
}

/* Stage D - 3D Wireframe */
.wireframe-svg {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  transition: opacity 2s ease;
}

.wireframe-svg.visible {
  opacity: 1;
}

.wireframe-line {
  stroke: var(--color-bronze);
  stroke-width: 1.5;
  fill: none;
  stroke-dasharray: 600;
  stroke-dashoffset: 600;
  opacity: 0.7;
}

.wireframe-line.animate {
  animation: drawPath 2s ease forwards;
}

/* Stage E - Finished Architecture */
.finished-image {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  transition: opacity 2s ease;
}

.finished-image.visible {
  opacity: 1;
}

.finished-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Text Overlay */
.animation-text {
  position: absolute;
  bottom: 10%;
  left: 5%;
  right: 5%;
  color: var(--color-white);
  z-index: 10;
  opacity: 0;
  transform: translateY(30px);
  transition: all 1s ease;
}

.animation-text.visible {
  opacity: 1;
  transform: translateY(0);
}

.animation-text h2 {
  color: var(--color-white);
  font-size: clamp(1.5rem, 3vw, 2.5rem);
  margin-bottom: var(--spacing-md);
}

.animation-text p {
  color: rgba(255, 255, 255, 0.8);
  font-size: clamp(1rem, 2vw, 1.25rem);
  max-width: 700px;
}

/* Animation Progress Indicator */
.animation-progress {
  position: absolute;
  bottom: 5%;
  right: 5%;
  display: flex;
  gap: var(--spacing-sm);
  z-index: 10;
}

.progress-dot {
  width: 12px;
  height: 12px;
  border: 2px solid var(--color-bronze);
  border-radius: 50%;
  background: transparent;
  opacity: 0.5;
  transition: all 0.3s ease;
}

.progress-dot.active {
  background: var(--color-bronze);
  opacity: 1;
}

.progress-dot.completed {
  background: var(--color-white);
  border-color: var(--color-white);
  opacity: 0.5;
}

/* Skip Button */
.skip-animation {
  position: absolute;
  top: 20px;
  right: 20px;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.3);
  color: var(--color-white);
  padding: 10px 20px;
  font-size: 0.875rem;
  cursor: pointer;
  backdrop-filter: blur(10px);
  z-index: 20;
  transition: all 0.3s ease;
}

.skip-animation:hover {
  background: rgba(255, 255, 255, 0.2);
}

/* Mobile Responsive */
@media (max-width: 767px) {
  .architectural-animation-section {
    min-height: 60vh;
  }

  .architectural-animation-section .container {
    flex-direction: column;
    text-align: center;
  }

  .architectural-animation-section .section-header {
    max-width: 100%;
    margin-bottom: var(--spacing-lg);
  }

  .architecture-canvas {
    aspect-ratio: 1;
    max-width: 100%;
  }

  .animation-text {
    bottom: 20%;
    left: 5%;
    right: 5%;
    text-align: center;
  }

  .animation-text h2 {
    font-size: 1.25rem;
    line-height: 1.3;
  }

  .animation-text p {
    font-size: 0.875rem;
  }

  .section-title {
    font-size: 1.25rem !important;
    line-height: 1.3 !important;
    text-align: center;
  }

  .section-subtitle {
    font-size: 0.875rem !important;
    text-align: center;
  }

  .geo-center-square {
    width: 120px;
    height: 120px;
  }
}

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
  .floor-plan-line,
  .floor-plan-wall,
  .elevation-line,
  .wireframe-line {
    animation: none;
    stroke-dashoffset: 0;
  }

  .stage-canvas,
  .technical-grid,
  .floor-plan-svg,
  .elevation-svg,
  .wireframe-svg,
  .finished-image,
  .animation-text,
  .geo-center-square,
  .measurement-ticks {
    transition: none;
  }

  .stage-canvas.hidden {
    opacity: 0;
  }

  .technical-grid.visible,
  .floor-plan-svg.visible,
  .elevation-svg.visible,
  .wireframe-svg.visible,
  .finished-image.visible,
  .animation-text.visible,
  .geo-center-square.visible,
  .measurement-ticks.visible {
    opacity: 1;
  }

  .geo-center-square.visible {
    transform: translate(-50%, -50%) scale(1);
  }
}

/* ============================================
   NEW: 3D SPACE BOX ANIMATION
   ============================================ */

/* Section Header with Text Animation */
.section-header {
  text-align: left;
  margin-bottom: var(--spacing-2xl);
  max-width: 600px;
  position: relative;
  z-index: 10;
}

.section-title {
  font-family: var(--font-display);
  font-size: 2.5rem;
  font-weight: 400;
  font-style: italic;
  color: #FFFFFF !important;
  margin-bottom: var(--spacing-md);
  letter-spacing: -0.02em;
  opacity: 1 !important;
  display: block !important;
  visibility: visible !important;
}

.section-subtitle {
  font-size: 1.125rem;
  color: #FFFFFF !important;
  max-width: 600px;
  line-height: 1.6;
  opacity: 1 !important;
  display: block !important;
  visibility: visible !important;
}

.animated-text {
  opacity: 0;
  transform: translateY(30px);
  animation: textReveal 1s ease forwards;
}

.section-title.animated-text {
  animation-delay: 0.2s;
}

.section-subtitle.animated-text {
  animation-delay: 0.4s;
}

@keyframes textReveal {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Typing Animation */
.typing-text {
  border-right: 3px solid var(--color-bronze);
  white-space: nowrap;
  overflow: hidden;
  animation: typing 3s steps(40, end), blink-caret 0.75s step-end infinite;
}

@keyframes typing {
  from {
    width: 0;
  }
  to {
    width: 100%;
  }
}

@keyframes blink-caret {
  from, to {
    border-color: transparent;
  }
  50% {
    border-color: var(--color-bronze);
  }
}

/* 3D Space Box */
.space-box-container {
  position: relative;
  width: 300px;
  height: 300px;
  perspective: 1000px;
  z-index: 1;
  pointer-events: none;
  opacity: 0.6;
  flex-shrink: 0;
  align-self: center;
}

.space-box {
  position: relative;
  width: 100%;
  height: 100%;
  transform-style: preserve-3d;
  animation: rotateBox 12s linear infinite;
}

.space-box-face {
  position: absolute;
  width: 180px;
  height: 180px;
  left: 50%;
  top: 50%;
  margin-left: -90px;
  margin-top: -90px;
  border: 2px solid var(--color-bronze);
  background: rgba(154, 112, 76, 0.15);
  opacity: 0.6;
  box-shadow: 0 0 20px rgba(154, 112, 76, 0.3);
}

.space-box-face.front {
  transform: translateZ(90px);
}

.space-box-face.back {
  transform: rotateY(180deg) translateZ(90px);
}

.space-box-face.right {
  transform: rotateY(90deg) translateZ(90px);
}

.space-box-face.left {
  transform: rotateY(-90deg) translateZ(90px);
}

.space-box-face.top {
  transform: rotateX(90deg) translateZ(90px);
}

.space-box-face.bottom {
  transform: rotateX(-90deg) translateZ(90px);
}

@keyframes rotateBox {
  0% {
    transform: rotateX(0deg) rotateY(0deg);
  }
  100% {
    transform: rotateX(360deg) rotateY(360deg);
  }
}

/* Connecting Lines */
.connecting-lines {
  position: absolute;
  width: 100%;
  height: 100%;
  top: 0;
  left: 0;
  pointer-events: none;
  z-index: 4;
}

.connecting-lines line {
  stroke: var(--color-bronze);
  stroke-width: 1.5;
  stroke-dasharray: 400;
  stroke-dashoffset: 400;
  animation: drawLine 2.5s ease forwards;
  opacity: 0.7;
}

.line-1 { animation-delay: 0.1s; }
.line-2 { animation-delay: 0.2s; }
.line-3 { animation-delay: 0.3s; }
.line-4 { animation-delay: 0.4s; }
.line-5 { animation-delay: 0.5s; }
.line-6 { animation-delay: 0.6s; }
.line-7 { animation-delay: 0.7s; }
.line-8 { animation-delay: 0.8s; }

@keyframes drawLine {
  to {
    stroke-dashoffset: 0;
  }
}

/* Mobile Responsive for Space Box */
@media (max-width: 767px) {
  .space-box-container {
    width: 200px;
    height: 200px;
    margin: 0 auto;
  }

  .space-box-face {
    width: 120px;
    height: 120px;
    margin-left: -60px;
    margin-top: -60px;
  }

  .space-box-face.front {
    transform: translateZ(60px);
  }

  .space-box-face.back {
    transform: rotateY(180deg) translateZ(60px);
  }

  .space-box-face.right {
    transform: rotateY(90deg) translateZ(60px);
  }

  .space-box-face.left {
    transform: rotateY(-90deg) translateZ(60px);
  }

  .space-box-face.top {
    transform: rotateX(90deg) translateZ(60px);
  }

  .space-box-face.bottom {
    transform: rotateX(-90deg) translateZ(60px);
  }
}

/* ============================================
   TYPED TEXT ANIMATION
   ============================================ */

.typed-text {
  display: inline-block;
  overflow: hidden;
  white-space: nowrap;
  border-right: 3px solid var(--color-bronze);
  animation: typing 2s steps(40, end), blink-caret 0.75s step-end infinite;
}

@keyframes typing {
  from {
    width: 0;
  }
  to {
    width: 100%;
  }
}

@keyframes blink-caret {
  from, to {
    border-color: transparent;
  }
  50% {
    border-color: var(--color-bronze);
  }
}

/* ============================================
   REAL PENCIL WRITING ANIMATION
   ============================================ */

.pencil-writing-container {
  position: relative;
  display: inline-block;
  font-family: var(--font-display);
  font-size: clamp(1.5rem, 3vw, 2rem);
  font-weight: 400;
  color: var(--color-charcoal);
}

.pencil-writing-text {
  position: relative;
  z-index: 2;
  opacity: 1;
  transition: opacity 0.3s ease;
}

.pencil-writing-text.writing {
  opacity: 0;
}

.pencil-svg {
  position: absolute;
  width: 40px;
  height: 40px;
  z-index: 3;
  pointer-events: none;
  opacity: 0;
  transform-origin: center bottom;
}

.pencil-svg.writing {
  opacity: 1;
  animation: pencilWrite 2s ease forwards;
}

@keyframes pencilWrite {
  0% {
    transform: translateX(0) rotate(-15deg);
  }
  100% {
    transform: translateX(var(--text-width)) rotate(0deg);
  }
}

.pencil-body {
  fill: #FFD700;
  stroke: #8B4513;
  stroke-width: 1;
}

.pencil-tip {
  fill: #8B4513;
}

.pencil-lead {
  fill: #333;
}

/* Pencil SVG */
.pencil-svg svg {
  width: 100%;
  height: 100%;
}

/* Enhanced Text Styling */
.journey-content h3 {
  font-family: var(--font-display);
  font-size: clamp(1.25rem, 2.5vw, 1.75rem);
  font-weight: 400;
  line-height: 1.3;
  color: var(--color-charcoal);
  margin-bottom: var(--spacing-md);
  letter-spacing: -0.01em;
  position: relative;
}

.journey-content h3::after {
  content: '';
  position: absolute;
  bottom: -8px;
  left: 0;
  width: 0;
  height: 2px;
  background: var(--color-bronze);
  transition: width 0.6s ease;
}

.journey-stage.visible .journey-content h3::after {
  width: 60px;
}

.journey-content p {
  font-size: 1rem;
  line-height: 1.7;
  color: var(--color-warm-grey);
  max-width: 500px;
}

/* ============================================
   WORKS SPACE BOX (For Selected Works Section)
   ============================================ */

.works-space-box-container {
  position: relative;
  width: 100%;
  height: 300px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: var(--spacing-2xl);
}

.works-space-box {
  position: relative;
  width: 200px;
  height: 200px;
  transform-style: preserve-3d;
  animation: rotateBox 10s linear infinite;
}

.works-space-box .space-box-face {
  width: 120px;
  height: 120px;
  left: 50%;
  top: 50%;
  margin-left: -60px;
  margin-top: -60px;
  border: 2px solid var(--color-bronze);
  background: rgba(154, 112, 76, 0.15);
  opacity: 0.9;
  box-shadow: 0 0 15px rgba(154, 112, 76, 0.3);
}

.works-space-box .space-box-face.front {
  transform: translateZ(60px);
}

.works-space-box .space-box-face.back {
  transform: rotateY(180deg) translateZ(60px);
}

.works-space-box .space-box-face.right {
  transform: rotateY(90deg) translateZ(60px);
}

.works-space-box .space-box-face.left {
  transform: rotateY(-90deg) translateZ(60px);
}

.works-space-box .space-box-face.top {
  transform: rotateX(90deg) translateZ(60px);
}

.works-space-box .space-box-face.bottom {
  transform: rotateX(-90deg) translateZ(60px);
}
