/* =========================================================
   HOME / PROJECT STAGE
   Alaplogika:
   - kompakt nézet az alap
   - stage mód csak nagy, elég magas viewportban kapcsol be
========================================================= */

:root {
  --gate-inner-top: 78px;
  --gate-inner-right: 73px;
  --gate-topband-h: 110px;

  --gate-bar-offset-y: -80px;
  --gate-bar-offset-x: 24px;

  --matte-w: clamp(480px, 60vw, 744px);
  --matte-gap: 33px;

  --gate-header-height: 80px;
}


/* =========================================================
   WRAPPER
========================================================= */

.projects-stage-section {
  position: relative;
}

.projects-stage-scroll {
  position: relative;
  height: auto;
}

.projects-stage {
  position: relative;
  width: 100%;
  height: auto;
  overflow: visible;
}


/* =========================================================
   KOMPAKT / EDITORIAL ALAPNÉZET
========================================================= */

.projects-stage-headers {
  display: none;
}

.gate-card {
  position: relative;
  cursor: pointer;
  opacity: 1;
  transform: none;
  transition: opacity 300ms ease;
  margin-bottom: var(--space-6);
}

.gate-card.is-hidden,
.gate-card:not(.is-active) {
  opacity: 1;
  pointer-events: auto;
}

.gate-pin {
  position: relative;
  width: 100%;
  height: auto;
}

.gate-link {
  position: absolute;
  inset: 0;
  z-index: 6;
  display: block;
}

.gate-bar,
.gate-copy {
  pointer-events: none;
}

.gate-frame {
  position: relative;
  width: 100%;
  padding: clamp(20px, 4vw, 40px);
  background: var(--bg-light);
  overflow: visible;
}

.gate-bar {
  position: relative;
  left: auto;
  top: auto;
  height: auto;
  transform: none;

  display: flex;
  flex-direction: column;
  gap: 8px;

  margin-bottom: var(--space-3);
  z-index: 9;
}

.gate-meta {
  font-size: clamp(10px, 0.85vw, 11px);
  font-weight: 400;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.gate-media {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 10;
  overflow: hidden;
  background: var(--bg-light);
  z-index: 3;
}

.gate-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;

  object-fit: contain;
  object-position: var(--focus-x, 50%) var(--focus-y, 50%);

  --pan-x: 0px;
  --pan-y: 0px;
  --zoom: 1;

  opacity: 0;
  filter: contrast(1.02) brightness(1.02);

  transform:
    translate(var(--pan-x), var(--pan-y))
    scale(var(--zoom));

  transition: opacity 420ms ease, transform 900ms ease;
}

.gate-img.is-active {
  opacity: 1;
}

.gate-copy {
  position: relative;
  left: auto;
  bottom: auto;
  width: min(100%, 720px);
  margin-top: var(--space-3);
  z-index: 8;
}

.project-description {
  font-size: clamp(13px, 1.4vw, 15px);
  line-height: 1.6;
}

.gate-svg-frame {
  display: none;
}


/* =========================================================
   STAGE MÓD
   Csak akkor aktív, ha van elég szélesség, magasság és arány
========================================================= */

@media (min-width: 821px) and (min-height: 681px) {

  .projects-stage-scroll {
    height: 520vh;
  }

  .projects-stage {
    position: sticky;
    top: 0;
    width: 100%;
    height: 100svh;
    overflow: hidden;

    --stage-tabs-space: 42px;
  }

  .projects-stage-headers {
    position: absolute;
    top: 0;
    left: 0;
    z-index: 100;

    width: 100%;
    padding-top: 18px;
    padding-left: 24px;
    padding-right: 24px;

    display: flex;
    flex-direction: row;
    align-items: flex-start;
    gap: 8px;

    pointer-events: none;
  }

  .stage-header {
    display: inline-flex;
    align-items: center;
    justify-content: center;

    height: 24px;
    padding: 0 12px;
    white-space: nowrap;

    background: #2a2f30;
    border-radius: 6px 6px 0 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.15);

    box-shadow:
      0 2px 6px rgba(0, 0, 0, 0.2),
      inset 0 -1px 0 rgba(255, 255, 255, 0.06);

    opacity: 0;
    transform: translateX(-8px) translateY(2px);
    transition: opacity 220ms ease, transform 260ms ease;
  }

  .stage-header-title {
    margin: 0;
  }

  .stage-header-meta {
    display: none;
  }

  .gate-card {
    position: absolute;
    top: var(--stage-tabs-space);
    right: 0;
    bottom: 0;
    left: 0;

    margin-bottom: 0;

    opacity: 1;
    transform: translateY(110%);
    transition: transform 500ms ease, opacity 300ms ease;
    will-change: transform;
  }

  .gate-card:nth-of-type(1) {
    z-index: 1;
    transform: translateY(0);
  }

  .gate-card:nth-of-type(2) {
    z-index: 2;
  }

  .gate-card:nth-of-type(3) {
    z-index: 3;
  }

  .gate-card.is-active {
    transform: translateY(0);
  }

  .gate-card.is-under {
    transform: translateY(0);
  }

  .gate-card.is-hidden {
    opacity: 0;
    pointer-events: none;
  }

  .gate-pin {
    height: 100%;
  }

  .gate-frame {
    position: relative;
    width: 100%;
    aspect-ratio: 1142 / 662;
    padding: 44px;

    padding-right: calc(
      var(--gate-inner-right) +
      var(--matte-gap) +
      var(--matte-w) +
      var(--matte-gap)
    );

    background: var(--bg-light);
    overflow: hidden;
  }

  .gate-bar {
    position: absolute;
    left: var(--gate-bar-offset-x);
    top: calc(
      var(--gate-inner-top) +
      (var(--gate-topband-h) / 2) +
      var(--gate-bar-offset-y)
    );

    height: var(--gate-header-height);
    transform: translateY(-50%);

    margin-bottom: 0;

    display: flex;
    flex-direction: column;
    gap: clamp(6px, 1vw, 10px);

    z-index: 9;
    opacity: 1;
    transition: opacity 220ms ease, transform 220ms ease;
  }

  .gate-card.is-peek .gate-bar {
    opacity: 0;
    transform: translateY(calc(-50% - 6px));
    pointer-events: none;
  }

  .gate-copy {
    position: absolute;
    left: var(--gate-bar-offset-x);
    bottom: 10px;
    width: clamp(180px, 16vw, 240px);
    margin-top: 0;
    z-index: 8;

    opacity: 1;
    transform: translateY(0);
    transition: opacity 220ms ease, transform 220ms ease;
  }

  .gate-card.is-peek .gate-copy {
    opacity: 0;
    transform: translateY(-6px);
    pointer-events: none;
  }

  .gate-media {
    position: absolute;
    top: 16.8%;
    right: 9.3%;

    width: 64%;
    aspect-ratio: 744 / 557;
    height: auto;

    background: var(--bg-light);
    overflow: hidden;
    z-index: 3;
  }

  .gate-img {
    object-fit: cover;
    object-position: var(--focus-x, 50%) var(--focus-y, 50%);

    --pan-x: 0px;
    --pan-y: 0px;
    --zoom: 1.1;

    opacity: 0;

    transform:
      perspective(1200px)
      translate(var(--pan-x), var(--pan-y))
      rotate(var(--rot, 0deg))
      rotateX(var(--rotx, 0deg))
      scale(calc(var(--zoom) * 0.96));
  }

  .gate-img.is-active {
    opacity: 1;

    transform:
      perspective(1200px)
      translate(var(--pan-x), var(--pan-y))
      rotate(var(--rot, 0deg))
      rotateX(var(--rotx, 0deg))
      scale(var(--zoom));
  }

  .gate-card:hover .gate-img {
    transform:
      perspective(1200px)
      translate(var(--pan-x), var(--pan-y))
      rotate(var(--rot, 0deg))
      rotateX(var(--rotx, 0deg))
      scale(calc(var(--zoom) * 1.03));
  }

  .gate-svg-frame {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    display: block;
    pointer-events: none;
    z-index: 7;
  }

  .gate-svg-frame .st0 {
    fill: #F2F2F3;
  }
}


/* =========================================================
   KÖZTES / KISEBB, DE MÉG TÁGASABB NÉZETEK
========================================================= */

@media (max-width: 820px),
       (max-height: 680px) {
  .gate-frame {
    padding: 28px;
  }

  .gate-copy {
    width: min(100%, 620px);
  }
}

@media (max-width: 700px),
       (max-height: 620px) {
  .gate-frame {
    padding: 20px;
  }

  .gate-media {
    aspect-ratio: 4 / 3;
  }

  .project-description {
    font-size: 14px;
    line-height: 1.6;
  }
}

/* =========================================================
   KOMPAKT EDITORIAL RHYTHM
========================================================= */

@media not all and (min-width: 821px) and (min-height: 681px) {

  .projects-stage-section {
    margin-top: var(--space-4);
  }

  .gate-card {
    margin-bottom: clamp(72px, 12vw, 140px);
  }

  .gate-frame {
    padding: 0;
  }

  .gate-bar {
    margin-bottom: clamp(18px, 4vw, 32px);
  }

  .gate-media {
    margin-top: clamp(20px, 4vw, 36px);
  }

  .gate-copy {
    margin-top: clamp(18px, 4vw, 32px);
    width: min(100%, 680px);
  }

  .gate-title {
    max-width: 760px;
  }

  .project-description {
    max-width: 620px;
  }
}

/* =========================================================
   COMPACT DESCRIPTIONS
========================================================= */

.project-description--compact {
  display: none;
}

@media not all and (min-width: 821px) and (min-height: 681px) {

  .project-description {
    display: none;
  }

  .project-description--compact {
    display: block;
  }
}

/* =========================================================
   COMPACT / TEXT SCALE BRIDGE
   700–979px között nagyobb, levegősebb szöveg
========================================================= */

@media (min-width: 701px) and (max-width: 820px) {

  .gate-meta {
    font-size: 11px;
  }

  .gate-title {
    font-size: clamp(22px, 3vw, 28px);
    line-height: 1.05;
  }

  .project-description {
    font-size: clamp(15px, 1.8vw, 17px);
    line-height: 1.65;
  }

  .project-description--compact {
    font-size: clamp(16px, 2vw, 18px);
    line-height: 1.55;
  }
}