/* ===== View Transitions API ===== */
@view-transition {
  navigation: auto;
}

:root {
  --motion-standard: cubic-bezier(0.2, 0.65, 0.2, 1);
  --motion-emphasized: cubic-bezier(0.22, 1, 0.36, 1);
}

/* Keep header stable during page transitions */
::view-transition-group(site-header) {
  animation-duration: 0s;
  z-index: 9999;
}

::view-transition-old(site-header),
::view-transition-new(site-header) {
  animation: none;
}

/* Content cross-fade + subtle slide */
::view-transition-old(page-content) {
  animation: vtFadeOut 0.22s var(--motion-standard) forwards;
}

::view-transition-new(page-content) {
  animation: vtFadeIn 0.36s var(--motion-emphasized) forwards;
}

@keyframes vtFadeOut {
  to {
    opacity: 0;
    transform: translateY(-8px);
  }
}

@keyframes vtFadeIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ===== Glassmorphism Card (WCAG AA enhanced) ===== */
.glass-card {
  background: rgba(255, 255, 255, 0.82);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.4);
}

/* ===== Horizontal Scroll Indicator for Tables ===== */
.table-container {
  overflow-x: auto;
  position: relative;
  background:
    linear-gradient(to right, white 30%, rgba(255, 255, 255, 0)),
    linear-gradient(to right, rgba(255, 255, 255, 0), white 70%) 0 100%,
    radial-gradient(farthest-side at 0 50%, rgba(0, 0, 0, .2), rgba(0, 0, 0, 0)),
    radial-gradient(farthest-side at 100% 50%, rgba(0, 0, 0, .2), rgba(0, 0, 0, 0)) 0 100%;
  background-repeat: no-repeat;
  background-color: white;
  background-size: 40px 100%, 40px 100%, 14px 100%, 14px 100%;
  background-position: 0 0, 100% 0, 0 0, 100% 0;
  background-attachment: local, local, scroll, scroll;
}

/* ===== Fade Up Animation ===== */
@keyframes fadeUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.animate-fade-up {
  animation: fadeUp 0.65s var(--motion-emphasized) forwards;
}

/* Staggered Delays */
.delay-100 {
  animation-delay: 100ms;
}

.delay-200 {
  animation-delay: 200ms;
}

.delay-300 {
  animation-delay: 300ms;
}

/* ===== Scroll Reveal (Scrollytelling) ===== */
.scroll-reveal {
  opacity: 0;
  transform: translateY(24px) scale(0.985);
  transition: opacity 0.65s var(--motion-standard), transform 0.75s var(--motion-emphasized);
  will-change: opacity, transform;
}

.scroll-reveal.is-visible {
  opacity: 1;
  transform: translateY(0) scale(1);
}

.filter-item {
  will-change: transform, box-shadow;
}

/* ===== Bento Card Hover Overlay ===== */
.bento-overlay {
  position: absolute;
  inset: 0;
  background: transparent;
  transition: background 0.5s ease-out;
  pointer-events: none;
  z-index: 1;
}

.group:hover .bento-overlay {
  background: rgba(0, 0, 0, 0.15);
}

/* ===== Home Story Card ===== */
.story-feature-card {
  isolation: isolate;
  border: 1px solid rgba(255, 255, 255, 0.22);
  background: #0b1728;
  cursor: pointer;
  box-shadow:
    0 16px 32px -18px rgba(2, 12, 26, 0.8),
    inset 0 1px 0 rgba(255, 255, 255, 0.12);
}

.story-feature-card::before {
  content: "";
  position: absolute;
  inset: 10px;
  z-index: 2;
  border-radius: 0.75rem;
  border: 1px solid rgba(255, 255, 255, 0.24);
  pointer-events: none;
}

.story-feature-card::after {
  content: "";
  position: absolute;
  top: -45%;
  left: -42%;
  width: 56%;
  height: 200%;
  z-index: 3;
  pointer-events: none;
  background: linear-gradient(120deg,
      rgba(255, 255, 255, 0) 0%,
      rgba(255, 255, 255, 0.28) 48%,
      rgba(255, 255, 255, 0) 100%);
  transform: translateX(-130%) rotate(10deg);
  transition: transform 0.75s var(--motion-emphasized);
}

.story-feature-media {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  transform: translateZ(0);
  transition: transform 0.55s var(--motion-emphasized), filter 0.55s var(--motion-emphasized),
    opacity 0.55s var(--motion-emphasized);
  filter: saturate(1.08) contrast(1.04);
}

.story-feature-overlay {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(110% 75% at 88% 0%, rgba(251, 133, 0, 0.28), rgba(251, 133, 0, 0) 58%),
    linear-gradient(to top, rgba(1, 13, 33, 0.9), rgba(1, 13, 33, 0.58), rgba(1, 13, 33, 0.22));
  transition: background 0.4s var(--motion-standard);
  pointer-events: none;
  z-index: 1;
}

.story-chip {
  width: max-content;
  color: #172033;
  background: linear-gradient(135deg, #ffd166 0%, #fb8500 100%);
  border: 1px solid rgba(255, 255, 255, 0.55);
  letter-spacing: 0.03em;
  text-transform: uppercase;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

.story-content {
  max-width: 20rem;
  padding: 0.85rem 1rem;
  border-radius: 0.85rem;
  border: 1px solid rgba(255, 255, 255, 0.24);
  background: linear-gradient(180deg, rgba(3, 11, 24, 0.44), rgba(3, 11, 24, 0.74));
  box-shadow: 0 14px 24px -18px rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

.story-icon-frame {
  display: flex;
  align-items: center;
  justify-content: center;
}

.story-icon {
  display: block !important;
  line-height: 1;
  vertical-align: 0;
  transform: translateY(0);
}

.story-kicker {
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 0.35rem;
}

.story-card-cta {
  opacity: 0.94;
  transition: transform 0.3s var(--motion-standard), opacity 0.3s var(--motion-standard), color 0.3s var(--motion-standard);
}

.story-feature-card:hover .story-feature-media {
  transform: scale(1.065);
  filter: saturate(1.14) contrast(1.1);
}

.story-feature-card:hover .story-feature-overlay {
  background:
    radial-gradient(110% 75% at 88% 0%, rgba(251, 133, 0, 0.38), rgba(251, 133, 0, 0) 58%),
    linear-gradient(to top, rgba(1, 13, 33, 0.94), rgba(1, 13, 33, 0.64), rgba(1, 13, 33, 0.28));
}

.story-feature-card:hover::after {
  transform: translateX(320%) rotate(10deg);
}

.story-feature-card:hover .story-card-cta {
  transform: translateX(2px);
  opacity: 1;
  color: #ffe4b0;
}

@media (prefers-reduced-motion: reduce) {

  .story-feature-media,
  .story-card-cta,
  .story-feature-card::after {
    transition: none;
  }

  .story-feature-card:hover .story-feature-media,
  .story-feature-card:hover .story-card-cta {
    transform: none;
  }

  .story-feature-card:hover::after {
    transform: translateX(-130%) rotate(10deg);
  }
}

/* ===== Active Menu State ===== */
.nav-link.active {
  color: #FB8500;
  font-weight: 700;
  border-bottom: 2px solid #FB8500;
}

/* ===== Logo ===== */
.site-logo {
  width: auto;
  object-fit: contain;
}

/* ===== Hero Section Mobile Fix ===== */
.hero-media-wrap {
  overflow: hidden;
  background: #000;
}

.hero-media-fallback,
.hero-video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
}

.hero-video {
  opacity: 0;
  transition: opacity 0.28s var(--motion-standard), transform 0.32s var(--motion-standard);
}

.hero-video.is-playing {
  opacity: 1;
}

@supports (height: 100dvh) {
  @media (max-width: 767px) {
    .hero-section {
      height: 100dvh;
    }
  }
}

@media (max-width: 767px) {
  .hero-video.is-playing {
    transform: scale(1.08);
  }

  /* Move História card to last position on mobile */
  .story-feature-card {
    order: 99;
    min-height: 20rem;
  }
}

/* Keep Hugeicons visually centered with adjacent text */
i.hgi-stroke {
  display: inline-block;
  line-height: 1;
  vertical-align: -0.12em;
}

/* ===== History Photo Overlay ===== */
.history-photo-card {
  position: relative;
  overflow: hidden;
  border-radius: 0.5rem;
}

.history-photo-image {
  transform: translateZ(0);
  transition: transform 0.5s var(--motion-emphasized);
}

.history-photo-overlay {
  position: absolute;
  inset: 0;
  z-index: 1;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.85), rgba(0, 0, 0, 0.45), rgba(0, 0, 0, 0.2));
}

.history-photo-caption {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 2;
  padding: 1rem;
  color: rgba(255, 255, 255, 0.9);
  font-size: 0.875rem;
  line-height: 1.35;
  opacity: 0;
  transform: translateY(12px);
  transition: opacity 0.5s var(--motion-emphasized), transform 0.5s var(--motion-emphasized);
}

.history-photo-card:hover .history-photo-image,
.history-photo-card:focus-within .history-photo-image {
  transform: scale(1.05);
}

.history-photo-card:hover .history-photo-caption,
.history-photo-card:focus-within .history-photo-caption {
  opacity: 1;
  transform: translateY(0);
}

@media (hover: none) {
  .history-photo-caption {
    opacity: 1;
    transform: none;
  }
}

/* ===== Reduced Motion ===== */
@media (prefers-reduced-motion: reduce) {
  .scroll-reveal {
    opacity: 1;
    transform: none;
    transition: none;
  }

  .animate-fade-up {
    animation: none;
    opacity: 1;
  }

  ::view-transition-old(page-content),
  ::view-transition-new(page-content) {
    animation-duration: 0s;
  }
}