html,
body {
  height: auto !important;
  min-height: 100vh;
  overflow-x: hidden;
  scroll-behavior: smooth;
}

body {
  display: flex !important;
  flex-direction: column;
  overflow-y: auto !important;
}

::-webkit-scrollbar {
  display: none;
}

header {
  z-index: 1;
}

/* Background cylinder */
.cylinder-background {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
  user-select: none;
  mix-blend-mode: color-dodge;
}

.container {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  perspective: 2000px;
}

.box {
  position: relative;
  transform-style: preserve-3d;
  animation: rotate-cylinder 300s linear infinite;
}

.box span {
  position: absolute;
  padding: 0 10px;
  transform:
    translate(-50%, -50%)
    rotateX(calc(var(--i) * 12.805deg))
    translateZ(450px);
  backface-visibility: hidden;
  color: var(--color-project-cylinder);
  font-size: 5rem;
  font-weight: 700;
  line-height: 1.19em;
  text-transform: uppercase;
  text-shadow: 0 5px 5px var(--color-shadow-faint);
  white-space: nowrap;
  opacity: 0.6;
  transform-style: preserve-3d;
}

@keyframes rotate-cylinder {
  from {
    transform: perspective(2000px) rotateX(0deg) rotate(5deg);
  }

  to {
    transform: perspective(2000px) rotateX(360deg) rotate(5deg);
  }
}

/* Project layout */
main {
  position: relative;
  z-index: 10;
  padding: 60px 0;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.featured-section {
  width: 90%;
  max-width: 1200px;
  margin: 0 auto 60px;
}

.regular-section {
  width: 95%;
  max-width: 1300px;
  margin: 20px auto 60px;
}

.featured-project:not(:first-child) {
  content-visibility: auto;
  contain-intrinsic-size: auto 500px;
}

.demo-reel-section {
  content-visibility: auto;
  contain-intrinsic-size: auto 675px;
}

.projects-container {
  width: 90%;
  max-width: 1200px;
  margin: 40px auto;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
  gap: 30px;
}

.featured-project,
.project-card {
  overflow: hidden;
  border: 0;
  border-radius: 10px;
  /* Use the Bio card's subtle highlight over an opaque base so the
     decorative cylinder cannot show through either project-card style. */
  background-color: var(--color-media-background);
  background-image: linear-gradient(167deg, rgb(241 241 241 / 5%), rgb(0 0 0 / 10%));
  box-shadow: 0 5px 15px var(--color-shadow-faint);
}

.featured-project {
  margin-bottom: 60px;
  padding: 30px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 40px;
}

.featured-project:nth-child(even) {
  direction: rtl;
}

.project-card {
  height: 450px;
  display: flex;
  flex-direction: column;
  content-visibility: auto;
  contain-intrinsic-size: auto 450px;
}

/* Project images */
.project-image {
  position: relative;
  height: 200px;
  overflow: hidden;
  background: var(--color-media-background);
}

.featured-image {
  height: 380px;
  overflow: hidden;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--color-media-background);
}

.project-image img,
.featured-image img {
  width: 100%;
  user-select: none;
  filter: grayscale(20%);
  transition: opacity 300ms ease, transform 0.5s ease, filter 0.5s ease;
}

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

.featured-image img {
  height: 100%;
  border-radius: 10px;
  object-fit: cover;
}

.project-card:hover .project-image img,
.featured-project:hover .featured-image img {
  transform: scale(1.015);
  filter: grayscale(0%);
}

.image-nav {
  position: absolute;
  inset: 0;
  padding: 0 15px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.project-card:hover .image-nav {
  opacity: 1;
}

.nav-arrow {
  z-index: 2;
  width: 35px;
  height: 35px;
  border: 1px solid var(--control-border);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--control-background);
  color: var(--control-text);
  cursor: pointer;
  transition: transform 0.3s ease, background 0.3s ease, color 0.3s ease, box-shadow 0.3s ease;
}

.nav-arrow:hover {
  transform: scale(1.1);
  background: var(--control-background-hover);
  color: var(--control-text-hover);
  box-shadow: 0 0 10px var(--color-shadow-control);
}

.nav-arrow iconify-icon {
  font-size: 18px;
  filter: drop-shadow(0 0 2px var(--color-shadow-modal));
}

/* Project content */
.project-content,
.featured-content {
  padding: 25px;
  flex-grow: 1;
  display: flex;
  flex-direction: column;
}

.featured-content {
  justify-content: center;
  direction: ltr;
}

.project-title,
.featured-title {
  margin-bottom: 15px;
  color: var(--color-text-white);
  font-family: "Century Gothic", sans-serif;
  font-weight: 600;
  letter-spacing: -0.5px;
}

.project-title {
  font-size: 1.5rem;
}

.featured-title {
  margin-bottom: 20px;
  font-size: 2.2rem;
}

.project-description,
.featured-description {
  margin-bottom: 20px;
  color: var(--color-text-body);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 0.95rem;
  line-height: 1.7;
}

.featured-description {
  margin-bottom: 30px;
  font-size: 1rem;
}

.project-tech,
.featured-tech {
  margin-bottom: 20px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.tech-tag,
.featured-tag {
  padding: 6px 14px;
  border-radius: 4px;
  background: var(--color-surface-soft);
  color: var(--color-text-button);
  font-size: 0.9rem;
  user-select: none;
  transition: background 0.3s ease, color 0.3s ease;
}

.featured-tag {
  margin-bottom: 30px;
}

.project-card:hover .tech-tag,
.featured-project:hover .featured-tag {
  background: var(--color-surface-neutral-hover);
  color: var(--color-text-soft);
}

.project-links,
.featured-links {
  margin-top: auto;
  display: flex;
  gap: 12px;
}

.project-link,
.featured-link,
.project-details-btn {
  padding: 8px 16px;
  border: 1px solid var(--button-border);
  border-radius: 4px;
  display: inline-block;
  background: var(--button-background);
  color: var(--button-text);
  font-size: 0.9rem;
  font-weight: 500;
  text-decoration: none;
  cursor: pointer;
  user-select: none;
  transition: transform 0.3s ease, background 0.3s ease, color 0.3s ease;
}

.featured-link {
  padding: 10px 22px;
  font-size: 0.95rem;
}

.project-link:hover,
.featured-link:hover,
.project-details-btn:hover {
  transform: translateY(-2px);
  background: var(--button-background-hover);
  color: var(--button-text-hover);
}

/* Demo reel */
.demo-reel-section {
  width: 90%;
  max-width: 1200px;
  margin: 0 auto 60px;
  padding-top: 40px;
}

.demo-reel-container {
  border-radius: 10px;
  background: var(--color-modal-surface);
  user-select: none;
}

.demo-reel-container:hover {
  background: var(--color-modal-surface-hover);
}

.video-container {
  position: relative;
  width: 100%;
  padding-bottom: 56.25%;
  overflow: hidden;
  border-radius: 10px;
}

.video-container iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
  border-radius: 10px;
  background: var(--color-media-background);
  transition: box-shadow 0.3s ease;
}

.video-container iframe:hover {
  box-shadow: 0 0 30px var(--color-shadow-modal);
}

/* Project details modal */
.project-modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.project-modal.active {
  opacity: 1;
  pointer-events: all;
}

.modal-overlay {
  position: absolute;
  inset: 0;
  background: var(--color-modal-overlay);
  backdrop-filter: blur(5px);
}

.modal-content {
  position: relative;
  width: 90%;
  max-width: 1200px;
  max-height: 90vh;
  overflow-y: auto;
  transform: translateY(20px);
  border-radius: 10px;
  background: var(--color-modal-surface);
  transition: transform 0.3s ease;
}

.project-modal.active .modal-content {
  transform: translateY(0);
}

.modal-close {
  position: absolute;
  top: 15px;
  right: 15px;
  z-index: 10;
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--color-close-control);
  cursor: pointer;
  transition: transform 0.3s ease, background 0.3s ease;
}

.modal-close:hover {
  transform: rotate(90deg);
  background: var(--color-close-control-hover);
}

.modal-close iconify-icon {
  color: var(--color-text-secondary);
  font-size: 24px;
}

.modal-body {
  padding: 30px;
  display: grid;
  grid-template-columns: 1.5fr 1fr;
  gap: 30px;
}

.modal-gallery-container {
  height: 100%;
  display: flex;
  flex-direction: column;
  user-select: none;
}

.modal-main-image {
  position: relative;
  width: 100%;
  min-height: 0;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--color-media-background);
}

.modal-main-image img {
  width: 100%;
  height: 100%;
  max-width: 100%;
  max-height: 100%;
  border-radius: 8px;
  object-fit: contain;
  transition: opacity 0.3s ease;
}

.modal-main-image::after,
.thumbnail-item::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 4;
  background: var(--color-media-background);
  opacity: 1;
  pointer-events: none;
}

.modal-main-image.image-loaded::after,
.thumbnail-item.image-loaded::after {
  opacity: 0;
  transition: opacity 0.4s ease;
}

.modal-main-image .nav-arrow {
  position: absolute;
  z-index: 5;
  border-color: var(--color-border-control-strong);
  background: var(--control-background-strong);
}

.modal-main-image .prev-gallery {
  left: 20px;
}

.modal-main-image .next-gallery {
  right: 20px;
}

.modal-thumbnails {
  min-height: 70px;
  margin-top: 15px;
  padding: 5px 0;
  overflow-x: auto;
  display: flex;
  gap: 10px;
}

.thumbnail-item {
  position: relative;
  width: 100px;
  height: 60px;
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--control-border);
  border-radius: 6px;
  background: var(--color-transparent);
  cursor: pointer;
}

.thumbnail-item:hover {
  transform: translateY(-2px);
  opacity: 0.9;
}

.thumbnail-item.active {
  border: 2px solid var(--color-gallery-selection);
  opacity: 1;
}

.thumbnail-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

@media (prefers-reduced-motion: reduce) {
  .modal-main-image.image-loaded::after,
  .thumbnail-item.image-loaded::after {
    transition: none;
  }
}

.modal-details h2 {
  margin-bottom: 20px;
  color: var(--color-text-primary);
  font-size: 1.8rem;
}

@media screen and (max-width: 992px) {
  .featured-project,
  .featured-project:nth-child(even) {
    padding: 20px;
    grid-template-columns: 1fr;
    direction: ltr;
  }

  .featured-image {
    height: 300px;
  }
}

@media screen and (max-width: 768px) {
  .projects-container {
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  }

  .project-card {
    height: auto;
  }

  .featured-project {
    margin-bottom: 40px;
  }

  .demo-reel-section {
    width: 95%;
    margin-bottom: 40px;
  }

  .project-modal {
    align-items: flex-start;
  }

  .project-modal.active {
    overscroll-behavior: contain;
  }

  .modal-content {
    width: 100%;
    max-width: 390px;
    max-height: 85vh;
    margin: 40px auto 0;
    padding: 12px;
    border-radius: 8px;
  }

  .modal-body {
    max-height: 70vh;
    margin: 0;
    padding: 15px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 15px;
  }

  .modal-gallery-container {
    width: 100%;
    height: auto;
  }

  .modal-main-image {
    margin-bottom: 8px;
  }

  .modal-main-image .nav-arrow {
    top: 50%;
    width: 36px;
    height: 36px;
    transform: translateY(-50%);
    opacity: 0.9;
  }

  .modal-main-image .nav-arrow:hover {
    transform: translateY(-50%) scale(1.1);
  }

  .modal-main-image .prev-gallery {
    left: 8px;
  }

  .modal-main-image .next-gallery {
    right: 8px;
  }

  .modal-thumbnails {
    height: 50px;
    min-height: 0;
    margin-top: 6px;
    padding: 0 0 4px;
    gap: 6px;
    justify-content: center;
    -webkit-overflow-scrolling: touch;
  }

  .thumbnail-item {
    width: 48px;
    height: 36px;
    flex-shrink: 0;
  }

  .modal-details {
    width: 100%;
    padding: 0;
  }

  .modal-details h2 {
    margin-bottom: 10px;
    font-size: 1.4rem;
  }

  .modal-close {
    top: 6px;
    right: 6px;
    width: 32px;
    height: 32px;
    background: var(--control-background-mobile);
  }

  .modal-close iconify-icon {
    font-size: 20px;
  }
}

@media screen and (min-width: 769px) and (max-width: 1199px) {
  .modal-content {
    width: 90%;
    max-width: 900px;
    padding: 20px;
  }

  .modal-body {
    display: flex;
    flex-direction: column;
    gap: 25px;
  }

  .modal-gallery-container,
  .modal-details {
    width: 100%;
  }

  .modal-details {
    padding: 0;
  }

  .modal-details h2 {
    margin-bottom: 15px;
    font-size: 1.6rem;
  }

  .modal-thumbnails {
    margin-top: 12px;
    justify-content: flex-start;
  }

  .thumbnail-item {
    width: 80px;
    height: 55px;
  }
}

@media screen and (min-width: 1024px) and (max-width: 1199px) {
  .modal-content {
    max-width: 960px;
  }

  .modal-body {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
  }
}

@media screen and (max-width: 380px) {
  .modal-content {
    width: 95%;
    margin-top: 30px;
    padding: 10px;
  }

  .modal-body {
    padding: 10px 8px;
    gap: 12px;
  }

  .modal-details h2 {
    font-size: 1.25rem;
  }

  .thumbnail-item {
    width: 42px;
    height: 32px;
  }
}
