/* ============================================================
   HERO — SCROLL MOTION NOVEL
   Canvas WebGL fixo (sticky) + cartelas tipográficas em DOM.
   O scroll é a linha do tempo: 6 atos, uma única cena 3D.
   ============================================================ */

/* ---- 1. Trilho e palco ------------------------------------------- */
/* O sticky do palco exige que NENHUM ancestral seja contexto de rolagem:
   .hero herda overflow:hidden de styles.css — aqui ele é neutralizado. */
body { overflow-x: clip; }
/* O scroll nativo suave do styles.css briga com o Lenis e produz
   engasgo — quando o Lenis assume, ele é desligado. */
html.lenis { scroll-behavior: auto; }
html.lenis body { scroll-behavior: auto; }

.hero.novel {
  position: relative;
  overflow: visible;
  padding: 0;
  min-height: auto;
  background: var(--bone);
  color: var(--ink);
}
.novel-track { height: 440svh; position: relative; }
.novel-stage {
  position: sticky; top: 0;
  height: 100svh;
  overflow: hidden;
  isolation: isolate;
  background:
    radial-gradient(80% 68% at 76% 20%, color-mix(in oklab, var(--accent, #1B9276) 10%, transparent) 0%, transparent 66%),
    linear-gradient(168deg, var(--bone-card) 0%, var(--bone) 52%, var(--bone-deep) 100%);
}
.novel-canvas {
  position: absolute; inset: 0; z-index: 0;
  width: 100%; height: 100%; display: block;
  transform: translateZ(0);
}
/* Grade editorial sobre o WebGL: garante leitura da tipografia */
.novel-grade {
  position: absolute; inset: 0; z-index: 1; pointer-events: none;
  background:
    linear-gradient(to right, rgba(247,244,239,.95) 0%, rgba(247,244,239,.86) 34%, rgba(247,244,239,.24) 66%, rgba(247,244,239,0) 100%),
    linear-gradient(to bottom, rgba(247,244,239,.7) 0%, rgba(247,244,239,0) 22%, rgba(247,244,239,0) 60%, rgba(247,244,239,.72) 100%);
}
.novel-grade::after {
  content: ""; position: absolute; inset: 0;
  opacity: .045; mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml;base64,PHN2ZyB4bWxucz0naHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmcnIHdpZHRoPScxNDAnIGhlaWdodD0nMTQwJz48ZmlsdGVyIGlkPSdnQyc+PGZlVHVyYnVsZW5jZSB0eXBlPSdmcmFjdGFsTm9pc2UnIGJhc2VGcmVxdWVuY3k9Jy44NScgbnVtT2N0YXZlcz0nMycgc3RpdGNoVGlsZXM9J3N0aXRjaCcvPjxmZUNvbG9yTWF0cml4IHR5cGU9J3NhdHVyYXRlJyB2YWx1ZXM9JzAnLz48L2ZpbHRlcj48cmVjdCB3aWR0aD0nMTQwJyBoZWlnaHQ9JzE0MCcgZmlsdGVyPSd1cmwoI2dDKScvPjwvc3ZnPg==");
  background-size: 180px 180px;
}

/* ---- 2. Atos ----------------------------------------------------- */
.novel-acts { position: absolute; inset: 0; z-index: 2; }
.act {
  position: absolute;
  backface-visibility: hidden;
  left: var(--gutter);
  right: auto;
  top: 50%;
  transform: translateY(-50%);
  width: min(56ch, 47vw);
  will-change: opacity, transform, filter;
}
.act-num {
  position: absolute; z-index: -1;
  left: -.06em; top: -.46em;
  font-family: var(--serif); font-weight: 500;
  font-size: clamp(9rem, 30vh, 22rem); line-height: .8;
  color: var(--accent, #1B9276);
  opacity: .13; pointer-events: none; user-select: none;
}
.act-eyebrow, .act-date {
  display: flex; align-items: center; gap: .7rem;
  font-family: var(--sans); font-size: .74rem; font-weight: 700;
  letter-spacing: .2em; text-transform: uppercase;
  color: var(--ink-soft); margin: 0 0 1.4rem;
}
.act-eyebrow i, .act-date i {
  width: 30px; height: 2px; border-radius: 2px; flex: 0 0 auto;
  background: var(--accent, #1B9276);
}
.act-date { color: var(--accent, #1B9276); letter-spacing: .24em; }

.act-title {
  font-family: var(--serif); font-weight: 500;
  font-size: clamp(2.15rem, 7vh + .8vw, 5.1rem);
  line-height: .96; letter-spacing: -.025em;
  color: var(--ink);
  margin: 0 0 1.5rem;
}
.act-title .ln { display: block; }
.act-title em { font-style: italic; color: var(--accent, #1B9276); }
.act-line {
  font-size: clamp(.95rem, 1.85vh, 1.15rem); line-height: 1.5;
  color: var(--ink-soft);
  max-width: 42ch; margin: 0 0 1.7rem;
}

.act-meta {
  list-style: none; margin: 0; padding: 1.15rem 0 0;
  display: flex; flex-wrap: wrap; gap: .5rem 2.2rem;
  border-top: 1px solid var(--line);
  max-width: 46ch;
}
.act-meta li {
  font-family: var(--sans); font-size: .84rem; letter-spacing: .01em;
  color: var(--ink-soft);
  display: flex; align-items: center; gap: .6rem;
}
.act-meta li::before {
  content: ""; width: 5px; height: 5px; border-radius: 50%;
  background: var(--accent, #1B9276);
  flex: 0 0 auto;
}

.act-grid {
  list-style: none; margin: 0; padding: 1.2rem 0 0;
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: .9rem 1.6rem;
  border-top: 1px solid var(--line);
  max-width: 48ch;
}
.act-grid li {
  font-family: var(--sans); font-size: .82rem; line-height: 1.35;
  color: var(--ink-soft); display: flex; gap: .5rem;
}
.act-grid li::before {
  content: ""; width: 12px; height: 1px; margin-top: .62em; flex: 0 0 auto;
  background: var(--accent, #1B9276);
}

/* Marcador de urgência: régua vertical de acento, sem pílula.
   Discreto por construção — não compete com o título. */
.act-chip {
  display: flex; flex-direction: column; gap: .3rem;
  padding: .1rem 0 .1rem 1.05rem;
  border-left: 2px solid var(--accent, #1B9276);
  font-family: var(--sans);
}
.act-chip b {
  font-size: clamp(.9rem, 1.7vh, 1.02rem); font-weight: 700;
  letter-spacing: .01em; line-height: 1.15;
  color: var(--accent, #1B9276);
}
.act-chip s {
  text-decoration: none;
  font-size: .74rem; font-weight: 600; letter-spacing: .16em;
  text-transform: uppercase; color: var(--ink-soft); line-height: 1.2;
}

.act-actions { display: flex; flex-wrap: wrap; gap: .8rem 1rem; align-items: center; }
.act-addr {
  font-family: var(--sans); font-size: .84rem; color: var(--ink-soft);
  margin: 1.3rem 0 0; letter-spacing: .02em;
}

/* Botão magnético */
.btn-mag {
  position: relative;
  display: inline-flex; align-items: center; gap: .7rem;
  font-family: var(--sans); font-size: .95rem; font-weight: 600; letter-spacing: .01em;
  color: #F2EEE6; text-decoration: none;
  padding: .95rem 1.7rem; border-radius: 999px;
  background: var(--ink);
  isolation: isolate; overflow: hidden;
  will-change: transform;
}
.btn-mag > span, .btn-mag > svg, .btn-mag > b { position: relative; z-index: 2; }
.btn-mag::before {
  content: ""; position: absolute; inset: -40%; z-index: 1;
  border-radius: 50%;
  background: var(--accent, #1B9276);
  transform: scale(0); transform-origin: center;
  transition: transform .6s cubic-bezier(.22,1,.36,1);
}
.btn-mag:hover::before { transform: scale(1); }
.btn-mag:hover { color: #FFFFFF; }
.btn-mag b { font-weight: 600; }

/* ---- 3. Trilha de navegação e affordance ------------------------- */
.novel-rail {
  position: absolute; z-index: 4; right: calc(var(--gutter) - .6rem); top: 50%;
  transform: translateY(-50%);
  display: flex; flex-direction: column; gap: .15rem;
}
.novel-rail button {
  width: 46px; height: 34px; display: grid; place-items: center;
  background: none; border: 0; padding: 0; cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.novel-rail button i {
  display: block; width: 13px; height: 2px; border-radius: 2px;
  background: rgba(22,32,43,.28);
  transition: width .35s cubic-bezier(.22,1,.36,1), background .35s ease;
}
.novel-rail button:hover i { width: 20px; background: rgba(22,32,43,.7); }
.novel-rail button[aria-current="true"] i { width: 28px; background: var(--accent, #1B9276); }
.novel-rail button:focus-visible { outline: 2px solid var(--ink); outline-offset: -6px; border-radius: 6px; }

.novel-hint {
  position: absolute; z-index: 4; left: var(--gutter); bottom: clamp(1.6rem, 4vh, 2.6rem);
  display: flex; align-items: center; gap: .7rem;
  font-family: var(--sans); font-size: .7rem; font-weight: 600;
  letter-spacing: .22em; text-transform: uppercase; color: var(--ink-soft);
}
.novel-hint i {
  display: block; width: 46px; height: 1px;
  background: linear-gradient(to right, var(--accent, #1B9276), transparent);
  animation: hintPull 2.6s ease-in-out infinite;
}
@keyframes hintPull { 0%,100% { transform: scaleX(.4); transform-origin: left; } 50% { transform: scaleX(1); transform-origin: left; } }

.novel-progress {
  position: absolute; z-index: 4; left: 0; right: 0; bottom: 0; height: 2px;
  background: rgba(22,32,43,.08);
}
.novel-progress i {
  display: block; height: 100%; width: 100%;
  transform: scaleX(0); transform-origin: left center;
  background: var(--accent, #1B9276);
  will-change: transform;
}

/* ---- 5. Estado inicial sem JS ------------------------------------ */
.act { opacity: 0; }
@media (max-width: 900px) { .act.is-first { top: 17vh; } }
.act.is-first { opacity: 1; }
html.no-motion .act, html.novel-static .act {
  position: relative; opacity: 1; transform: none;
  top: auto; left: auto; margin: 0 auto;
}
html.novel-static .novel-track { height: auto; }
html.novel-static .novel-stage { position: relative; height: auto; padding: 22vh 0 12vh; }
html.novel-static .novel-acts { position: relative; inset: auto; display: grid; gap: 14vh; padding: 0 var(--gutter); }
html.novel-static .novel-canvas, html.novel-static .novel-hint { display: none; }

/* ---- 6. Mobile --------------------------------------------------- */
@media (max-width: 900px) {
  .novel-track { height: 430svh; }
  .act {
    left: var(--gutter); right: calc(var(--gutter) + 1.8rem);
    width: auto; top: 46%;
  }
  .act-title { font-size: clamp(1.9rem, 5.4vh + 1.6vw, 3rem); }
  .act-num { font-size: clamp(7rem, 22vh, 12rem); top: -.42em; }
  .act-grid { grid-template-columns: 1fr 1fr; }
  .act-meta { flex-direction: column; gap: .45rem; }
  .novel-grade {
    background:
      linear-gradient(to bottom, rgba(247,244,239,.94) 0%, rgba(247,244,239,.9) 46%, rgba(247,244,239,.5) 68%, rgba(247,244,239,.4) 100%);
  }
  .act { top: 15vh; transform: none; }
  .act-num { opacity: .12 !important; }
  .novel-hint { display: none; }
}
@media (max-height: 680px) {
  .act-line { display: none; }
  .act-meta { padding-top: .9rem; }
}

/* ---- 7. Movimento reduzido --------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  .novel-hint i { animation: none; }
}
