:root {
  --page-width: 1142px;
  --gold: #fede27;
  --ink: #1e1e1e;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  overflow-x: hidden;
}

body {
  margin: 0;
  min-width: 320px;
  overflow-x: hidden;
  background: #eee;
  color: #000;
  font-family: "Poppins", Arial, sans-serif;
}

a {
  color: inherit;
  text-decoration: none;
}

p {
  margin: 0;
}

img {
  display: block;
  max-width: none;
}

.loading,
.error {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 24px;
  text-align: center;
  font: 500 18px/1.4 "Poppins", Arial, sans-serif;
}

.error {
  color: #7d1111;
}

/* ── Section & Stage ── */
.lp-section {
  position: relative;
  width: 100%;
  overflow: hidden;
  background-position: center center;
  background-repeat: no-repeat;
  background-size: cover;
}

.lp-stage {
  position: relative;
  width: var(--page-width);
  height: 100%;
  margin: 0 auto;
}

/* ── Desktop elements (absolute) ── */
.lp-el {
  position: absolute;
  transform-origin: top left;
}

.lp-text {
  overflow: visible;
  word-wrap: break-word;
  overflow-wrap: break-word;
}

.lp-text span,
.lp-text p {
  letter-spacing: 0;
}

.lp-image {
  object-fit: contain;
}

.lp-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 14px;
  text-align: center;
  line-height: 1.2;
  white-space: normal;
  cursor: pointer;
  transition: transform 160ms ease, filter 160ms ease;
}

.lp-button:hover {
  filter: brightness(0.96);
  transform: translateY(-1px);
}

.lp-button:focus-visible {
  outline: 3px solid rgba(254, 222, 39, 0.55);
  outline-offset: 4px;
}

.lp-box {
  position: absolute;
  overflow: visible;
}

.lp-code {
  position: absolute;
  overflow: visible;
}

.lp-code iframe {
  width: 100%;
  height: 100%;
  border: 0;
}

/* ── Carousel ── */
.portfolio-carousel {
  position: relative;
  width: 100%;
  height: 100%;
  perspective: 1100px;
  overflow: visible;
}

.portfolio-slide {
  position: absolute;
  top: 50%;
  left: 50%;
  width: min(36vw, 380px);
  max-width: 34%;
  aspect-ratio: 1 / 1;
  border-radius: 8px;
  background-position: center;
  background-size: cover;
  box-shadow: 0 22px 54px rgba(0, 0, 0, 0.45);
  opacity: 0;
  transform: translate(-50%, -50%) scale(0.72);
  transition: transform 900ms ease, opacity 900ms ease;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.portfolio-slide.is-active {
  z-index: 5;
  opacity: 1;
  transform: translate(-50%, -50%) translateX(0) rotateY(0) scale(1);
}

.portfolio-slide.is-prev {
  z-index: 4;
  opacity: 0.78;
  transform: translate(-50%, -50%) translateX(-82%) rotateY(38deg) scale(0.82);
}

.portfolio-slide.is-next {
  z-index: 4;
  opacity: 0.78;
  transform: translate(-50%, -50%) translateX(82%) rotateY(-38deg) scale(0.82);
}

.portfolio-slide.is-far-prev {
  z-index: 3;
  opacity: 0.3;
  transform: translate(-50%, -50%) translateX(-150%) rotateY(48deg) scale(0.68);
}

.portfolio-slide.is-far-next {
  z-index: 3;
  opacity: 0.3;
  transform: translate(-50%, -50%) translateX(150%) rotateY(-48deg) scale(0.68);
}

/* ── Lightbox ── */
.lightbox-overlay {
  position: fixed;
  inset: 0;
  z-index: 10000;
  background: rgba(0, 0, 0, 0.92);
  display: flex;
  align-items: center;
  justify-content: center;
  animation: lb-fade-in 250ms ease;
}

@keyframes lb-fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

.lightbox-img {
  max-width: 90vw;
  max-height: 85vh;
  object-fit: contain;
  border-radius: 8px;
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.6);
  user-select: none;
  -webkit-user-drag: none;
}

.lightbox-close {
  position: absolute;
  top: 16px;
  right: 20px;
  background: none;
  border: none;
  color: #fff;
  font-size: 32px;
  cursor: pointer;
  z-index: 10001;
  line-height: 1;
  padding: 8px;
  opacity: 0.8;
  transition: opacity 200ms;
}

.lightbox-close:hover {
  opacity: 1;
}

.lightbox-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(255, 255, 255, 0.12);
  border: none;
  color: #fff;
  font-size: 48px;
  cursor: pointer;
  padding: 8px 16px;
  border-radius: 8px;
  z-index: 10001;
  opacity: 0.7;
  transition: opacity 200ms, background 200ms;
  line-height: 1;
  user-select: none;
}

.lightbox-nav:hover {
  opacity: 1;
  background: rgba(255, 255, 255, 0.22);
}

.lightbox-prev {
  left: 12px;
}

.lightbox-next {
  right: 12px;
}

/* ══════════════════════════════════════
   MOBILE — Flow layout (no absolute)
   ══════════════════════════════════════ */
@media (max-width: 767px) {
  body {
    background: #1e1e1e;
  }

  .lp-section.mobile {
    height: auto !important;
    overflow: visible;
    padding: 24px 0;
  }

  .lp-section.mobile .lp-stage {
    width: 100%;
    max-width: 375px;
    height: auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    padding: 0 16px;
  }

  .lp-section.mobile .lp-el {
    position: static !important;
    transform: none !important;
    flex-shrink: 0;
  }

  .lp-section.mobile .lp-text {
    width: 100%;
    text-align: center;
  }

  .lp-section.mobile .lp-image {
    height: auto !important;
    border-radius: 8px;
  }

  .lp-section.mobile .lp-button {
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .lp-section.mobile .lp-box {
    position: static !important;
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    border-radius: 8px;
  }

  .lp-section.mobile .lp-box .lp-el {
    position: static !important;
  }

  .lp-section.mobile .lp-box .lp-image {
    width: 20px !important;
    height: 20px !important;
    flex-shrink: 0;
  }

  .lp-section.mobile .lp-box .lp-text {
    text-align: left;
    flex: 1;
  }

  .lp-section.mobile .lp-code {
    position: relative !important;
    height: 260px !important;
    overflow: visible;
  }

  .portfolio-slide {
    width: 180px;
    max-width: none;
  }

  .portfolio-slide.is-prev {
    transform: translate(-50%, -50%) translateX(-62%) rotateY(32deg) scale(0.78);
  }

  .portfolio-slide.is-next {
    transform: translate(-50%, -50%) translateX(62%) rotateY(-32deg) scale(0.78);
  }

  .portfolio-slide.is-far-prev,
  .portfolio-slide.is-far-next {
    opacity: 0;
  }

  .lightbox-nav {
    font-size: 36px;
    padding: 6px 12px;
  }

  .lightbox-prev {
    left: 4px;
  }

  .lightbox-next {
    right: 4px;
  }

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