html,
body {
  height: 100%;
}

[role="main"] {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  right: 0;
  overflow: hidden;
}

/* Page */

.page {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: #fff url(../images/wall.jpg) center bottom repeat-x;
  line-height: 400px;
  font-size: 300px;
  font-weight: bold;
  text-align: center;
  color: rgba(0,0,0,0.2);
}

.multiplebgs.cssgradients .page {
  background-position: center bottom, center bottom;
  background-repeat: no-repeat, repeat-x;
  background-image: linear-gradient(to right, rgba(0,0,0,0.35) 0%, rgba(0,0,0,0) 20%, rgba(0,0,0,0) 80%, rgba(0,0,0,0.35) 100%),
                    url(../images/wall.jpg);
}

/* Page Transformation */

.csstransforms3d.cssanimations [role="main"],
.swiper-3d {
  perspective: 1200px;
}

.csstransforms3d.cssanimations .page-trans-in,
.page-trans-in,
.swiper-slide-next2 {
  transform-origin: 0% 50%;
  animation: transRoomIn 1s ease both;
}

.csstransforms3d.cssanimations .page-trans-out,
.page-trans-out,
.swiper-slide-active2 {
  transform-origin: 100% 50%;
  animation: transRoomOut 1s ease both;
}

.csstransforms3d.cssanimations .page-trans-back-in,
.page-trans-back-in,
.swiper-slide-prev2 {
  transform-origin: 100% 50%;
  animation: transRoomBackIn 1s ease both;
}

.csstransforms3d.cssanimations .page-trans-back-out,
.page-trans-back-out,
.swiper-slide-active2 {
  transform-origin: 0% 50%;
  animation: transRoomBackOut 1s ease both;
}

/* Animations */

@keyframes transRoomOut {
  to {
    transform: translateX(-99%) rotateY(90deg);
  }
}

@keyframes transRoomIn {
  from {
    transform: translateX(99%) rotateY(-90deg);
  }
}

@keyframes transRoomBackOut {
  to {
    transform: translateX(99%) rotateY(-90deg);
  }
}

@keyframes transRoomBackIn {
  from {
    transform: translateX(-99%) rotateY(90deg);
  }
}

/* Interactive Elements */

.dot {
  cursor: pointer;
}

#popout {
  width: 250px;
  height: 350px;
  background: #FFF;
  border-radius: 10px;
  transform: translateX(-50%);
  position: absolute;
  box-sizing: border-box;
  padding: 20px 10px;
  text-align: center;
  opacity: 0;
  cursor: pointer;
  transition: opacity 0.8s ease-out;
}

.page svg {
  position: static;
  z-index: 10;
}

#popout > .popout-data > h3 {
  margin: 0 0 5px;
  text-transform: uppercase;
  font-size: 16px;
}

/* Rotating Chair Animation */

.rotating-chair {
  animation: swing 4s infinite ease-in-out;
  transform-origin: bottom center;
}

@keyframes swing {
  0%   { transform: rotateY(0deg); }
  25%  { transform: rotateY(-10deg); }
  50%  { transform: rotateY(0deg); }
  75%  { transform: rotateY(10deg); }
  100% { transform: rotateY(0deg); }
}

/* Swipe Hint */

.swipe-hint {
  position: absolute;
  bottom: 80px;
  width: 100%;
  text-align: center;
  font-size: 14px;
  color: #aaa;
  background-color: white;
  opacity: 0;
  animation: fadeHint 5s ease-in-out 1s forwards;
  pointer-events: none;
}

@keyframes fadeHint {
  0% { opacity: 0; }
  20% { opacity: 1; }
  80% { opacity: 1; }
  100% { opacity: 0; }
}

/* Pagination Dots */

.pagination {
  position: absolute;
  bottom: 40px;
  width: 100%;
  text-align: center;
  z-index: 10;
}

.pagination .dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  margin: 0 4px;
  background-color: #ccc;
  border-radius: 50%;
  transition: background-color 0.3s;
}

.pagination .dot.active {
  background-color: #333;
}

/* Navigation Arrows */

.swipe-arrow {
  position: fixed;
  top: 50%;
  transform: translateY(-50%);
  font-size: 44px;
  line-height: 0;
  color: rgb(0, 122, 255);
  padding: 0;
  padding-bottom: 4px;
  background: rgba(255, 255, 255, 0.8);
  border: none;
  border-radius: 50%;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
  z-index: 9999;
  cursor: pointer;
  user-select: none;
  transition: background 0.2s, transform 0.2s;
  width: 60px;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.swipe-arrow:hover {
  background: rgba(255, 255, 255, 1);
  transform: translateY(-50%) scale(1.1);
}

.swipe-arrow:focus {
  outline: 2px solid rgb(0, 122, 255);
  outline-offset: 2px;
}

.left-arrow {
  left: 10px;
}

.right-arrow {
  right: 10px;
}

/* Content Items */

.item {
  display: inline-block;
  margin: 1rem;
  cursor: pointer;
}

.item img {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

/* Modal Styles */

.modal {
  display: none;
  position: fixed;
  z-index: 9999;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(10px);
  opacity: 0;
  transition: opacity 0.4s ease;
}

.modal.show {
  opacity: 1;
}

.modal-content {
  background: linear-gradient(135deg, #ffffff 0%, #f8f9fa 100%);
  border-radius: 20px;
  width: 85%;
  max-width: 900px;
  height: 80%;
  max-height: 700px;
  margin: 0;
  padding: 3rem;
  position: absolute;
  top: 50%;
  left: 50%;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  box-shadow: 0 30px 90px rgba(0, 0, 0, 0.5);
  transform: translate(-50%, -50%) scale(0.7) translateZ(-500px);
  opacity: 0;
  transition: all 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.modal.show .modal-content {
  transform: translate(-50%, -50%) scale(1) translateZ(0);
  opacity: 1;
}

.modal iframe,
.modal img {
  max-width: 100%;
  max-height: 80vh;
  display: block;
  margin: auto;
}

.modal-text {
  font-size: 1.1rem;
  line-height: 1.8;
  color: #2c3e50;
  padding: 0;
}

.modal-text h2 {
  font-size: 2.5rem;
  margin: 0 0 1.5rem 0;
  color: #1a1a1a;
  font-weight: 700;
}

.modal-text h3 {
  font-size: 1.5rem;
  margin: 2rem 0 1rem 0;
  color: #2c3e50;
  font-weight: 600;
}

.modal-text p {
  margin: 0 0 1.5rem 0;
  line-height: 1.8;
}

.modal-text ul {
  list-style: none;
  padding: 0;
  margin: 1rem 0;
}

.modal-text ul li {
  padding: 0.75rem 0;
  padding-left: 1.5rem;
  position: relative;
  line-height: 1.6;
}

.modal-text ul li::before {
  content: '→';
  position: absolute;
  left: 0;
  color: rgb(0, 122, 255);
  font-weight: bold;
}

.modal-text strong {
  color: #1a1a1a;
  font-weight: 600;
}

.close {
  position: absolute;
  right: 20px;
  top: 20px;
  color: #666;
  font-size: 32px;
  font-weight: 300;
  cursor: pointer;
  z-index: 1;
  background: rgba(255, 255, 255, 0.9);
  border: none;
  padding: 8px 15px;
  line-height: 1;
  border-radius: 50%;
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.close:hover {
  background: rgb(0, 122, 255);
  color: white;
  transform: rotate(90deg);
  box-shadow: 0 4px 12px rgba(0, 122, 255, 0.3);
}

.close:focus {
  outline: 2px solid rgb(0, 122, 255);
  outline-offset: 2px;
}

/* Screen reader only */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}

/* Photo Gallery */

.photo-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1rem;
  margin-top: 1rem;
}

.photo-gallery img {
  width: 100%;
  height: auto;
  border-radius: 8px;
  object-fit: cover;
}

/* Center Image */

.center-image {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
}

.center-image img {
  max-width: 90vw;
  max-height: 90vh;
}

/* Hero Clone Animation */

.hero-clone {
  position: absolute;
  z-index: 9999;
  margin: 0;
  pointer-events: none;
  transition: all 0.5s ease;
  transform-origin: center center;
}

.modal.hidden {
  display: none;
}

/* Responsive Design */

/* Tablets and smaller laptops */
@media (max-width: 1024px) {
  .swipe-arrow {
    font-size: 36px;
    width: 36px;
    padding: 8px 12px;
  }

  .swipe-hint h1 {
    font-size: 16px;
  }

  .center-image img {
    max-width: 85vw;
    max-height: 85vh;
  }
}

/* Mobile devices */
@media (max-width: 768px) {
  .page {
    font-size: 200px;
    line-height: 300px;
  }

  .swipe-arrow {
    font-size: 32px;
    width: 32px;
    padding: 6px 10px;
  }

  /* Smaller window on mobile */
  .window {
    width: 200px;
    height: 250px;
    right: 5%;
    top: 10%;
  }

  .window-light-rays {
    width: 400px;
    height: 300px;
  }

  .left-arrow {
    left: 5px;
  }

  .right-arrow {
    right: 5px;
  }

  .swipe-hint {
    bottom: 60px;
    font-size: 12px;
  }

  .swipe-hint h1 {
    font-size: 14px;
  }

  .pagination {
    bottom: 30px;
  }

  /* Hide depth indicator on all mobile devices */
  .depth-indicator {
    display: none !important;
  }

  .modal-content {
    width: 95%;
    height: 95%;
    margin: 2.5% auto;
    padding: 0.5rem;
  }

  .modal iframe {
    height: 40vh;
  }

  .modal-text {
    font-size: 1rem;
    padding: 0.5rem;
  }

  .close {
    font-size: 28px;
    top: 8px;
    right: 8px;
  }

  .photo-gallery {
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 0.5rem;
  }

  .center-image img {
    max-width: 90vw;
    max-height: 80vh;
  }
}

/* Small mobile devices */
@media (max-width: 480px) {
  .page {
    font-size: 150px;
    line-height: 250px;
    background: #fff url(../images/wallphone.jpg) center bottom repeat-x;
  }

  .multiplebgs.cssgradients .page {
    background-image: linear-gradient(to right, rgba(0, 0, 0, 0.35) 0%, rgba(0,0,0,0) 20%, rgba(0,0,0,0) 80%, rgba(0,0,0,0.35) 100%),
                      url(../images/wallphone.jpg);
  }

  .swipe-arrow {
    font-size: 28px;
    width: 28px;
  }

  .swipe-hint {
    bottom: 50px;
    font-size: 11px;
  }

  .swipe-hint h1 {
    font-size: 12px;
    padding: 0 10px;
  }

  .pagination .dot {
    width: 6px;
    height: 6px;
    margin: 0 3px;
  }

  .modal-text {
    font-size: 0.9rem;
  }

  .close {
    font-size: 24px;
    top: 5px;
    right: 5px;
  }

  #popout {
    width: 200px;
    height: 300px;
    padding: 15px 8px;
  }

  .photo-gallery {
    grid-template-columns: 1fr;
  }
}

/* Landscape orientation */
@media (max-height: 500px) and (orientation: landscape) {
  .swipe-hint {
    bottom: 20px;
    font-size: 10px;
  }

  .swipe-hint h1 {
    font-size: 11px;
  }

  .pagination {
    bottom: 15px;
  }

  .center-image img {
    max-height: 70vh;
  }
}

/* Mobile Portrait - Optimized Layout */
@media (max-width: 768px) and (orientation: portrait) {
  body {
    overflow: hidden;
  }

  /* Stretch brick wall to cover full screen */
  .page {
    background-repeat: no-repeat;
    background-size: 100% 100%;
    background-position: center center;
  }

  /* Fix gradient shadows to stay at edges */
  .multiplebgs.cssgradients .page {
    background-size: 100%, 100% 100%;
    background-repeat: no-repeat, no-repeat;
    background-position: center center, center center;
  }

  /* Scale down large elements */
  .rotating-chair {
    transform: scale(0.4) !important;
    transform-origin: bottom left !important;
  }

  .center-image img {
    max-width: 60vw !important;
    max-height: 50vh !important;
  }

  /* Decorative elements smaller */
  .decorative-flower {
    transform: scale(0.3) !important;
    transform-origin: bottom left !important;
  }

  /* Window centered on mobile portrait */
  .window {
    width: 120px !important;
    height: 160px !important;
    left: 50% !important;
    top: 50% !important;
    right: auto !important;
    transform: translate(-50%, -50%) !important;
  }

  .window-light-rays {
    width: 240px !important;
    height: 200px !important;
  }

  /* SVG elements scaled down */
  svg {
    transform: scale(0.7);
    transform-origin: center center;
  }

  /* Hide depth indicator on mobile portrait */
  .depth-indicator {
    display: none !important;
  }

  /* Update swipe hint for mobile portrait */
  .swipe-hint h1 {
    font-size: 10px;
  }

  /* Make arrows more subtle on mobile portrait */
  .swipe-arrow {
    opacity: 0.6;
  }

  .swipe-arrow:active {
    opacity: 1;
  }
}

/* Depth Navigation (Forward/Backward Movement) */

/* Depth levels */
[role="main"] {
  transition: transform 0.8s cubic-bezier(0.4, 0, 0.2, 1);
  transform-style: preserve-3d;
}

/* Normal viewing distance */
[role="main"].depth-level-0 {
  transform: translateZ(0) scale(1);
}

/* Move forward (closer to wall) */
[role="main"].depth-level-1 {
  transform: translateZ(300px) scale(1.3);
}

/* Move very close */
[role="main"].depth-level-2 {
  transform: translateZ(500px) scale(1.6);
}

/* Move backward (away from wall) */
[role="main"].depth-level--1 {
  transform: translateZ(-200px) scale(0.85);
}

/* Move far back */
[role="main"].depth-level--2 {
  transform: translateZ(-400px) scale(0.7);
}

/* Depth indicator */
.depth-indicator {
  position: fixed;
  bottom: 80px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 200;
  display: flex;
  gap: 8px;
  align-items: center;
  padding: 10px 20px;
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(10px);
  border-radius: 20px;
  pointer-events: none;
}

.depth-indicator .depth-dot {
  width: 8px;
  height: 8px;
  background: rgba(255, 255, 255, 0.3);
  border-radius: 50%;
  transition: all 0.3s;
}

.depth-indicator .depth-dot.active {
  background: rgb(0, 122, 255);
  width: 12px;
  height: 12px;
}

.depth-indicator .depth-label {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.7);
  margin: 0 8px;
  text-transform: uppercase;
  letter-spacing: 1px;
}

/* Prefers reduced motion */
@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* Parallax Depth Layers */

/* Depth layer definitions - elements move at different speeds based on depth */
.depth-far {
  z-index: 1;
}

.depth-mid {
  z-index: 5;
}

.depth-near {
  z-index: 10;
}

/* Parallax animations - far elements move slower, near elements move faster */
.csstransforms3d.cssanimations .depth-far.page-trans-in,
.depth-far.page-trans-in {
  animation-duration: 1.3s;
}

.csstransforms3d.cssanimations .depth-far.page-trans-out,
.depth-far.page-trans-out {
  animation-duration: 1.3s;
}

.csstransforms3d.cssanimations .depth-far.page-trans-back-in,
.depth-far.page-trans-back-in {
  animation-duration: 1.3s;
}

.csstransforms3d.cssanimations .depth-far.page-trans-back-out,
.depth-far.page-trans-back-out {
  animation-duration: 1.3s;
}

.csstransforms3d.cssanimations .depth-near.page-trans-in,
.depth-near.page-trans-in {
  animation-duration: 0.8s;
}

.csstransforms3d.cssanimations .depth-near.page-trans-out,
.depth-near.page-trans-out {
  animation-duration: 0.8s;
}

.csstransforms3d.cssanimations .depth-near.page-trans-back-in,
.depth-near.page-trans-back-in {
  animation-duration: 0.8s;
}

.csstransforms3d.cssanimations .depth-near.page-trans-back-out,
.depth-near.page-trans-back-out {
  animation-duration: 0.8s;
}

/* Natural Lighting Overlay */
.lighting-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 100;
  transition: background 1s ease;
}

/* Different lighting for each wall - simulates natural light from different angles */
.lighting-overlay[data-wall="0"] {
  background: radial-gradient(ellipse at 20% 50%,
    rgba(255, 248, 220, 0.15) 0%,
    rgba(0, 0, 0, 0.1) 60%,
    rgba(0, 0, 0, 0.25) 100%);
}

.lighting-overlay[data-wall="1"] {
  background: radial-gradient(ellipse at 50% 30%,
    rgba(255, 248, 220, 0.2) 0%,
    rgba(0, 0, 0, 0.05) 50%,
    rgba(0, 0, 0, 0.2) 100%);
}

.lighting-overlay[data-wall="2"] {
  background: radial-gradient(ellipse at 80% 50%,
    rgba(255, 248, 220, 0.15) 0%,
    rgba(0, 0, 0, 0.1) 60%,
    rgba(0, 0, 0, 0.25) 100%);
}

.lighting-overlay[data-wall="3"] {
  background: radial-gradient(ellipse at 50% 70%,
    rgba(255, 248, 220, 0.18) 0%,
    rgba(0, 0, 0, 0.08) 55%,
    rgba(0, 0, 0, 0.22) 100%);
}

/* Page-specific styles */

/* Page 0 - First page with chair */
.page[data-index="0"] .rotating-chair {
  position: absolute;
  left: 10%;
  bottom: -1px;
  z-index: 1;
}

/* Page 1 - YouTube video page */
.page[data-index="1"] .decorative-flower {
  bottom: -20px;
  position: absolute;
  left: 25%;
  height: 256px;
  width: 455px;
}

/* Page 2 - Polaroid iframe */
.iframe-wrapper {
  width: 100%;
  height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  position: relative;
  z-index: 10;
}

.my-centered-iframe {
  width: 70%;
  height: 70%;
  border: none;
}

/* Page 2 - Window (Real Image) */
.window {
  position: absolute;
  right: 8%;
  top: 15%;
  width: 320px;
  height: 400px;
  z-index: 1;
}

.window-image {
  width: 100%;
  height: 100%;
  object-fit: contain;
  filter: drop-shadow(0 10px 30px rgba(0, 0, 0, 0.3));
}

.window-light-rays {
  position: absolute;
  top: 50%;
  left: 0;
  width: 600px;
  height: 400px;
  transform: translate(-80%, -50%);
  pointer-events: none;
  opacity: 0.15;
  background: radial-gradient(ellipse at 100% 50%,
    rgba(255, 248, 220, 0.6) 0%,
    rgba(255, 248, 220, 0.3) 30%,
    rgba(255, 248, 220, 0) 60%);
  animation: lightPulse 4s ease-in-out infinite;
}

@keyframes lightPulse {
  0%, 100% { opacity: 0.15; }
  50% { opacity: 0.25; }
}

/* Page 3 - Public speaking */
.page[data-index="3"] .public-speaking-label {
  font-size: 40px;
  margin-top: 1rem;
}
