/*
 * Página de artigo (artigo.php). Autossuficiente: o app.css compilado não contém várias
 * utilidades Tailwind usadas no PHP (max-w-3xl, mt-12...), então o layout vive aqui.
 * Usa os tokens de cor do tema definidos em app.css (--primary, --border, --card...).
 */

/* ---------- Estrutura ---------- */
.rr-wrap { max-width: 72rem; margin: 0 auto; padding: 0 1rem; }
.rr-main { padding: 1.25rem 0 3rem; }
.rr-col  { max-width: 52rem; margin-left: auto; margin-right: auto; padding: 0 1.125rem; } /* ~800px de texto: ~80-85 caracteres por linha */
.rr-wide { max-width: 60rem; margin-left: auto; margin-right: auto; padding: 0 1rem; }
@media (min-width: 768px) {
  .rr-wrap { padding: 0 1.5rem; }
  .rr-main { padding-top: 2rem; }
}

.rr-skip { position: absolute; left: -999px; top: 0; z-index: 60; padding: .75rem 1rem; background: hsl(var(--primary)); color: hsl(var(--primary-foreground)); border-radius: 0 0 .5rem 0; }
.rr-skip:focus { left: 0; }

.rr-progress { position: fixed; inset: 0 0 auto 0; height: 3px; z-index: 50; pointer-events: none; }
.rr-progress span { display: block; height: 100%; background: hsl(var(--primary)); transform: scaleX(0); transform-origin: 0 50%; }

.rr-main a:focus-visible, .rr-site-header a:focus-visible, .rr-site-footer a:focus-visible, .article-toc summary:focus-visible {
  outline: 2px solid hsl(var(--primary)); outline-offset: 3px; border-radius: 4px;
}

/* ---------- Cabeçalho e rodapé do site ---------- */
.rr-site-header { border-bottom: 1px solid hsl(var(--border) / .5); }
.rr-site-header-inner { display: flex; align-items: center; justify-content: space-between; min-height: 4.25rem; gap: 1rem; }
.rr-logo { height: 34px; width: auto; }
@media (min-width: 768px) { .rr-logo { height: 40px; } }
.rr-header-link { font-size: .875rem; font-weight: 500; color: hsl(var(--foreground) / .8); padding: .5rem 0; }
.rr-header-link:hover { color: hsl(var(--primary)); }

.rr-site-footer { margin-top: 3rem; border-top: 1px solid hsl(var(--border) / .5); background: hsl(var(--card)); }
.rr-site-footer-inner { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .75rem 1.5rem; padding-top: 1.75rem; padding-bottom: 1.75rem; font-size: .875rem; color: hsl(var(--muted-foreground)); }
.rr-site-footer nav { display: flex; flex-wrap: wrap; gap: .25rem 1.25rem; }
.rr-site-footer nav a { padding: .35rem 0; }
.rr-site-footer nav a:hover { color: hsl(var(--primary)); }

.rr-preview-banner { margin-bottom: 1.5rem; padding: .9rem 1.1rem; border-radius: .75rem; border: 1px solid hsl(var(--primary) / .5); background: hsl(var(--primary) / .1); font-size: .875rem; }

/* ---------- Cabeçalho do artigo ---------- */
.rr-breadcrumb ol { display: flex; flex-wrap: wrap; gap: .35rem; font-size: .8125rem; color: hsl(var(--muted-foreground)); }
.rr-breadcrumb li + li::before { content: "/"; margin-right: .35rem; opacity: .6; }
.rr-breadcrumb a:hover { color: hsl(var(--primary)); }
.rr-breadcrumb [aria-current] { color: hsl(var(--primary)); font-weight: 500; }

.rr-title {
  margin: .9rem 0 .85rem; font-family: Montserrat, system-ui, sans-serif; font-weight: 700;
  font-size: clamp(1.75rem, 1.15rem + 2.4vw, 2.6rem); line-height: 1.18; letter-spacing: -.015em;
  color: hsl(var(--foreground)); text-wrap: balance;
}
.rr-dek { font-size: 1.1rem; line-height: 1.6; color: hsl(var(--muted-foreground)); margin: 0 0 1.5rem; }
@media (min-width: 768px) { .rr-dek { font-size: 1.225rem; } }

.rr-byline { display: flex; align-items: flex-start; gap: .9rem; padding: 1rem 0; border-top: 1px solid hsl(var(--border) / .5); border-bottom: 1px solid hsl(var(--border) / .5); }
.rr-byline-avatar { width: 48px; height: 48px; border-radius: 999px; object-fit: cover; flex-shrink: 0; margin-top: .1rem; }
.rr-byline-text { min-width: 0; }
.rr-byline-name { display: flex; flex-wrap: wrap; align-items: center; gap: .25rem .6rem; font-weight: 600; color: hsl(var(--foreground)); }
.rr-byline-name a:hover { color: hsl(var(--primary)); }
.rr-byline-role { margin-top: .15rem; font-size: .8125rem; line-height: 1.45; color: hsl(var(--muted-foreground)); }
.rr-byline-meta { margin-top: .3rem; display: flex; flex-wrap: wrap; gap: .1rem .4rem; font-size: .8125rem; color: hsl(var(--muted-foreground)); }
/* No celular os itens quebram linha; sem os pontos, nenhuma linha termina com "·" solto */
@media (max-width: 479px) { .rr-byline-meta { gap: .1rem .9rem; } .rr-byline-meta > [aria-hidden] { display: none; } }

.rr-badge { display: inline-flex; align-items: center; gap: .3rem; padding: .15rem .55rem; border-radius: 999px; background: hsl(var(--primary) / .12); color: hsl(var(--primary)); font-size: .75rem; font-weight: 600; line-height: 1.4; }
.rr-nowrap { white-space: nowrap; }
.rr-badge-lg { flex-wrap: wrap; margin-top: .6rem; font-size: .8125rem; padding: .25rem .7rem; }

/* ---------- Capa ---------- */
.article-cover { margin-top: 1.75rem; margin-bottom: 2rem; }
.article-cover img { display: block; width: 100%; height: auto; aspect-ratio: 16 / 9; object-fit: cover; object-position: center 40%; border-radius: calc(var(--radius) + 4px); }
.article-cover-credit, .article-body figcaption { margin-top: .5rem; font-size: .78rem; line-height: 1.5; color: hsl(var(--muted-foreground)); }
.article-cover-credit a, .article-body figcaption a { color: inherit; text-decoration: underline; text-underline-offset: 2px; }

/* ---------- Sumário ---------- */
.article-toc { margin-bottom: 2rem; border: 1px solid hsl(var(--border) / .6); border-radius: var(--radius); background: hsl(var(--card)); }
.article-toc summary { display: flex; align-items: center; gap: .6rem; padding: .9rem 1.1rem; cursor: pointer; font-weight: 600; font-size: .9375rem; list-style: none; min-height: 44px; }
.article-toc summary::-webkit-details-marker { display: none; }
.article-toc summary::after { content: ""; margin-left: auto; width: .55rem; height: .55rem; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: rotate(45deg); transition: transform .2s; opacity: .7; }
.article-toc[open] summary::after { transform: rotate(-135deg); }
.article-toc-count { font-weight: 400; font-size: .8125rem; color: hsl(var(--muted-foreground)); }
.article-toc ol { list-style: decimal; margin: 0; padding: 0 1.1rem 1rem 2.4rem; font-size: .9rem; }
.article-toc li + li { margin-top: .2rem; }
.article-toc a { display: inline-block; padding: .2rem 0; color: hsl(var(--foreground) / .85); }
.article-toc a:hover { color: hsl(var(--primary)); }
.article-toc li::marker { color: hsl(var(--muted-foreground)); }

/* ---------- Corpo ---------- */
.article-body { color: hsl(var(--foreground) / .9); line-height: 1.75; font-size: 1.0625rem; overflow-wrap: break-word; }
@media (min-width: 768px) { .article-body { font-size: 1.125rem; } }
/* Coluna mais larga no desktop: fonte um pouco maior mantém a linha confortável */
@media (min-width: 1024px) { .article-body { font-size: 1.1875rem; line-height: 1.8; } }
.article-body > * + * { margin-top: 1.25rem; }
.article-body h2, .article-body h3, .article-body h4 {
  font-family: Montserrat, system-ui, sans-serif; font-weight: 700; line-height: 1.28;
  color: hsl(var(--foreground)); scroll-margin-top: 1.25rem; text-wrap: pretty;
}
.article-body h2 { font-size: 1.45rem; margin-top: 2.75rem; }
.article-body > h2:not(:first-child) { padding-top: 2.25rem; border-top: 1px solid hsl(var(--border) / .45); }
.article-body h3 { font-size: 1.2rem; margin-top: 2rem; }
.article-body h4 { font-size: 1.05rem; margin-top: 1.5rem; }
@media (min-width: 768px) { .article-body h2 { font-size: 1.75rem; } .article-body h3 { font-size: 1.3rem; } }
.article-body a { color: hsl(var(--primary)); text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px; }
.article-body a:hover { text-decoration-thickness: 2px; }
.article-body strong { color: hsl(var(--foreground)); font-weight: 600; }
.article-body ul, .article-body ol { padding-left: 1.4rem; }
.article-body ul { list-style: disc; }
.article-body ol { list-style: decimal; }
.article-body li + li { margin-top: .5rem; }
.article-body li::marker { color: hsl(var(--primary)); }
.article-body blockquote { border-left: 4px solid hsl(var(--primary)); padding: .25rem 0 .25rem 1.25rem; font-style: italic; color: hsl(var(--foreground) / .8); }
.article-body code { font-size: .9em; padding: .1rem .35rem; border-radius: .375rem; background: hsl(var(--secondary)); }
.article-body hr { border: 0; border-top: 1px solid hsl(var(--border)); margin: 2.5rem 0; }
.article-body .table-wrap { overflow-x: auto; }
.article-body table { width: 100%; border-collapse: collapse; font-size: .95rem; }
.article-body th, .article-body td { border: 1px solid hsl(var(--border)); padding: .6rem .8rem; text-align: left; vertical-align: top; }
.article-body th { background: hsl(var(--secondary) / .6); font-weight: 600; }

/* Imagens do corpo: nunca maiores que ~60% da tela; fotos em pé ficam estreitas e centralizadas (sem corte) */
.article-body figure { margin: 2rem auto; text-align: center; }
.article-body figure img { display: block; margin: 0 auto; width: auto; max-width: 100%; height: auto; max-height: min(60vh, 520px); border-radius: var(--radius); }
.article-body figcaption { text-align: center; }

/* ---------- Vídeo (:::video) ---------- */
.article-body .rr-video { margin: 2rem 0; text-align: left; }
.article-body .rr-video-link, .article-body .rr-video-frame { position: relative; display: block; width: 100%; aspect-ratio: 16 / 9; border-radius: var(--radius); overflow: hidden; background: #000; border: 0; }
.article-body .rr-video-link img { width: 100%; height: 100%; max-height: none; object-fit: cover; border-radius: 0; opacity: .85; transition: opacity .2s; }
.article-body .rr-video-link:hover img { opacity: 1; }
.article-body .rr-video-play { position: absolute; left: 50%; top: 50%; width: 68px; height: 48px; margin: -24px 0 0 -34px; border-radius: 12px; background: hsl(var(--primary)); box-shadow: 0 6px 20px rgb(0 0 0 / .35); }
.article-body .rr-video-play::after { content: ""; position: absolute; left: 27px; top: 14px; border-style: solid; border-width: 10px 0 10px 17px; border-color: transparent transparent transparent #fff; }
.article-body .rr-video-time { position: absolute; right: .6rem; bottom: .6rem; padding: .15rem .5rem; border-radius: .375rem; background: rgb(0 0 0 / .75); color: #fff; font-size: .8rem; font-weight: 600; }
.article-body .rr-video figcaption { text-align: left; }

/* ---------- Destaques (:::fisio, :::atualizacao, :::nota, :::alerta) ---------- */
.article-body .callout { margin-top: 1.5rem; padding: 1rem 1.15rem 1.15rem; border-radius: calc(var(--radius) + 2px); }
.article-body .callout + .callout { margin-top: 1rem; }
.article-body .callout > * + * { margin-top: .65rem; }
.article-body .callout-label {
  display: flex; flex-wrap: wrap; align-items: center; gap: .3rem .5rem;
  font-family: Inter, system-ui, sans-serif; font-size: .75rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; line-height: 1.3;
}
.article-body .callout-label img { width: 28px; height: 28px; border-radius: 999px; object-fit: cover; }
.article-body .callout-by { font-weight: 500; letter-spacing: 0; text-transform: none; font-size: .8125rem; color: hsl(var(--muted-foreground)); }
.article-body .callout-by::before { content: "·"; margin-right: .5rem; opacity: .7; }
@media (max-width: 479px) {
  /* Em tela estreita o nome vai para a linha de baixo, alinhado ao texto do rótulo */
  .article-body .callout-by { flex-basis: 100%; }
  .article-body .callout-expert .callout-by { padding-left: 36px; margin-top: -.35rem; }
  .article-body .callout-by::before { content: none; }
}
.article-body .callout-expert { background: hsl(var(--primary) / .07); border: 1px solid hsl(var(--primary) / .22); border-left: 4px solid hsl(var(--primary)); }
.article-body .callout-expert .callout-label { color: hsl(var(--primary)); }
.article-body .callout-update { background: hsl(var(--secondary) / .45); border: 1px dashed hsl(var(--border)); font-size: .95em; }
.article-body .callout-update .callout-label { color: hsl(var(--foreground) / .75); }
.article-body .callout-summary { background: hsl(var(--card)); border: 1px solid hsl(var(--border) / .8); border-top: 3px solid hsl(var(--primary)); }
.article-body .callout-summary .callout-label { color: hsl(var(--primary)); }
.article-body .callout-summary ul { margin-top: .4rem; }
.article-body .callout-note { background: hsl(var(--secondary) / .45); border-left: 4px solid hsl(var(--muted-foreground)); }
.article-body .callout-warning { background: hsl(38 92% 50% / .08); border: 1px solid hsl(38 92% 50% / .35); border-left: 4px solid hsl(38 92% 50%); }
.article-body .callout-warning .callout-label { color: hsl(38 92% 60%); }

/* ---------- Página do autor (/sobre) ---------- */
.rr-profile { display: flex; align-items: center; gap: 1.5rem; margin: 1rem 0 2rem; }
.rr-profile-photo { width: 140px; height: 140px; border-radius: 999px; object-fit: cover; flex-shrink: 0; border: 3px solid hsl(var(--primary) / .5); }
.rr-profile .rr-title { margin-top: 0; }
.rr-profile .rr-dek { margin-bottom: .5rem; }
@media (max-width: 599px) { .rr-profile { flex-direction: column; align-items: flex-start; } .rr-profile-photo { width: 112px; height: 112px; } }
.rr-muted { color: hsl(var(--muted-foreground)); font-size: .9em; }
.article-body .rr-inline-list { list-style: none; padding-left: 0; display: flex; flex-wrap: wrap; gap: .5rem 1.25rem; }
.article-body .rr-inline-list li + li { margin-top: 0; }

/* ---------- Compartilhar ---------- */
.rr-share { margin-top: 2.5rem; padding-top: 1.5rem; border-top: 1px solid hsl(var(--border) / .5); }
.rr-share-title { font-weight: 600; color: hsl(var(--foreground)); margin-bottom: .75rem; }
.rr-share-buttons { display: flex; flex-wrap: wrap; gap: .5rem; }
.rr-share-btn {
  display: inline-flex; align-items: center; gap: .45rem; min-height: 44px; padding: .5rem .95rem;
  border-radius: 999px; border: 1px solid hsl(var(--border)); background: hsl(var(--card));
  color: hsl(var(--foreground)); font-size: .875rem; font-weight: 500; cursor: pointer;
  transition: border-color .2s, color .2s;
}
.rr-share-btn:hover { border-color: hsl(var(--primary)); color: hsl(var(--primary)); }
.rr-share-btn:focus-visible { outline: 2px solid hsl(var(--primary)); outline-offset: 2px; }
.rr-share-whatsapp { background: #1f7a4d; border-color: #1f7a4d; color: #fff; }
.rr-share-whatsapp:hover { background: #25a162; border-color: #25a162; color: #fff; }
.rr-share-status { min-height: 1.25rem; margin-top: .5rem; font-size: .8125rem; color: hsl(var(--primary)); }
.rr-author-name a:hover { color: hsl(var(--primary)); }

/* ---------- Seções finais ---------- */
.rr-section { margin-top: 3rem; }
.rr-section-title { font-family: Montserrat, system-ui, sans-serif; font-weight: 700; font-size: 1.4rem; line-height: 1.3; color: hsl(var(--foreground)); }
.article-faq .rr-section-title, .article-refs .rr-section-title { margin-bottom: .75rem; }
.article-faq details { border-bottom: 1px solid hsl(var(--border) / .6); }
.article-faq summary { cursor: pointer; padding: .9rem 0; font-weight: 600; color: hsl(var(--foreground)); min-height: 44px; }
.article-faq details p { padding-bottom: 1rem; color: hsl(var(--foreground) / .85); line-height: 1.7; }
.article-refs ol { list-style: decimal; padding-left: 1.25rem; font-size: .875rem; color: hsl(var(--muted-foreground)); }
.article-refs li + li { margin-top: .5rem; }
.article-refs a { color: hsl(var(--primary)); word-break: break-word; }

.rr-author-box { display: flex; align-items: flex-start; gap: 1.1rem; padding: 1.4rem; border-radius: 1rem; background: hsl(var(--card)); border: 1px solid hsl(var(--border) / .6); }
.rr-author-photo { width: 72px; height: 72px; border-radius: 999px; object-fit: cover; flex-shrink: 0; }
.rr-eyebrow { font-size: .72rem; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: hsl(var(--muted-foreground)); }
.rr-author-name { margin-top: .15rem; font-family: Montserrat, system-ui, sans-serif; font-size: 1.2rem; font-weight: 700; color: hsl(var(--foreground)); }
.rr-author-role { margin-top: .2rem; font-size: .875rem; line-height: 1.5; color: hsl(var(--muted-foreground)); }
.rr-author-bio { margin-top: .75rem; font-size: .9rem; line-height: 1.65; color: hsl(var(--foreground) / .82); }
.rr-button {
  display: inline-flex; align-items: center; min-height: 44px; margin-top: 1rem; padding: .6rem 1.1rem;
  border-radius: .75rem; border: 1px solid hsl(var(--primary)); color: hsl(var(--primary)); font-weight: 600; font-size: .9rem;
  transition: background-color .2s, color .2s;
}
.rr-button:hover { background: hsl(var(--primary)); color: hsl(var(--primary-foreground)); }
@media (max-width: 479px) { .rr-author-box { flex-direction: column; } }

.rr-disclaimer { margin-top: 1.25rem; padding: .9rem 1.1rem; border-left: 3px solid hsl(var(--border)); background: hsl(var(--secondary) / .3); border-radius: 0 .5rem .5rem 0; font-size: .8125rem; line-height: 1.6; color: hsl(var(--muted-foreground)); }
.rr-disclaimer strong { color: hsl(var(--foreground)); }

/* ---------- Continue lendo ---------- */
.rr-related { margin-top: 3.5rem; padding-top: 2rem; border-top: 1px solid hsl(var(--border) / .5); }
.rr-related-head { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; margin-bottom: 1.25rem; }
.rr-related-all { font-size: .875rem; font-weight: 600; color: hsl(var(--primary)); padding: .5rem 0; white-space: nowrap; }
.rr-related-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(16rem, 1fr)); gap: 1.25rem; }
.rr-card { display: flex; flex-direction: column; overflow: hidden; border-radius: 1rem; background: hsl(var(--card)); border: 1px solid hsl(var(--border) / .6); transition: transform .2s, border-color .2s; }
.rr-card:hover { transform: translateY(-2px); border-color: hsl(var(--primary) / .5); }
.rr-card:focus-visible { outline: 2px solid hsl(var(--primary)); outline-offset: 3px; }
.rr-card-media { aspect-ratio: 16 / 9; background: linear-gradient(135deg, hsl(var(--primary) / .28), hsl(var(--secondary)) 70%); display: flex; align-items: center; justify-content: center; overflow: hidden; }
.rr-card-media img { width: 100%; height: 100%; object-fit: cover; }
.rr-card-fallback { font-family: Montserrat, system-ui, sans-serif; font-weight: 700; font-size: 1.1rem; letter-spacing: .04em; text-transform: uppercase; color: hsl(var(--foreground) / .8); }
.rr-card-body { padding: 1rem 1.1rem 1.15rem; }
.rr-card-cat { font-size: .75rem; font-weight: 600; color: hsl(var(--primary)); }
.rr-card-title { margin-top: .35rem; font-family: Montserrat, system-ui, sans-serif; font-weight: 600; font-size: 1rem; line-height: 1.4; color: hsl(var(--foreground)); display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.rr-card:hover .rr-card-title { color: hsl(var(--primary)); }

/* ---------- Ampliar imagem (lightbox nativo com <dialog>) ---------- */
.rr-zoomable { cursor: zoom-in; }
.rr-zoomable:focus-visible { outline: 3px solid hsl(var(--primary)); outline-offset: 3px; }
dialog.rr-lightbox { padding: 0; border: 0; background: transparent; max-width: 96vw; max-height: 96vh; overflow: visible; }
dialog.rr-lightbox::backdrop { background: rgb(0 0 0 / .85); }
dialog.rr-lightbox img { display: block; max-width: 96vw; max-height: 88vh; width: auto; height: auto; border-radius: .5rem; cursor: zoom-out; }
dialog.rr-lightbox p { margin-top: .5rem; text-align: center; font-size: .8125rem; color: #e5e7eb; }
dialog.rr-lightbox button { position: absolute; top: -2.75rem; right: 0; width: 2.5rem; height: 2.5rem; border-radius: 999px; background: rgb(255 255 255 / .15); color: #fff; font-size: 1.35rem; line-height: 1; cursor: pointer; }

@media (prefers-reduced-motion: reduce) {
  .rr-card, .article-toc summary::after, .rr-button { transition: none; }
  .rr-card:hover { transform: none; }
}
