/* ─── PORTAL SECTION ─── */
.portal-section {
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: relative;
  z-index: 2;
  isolation: isolate;
  padding: clamp(3rem, 6vw, 5rem) clamp(4vw, 5vw, 6vw);
  overflow: hidden;
  background: var(--surface);
}

.portal-section::before { content: none; }

/* ── Change 2: Pretitle — starts blurred, reveals on .portal-revealed ── */
.portal-cta-pretitle {
  width: 100%;
  margin-bottom: clamp(0.95rem, 2.4vw, 1.65rem);
  margin-top: 0;
  text-transform: lowercase;
  position: relative;
  z-index: 3;
  opacity: 0;
  filter: blur(10px);
  transition: opacity 0.4s ease, filter 0.4s ease;
}

.portal-section.portal-revealed .portal-cta-pretitle {
  opacity: 0.92;
  filter: blur(0px);
}

/* ── Text wrap ── */
.portal-text-wrap {
  text-align: center;
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: min(96vw, 76rem);
  margin: 0 auto;
  padding-block: clamp(1.5rem, 3vw, 2.5rem);
  padding-inline: clamp(1rem, 3vw, 2rem);
}

/* ── Cursor hints layer — covers the full section ── */
.portal-cursor-hints {
  pointer-events: none;
  position: absolute;
  inset: 0;
  z-index: 0;
  overflow: hidden;
}

/* ── Change 1: Hands — start hidden, opacity fades in when .portal-revealed fires ── */
.portal-dither-pointer {
  position: absolute;
  left: 0;
  top: 0;
  opacity: 0;
  filter:
    drop-shadow(0 0 1px rgba(26, 20, 8, 0.4))
    drop-shadow(0 1px 4px rgba(26, 20, 8, 0.12));
  /* Staggered by --i; JS handles the transform entrance, CSS handles opacity */
  transition: opacity 0.5s ease calc(var(--i, 0) * 80ms + 100ms);
}

.portal-section.portal-revealed .portal-dither-pointer {
  opacity: 0.78;
}

/* Idle float lives on the img so it never conflicts with JS rotation on the span */
.portal-dither-img {
  display: block;
  width: clamp(2rem, 4vw, 2.6rem);
  height: auto;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  mix-blend-mode: screen;
  animation: portal-hand-idle calc(3.5s + var(--i, 0) * 0.5s) ease-in-out infinite alternate;
  animation-delay: calc(var(--i, 0) * -0.82s);
}

@keyframes portal-hand-idle {
  from { transform: translateY(0); }
  to   { transform: translateY(-7px); }
}

/* ── Headline — blur reveal (holo vars inherited by .portal-accent-text only) ── */
.portal-text.portal-cta-hit {
  font-family: 'Syne', sans-serif;
  font-size: clamp(2rem, 8.5vw, 6.25rem);
  font-weight: 800;
  letter-spacing: -0.052em;
  line-height: 0.96;
  color: var(--text);
  cursor: pointer;
  display: block;
  width: 100%;
  max-width: 100%;
  margin: 0 auto;
  position: relative;
  z-index: 2;
  overflow-wrap: break-word;
  word-break: normal;
  user-select: none;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.7s ease 0.2s, transform 0.7s cubic-bezier(0.16, 1, 0.3, 1) 0.2s;
}

.portal-section.portal-revealed .portal-text.portal-cta-hit {
  opacity: 1;
  transform: translateY(0);
}

/* ── Static spotlight ── */
.portal-hit-shine {
  position: absolute;
  inset: -16% -6%;
  border-radius: 50%;
  pointer-events: none;
  z-index: 0;
  opacity: 0.36;
  mix-blend-mode: soft-light;
  background:
    radial-gradient(
      ellipse 108% 90% at 50% 50%,
      rgba(255, 253, 247, 0.94) 0%,
      rgba(221, 240, 229, 0.18) 40%,
      transparent 62%
    );
}

/* ── Accent word: iridescent foil + CSS sweep (no color-mix — fails silently in some browsers) ── */
.portal-accent-text {
  display: inline-block;
  vertical-align: baseline;
  -webkit-box-decoration-break: clone;
  box-decoration-break: clone;
  font-weight: 800;
  color: transparent;
  -webkit-text-fill-color: transparent;
  background-image: linear-gradient(
    102deg,
    var(--accent) 0%,
    #2d8550 12%,
    #4a9d7a 26%,
    #6a9ec4 40%,
    #a898d4 52%,
    #4a9d7a 66%,
    #2d8550 82%,
    var(--accent) 100%
  );
  background-size: 240% 240%;
  background-position: 0% 50%;
  background-repeat: no-repeat;
  -webkit-background-clip: text;
  background-clip: text;
  animation: portal-accent-shimmer 8s ease-in-out infinite;
  will-change: background-position;
}

@keyframes portal-accent-shimmer {
  0%, 100% { background-position: 8% 42%; }
  25%      { background-position: 42% 58%; }
  50%      { background-position: 78% 48%; }
  75%      { background-position: 48% 62%; }
}

.portal-text.portal-cta-hit::selection {
  background: rgba(31, 107, 60, 0.2);
  color: var(--text);
}

.portal-accent-text::selection {
  background: rgba(31, 107, 60, 0.26);
  -webkit-text-fill-color: var(--accent);
  color: var(--accent);
}

.portal-cta-hit:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 8px;
  border-radius: 2px;
}

/* ── Coarse pointer ── */
@media (hover: none), (pointer: coarse) {
  .portal-section.portal-revealed .portal-dither-pointer { opacity: 0.82; }
  /* Idle float competes with RAF transforms on iOS — disable for smoother frames */
  .portal-dither-img {
    animation: none !important;
  }
}

/* ── Reduced motion: skip blur/slide, show instantly ── */
@media (prefers-reduced-motion: reduce) {
  .portal-cta-pretitle,
  .portal-text.portal-cta-hit,
  .portal-dither-pointer {
    transition: none !important;
    animation: none !important;
    filter: none !important;
  }
  .portal-dither-img { animation: none !important; }
  .portal-text.portal-cta-hit {
    transform: none !important;
    will-change: auto;
  }
  .portal-accent-text {
    background: none !important;
    animation: none !important;
    -webkit-text-fill-color: var(--accent) !important;
    color: var(--accent) !important;
    will-change: auto;
  }
}

/* ── Mobile — hide cursor hands, compact layout ── */
@media (max-width: 768px) {
  .portal-section {
    padding: clamp(2.5rem, 8vw, 4rem) 5vw;
  }
  .portal-cursor-hints {
    display: none;
  }
  .portal-text-wrap {
    max-width: 100%;
    padding-inline: 0;
  }
  .portal-cta-pretitle { margin-bottom: 0.75rem; }
  .portal-text.portal-cta-hit {
    font-size: clamp(2rem, 12.5vw, 4.4rem);
    line-height: 1.02;
  }
  .portal-accent-text { white-space: normal; }
}
