/* ─────────────────────────────────────────
   story.css — Espécies, Processo, Aviso legal,
   Tabs dos modais, efeitos 3D e partículas
   Fazenda dos Pinheiros
───────────────────────────────────────── */

/* ── Pollen particle canvas ── */
#pollen-canvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  pointer-events: none;
}

/* Content sits above the canvas */
header,
section,
.trust-bar,
.manifesto,
.sep,
.legal-strip,
footer {
  position: relative;
  z-index: 1;
}

/* ── Hero: staggered headline reveal ── */
.h1-line {
  display: block;
  opacity: 0;
  transform: translateY(0.5em);
  animation: h1-rise 0.9s var(--ease-out) forwards;
}
.h1-line:nth-child(1) {
  animation-delay: 0.15s;
}
.h1-line:nth-child(2) {
  animation-delay: 0.32s;
}
.h1-line:nth-child(3) {
  animation-delay: 0.49s;
}

@keyframes h1-rise {
  to {
    opacity: 1;
    transform: none;
  }
}

/* Slow breathe on hero image */
.hero-img-frame img {
  animation: hero-breathe 18s ease-in-out infinite alternate;
}
@keyframes hero-breathe {
  from {
    transform: scale(1);
  }
  to {
    transform: scale(1.06);
  }
}

/* ── Scroll cue ── */
.scroll-cue {
  position: absolute;
  bottom: 26px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  opacity: 0.55;
}

.scroll-cue-line {
  width: 1px;
  height: 44px;
  background: linear-gradient(180deg, transparent, var(--amber));
  animation: cue-drop 2.4s var(--ease-out) infinite;
  transform-origin: top;
}

@keyframes cue-drop {
  0% {
    transform: scaleY(0);
    opacity: 0;
  }
  35% {
    transform: scaleY(1);
    opacity: 1;
  }
  100% {
    transform: scaleY(1);
    opacity: 0;
  }
}

.scroll-cue-label {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--text-faint);
}

/* ── 3D tilt (JS sets --rx / --ry / --mx / --my) ──
   Transform only applies while .tilting, at two-class
   specificity, so it wins over .reveal.in's transform:none
   and the scroll-reveal slide-up stays intact. */
.tilt {
  transform-style: preserve-3d;
  will-change: transform;
}

.tilt.tilting {
  transform: perspective(900px) rotateX(var(--rx, 0deg))
    rotateY(var(--ry, 0deg));
  transition:
    transform 0.06s linear,
    background var(--duration) var(--ease-out),
    border-color var(--duration) var(--ease-out);
}

/* Specular sheen following the cursor
   (.hero-visual excluded — its ::after is the gold corner accent) */
.tilt:not(.hero-visual)::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 3;
  pointer-events: none;
  border-radius: inherit;
  background: radial-gradient(
    420px circle at var(--mx, 50%) var(--my, 50%),
    rgba(245, 238, 220, 0.09) 0%,
    transparent 60%
  );
  opacity: 0;
  transition: opacity 0.35s ease;
}

.tilt.tilting:not(.hero-visual)::after {
  opacity: 1;
}

/* ── Species grid ── */
.species-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 20px;
}

.species-card {
  position: relative;
  background: var(--surface-card);
  border: 1px solid var(--border-white);
  border-radius: var(--radius-md);
  padding: 32px 28px 30px;
  overflow: hidden;
  backdrop-filter: blur(12px);
  transition:
    background var(--duration) var(--ease-out),
    border-color var(--duration) var(--ease-out);
}

.species-card[data-modal] {
  cursor: pointer;
}

.species-card:hover,
.species-card:focus-visible {
  background: var(--surface-card-hover);
  border-color: var(--border-gold-mid);
}

.species-card:focus-visible {
  outline: 2px solid var(--amber);
  outline-offset: 3px;
}

/* "Ver história" hint */
.species-more {
  margin-top: 18px;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--gold);
  opacity: 0.65;
  transition:
    opacity var(--duration) ease,
    color var(--duration) ease;
}

.species-card:hover .species-more,
.species-card:focus-visible .species-more {
  opacity: 1;
  color: var(--amber);
}

.species-art {
  position: absolute;
  top: -12px;
  right: -16px;
  width: 130px;
  height: 130px;
  opacity: 0.5;
  transition:
    opacity var(--duration) ease,
    transform 0.6s var(--ease-out);
}

.species-card:hover .species-art {
  opacity: 0.9;
  transform: rotate(-6deg) scale(1.06);
}

/* Draw-on-scroll pine sprigs */
.pine-sprig path {
  stroke-dasharray: 140;
  stroke-dashoffset: 140;
}

.reveal.in .pine-sprig path {
  animation: sprig-draw 1.4s var(--ease-out) forwards;
}

.reveal.in .pine-sprig path:nth-child(2) {
  animation-delay: 0.3s;
}
.reveal.in .pine-sprig path:nth-child(3) {
  animation-delay: 0.4s;
}
.reveal.in .pine-sprig path:nth-child(4) {
  animation-delay: 0.5s;
}
.reveal.in .pine-sprig path:nth-child(5) {
  animation-delay: 0.6s;
}
.reveal.in .pine-sprig path:nth-child(6) {
  animation-delay: 0.7s;
}
.reveal.in .pine-sprig path:nth-child(7) {
  animation-delay: 0.8s;
}
.reveal.in .pine-sprig path:nth-child(8) {
  animation-delay: 0.9s;
}
.reveal.in .pine-sprig path:nth-child(9) {
  animation-delay: 1s;
}

@keyframes sprig-draw {
  to {
    stroke-dashoffset: 0;
  }
}

.species-index {
  font-family: var(--font-display);
  font-size: 2.6rem;
  font-style: italic;
  color: var(--border-gold-mid);
  line-height: 1;
  margin-bottom: 18px;
}

.species-name {
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 700;
  line-height: 1.15;
  margin-bottom: 4px;
}

.species-name em {
  font-style: italic;
  color: var(--lavender);
}

.species-origin {
  font-family: var(--font-mono);
  font-size: 0.74rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--amber);
  margin-bottom: 14px;
}

.species-desc {
  font-size: 0.95rem;
  line-height: 1.75;
  color: var(--text-muted);
}

/* ── Journey (Da floresta ao frasco) ── */
/* Ambient light shafts behind the process timeline */
.journey {
  position: relative;
}

.journey::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(
      ellipse 55% 38% at 18% 18%,
      rgba(160, 100, 240, 0.13),
      transparent 70%
    ),
    radial-gradient(
      ellipse 48% 34% at 85% 72%,
      rgba(232, 192, 74, 0.1),
      transparent 70%
    );
}

.journey .section-inner {
  position: relative;
}

.journey-track {
  position: relative;
  max-width: 760px;
  margin: 0 auto;
  padding-left: 40px;
  display: flex;
  flex-direction: column;
  gap: 64px;
  counter-reset: etapa;
}

.journey-line {
  position: absolute;
  left: 27px;
  top: 8px;
  bottom: 8px;
  width: 2px;
  background: rgba(245, 238, 220, 0.16);
  border-radius: 2px;
}

.journey-line-fill {
  width: 100%;
  height: calc(var(--journey-progress, 0) * 100%);
  background: linear-gradient(
    180deg,
    var(--amber),
    var(--gold),
    var(--lavender-dim)
  );
  box-shadow: 0 0 14px rgba(232, 192, 74, 0.55);
  border-radius: 2px;
  transition: height 0.15s linear;
}

.journey-step {
  display: grid;
  grid-template-columns: 72px 1fr 224px;
  gap: 28px;
  align-items: center;
  position: relative;
  counter-increment: etapa;
}

/* Step photograph */
.journey-photo {
  margin: 0;
  border-radius: var(--radius-md) var(--radius-md) 28px var(--radius-md);
  overflow: hidden;
  aspect-ratio: 4 / 3;
  box-shadow:
    0 0 0 1px rgba(200, 152, 42, 0.35),
    0 18px 44px rgba(0, 0, 0, 0.5);
  position: relative;
  z-index: 1;
}

.journey-photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  filter: saturate(0.92) contrast(1.02);
  transition:
    transform 0.65s var(--ease-out),
    filter 0.5s ease;
}

.journey-photo::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(
    160deg,
    transparent 55%,
    rgba(15, 12, 28, 0.35) 100%
  );
  pointer-events: none;
}

.journey-step:hover .journey-photo img {
  transform: scale(1.06);
  filter: saturate(1.05);
}

@media (max-width: 900px) {
  .journey-step {
    grid-template-columns: 72px 1fr;
    align-items: start;
  }
  .journey-photo {
    grid-column: 2;
    max-width: 420px;
  }
}

/* Ghosted display numeral behind each step */
.journey-step::after {
  content: "0" counter(etapa);
  position: absolute;
  top: -26px;
  right: 0;
  font-family: var(--font-display);
  font-size: clamp(4rem, 8vw, 6.5rem);
  font-weight: 900;
  line-height: 1;
  background: linear-gradient(
    180deg,
    rgba(232, 192, 74, 0.2),
    rgba(160, 100, 240, 0.06)
  );
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  pointer-events: none;
  z-index: 0;
}

.journey-body {
  position: relative;
  z-index: 1;
}

.journey-marker {
  width: 72px;
  height: 72px;
  margin-left: -40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  background:
    radial-gradient(
      circle at 30% 25%,
      rgba(232, 192, 74, 0.2),
      transparent 62%
    ),
    var(--ink-mid);
  border: 1px solid var(--border-gold-strong);
  color: var(--amber);
  box-shadow:
    0 0 0 6px rgba(19, 14, 31, 0.9),
    0 0 34px rgba(200, 152, 42, 0.3),
    inset 0 0 16px rgba(232, 192, 74, 0.14);
  transition:
    box-shadow var(--duration) ease,
    color var(--duration) ease,
    transform var(--duration) var(--ease-out);
}

/* Gold→lavender gradient ring around each medallion */
.journey-marker::after {
  content: "";
  position: absolute;
  inset: -5px;
  border-radius: 50%;
  background: conic-gradient(
    from 210deg,
    var(--amber),
    var(--gold),
    var(--lavender-dim),
    transparent 70%
  );
  -webkit-mask: radial-gradient(
    farthest-side,
    transparent calc(100% - 7px),
    #000 calc(100% - 6px)
  );
  mask: radial-gradient(
    farthest-side,
    transparent calc(100% - 7px),
    #000 calc(100% - 6px)
  );
  opacity: 0.6;
  transition: opacity var(--duration) ease;
}

/* Soft halo behind the medallion */
.journey-marker::before {
  content: "";
  position: absolute;
  inset: -26px;
  border-radius: 50%;
  background: radial-gradient(
    circle,
    rgba(232, 192, 74, 0.16),
    transparent 70%
  );
  pointer-events: none;
  transition: opacity var(--duration) ease;
}

.journey-step:hover .journey-marker {
  color: var(--lavender);
  transform: scale(1.06);
  box-shadow:
    0 0 0 6px rgba(19, 14, 31, 0.9),
    0 0 48px rgba(160, 100, 240, 0.4),
    inset 0 0 16px rgba(160, 100, 240, 0.18);
}

.journey-step:hover .journey-marker::after {
  opacity: 1;
}

.journey-step:hover .journey-marker::before {
  background: radial-gradient(
    circle,
    rgba(160, 100, 240, 0.22),
    transparent 70%
  );
}

.journey-marker svg {
  width: 34px;
  height: 34px;
  position: relative;
}

.journey-num {
  font-family: var(--font-mono);
  font-size: 0.74rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--amber);
  margin-bottom: 8px;
}

.journey-body h3 {
  font-family: var(--font-display);
  font-size: 1.7rem;
  font-weight: 700;
  margin-bottom: 10px;
}

.journey-body p {
  color: var(--text-muted);
  line-height: 1.8;
  max-width: 520px;
}

/* ── Legal strip ── */
.legal-strip {
  border-top: 1px solid var(--border-white);
  background: rgba(20, 12, 38, 0.55);
  padding: 52px var(--space-md);
}

.legal-inner {
  max-width: 820px;
  margin: auto;
  text-align: center;
}

.legal-title {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--amber);
  margin-bottom: 16px;
}

.legal-text {
  font-size: 0.92rem;
  line-height: 1.9;
  color: var(--text-muted);
}

/* ── Modal tabs ── */
.modal-tabs {
  display: flex;
  gap: 4px;
  padding: 14px 20px 0;
  border-bottom: 1px solid var(--border-gold);
}

.modal-tab {
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--text-faint);
  font-family: var(--font-mono);
  font-size: 0.78rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  padding: 10px 14px;
  cursor: pointer;
  transition:
    color var(--duration) ease,
    border-color var(--duration) ease;
}

.modal-tab:hover {
  color: var(--text-secondary);
}

.modal-tab.active {
  color: var(--amber);
  border-bottom-color: var(--gold);
}

.modal-pane {
  display: none;
}

.modal-pane.active {
  display: block;
  animation: pane-in 0.35s var(--ease-out);
}

@keyframes pane-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.modal-pane p + p {
  margin-top: 14px;
}

.modal-disclaimer {
  margin-top: 24px;
  padding-top: 18px;
  border-top: 1px solid var(--border-white);
  font-size: 0.78rem;
  line-height: 1.7;
  color: var(--text-faint);
}

/* ── Nutrient chips ── */
.nutri-group + .nutri-group {
  margin-top: 22px;
}

.nutri-label {
  font-family: var(--font-mono);
  font-size: 0.74rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--lavender);
  margin-bottom: 10px;
}

.nutri-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chip {
  padding: 6px 14px;
  border: 1px solid var(--border-gold);
  border-radius: var(--radius-pill);
  background: rgba(200, 152, 42, 0.07);
  font-size: 0.84rem;
  color: var(--text-secondary);
  transition:
    border-color var(--duration) ease,
    background var(--duration) ease;
}

.chip:hover {
  border-color: var(--border-gold-strong);
  background: rgba(200, 152, 42, 0.16);
}

.modal-pane.active .chip {
  animation: chip-pop 0.45s var(--ease-out) backwards;
}

.modal-pane.active .chip:nth-child(2n) {
  animation-delay: 0.05s;
}
.modal-pane.active .chip:nth-child(3n) {
  animation-delay: 0.1s;
}
.modal-pane.active .chip:nth-child(5n) {
  animation-delay: 0.15s;
}

@keyframes chip-pop {
  from {
    opacity: 0;
    transform: scale(0.85);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

/* ── Reduced motion ── */
@media (prefers-reduced-motion: reduce) {
  .h1-line,
  .reveal.in .pine-sprig path,
  .modal-pane.active .chip {
    animation: none;
    opacity: 1;
    transform: none;
    stroke-dashoffset: 0;
  }
  .hero-img-frame img {
    animation: none;
  }
  .scroll-cue-line {
    animation: none;
  }
  .tilt {
    transform: none !important;
  }
  #pollen-canvas {
    display: none;
  }
}

/* ── Responsive ── */
@media (max-width: 600px) {
  .journey-track {
    padding-left: 28px;
    gap: 48px;
  }
  .journey-line {
    left: 19px;
  }
  .journey-step {
    grid-template-columns: 56px 1fr;
    gap: 20px;
  }
  .journey-marker {
    width: 56px;
    height: 56px;
    margin-left: -28px;
  }
  .journey-marker svg {
    width: 28px;
    height: 28px;
  }
  .journey-marker::before {
    inset: -18px;
  }
  .journey-step::after {
    font-size: 3.4rem;
    top: -18px;
  }
  .species-grid {
    grid-template-columns: 1fr;
  }
  .modal-tabs {
    padding: 10px 12px 0;
    overflow-x: auto;
  }
  .scroll-cue {
    display: none;
  }
}
