.gaiamath-works {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  padding: clamp(70px, 8vw, 120px) clamp(8px, 1vw, 16px) 14px;
  color: #161817;
  background: #f4f3ef;
}

.gaiamath-works-swarm {
  position: fixed;
  z-index: 0;
  top: 0;
  left: 0;
  width: 100%;
  height: 100vh;
  display: block;
  pointer-events: none;
  opacity: 0;
  transition: opacity .55s ease;
}

.gaiamath-works.is-swarm-active .gaiamath-works-swarm { opacity: .96; }

.gaiamath-works-head {
  position: relative;
  z-index: 1;
  isolation: isolate;
  overflow: hidden;
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 24px;
  margin: 0 0 clamp(18px, 2vw, 28px);
  padding: clamp(20px, 2.5vw, 34px);
  color: #111514;
  background: #fff;
  border: 1px solid #d4d1c8;
  border-radius: 8px;
  box-shadow:
    0 8px 18px rgba(15, 20, 18, .13),
    inset 0 1px 0 rgba(255, 255, 255, 1),
    inset 0 -3px 0 rgba(176, 173, 164, .22);
}

.gaiamath-works-head-wave {
  position: absolute;
  z-index: -1;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  opacity: .9;
}

.gaiamath-works-head span {
  color: #237a75;
  font: 800 10px/1.2 Arial, sans-serif;
  letter-spacing: .16em;
  text-transform: uppercase;
}

.gaiamath-works-head h2 {
  margin: 0;
  max-width: 900px;
  text-align: right;
  font: 400 clamp(1.65rem, 3.4vw, 4.4rem)/1 Georgia, serif;
  letter-spacing: 0;
  will-change: transform;
  animation: worksTitleWalk 8.5s ease-in-out infinite alternate;
}

@keyframes worksTitleWalk {
  from { transform: translateX(-18px); }
  to { transform: translateX(18px); }
}

.gaiamath-works-grid {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: clamp(9px, 1vw, 14px);
}

.gaiamath-work {
  position: relative;
  aspect-ratio: 16 / 10;
  min-width: 0;
  margin: 0;
  overflow: hidden;
  padding: clamp(5px, .55vw, 8px);
  background: #fff;
  border: 1px solid #d2cfc6;
  border-radius: 8px;
  box-shadow:
    0 7px 15px rgba(20, 24, 22, .15),
    inset 0 1px 0 #fff,
    inset 0 -3px 0 rgba(160, 158, 150, .24);
  cursor: pointer;
  transition: transform .3s ease, box-shadow .3s ease;
}

.gaiamath-work::before,
.gaiamath-work::after {
  content: "";
  position: absolute;
  inset: 7px;
  z-index: 2;
  pointer-events: none;
  opacity: 0;
  mix-blend-mode: screen;
}

.gaiamath-work::before {
  background: linear-gradient(90deg, transparent 0 12%, rgba(0, 238, 255, .72) 12% 38%, transparent 38% 58%, rgba(255, 37, 156, .68) 58% 86%, transparent 86%);
}

.gaiamath-work::after {
  background: linear-gradient(90deg, rgba(255, 222, 0, .55), transparent 34%, rgba(58, 255, 177, .7) 62%, transparent 88%);
}

.gaiamath-work:hover::before,
.gaiamath-work:hover::after,
.gaiamath-work:focus-within::before,
.gaiamath-work:focus-within::after {
  opacity: .72;
}

.gaiamath-work:hover::before,
.gaiamath-work:focus-within::before {
  animation: worksGlitchTop 620ms steps(1, end) infinite;
}

.gaiamath-work:hover::after,
.gaiamath-work:focus-within::after {
  animation: worksGlitchBottom 760ms steps(1, end) infinite reverse;
}

.gaiamath-work:hover,
.gaiamath-work:focus-visible {
  transform: translateY(-3px);
  box-shadow:
    0 13px 24px rgba(20, 24, 22, .2),
    inset 0 1px 0 #fff,
    inset 0 -3px 0 rgba(160, 158, 150, .24);
}

.gaiamath-work:focus-visible { outline: 2px solid #168f89; outline-offset: 3px; }

.gaiamath-work video {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  border-radius: 5px;
  transform: scale(1.002);
  transition: transform .8s cubic-bezier(.2,.7,.2,1), filter .45s ease;
}

.gaiamath-work figcaption {
  position: absolute;
  inset: auto clamp(5px, .55vw, 8px) clamp(5px, .55vw, 8px);
  border-radius: 0 0 5px 5px;
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
  padding: 46px 16px 14px;
  color: #fff8e8;
  background: linear-gradient(transparent, rgba(0,0,0,.82));
  opacity: 0;
  transform: translateY(8px);
  transition: opacity .3s ease, transform .3s ease;
  z-index: 3;
}

.gaiamath-work figcaption strong {
  font: 600 clamp(.85rem, 1.1vw, 1.15rem)/1.1 Arial, sans-serif;
  letter-spacing: 0;
}

.gaiamath-work figcaption span {
  color: #7de7e0;
  font: 700 8px/1.1 Arial, sans-serif;
  letter-spacing: .12em;
  text-transform: uppercase;
}

.gaiamath-work:hover video,
.gaiamath-work:focus-within video { animation: worksVideoGlitch 760ms steps(1, end) infinite; }
.gaiamath-work:hover figcaption,
.gaiamath-work:focus-within figcaption { opacity: 1; transform: none; }

@keyframes worksGlitchTop {
  0%, 100% { clip-path: polygon(0 8%, 100% 8%, 100% 17%, 0 17%); transform: translateX(0); }
  24% { clip-path: polygon(0 22%, 100% 22%, 100% 31%, 0 31%); transform: translateX(-7px); }
  48% { clip-path: polygon(0 42%, 100% 42%, 100% 51%, 0 51%); transform: translateX(6px); }
  72% { clip-path: polygon(0 62%, 100% 62%, 100% 72%, 0 72%); transform: translateX(-4px); }
}

@keyframes worksGlitchBottom {
  0%, 100% { clip-path: polygon(0 74%, 100% 74%, 100% 83%, 0 83%); transform: translateX(0); }
  30% { clip-path: polygon(0 53%, 100% 53%, 100% 61%, 0 61%); transform: translateX(8px); }
  58% { clip-path: polygon(0 32%, 100% 32%, 100% 39%, 0 39%); transform: translateX(-5px); }
  82% { clip-path: polygon(0 86%, 100% 86%, 100% 94%, 0 94%); transform: translateX(4px); }
}

@keyframes worksVideoGlitch {
  0%, 100% { filter: none; transform: scale(1.035) translateX(0); }
  24% { filter: saturate(1.45) hue-rotate(8deg); transform: scale(1.045) translateX(-2px); }
  48% { filter: contrast(1.16) hue-rotate(-10deg); transform: scale(1.04) translateX(2px); }
  72% { filter: saturate(1.25); transform: scale(1.045) translateX(-1px); }
}

.gaiamath-works-viewer {
  width: min(1240px, 94vw);
  max-width: none;
  padding: 0;
  overflow: visible;
  color: #fff;
  background: transparent;
  border: 0;
}

.gaiamath-works-viewer,
.gaiamath-works-viewer * {
  cursor: auto !important;
}

.gaiamath-works-viewer button:not(:disabled) {
  cursor: pointer !important;
}

.gaiamath-works-viewer::backdrop {
  background: rgba(3, 5, 6, .88);
  backdrop-filter: blur(10px);
}

.gaiamath-works-viewer-shell {
  position: relative;
  padding: 7px;
  background: #f8f7f2;
  border: 1px solid rgba(255,255,255,.78);
  border-radius: 8px;
  box-shadow: 0 28px 90px rgba(0,0,0,.72), inset 0 -3px 0 rgba(80,82,78,.2);
}

.gaiamath-works-viewer video {
  width: 100%;
  max-height: 80vh;
  aspect-ratio: 16 / 9;
  display: block;
  object-fit: contain;
  background: #000;
  border-radius: 5px;
}

.gaiamath-works-viewer-close {
  position: absolute;
  z-index: 2;
  top: -18px;
  right: -18px;
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  padding: 0;
  color: #101312;
  background: #fff;
  border: 1px solid #c8c5bc;
  border-radius: 50%;
  font: 300 30px/1 Arial, sans-serif;
  box-shadow: 0 8px 22px rgba(0,0,0,.34);
  cursor: pointer;
}

.gaiamath-works-viewer-caption {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  padding: 12px 10px 8px;
  color: #161817;
}

.gaiamath-works-viewer-caption strong { font: 600 1rem/1.2 Arial, sans-serif; }
.gaiamath-works-viewer-caption span {
  color: #237a75;
  font: 800 9px/1.2 Arial, sans-serif;
  text-transform: uppercase;
  letter-spacing: .12em;
}

.skull-rhythm-corridor {
  min-height: clamp(260px, 34vw, 520px);
  background: #000;
}

.skull-rhythm-corridor video {
  width: 100%;
  height: 100%;
  min-height: inherit;
  display: block;
  object-fit: contain;
  background: #000;
}

.film-section .section-title {
  width: 100%;
  text-align: center;
  white-space: normal;
  font-size: clamp(2.3rem, 5.4vw, 6.2rem);
}

.film-section .section-title span {
  display: block;
}

.film-section .section-intro {
  text-align: center;
}

.film-section .section-intro-copy {
  margin-inline: auto;
  text-align: center;
}

.mirrors-arrival {
  position: relative;
  z-index: 2;
  width: min(1180px, 94vw);
  margin: clamp(-34px, -2vw, -10px) auto clamp(28px, 3vw, 52px);
  opacity: 0;
  transform: translateY(-34vh) scale(.94);
  isolation: isolate;
  transition: opacity 1.8s ease, transform 3.4s cubic-bezier(.16,.8,.2,1);
}

.mirrors-starfield {
  position: absolute;
  z-index: -1;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
}

.mirrors-starfield canvas {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100vh;
  display: block;
  opacity: 0;
  mix-blend-mode: screen;
}

.mirrors-chamber.is-starfield-active .mirrors-starfield canvas {
  opacity: .9;
}

.mirrors-arrival.is-arrived { opacity: 1; transform: none; }
.mirrors-arrival img {
  width: 100%;
  display: block;
  filter: drop-shadow(0 28px 42px rgba(0,0,0,.82));
  transition: transform 1s cubic-bezier(.16,.78,.2,1), filter .8s ease;
}

.mirrors-arrival:hover { z-index: 7; }

.mirrors-arrival:hover img {
  transform: scale(1.075);
  filter: drop-shadow(0 32px 48px rgba(0,0,0,.88));
}

.mirror-oracle {
  width: min(1080px, calc(100% - 36px));
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: clamp(10px, 1.4vw, 20px);
  margin: clamp(64px, 7vw, 112px) auto 0;
  perspective: 1600px;
}

.mirror-card {
  position: relative;
  aspect-ratio: 2 / 3;
  min-width: 0;
  padding: 0;
  border: 1px solid rgba(218,174,93,.34);
  border-radius: 6px;
  background: #050505;
  box-shadow: 0 24px 46px rgba(0,0,0,.56);
  perspective: 1200px;
}

.mirror-card-inner,
.mirror-card-face,
.mirror-card img { position: absolute; inset: 0; width: 100%; height: 100%; }
.mirror-card-inner { transform-style: preserve-3d; transition: transform .85s cubic-bezier(.2,.72,.18,1); }
.mirror-card-face { overflow: hidden; backface-visibility: hidden; }
.mirror-card-face img { display: block; object-fit: cover; }
.mirror-card-front { transform: rotateY(180deg); }
.mirror-card:hover .mirror-card-inner,
.mirror-card:focus-visible .mirror-card-inner,
.mirror-card.is-revealed .mirror-card-inner { transform: rotateY(180deg); }
.mirror-card:focus-visible { outline: 1px solid #79e5de; outline-offset: 5px; }

.mirrors-final-light {
  position: relative;
  z-index: 2;
  width: min(1220px, 94vw);
  margin: clamp(76px, 9vw, 150px) auto 0;
  overflow: visible;
  background: transparent;
  border: 0;
  border-radius: 0;
  box-shadow: none;
}

.mirrors-final-light video {
  width: 100%;
  aspect-ratio: 16 / 9;
  display: block;
  object-fit: contain;
  background: transparent;
}

@media (max-width: 760px) {
  .gaiamath-works-head { align-items: start; flex-direction: column; }
  .gaiamath-works-head h2 { text-align: left; }
  .gaiamath-works-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .gaiamath-work figcaption { opacity: 1; transform: none; padding: 34px 10px 9px; }
  .gaiamath-work figcaption span { display: none; }
  .mirror-oracle { gap: 7px; width: calc(100% - 18px); }
  .gaiamath-works-viewer-close { top: -13px; right: -6px; }
  .gaiamath-works-viewer-caption { align-items: start; flex-direction: column; gap: 5px; }
}

@media (max-width: 440px) {
  .gaiamath-works-grid { grid-template-columns: 1fr; }
  .film-section .section-title { font-size: clamp(2rem, 10vw, 3rem); }
}

@media (prefers-reduced-motion: reduce) {
  .gaiamath-work::before,
  .gaiamath-work::after,
  .gaiamath-work:hover video,
  .gaiamath-work:focus-within video {
    animation: none;
  }
  .mirrors-arrival { opacity: 1; transform: none; transition: none; }
  .mirror-card-inner { transition-duration: .01ms; }
  .gaiamath-works-head h2 { animation: none; }
}
