/* BTD diagrams — editorial presentation for the six integral 16:9 pieces. */

.diagram-gallery,
.diagram-feature {
  scroll-margin-top: calc(var(--header-height) + 24px);
}

.diagram-gallery {
  background: var(--charcoal);
  color: var(--white);
}

.diagram-gallery .section-head,
.diagram-feature .section-head {
  margin-bottom: clamp(2rem, 4.5vw, 4rem);
}

/* Gallery controls */
.diagram-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem 2rem;
  padding: 1rem 0;
  border-top: 1px solid var(--line-light);
  border-bottom: 1px solid var(--line-light);
}

.diagram-toolbar p {
  min-width: 0;
  color: #d2ccc4;
  font-size: 0.78rem;
  line-height: 1.5;
}

.diagram-expand {
  display: inline-flex;
  min-height: 44px;
  flex: 0 1 auto;
  align-items: center;
  justify-content: center;
  padding: 0.65rem 0.9rem;
  border: 1px solid rgba(255, 253, 249, 0.34);
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--white);
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.07em;
  line-height: 1.25;
  text-align: center;
  text-transform: uppercase;
  transition: border-color 180ms var(--ease), background-color 180ms var(--ease), color 180ms var(--ease);
}

.diagram-expand:hover {
  border-color: var(--orange);
  background: var(--orange);
  color: var(--black);
}

/* Details panels */
.diagram-panels {
  border-bottom: 1px solid var(--line-light);
}

.diagram-panel {
  border-top: 1px solid var(--line-light);
}

.diagram-panel:first-child {
  border-top: 0;
}

.diagram-panel summary {
  display: grid;
  grid-template-columns: 58px minmax(0, 1fr) 42px;
  gap: 1rem;
  align-items: center;
  min-height: 92px;
  padding: 1rem 0;
  cursor: pointer;
  list-style: none;
}

.diagram-panel summary::-webkit-details-marker {
  display: none;
}

.diagram-panel summary:focus-visible {
  outline-offset: -3px;
}

.diagram-index {
  color: var(--orange);
  font-family: "Barlow Condensed", Impact, sans-serif;
  font-size: 1.05rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  line-height: 1;
}

.diagram-panel summary > span:nth-child(2) {
  display: grid;
  min-width: 0;
  gap: 0.4rem;
}

.diagram-panel summary strong {
  color: var(--white);
  font-family: "Barlow Condensed", Impact, sans-serif;
  font-size: clamp(1.75rem, 3vw, 2.7rem);
  font-weight: 600;
  letter-spacing: -0.025em;
  line-height: 0.9;
  overflow-wrap: anywhere;
}

.diagram-summary {
  display: block;
  max-width: 680px;
  color: var(--muted-light);
  font-family: "Manrope", Arial, sans-serif;
  font-size: 0.78rem;
  font-weight: 500;
  line-height: 1.5;
}

.diagram-toggle {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  justify-self: end;
  border: 1px solid rgba(255, 253, 249, 0.3);
  color: var(--orange);
  font-size: 1.35rem;
  font-weight: 400;
  line-height: 1;
  transition: border-color 180ms var(--ease), background-color 180ms var(--ease), color 180ms var(--ease);
}

.diagram-panel summary:hover .diagram-toggle,
.diagram-panel summary:focus-visible .diagram-toggle {
  border-color: var(--orange);
}

.diagram-panel[open] summary .diagram-toggle {
  background: var(--orange);
  color: var(--black);
  font-size: 0;
}

.diagram-panel[open] summary .diagram-toggle::before {
  content: "−";
  font-size: 1.35rem;
}

.diagram-panel-body {
  padding: 0 0 clamp(1.75rem, 4vw, 3.5rem);
}

/* Integral artwork: never crop, fix the height, or force object-fit. */
.diagram-figure {
  width: 100%;
  margin: 0;
}

.diagram-image-link {
  display: block;
  width: 100%;
  overflow: hidden;
  border: 1px solid rgba(255, 253, 249, 0.16);
  background: var(--black);
}

.diagram-image-link:hover {
  border-color: var(--orange);
}

.diagram-image-link > img,
.diagram-figure img,
.diagram-promo-image > img,
.diagram-thumbnail img {
  display: block;
  width: 100%;
  max-width: 100%;
  height: auto;
}

.diagram-image-link > img,
.diagram-figure img {
  object-fit: initial;
}

.diagram-figure figcaption {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem 1.5rem;
  margin-top: 0.8rem;
  padding-top: 0.8rem;
  border-top: 1px solid var(--line-light);
  color: var(--muted-light);
  font-size: 0.7rem;
  line-height: 1.5;
}

.diagram-figure figcaption > span {
  min-width: 0;
  flex: 1 1 18rem;
}

.diagram-figure figcaption > a {
  display: inline-flex;
  min-height: 44px;
  flex: 0 1 auto;
  align-items: center;
  gap: 0.55rem;
  color: var(--white);
  font-size: 0.67rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  line-height: 1.3;
  text-decoration: none;
  text-transform: uppercase;
}

.diagram-figure figcaption > a:hover {
  color: var(--orange);
}

.diagram-figure figcaption .arrow {
  color: var(--orange);
}

.diagram-figure figcaption > a:hover .arrow {
  transform: translate(0.15em, -0.15em);
}

.diagram-disclaimer {
  max-width: 900px;
  margin: clamp(2rem, 4vw, 3.25rem) 0 0;
  padding: 0.85rem 1rem;
  border-left: 3px solid var(--orange);
  background: rgba(255, 253, 249, 0.07);
  color: #ddd8cf;
  font-size: 0.75rem;
  line-height: 1.65;
}

/* Standalone dark feature for the academy and complex-sales funnel pieces. */
.diagram-feature {
  background: var(--charcoal);
  color: var(--white);
}

.diagram-feature .diagram-figure {
  width: 100%;
}

.diagram-feature > .container > .text-link {
  margin-top: 1.4rem;
  color: var(--white);
}

.diagram-feature > .container > .text-link:hover {
  color: var(--orange);
}

/* Home promotion: a quiet 50/50 editorial break after the service cards. */
.diagram-promo {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  align-items: center;
  gap: clamp(2rem, 6vw, 6.5rem);
  margin-top: clamp(3rem, 6vw, 5.5rem);
  padding: clamp(2rem, 4vw, 3.5rem) 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: var(--paper);
  color: var(--ink);
}

.diagram-promo-image {
  display: block;
  min-width: 0;
  background: var(--charcoal);
}

.diagram-promo-image:hover {
  outline: 1px solid var(--orange);
  outline-offset: -1px;
}

.diagram-promo-copy {
  min-width: 0;
}

.diagram-promo-copy .section-kicker {
  margin-bottom: 1rem;
}

.diagram-promo-copy h3 {
  max-width: 520px;
  margin-bottom: 1rem;
  font-size: clamp(2.6rem, 4.5vw, 4.6rem);
  line-height: 0.9;
}

.diagram-promo-copy > p:not(.section-kicker) {
  max-width: 480px;
  margin-bottom: 1.45rem;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.7;
}

.diagram-promo-copy .text-link {
  color: var(--ink);
}

.diagram-promo-copy .text-link:hover {
  color: var(--orange-deep);
}

/* Home portfolio column thumbnail. */
.home-portfolio-summary .diagram-thumbnail {
  display: grid;
  gap: 0.9rem;
  margin-top: clamp(2rem, 4vw, 3.5rem);
  padding-top: 1.25rem;
  border-top: 1px solid var(--line);
}

.diagram-thumbnail > a:first-child {
  display: block;
  min-width: 0;
  background: var(--charcoal);
}

.diagram-thumbnail > a:first-child:hover {
  outline: 1px solid var(--orange);
  outline-offset: -1px;
}

.diagram-thumbnail .text-link {
  color: var(--ink);
}

.diagram-thumbnail .text-link:hover {
  color: var(--orange-deep);
}

.diagram-image-link:focus-visible,
.diagram-promo-image:focus-visible,
.diagram-thumbnail > a:focus-visible,
.diagram-figure figcaption > a:focus-visible,
.diagram-expand:focus-visible {
  outline: 3px solid var(--orange);
  outline-offset: 4px;
}

@media (max-width: 900px) {
  .diagram-promo {
    gap: clamp(1.75rem, 5vw, 3.5rem);
  }

  .diagram-panel summary {
    grid-template-columns: 48px minmax(0, 1fr) 38px;
  }
}

@media (max-width: 720px) {
  .diagram-toolbar {
    align-items: flex-start;
    flex-direction: column;
    gap: 0.85rem;
  }

  .diagram-expand {
    width: auto;
    max-width: 100%;
  }

  .diagram-panel summary {
    grid-template-columns: 42px minmax(0, 1fr) 36px;
    gap: 0.7rem;
    min-height: 84px;
  }

  .diagram-panel summary strong {
    font-size: clamp(1.7rem, 7vw, 2.45rem);
  }

  .diagram-summary {
    font-size: 0.74rem;
  }

  .diagram-figure figcaption {
    gap: 0.65rem;
  }

  .diagram-figure figcaption > a {
    flex-basis: 100%;
  }

  .diagram-promo {
    grid-template-columns: 1fr;
    gap: 2rem;
    margin-top: 3rem;
  }

  .diagram-promo-copy h3 {
    font-size: clamp(2.75rem, 12vw, 4.15rem);
  }

  .diagram-thumbnail {
    width: 100%;
  }
}

@media (max-width: 560px) {
  .diagram-panel summary {
    grid-template-columns: 34px minmax(0, 1fr) 34px;
    gap: 0.6rem;
    padding: 0.9rem 0;
  }

  .diagram-index {
    font-size: 0.92rem;
  }

  .diagram-toggle {
    width: 32px;
    height: 32px;
  }

  .diagram-disclaimer {
    padding: 0.75rem 0.85rem;
    font-size: 0.72rem;
  }

  .diagram-figure figcaption {
    font-size: 0.68rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .diagram-expand,
  .diagram-toggle {
    transition: none;
  }
}

/* Rótulos longos não podem impor uma largura mínima maior que a tela. */
.diagram-gallery .section-kicker,
.diagram-feature .section-kicker,
.diagram-promo .section-kicker {
  min-width: 0;
  max-width: 100%;
  overflow-wrap: anywhere;
}

.diagram-feature > .container > .text-link,
.diagram-promo .text-link,
.diagram-thumbnail .text-link {
  max-width: 100%;
  white-space: normal;
}

/* As peças usam SVG nativo; o WebP integral permanece como fallback. */
.diagram-image-link picture,
.diagram-promo-image picture,
.diagram-thumbnail picture {
  display: block;
  width: 100%;
}

.diagram-image-link picture img,
.diagram-promo-image picture img,
.diagram-thumbnail picture img {
  display: block;
  width: 100%;
  max-width: 100%;
  height: auto;
}
