:root {
  --bg-a: #E4EAE7;
  --bg-b: #D8E0DD;
  --panel: #0A0B0B;
  --panel-edge: rgba(255, 255, 255, 0.07);
  --ink: #F3F5F0;
  --blue: #2A46FF;
  --grey: #4A4F4C;
  --gap: 0.6vh;
  --outer: 1.2vh;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  background: linear-gradient(155deg, var(--bg-a) 0%, var(--bg-b) 100%);
}

#logo-container {
  position: fixed;
  bottom: 20px;
  left: 20px;
  width: 60px;
  height: 60px;
  z-index: 1000;
  cursor: pointer;
}

#logoShape {
  width: 100%;
  height: 100%;
}

.scene {
  position: relative;
  height: 600vh;
}

.pin {
  --progress: 0;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow: hidden;
  background: var(--bg-a);
}

.layer {
  position: absolute;
  inset: 0;
  will-change: transform, opacity, filter;
}

/* ---------- Scene 1: Intro Shatter Layer ---------- */
.intro-layer {
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(155deg, var(--bg-a) 0%, var(--bg-b) 100%);
  z-index: 50;
}

.intro-stack {
  position: relative;
  width: fit-content;
  max-width: 84vw;
}

.intro-box {
  box-sizing: border-box;
  font-family: 'JetBrains Mono', monospace;
  color: var(--ink);
  letter-spacing: 0.01em;
  transform-origin: center center;
  will-change: transform, opacity;
}

.intro-grey {
  position: relative;
  width: fit-content;
  max-width: 84vw;
  background: var(--grey);
  border: 1px solid var(--panel-edge);
  padding: 1.2vh 1.6vw;
  font-weight: 700;
  font-size: 1.8vh;
  line-height: 1.6;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  margin-bottom: 1.2vh;
  white-space: nowrap;
}

.grey-highlight {
  display: inline-block;
  background: var(--panel);
  padding: 0.15em 0.5em;
  margin: 0 0.2em;
}

.intro-black {
  position: relative;
  width: fit-content;
  max-width: 84vw;
  background: var(--panel);
  border: 1px solid var(--panel-edge);
  padding: 2.8vh 2.8vw;
  font-weight: 700;
  font-size: 4.5vh;
  line-height: 1.2;
  white-space: nowrap;
}

.intro-blue {
  position: absolute;
  bottom: -3.8vh;
  right: -2vw;
  z-index: 5;
  width: fit-content;
  background: var(--blue);
  border: 1px solid rgba(255, 255, 255, 0.25);
  padding: 1.2vh 1.4vw;
  font-weight: 700;
  font-size: 1.8vh;
  line-height: 1.4;
  white-space: nowrap;
  transform: rotate(-7deg);
  box-shadow: 0 1.2vh 2vh rgba(10, 11, 11, 0.28);
}

.cmd-symbol {
  margin-left: 0.5em;
  font-weight: 700;
}

@media (max-width: 800px) {
  .intro-stack {
    max-width: 90vw;
  }

  .intro-grey {
    font-size: 1.4vh;
    padding: 1.1vh 1.4vw;
    white-space: normal;
  }

  .intro-black {
    font-size: 3vh;
    padding: 2.2vh 2.2vw;
    white-space: normal;
  }

  .intro-blue {
    bottom: -3vh;
    right: -1.4vw;
    font-size: 1.5vh;
    padding: 1.1vh 1.2vw;
  }
}

/* ---------- Layer 1: Marquee Wall ---------- */
.wall {
  width: 100%;
  height: 100%;
  padding: var(--outer);
  display: grid;
  grid-template-rows: repeat(14, 1fr);
  gap: var(--gap);
}

.row {
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
}

.track {
  display: inline-flex;
  align-items: center;
  white-space: nowrap;
  will-change: transform, animation-duration;
}

.chip {
  display: inline-block;
  position: relative;
  margin-right: 4vw;
  perspective: 800px;
  transition: margin-right 0.4s cubic-bezier(0.4, 0.2, 0.2, 1);
}

.chip-inner {
  position: relative;
  display: inline-block;
  transform-style: preserve-3d;
  transition: transform 0.5s cubic-bezier(0.4, 0.2, 0.2, 1);
}

body.rows-flipped .chip-inner {
  transform: rotateX(180deg);
}

.chip-face {
  display: block;
  font-family: 'JetBrains Mono', monospace;
  font-weight: 700;
  font-size: 2.6vh;
  line-height: 1;
  letter-spacing: 0.01em;
  padding: 1.1vh 1.6vw;
  text-transform: uppercase;
  white-space: nowrap;
  backface-visibility: hidden;
  transition: opacity 0.5s ease, background 0.5s ease;
}

.chip-front {
  color: var(--ink);
  background: var(--panel);
  border: 1px solid var(--panel-edge);
}

.chip-back {
  position: absolute;
  top: 0;
  left: 0;
  color: var(--ink);
  background: var(--blue);
  border: 1px solid rgba(255, 255, 255, 0.25);
  transform: rotateX(180deg);
}

@keyframes go-left {
  from {
    transform: translateX(0);
  }
  to {
    transform: translateX(-50%);
  }
}

@keyframes go-right {
  from {
    transform: translateX(-50%);
  }
  to {
    transform: translateX(0);
  }
}

.dir-left {
  animation-name: go-left;
}

.dir-right {
  animation-name: go-right;
}

.track {
  animation-timing-function: linear;
  animation-iteration-count: infinite;
}

.row .track {
  animation-duration: 60s;
}

.row:nth-child(odd) .track {
  animation-delay: 0s;
}

.row:nth-child(even) .track {
  animation-delay: -30s;
}

@media (prefers-reduced-motion: reduce) {
  .track {
    animation: none !important;
  }
}

@media (max-width: 700px) {
  .chip-face {
    font-size: 2.1vh;
    padding: 0.9vh 2.4vw;
  }
}

/* ---------- Layer 2: Diamond reveal ---------- */
.reveal-layer {
  background: linear-gradient(155deg, var(--bg-a) 0%, var(--bg-b) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  visibility: hidden;
}

.diamond-stack {
  --d-top: 30vh;
  --d-mid: 35vh;
  --d-bottom: 30vh;
  --reach-top: calc(var(--d-top) * 0.7071);
  --reach-mid: calc(var(--d-mid) * 0.7071);
  --reach-bottom: calc(var(--d-bottom) * 0.7071);
  position: relative;
  width: var(--d-mid);
  height: calc(var(--reach-top)*2 + var(--reach-mid)*2 + var(--reach-bottom)*2);
}

.diamond {
  position: absolute;
  left: 50%;
  background: var(--panel);
  border: 1px solid var(--panel-edge);
  transform: translate(-50%, -50%) rotate(45deg);
  will-change: transform, opacity;
}

.diamond.d-top {
  top: var(--reach-top);
  width: var(--d-top);
  height: var(--d-top);
}

.diamond.d-mid {
  top: calc(var(--reach-top)*2 + var(--reach-mid));
  width: var(--d-mid);
  height: var(--d-mid);
}

.diamond.d-bottom {
  top: calc(var(--reach-top)*2 + var(--reach-mid)*2 + var(--reach-bottom));
  width: var(--d-bottom);
  height: var(--d-bottom);
}

@media (max-width: 800px) {
  .diamond-stack {
    --d-top: 20vh;
    --d-mid: 25vh;
    --d-bottom: 20vh;
  }
}

/* ---------- Morphing Boxes (Scene 3 -> 4) ---------- */
.transition-box {
  position: absolute;
  top: 0;
  left: 0;
  z-index: 10;
  box-sizing: border-box;
  font-family: 'JetBrains Mono', monospace;
  font-weight: 500;
  color: var(--ink);
  background: var(--panel);
  border: 1px solid var(--panel-edge);
  letter-spacing: 0.01em;
  pointer-events: auto;
  will-change: transform, width, height, opacity;
  overflow: hidden;
  padding: 0;
}

.content-layer {
  position: absolute;
  top: 50%;
  left: 0;
  width: 100%;
  height: auto;
  transform: translateY(-50%);
  padding: inherit;
  line-height: 1.5;
  box-sizing: border-box;
}

.content-initial {
  opacity: 1;
}

.content-final {
  opacity: 0;
  font-weight: 600;
}

.content-scene4 {
  opacity: 0;
  line-height: 1.7;
}