/* ============================================================
   Biohma — layout: header, nav, mobile menu, footer, grids
   ============================================================ */

/* ---------- Header ------------------------------------------------ */
.site-header {
  position: sticky;
  top: 0;
  z-index: 40;
  color: var(--paper);
  background: var(--green-950);
  border-bottom: 1px solid var(--border-on-dark);
}
/* Pages that open on a full-bleed hero start with a transparent header
   that solidifies as the visitor scrolls past the hero. */
body.hero-header .site-header {
  background: rgba(7, 26, 18, var(--hk, 0));
  border-bottom-color: rgba(30, 58, 43, var(--hk, 0));
}
body.hero-header .site-header.menu-is-open { background: var(--green-950); border-bottom-color: var(--border-on-dark); }

.site-header__bar {
  padding-inline: var(--pad-inline);
  height: 80px;
  display: flex; align-items: center; justify-content: space-between; gap: var(--space-8);
}

.logo-link {
  display: block; width: 136px; flex: none;
}
.logo-link img { width: 100%; height: auto; display: block; }
/* .logo-link appears 3x per page (header, mobile menu, footer) — the name
   must be unique per rendered snapshot, so only the header's copy gets it. */
.site-header .logo-link { view-transition-name: brand-logo; }

.main-nav { display: none; align-items: center; gap: var(--space-16); font-size: var(--text-sm); font-weight: 500; }
.main-nav a {
  padding: 6px 0; color: var(--paper); border-bottom: 2px solid transparent;
  white-space: nowrap; transition: border-color var(--dur-fast) var(--ease-standard);
}
.main-nav a:hover { text-decoration: none; border-bottom-color: var(--mark-on-dark); }
/* "page" is the static per-page indicator (set in markup); "true" is the
   scroll-spy's same-page section indicator (set in js/main.js). Both read
   as a shape — a bar appearing under the link — not a colour swap alone,
   so the mark still shows under grayscale/desaturation. */
.main-nav a[aria-current="page"], .main-nav a[aria-current="true"] { border-bottom-color: var(--mark-on-dark); }

.header-side { display: flex; align-items: center; gap: var(--space-5); }
.header-social { display: flex; align-items: center; color: var(--paper); opacity: .85; transition: opacity var(--dur-base) var(--ease-standard); }
.header-social:hover { opacity: 1; }
.lang-switch { display: none; gap: var(--space-2); font-size: var(--text-xs); font-weight: var(--fw-semibold); color: var(--stone-on-dark); }
.lang-switch .is-active { color: var(--paper); font-weight: 500; border-bottom: 2px solid var(--mark-on-dark); }
.lang-switch a, .site-footer a[hreflang] { color: inherit; text-decoration: none; transition: color var(--dur-base) var(--ease-standard); }
.lang-switch a:hover, .site-footer a[hreflang]:hover { color: var(--paper); }

.menu-toggle {
  background: none; border: 1px solid var(--stone-on-dark); color: var(--paper);
  width: 44px; height: 44px; cursor: pointer; border-radius: var(--radius-sm);
  display: grid; place-items: center; flex: none;
}
.menu-toggle span { display: block; width: 18px; height: 2px; background: var(--paper); box-shadow: 0 -6px 0 var(--paper), 0 6px 0 var(--paper); }

@media (min-width: 1024px) {
  .main-nav { display: flex; }
  .lang-switch { display: flex; }
  .menu-toggle { display: none; }
}

/* Narrow phones (~400px and under): logo (136px, fixed) + "Fale
   conosco" button + the 44px menu toggle, plus the bar's own gap and
   padding, add up to more than the viewport — the toggle button was
   landing partly past the right edge, clipped by html/body's
   overflow-x:clip (base.css) instead of visible. Trimming the bar's
   own gap and the button's own padding here reclaims just enough
   width without touching pad-inline (which sets the whole page's
   rhythm, not just the header). */
@media (max-width: 440px) {
  .site-header__bar { gap: var(--space-3); }
  .header-side { gap: var(--space-3); }
  .header-side .btn { padding: 10px 14px; font-size: var(--text-xs); }
}

/* ---------- Mobile menu overlay ------------------------------------ */
/* Background is a separate layer (::before), not background:var(--field)
   directly on .menu-overlay itself — opacity on the overlay's own box
   would fade its nav links and text along with it; a backing layer
   lets just the field gradient read as slightly see-through (the page
   behind it still showing faintly) while the menu's own content stays
   fully opaque. z-index:-1 here is scoped to .menu-overlay's own
   stacking context (it has z-index:50, establishing one) — it only
   drops behind the overlay's OTHER children, never behind the actual
   page content, which sits in a sibling context entirely. */
.menu-overlay {
  position: fixed; inset: 0; z-index: 50; color: var(--paper);
  overflow: auto; display: none;
}
.menu-overlay::before {
  content: ""; position: fixed; inset: 0; z-index: -1;
  background: var(--field); opacity: 0.94;
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
}
.menu-overlay.is-open { display: block; }
.menu-overlay__bar {
  height: 80px; display: flex; align-items: center; justify-content: space-between;
  padding-inline: var(--pad-inline); border-bottom: 1px solid var(--border-on-dark);
}
.menu-overlay__close {
  background: none; border: 1px solid var(--stone-on-dark); color: var(--paper);
  padding: 10px 16px; font-size: var(--text-xs); font-weight: 500; cursor: pointer;
  border-radius: var(--radius-sm);
}
.menu-overlay nav { display: flex; flex-direction: column; padding: var(--space-10) var(--pad-inline); }
/* Direct children only — .menu-overlay__foot's "Fale conosco" button is a
   grandchild of nav, and must keep its own .btn--inverse styling (color,
   width, padding) instead of inheriting the full-width nav-link treatment. */
.menu-overlay nav > a {
  padding: 20px 0; color: var(--paper);
  text-align: left; width: 100%; font-family: var(--font-display); font-weight: 700;
  font-size: var(--text-h2); letter-spacing: var(--ls-tighter); line-height: var(--lh-tight);
}
.menu-overlay nav > a:hover { text-decoration: none; color: var(--accent-on-dark); }
/* Scroll-spy mark: a dash before the label, the same shape the eyebrow
   rule uses — not a colour swap alone, so it survives desaturation. */
.menu-overlay nav > a[aria-current="true"] { color: var(--accent-on-dark); }
.menu-overlay nav > a[aria-current="true"]::before {
  content: ""; display: inline-block; width: 20px; height: 3px;
  background: var(--mark-on-dark); margin-right: 14px; vertical-align: middle;
}
.menu-overlay__foot {
  border-top: 1px solid var(--border-on-dark); padding-top: var(--space-6);
  display: flex; justify-content: space-between; align-items: center; gap: var(--space-4);
}
@media (min-width: 1024px) { .menu-overlay { display: none !important; } }

/* ---------- Sections / grids --------------------------------------- */
main { margin-top: -80px; }

.section { padding-inline: var(--pad-inline); padding-block: var(--section-y); position: relative; }
/* One rhythm, --section-y, used by every section with no per-section
   magic-number overrides. Every section's own top padding drops out
   against whatever comes before it — the leading section's bottom
   padding alone sets the gap — regardless of whether the two sections
   share a background or change it, so every boundary in the page reads
   as the same single rhythm (previously a background change doubled
   the gap to two rhythms stacked; standardized flat instead).
   .section--tight (the Portfolio band) keeps its own smaller padding on
   both edges — it was never part of this pairing, just inflated by the
   background-change doubling on whichever side had one; flattening that
   away now lets its real half-rhythm show on both sides. */
.section + .section { padding-top: 0; }
/* Exception: a section whose own background is a photo bleeding full-
   bleed under its padding (see .section--photo's img/video, inset:0,
   ignoring the section's own padding box) can't supply a visible gap
   from ITS bottom padding — that padding is covered by the photo, not
   empty space. Collapsing the next section's top padding to 0 as well
   (the default above) left genuinely nothing between the photo and the
   next section's text — TI Baú's photo was landing flush against "Quem
   somos". The section AFTER a photo has to carry the gap on its own. */
.section.section--photo + .section { padding-top: var(--section-y); }
/* A section whose own content sits over its OWN full-bleed photo (TI
   Baú) needs that same padding-top for a different reason than
   inter-section rhythm: it's the only thing holding its text off the
   top edge of the image underneath it — the photo itself ignores
   padding (inset:0), but the text wrapper is a normal flow child and
   does respect it. The collapse above zeroed it against Portfolio
   before this, which read fine for the GAP between the two sections
   (the photo bleeds under it regardless) but also flattened the
   slide's own internal inset, pinning "Terra Indígena Baú" flush to
   the top. Restored unconditionally, whatever precedes it. */
.section + .section.section--photo { padding-top: var(--section-y); }
.section--tight { padding-block: var(--space-16); }
.section--dark { background: var(--green-950); color: var(--paper); }
.section--sand { background: var(--green-50); color: var(--green-950); }
.section--paper { background: transparent; color: var(--green-950); }
.section--field { background: var(--field); color: var(--paper); }
.section--photo { position: relative; overflow: hidden; background: #3a4a41; color: var(--paper); }
.section--blue { background: transparent; color: var(--green-950); }
.section--blue .source-note { color: var(--turq-800); }
.section--teal {
  background: radial-gradient(90% 120% at 108% 112%, rgba(23,195,168,0.9) 0%, rgba(23,195,168,0.6) 18%, rgba(23,195,168,0.32) 38%, rgba(23,195,168,0.12) 58%, rgba(23,195,168,0.03) 76%, rgba(23,195,168,0) 90%),
              linear-gradient(104deg, #071a12 0%, #08200f 34%, #0a2418 62%, #0e3423 100%);
  color: var(--paper);
}

@media (max-width: 640px) { .site-footer__wm { display: none; } }

.grid { display: grid; gap: var(--space-8); }
@media (min-width: 1024px) { .grid { gap: var(--space-10); } }
.grid-2 { grid-template-columns: 1fr; }
.grid-3 { grid-template-columns: 1fr; }
.grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (min-width: 640px) { .grid-3 { grid-template-columns: repeat(2, minmax(0,1fr)); } }
@media (min-width: 1000px) { .grid-3 { grid-template-columns: repeat(3, minmax(0,1fr)); } }
.grid-partners { grid-template-columns: 1fr; gap: var(--space-12); }
@media (min-width: 480px)  { .grid-partners { grid-template-columns: repeat(2, minmax(0,1fr)); } }
@media (min-width: 1000px) { .grid-partners { grid-template-columns: repeat(4, minmax(0,1fr)); column-gap: clamp(32px, 4vw, 80px); } }
/* leva 3: logos um pouco mais abaixo do rótulo */
.grid-partners.title-gap { margin-top: calc(var(--space-10) + 16px); }
@media (min-width: 1000px) { .grid-partners.title-gap { margin-top: calc(var(--space-10) + 40px); } }
.grid-portfolio { grid-template-columns: 1fr; }
@media (min-width: 640px)  { .grid-portfolio { grid-template-columns: repeat(2, minmax(0,1fr)); } }
@media (min-width: 1440px) { .grid-portfolio { grid-template-columns: repeat(4, minmax(0,1fr)); } }
@media (min-width: 1024px) { .grid-2 { grid-template-columns: 1fr 1fr; } }
@media (min-width: 1000px) { .grid-4 { grid-template-columns: repeat(4, minmax(0,1fr)); } }

/* Side-by-side only once the team row (.grid-team below) also has room
   to sit in one line at that width — 1480px, matching its own
   breakpoint. Below that, the headline stacks above the full-width team
   row instead of squeezing it into a narrow 2-column block next to a
   half-empty text column, which read as broken. */
.grid-modelo { grid-template-columns: 1fr; gap: var(--space-12); }
@media (min-width: 1480px) { .grid-modelo { grid-template-columns: minmax(300px, 440px) minmax(0,1fr); } }

/* "O modelo" teaser: a 2x2 grid — info above the button on the left,
   the role timeline above its governance charts on the right, so the
   charts sit directly under (and share the width of) the timeline. */
.grid-modelo-2x2 { grid-template-columns: 1fr; gap: var(--space-12); }
@media (min-width: 900px) {
  .grid-modelo-2x2 { grid-template-columns: minmax(280px, 380px) minmax(0, 1fr); gap: clamp(32px, 5vw, 80px); }
}

/* TI Baú: info, map and photo. Below 720px, three full-width rows. From
   720px, info spans the top row and map/photo split the row beneath it
   50/50. From 1240px, all three sit in one row at 30/35/35. */
.grid-bau-3col { grid-template-columns: 1fr; gap: var(--space-8); }
@media (min-width: 720px) {
  .grid-bau-3col { grid-template-columns: 1fr 1fr; }
  .grid-bau-3col > :first-child { grid-column: 1 / -1; }
}
@media (min-width: 1240px) {
  .grid-bau-3col { grid-template-columns: 30fr 35fr 35fr; gap: var(--space-6); }
  .grid-bau-3col > :first-child { grid-column: auto; }
}

/* Team photos: side by side, never dropping to 2 columns until the row
   actually gets tight — a higher threshold than .grid-4's 1000px because
   these portraits are wide enough to look cramped sooner. 1480px is
   .grid-modelo's own breakpoint (above), where the row shares its width
   with the headline column; below that the row has the FULL section
   width to itself (headline stacks above it instead), so it can go to
   one line much sooner — 900px, below which "Pedro Paulo Lins e Silva",
   the longest name, wraps to two lines while its siblings stay on one.
   Verified in-browser at exactly this width: wraps up to 880px, clear
   at 890px. */
.grid-team { grid-template-columns: repeat(2, minmax(0, 1fr)); }
/* Below 480px (phones, not just "below 900px" tablets) even 2 columns
   get tight once a portrait's own min width is accounted for — one
   column, same as every other narrow-phone override in this file. */
@media (max-width: 480px) { .grid-team { grid-template-columns: 1fr; } }
@media (min-width: 900px) { .grid-team { grid-template-columns: repeat(4, minmax(0, 1fr)); } }

.grid-integ-home { grid-template-columns: 1fr; gap: var(--space-10); }
@media (min-width: 1180px) { .grid-integ-home { grid-template-columns: minmax(300px, 400px) minmax(0,1fr); } }

.grid-article { grid-template-columns: 1fr; gap: var(--space-12); }
@media (min-width: 900px) { .grid-article { grid-template-columns: 200px minmax(0,1fr); } }

.grid-papeis { grid-template-columns: 1fr; gap: var(--space-4); }
@media (min-width: 700px) { .grid-papeis { grid-template-columns: 1fr 1fr; } }
@media (min-width: 1180px) { .grid-papeis { grid-template-columns: repeat(3, minmax(0,1fr)); } }

.grid-kpi { grid-template-columns: repeat(2, minmax(0,1fr)); }
@media (min-width: 640px) { .grid-kpi { grid-template-columns: repeat(3, minmax(0,1fr)); } }
@media (min-width: 1180px) { .grid-kpi { grid-template-columns: repeat(5, minmax(0,1fr)); } }

.grid-ods { grid-template-columns: repeat(6, minmax(0,1fr)); gap: 6px; }
@media (min-width: 900px) { .grid-ods { grid-template-columns: repeat(17, minmax(0,1fr)); } }
.grid-ods img { width: 100%; height: auto; aspect-ratio: 1; display: block; border-radius: 2px; }

.kpi-card { background: var(--white); border: 1px solid var(--sand-200); border-radius: var(--radius-lg); padding: var(--space-8); display: flex; flex-direction: column; gap: var(--space-6); min-height: 200px; }
.kpi-card__title { font-size: var(--text-lg); font-weight: 600; color: var(--green-700); line-height: 1.3; }
.kpi-card__ods { display: flex; gap: 6px; flex-wrap: wrap; margin-top: auto; }
.kpi-card__ods img { width: 56px; height: 56px; display: block; border-radius: 2px; }

.patch-bg {
  position: absolute; right: -12%; top: -100px; width: 720px; height: 720px;
  max-width: 90vw; pointer-events: none;
}
/* "A tese" dot cluster: centered on the card column behind it by default.
   The cards below narrow and stack as the viewport shrinks, so the cluster
   slides upward continuously with them (no breakpoint jumps: the extra
   translateY is a clamped calc() of viewport width) to stay clear of the
   card stack instead of sitting behind it. By 1460px it's already sliding
   off the top edge; only past ~2200px (a genuinely wide desktop) does it
   settle at true center with nothing trimmed. right is pulled in from the
   base -12% so less of it bleeds off-screen on the side at wide viewports. */
.patch-bg--tese {
  top: 50%; right: -4%;
  transform: translateY(-50%) translateY(clamp(-450px, calc(27vw - 595px), 0px));
}
.section-content { position: relative; }
/* "Com quem trabalhamos" gets a bit more air than the standard section
   rhythm on both sides — margin, not padding, so it's additive on top
   of the normal --section-y gap instead of fighting the collapse rules
   every other section boundary shares. */
#parceiros { margin-block: var(--space-8); }

/* ---------- Footer -------------------------------------------------- */
.site-footer {
  position: relative; overflow: hidden; background: var(--green-950); color: var(--paper);
  padding-inline: var(--pad-inline); padding-top: var(--space-12); padding-bottom: var(--space-8);
}
.site-footer__wm {
  position: relative; height: 200px; margin-bottom: var(--space-8); overflow: hidden;
  pointer-events: none; color: var(--paper);
  -webkit-mask-image: linear-gradient(180deg, rgba(0,0,0,1) 0%, rgba(0,0,0,0) 72%);
  mask-image: linear-gradient(180deg, rgba(0,0,0,1) 0%, rgba(0,0,0,0) 72%);
}
.site-footer__wm svg { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.site-footer__grid { display: grid; gap: var(--space-8); font-size: var(--text-sm); color: var(--stone-on-dark); font-weight: var(--fw-semibold); }
.site-footer .logo-link { width: 190px; margin-top: 17px; }
@media (min-width: 1000px) { .site-footer__grid { grid-template-columns: repeat(4, minmax(0,1fr)); } }
.site-footer h4 { font-size: var(--text-xs); font-weight: 600; letter-spacing: var(--ls-caps); text-transform: uppercase; color: var(--paper); margin-bottom: var(--space-3); }
.site-footer nav { display: flex; flex-direction: column; gap: 6px; }
.site-footer nav a { color: var(--stone-on-dark); font-weight: var(--fw-semibold); }
.site-footer nav a:hover { color: var(--paper); }
.site-footer nav a[aria-current="true"] { color: var(--paper); }
.site-footer nav a[aria-current="true"]::before {
  content: ""; display: inline-block; width: 10px; height: 2px;
  background: var(--mark-on-dark); margin-right: 8px; vertical-align: middle;
}
.site-footer__bottom {
  border-top: 1px solid var(--border-on-dark); margin-top: var(--space-10); padding-top: var(--space-5);
  display: flex; justify-content: space-between; gap: var(--space-4); flex-wrap: wrap;
  font-size: var(--text-xs); color: var(--stone-on-dark); font-weight: var(--fw-semibold);
}

/* ---------- Hero (home + TI Baú) ------------------------------------- */
.hero {
  position: relative; z-index: 1; height: 92vh; max-height: 960px; min-height: 640px;
  background: var(--green-950); color: var(--paper); overflow: hidden;
}
@media (min-width: 1024px) { .hero { min-height: 760px; } }
/* will-change:transform removed deliberately: nothing ever transforms this
   element (no [data-parallax] here), and keeping it forced a composited
   layer that silently failed to paint AVIF hero images in some browsers —
   the photo never showed, only the solid fallback color underneath. */
.hero__bg { position: absolute; inset: -8% 0 0 0; background: var(--green-950); }
.hero-bg-slide img { width: 100%; height: 100%; display: block; object-fit: cover; object-position: 60% 100%; }
/* Lighter than before on purpose: strong behind the text block (bottom
   band, left side), weak everywhere else, so the forest photograph is
   actually visible instead of a flat dark wash over the whole frame. The
   headline itself carries a text-shadow (below) as a second line of
   contrast that doesn't cost the image anything. */
.hero__scrim {
  position: absolute; inset: 0;
  background:
    linear-gradient(90deg, rgba(7,26,18,0.4) 0%, rgba(7,26,18,0.15) 45%, rgba(7,26,18,0) 75%),
    linear-gradient(180deg, rgba(7,26,18,0.5) 0%, rgba(7,26,18,0.3) 12%, rgba(7,26,18,0.05) 32%, rgba(7,26,18,0.25) 55%, rgba(7,26,18,0.72) 78%, rgba(7,26,18,0.85) 100%);
}
.hero-slide, .hero__lede { text-shadow: 0 2px 16px rgba(7,26,18,.55); }
.hero__content { position: absolute; left: 0; right: 0; bottom: 0; padding-inline: var(--pad-inline); padding-top: 104px; padding-bottom: 48px; }
.hero__inner { max-width: 880px; }
.hero__slides { display: grid; grid-template-columns: minmax(0,1fr); }
.hero__lede { margin-top: var(--space-6); font-size: clamp(var(--text-sm), 1.6vw, var(--text-lg)); line-height: 1.5; max-width: 62ch; color: var(--stone-on-dark); font-weight: var(--fw-semibold); text-wrap: pretty; }
.hero__actions { display: flex; gap: var(--space-4); align-items: center; flex-wrap: wrap; margin-top: var(--space-8); }
.hero__dots { display: flex; gap: 8px; margin-top: var(--space-5); }
.hero__dot { width: 32px; height: 24px; background: none; border: none; padding: 0; cursor: pointer; display: grid; align-items: center; }
.hero__dot span { display: block; height: 2px; background: var(--stone-on-dark); transition: background var(--dur-base) var(--ease-standard); }
.hero__dot[aria-selected="true"] span { background: var(--mark-on-dark); }

.hero--bau { min-height: 520px; height: auto; display: flex; align-items: flex-end; }
.hero--bau .hero__scrim { background: linear-gradient(180deg, rgba(7,26,18,0.35) 0%, rgba(7,26,18,0) 30%, rgba(7,26,18,0.92) 100%); }
.hero--bau .hero__content { position: relative; padding-top: 160px; padding-bottom: 64px; }

.opener {
  position: relative; overflow: hidden; padding-inline: var(--pad-inline);
  padding-top: 160px; padding-bottom: var(--space-24);
}
.opener h1 { max-width: 18ch; font-size: var(--text-display-xl); }

/* View Transition timing lives in animations.css (single source). */
