.projects-page {
  max-width: 1200px;
  padding-bottom: 40px;

  /* ===== ARROW POSITION AND ROTATION =====
     x: negative = further LEFT, positive = further RIGHT
     y: positive = further DOWN, negative = further UP
     rot: arrow angle (higher values = more downward tilt)
  */

  --a1-x: -30px;
  --a1-y: 0px;
  --a1-rot: 30deg;

  --a2-x: 0px;
  --a2-y: 0px;
  --a2-rot: 0deg;

  --a3-x: -40px;
  --a3-y: 0px;
  --a3-rot: 50deg;

  /* ===== 3D HOUSE =====
     --house-ratio: container shape (4 / 3 = taller, 16 / 9 = wider)
     --house-grow: how much the house extends to the left (0px = column width)
  */

  --house-ratio: 4 / 3;
  --house-grow: 180px;
}

/* ===== TOP SECTION ===== */
.proj-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 24px;
}

.proj-title {
  font-family: "Cormorant Garamond", serif;
  font-weight: 400;
  font-size: clamp(4rem, 10vw, 7.5rem);
  line-height: 1;
  color: var(--maroon, #800000);
}

.back-btn {
  background: var(--maroon, #800000);
  color: #fff;
  padding: 8px 22px;
  border-radius: 4px;
  font-size: 1.1rem;
  transition: background 0.2s;
  text-decoration: none;
}

.back-btn:hover {
  background: #6f2323;
}

.proj-script {
  font-family: "Great Vibes", cursive;
  font-size: 2.6rem;
  margin: 10px 0 40px;
}

/* ===== IMAGES AND TEXT ===== */
.shot {
  width: 100%;
  max-width: 860px;
  height: auto;
  display: block;
  box-shadow: 6px 6px 0 rgba(0, 0, 0, 0.15);
}

.shot-2 {
  grid-column: 2;
  grid-row: 5;
  justify-self: start;
}

.proj-text {
  font-size: 1.55rem;
  font-weight: 600;
  line-height: 1.65;
  max-width: 580px;
}

/* ===== 3D HOUSE ===== */
.house-3d {
  position: relative;
  aspect-ratio: var(--house-ratio);
  height: auto;
  overflow: hidden;
  background: #c5bfc0;
  cursor: grab;
  touch-action: pan-y;
}

.house-3d:active {
  cursor: grabbing;
}

.house-3d canvas {
  display: block;
  width: 100%;
  height: 100%;
}

.house-loading,
.house-hint {
  position: absolute;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.45);
  color: #fff;
  font-size: 0.85rem;
  pointer-events: none;
}

.house-loading {
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
}

.house-hint {
  left: 14px;
  bottom: 12px;
  transition: opacity 0.6s;
}

.house-3d.is-touched .house-hint {
  opacity: 0;
}

/* ===== ARROW IMAGES ===== */
.arrow {
  --arrow-h: 220px;

  display: block;
  height: var(--arrow-h);
  width: auto;
  max-width: 100%;
  justify-self: center;
  object-fit: contain;
  mix-blend-mode: multiply;
  transition: clip-path 1.2s ease-in-out;
}

/* Arrows are hidden initially only when JavaScript is active. */
.js .arrow {
  clip-path: inset(0 100% 0 0);
}

.js .arrow[data-reveal="top"] {
  clip-path: inset(0 0 100% 0);
}

.js .arrow.is-drawn {
  clip-path: inset(0 0 0 0);
}

/* Arrow image flips */
.arrow.flip-x {
  transform: scaleX(-1);
}

.arrow.flip-y {
  transform: scaleY(-1);
}

.arrow.flip-xy {
  transform: scale(-1, -1);
}

/* Individual arrow sizes */
.arrow-1 {
  --arrow-h: 240px;
}

.arrow-2 {
  --arrow-h: 220px;
}

.arrow-3 {
  --arrow-h: 240px;
}

@media (prefers-reduced-motion: reduce) {
  .arrow {
    transition: none;
  }
}

/* ===== VIDEO ===== */
.video-block {
  --video-w: 1320px;
  --video-h: 1000px;
  --box-pad: 60px;

  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 22px;
  box-sizing: border-box;
  width: fit-content;
  max-width: 100%;
  margin: 30px auto 0;
  padding: var(--box-pad);
  background: #a31f26;
  border-radius: 22px;
}

.video-block video {
  display: block;
  width: 100%;
  height: auto;
  max-width: 1550px;
  max-height: none;
  border-radius: 8px;
}

.video-controls {
  display: flex;
  justify-content: center;
}

.video-btn {
  position: relative;
  width: 60px;
  height: 60px;
  border: none;
  border-radius: 50%;
  background: #fff;
  cursor: pointer;
  transition: transform 0.2s;
}

.video-btn:hover {
  transform: scale(1.08);
}

.video-btn::before {
  content: "";
  position: absolute;
  inset: 0;
  margin: auto;
  width: 22px;
  height: 22px;
  background: #a31f26;
  clip-path: polygon(20% 0, 100% 50%, 20% 100%);
  transform: translateX(2px);
}

.video-btn.is-playing::before {
  width: 18px;
  height: 18px;
  clip-path: none;
  border-radius: 3px;
  transform: none;
}

/* ===== MOBILE LAYOUT ===== */
.proj-grid,
.proj-bottom {
  display: grid;
  grid-template-columns: 1fr;
  row-gap: 24px;
}

@media (max-width: 800px) {
  .shot {
    width: 85%;
    max-width: 420px;
    justify-self: center;
  }

  .shot-2 {
    justify-self: center;
  }

  .proj-text {
    max-width: 90%;
    margin: 0 auto;
    font-size: 1.15rem;
  }

  .arrow-1,
  .arrow-2,
  .arrow-3 {
    --arrow-h: 130px;
  }
}

/* ===== DESKTOP LAYOUT (2 COLUMNS WITH DEDICATED ARROW ROWS) ===== */
@media (min-width: 801px) {
  .projects-page {
    display: grid;
    grid-template-columns: 1.6fr 1fr;
    column-gap: 60px;
    align-items: start;
  }

  .proj-grid {
    display: contents;
  }

  .proj-top {
    grid-column: 1 / -1;
    grid-row: 1;
  }

  .proj-script {
    grid-column: 1 / -1;
    grid-row: 2;
  }

  /* Row 3: Image 1 on the left and Text 1 on the right */
  .shot-1 {
    grid-column: 1;
    grid-row: 3;
  }

  .text-1 {
    grid-column: 2;
    grid-row: 3;
    align-self: center;
  }

  /* Row 4: Arrow 1, angled and starting below Image 1 */
  .arrow-1 {
    grid-column: 1 / -1;
    grid-row: 4;
    justify-self: center;
    margin: 20px auto;
    translate: var(--a1-x) var(--a1-y);
    rotate: var(--a1-rot);
  }

  /* Row 5: Text 2 on the left and the 3D house on the right */
  .text-middle {
    grid-column: 1;
    grid-row: 5;
    align-self: center;
  }

  .shot-2 {
    grid-column: 2;
    grid-row: 5;
  }

  /* The 3D house extends to the left to make it wider than its column */
  .house-3d {
    width: calc(100% + var(--house-grow));
    max-width: none;
    margin-left: calc(var(--house-grow) * -1);
  }

  /* Row 6: Arrow 2 */
  .arrow-2 {
    grid-column: 1 / -1;
    grid-row: 6;
    justify-self: center;
    margin: 5px auto;
    translate: var(--a2-x) var(--a2-y);
    rotate: var(--a2-rot);
  }

  /* Row 7: Image 3 on the left and Text 3 on the right */
  .shot-3 {
    grid-column: 1;
    grid-row: 7;
  }

  .text-2 {
    grid-column: 2;
    grid-row: 7;
    align-self: center;
  }

  /* Arrow 3, angled and pointing from Image 3 towards the video */
  .proj-bottom {
    grid-column: 1 / -1;
    grid-row: 8;
    display: flex;
    justify-content: center;
    margin: 5px 0;
  }

  .arrow-3 {
    margin: 20px auto;
    translate: var(--a3-x) var(--a3-y);
    rotate: var(--a3-rot);
  }

  /* Video at the bottom */
  .video-block {
    grid-column: 1 / -1;
    grid-row: 9;
    justify-self: center;
  }
}
