/* Portillo Technologies — machine.css
   Layout + choreography styles for the "Into the Machine" journey.
   The 3D canvas is fixed behind everything; acts are tall scroll sections
   whose sticky pins carry the copy. body.no3d = static fallback. */

/* the copy scrims bleed past their blocks by design — never let that
   become a horizontal scrollbar (clip, not hidden: keeps sticky working) */
html, body { overflow-x: clip; }

/* ---------- canvas + grain ---------- */
#machine-canvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  display: block;
}

.grain {
  position: fixed;
  inset: 0;
  z-index: 3;
  pointer-events: none;
  opacity: 0.05;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2'/%3E%3C/filter%3E%3Crect width='160' height='160' filter='url(%23n)' opacity='0.6'/%3E%3C/svg%3E");
  background-size: 160px 160px;
}

/* ---------- journey structure ---------- */
#journey { position: relative; z-index: 1; }

.act { position: relative; }
.act-hero      { height: 210vh; }
.act-dive      { height: 170vh; }
.act-substrate { height: 240vh; }
.act-systems   { height: 260vh; }
.act-finale    { height: 250vh; }

.act-pin {
  position: sticky;
  top: 0;
  height: 100vh;
  height: 100dvh;
  display: flex;
  align-items: center;
  will-change: transform, opacity;
}
.act-pin--empty { pointer-events: none; }

.act-inner { width: 100%; }
.act-inner--left  { max-width: 620px; margin-left: 0; margin-right: auto; }
.act-inner--right { max-width: 620px; margin-left: auto; margin-right: 0; }
.act-systems .act-inner--right { max-width: 740px; }
.act-inner--center { max-width: 680px; margin-inline: auto; text-align: center; }

/* finale: copy at the top, the PORTILLO / TECHNOLOGIES explosion owns the
   center, the invite + CTA rest at the base */
.act-finale .act-pin {
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  padding: 7vh 0 8vh;
}
.act-finale .act-inner--center { margin-top: 0; flex: 0 0 auto; }

.finale-close { position: relative; text-align: center; flex: 0 0 auto; }
.finale-close::before {
  content: "";
  position: absolute;
  inset: -6% -32% -55% -32%;
  z-index: -1;
  background: radial-gradient(100% 92% at 50% 74%, rgba(4, 5, 5, 0.9) 0%, rgba(4, 5, 5, 0.7) 52%, rgba(4, 5, 5, 0.28) 78%, transparent 100%);
}
.finale-invite {
  font-family: var(--font-display, "Soehne Dreiviertelfett", sans-serif);
  font-weight: 700;
  font-size: clamp(1.5rem, 3.4vw, 2.5rem);
  letter-spacing: -0.02em;
  line-height: 1.05;
  color: var(--bone, #ecece8);
  margin: 0 0 1.5rem;
}

/* soft scrim so copy stays readable over bright circuitry */
.act-inner--left, .act-inner--right, .act-inner--center {
  position: relative;
  padding: 2.5rem 2.75rem;
  border-radius: 1.5rem;
}
.act-inner--left::before, .act-inner--right::before, .act-inner--center::before {
  content: "";
  position: absolute;
  inset: -16% -20%;
  z-index: -1;
  background: radial-gradient(100% 96% at 50% 50%, rgba(4, 5, 5, 0.96) 0%, rgba(4, 5, 5, 0.88) 55%, rgba(4, 5, 5, 0.45) 80%, transparent 100%);
  border-radius: 2rem;
}

/* ---------- act copy ---------- */
.eyebrow-bare {
  font-family: var(--font-mono, monospace);
  font-size: 0.68rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--green-bright, #3ee08c);
  margin: 0 0 1.1rem;
}

.act h2 {
  font-size: clamp(1.9rem, 4.6vw, 3.4rem);
  color: var(--bone, #ecece8);
  margin-bottom: 1.2rem;
}

.act-body {
  color: rgba(250, 250, 248, 0.94);
  font-size: clamp(1rem, 1.35vw, 1.14rem);
  line-height: 1.65;
  max-width: 54ch;
  margin: 0;
}
.act-body--center { margin-inline: auto; }

.sys-list {
  list-style: none;
  margin: 1.8rem 0 0;
  padding: 0;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem 2.2rem;
}
.sys-list li { border-left: 1px solid rgba(62, 224, 140, 0.35); padding-left: 1.25rem; }
.sys-list .idx {
  font-family: var(--font-mono, monospace);
  font-size: 0.66rem;
  letter-spacing: 0.16em;
  color: rgba(62, 224, 140, 0.8);
}
.sys-list h3 { font-size: 1.18rem; color: var(--bone, #ecece8); margin: 0.35rem 0 0.4rem; }
.sys-list p { margin: 0; color: rgba(250, 250, 248, 0.88); font-size: 0.98rem; line-height: 1.55; }

.hero-cta--center { justify-content: center; }

/* ---------- scroll cue ---------- */
.scroll-cue {
  margin-top: 3.2rem;
  font-family: var(--font-mono, monospace);
  font-size: 0.7rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: rgba(236, 236, 232, 0.5);
  display: flex;
  align-items: center;
  gap: 0.9rem;
}
.cue-line {
  display: inline-block;
  width: 42px;
  height: 1px;
  background: linear-gradient(90deg, #3ee08c, transparent);
  animation: cue-sweep 2.4s cubic-bezier(0.32, 0.72, 0, 1) infinite;
  transform-origin: left center;
}
@keyframes cue-sweep {
  0% { transform: scaleX(0.2); opacity: 0.4; }
  55% { transform: scaleX(1); opacity: 1; }
  100% { transform: scaleX(0.2); opacity: 0.4; }
}

/* ---------- static fallback (reduced motion / no WebGL2) ---------- */
body.no3d #machine-canvas { display: none; }
body.no3d .grain { opacity: 0.035; }
body.no3d .act { height: auto; }
body.no3d .act-dive { display: none; }
body.no3d .act-pin {
  position: static;
  height: auto;
  min-height: 0;
  padding: clamp(4rem, 12vh, 8rem) 0;
  opacity: 1 !important;
  transform: none !important;
}
body.no3d .act-hero .act-pin { min-height: 88vh; display: flex; align-items: center; }
body.no3d .act-hero {
  background: radial-gradient(120% 100% at 30% 20%, #0c2a20 0%, #08090a 55%);
}
body.no3d .act-inner--left::before,
body.no3d .act-inner--right::before,
body.no3d .act-inner--center::before,
body.no3d .finale-close::before { display: none; }
body.no3d .act-finale .act-pin { gap: 2.5rem; }

/* ---------- mobile ---------- */
@media (max-width: 768px) {
  .act-hero      { height: 180vh; }
  .act-dive      { height: 130vh; }
  .act-substrate { height: 200vh; }
  .act-systems   { height: 220vh; }
  .act-finale    { height: 210vh; }

  .act-inner--left, .act-inner--right, .act-inner--center {
    max-width: 100%;
    padding: 1.6rem 1.3rem;
    margin-inline: 0;
    text-align: left;
  }
  .act-inner--center { text-align: left; }
  .act-systems .act-inner--right { max-width: 100%; }
  .sys-list { grid-template-columns: 1fr; gap: 1.25rem; }
  .hero-cta--center { justify-content: flex-start; }
  /* the finale close stays centered on the wordmark even on mobile */
  .finale-close { text-align: center; }
  .finale-close .hero-cta--center { justify-content: center; }
  .scroll-cue { margin-top: 2.2rem; }
}
