/* Fonte: reaproveitamos a mesma do painel (plugin Base Core), licença OFL — sem Google Fonts. */
@font-face {
  font-family: "Schibsted Grotesk";
  src: url("fonts/schibsted-grotesk.woff2") format("woff2");
  font-weight: 400 900;
  font-style: normal;
  font-display: swap;
}

  /* ---------- Tokens (sobrescritos pelo Personalizar) ---------- */
  :root {
    --mb-bg: #eef1f6;
    --mb-surface: #ffffff;
    --mb-text: #14182b;
    --mb-muted: #5d6478;
    --mb-accent: #2547f5;
    --mb-accent-contrast: #ffffff;
    --mb-accent-tint: #e4eaff;
    --mb-warm: #ff6b4a;
    --mb-line: #d5dae6;
    --mb-wa: #25d366;
    --mb-radius: 20px;
    --mb-radius-sm: 12px;
    --mb-font: "Schibsted Grotesk", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  }
  /* O Personalizar pode aplicar data-theme="dark" no <html> */
  :root[data-theme="dark"] {
    --mb-bg: #0f1220;
    --mb-surface: #1a1e33;
    --mb-text: #f1f3fb;
    --mb-muted: #a3aac2;
    --mb-accent-tint: #26305e;
    --mb-line: #2e3554;
  }

  /* ---------- Base ---------- */
  *, *::before, *::after { box-sizing: border-box; }
  [hidden] { display: none !important; }
  html { -webkit-text-size-adjust: 100%; }
  body {
    margin: 0;
    min-height: 100dvh;
    background: var(--mb-bg);
    color: var(--mb-text);
    font-family: var(--mb-font);
    font-size: 16px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
  }
  img, svg, video { display: block; max-width: 100%; }
  a { color: inherit; text-decoration: none; }
  button { font: inherit; color: inherit; cursor: pointer; }
  ul { list-style: none; margin: 0; padding: 0; }
  :focus-visible { outline: 3px solid var(--mb-accent); outline-offset: 3px; }
  .sr-only {
    position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0;
    overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
  }

  .page {
    width: 100%;
    max-width: 480px;
    margin: 0 auto;
    padding:
      calc(40px + env(safe-area-inset-top, 0px))
      20px
      calc(112px + env(safe-area-inset-bottom, 0px));
  }
  .page > * + * { margin-top: 32px; }

  /* ---------- Perfil ---------- */
  .profile { text-align: center; }
  .profile-photo {
    width: 112px; height: 112px;
    margin: 0 auto 20px;
    border-radius: 50%;
    object-fit: cover;
    background: var(--mb-accent-tint);
    box-shadow: 0 0 0 4px var(--mb-bg), 0 0 0 6px var(--mb-accent);
  }
  .profile-name {
    margin: 0;
    font-size: 1.75rem;
    line-height: 1.15;
    font-weight: 700;
    letter-spacing: -0.02em;
    text-wrap: balance;
  }
  .profile-description {
    max-width: 34ch;
    margin: 10px auto 0;
    color: var(--mb-muted);
    text-wrap: pretty;
  }

  .btn-more {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin-top: 10px;
    padding: 4px 2px;
    border: 0;
    background: none;
    color: var(--mb-accent);
    font-size: .875rem;
    font-weight: 600;
  }
  .btn-more svg {
    width: 14px;
    height: 14px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2.5;
    stroke-linecap: round;
    stroke-linejoin: round;
    transition: transform .15s ease;
  }
  .btn-more:hover svg { transform: translateX(2px); }

  .about-body { padding-left: 20px; padding-right: 20px; }
  .about-image {
    width: 100%;
    border-radius: var(--mb-radius-sm);
    margin-bottom: 16px;
  }
  .about-text { color: var(--mb-text); text-wrap: pretty; }
  .about-text p { margin: 0 0 14px; }
  .about-text p:last-child { margin-bottom: 0; }

  /* ---------- Stories ---------- */
  .stories-track {
    display: flex;
    gap: 16px;
    margin: 0 -20px;
    padding: 4px 20px;
    overflow-x: auto;
    scroll-snap-type: x proximity;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
  }
  .stories-track::-webkit-scrollbar { display: none; }
  .story {
    flex: 0 0 auto;
    width: 76px;
    padding: 0;
    border: 0;
    background: none;
    text-align: center;
    scroll-snap-align: start;
  }
  .story-ring {
    display: block;
    width: 76px; height: 76px;
    padding: 3px;
    border-radius: 50%;
    background: conic-gradient(from 210deg, var(--mb-accent), var(--mb-warm), var(--mb-accent));
  }
  .story-thumb {
    position: relative;
    display: grid;
    place-items: center;
    width: 100%; height: 100%;
    border: 3px solid var(--mb-bg);
    border-radius: 50%;
    background: var(--g, var(--mb-accent-tint));
    background-size: cover;
    background-position: center;
    color: #fff;
  }
  .story-thumb svg { width: 18px; height: 18px; fill: currentColor; filter: drop-shadow(0 1px 2px rgba(0,0,0,.35)); }
  .story-title {
    display: block;
    margin-top: 8px;
    font-size: 0.8125rem;
    line-height: 1.25;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .story.is-viewed .story-ring { background: var(--mb-line); }

  /* ---------- Links ---------- */
  .links { display: grid; gap: 12px; }
  .link {
    display: grid;
    grid-template-columns: 56px 1fr 20px;
    align-items: center;
    gap: 14px;
    min-height: 72px;
    padding: 10px 16px 10px 10px;
    background: var(--mb-surface);
    border: 1px solid var(--mb-line);
    border-radius: var(--mb-radius);
    transition: background-color .15s ease, border-color .15s ease;
  }
  .link--no-image { grid-template-columns: 1fr 20px; padding: 10px 16px 10px 20px; }

  /* Link em formato de imagem (banner): a imagem ocupa a largura toda do card */
  .link--banner { display: block; min-height: 0; padding: 0; overflow: hidden; }
  .link-cover {
    width: 100%;
    aspect-ratio: 3 / 1;
    object-fit: cover;
    background: var(--mb-accent-tint);
  }
  .link-banner-body {
    display: grid;
    grid-template-columns: 1fr 20px;
    align-items: center;
    gap: 14px;
    padding: 14px 16px 14px 20px;
  }
  .link:hover { background: var(--mb-accent-tint); border-color: var(--mb-accent); }
  .link-thumb {
    width: 56px; height: 56px;
    border-radius: var(--mb-radius-sm);
    object-fit: cover;
    background: var(--mb-accent-tint);
  }
  .link-text { min-width: 0; }
  .link-title {
    display: block;
    font-weight: 600;
    line-height: 1.25;
    overflow-wrap: anywhere;
  }
  .link-sub {
    display: block;
    margin-top: 2px;
    color: var(--mb-muted);
    font-size: 0.875rem;
    line-height: 1.3;
  }
  .link-icon { width: 18px; height: 18px; color: var(--mb-muted); transition: transform .15s ease, color .15s ease; }
  .link:hover .link-icon { color: var(--mb-accent); transform: translate(2px, -2px); }

  /* Link em destaque (opção no Personalizar) */
  .link--featured { background: var(--mb-accent); border-color: var(--mb-accent); color: var(--mb-accent-contrast); }
  .link--featured .link-sub, .link--featured .link-icon { color: color-mix(in srgb, var(--mb-accent-contrast) 78%, transparent); }
  .link--featured:hover { background: var(--mb-accent); filter: brightness(1.08); }
  .link--featured:hover .link-icon { color: var(--mb-accent-contrast); }

  /* ---------- Redes sociais ---------- */
  .social { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; }
  .social a {
    display: grid; place-items: center;
    width: 46px; height: 46px;
    border-radius: 50%;
    background: var(--mb-surface);
    border: 1px solid var(--mb-line);
    color: var(--mb-text);
    transition: background-color .15s ease, color .15s ease, border-color .15s ease;
  }
  .social a:hover { background: var(--mb-accent); border-color: var(--mb-accent); color: var(--mb-accent-contrast); }
  .social svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

  /* ---------- WhatsApp flutuante ---------- */
  .wa-float {
    position: fixed;
    right: calc(20px + env(safe-area-inset-right, 0px));
    bottom: calc(20px + env(safe-area-inset-bottom, 0px));
    z-index: 50;
    display: grid; place-items: center;
    width: 60px; height: 60px;
    border-radius: 50%;
    background: var(--mb-wa);
    color: #fff;
    box-shadow: 0 6px 18px rgba(20, 24, 43, .28);
  }
  .wa-float svg { width: 32px; height: 32px; fill: currentColor; }
  .wa-float::after {
    content: "";
    position: absolute; inset: 0;
    border-radius: 50%;
    border: 2px solid var(--mb-wa);
    opacity: 0;
    animation: wa-pulse 2.4s ease-out 1.5s 3;
  }
  @keyframes wa-pulse {
    0%   { transform: scale(1);   opacity: .7; }
    100% { transform: scale(1.6); opacity: 0; }
  }

  /* ---------- Visualizador de stories ---------- */
  .viewer {
    position: fixed; inset: 0; z-index: 100;
    display: grid; place-items: center;
    background: rgba(8, 10, 20, .92);
  }
  .viewer-stage {
    position: relative;
    width: min(100vw, calc(100dvh * 9 / 16));
    height: min(100dvh, calc(100vw * 16 / 9));
    background: #000;
    overflow: hidden;
    color: #fff;
  }
  @media (min-width: 560px) { .viewer-stage { border-radius: 20px; } }
  .viewer-video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
  .viewer-empty {
    position: absolute; inset: 0;
    display: grid; place-content: center; gap: 6px;
    padding: 32px; text-align: center;
    background: linear-gradient(160deg, #1d2450, #0b0e1f);
  }
  .viewer-empty p { margin: 0; }
  .viewer-empty p:first-child { font-size: 1.125rem; font-weight: 600; }
  .viewer-empty p:last-child { color: rgba(255,255,255,.7); font-size: .9375rem; }
  .viewer-top {
    position: absolute; top: 0; left: 0; right: 0; z-index: 3;
    padding: calc(12px + env(safe-area-inset-top, 0px)) 12px 24px;
    background: linear-gradient(rgba(0,0,0,.55), transparent);
    pointer-events: none;
  }
  .viewer-progress { display: flex; gap: 4px; }
  .viewer-progress .bar { flex: 1; height: 3px; border-radius: 3px; background: rgba(255,255,255,.35); overflow: hidden; }
  .viewer-progress .bar i { display: block; width: 0; height: 100%; background: #fff; }
  .viewer-head { display: flex; align-items: center; gap: 4px; margin-top: 10px; }
  .viewer-title { flex: 1; min-width: 0; font-weight: 600; font-size: .9375rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .viewer-btn {
    pointer-events: auto;
    display: grid; place-items: center;
    width: 40px; height: 40px;
    border: 0; border-radius: 50%;
    background: transparent;
    color: #fff;
  }
  .viewer-btn:hover { background: rgba(255,255,255,.16); }
  .viewer-btn svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
  .viewer-nav { position: absolute; top: 0; bottom: 0; z-index: 2; width: 34%; border: 0; background: transparent; }
  .viewer-nav--prev { left: 0; }
  .viewer-nav--next { right: 0; width: 66%; }

  /* ---------- Portfólio: link, painel deslizante e galeria ---------- */
  button.link { width: 100%; text-align: left; font: inherit; color: inherit; cursor: pointer; }
  .link--portfolio:hover .link-icon { transform: translateY(-2px); }

  .sheet {
    position: fixed; inset: 0; z-index: 200;
    visibility: hidden; pointer-events: none;
    transition: visibility 0s linear .32s;
  }
  .sheet.is-open { visibility: visible; pointer-events: auto; transition-delay: 0s; }
  .sheet-backdrop {
    position: absolute; inset: 0;
    background: rgba(8, 10, 20, .55);
    opacity: 0;
    transition: opacity .28s ease;
  }
  .sheet.is-open .sheet-backdrop { opacity: 1; }
  .sheet-panel {
    position: absolute; left: 0; right: 0; bottom: 0;
    width: 100%; max-width: 480px; max-height: 90dvh;
    margin: 0 auto;
    display: flex; flex-direction: column;
    background: var(--mb-surface);
    border-radius: 24px 24px 0 0;
    padding-bottom: env(safe-area-inset-bottom, 0px);
    transform: translateY(100%);
    transition: transform .32s cubic-bezier(.22, .8, .3, 1);
  }
  .sheet.is-open .sheet-panel { transform: translateY(0); }
  .sheet-panel.is-dragging { transition: none; }
  .sheet-head { padding: 10px 12px 4px 20px; touch-action: none; cursor: grab; }
  .sheet-grip { width: 40px; height: 4px; margin: 0 auto 10px; border-radius: 4px; background: var(--mb-line); }
  .sheet-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
  .sheet-title { margin: 0; font-size: 1.25rem; font-weight: 700; letter-spacing: -0.01em; }
  .sheet-close {
    display: grid; place-items: center;
    width: 40px; height: 40px;
    border: 0; border-radius: 50%;
    background: var(--mb-bg);
    color: var(--mb-text);
  }
  .sheet-close:hover { background: var(--mb-accent-tint); }
  .sheet-close svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
  .sheet-body { overflow-y: auto; overscroll-behavior: contain; padding: 8px 0 20px; }

  .cat-wrap { position: relative; }
  .cat-track {
    position: relative;
    display: flex; gap: 12px;
    padding: 4px 20px;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    scroll-padding-inline: 20px;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
  }
  .cat-track::-webkit-scrollbar { display: none; }
  .cat-item { flex: 0 0 min(68%, 260px); scroll-snap-align: start; }
  .cat {
    position: relative;
    display: block;
    width: 100%;
    aspect-ratio: 4 / 5;
    padding: 0;
    border: 0;
    border-radius: var(--mb-radius);
    overflow: hidden;
    background: var(--mb-accent-tint);
    color: #fff;
    text-align: left;
  }
  .cat img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
  .cat-text {
    position: absolute; left: 0; right: 0; bottom: 0;
    display: block;
    padding: 44px 16px 16px;
    background: linear-gradient(transparent, rgba(8, 10, 20, .74));
  }
  .cat-title { display: block; font-size: 1.125rem; font-weight: 700; line-height: 1.2; letter-spacing: -0.01em; }
  .cat-count { display: block; margin-top: 2px; font-size: .875rem; color: rgba(255, 255, 255, .84); }

  .cat-dots { display: flex; justify-content: center; gap: 2px; margin-top: 12px; }
  .cat-dot { position: relative; width: 22px; height: 22px; padding: 0; border: 0; background: none; }
  .cat-dot::after {
    content: "";
    position: absolute; top: 50%; left: 50%;
    width: 8px; height: 8px; margin: -4px 0 0 -4px;
    border-radius: 50%;
    background: var(--mb-line);
    transition: background-color .15s ease, transform .15s ease;
  }
  .cat-dot.is-active::after { background: var(--mb-accent); transform: scale(1.25); }

  .cat-arrow {
    display: none;
    position: absolute; top: 50%; z-index: 2;
    width: 40px; height: 40px; margin-top: -20px;
    place-items: center;
    border: 0; border-radius: 50%;
    background: var(--mb-surface);
    color: var(--mb-text);
    box-shadow: 0 2px 10px rgba(20, 24, 43, .28);
  }
  .cat-arrow--prev { left: 8px; }
  .cat-arrow--next { right: 8px; }
  .cat-arrow:disabled { opacity: 0; pointer-events: none; }
  .cat-arrow svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
  @media (hover: hover) and (pointer: fine) { .cat-arrow { display: grid; } }

  .lightbox {
    position: fixed; inset: 0; z-index: 300;
    display: grid; grid-template-rows: auto minmax(0, 1fr);
    background: rgba(6, 8, 16, .96);
    color: #fff;
    animation: lb-fade .18s ease-out;
  }
  @keyframes lb-fade { from { opacity: 0; } to { opacity: 1; } }
  .lb-top {
    display: flex; align-items: center; gap: 12px;
    padding: calc(10px + env(safe-area-inset-top, 0px)) 12px 10px 20px;
  }
  .lb-info { flex: 1; min-width: 0; display: flex; flex-direction: column; }
  .lb-title { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .lb-count { font-size: .8125rem; color: rgba(255, 255, 255, .7); }
  .lb-btn {
    display: grid; place-items: center;
    width: 44px; height: 44px;
    border: 0; border-radius: 50%;
    background: rgba(255, 255, 255, .12);
    color: #fff;
  }
  .lb-btn:hover { background: rgba(255, 255, 255, .22); }
  .lb-btn svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
  .lb-stage {
    position: relative;
    display: grid; grid-template-rows: minmax(0, 1fr) auto;
    place-items: center;
    margin: 0;
    padding: 0 16px calc(16px + env(safe-area-inset-bottom, 0px));
    min-height: 0;
    touch-action: pan-y;
  }
  .lb-img {
    max-width: 100%; max-height: 100%;
    width: auto; height: auto;
    object-fit: contain;
    border-radius: 8px;
    user-select: none;
    -webkit-user-drag: none;
  }
  .lb-img.is-in { animation: lb-photo .2s ease-out; }
  @keyframes lb-photo { from { opacity: 0; transform: scale(.98); } to { opacity: 1; transform: none; } }
  .lb-caption { max-width: 60ch; margin-top: 12px; font-size: .9375rem; text-align: center; color: rgba(255, 255, 255, .85); }
  .lb-nav { position: absolute; top: 50%; z-index: 2; margin-top: -22px; }
  .lb-nav--prev { left: 12px; }
  .lb-nav--next { right: 12px; }

  @media (prefers-reduced-motion: reduce) {
    .wa-float::after { animation: none; }
    .link, .link-icon, .social a { transition: none; }
    .sheet, .sheet-backdrop, .sheet-panel, .cat-dot::after { transition: none; }
    .lightbox, .lb-img.is-in { animation: none; }
  }
