/* ==========================================================================
   F.L.R. MECÂNICA DIESEL E SOLDA EM GERAL — Rounded Card Architecture & Motion
   Palette: #FE5502 (Orange) | #0A0A0A (Black) | #FFFFFF (White)
   Zero Red Policy (#000 / #FFF / #FE5502 strictly enforced)
   ========================================================================== */

:root {
  --flr-orange: #FE5502;
  --flr-orange-hover: #E04800;
  --flr-black: #0A0A0A;
  --flr-white: #FFFFFF;
  --flr-surface: #F4F4F2;
  --flr-border: #DFDFDD;
  --flr-muted: #6E6E6E;
  --ease-out-expo: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-in-out-tech: cubic-bezier(0.65, 0, 0.35, 1);
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html {
  scroll-behavior: smooth;
  font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  background-color: var(--flr-surface);
  color: var(--flr-black);
  text-size-adjust: 100%;
  -webkit-text-size-adjust: 100%;
}

body {
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.tabular-nums {
  font-variant-numeric: tabular-nums;
}

/* Hide scrollbar for horizontal pill scrollers on mobile */
.no-scrollbar::-webkit-scrollbar {
  display: none;
}
.no-scrollbar {
  -ms-overflow-style: none;
  scrollbar-width: none;
}

/* Prevent iOS Safari auto-zoom on form fields (<16px triggers zoom on iOS) */
@media (max-width: 639px) {
  input,
  select,
  textarea {
    font-size: 16px !important;
  }
}

/* Automatic Desktop vs Mobile/Touch Copy Switching for Hover/Tap Prompts */
.prompt-copy-desktop {
  display: none;
}
.prompt-copy-mobile {
  display: inline;
}

@media (min-width: 1024px) and (hover: hover) and (pointer: fine) {
  .prompt-copy-desktop {
    display: inline;
  }
  .prompt-copy-mobile {
    display: none;
  }
}

/* Native 1:1 High-Clarity Video Rendering for Hero Section */
.hero-video-crisp {
  transform: none !important;
  will-change: auto;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  filter: url(#flr-sharp-video) contrast(1.06) saturate(1.06);
  image-rendering: -webkit-optimize-contrast;
}

@media (max-width: 767px) {
  .hero-video-crisp {
    filter: contrast(1.05) saturate(1.05);
  }
}

/* ==========================================================================
   1. BIDIRECTIONAL ENTRANCE & EXIT ANIMATIONS (Sections, Text & Images)
   ========================================================================== */

[data-reveal] {
  opacity: 0;
  transform: translate3d(0, 32px, 0);
  transition:
    opacity 0.68s var(--ease-out-expo),
    transform 0.68s var(--ease-out-expo);
  transition-delay: var(--reveal-delay, 0ms);
  will-change: opacity, transform;
}

[data-reveal="left"] {
  transform: translate3d(-36px, 0, 0);
}

[data-reveal="right"] {
  transform: translate3d(36px, 0, 0);
}

[data-reveal="scale"] {
  transform: scale(0.94) translate3d(0, 20px, 0);
}

@media (max-width: 767px) {
  [data-reveal="left"],
  [data-reveal="right"] {
    transform: translate3d(0, 26px, 0);
  }
}

[data-reveal].is-inview {
  opacity: 1;
  transform: translate3d(0, 0, 0) scale(1);
}

[data-reveal].is-exited-top {
  opacity: 0;
  transform: translate3d(0, -24px, 0) scale(0.98);
}

[data-reveal].is-exited-bottom {
  opacity: 0;
  transform: translate3d(0, 32px, 0);
}

/* Image Frame Entrance & Exit */
[data-reveal-img] {
  opacity: 0;
  transform: scale(0.97);
  transition:
    transform 0.85s var(--ease-out-expo),
    opacity 0.55s ease;
  transition-delay: var(--reveal-delay, 0ms);
  will-change: transform, opacity;
}

[data-reveal-img] img {
  transform: scale(1.06);
  transition: transform 1.1s var(--ease-out-expo);
}

[data-reveal-img].is-inview {
  opacity: 1;
  transform: scale(1);
}

[data-reveal-img].is-inview img {
  transform: scale(1.01);
}

[data-reveal-img].is-exited-top {
  opacity: 0.2;
  transform: scale(0.98) translateY(-10px);
}

[data-reveal-img].is-exited-bottom {
  opacity: 0;
  transform: scale(0.97) translateY(14px);
}

/* Cutout Machine Floating & Entrance (001 / 002 / 003) */
[data-reveal-cutout] {
  opacity: 0;
  transform: translate3d(0, 36px, 0) scale(0.9);
  filter: drop-shadow(0 10px 15px rgba(0, 0, 0, 0.04));
  transition:
    opacity 0.8s var(--ease-out-expo),
    transform 0.8s var(--ease-out-expo),
    filter 0.5s ease;
  transition-delay: var(--reveal-delay, 0ms);
}

[data-reveal-cutout].is-inview {
  opacity: 1;
  transform: translate3d(0, 0, 0) scale(1);
  filter: drop-shadow(0 20px 24px rgba(0, 0, 0, 0.12));
}

[data-reveal-cutout].is-exited-top {
  opacity: 0;
  transform: translate3d(0, -28px, 0) scale(0.94);
}

[data-reveal-cutout].is-exited-bottom {
  opacity: 0;
  transform: translate3d(0, 36px, 0) scale(0.9);
}

/* ==========================================================================
   2. VIEWPORT-FITTING ROUNDED SPLIT CARDS & HOVER/TAP SERVICE BREAKDOWN
   ========================================================================== */

@media (min-width: 1024px) {
  .viewport-split-section {
    height: calc(100vh - 84px);
    min-height: 540px;
    max-height: 660px;
  }
}

.vertical-editorial-title {
  writing-mode: vertical-rl;
  transform: rotate(180deg);
  letter-spacing: -0.03em;
  line-height: 0.92;
  user-select: none;
  transition:
    opacity 0.4s var(--ease-out-expo),
    transform 0.5s var(--ease-out-expo),
    color 0.35s ease;
}

@media (max-width: 1023px) {
  .vertical-editorial-title {
    writing-mode: horizontal-tb;
    transform: none;
    line-height: 1.04;
  }
}

.editorial-spec-col {
  position: relative;
  overflow: hidden;
  background-color: var(--flr-white);
  transition: background-color 0.4s var(--ease-out-expo);
}

.editorial-spec-col::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 4px;
  background-color: var(--flr-orange);
  transform: scaleX(0);
  transform-origin: left center;
  transition: transform 0.5s var(--ease-out-expo);
  z-index: 30;
}

.editorial-rest-state {
  transition:
    opacity 0.35s var(--ease-out-expo),
    transform 0.4s var(--ease-out-expo);
}

/* DESKTOP HOVER BEHAVIOR (>= 1024px with mouse) */
@media (min-width: 1024px) {
  .editorial-spec-col:hover::before,
  .editorial-spec-col.is-expanded::before {
    transform: scaleX(1);
  }

  .editorial-spec-col:hover .editorial-rest-state,
  .editorial-spec-col.is-expanded .editorial-rest-state {
    opacity: 0.04;
    transform: translateX(-14px) scale(0.97);
    pointer-events: none;
  }

  .editorial-hover-details {
    position: absolute;
    inset: 0;
    padding: 1.5rem 1.75rem;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    background: linear-gradient(
      180deg,
      rgba(255, 255, 255, 0.98) 0%,
      rgba(255, 255, 255, 0.96) 65%,
      rgba(255, 255, 255, 0.99) 100%
    );
    backdrop-filter: blur(6px);
    opacity: 0;
    pointer-events: none;
    transform: translate3d(0, 18px, 0);
    transition:
      opacity 0.4s var(--ease-out-expo),
      transform 0.4s var(--ease-out-expo);
    z-index: 20;
    overflow-y: auto;
  }

  .editorial-spec-col:hover .editorial-hover-details,
  .editorial-spec-col.is-expanded .editorial-hover-details {
    opacity: 1;
    pointer-events: auto;
    transform: translate3d(0, 0, 0);
  }

  .service-detail-item {
    opacity: 0;
    transform: translate3d(0, 12px, 0);
    transition:
      opacity 0.4s var(--ease-out-expo),
      transform 0.4s var(--ease-out-expo),
      border-color 0.25s ease,
      background-color 0.25s ease;
  }

  .editorial-spec-col:hover .service-detail-item,
  .editorial-spec-col.is-expanded .service-detail-item {
    opacity: 1;
    transform: translate3d(0, 0, 0);
  }

  .editorial-spec-col:hover .service-detail-item:nth-child(1),
  .editorial-spec-col.is-expanded .service-detail-item:nth-child(1) { transition-delay: 40ms; }
  .editorial-spec-col:hover .service-detail-item:nth-child(2),
  .editorial-spec-col.is-expanded .service-detail-item:nth-child(2) { transition-delay: 80ms; }
  .editorial-spec-col:hover .service-detail-item:nth-child(3),
  .editorial-spec-col.is-expanded .service-detail-item:nth-child(3) { transition-delay: 120ms; }
  .editorial-spec-col:hover .service-detail-item:nth-child(4),
  .editorial-spec-col.is-expanded .service-detail-item:nth-child(4) { transition-delay: 160ms; }
  .editorial-spec-col:hover .service-detail-item:nth-child(5),
  .editorial-spec-col.is-expanded .service-detail-item:nth-child(5) { transition-delay: 200ms; }
}

@media (min-width: 1280px) {
  .editorial-hover-details {
    padding: 1.75rem 2.25rem;
  }
}

/* MOBILE & TABLET ACCORDION / EXPANDABLE FLOW (< 1024px) */
@media (max-width: 1023px) {
  .editorial-spec-col.is-expanded::before {
    transform: scaleX(1);
  }

  .editorial-hover-details {
    display: none;
    margin-top: 1.25rem;
    padding-top: 1.25rem;
    border-top: 1px solid var(--flr-border);
    animation: mobileSlideDown 0.35s var(--ease-out-expo) forwards;
  }

  .editorial-spec-col.is-expanded .editorial-hover-details {
    display: flex;
    flex-direction: column;
    gap: 1rem;
  }

  .service-detail-item {
    opacity: 1;
    transform: none;
  }
}

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

.service-detail-item:hover {
  background-color: #EFEFED;
  border-color: var(--flr-orange);
}

/* Synchronized Left Photo Reaction */
.editorial-split-row:has(.editorial-spec-col:hover) .editorial-photo-wrap img,
.editorial-split-row:has(.editorial-spec-col.is-expanded) .editorial-photo-wrap img {
  transform: scale(1.05);
  filter: contrast(1.06) brightness(0.92);
}

.editorial-split-row:has(.editorial-spec-col:hover) .editorial-photo-badge,
.editorial-split-row:has(.editorial-spec-col.is-expanded) .editorial-photo-badge {
  opacity: 1;
  transform: translate3d(0, 0, 0);
}

.editorial-photo-badge {
  opacity: 0;
  transform: translate3d(0, 12px, 0);
  transition:
    opacity 0.4s var(--ease-out-expo),
    transform 0.4s var(--ease-out-expo);
}

@media (max-width: 1023px) {
  .editorial-photo-badge {
    opacity: 1;
    transform: none;
  }
}

/* ==========================================================================
   3. SCROLL-DRIVEN TYPEWRITER / WORD REVEAL (#historia)
   ========================================================================== */

.scroll-write-word {
  display: inline-block;
  opacity: 0.14;
  transform: translateY(4px);
  transition: opacity 0.18s ease, transform 0.18s ease, color 0.18s ease;
}

.scroll-write-word.is-typed {
  opacity: 1;
  transform: translateY(0);
}

.scroll-write-word.is-bold.is-typed {
  color: #0A0A0A;
  font-weight: 700;
}

.scroll-write-word.is-accent.is-typed {
  color: #FE5502;
  font-weight: 700;
}

@keyframes cursorBlink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0; }
}

.scroll-write-cursor {
  display: inline-block;
  width: 3px;
  height: 0.95em;
  background-color: #FE5502;
  vertical-align: -0.08em;
  margin-left: 3px;
  animation: cursorBlink 0.85s infinite;
}

/* ==========================================================================
   4. CONTINUOUS AUTO-SCROLLING CAROUSEL (ROUNDED PHOTO CARDS)
   ========================================================================== */

.carousel-viewport {
  overflow: hidden;
  position: relative;
  user-select: none;
  touch-action: pan-y;
}

.carousel-track {
  display: flex;
  width: max-content;
  will-change: transform;
}

/* ==========================================================================
   5. DYNAMIC RESULTS / NUMBERS SECTION
   ========================================================================== */

.metric-card {
  position: relative;
  transition: transform 0.35s var(--ease-out-expo), border-color 0.35s ease;
}

.metric-card:hover {
  border-color: var(--flr-orange);
  transform: translateY(-4px);
}

.metric-bar-fill {
  width: 0%;
  transition: width 1.3s var(--ease-out-expo);
}

/* ==========================================================================
   6. HERO VIGNETTES, ROUNDED PILLAR CARDS & SCROLL UI
   ========================================================================== */

.hero-vignette {
  background: linear-gradient(
    90deg,
    rgba(0, 0, 0, 0.82) 0%,
    rgba(0, 0, 0, 0.56) 42%,
    rgba(0, 0, 0, 0.22) 72%,
    rgba(0, 0, 0, 0.1) 100%
  );
}

@media (max-width: 767px) {
  .hero-vignette {
    background: linear-gradient(
      180deg,
      rgba(0, 0, 0, 0.72) 0%,
      rgba(0, 0, 0, 0.58) 45%,
      rgba(0, 0, 0, 0.84) 100%
    );
  }
}

.hero-top-vignette {
  background: linear-gradient(
    180deg,
    rgba(0, 0, 0, 0.65) 0%,
    rgba(0, 0, 0, 0) 100%
  );
}

.pillar-card {
  position: relative;
  transition:
    transform 0.4s var(--ease-out-expo),
    box-shadow 0.4s var(--ease-out-expo),
    border-color 0.35s ease;
}

.pillar-card:hover {
  transform: translateY(-6px);
  border-color: rgba(254, 85, 2, 0.45);
}

.pillar-card .pillar-image {
  transition: transform 0.55s var(--ease-out-expo);
}

.pillar-card:hover .pillar-image {
  transform: translateY(-8px) scale(1.04);
}

@keyframes scrollLinePulse {
  0% { transform: scaleY(0); transform-origin: top; }
  50% { transform: scaleY(1); transform-origin: top; }
  50.1% { transform: scaleY(1); transform-origin: bottom; }
  100% { transform: scaleY(0); transform-origin: bottom; }
}

.scroll-line-animated {
  animation: scrollLinePulse 2.4s var(--ease-in-out-tech) infinite;
}

a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible {
  outline: 2px solid var(--flr-orange);
  outline-offset: 3px;
}

::-webkit-scrollbar {
  width: 8px;
}

::-webkit-scrollbar-track {
  background: #0A0A0A;
}

::-webkit-scrollbar-thumb {
  background: #FE5502;
}

.modal-backdrop {
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}

.modal-backdrop.is-open {
  opacity: 1;
  pointer-events: auto;
}

.modal-panel {
  transform: translateY(16px);
  transition: transform 0.25s var(--ease-out-expo);
}

.modal-backdrop.is-open .modal-panel {
  transform: translateY(0);
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  [data-reveal],
  [data-reveal-img],
  [data-reveal-cutout],
  .pillar-card .pillar-image,
  .editorial-hover-details,
  .service-detail-item,
  .scroll-write-word {
    transition: none !important;
    opacity: 1 !important;
    transform: none !important;
    clip-path: none !important;
  }
}
