/* ==========================================================================
   Arvind Kaushik Portfolio — Entrance Scene Styles
   Primary Visual Source: Stitch Project 3921804821922649689
   ========================================================================== */

:root {
  --wall-color: #2F5233;
  --wall-dark: #1b341f;
  --text-cream: #F5F2EB;
  --text-cream-dim: rgba(245, 242, 235, 0.75);
  --brass-gold: #D4AF37;
  --brass-light: #F3E5AB;
  --wood-shadow: rgba(20, 15, 8, 0.75);
  --interior-glow: rgba(255, 230, 180, 0.85);
}

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background-color: var(--wall-color);
  color: var(--text-cream);
  font-family: 'Cormorant Garamond', Georgia, 'Times New Roman', serif;
  user-select: none;
  -webkit-user-select: none;
}

/* ==========================================================================
   Viewport & Camera Container
   ========================================================================== */

.scene-viewport {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: var(--wall-color);
  perspective: 1600px;
  overflow: hidden;
}

.scene-camera {
  position: relative;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  transform-origin: 24.16% 57.68%;
  will-change: transform, opacity;
}

/* ==========================================================================
   Room Canvas Container (Stitch 3D WebGL Room Layer)
   ========================================================================== */

.room-canvas-container {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  overflow: hidden;
  background-color: #0a1622;
  pointer-events: none;
}

.room-canvas-container canvas {
  display: block;
  width: 100% !important;
  height: 100% !important;
}

/* ==========================================================================
   Scene Stage (1376 x 768 Base Coordinate System)
   ========================================================================== */

.scene-stage {
  position: relative;
  width: max(100vw, calc(100vh * (1376 / 768)));
  height: max(100vh, calc(100vw * (768 / 1376)));
  aspect-ratio: 1376 / 768;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2;
  transform-origin: 24.16% 57.68%;
  transition: opacity 0.8s ease-out;
  will-change: transform, opacity;
}

/* ==========================================================================
   Doorway Portal (Transparent opening to Stitch 3D Room)
   ========================================================================== */

.doorway-portal {
  position: absolute;
  left: 12.35465%;
  top: 15.36458%;
  width: 23.61918%;
  height: 84.63541%;
  overflow: hidden;
  z-index: 1;
  background-color: transparent;
}

/* Inner architectural door jamb details */
.doorway-jamb-left {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 14px;
  background: linear-gradient(to right, #4a2f14 0%, #7d5225 50%, #3a220d 100%);
  box-shadow: inset -2px 0 6px rgba(0,0,0,0.6);
  z-index: 2;
}

.doorway-jamb-top {
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  height: 12px;
  background: linear-gradient(to bottom, #301e0d 0%, #5d3c19 100%);
  box-shadow: 0 4px 10px rgba(0,0,0,0.7);
  z-index: 2;
}

.doorway-jamb-right {
  position: absolute;
  right: 0;
  top: 0;
  bottom: 0;
  width: 14px;
  background: linear-gradient(to left, #4a2f14 0%, #6e461f 60%, #2f1908 100%);
  box-shadow: inset 2px 0 6px rgba(0,0,0,0.6);
  z-index: 2;
}

/* Brass strike plate on right jamb */
.doorway-strike-plate {
  position: absolute;
  right: 2px;
  top: 61.8%;
  width: 8px;
  height: 38px;
  background: linear-gradient(to bottom, #d4af37, #997820, #e6c86e);
  border-radius: 1px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.8);
}

/* Door threshold floor strip */
.doorway-threshold {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 8px;
  background: linear-gradient(to top, #654627 0%, #8c6439 60%, #a67c48 100%);
  box-shadow: 0 -2px 6px rgba(0,0,0,0.5);
  z-index: 3;
}

/* ==========================================================================
   Layer 1: Wall & Door Frame (Base Scene)
   ========================================================================== */

.wall-frame-layer {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 2;
  pointer-events: none;
}

/* Full-bleed forest green wall extensions in all 4 directions around the stage */
.wall-extension-left {
  position: absolute;
  top: -100vh;
  bottom: -100vh;
  right: calc(100% - 2px);
  width: 200vw;
  background: linear-gradient(to left, #4f7059 0%, #3a5542 50%, #293f2f 100%);
  pointer-events: none;
  z-index: 2;
}

.wall-extension-right {
  position: absolute;
  top: -100vh;
  bottom: -100vh;
  left: calc(100% - 2px);
  width: 200vw;
  background: #182617;
  pointer-events: none;
  z-index: 2;
}

.wall-extension-top {
  position: absolute;
  left: -200vw;
  right: -200vw;
  bottom: calc(100% - 2px);
  height: 100vh;
  background: linear-gradient(to top, #4f7059, #2F5233);
  pointer-events: none;
  z-index: 2;
}

.wall-extension-bottom {
  position: absolute;
  left: -200vw;
  right: -200vw;
  top: calc(100% - 2px);
  height: 100vh;
  background: #243b27;
  pointer-events: none;
  z-index: 2;
}

.wall-frame-image {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: fill;
  pointer-events: none;
}

/* ==========================================================================
   Layer 2: 3D Swinging Teak Door Leaf
   ========================================================================== */

.door-3d-assembly {
  position: absolute;
  left: 12.35465%;
  top: 15.36458%;
  width: 23.61918%;
  height: 84.63541%;
  perspective: 1400px;
  perspective-origin: 0% 50%;
  z-index: 3;
  pointer-events: none;
}

.door-leaf-pivot {
  position: relative;
  width: 100%;
  height: 100%;
  transform-style: preserve-3d;
  transform-origin: 0% 50%;
  transform: rotateY(0deg);
  transition: transform 1.25s cubic-bezier(0.2, 0.8, 0.25, 1);
  will-change: transform;
}

/* Door leaf open state - swung open inward into the room */
.door-leaf-pivot.door-open {
  transform: rotateY(-86deg);
}

/* Door front face with high-res teak texture */
.door-front-face {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  background-image: url('../assets/door_leaf.png');
  background-size: 100% 100%;
  background-repeat: no-repeat;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  transform: translateZ(0);
}

/* Shading gradient dynamically responding to rotation */
.door-face-shadow {
  position: absolute;
  inset: 0;
  background: linear-gradient(to right, rgba(0,0,0,0) 0%, rgba(0,0,0,0.4) 100%);
  opacity: 0;
  transition: opacity 1.8s ease-out;
  pointer-events: none;
}

.door-leaf-pivot.door-open .door-face-shadow {
  opacity: 0.85;
}

/* 3D Physical Door Thickness (Wood Edge visible as door swings inward) */
.door-thickness-edge {
  position: absolute;
  right: 0;
  top: 0;
  bottom: 0;
  width: 16px;
  background-image: url('../assets/door_edge.png');
  background-size: 100% 100%;
  transform-origin: right center;
  transform: rotateY(-90deg);
  box-shadow: inset 2px 0 6px rgba(0,0,0,0.6);
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
}

/* Back of door (watertight teak wood box geometry, 16px behind front face) */
.door-back-face {
  position: absolute;
  inset: 0;
  background-image: url('../assets/door_leaf.png');
  background-size: 100% 100%;
  background-repeat: no-repeat;
  filter: brightness(0.85);
  transform: translateZ(-16px) rotateY(180deg);
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
}

/* Cast shadow handled without intersecting 3D planes */
.door-cast-shadow {
  display: none !important;
}

/* ==========================================================================
   Layer 3: Interactive Door Knob (The ONLY interactive element)
   ========================================================================== */

.knob-anchor {
  position: absolute;
  left: 87.6923%;
  top: 62.923%;
  transform: translate(-50%, -50%);
  pointer-events: auto;
  z-index: 10;
}

/* Generous touch/mouse target area (no visual distraction) */
.knob-button {
  position: relative;
  width: 52px;
  height: 52px;
  background: transparent;
  border: none;
  outline: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border-radius: 50%;
}

/* Visual knob matching high-res brass element */
.knob-disc {
  position: relative;
  width: 38px;
  height: 38px;
  background-image: url('../assets/knob.png');
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center;
  transform-origin: center center;
  transition: transform 0.32s cubic-bezier(0.34, 1.56, 0.64, 1);
  will-change: transform;
}

/* Knob turned state */
.knob-disc.knob-turned {
  transform: rotate(36deg) scale(0.97);
}

/* ==========================================================================
   Layer 4: Right Wall Typography ("Arvind Kaushik")
   ========================================================================== */

.wall-typography-layer {
  position: absolute;
  right: 0;
  top: 0;
  bottom: 0;
  width: 58%;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  padding-left: 8%;
  z-index: 2;
  pointer-events: none;
}

.portfolio-name {
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-weight: 300;
  font-size: clamp(2.8rem, 5.2vw, 5.8rem);
  letter-spacing: 0.055em;
  line-height: 1.1;
  color: var(--text-cream);
  text-shadow: 
    0 4px 28px rgba(0, 0, 0, 0.45),
    0 1px 4px rgba(0, 0, 0, 0.25);
  transition: opacity 1.8s ease-out, transform 2.2s cubic-bezier(0.22, 1, 0.36, 1);
}

.portfolio-name .name-first {
  display: inline-block;
  margin-right: 0.28em;
  font-weight: 300;
}

.portfolio-name .name-last {
  display: inline-block;
  font-weight: 300;
}

/* "click on door knob" subtle architectural hint */
.door-knob-hint {
  position: absolute;
  top: 68.62%;
  left: 13.79%;
  transform: translateY(-50%);
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-size: clamp(0.80rem, 0.95vw, 1.0rem);
  font-weight: 400;
  letter-spacing: 0.14em;
  color: var(--text-cream-dim);
  text-shadow: 0 2px 14px rgba(0, 0, 0, 0.45);
  cursor: pointer;
  pointer-events: auto;
  user-select: none;
  margin: 0;
  padding: 4px 0;
  transition: opacity 0.5s ease, transform 0.4s ease, color 0.25s ease, letter-spacing 0.25s ease;
  z-index: 10;
  line-height: 1;
}

.door-knob-hint:hover {
  color: var(--text-cream);
  letter-spacing: 0.17em;
}

.door-knob-hint.hint-hidden {
  opacity: 0 !important;
  pointer-events: none !important;
  transform: translateY(-50%) scale(0.96);
}

/* ==========================================================================
   Responsive Adaptations
   Desktop: Full-bleed architectural composition
   Mobile: Perfectly balanced door on left, typography on right
   ========================================================================== */

@media (max-width: 900px) and (orientation: landscape) {
  .scene-camera {
    transform-origin: 26% 56%;
  }
}

@media (max-width: 768px), (max-aspect-ratio: 1/1) {
  .scene-viewport {
    align-items: center;
    justify-content: flex-start;
    background-color: var(--wall-color);
  }

  .scene-camera {
    align-items: center;
    justify-content: flex-start;
    transform-origin: 30% 70%;
  }

  .scene-stage {
    width: calc(100vh * (1376 / 1400));
    height: 100vh;
    aspect-ratio: 1376 / 1400;
    max-width: none;
    max-height: none;
    position: relative;
    left: -10vw;
    margin: 0;
    flex-shrink: 0;
  }

  .wall-frame-picture,
  .wall-frame-image {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: fill;
  }

  /* Reposition doorway portal and door leaf for 1376 x 1400 mobile coordinate space */
  .doorway-portal {
    top: 53.57143%;
    height: 46.42857%;
  }

  .door-3d-assembly {
    top: 53.57143%;
    height: 46.42857%;
    perspective: 1200px;
  }

  /* Generous knob tap target for mobile thumbs */
  .knob-button {
    width: 60px;
    height: 60px;
  }

  .wall-typography-layer {
    position: fixed;
    top: 15%;
    bottom: auto;
    left: auto;
    right: 7vw;
    width: auto;
    transform: none;
    padding: 0;
    justify-content: flex-end;
    z-index: 20;
  }

  .portfolio-name {
    font-size: clamp(2rem, 7.5vw, 2.8rem);
    line-height: 1.15;
    text-align: right;
  }

  .portfolio-name .name-first {
    display: inline-block;
    margin-right: 0.25em;
  }

  .portfolio-name .name-last {
    display: inline-block;
  }

  .door-knob-hint {
    position: fixed;
    top: 82.79%;
    bottom: auto;
    left: auto;
    right: 7vw;
    transform: translateY(-50%);
    font-size: clamp(0.72rem, 3.2vw, 0.88rem);
    letter-spacing: 0.12em;
    text-align: right;
  }
}








