/* Make all bullet points interactive - underline on hover */
li {
  cursor: pointer;
  transition: all 0.2s ease;
}

li:hover span {
  text-decoration: underline;
}

/* Make clickable skills interactive - same effect as bullet points */
.clickable-skill {
  cursor: pointer;
  transition: all 0.2s ease;
}

.clickable-skill:hover {
  text-decoration: underline;
}

/* Page containers */
.page-container {
  display: block;
  opacity: 1;
  position: absolute;
  top: 20px;
  left: 50%;
  transform: translateX(-50%) scale(0.68);
  transform-origin: top center;
  z-index: 1;
  will-change: transform;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  min-width: 468pt;
}

.page-container.active {
  z-index: 2;
  animation: none;
}

.page-container.page-exit {
  z-index: 3;
  animation: pageExit 0.6s ease-in-out forwards;
}

/* Page exit animation - slides to the left and behind the stack */
@keyframes pageExit {
  0% {
    transform: translateX(-50%) translateX(0) scale(0.68);
    z-index: 3;
  }
  50% {
    transform: translateX(-50%) translateX(-150%) scale(0.646);
    z-index: 3;
  }
  51% {
    z-index: 0;
  }
  100% {
    transform: translateX(-50%) translateX(0) scale(0.68);
    z-index: 0;
  }
}

/* Apply home page styling to all page containers */
body .page-container {
  background-color: #ffffff;
  max-width: 468pt;
  width: 468pt;
  min-height: 725pt;
  padding: 22pt 55pt 50pt 55pt;
  margin: 0;
  box-shadow: 0 0 10px rgba(0,0,0,0.08);
  position: absolute;
  box-sizing: content-box;
}

/* Container wrapper for absolute positioning */
body {
  position: relative;
  min-height: 100vh;
  min-width: 700px;
  padding: 0;
  margin: 0;
  overflow-x: auto;
  overflow-y: auto;
}

/* Ensure desktop layout stays consistent on zoom/resize */
@media screen and (min-width: 769px) {
  body {
    width: 100%;
  }

  .page-container {
    /* Ensure pages stay centered regardless of zoom */
    margin-left: auto;
    margin-right: auto;
  }
}

/* Go Home button styling */
.go-home-btn {
  display: inline-block;
  margin-top: 20px;
  padding: 10px 20px;
  background-color: #f5f5f5;
  border: 1px solid #ccc;
  border-radius: 4px;
  cursor: pointer;
  font-family: "Helvetica Neue", Arial, sans-serif;
  font-size: 11pt;
  text-decoration: none;
  color: #000;
  transition: all 0.2s ease;
}

.go-home-btn:hover {
  background-color: #e0e0e0;
  text-decoration: underline;
}

/* Page curl in bottom right corner */
.page-curl {
  position: absolute;
  bottom: 0;
  right: 0;
  width: 80px;
  height: 80px;
  cursor: pointer;
  z-index: 100;
  overflow: hidden;
}

.page-curl::before {
  content: '';
  position: absolute;
  bottom: 0;
  right: 0;
  width: 0;
  height: 0;
  border-style: solid;
  border-width: 0 0 60px 60px;
  border-color: transparent transparent #f5f5f5 transparent;
  transition: all 0.3s ease;
  box-shadow: -2px 2px 8px rgba(0, 0, 0, 0.15);
}

.page-curl:hover::before {
  border-width: 0 0 80px 80px;
  box-shadow: -3px 3px 12px rgba(0, 0, 0, 0.2);
}

.page-curl::after {
  content: '→';
  position: absolute;
  bottom: 10px;
  right: 10px;
  font-size: 18px;
  color: #666;
  transition: all 0.3s ease;
  pointer-events: none;
}

.page-curl:hover::after {
  bottom: 15px;
  right: 15px;
  color: #333;
}

/* Project Tabs */
.project-tabs {
  display: flex;
  justify-content: center;
  gap: 0;
  margin: 20px auto 0 auto;
  max-width: 582px;
}

.project-tab {
  flex: 1;
  padding: 10px 20px;
  background-color: #f5f5f7;
  border: none;
  cursor: pointer;
  font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
  font-size: 14px;
  color: #1d1d1f;
  transition: background-color 0.2s ease;
  border-bottom: 2px solid #d2d2d7;
}

.project-tab:first-child {
  border-radius: 8px 0 0 0;
}

.project-tab:last-child {
  border-radius: 0 8px 0 0;
}

.project-tab:hover {
  background-color: #e8e8ed;
}

.project-tab.active {
  background-color: #ffffff;
  border-bottom: 2px solid #0071e3;
  color: #0071e3;
  font-weight: 500;
}

/* Image Carousel */
.carousel-container {
  position: relative;
  width: 100%;
  max-width: 582px;
  height: 582px;
  margin: 20px auto;
  overflow: hidden;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.carousel-track {
  display: flex;
  height: 100%;
  transition: transform 0.5s ease-in-out;
  will-change: transform;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
}

.carousel-image {
  width: 582px;
  height: 582px;
  flex-shrink: 0;
  object-fit: contain;
  display: block;
  background-color: #f5f5f5;
}

.carousel-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background-color: rgba(255, 255, 255, 0.8);
  border: none;
  font-size: 32px;
  padding: 10px 15px;
  cursor: pointer;
  z-index: 10;
  transition: background-color 0.3s ease;
  border-radius: 4px;
  line-height: 1;
  color: #333;
}

.carousel-btn:hover {
  background-color: rgba(255, 255, 255, 0.95);
}

.carousel-prev {
  left: 10px;
}

.carousel-next {
  right: 10px;
}

.carousel-indicators {
  position: absolute;
  bottom: 15px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 8px;
  z-index: 10;
}

.carousel-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background-color: rgba(255, 255, 255, 0.5);
  cursor: pointer;
  transition: background-color 0.3s ease;
}

.carousel-dot:hover {
  background-color: rgba(255, 255, 255, 0.8);
}

.carousel-dot.active {
  background-color: rgba(255, 255, 255, 1);
}

/* Carousel Text Card (inside carousel as last slide) */
.carousel-text-card {
  width: 582px;
  height: 582px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 60px;
  box-sizing: border-box;
  background-color: #f5f5f7;
  text-align: center;
}

.carousel-card-title {
  font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
  font-size: 28px;
  font-weight: 600;
  color: #1d1d1f;
  margin: 0 0 20px 0;
}

.carousel-card-text {
  font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
  font-size: 17px;
  font-weight: 400;
  color: #424245;
  line-height: 1.6;
  margin: 0;
  max-width: 400px;
}

/* Image loading states */
.carousel-image.lazy-load {
  background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
  background-size: 200% 100%;
  animation: loading 1.5s ease-in-out infinite;
  min-height: 200px;
}

@keyframes loading {
  0% {
    background-position: 200% 0;
  }
  100% {
    background-position: -200% 0;
  }
}

.carousel-image.loaded {
  animation: fadeIn 0.3s ease-in;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

/* Smooth touch interactions for all devices */
li, .project-tab, .carousel-btn, .go-home-btn {
  -webkit-tap-highlight-color: rgba(0, 0, 0, 0.1);
  touch-action: manipulation;
}

/* ===== DESKTOP-ONLY STYLES ===== */
@media screen and (min-width: 769px) {
  /* Make carousel images clickable on desktop */
  .carousel-image {
    cursor: zoom-in;
    transition: opacity 0.2s ease;
  }

  .carousel-image:hover {
    opacity: 0.9;
  }

  /* Image Modal Styles - Desktop Only */
  .image-modal {
    display: none;
    position: fixed;
    z-index: 10000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.95);
    animation: fadeIn 0.3s ease;
  }

  .image-modal.active {
    display: flex;
    justify-content: center;
    align-items: center;
  }

  .image-modal-content {
    position: relative;
    width: 90vw;
    height: 90vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
  }

  .image-modal-close {
    position: absolute;
    top: 20px;
    right: 30px;
    color: #ffffff;
    font-size: 48px;
    font-weight: 300;
    background: none;
    border: none;
    cursor: pointer;
    z-index: 10002;
    line-height: 1;
    padding: 0;
    width: 50px;
    height: 50px;
    transition: all 0.2s ease;
  }

  .image-modal-close:hover {
    color: #cccccc;
    transform: scale(1.1);
  }

  .image-modal-carousel {
    position: relative;
    width: 100%;
    height: calc(100% - 80px);
    overflow: hidden;
    display: flex;
    justify-content: center;
    align-items: center;
  }

  .image-modal-track {
    display: flex;
    height: 100%;
    width: 100%;
    transition: transform 0.4s cubic-bezier(0.25, 0.8, 0.25, 1);
    will-change: transform;
  }

  .image-modal-track img {
    width: 100%;
    min-width: 100%;
    height: 100%;
    object-fit: contain;
    flex-shrink: 0;
    user-select: none;
    -webkit-user-drag: none;
  }

  .image-modal-prev,
  .image-modal-next {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background-color: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(10px);
    border: none;
    font-size: 48px;
    padding: 20px 25px;
    cursor: pointer;
    z-index: 10001;
    transition: all 0.3s ease;
    border-radius: 8px;
    line-height: 1;
    color: #ffffff;
    font-weight: 300;
  }

  .image-modal-prev:hover,
  .image-modal-next:hover {
    background-color: rgba(255, 255, 255, 0.25);
    transform: translateY(-50%) scale(1.1);
  }

  .image-modal-prev {
    left: 30px;
  }

  .image-modal-next {
    right: 30px;
  }

  .image-modal-indicators {
    display: none;
  }

  .image-modal-counter {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    color: #ffffff;
    font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
    font-size: 16px;
    font-weight: 400;
    background-color: rgba(0, 0, 0, 0.5);
    padding: 8px 16px;
    border-radius: 20px;
    backdrop-filter: blur(10px);
  }

  /* Keyboard navigation hint */
  .image-modal-content::before {
    content: 'Use ← → arrow keys or ESC to close';
    position: absolute;
    top: 20px;
    left: 30px;
    color: rgba(255, 255, 255, 0.6);
    font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
    font-size: 14px;
    font-weight: 300;
    opacity: 1;
    animation: fadeOut 3s ease forwards;
    animation-delay: 2s;
    z-index: 10003;
  }

  @keyframes fadeOut {
    to {
      opacity: 0;
    }
  }
}

/* ===== MOBILE RESPONSIVE STYLES - VERTICAL SCROLL WITH BUTTON NAVIGATION ===== */
@media screen and (max-width: 768px) {
  /* Clean reset for mobile */
  html {
    width: 100%;
    height: 100%;
    overflow: hidden;
    position: fixed;
  }

  body {
    width: 100%;
    height: 100%;
    margin: 0;
    padding: 0;
    overflow: hidden;
    position: fixed;
    background: #ffffff;
  }

  /* Page container - Vertically scrollable pages */
  body .page-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw !important;
    max-width: 100vw !important;
    min-width: 100vw !important;
    height: 100vh;
    padding: 16px 14px 200px 14px !important;
    margin: 0 !important;
    box-sizing: border-box;
    background-color: #ffffff;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    box-shadow: none;
    transform: none;
    transition: none;
    display: none;
  }

  /* Detail pages have navigation bar at bottom */
  body .page-container:not(#home-page) {
    height: calc(100vh - 70px);
    padding-bottom: 150px !important;
  }

  /* Active page is visible */
  .page-container.active {
    display: block;
    z-index: 100;
  }

  /* Fade transitions for page changes */
  .page-container.page-exit {
    display: block;
    z-index: 50;
    animation: fadeOut 0.2s ease-out forwards;
  }

  .page-container.page-enter {
    animation: fadeIn 0.2s ease-in forwards;
  }

  @keyframes fadeOut {
    from {
      opacity: 1;
    }
    to {
      opacity: 0;
    }
  }

  @keyframes fadeIn {
    from {
      opacity: 0;
    }
    to {
      opacity: 1;
    }
  }

  /* Typography adjustments for mobile */
  body .page-container * {
    max-width: 100%;
    word-wrap: break-word;
    overflow-wrap: break-word;
    box-sizing: border-box;
  }

  body .page-container h1 {
    font-size: 22px;
    line-height: 1.2;
    margin: 0 0 6px 0;
    padding: 0;
    white-space: normal;
  }

  body .page-container h5 {
    font-size: 14px;
    font-weight: bold;
    margin: 14px 0 6px 0;
    padding-bottom: 2px;
    white-space: normal;
  }

  body .page-container p {
    font-size: 13px;
    line-height: 1.5;
    margin: 4px 0;
    white-space: normal;
  }

  body .page-container li {
    font-size: 13px;
    line-height: 1.5;
    margin: 6px 0;
    white-space: normal;
  }

  body .page-container span {
    white-space: normal;
    font-size: inherit;
  }

  /* Make sure all text inside paragraphs and list items use the same size */
  body .page-container p span,
  body .page-container li span {
    font-size: inherit !important;
  }

  body .page-container .c17 {
    font-size: 11px;
    text-align: center;
    line-height: 1.3;
  }

  body .page-container .c12 {
    font-size: 11px;
  }

  body .page-container .c4 {
    font-weight: bold;
  }

  body .page-container .c7 {
    font-weight: normal;
  }

  /* Remove all floats on mobile - they cause clipping */
  body .page-container .c21 {
    float: none !important;
    display: inline;
    margin: 0;
    background: transparent;
  }

  /* Fix list spacing */
  body .page-container ul {
    margin: 6px 0 10px 0;
    padding-left: 18px;
    list-style-position: outside;
    max-width: 100%;
  }

  body .page-container .c1 {
    margin-left: 18px;
    padding-left: 0;
  }

  body .page-container li {
    padding-left: 4px;
    max-width: 100%;
  }

  /* Carousel adjustments */
  .carousel-container {
    width: 100%;
    max-width: 100%;
    height: auto;
    aspect-ratio: 1;
    margin: 12px 0;
  }

  .carousel-image {
    width: 100%;
    height: 100%;
    cursor: pointer;
  }

  .carousel-text-card {
    width: 100%;
    height: 100%;
    padding: 30px 20px;
  }

  .project-tabs {
    width: 100%;
    max-width: 100%;
    margin: 12px 0 0 0;
  }

  .project-tab {
    font-size: 11px;
    padding: 8px 10px;
  }

  .carousel-btn {
    font-size: 20px;
    padding: 6px 10px;
  }

  .carousel-prev {
    left: 4px;
  }

  .carousel-next {
    right: 4px;
  }

  .carousel-indicators {
    bottom: 8px;
    gap: 5px;
  }

  .carousel-dot {
    width: 7px;
    height: 7px;
  }

  /* Go home button - hide it, replaced by navigation bar */
  .go-home-btn {
    display: none;
  }

  /* Hide page curl on mobile */
  .page-curl {
    display: none;
  }

  /* Mobile Navigation Bar */
  .mobile-nav-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 70px;
    background-color: #ffffff;
    border-top: 1px solid #d2d2d7;
    display: flex !important;
    justify-content: space-around;
    align-items: center;
    padding: 0 20px;
    box-sizing: border-box;
    z-index: 1000;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
  }

  /* Hide navigation bar when on home page */
  .mobile-nav-bar.hidden {
    display: none !important;
  }

  .mobile-nav-btn {
    flex: 1;
    max-width: 120px;
    height: 50px;
    background-color: #f5f5f7;
    border: 1px solid #d2d2d7;
    border-radius: 12px;
    font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
    font-size: 15px;
    font-weight: 500;
    color: #1d1d1f;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    -webkit-tap-highlight-color: rgba(0, 0, 0, 0.1);
    touch-action: manipulation;
  }

  .mobile-nav-btn:active {
    background-color: #e8e8ed;
    transform: scale(0.96);
  }

  .mobile-nav-btn.home-btn {
    background-color: #007aff;
    color: #ffffff;
    border-color: #007aff;
    font-size: 16px;
    max-width: 100px;
  }

  .mobile-nav-btn.home-btn:active {
    background-color: #0051d5;
  }

  .mobile-nav-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
  }

  .mobile-nav-btn:disabled:active {
    transform: none;
  }

  /* Ensure all content is visible */
  body .page-container .c16,
  body .page-container .c0,
  body .page-container .c11 {
    max-width: 100%;
    overflow-wrap: break-word;
    word-wrap: break-word;
  }

  /* Override the .c2 container fixed width on mobile */
  body .page-container > div,
  body .page-container .c2,
  body .page-container div {
    max-width: 100% !important;
    width: auto !important;
    min-width: 0 !important;
  }

  /* Reset all padding and margins that could cause overflow */
  body .page-container > div:first-child {
    padding: 0 !important;
    margin: 0 !important;
  }

  /* Adjust header spacing */
  body .page-container .c18 {
    padding-top: 0;
    padding-bottom: 4px;
    margin-bottom: 4px;
    border-bottom: 1px solid #000;
  }

  body .page-container .c3 {
    padding-top: 6px;
    padding-bottom: 3px;
    margin: 12px 0 6px 0;
    border-bottom: 1px solid #000;
  }

  /* Fix paragraph spacing */
  body .page-container .c0 {
    margin: 6px 0;
    padding: 0;
  }

  body .page-container .c16 {
    margin: 2px 0;
    padding: 0;
  }

  /* Ensure proper line breaks */
  body .page-container br {
    display: block;
    content: "";
    margin: 2px 0;
  }

  /* Mobile Image Modal */
  .image-modal {
    display: none;
    position: fixed;
    z-index: 10000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.95);
  }

  .image-modal.active {
    display: flex;
    justify-content: center;
    align-items: center;
  }

  .image-modal-content {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
  }

  .image-modal-close {
    position: absolute;
    top: 10px;
    right: 15px;
    color: #ffffff;
    font-size: 40px;
    font-weight: 300;
    background: none;
    border: none;
    cursor: pointer;
    z-index: 10002;
    line-height: 1;
    padding: 10px;
    width: 50px;
    height: 50px;
    -webkit-tap-highlight-color: rgba(255, 255, 255, 0.2);
  }

  .image-modal-close:active {
    color: #cccccc;
  }

  .image-modal-carousel {
    position: relative;
    width: 100%;
    height: 100%;
    overflow: hidden;
    display: flex;
    justify-content: center;
    align-items: center;
  }

  .image-modal-track {
    display: flex;
    height: 100%;
    width: 100%;
    transition: transform 0.3s ease-out;
    will-change: transform;
  }

  .image-modal-track img {
    width: 100%;
    min-width: 100%;
    height: 100%;
    object-fit: contain;
    flex-shrink: 0;
    user-select: none;
    -webkit-user-drag: none;
  }

  .image-modal-prev,
  .image-modal-next {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background-color: rgba(255, 255, 255, 0.2);
    border: none;
    font-size: 32px;
    padding: 15px 20px;
    cursor: pointer;
    z-index: 10001;
    border-radius: 8px;
    line-height: 1;
    color: #ffffff;
    font-weight: 300;
    -webkit-tap-highlight-color: rgba(255, 255, 255, 0.2);
  }

  .image-modal-prev:active,
  .image-modal-next:active {
    background-color: rgba(255, 255, 255, 0.3);
  }

  .image-modal-prev {
    left: 10px;
  }

  .image-modal-next {
    right: 10px;
  }

  .image-modal-indicators {
    display: none;
  }

  .image-modal-counter {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    color: #ffffff;
    font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
    font-size: 14px;
    font-weight: 400;
    background-color: rgba(0, 0, 0, 0.6);
    padding: 6px 14px;
    border-radius: 20px;
  }
}

/* Prevent zoom on input focus on iOS */
@media screen and (max-width: 768px) {
  input, select, textarea {
    font-size: 16px !important;
  }
}

/* Landscape orientation on mobile */
@media screen and (max-width: 768px) and (orientation: landscape) {
  .carousel-container {
    aspect-ratio: 16 / 9;
    max-height: 60vh;
  }
}