*,
*::after,
*::before {
  box-sizing: border-box;
}

:root {
  font-size: 14px;
  --color-text: #fff;
  --color-bg: #000000;
  --color-link: #ffffff;
  --color-link-hover: rgba(255, 255, 255, 0.6);
  --page-padding: 0.5rem;
  --aspect: 4/5;
  --grid-item-height: 20vh;
  --c-gap: 3rem;
  --r-gap: 3rem;
  --column: 80px;
  --column-count: 3;
  --border-radius: 4px;
}

/* Mobile adjustments for root variables */
@media screen and (max-width: 768px) {
  :root {
    font-size: 12px;
    --page-padding: 1rem;
    --c-gap: 2rem;
    --r-gap: 2rem;
  }
}

html {
  height: 100%;
  overflow-x: hidden;
  /* iOS-specific zoom prevention */
  -webkit-text-size-adjust: 100%;
  -ms-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

/* Comprehensive iOS zoom prevention */
html, body {
  touch-action: manipulation;
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  -khtml-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  user-select: none;
}

/* Prevent iOS pinch zoom on all elements */
*, *:before, *:after {
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  -khtml-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  user-select: none;
  touch-action: manipulation;
}

/* Allow text selection only in specific elements */
input[type="text"], input[type="email"], input[type="tel"], input[type="password"], textarea, .bio-modal__text {
  -webkit-user-select: text;
  -moz-user-select: text;
  -ms-user-select: text;
  user-select: text;
}

/* iOS Safari specific zoom prevention */
@supports (-webkit-overflow-scrolling: touch) {
  input, textarea, select {
    font-size: 16px !important;
    transform: scale(1);
  }
}

/* Additional mobile adjustments for better flow */
@media screen and (max-width: 768px) {
  /* Ensure smooth scroll behavior on mobile */
  html {
    scroll-behavior: smooth;
  }
  
  /* Improve viewport handling */
  body {
    min-height: 100vh;
    min-height: 100dvh; /* Dynamic viewport height for mobile browsers */
  }
  
  /* Make sure the first scene is properly spaced from the top */
  .scene:first-of-type .scene__title {
    margin-top: 2rem;
  }
}

body {
  height: 100%;
  width: 100%;
  font-family: 'forma-djr-mono', sans-serif;
  text-transform: uppercase;
  margin: 0;
  color: var(--color-text);
  background-color: var(--color-bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  /* Prevent zoom on double-tap and improve touch behavior */
  touch-action: manipulation;
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  -khtml-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  user-select: none;
}

/* Mobile scene spacing and layout */
@media screen and (max-width: 768px) {
  /* iOS-specific zoom prevention */
  html {
    -webkit-text-size-adjust: none;
    text-size-adjust: none;
  }
  
  body {
    -webkit-text-size-adjust: none;
    text-size-adjust: none;
  }
  
  .scene {
    height: 90vh; /* Increased height for better carousel visibility */
    min-height: 550px; /* Increased minimum space for carousel visibility */
  }
  
  .carousel {
    /* Improved carousel size for better mobile viewing */
    width: 350px;
    height: 450px;
    margin: -225px 0 0 -175px;
    top: calc(50% + 1rem);
    transform: translateZ(-400px) scale(0.85);
  }
  
  /* Move the first carousel up by 80px on mobile for better alignment */
  .scene:first-child .carousel {
    top: calc(50% + 1rem - 80px);
  }
  
  .scene:nth-child(even) .carousel {
    top: calc(50% + 1rem);
    transform: translateZ(-400px) scale(0.85);
  }
  
  /* Also adjust the first scene if it's even (just in case) */
  .scene:first-child:nth-child(even) .carousel {
    top: calc(50% + 1rem - 80px);
    transform: translateZ(-400px) scale(0.85);
  }
  
  .carousel__cell {
    /* Better cell sizing for improved mobile experience */
    width: 220px;
    height: 280px;
  }
  
  .card {
    /* Improved card scaling for better mobile viewing */
    transform: scale(0.8);
    transform-origin: center;
  }
  
  .card:hover {
    transform: scale(0.82);
  }
  
  .scene__title {
    font-size: 1.4rem;
    top: 15%;
  }
}

/* Extra small mobile devices */
@media screen and (max-width: 480px) {
  .carousel {
    width: 320px;
    height: 400px;
    margin: -200px 0 0 -160px;
    transform: translateZ(-450px) rotateY(0deg) scale(0.75);
  }
  
  .scene:nth-child(even) .carousel {
    transform: translateZ(-450px) rotateY(45deg) scale(0.75);
  }
  
  .carousel__cell {
    width: 160px;
    height: 200px;
  }
  
  .card {
    /* Much smaller card scaling for very small screens to prevent overlap */
    transform: scale(0.6);
  }
  
  .card:hover {
    transform: scale(0.62);
  }
  
  .scene__title {
    font-size: 1.1rem;
    top: 10%;
  }
}

/* iPhone SE and very small screens */
@media screen and (max-width: 375px) {
  .carousel {
    width: 280px;
    height: 360px;
    margin: -180px 0 0 -140px;
    transform: translateZ(-500px) rotateY(0deg) scale(0.7);
  }
  
  .scene:nth-child(even) .carousel {
    transform: translateZ(-500px) rotateY(30deg) scale(0.7);
  }
  
  .carousel__cell {
    width: 140px;
    height: 180px;
  }
  
  .card {
    /* Even smaller cards for iPhone SE to prevent overlap */
    transform: scale(0.55);
  }
  
  .card:hover {
    transform: scale(0.57);
  }
  
  .scene__title {
    font-size: 1rem;
    top: 8%;
  }
}

@media (scripting: enabled) {
  .loading {
    &::before,
    &::after {
      content: '';
      position: fixed;
      z-index: 10000;
    }

    &::before {
      top: 0;
      left: 0;
      width: 100%;
      height: 100%;
      background: var(--color-bg);
    }

    &::after {
      top: 50%;
      left: 50%;
      width: 100px;
      height: 1px;
      margin: 0 0 0 -50px;
      background: var(--color-link);
      animation: loaderAnim 1.5s ease-in-out infinite alternate forwards;
    }
  }
}

@keyframes loaderAnim {
  0% {
    transform: scaleX(0);
    transform-origin: 0% 50%;
  }

  50% {
    transform: scaleX(1);
    transform-origin: 0% 50%;
  }

  50.1% {
    transform: scaleX(1);
    transform-origin: 100% 50%;
  }

  100% {
    transform: scaleX(0);
    transform-origin: 100% 50%;
  }
}

a {
  text-decoration: none;
  color: var(--color-link);
  outline: none;
  cursor: pointer;
  transition: all 0.3s ease;

  &:hover {
    text-decoration: none;
    color: var(--color-link-hover);
  }

  &:focus {
    outline: none;
    background: lightgrey;

    &:not(:focus-visible) {
      background: transparent;
    }

    &:focus-visible {
      outline: 2px solid red;
      background: transparent;
    }
  }
}

.line {
  display: inline-block;
  overflow: hidden;
  position: relative;
  vertical-align: top;

  &::before {
    background: var(--color-link-hover);
    bottom: 0;
    content: '';
    height: 1px;
    left: 0;
    position: absolute;
    transition: transform 0.4s ease;
    width: 100%;
    transform: scaleX(0);
    transform-origin: right center;
  }

  &:hover::before {
    transform: scaleX(1);
    transform-origin: left center;
  }
}

.frame {
  display: flex;
  z-index: 1000;
  width: 100%;
  height: 100vh;
  position: fixed;
  pointer-events: none;
  justify-content: flex-end;
  align-items: flex-start;
  padding: var(--page-padding);

  a,
  button {
    pointer-events: auto;
    color: var(--color-text);
  }

  .frame__links {
    display: flex;
    gap: 1rem;
    align-items: start;
  }

  &.frame--footer {
    display: flex;
    min-height: 300px;
    align-items: end;
    justify-content: space-between;
  }
}

.scene {
  perspective: 900px;
  position: relative;
  height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
}

.scene__title {
  position: relative;
  z-index: 10;
  margin: 0;
}

.scene__title a {
  display: block;
}

.scene__title span {
  display: inline-block;
}

.scene__title .char {
  display: inline-block;
  transform-style: preserve-3d;
  transform-origin: 50% 0%;
}

.carousel {
  width: 400px;
  height: 500px;
  top: 50%;
  left: 50%;
  margin: -250px 0 0 -200px;
  position: absolute;
  transform-style: preserve-3d;
  will-change: transform;
  transform: translateZ(-550px);
}

.scene:nth-child(even) .carousel {
  transform: translateZ(-550px);
}

.carousel__cell {
  position: absolute;
  width: 350px;
  height: 420px;
  left: 0;
  top: 0;
  transform-style: preserve-3d;
}

.card {
  width: 100%;
  height: 100%;
  position: relative;
  transform-style: preserve-3d;
  cursor: pointer;
  transition: transform 0.3s ease;
}

.card:hover {
  transform: scale(1.02);
}

.card__face {
  width: 100%;
  height: 100%;
  position: absolute;
  backface-visibility: hidden;
  background-image: var(--img);
  background-size: cover;
}

/* Mobile card face adjustments */
@media screen and (max-width: 768px) {
  .card__face {
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    /* Ensure smooth scaling on mobile */
    border-radius: calc(var(--border-radius) * 0.8);
  }
  
  .card__face img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: calc(var(--border-radius) * 0.8);
  }
}

/* Extra small mobile card adjustments */
@media screen and (max-width: 480px) {
  .card__face {
    border-radius: calc(var(--border-radius) * 0.6);
  }
  
  .card__face img {
    border-radius: calc(var(--border-radius) * 0.6);
  }
}

.card__face img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: var(--border-radius);
}

.card__face--back {
  transform: rotateY(180deg);
}

/* Disable flip effect for specific cards */
.card.no-flip .card__face--back {
  transform: rotateY(0deg);
}

/* Ensure no-flip cards are never horizontally flipped */
.card.no-flip .card__face--front {
  transform: rotateY(0deg) scaleX(1) !important;
}

.card.no-flip .card__face--back {
  transform: rotateY(0deg) scaleX(1) !important;
}

/* If the SVG appears backwards, use this class to flip it back */
.card.no-flip.flip-content .card__face {
  transform: rotateY(0deg) scaleX(-1) !important;
}

.preview {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  padding: 0 15vw;
  display: grid;
  align-content: center;
  justify-items: center;
  grid-row-gap: 1rem;
  opacity: 0;
  pointer-events: none;
}

.preview__header {
  display: flex;
  width: 100%;
  align-items: flex-end;
  justify-content: space-between;
  line-height: 1;
}

.preview__title {
  margin: 0;
}

.preview__close {
  background: none;
  text-transform: inherit;
  border: 0;
  padding: 0;
  margin: 0;
  font: inherit;
  cursor: pointer;
  color: var(--color-close);
  &:hover,
  &:focus {
    outline: none;
    color: var(--color-link-hover);
  }
}

.grid {
  padding: 1rem 0;
  display: grid;
  grid-template-columns: repeat(var(--column-count), minmax(var(--column), 1fr));
  grid-column-gap: var(--c-gap);
  grid-row-gap: var(--r-gap);
  width: 100%;
  perspective: 900px;
}

.grid__item {
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  will-change: transform, clip-path;
  overflow: hidden;
  border-radius: var(--border-radius);
  position: relative;
  transform-style: preserve-3d;
}

.grid__item-image {
  width: 100%;
  aspect-ratio: var(--aspect);
  background-size: 100%;
  background-position: 50% 50%;
  transition: opacity 0.15s cubic-bezier(0.2, 0, 0.2, 1);
}

.grid__item:hover .grid__item-image {
  opacity: 0.7;
}

.grid__item-caption h3 {
  font-size: 1rem;
  font-weight: 400;
  margin: 0;
}

/* Image Modal Styles */
.image-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh; /* Fallback */
  height: 100dvh; /* Dynamic viewport height for mobile browsers */
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  pointer-events: auto;
}

.image-modal__backdrop {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.9);
  backdrop-filter: blur(10px);
}

.image-modal__content {
  position: relative;
  max-width: 90vw;
  max-height: 90vh;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1;
  padding: 0 0 120px 0; /* Add bottom padding to prevent description overlap */
}

.image-modal__image {
  max-width: 100%;
  max-height: calc(100% - 20px); /* Slightly reduce height to account for description */
  object-fit: contain;
  border-radius: var(--border-radius);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
  cursor: pointer;
}

.image-modal__info {
  position: absolute;
  bottom: 20px;
  left: 20px;
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(10px);
  padding: 1.5rem;
  border-radius: var(--border-radius);
  max-width: 300px;
  pointer-events: none;
}

.artwork-details h3.artwork-title {
  color: var(--color-text);
  font-size: 1.2rem;
  font-weight: 600;
  margin: 0 0 0.5rem 0;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.artwork-details p.artwork-medium,
.artwork-details p.artwork-size {
  color: rgba(255, 255, 255, 0.8);
  font-size: 0.9rem;
  font-weight: 400;
  margin: 0.25rem 0;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.artwork-details p.artwork-medium {
  font-style: italic;
}

/* Responsive modal sizing for better proportions on larger screens */
@media screen and (min-width: 768px) {
  .image-modal__content {
    max-width: 70vw;
    max-height: 80vh;
  }
}

@media screen and (min-width: 1024px) {
  .image-modal__content {
    max-width: 60vw;
    max-height: 75vh;
  }
}

@media screen and (min-width: 1440px) {
  .image-modal__content {
    max-width: 50vw;
    max-height: 70vh;
  }
}

/* Mobile modal adjustments */
@media screen and (max-width: 768px) {
  .image-modal__content {
    max-width: 95vw;
    max-height: 85vh;
    padding: 1rem 1rem calc(140px + env(safe-area-inset-bottom, 20px)) 1rem; /* Account for safe area insets */
  }
  
  .image-modal__image {
    max-height: calc(100% - 40px); /* Extra space on mobile */
  }
  
  .image-modal__info {
    bottom: calc(10px + env(safe-area-inset-bottom, 0px));
    left: 10px;
    right: 10px;
    max-width: none;
    padding: 1rem;
  }
  
  .artwork-details h3.artwork-title {
    font-size: 1rem;
  }
  
  .artwork-details p.artwork-medium,
  .artwork-details p.artwork-size {
    font-size: 0.8rem;
  }
}

/* Additional mobile Safari specific adjustments */
@media screen and (max-width: 768px) and (-webkit-min-device-pixel-ratio: 1) {
  .image-modal {
    height: 100vh;
    height: -webkit-fill-available; /* Safari mobile viewport fix */
  }
  
  .image-modal__content {
    max-height: calc(85vh - env(safe-area-inset-bottom, 0px));
    padding-bottom: calc(160px + env(safe-area-inset-bottom, 20px)); /* Extra padding for Safari */
  }
  
  .image-modal__info {
    bottom: calc(20px + env(safe-area-inset-bottom, 10px));
    margin-bottom: env(safe-area-inset-bottom, 0px);
  }
}

/* Support for dynamic viewport height (mobile browser UI awareness) */
@supports (height: 100dvh) {
  .image-modal {
    height: 100dvh;
  }
  
  @media screen and (max-width: 768px) {
    .image-modal__content {
      max-height: 85dvh;
    }
  }
}

/* iOS Safari specific improvements */
@supports (-webkit-touch-callout: none) {
  @media screen and (max-width: 768px) {
    .image-modal {
      height: 100vh;
      height: -webkit-fill-available;
    }
    
    .image-modal__content {
      max-height: calc(85vh - 80px); /* Account for Safari UI */
      padding-bottom: calc(180px + env(safe-area-inset-bottom, 30px));
    }
    
    .image-modal__info {
      bottom: calc(30px + env(safe-area-inset-bottom, 15px));
      transform: translateY(calc(-1 * env(safe-area-inset-bottom, 0px)));
    }
  }
}

/* Bio Modal Styles */
.bio-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  height: 100dvh; /* Dynamic viewport height for mobile browsers */
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  pointer-events: auto;
  padding: 1rem;
  box-sizing: border-box;
}

.bio-modal__backdrop {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.9);
  backdrop-filter: blur(10px);
}

.bio-modal__content {
  position: relative;
  width: 100%;
  max-width: 90vw;
  height: calc(100vh - 2rem);
  height: calc(100dvh - 2rem);
  max-height: calc(100vh - 2rem);
  max-height: calc(100dvh - 2rem);
  background: var(--color-bg);
  border: 1px solid var(--color-text);
  border-radius: var(--border-radius);
  z-index: 1;
  overflow: hidden;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
  cursor: pointer;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
}

/* Custom scrollbar styling for bio modal */
.bio-modal__content::-webkit-scrollbar {
  width: 8px;
}

.bio-modal__content::-webkit-scrollbar-track {
  background: transparent;
}

.bio-modal__content::-webkit-scrollbar-thumb {
  background: var(--color-text);
  border-radius: 4px;
  opacity: 0.7;
}

.bio-modal__content::-webkit-scrollbar-thumb:hover {
  background: var(--color-text);
  opacity: 1;
}

/* Firefox scrollbar styling */
.bio-modal__content {
  scrollbar-width: thin;
  scrollbar-color: var(--color-text) transparent;
}

.bio-modal__text {
  padding: 2rem;
  color: var(--color-text);
  font-family: 'forma-djr-mono', sans-serif;
  text-transform: uppercase;
  line-height: 1.6;
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  overflow: hidden;
}

.bio-modal__text h2 {
  margin: 0 0 1.5rem 0;
  font-size: 1.5rem;
  font-weight: normal;
  border-bottom: 1px solid var(--color-text);
  padding-bottom: 1rem;
}

.bio-modal__text p {
  margin: 0 0 1rem 0;
  font-size: 0.875rem;
  font-weight: 300;
}

.bio-modal__text p:last-child {
  margin-bottom: 0;
}

/* Responsive bio modal sizing */
@media screen and (max-width: 767px) {
  .bio-modal {
    padding: 0;
  }
  
  .bio-modal__content {
    width: 100%;
    max-width: 100%;
    height: 100vh;
    height: 100dvh;
    max-height: 100vh;
    max-height: 100dvh;
    margin: 0;
    border-radius: 0;
    overflow-y: auto;
  }
  
  .bio-modal__text {
    padding: 0.5rem 1rem;
    height: auto;
    overflow: visible;
    display: block;
    min-height: calc(100vh - 1rem);
  }
  
  .bio-modal__text h2 {
    font-size: 1.3rem;
    margin-bottom: 0.8rem;
    flex-shrink: 0;
    line-height: 1.2;
  }
  
  .bio-modal__text p {
    font-size: 1rem;
    line-height: 1.4;
    margin-bottom: 0.8rem;
    text-align: left;
  }
  
  .bio-modal__text p:last-child {
    margin-bottom: 0.5rem;
  }
}

/* Extra small mobile screens - better readability */
@media screen and (max-width: 480px) {
  .bio-modal__text {
    padding: 0.8rem 1.2rem;
    min-height: calc(100vh - 1.6rem);
  }
  
  .bio-modal__text h2 {
    font-size: 1.2rem;
    margin-bottom: 0.8rem;
    line-height: 1.2;
  }
  
  .bio-modal__text p {
    font-size: 0.95rem;
    line-height: 1.35;
    margin-bottom: 0.8rem;
  }
}

/* iPhone SE and very small screens */
@media screen and (max-width: 375px) {
  .bio-modal__text {
    padding: 0.7rem 1rem;
    min-height: calc(100vh - 1.4rem);
  }
  
  .bio-modal__text h2 {
    font-size: 1.1rem;
    margin-bottom: 0.7rem;
  }
  
  .bio-modal__text p {
    font-size: 0.9rem;
    line-height: 1.3;
    margin-bottom: 0.7rem;
  }
}

/* iPhone XR, iPhone 11, iPhone 12/13/14 standard sizes */
@media screen and (min-width: 376px) and (max-width: 414px) {
  .bio-modal__text {
    padding: 0.9rem 1.3rem;
    min-height: calc(100vh - 1.8rem);
  }
  
  .bio-modal__text h2 {
    font-size: 1.25rem;
    margin-bottom: 0.9rem;
    line-height: 1.2;
  }
  
  .bio-modal__text p {
    font-size: 1rem;
    line-height: 1.4;
    margin-bottom: 0.9rem;
  }
}

/* iPhone 12 Pro, iPhone 13 Pro, iPhone 14 Pro */
@media screen and (min-width: 415px) and (max-width: 430px) {
  .bio-modal__text {
    padding: 0.6rem 1.2rem;
    min-height: calc(100vh - 1.2rem);
  }
  
  .bio-modal__text h2 {
    font-size: 1.35rem;
    margin-bottom: 0.8rem;
    line-height: 1.2;
  }
  
  .bio-modal__text p {
    font-size: 1.1rem;
    line-height: 1.4;
    margin-bottom: 0.8rem;
  }
}

/* Desktop bio modal sizing */
@media screen and (min-width: 768px) {
  .bio-modal__content {
    max-width: 70vw;
    height: calc(100vh - 4rem);
    height: calc(100dvh - 4rem);
    max-height: calc(100vh - 4rem);
    max-height: calc(100dvh - 4rem);
    overflow-y: auto;
  }
  
  .bio-modal__text {
    padding: 2.5rem;
    justify-content: flex-start;
    display: block;
  }
  
  .bio-modal__text h2 {
    font-size: 1.8rem;
    margin-bottom: 1.5rem;
    line-height: 1.2;
  }
  
  .bio-modal__text p {
    font-size: 1rem;
    line-height: 1.6;
    margin-bottom: 1.3rem;
  }
}

@media screen and (min-width: 1024px) {
  .bio-modal__content {
    max-width: 60vw;
    height: calc(100vh - 6rem);
    height: calc(100dvh - 6rem);
    max-height: calc(100vh - 6rem);
    max-height: calc(100dvh - 6rem);
    overflow-y: auto;
  }
  
  .bio-modal__text {
    padding: 3rem;
  }
  
  .bio-modal__text h2 {
    font-size: 2rem;
    margin-bottom: 1.8rem;
  }
  
  .bio-modal__text p {
    font-size: 1.1rem;
    line-height: 1.7;
    margin-bottom: 1.5rem;
  }
}

@media screen and (min-width: 1440px) {
  .bio-modal__content {
    max-width: 50vw;
    height: calc(100vh - 8rem);
    height: calc(100dvh - 8rem);
    max-height: calc(100vh - 8rem);
    max-height: calc(100dvh - 8rem);
    overflow-y: auto;
  }
  
  .bio-modal__text {
    padding: 3.5rem;
  }
  
  .bio-modal__text h2 {
    font-size: 2.2rem;
    margin-bottom: 2rem;
  }
  
  .bio-modal__text p {
    font-size: 1.2rem;
    line-height: 1.8;
    margin-bottom: 1.7rem;
  }
}

/* Contact Modal Styles */
.contact-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  pointer-events: auto;
}

.contact-modal__backdrop {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.9);
  backdrop-filter: blur(10px);
}

.contact-modal__content {
  position: relative;
  max-width: 90vw;
  max-height: 90vh;
  background: var(--color-bg);
  border: 1px solid var(--color-text);
  border-radius: var(--border-radius);
  z-index: 1;
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.contact-modal__form {
  padding: 2rem;
  color: var(--color-text);
  font-family: 'forma-djr-mono', sans-serif;
  text-transform: uppercase;
}

.contact-modal__form h2 {
  margin: 0 0 1.5rem 0;
  font-size: 1.5rem;
  font-weight: normal;
  border-bottom: 1px solid var(--color-text);
  padding-bottom: 1rem;
}

.form-group {
  margin-bottom: 1.5rem;
}

.form-group label {
  display: block;
  margin-bottom: 0.5rem;
  font-size: 0.875rem;
  font-weight: 300;
}

.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 0.75rem;
  border: 1px solid var(--color-text);
  border-radius: var(--border-radius);
  background: transparent;
  color: var(--color-text);
  font-family: 'forma-djr-mono', sans-serif;
  font-size: 0.875rem;
  text-transform: none;
  box-sizing: border-box;
  /* iOS zoom prevention for form elements */
  touch-action: manipulation;
  -webkit-touch-callout: none;
  -webkit-user-select: text;
  -moz-user-select: text;
  -ms-user-select: text;
  user-select: text;
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
}

/* iOS-specific form input styles to prevent zoom */
@media screen and (max-width: 768px) {
  .form-group input,
  .form-group select,
  .form-group textarea {
    font-size: 16px; /* iOS won't zoom if font-size is 16px or larger */
    -webkit-text-size-adjust: 100%;
    transform: scale(1);
  }
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--color-text);
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.1);
}

.form-group textarea {
  resize: vertical;
  min-height: 120px;
}

.form-group input::placeholder,
.form-group textarea::placeholder {
  color: rgba(255, 255, 255, 0.5);
  text-transform: none;
}

.form-buttons {
  display: flex;
  gap: 1rem;
  justify-content: flex-end;
  margin-top: 2rem;
  padding-top: 1rem;
  border-top: 1px solid var(--color-text);
}

.btn {
  padding: 0.75rem 1.5rem;
  border: 1px solid var(--color-text);
  border-radius: var(--border-radius);
  background: transparent;
  color: var(--color-text);
  font-family: 'forma-djr-mono', sans-serif;
  font-size: 0.875rem;
  text-transform: uppercase;
  cursor: pointer;
  transition: all 0.3s ease;
}

.btn:hover {
  background: var(--color-text);
  color: var(--color-bg);
}

.btn--cancel {
  background: transparent;
}

.btn--send {
  background: var(--color-text);
  color: var(--color-bg);
}

.btn--send:hover {
  background: transparent;
  color: var(--color-text);
}

/* Responsive contact modal sizing */
@media screen and (max-width: 767px) {
  .contact-modal {
    padding: 0;
    align-items: stretch;
  }
  
  .contact-modal__content {
    width: 100%;
    max-width: 100%;
    height: 100vh;
    height: 100dvh;
    max-height: 100vh;
    max-height: 100dvh;
    margin: 0;
    border-radius: 0;
    overflow-y: auto;
  }
  
  .contact-modal__form {
    padding: 1rem;
    min-height: calc(100vh - 2rem);
  }
  
  .contact-modal__form h2 {
    font-size: 1.2rem;
    margin-bottom: 1rem;
    padding-bottom: 0.8rem;
  }
  
  .form-group {
    margin-bottom: 1rem;
  }
  
  .form-group label {
    font-size: 0.9rem;
    margin-bottom: 0.4rem;
  }
  
  .form-group input,
  .form-group select,
  .form-group textarea {
    font-size: 0.9rem;
    padding: 0.6rem;
  }
  
  .form-group textarea {
    min-height: 80px;
  }
  
  .form-buttons {
    margin-top: 1.5rem;
    padding-top: 0.8rem;
    gap: 0.8rem;
  }
  
  .btn {
    padding: 0.6rem 1.2rem;
    font-size: 0.8rem;
  }
}

/* iPhone specific contact modal optimizations */
@media screen and (max-width: 430px) {
  .contact-modal__form {
    padding: 0.8rem;
    min-height: calc(100vh - 1.6rem);
  }
  
  .contact-modal__form h2 {
    font-size: 1.1rem;
    margin-bottom: 0.8rem;
    padding-bottom: 0.6rem;
  }
  
  .form-group {
    margin-bottom: 0.8rem;
  }
  
  .form-group label {
    font-size: 0.85rem;
    margin-bottom: 0.3rem;
  }
  
  .form-group input,
  .form-group select,
  .form-group textarea {
    font-size: 0.85rem;
    padding: 0.5rem;
  }
  
  .form-group textarea {
    min-height: 70px;
  }
  
  .form-buttons {
    margin-top: 1.2rem;
    padding-top: 0.6rem;
    gap: 0.6rem;
    flex-direction: column;
  }
  
  .btn {
    padding: 0.8rem 1rem;
    font-size: 0.85rem;
    width: 100%;
  }
}

@media screen and (min-width: 768px) {
  .contact-modal__content {
    max-width: 70vw;
    max-height: 95vh;
    max-height: 95dvh;
  }
  
  .contact-modal__form {
    padding: 2rem;
    min-height: calc(95vh - 4rem);
  }
  
  .contact-modal__form h2 {
    font-size: 1.5rem;
    margin-bottom: 1.2rem;
  }
  
  .form-group {
    margin-bottom: 1.2rem;
  }
  
  .form-group label,
  .form-group input,
  .form-group select,
  .form-group textarea {
    font-size: 0.95rem;
  }
  
  .form-group textarea {
    min-height: 100px;
  }
  
  .form-buttons {
    margin-top: 1.5rem;
    padding-top: 1rem;
  }
}

@media screen and (min-width: 1024px) {
  .contact-modal__content {
    max-width: 60vw;
    max-height: 90vh;
    max-height: 90dvh;
  }
  
  .contact-modal__form {
    padding: 2.5rem;
    min-height: calc(90vh - 5rem);
  }
  
  .contact-modal__form h2 {
    font-size: 1.6rem;
    margin-bottom: 1.3rem;
  }
  
  .form-group {
    margin-bottom: 1.3rem;
  }
  
  .form-group label,
  .form-group input,
  .form-group select,
  .form-group textarea {
    font-size: 1rem;
  }
  
  .form-group textarea {
    min-height: 110px;
  }
}

@media screen and (min-width: 1440px) {
  .contact-modal__content {
    max-width: 50vw;
    max-height: 85vh;
    max-height: 85dvh;
  }
  
  .contact-modal__form {
    padding: 3rem;
    min-height: calc(85vh - 6rem);
  }
  
  .contact-modal__form h2 {
    font-size: 1.8rem;
    margin-bottom: 1.5rem;
  }
  
  .form-group {
    margin-bottom: 1.5rem;
  }
  
  .form-group label,
  .form-group input,
  .form-group select,
  .form-group textarea {
    font-size: 1.1rem;
  }
  
  .form-group textarea {
    min-height: 120px;
  }
}

@media screen and (min-width: 65em) {
  :root {
    --column-count: 6;
  }
}

/* Scroll Indicator */
.scroll-indicator {
  position: fixed;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  color: var(--color-text);
  font-family: 'forma-djr-mono', sans-serif;
  text-transform: uppercase;
  font-size: 0.875rem;
  letter-spacing: 0.1em;
  z-index: 100;
  opacity: 1;
  transition: opacity 0.3s ease;
  pointer-events: none;
}

.scroll-indicator.hidden {
  opacity: 0;
}

.scroll-text {
  font-weight: 300;
  opacity: 0.8;
}

.scroll-arrow {
  font-size: 1.25rem;
  animation: scrollBounce 2s ease-in-out infinite;
  opacity: 0.9;
}

@keyframes scrollBounce {
  0%, 20%, 50%, 80%, 100% {
    transform: translateY(0);
    opacity: 0.9;
  }
  40% {
    transform: translateY(-8px);
    opacity: 0.6;
  }
  60% {
    transform: translateY(-4px);
    opacity: 0.8;
  }
}

@media screen and (max-width: 768px) {
  .scroll-indicator {
    bottom: 1.5rem;
    font-size: 0.75rem;
  }
  
  .scroll-arrow {
    font-size: 1rem;
  }
}

/* Image Modal Navigation */
.image-modal__nav {
  position: absolute;
  top: 50%;
  left: 0;
  right: 0;
  transform: translateY(-50%);
  display: flex;
  justify-content: space-between;
  align-items: center;
  pointer-events: none;
  z-index: 10;
}

.image-modal__nav-btn {
  background: rgba(0, 0, 0, 0.7);
  border: none;
  color: white;
  font-size: 2rem;
  width: 50px;
  height: 50px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.3s ease;
  pointer-events: auto;
  font-family: 'forma-djr-mono', sans-serif;
  line-height: 1;
  backdrop-filter: blur(10px);
  user-select: none;
}

.image-modal__nav-btn:hover {
  background: rgba(0, 0, 0, 0.9);
  transform: scale(1.1);
}

.image-modal__nav-btn:active {
  transform: scale(0.95);
}

.image-modal__nav-btn--prev {
  margin-left: 1rem;
}

.image-modal__nav-btn--next {
  margin-right: 1rem;
}

@media screen and (max-width: 768px) {
  .image-modal__nav-btn {
    font-size: 1.5rem;
    width: 40px;
    height: 40px;
  }
  
  .image-modal__nav-btn--prev {
    margin-left: 0.5rem;
  }
  
  .image-modal__nav-btn--next {
    margin-right: 0.5rem;
  }
}

/* Burger Menu Styles */
.burger-menu {
  display: none;
  flex-direction: column;
  justify-content: space-around;
  width: 24px;
  height: 24px;
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 0;
  z-index: 1001;
  transition: all 0.3s ease;
  /* Prevent text selection and improve touch behavior */
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  touch-action: manipulation;
}

.burger-line {
  width: 100%;
  height: 2px;
  background: var(--color-text);
  transition: all 0.3s ease;
  transform-origin: center;
  /* Prevent selection on burger lines */
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  user-select: none;
}

/* Burger menu animation when active */
.burger-menu.active .burger-line:nth-child(1) {
  transform: rotate(45deg) translate(6px, 6px);
}

.burger-menu.active .burger-line:nth-child(2) {
  opacity: 0;
}

.burger-menu.active .burger-line:nth-child(3) {
  transform: rotate(-45deg) translate(6px, -6px);
}

/* Mobile Navigation Styles */
@media screen and (max-width: 768px) {
  .burger-menu {
    display: flex;
    z-index: 1002;
    position: fixed;
    top: max(1rem, env(safe-area-inset-top, 1rem));
    right: max(1rem, env(safe-area-inset-right, 1rem));
    /* Additional padding for Android devices that might cut off content */
    margin-top: 0.5rem;
    margin-right: 0.5rem;
    /* Improve touch target size */
    min-width: 44px;
    min-height: 44px;
    padding: 10px;
  }
  
  .frame {
    padding: 0.5rem;
    z-index: 1001;
  }
  
  .frame__links {
    position: fixed;
    top: 0;
    right: -100%;
    width: 280px;
    height: 100vh;
    height: 100dvh; /* Use dynamic viewport height for better mobile support */
    background: rgba(15, 14, 14, 0.95);
    backdrop-filter: blur(20px);
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 2rem;
    transition: right 0.3s ease;
    z-index: 1000;
    border-left: 1px solid rgba(255, 255, 255, 0.1);
  }
  
  .frame__links.active {
    right: 0;
  }
  
  .frame__links a {
    font-size: 1.2rem;
    padding: 1rem;
    width: 100%;
    text-align: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    /* Improve touch targets */
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    touch-action: manipulation;
  }
  
  .frame__links a:last-child {
    border-bottom: none;
  }
}

/* Android-specific burger menu adjustments */
@media screen and (max-width: 768px) and (-webkit-min-device-pixel-ratio: 1) {
  .burger-menu {
    /* Extra margin for Android devices with various notch configurations */
    top: max(1.5rem, env(safe-area-inset-top, 1.5rem));
    right: max(1.5rem, env(safe-area-inset-right, 1.5rem));
    margin-top: 0.75rem;
    margin-right: 0.75rem;
  }
}

/* Additional Android support for devices with status bars */
@media screen and (max-width: 768px) and (max-height: 800px) {
  .burger-menu {
    top: max(2rem, env(safe-area-inset-top, 2rem));
    right: max(1.5rem, env(safe-area-inset-right, 1.5rem));
  }
}

/* Ensure frame layout works on mobile */
@media screen and (max-width: 768px) {
  .frame {
    padding: 1rem;
  }
}

/* Simple mobile frame adjustment */
@media screen and (max-width: 768px) {
  .frame {
    padding: 0.5rem;
  }
}

/* Mobile scene wrapper adjustments */
@media screen and (max-width: 768px) {
  .scene-wrapper {
    padding-top: 3rem; /* Space from navigation */
    gap: 2rem; /* If it becomes flexbox */
  }
  
  /* Ensure proper spacing between scenes */
  .scene + .scene {
    margin-top: 0.5rem; /* Very compact gap between consecutive scenes */
  }
}

/* Hero Section Styling */
.hero-section {
  height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
}

.hero-content {
  text-align: center;
  z-index: 10;
  will-change: transform, opacity;
  transform: translateY(-50px);
}

.hero-logo {
  margin-bottom: -1rem;
  display: flex;
  justify-content: center;
  align-items: center;
}

.logo-image {
  max-width: 400px;
  width: 100%;
  height: auto;
  filter: brightness(1) contrast(1);
  transition: all 0.3s ease;
}

.hero-title {
  font-family: 'forma-djr-mono', sans-serif;
  font-size: 1.5rem;
  text-transform: uppercase;
  color: var(--color-text);
  margin: -200px 0 0 0;
  letter-spacing: 0.1em;
  font-weight: 300;
}

.hero-title span {
  display: inline-block;
}

/* Mobile adjustments for hero section */
@media screen and (max-width: 768px) {
  .hero-content {
    transform: translateY(-200px);
  }
  
  .hero-logo {
    margin-bottom: -1rem;
  }
  
  .logo-image {
    max-width: 300px;
  }
  
  .hero-title {
    font-size: 1.2rem;
    letter-spacing: 0.05em;
    margin-top: -150px;
  }
}

@media screen and (max-width: 480px) {
  .hero-content {
    transform: translateY(-200px);
  }
  
  .hero-logo {
    margin-bottom: -0.75rem;
  }
  
  .logo-image {
    max-width: 250px;
  }
  
  .hero-title {
    font-size: 1rem;
    letter-spacing: 0.03em;
    margin-top: -120px;
  }
}

/* Larger screen adjustments for better centering */
@media screen and (min-width: 769px) {
  .hero-content {
    transform: translateY(-100px);
  }
  
  .hero-logo {
    margin-bottom: -1.25rem;
  }
}

@media screen and (min-width: 1024px) {
  .hero-content {
    transform: translateY(-120px);
  }
  
  .hero-logo {
    margin-bottom: -1.5rem;
  }
  
  .hero-title {
    font-size: 1.75rem;
  }
}

@media screen and (min-width: 1440px) {
  .hero-content {
    transform: translateY(-150px);
  }
  
  .hero-logo {
    margin-bottom: -1.75rem;
  }
  
  .logo-image {
    max-width: 450px;
  }
  
  .hero-title {
    font-size: 2rem;
  }
}

/* iOS Safari specific bio modal fixes */
@supports (-webkit-touch-callout: none) {
  @media screen and (max-width: 767px) {
    .bio-modal__content {
      height: 100vh;
      height: 100dvh;
      max-height: 100vh;
      max-height: 100dvh;
      margin: 0;
      /* Force scrollable area */
      overflow-y: auto;
      -webkit-overflow-scrolling: touch;
    }
    
    .bio-modal__text {
      /* Minimal padding for iOS Safari */
      padding: 0.5rem 1rem 1rem 1rem;
      min-height: calc(100vh - 1.5rem);
    }
  }
}
