/* ============================================================
   SEGUIU — HEADER PÚBLICO (sg-header.css)
   Carregar DEPOIS do style.css em todas as páginas públicas.
   ============================================================ */

/* O style.css usa overflow-x: hidden !important em html/body, o que
   impede o header "grudar" no topo (position: sticky). "clip" corta o
   vazamento lateral do mesmo jeito, sem quebrar o sticky. */
html, body, body.sg-home { overflow-x: clip !important; }

.sg-hd {
  --hd-primary: var(--primary, #6701E6);
  --hd-primary-dark: var(--primary-dark, #4701A1);
  --hd-primary-soft: var(--primary-soft, #F4EBFF);
  --hd-primary-border: var(--primary-border, #E0CBFA);
  --hd-ink: var(--ink, #1B1533);
  --hd-muted: var(--muted, #66627A);
  --hd-edge: var(--edge, #DCE0E8);
  --hd-line: var(--card-line, #E5E7EB);
  --hd-subtle: var(--section-alt, #F6F7FA);
  --hd-font: 'Open Runde', var(--font-main, 'Roboto'), system-ui, sans-serif;
  --hd-ease: cubic-bezier(.16, 1, .3, 1);
  --hd-ease-io: cubic-bezier(.45, 0, .2, 1);
  --hd-state: .25s;          /* voltar ao topo */
  --hd-move: .38s;           /* virar flutuante */
  --hd-quick: .18s;
  --hd-h: 72px;              /* altura em repouso */
  --hd-float-h: 64px;        /* altura flutuante */
  --hd-inset: 12px;          /* distância do topo quando flutua */
  --hd-shell: 1240px;        /* largura máxima do conteúdo */
  --hd-inset-x: max(16px, calc((100% - var(--hd-shell)) / 2 + 4px));
  --hd-radius: 18px;
  --hd-shift: calc(var(--hd-inset) + (var(--hd-float-h) - var(--hd-h)) / 2);

  position: sticky; top: 0; z-index: 100;
  height: var(--hd-h);
  font-family: var(--hd-font); color: var(--hd-ink);
}
.sg-hd *, .sg-hd *::before, .sg-hd *::after { box-sizing: border-box; }
.sg-hd a { text-decoration: none; color: inherit; }
.sg-hd ul { list-style: none; margin: 0; padding: 0; }

/* Camada de fundo: em repouso ocupa a largura toda; flutuando vira uma barra arredondada */
.sg-hd__bg {
  position: absolute; top: 0; left: 0; right: 0; height: var(--hd-h);
  background: #FFFFFF;
  border: 1px solid transparent;
  border-bottom: 2px solid var(--hd-edge);
  border-radius: 0;
}
.sg-hd__row {
  position: relative; z-index: 1;
  height: var(--hd-h); max-width: var(--hd-shell); margin: 0 auto; padding: 0 28px;
  display: flex; align-items: center; gap: 36px;
}
.sg-hd.is-float .sg-hd__bg, .sg-hd.is-open .sg-hd__bg {
  top: var(--hd-inset); left: var(--hd-inset-x); right: var(--hd-inset-x);
  height: var(--hd-float-h);
  border-radius: var(--hd-radius);
  border-color: var(--hd-line);
  border-bottom: 4px solid var(--hd-edge);
}
.sg-hd.is-float .sg-hd__row, .sg-hd.is-open .sg-hd__row { transform: translateY(var(--hd-shift)); }

/* Movimento só depois do primeiro frame (sem animar no carregamento) */
.sg-hd.has-motion .sg-hd__bg {
  transition: top var(--hd-state) var(--hd-ease), left var(--hd-state) var(--hd-ease), right var(--hd-state) var(--hd-ease),
              height var(--hd-state) var(--hd-ease), border-radius var(--hd-state) var(--hd-ease), border-color 0s var(--hd-state);
}
.sg-hd.has-motion .sg-hd__row { transition: transform var(--hd-state) var(--hd-ease); }
.sg-hd.has-motion:is(.is-float, .is-open) .sg-hd__bg {
  transition: top var(--hd-move) var(--hd-ease), left var(--hd-move) var(--hd-ease), right var(--hd-move) var(--hd-ease),
              height var(--hd-move) var(--hd-ease), border-radius var(--hd-move) var(--hd-ease), border-color 0s;
}
.sg-hd.has-motion:is(.is-float, .is-open) .sg-hd__row { transition: transform var(--hd-move) var(--hd-ease); }

/* Logo (SVG inline da Seguiu): no hover o pingo do "i" dá um pulinho */
.sg-hd__logo { display: flex; align-items: center; min-height: 44px; flex: none; border-radius: 6px; }
.sg-hd__logo svg { display: block; height: 34px; width: auto; fill: var(--hd-logo, #6A40E4); overflow: visible; }
.sg-hd__logo .sg-logo__dot { transform-box: fill-box; transform-origin: 50% 100%; }
.sg-hd__logo:hover .sg-logo__dot { animation: sg-dot-hop .62s var(--hd-ease); }
@keyframes sg-dot-hop {
  0% { transform: none; }
  30% { transform: translateY(-38%) scale(1.08, .94); }
  55% { transform: translateY(0) scale(1.12, .86); }
  75% { transform: translateY(-8%) scale(.97, 1.03); }
  100% { transform: none; }
}

/* Navegação */
.sg-hd__nav { display: flex; align-items: center; gap: 30px; flex: 1; min-width: 0; }
.sg-hd__link {
  display: inline-flex; align-items: center; gap: 6px; min-height: 44px;
  background: none; border: 0; padding: 0; cursor: pointer; white-space: nowrap;
  font: 500 15px/20px var(--hd-font); color: var(--hd-ink);
  transition: color .12s var(--hd-ease);
}
.sg-hd__link:hover { color: var(--hd-primary); }
.sg-hd__link[aria-current="page"], .sg-hd__link[aria-expanded="true"] { font-weight: 600; }
.sg-hd__link > svg { width: 16px; height: 16px; color: var(--hd-muted); transition: transform var(--hd-quick) var(--hd-ease); }
.sg-hd__link[aria-expanded="true"] > svg { transform: rotate(180deg); color: var(--hd-ink); }
.sg-hd :is(a, button):focus-visible { outline: 2px solid var(--hd-primary); outline-offset: 3px; }

/* Ações à direita */
.sg-hd__actions { display: flex; align-items: center; gap: 12px; margin-left: auto; }
.sg-hd__cta {
  display: inline-flex; align-items: center; gap: 8px; height: 44px; padding: 0 18px;
  border-radius: 12px; background: var(--hd-primary); color: #FFFFFF !important;
  border: 1px solid var(--hd-primary); border-bottom: 3px solid var(--hd-primary-dark);
  font: 700 14.5px/1 var(--hd-font); white-space: nowrap;
  transition: background-color .15s ease, transform .12s var(--hd-ease), border-bottom-width .12s var(--hd-ease);
}
.sg-hd__cta:hover { background: #7412FF; }
.sg-hd__cta:active { transform: translateY(2px); border-bottom-width: 1px; }
.sg-hd__icon {
  position: relative; width: 44px; height: 44px; flex: none;
  display: inline-flex; align-items: center; justify-content: center; padding: 0; cursor: pointer;
  border-radius: 12px; background: #FFFFFF; color: var(--hd-ink);
  border: 1px solid var(--hd-edge); border-bottom-width: 3px;
  transition: background-color .12s ease, transform .12s var(--hd-ease), border-bottom-width .12s var(--hd-ease);
}
.sg-hd__icon svg { width: 20px; height: 20px; }
.sg-hd__icon:hover { background: var(--hd-subtle); }
.sg-hd__icon:active, .sg-hd__icon[aria-expanded="true"] { transform: translateY(2px); border-bottom-width: 1px; background: var(--hd-subtle); }

/* ---------- Menu "Serviços" (desktop) ---------- */
.sg-hd__item { position: relative; }
.sg-menu {
  position: absolute; top: calc(50% + var(--hd-h) / 2 + 6px); left: -22px; width: 384px;
  visibility: hidden; pointer-events: none;
}
.sg-hd.is-float .sg-menu { top: calc(50% + var(--hd-float-h) / 2 + 6px); }
.sg-menu.is-open { visibility: visible; pointer-events: auto; }
.sg-menu__card {
  position: relative; padding: 6px;
  background: #FFFFFF; border: 1px solid var(--hd-line); border-bottom: 4px solid var(--hd-edge);
  border-radius: 18px;
  clip-path: inset(0 0 100% 0 round 18px);
  transition: clip-path var(--hd-quick) var(--hd-ease-io);
}
.sg-menu.is-open .sg-menu__card { clip-path: inset(0 0 0 0 round 18px); transition: clip-path var(--hd-state) var(--hd-ease); }
/* destaque que desliza atrás do item sob o mouse */
.sg-menu__pill {
  position: absolute; left: 6px; right: 6px; top: 0; height: 0;
  border-radius: 12px; background: var(--hd-primary-soft);
  opacity: 0; pointer-events: none;
  transition: transform var(--hd-quick) var(--hd-ease), height var(--hd-quick) var(--hd-ease), opacity .12s ease;
}
.sg-menu__pill.is-on { opacity: 1; }
.sg-menu__pill.no-slide { transition: opacity .12s ease; }
.sg-menu__link {
  position: relative; display: flex; align-items: center; gap: 12px;
  min-height: 58px; padding: 8px 12px; border-radius: 12px;
}
.sg-menu__ico {
  width: 36px; height: 36px; flex: none; display: grid; place-items: center;
  border-radius: 10px; background: var(--hd-primary-soft); color: var(--hd-primary);
  transition: background-color .15s ease, color .15s ease;
}
.sg-menu__ico svg { width: 18px; height: 18px; }
.sg-menu__link:hover .sg-menu__ico, .sg-menu__link[aria-current="page"] .sg-menu__ico { background: var(--hd-primary); color: #FFFFFF; }
.sg-menu__txt { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.sg-menu__name { font: 600 15px/1.2 var(--hd-font); color: var(--hd-ink); }
.sg-menu__desc { font: 400 13px/1.3 var(--hd-font); color: var(--hd-muted); }
.sg-menu__go { width: 16px; height: 16px; margin-left: auto; color: var(--hd-primary); opacity: 0; transform: translateX(-4px); transition: opacity .12s ease, transform .18s var(--hd-ease); }
.sg-menu__link:hover .sg-menu__go { opacity: 1; transform: none; }
.sg-menu__sep { height: 1px; margin: 6px 12px; background: var(--hd-line); }
.sg-menu__foot { white-space: nowrap; display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 8px 12px 6px; font: 500 13px/1.3 var(--hd-font); color: var(--hd-muted); }
.sg-menu__foot a { color: var(--hd-primary); font-weight: 600; }

/* ---------- Mobile ---------- */
.sg-hd__burger { display: none; }
.sg-hd__burger line { transform-box: view-box; transform-origin: 12px 12px; transition: transform var(--hd-state) var(--hd-ease), opacity .15s ease; }
.sg-hd__burger[aria-expanded="true"] .l1 { transform: rotate(45deg) translateY(6px); }
.sg-hd__burger[aria-expanded="true"] .l2 { opacity: 0; }
.sg-hd__burger[aria-expanded="true"] .l3 { transform: rotate(-45deg) translateY(-6px); }
.sg-sheet, .sg-scrim { display: none; }

@media (max-width: 767px) {
  .sg-hd { --hd-h: 64px; --hd-float-h: 60px; --hd-inset: 10px; --hd-inset-x: 10px; --hd-radius: 20px; }
  .sg-hd__row { padding: 0 12px 0 24px; gap: 8px; }
  .sg-hd.is-float .sg-hd__row, .sg-hd.is-open .sg-hd__row { padding-left: 22px; padding-right: 20px; }
  .sg-hd__logo svg { height: 28px; }
  .sg-hd__nav, .sg-hd__cta { display: none; }
  .sg-hd__actions { gap: 8px; }
  .sg-hd__burger { display: inline-flex; }

  .sg-scrim {
    display: block; position: fixed; inset: 0; z-index: -1;
    background: rgba(27, 21, 51, .38);
    opacity: 0; visibility: hidden; transition: opacity var(--hd-state) var(--hd-ease), visibility var(--hd-state);
  }
  .sg-hd.is-open .sg-scrim { opacity: 1; visibility: visible; }

  .sg-sheet {
    display: block; position: absolute; z-index: 2;
    top: calc(var(--hd-inset) + var(--hd-float-h) + 8px); left: var(--hd-inset-x); right: var(--hd-inset-x);
    max-height: calc(100dvh - var(--hd-inset) * 2 - var(--hd-float-h) - 8px); overflow-y: auto; overscroll-behavior: contain;
    padding: 8px; background: #FFFFFF;
    border: 1px solid var(--hd-line); border-bottom: 4px solid var(--hd-edge); border-radius: 20px;
    visibility: hidden; pointer-events: none;
    clip-path: inset(0 0 100% 0 round 20px);
    transition: clip-path var(--hd-quick) var(--hd-ease-io), visibility 0s var(--hd-quick);
  }
  .sg-hd.is-open .sg-sheet { visibility: visible; pointer-events: auto; clip-path: inset(0 0 0 0 round 20px); transition: clip-path var(--hd-move) var(--hd-ease), visibility 0s; }
  .sg-sheet > * { opacity: 0; transform: translateY(-8px); transition: opacity .12s ease, transform .12s ease; }
  .sg-hd.is-open .sg-sheet > * { opacity: 1; transform: none; transition: opacity .22s ease, transform .3s var(--hd-ease); transition-delay: calc(60ms + var(--k, 0) * 30ms); }

  .sg-sheet__row {
    width: 100%; display: flex; align-items: center; gap: 12px; min-height: 52px; padding: 0 12px;
    background: none; border: 0; border-radius: 12px; cursor: pointer; text-align: left;
    font: 600 16px/1.2 var(--hd-font); color: var(--hd-ink);
  }
  .sg-sheet__row + .sg-sheet__row, .sg-sheet__acc + .sg-sheet__row { border-top: 1px solid var(--hd-line); border-radius: 0; }
  .sg-sheet__row > svg:last-child { width: 18px; height: 18px; margin-left: auto; color: var(--hd-muted); transition: transform var(--hd-state) var(--hd-ease); }
  .sg-sheet__row[aria-expanded="true"] > svg:last-child { transform: rotate(180deg); color: var(--hd-ink); }
  .sg-sheet__row:active { background: var(--hd-subtle); }
  .sg-sheet__panel { display: grid; grid-template-rows: 0fr; transition: grid-template-rows var(--hd-state) var(--hd-ease); }
  .sg-sheet__panel > div { overflow: hidden; }
  .sg-sheet__row[aria-expanded="true"] + .sg-sheet__panel { grid-template-rows: 1fr; }
  .sg-sheet__panel ul { padding: 0 4px 8px; }
  .sg-sheet .sg-menu__link { min-height: 56px; }
  .sg-sheet .sg-menu__link[aria-current="page"] { background: var(--hd-primary-soft); }
  .sg-sheet__cta { margin-top: 8px; width: 100%; justify-content: center; height: 50px; display: inline-flex !important; }
}
html.sg-lock { overflow: hidden; }

@media (prefers-reduced-motion: reduce) {
  .sg-hd *, .sg-hd *::before, .sg-hd *::after, .sg-hd .sg-hd__bg { transition: none !important; animation: none !important; }
}
