/* Animações temáticas de Jiu-Jitsu — leves, só CSS/SVG. Respeitam prefers-reduced-motion. */

/* ----- tatame pattern ----- */
.tatame-bg::before {
  content: "";
  position: absolute;
  inset: -80px;
  z-index: 0;
  pointer-events: none;
  opacity: 0.12;
  background-image: url("../assets/icons/tatame-tile.svg");
  background-size: 160px 160px;
  background-repeat: repeat;
  transform: translate3d(0, 0, 0);
}
.tatame-bg {
  overflow: hidden;
}
.section-tatame > .wrap,
.section-tatame > .technique-inner,
.section-tatame > .about-grid {
  position: relative;
  z-index: 1;
}
@media (prefers-reduced-motion: no-preference) {
  .tatame-bg::before {
    animation: tatame-drift 48s linear infinite;
  }
}
@keyframes tatame-drift {
  from { transform: translate3d(0, 0, 0); }
  to { transform: translate3d(-160px, -80px, 0); }
}

/* ----- hero entrance ----- */
@media (prefers-reduced-motion: no-preference) {
  .hero-logo-wrap {
    animation: queda-in 0.85s cubic-bezier(0.2, 0.8, 0.2, 1) both;
  }
  .faixa-wrap {
    animation: fade-up 0.6s 0.45s both;
  }
  .hero .eyebrow {
    animation: fade-up 0.55s 1.15s both;
  }
  .hero h1 {
    animation: fade-up 0.7s 1.28s both;
  }
  .hero .lead {
    animation: fade-up 0.6s 1.42s both;
  }
  .hero-actions {
    animation: fade-up 0.6s 1.55s both;
  }
  .hero-pills {
    animation: fade-up 0.5s 1.7s both;
  }
}
@keyframes queda-in {
  from {
    opacity: 0;
    transform: translate3d(-28px, 24px, 0) rotate(-6deg);
  }
  to {
    opacity: 1;
    transform: none;
  }
}
@keyframes fade-up {
  from {
    opacity: 0;
    transform: translate3d(0, 14px, 0);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

/* ----- faixa (belt) SVG ----- */
.faixa-hero {
  width: 100%;
  height: auto;
  display: block;
  overflow: visible;
}
.faixa-hero .faixa-fill { opacity: 1; }
html.js-anim .faixa-hero:not(.is-drawn) .faixa-fill { opacity: 0; }
html.js-anim .faixa-hero.is-drawn .faixa-fill {
  animation: faixa-fill-in 0.45s 0.7s ease-out both;
}
.faixa-hero .faixa-knot-core {
  transform-box: fill-box;
  transform-origin: center;
}
.faixa-hero.is-drawn .faixa-knot-core {
  animation: faixa-tie 0.5s 0.85s cubic-bezier(0.2, 0.9, 0.3, 1.15) both;
}
@keyframes faixa-fill-in {
  from { opacity: 0; }
  to { opacity: 1; }
}
@keyframes faixa-tie {
  0% { transform: scale(0.6, 1.15); opacity: 0.4; }
  60% { transform: scale(1.06, 0.94); }
  100% { transform: none; opacity: 1; }
}
.faixa-hero .draw-path {
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
  opacity: 0;
}
html.js-anim .faixa-hero .draw-path { opacity: 1; }
html.js-anim .faixa-hero.is-drawn .draw-path {
  transition: opacity 0.35s 1.05s ease-out;
  opacity: 0;
}

/* ----- belt rank path ----- */
.belt-path {
  margin-top: 2.5rem;
  padding-top: 0.5rem;
}
.belt-path-label {
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 0.85rem;
}
.belt-track {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 0.35rem;
}
.belt-seg {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.4rem;
  min-width: 0;
}
.belt-seg .bar {
  width: 100%;
  height: 0.7rem;
  border-radius: 2px;
  transform-origin: left center;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.25);
}
html.js-anim .belt-path:not(.is-visible) .belt-seg .bar { transform: scaleX(0); }
.belt-seg span {
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}
html.js-anim .belt-path:not(.is-visible) .belt-seg span { opacity: 0; }
.belt-white .bar { background: #f3f3f3; border: 1px solid rgba(255,255,255,0.4); }
.belt-azul .bar { background: #1e5aab; }
.belt-roxa .bar { background: #6b3fa0; }
.belt-marrom .bar { background: #6b3a1f; }
.belt-preta .bar { background: #141414; border: 1px solid rgba(255,255,255,0.12); }

.belt-path.is-visible .belt-seg .bar,
.belt-path.is-visible .belt-seg span {
  animation: belt-fill 0.55s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}
.belt-path.is-visible .belt-seg:nth-child(1) .bar,
.belt-path.is-visible .belt-seg:nth-child(1) span { animation-delay: 0.05s; }
.belt-path.is-visible .belt-seg:nth-child(2) .bar,
.belt-path.is-visible .belt-seg:nth-child(2) span { animation-delay: 0.22s; }
.belt-path.is-visible .belt-seg:nth-child(3) .bar,
.belt-path.is-visible .belt-seg:nth-child(3) span { animation-delay: 0.39s; }
.belt-path.is-visible .belt-seg:nth-child(4) .bar,
.belt-path.is-visible .belt-seg:nth-child(4) span { animation-delay: 0.56s; }
.belt-path.is-visible .belt-seg:nth-child(5) .bar,
.belt-path.is-visible .belt-seg:nth-child(5) span { animation-delay: 0.73s; }
.belt-path.is-visible .belt-seg span { animation-name: fade-up; }
@keyframes belt-fill {
  from { transform: scaleX(0); }
  to { transform: scaleX(1); }
}

/* ----- queda / raspagem reveals ----- */
.reveal {
  transition:
    opacity 0.7s cubic-bezier(0.2, 0.7, 0.2, 1),
    transform 0.7s cubic-bezier(0.2, 0.7, 0.2, 1);
  transform-origin: 30% 80%;
}
html.js-anim .reveal:not(.is-visible) {
  opacity: 0;
  transform: translate3d(-26px, 22px, 0) rotate(-4.5deg);
}
html.js-anim .reveal.reveal-raspagem:not(.is-visible),
html.js-anim .cards .reveal:nth-child(even):not(.is-visible),
html.js-anim .quotes .reveal:nth-child(even):not(.is-visible) {
  transform: translate3d(26px, 22px, 0) rotate(4.5deg);
  transform-origin: 70% 80%;
}
.cards .reveal:nth-child(2) { transition-delay: 0.06s; }
.cards .reveal:nth-child(3) { transition-delay: 0.12s; }
.cards .reveal:nth-child(4) { transition-delay: 0.18s; }
.cards .reveal:nth-child(5) { transition-delay: 0.24s; }
.cards .reveal:nth-child(6) { transition-delay: 0.3s; }
.quotes .reveal:nth-child(2) { transition-delay: 0.08s; }
.quotes .reveal:nth-child(3) { transition-delay: 0.16s; }

/* ----- technique silhouette band ----- */
.technique-band {
  padding: 2rem 0 1.25rem;
  background: var(--bg);
  overflow: hidden;
}
.technique-inner {
  width: min(100% - 1.5rem, 40rem);
  margin-inline: auto;
}
.silhouette {
  width: 100%;
  height: auto;
  display: block;
  color: #e8eef8;
  overflow: visible;
}
.silhouette .draw-path {
  fill: none;
  stroke: currentColor;
  stroke-width: 2.4;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.silhouette .draw-path.accent {
  stroke: var(--pink);
  stroke-width: 2.6;
}
.silhouette .draw-path.mat {
  stroke: var(--blue-bright);
  stroke-width: 1.6;
  opacity: 0.7;
}

/* ----- medal shine ----- */
.gallery-item[data-category="competicoes"]::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  background: linear-gradient(
    110deg,
    transparent 35%,
    rgba(255, 228, 170, 0.0) 42%,
    rgba(255, 236, 190, 0.42) 50%,
    rgba(255, 228, 170, 0.0) 58%,
    transparent 65%
  );
  transform: translateX(-130%);
}
.gallery-item[data-category="competicoes"].is-shining::after {
  animation: medal-shine 1.35s ease-out 0.15s both;
}
.gallery-item[data-category="competicoes"]:hover::after,
.gallery-item[data-category="competicoes"]:focus-visible::after {
  animation: medal-shine 1.15s ease-out both;
}
@keyframes medal-shine {
  from { transform: translateX(-130%); }
  to { transform: translateX(130%); }
}
.gallery-item[data-category="competicoes"] .gallery-badge {
  border-color: rgba(255, 214, 140, 0.55);
  box-shadow: 0 0 0 1px rgba(255, 200, 90, 0.15);
}
.gallery-item[data-category="competicoes"].is-shining .gallery-badge {
  animation: badge-glow 1.2s ease;
}
@keyframes badge-glow {
  0%, 100% { box-shadow: 0 0 0 1px rgba(255, 200, 90, 0.15); }
  40% { box-shadow: 0 0 14px 2px rgba(255, 214, 140, 0.55); }
}

/* ----- reduced motion: show final state, no movement ----- */
@media (prefers-reduced-motion: reduce) {
  .tatame-bg::before,
  .hero-logo-wrap,
  .faixa-wrap,
  .hero .eyebrow,
  .hero h1,
  .hero .lead,
  .hero-actions,
  .hero-pills,
  .faixa-hero.is-drawn .faixa-fill,
  .faixa-hero.is-drawn .faixa-knot-core,
  .belt-path.is-visible .belt-seg .bar,
  .belt-path.is-visible .belt-seg span,
  .gallery-item[data-category="competicoes"]::after,
  .gallery-item[data-category="competicoes"].is-shining .gallery-badge {
    animation: none !important;
  }
  .faixa-hero .faixa-fill { opacity: 1; }
  .belt-seg .bar { transform: none; }
  .belt-seg span { opacity: 1; }
  html.js-anim .reveal:not(.is-visible),
  html.js-anim .reveal.reveal-raspagem:not(.is-visible),
  html.js-anim .cards .reveal:nth-child(even):not(.is-visible),
  html.js-anim .quotes .reveal:nth-child(even):not(.is-visible) {
    opacity: 1 !important;
    transform: none !important;
  }
  .reveal { transition: none; }
  .gallery-item[data-category="competicoes"]::after { display: none; }
}

@media (max-width: 559px) {
  .belt-seg span { font-size: 0.62rem; letter-spacing: 0; }
}
