/* ============================================================
   VERATUM BRANDS — Custom stylesheet
   Loaded AFTER tailwind.min.css so specificity wins cleanly.
   ============================================================ */

/* ---- Base -------------------------------------------- */
html,
body {
  background: #EFE9DC;
  color: #18120E;
  /* Prevent horizontal rubber-banding on mobile without killing vertical pull-to-refresh */
  overscroll-behavior-x: none;
}

body {
  font-family: 'Geist', system-ui, sans-serif;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  /* Helps Safari sub-pixel rendering consistency */
  text-rendering: optimizeLegibility;
}

/* ---- Typography utilities ---------------------------- */
.font-display {
  font-family: 'Instrument Serif', serif;
  font-weight: 400;
  letter-spacing: -0.01em;
}

.font-mono {
  font-family: 'JetBrains Mono', ui-monospace, monospace;
}

::selection {
  background: #18120E;
  color: #EFE9DC;
}

/* ---- Paper grain ------------------------------------- */
/* contain: paint isolates this element's compositing so the
   radial-gradient doesn't re-rasterise on every scroll event */
.grain::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: .22;
  mix-blend-mode: multiply;
  background-image: radial-gradient(rgba(24, 18, 14, .15) 1px, transparent 1px);
  background-size: 4px 4px;
  contain: paint;
}

/* ---- Fluid headings ---------------------------------- */
.h-hero {
  font-size: clamp(3rem, 11.5vw, 9.5rem);
  line-height: .88;
  letter-spacing: -0.018em;
}

.h-sec {
  font-size: clamp(2.5rem, 7.2vw, 6rem);
  line-height: .92;
  letter-spacing: -0.012em;
}

.h-sub {
  font-size: clamp(1.6rem, 2.4vw, 2.1rem);
  line-height: 1.35;
}

/* ---- Gold tick --------------------------------------- */
.tick {
  width: 5px;
  height: 5px;
  background: #A8854A;
  display: inline-block;
  transform: rotate(45deg);
}

/* ---- Spinning seal ----------------------------------- */
@keyframes spinSlow {
  to { transform: rotate(360deg); }
}

.spin-slow {
  animation: spinSlow 60s linear infinite;
  /* Persistent GPU layer: this element rotates for the entire page lifetime */
  will-change: transform;
}

/* ---- Ticker marquee ---------------------------------- */
@keyframes marquee {
  from { transform: translateX(0); }
  to   { transform: translateX(-50%); }
}

.marquee {
  display: flex;
  width: max-content;
  animation: marquee 55s linear infinite;
  /* Persistent GPU layer: continuous horizontal scroll */
  will-change: transform;
}

/* ---- Fade-in reveals --------------------------------- */
/* will-change is set just-in-time via JS and removed after
   transitionend to avoid wasting GPU memory on idle elements */
.fu {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 1.1s cubic-bezier(.16, 1, .3, 1),
              transform 1.1s cubic-bezier(.16, 1, .3, 1);
}

.fu.in {
  opacity: 1;
  transform: none;
}

/* ---- Dark sections ----------------------------------- */
.ink-section {
  background: #18120E;
  color: #EFE9DC;
}

.ink-section ::selection {
  background: #EFE9DC;
  color: #18120E;
}

/* ---- Nav underline ----------------------------------- */
.nav-link {
  position: relative;
}

.nav-link::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -5px;
  height: 1px;
  background: currentColor;
  transform: scaleX(0);
  transform-origin: left;
  transition: transform .55s cubic-bezier(.16, 1, .3, 1);
}

.nav-link:hover::after {
  transform: scaleX(1);
}

/* ---- Arrow CTA --------------------------------------- */
.arrow-cta {
  display: inline-block;
  transition: transform .55s cubic-bezier(.16, 1, .3, 1);
  /* This element animates on every group:hover — promote early */
  will-change: transform;
}

.group:hover .arrow-cta {
  transform: translateX(8px);
}

/* ---- Colonnade SVG stage ----------------------------- */
.colonnade-stage {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: 0;
}

.colonnade-stage svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  color: #A8854A;
}

/* ---- Hero warm wash ---------------------------------- */
.hero-wash {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background:
    radial-gradient(ellipse 70% 55% at 35% 55%, rgba(246, 241, 230, .85) 0%, rgba(246, 241, 230, 0) 70%),
    radial-gradient(ellipse 60% 40% at 50% 18%, rgba(201, 168, 107, .10) 0%, rgba(201, 168, 107, 0) 70%);
}

/* ---- Row hover --------------------------------------- */
.row-hover {
  transition: background .35s ease;
}

.row-hover:hover {
  background: rgba(168, 133, 74, .06);
}

/* ---- Gold italic helper ------------------------------ */
.gold-italic {
  color: #A8854A;
  font-style: italic;
}

/* ---- Hero clip --------------------------------------- */
.hero-clip {
  overflow: clip;
}

/* ---- Section paint containment ----------------------
   contain: layout paint isolates each section so scroll-driven
   repaints in one section cannot invalidate adjacent sections.
   Safe on these elements: all positioned children are intentionally
   within the section boundary (grain::before with inset:0).
   NOT applied to .olive-section because sticky needs scroll-container. */
#manifesto,
#casos,
#metodologia,
#qualificacao,
footer {
  contain: layout paint;
}

/* ============================================================
   OLIVE TREE — scroll-scrubbed video section
   ============================================================ */

.olive-section {
  position: relative;
  /* svh = small viewport height: stable on iOS Safari (ignores toolbar).
     Fallback to vh for browsers that don't support svh. */
  height: 280vh;
  height: 280svh;
  background: #EFE9DC;
}

.olive-stage {
  position: sticky;
  top: 0;
  /* svh keeps the sticky stage exactly one "stable" screen tall on iOS */
  height: 100vh;
  height: 100svh;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  padding: 7vh 24px 6vh;
}

.olive-eyebrow {
  display: flex;
  align-items: center;
  gap: 12px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  letter-spacing: .3em;
  text-transform: uppercase;
  color: #A8854A;
}

.olive-eyebrow .lat {
  font-family: 'Instrument Serif', serif;
  font-style: italic;
  font-size: 16px;
  letter-spacing: .01em;
  color: #18120E;
  text-transform: none;
}

.olive-eyebrow .sep {
  width: 24px;
  height: 1px;
  background: rgba(168, 133, 74, .5);
}

.olive-frame {
  position: relative;
  height: clamp(38vh, 55vh, 60vh);
  max-width: 92vw;
  padding: 10px;
  border: 1px solid rgba(168, 133, 74, .42);
  /* GPU promotion lives here — on the container, NOT on the video.
     The video has -webkit-mask-image, and Safari breaks when mask +
     transform coexist on the same element (element becomes invisible). */
  -webkit-transform: translateZ(0);
  transform: translateZ(0);
}

.olive-frame::before {
  content: "";
  position: absolute;
  inset: -12px;
  border: 1px dashed rgba(168, 133, 74, .18);
  pointer-events: none;
}

.olive-frame .corner {
  position: absolute;
  width: 14px;
  height: 14px;
  border: 1px solid rgba(168, 133, 74, .75);
  pointer-events: none;
}

.olive-frame .c-tl { top: -4px;    left: -4px;  border-right: none; border-bottom: none; }
.olive-frame .c-tr { top: -4px;    right: -4px; border-left: none;  border-bottom: none; }
.olive-frame .c-bl { bottom: -4px; left: -4px;  border-right: none; border-top: none;    }
.olive-frame .c-br { bottom: -4px; right: -4px; border-left: none;  border-top: none;    }

.olive-video {
  display: block;
  height: 100%;
  width: auto;
  max-width: 100%;
  object-fit: cover;
  filter: sepia(.55) saturate(.78) hue-rotate(-8deg) contrast(1.04) brightness(.94);
  -webkit-mask-image: radial-gradient(ellipse 78% 72% at center, #000 36%, transparent 92%);
  mask-image: radial-gradient(ellipse 78% 72% at center, #000 36%, transparent 92%);
}

.olive-video.no-stream {
  background: #E5DCC9;
}

.olive-quote-area {
  position: relative;
  width: 100%;
  max-width: 64ch;
  height: clamp(90px, 16vh, 140px);
}

.olive-quote {
  position: absolute;
  inset: 0;
  text-align: center;
  opacity: 0;
  transform: translateY(10px);
  transition: opacity .8s cubic-bezier(.16, 1, .3, 1),
              transform .8s cubic-bezier(.16, 1, .3, 1);
  pointer-events: none;
  /* These quotes cross-fade frequently during scroll — keep them promoted */
  will-change: opacity, transform;
}

.olive-quote.is-active {
  opacity: 1;
  transform: translateY(0);
}

.olive-quote .meta {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  letter-spacing: .28em;
  text-transform: uppercase;
  color: rgba(24, 18, 14, .5);
  margin-bottom: 10px;
}

.olive-quote .hl {
  font-family: 'Instrument Serif', serif;
  font-size: clamp(1.4rem, 2.4vw, 2.1rem);
  line-height: 1.32;
  color: #18120E;
  max-width: 56ch;
  margin: 0 auto;
}

.olive-quote .hl em {
  color: #A8854A;
  font-style: italic;
}

/* ---- Progress bar -----------------------------------------------
   OPTIMIZATION: replaced height: var(--olive-progress) with
   transform: scaleY(var(--olive-scale)).
   height changes trigger layout recalculation on every RAF tick (~60×/s).
   scaleY changes are compositor-only — zero layout, zero paint cost. */
.olive-progress {
  position: absolute;
  right: 24px;
  top: 50%;
  width: 1px;
  height: 24vh;
  background: rgba(24, 18, 14, .10);
  transform: translateY(-50%);
}

.olive-progress::after {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background: #A8854A;
  transform-origin: top center;
  transform: scaleY(var(--olive-scale, 0));
  will-change: transform;
}

/* ---- Mobile ------------------------------------------ */
@media (max-width: 768px) {
  .olive-section {
    height: 240vh;
    height: 240svh;
  }

  .olive-frame {
    height: 42vh;
    padding: 8px;
  }

  .olive-quote .hl {
    font-size: 1.15rem;
  }

  .olive-progress {
    right: 12px;
    height: 18vh;
  }
}
