/* Services use the site's existing canvas, ink and coral palette. */
.section--services {
  --service-columns: minmax(0, 1fr) minmax(0, 1.15fr);
  --service-column-gap: 64px;
  --service-character-height: 220px;
  --services-navigation-gap: 24px;
  padding: 0;
  background: var(--canvas);
  scroll-margin-top: 72px;
}
.section--services .wrap { width: min(1200px, calc(100% - 96px)); }
.service-pin { padding-block: 64px 40px; }
.section--services .section-head { margin-bottom: 28px; }
.section--services h2 { margin: 0; max-width: none; font-family: "Cormorant Garamond", Georgia, serif; font-size: clamp(36px, 4vw, 52px); line-height: 1.1; letter-spacing: -.02em; }
.service-stage { position: relative; }
.service-scene { display: grid; grid-template-columns: var(--service-columns); grid-template-rows: auto auto var(--service-character-height); column-gap: var(--service-column-gap); }
.service-scene__heading { grid-column: 1 / -1; margin-bottom: 24px; }
.service-scene h3 { font-size: 24px; line-height: 1.2; margin: 0; font-weight: 500; letter-spacing: -.03em; }
.service-balloon { position: relative; grid-column: 1; grid-row: 2; padding: 24px; border: 1px solid var(--hairline); border-radius: 12px; background: var(--surface); min-width: 0; }
.service-balloon::after { content: ""; position: absolute; bottom: -9px; left: 50%; width: 16px; height: 16px; background: var(--surface); border-right: 1px solid var(--hairline); border-bottom: 1px solid var(--hairline); transform: translateX(-50%) rotate(45deg); }
/* The artwork follows the text box without taking up layout space. */
.service-balloon:has(.service-balloon__art) { background: transparent; border-color: transparent; }
.service-balloon:has(.service-balloon__art)::after { content: none; }
.service-balloon__art {
  position: absolute; top: -1px; left: -1px;
  width: calc(100% + 2px); height: calc(100% + 16px);
  overflow: visible; pointer-events: none;
}
.service-balloon__art [data-balloon-paper] { fill: var(--card); }
.service-balloon__art [data-balloon-shadow] { fill: var(--coral); }
.service-balloon__art [data-balloon-contour] {
  fill: none; stroke: var(--ink); stroke-width: 1.5;
  stroke-linecap: round; stroke-linejoin: round;
}
@media (prefers-reduced-motion: no-preference) {
  [data-enhanced][data-balloon-intro="waiting"] .service-balloon { opacity: 0; }
  [data-enhanced][data-balloon-intro]:not([data-balloon-intro="open"]) .service-balloon > :not(.service-balloon__art) { opacity: 0; }
}
.service-balloon__caption { position: relative; margin: 0 0 12px; color: color-mix(in srgb, var(--coral-dark) 90%, var(--ink)); font: 11px/1.4 "DM Mono", monospace; letter-spacing: .05em; }
.service-balloon[data-balloon-closed] { opacity: 0; pointer-events: none; }
.service-speech { position: relative; margin: 0; color: var(--body); font-size: 18px; line-height: 1.55; }
.service-speech__visible, .service-speech__measure { display: none; }
/* A clipped complete sentence stays accessible; a hidden copy reserves its exact height. */
[data-enhanced] .service-speech__full { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
[data-enhanced] .service-speech__measure { display: block; visibility: hidden; }
[data-enhanced] .service-speech__visible { display: block; position: absolute; inset: 0; }
.service-character-space { grid-column: 1; grid-row: 3; }
.service-preview {
  display: none;
  position: relative;
  grid-area: 2 / 2 / 4;
  align-self: center;
  justify-self: start;
  width: min(100%, 340px);
  overflow: hidden;
  border: 1px solid var(--hairline);
  border-radius: 12px;
}
.service-preview img { width: 100%; height: auto; }
.has-js .service-scene:not([data-state="em-apresentacao"], [data-state="concluido"]) .service-preview { visibility: hidden; }
@media (min-width: 768px) and (prefers-reduced-motion: no-preference) {
  .service-scene[data-state="em-apresentacao"] .service-preview {
    animation: service-preview-open .5s var(--ease) both;
  }
  .service-scene[data-state="em-apresentacao"] .service-preview::after {
    content: "";
    position: absolute;
    inset: 50% 0 auto;
    height: 2px;
    transform: translateY(-50%);
    background: var(--coral);
    pointer-events: none;
    animation: service-preview-line .5s ease-out both;
  }
  @keyframes service-preview-open {
    0%, 16% { clip-path: inset(49.5% 0); }
    100% { clip-path: inset(0); }
  }
  @keyframes service-preview-line {
    0%, 16% { opacity: 1; }
    60%, 100% { opacity: 0; }
  }
}
.service-character { display: none; position: absolute; bottom: 0; left: 0; width: calc((100% - var(--service-column-gap)) / 2.15); height: var(--service-character-height); align-items: center; justify-content: center; pointer-events: none; }
[data-enhanced] .service-character { display: flex; }
.service-character img, .service-character canvas { position: absolute; width: min(240px, 100%); height: auto; aspect-ratio: 1; object-fit: contain; }
.service-character canvas { width: min(270px, 112.5%); aspect-ratio: 9 / 8; opacity: 0; }
.service-character canvas[data-ready] { opacity: 1; }
.service-character:has(canvas[data-ready]) img { visibility: hidden; }
.services-navigation { display: flex; align-items: center; justify-content: space-between; margin-top: var(--services-navigation-gap); }
.services-control { display: inline-grid; place-items: center; width: 44px; min-height: 44px; padding: 0; border: 0; border-radius: 8px; background: transparent; color: var(--ink); font: inherit; font-size: 22px; line-height: 1; cursor: pointer; transition: transform .18s, background .18s; }
.services-control[aria-disabled="false"]:hover { background: var(--card); transform: translateY(-2px); }
.services-control[aria-disabled="false"]:active { transform: translateY(1px); }
.services-control[aria-disabled="true"] { opacity: .45; cursor: default; }
.services-conversation {
  position: relative;
  display: flex;
  width: fit-content;
  margin: var(--services-navigation-gap) auto 0;
  background: var(--coral-dark);
}
.services-conversation:hover { background: color-mix(in srgb, var(--coral-dark) 90%, var(--ink)); }
.has-js .section--services:not([data-enhanced]) .services-conversation { display: none; }
@media (prefers-reduced-motion: no-preference) {
  .services-conversation:not([hidden]) { animation: services-conversation-appear .24s var(--ease); }
  @keyframes services-conversation-appear { from { opacity: 0; } to { opacity: 1; } }
}
.section--services :is(button, .services-conversation):focus-visible { outline: 2px solid var(--coral-dark); outline-offset: 4px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }
.section--services [hidden] { display: none !important; }
/* Progressive fallback: all service texts remain readable without JavaScript. */
.section--services:not([data-enhanced]) .service-scene + .service-scene { margin-top: 48px; }
.section--services:not([data-enhanced]) .service-character-space { display: none; }
@media (max-width: 1024px) { .section--services { --service-column-gap: 32px; } }
@media (min-width: 768px) {
  /* Keep the original landing point while extending the canvas to the right. */
  .service-character canvas { width: min(315px, 131.25%); aspect-ratio: 21 / 16; margin-left: min(45px, 18.75%); }
  .service-preview { display: block; }
  .section--services .wrap {
    display: grid;
    grid-template-columns: var(--service-columns);
    column-gap: var(--service-column-gap);
  }
  .section--services .section-head { grid-area: 1 / 1 / 2 / -1; }
  .service-stage { grid-area: 2 / 1 / 3 / -1; }
  .services-navigation { grid-area: 3 / 1 / 4 / -1; }
  .services-conversation {
    grid-area: 3 / 1 / 4 / -1;
    align-self: center;
    background: var(--coral);
    color: var(--ink);
    box-shadow: 0 2px 16px color-mix(in srgb, var(--coral) 35%, transparent);
    transition: transform .18s var(--ease), box-shadow .18s ease;
  }
  .services-conversation:is(:hover, :active, .is-bursting) {
    background: var(--coral-dark);
    color: #fff;
  }
  .section--services[data-enhanced]:not(:has(.service-scene[data-character-animation]:not([hidden]))) .services-conversation { display: none; }
  .section--services:has(.service-scene:not([hidden]) .service-balloon[data-balloon-closed]) .services-conversation {
    grid-area: 2 / 1 / 3 / -1;
    align-self: end;
    /* Align the n in Oportunidades with the center of the character. */
    margin: 0 0 292px calc((100% - var(--service-column-gap)) / 4.3 + 65px);
    translate: -50%;
  }
}
@media (prefers-reduced-motion: no-preference) {
  .services-conversation.is-bursting { background: var(--coral-dark); }
  .services-conversation:active {
    transform: scale(.9);
    box-shadow: 0 2px 8px color-mix(in srgb, var(--coral-dark) 20%, transparent);
  }
  .services-conversation.is-bursting::before,
  .services-conversation.is-bursting::after {
    --bubble: radial-gradient(circle closest-side, var(--coral) 85%, transparent);
    --bubble-ring: radial-gradient(circle closest-side, transparent 51%, var(--coral) 61% 85%, transparent);
    content: "";
    position: absolute;
    inset-inline: -30%;
    height: 54px;
    pointer-events: none;
    background-image: var(--bubble), var(--bubble-ring), var(--bubble), var(--bubble), var(--bubble-ring), var(--bubble), var(--bubble);
    background-repeat: no-repeat;
    background-size: 6px 6px, 11px 11px, 8px 8px, 5px 5px, 12px 12px, 7px 7px, 9px 9px;
    animation: services-conversation-bubbles .5s ease-out both;
  }
  .services-conversation.is-bursting::before {
    bottom: 100%;
    --bubble-start: 26% 100%, 31% 100%, 43% 100%, 55% 100%, 60% 100%, 66% 100%, 75% 100%;
    --bubble-end: 0% 49%, 14% 26%, 31% 0%, 49% 59%, 63% 12%, 83% 37%, 97% 18%;
  }
  .services-conversation.is-bursting::after {
    top: 100%;
    --bubble-start: 30% 0%, 36% 0%, 44% 0%, 52% 0%, 65% 0%, 70% 0%, 76% 0%;
    --bubble-end: 2% 63%, 18% 40%, 30% 89%, 51% 53%, 63% 100%, 81% 33%, 100% 59%;
  }
  @keyframes services-conversation-bubbles {
    from { background-position: var(--bubble-start); }
    40% { opacity: 1; }
    to { background-position: var(--bubble-end); opacity: 0; }
  }
}
@media (max-width: 767px) {
  .section--services { --services-navigation-gap: 12px; }
  .section--services[data-enhanced] .wrap { display: grid; grid-template-columns: minmax(0, 1fr); }
  .section--services[data-enhanced] :is(.services-navigation, .services-conversation) { grid-area: 3 / 1; }
  .section--services[data-enhanced] .services-conversation { align-self: center; z-index: 1; }
  .section--services .wrap { width: min(600px, calc(100% - 40px)); }
  .service-pin { padding-block: 24px 16px; background: var(--canvas); }
  .section--services .section-head { margin-bottom: 20px; }
  .section--services h2 { font-size: 36px; }
  .service-scene { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); grid-template-rows: auto auto clamp(120px, 23svh, 180px); column-gap: 16px; }
  .service-scene__heading { margin-bottom: 20px; }
  .service-scene h3 { font-size: 24px; }
  .service-balloon { padding: 12px; }
  .service-balloon__caption { font-size: 9px; margin-bottom: 8px; letter-spacing: 0; }
  .service-speech { font-size: 14px; line-height: 1.45; }
  .service-character { width: calc((100% - 16px) / 2); height: clamp(120px, 23svh, 180px); }
  .service-character img, .service-character canvas { width: min(180px, 100%); }
}
@media (max-width: 767px) and (max-height: 680px) {
  .service-pin { padding-top: 12px; }
  .section--services .section-head { margin-bottom: 10px; }
  .section--services h2 { font-size: 30px; }
  .service-scene__heading { margin-bottom: 12px; }
  .service-scene h3 { font-size: 20px; }
  .service-scene { grid-template-rows: auto auto 100px; }
  .service-character { height: 100px; }
  .service-character img, .service-character canvas { width: 120px; }
}
@media (prefers-reduced-motion: reduce) {
  .section--services *, .section--services *::after { transition: none !important; animation: none !important; }
}

/* Inactive scenes reserve their dimensions so the presenter never shifts on a swap. */
[data-enhanced] .service-scenes { display: grid; }
[data-enhanced] .service-scene { grid-area: 1 / 1; }
.section--services[data-enhanced] .service-scene[hidden] { display: grid !important; visibility: hidden; pointer-events: none; }
@media (max-width: 340px) and (max-height: 680px) {
  .section--services .wrap { width: calc(100% - 24px); }
  .service-scene h3 { font-size: 18px; }
  .service-scene { grid-template-rows: auto auto 80px; }
  .service-character { height: 80px; }
  .service-character img, .service-character canvas { width: 104px; }
  .service-balloon { padding: 10px; }
}
/* Short landscape screens keep the stage compact at readable text sizes. */
@media (min-width: 520px) and (max-width: 767px) and (max-height: 520px) {
  .section--services { --services-navigation-gap: 4px; }
  .service-pin { padding-block: 4px; }
  .section--services .section-head { margin-bottom: 4px; }
  .section--services h2 { font-size: 24px; }
  .service-scene__heading { margin-bottom: 8px; }
  .service-scene h3 { font-size: 18px; }
  .service-scene { grid-template-rows: auto auto 72px; }
  .service-character { height: 72px; }
  .service-character img, .service-character canvas { width: 96px; }
  .service-balloon { padding: 8px; }
  .service-balloon__caption { margin-bottom: 4px; }
}

/* The hero departure owns the character until its fall has fully settled. */
[data-assistant-arrival="waiting"] .service-character,
[data-assistant-arrival="falling"] .service-character { visibility: hidden; }
.assistant-transfer-canvas { position: fixed; inset: 0; z-index: 5; width: 100%; height: 100%; pointer-events: none; }
@media (prefers-reduced-motion: reduce) { [data-assistant-arrival] .service-character { visibility: visible; } }

/* Extra transparent side space keeps presentation gloves inside the canvas. */
@media (max-width: 767px) { .service-character canvas { width: min(202.5px, 112.5%); } }
@media (max-width: 767px) and (max-height: 680px) { .service-character canvas { width: 135px; } }
@media (max-width: 340px) and (max-height: 680px) { .service-character canvas { width: 117px; } }
@media (min-width: 520px) and (max-width: 767px) and (max-height: 520px) { .service-character canvas { width: 108px; } }

/* Mobile stacks the balloon and presenter in one column. */
@media (max-width: 767px) {
  .section--services[data-enhanced] .service-scene {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto minmax(116px, auto) minmax(190px, auto);
    gap: 0;
  }
  .section--services[data-enhanced] .service-balloon {
    grid-area: 2 / 1; padding: 20px; align-self: start;
  }
  .section--services[data-enhanced] .service-speech { font-size: 17px; line-height: 1.5; }
  .section--services[data-enhanced] .service-balloon__caption { font-size: 10px; margin-bottom: 10px; }
  .section--services[data-enhanced] .service-character-space { grid-area: 3 / 1; }
  .section--services[data-enhanced] .service-character { width: 100%; height: 210px; }
  .section--services[data-enhanced] .service-character img { width: 156px; }
  .section--services[data-enhanced] .service-character canvas { width: 175.5px; height: 156px; }
  .section--services:not([data-enhanced]) .service-scene { display: flex; flex-direction: column; gap: 20px; }
}
@media (max-width: 767px) and (max-height: 680px) {
  .section--services[data-enhanced] .service-scene { grid-template-rows: auto minmax(96px, auto) minmax(160px, auto); }
  .section--services[data-enhanced] .service-balloon { padding: 16px; }
  .section--services[data-enhanced] .service-speech { font-size: 16px; }
  .section--services[data-enhanced] .service-character { height: 160px; }
}
