/* Algesya — folha de estilo única do site.
   Paleta espelha o tema do app (ff_theme): primary #26A69A. */

:root {
  --primary: #26A69A;
  --primary-dark: #1E8880;
  --primary-soft: #E6F4F3;
  --secondary: #42A5F5;
  --tertiary: #80CBC4;

  --text: #181818;
  --text-muted: #5A5F5E;
  --bg: #FFFFFF;
  --bg-alt: #F6F6F6;
  --surface: #FCFCFC;
  --border: #DADADA;
  --muted: #DADADA;

  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 16px;
  --max-width: 1080px;
  --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    "Helvetica Neue", Arial, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --primary-soft: #16302E;
    --text: #FFFFFF;
    --text-muted: #B4B8B7;
    --bg: #181818;
    --bg-alt: #202020;
    --surface: #1B1B1B;
    --border: #2C2C2C;
    --muted: #2C2C2C;
  }
}

*,
*::before,
*::after { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  /* o cabeçalho é fixo: sem isto as âncoras param atrás dele */
  scroll-padding-top: 92px;
  -webkit-text-size-adjust: 100%;
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}

body {
  margin: 0;
  font-family: var(--font);
  font-size: 17px;
  line-height: 1.65;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: rgba(38, 166, 154, 0.16);
  overflow-wrap: break-word;
}

.container {
  width: 100%;
  max-width: var(--max-width);
  margin: 0 auto;
  padding-inline: 20px;
}

a { color: var(--primary-dark); }
@media (prefers-color-scheme: dark) { a { color: var(--tertiary); } }

:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 3px;
  border-radius: var(--radius-sm);
}

h1, h2, h3 {
  line-height: 1.25;
  letter-spacing: -0.02em;
  margin: 0 0 12px;
  text-wrap: balance;
}
h1 { font-size: clamp(2rem, 5vw, 3rem); font-weight: 700; }
h2 { font-size: clamp(1.5rem, 3.5vw, 2rem); font-weight: 700; }
h3 { font-size: 1.125rem; font-weight: 600; }
p  { margin: 0 0 16px; }

/* ---------- cabeçalho ---------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}

.site-header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 68px;
  flex-wrap: wrap;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 1.2rem;
  color: var(--text);
  text-decoration: none;
  letter-spacing: -0.01em;
}

.brand img { width: 34px; height: auto; display: block; }

.site-nav {
  display: flex;
  align-items: center;
  gap: 8px 20px;
  flex-wrap: wrap;
}

.site-nav a {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.95rem;
  font-weight: 500;
}

.site-nav a:hover { color: var(--primary-dark); }
@media (prefers-color-scheme: dark) { .site-nav a:hover { color: var(--tertiary); } }

/* ---------- hero ---------- */

.hero {
  padding-block: 72px 56px;
  background: linear-gradient(180deg, var(--primary-soft) 0%, var(--bg) 100%);
}

.hero-grid {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 48px;
  align-items: center;
}

.eyebrow {
  display: inline-block;
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--primary-dark);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 4px 14px;
  margin-bottom: 20px;
}
@media (prefers-color-scheme: dark) { .eyebrow { color: var(--tertiary); } }

.lead { font-size: 1.15rem; color: var(--text-muted); max-width: 52ch; }

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 16px;
  margin-top: 28px;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 22px;
  border-radius: var(--radius-md);
  font-weight: 600;
  font-size: 0.98rem;
  text-decoration: none;
  border: 1px solid transparent;
}

.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); color: #fff; }

.btn-ghost {
  background: transparent;
  color: var(--text);
  border-color: var(--border);
}
.btn-ghost:hover { border-color: var(--primary); color: var(--primary-dark); }
@media (prefers-color-scheme: dark) { .btn-ghost:hover { color: var(--tertiary); } }

.btn-disabled {
  background: var(--bg-alt);
  color: var(--text-muted);
  border-color: var(--border);
  cursor: default;
}

.hero-note { font-size: 0.85rem; color: var(--text-muted); margin: 0; }

/* ---------- ilustração do app ----------
   Reproduz a tela "Sessões de dor": barra superior, cartões de sessão com o
   gráfico de intensidade e os botões de ação flutuantes. */

.phone {
  position: relative;
  width: min(300px, 100%);
  margin-inline: auto;
  border: 10px solid #222;
  border-radius: 34px;
  background: var(--bg);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.18);
  overflow: hidden;
  font-size: 13px;
  line-height: 1.4;
}

/* barra superior: ícone da página + título + tema/menu */
.app-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 14px 12px 12px;
  background: var(--surface);
}

.app-bar-title {
  flex: 1;
  font-size: 15px;
  font-weight: 400;
  letter-spacing: -0.01em;
}

.app-bar svg { width: 18px; height: 18px; }
.app-bar > svg { color: var(--tertiary); }

.icon-btn {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: var(--radius-sm);
  background: var(--muted);
  color: var(--text);
  flex: none;
}
.icon-btn svg { width: 14px; height: 14px; }

.app-list {
  padding: 12px;
  display: grid;
  gap: 12px;
  background: var(--bg);
}

/* cartão de sessão de dor */
.sess-card {
  background: var(--bg-alt);
  border-radius: var(--radius-lg);
  padding: 12px;
}

.sess-head {
  display: flex;
  align-items: center;
  gap: 8px;
}

.sess-title {
  flex: 1;
  font-size: 15px;
  font-weight: 500;
  letter-spacing: -0.01em;
}

.sess-timer {
  font-size: 12px;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

.sess-chart { display: block; width: 100%; height: auto; margin: 10px 0; }
.sess-chart .axis { fill: var(--text-muted); font-size: 7px; }
.sess-chart .grid-line { stroke: var(--border); stroke-width: 0.6; }

.sess-actions { display: flex; gap: 8px; }

.app-btn {
  flex: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 30px;
  border-radius: var(--radius-md);
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
}
.app-btn svg { width: 13px; height: 13px; }
.app-btn.is-primary { background: var(--primary); color: #fff; }
.app-btn.is-muted { background: var(--muted); color: var(--text); }
.app-btn.is-secondary { background: var(--secondary); color: #fff; }

/* botões flutuantes do canto inferior direito */
.app-fabs {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
  padding: 4px 12px 16px;
  background: var(--bg);
}
.app-fabs .app-btn { flex: none; padding-inline: 14px; }

.phone-caption {
  text-align: center;
  font-size: 0.8rem;
  color: var(--text-muted);
  margin: 14px 0 0;
}

/* ---------- seções ---------- */

section { padding-block: 64px; }

.section-alt { background: var(--bg-alt); }

.section-head { max-width: 62ch; margin-bottom: 36px; }
.section-head p { color: var(--text-muted); margin-bottom: 0; }

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 20px;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
}

.card p { color: var(--text-muted); margin-bottom: 0; font-size: 0.97rem; }

.card-icon {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border-radius: var(--radius-md);
  background: var(--primary-soft);
  color: var(--primary-dark);
  margin-bottom: 14px;
}
.card-icon svg { width: 22px; height: 22px; }
@media (prefers-color-scheme: dark) { .card-icon { color: var(--tertiary); } }

.steps {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 28px;
  counter-reset: step;
  list-style: none;
  margin: 0;
  padding: 0;
}

.steps li { counter-increment: step; }

.steps li::before {
  content: counter(step);
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  font-weight: 700;
  font-size: 0.95rem;
  margin-bottom: 12px;
}

.steps p { color: var(--text-muted); margin-bottom: 0; font-size: 0.97rem; }

.faq { max-width: 72ch; }

.faq details {
  border-bottom: 1px solid var(--border);
  padding: 16px 0;
}

.faq summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 44px;
  cursor: pointer;
  font-weight: 600;
  list-style: none;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after {
  content: "+";
  flex: none;
  color: var(--primary);
  font-weight: 700;
  font-size: 1.3rem;
  line-height: 1;
}
.faq details[open] summary::after { content: "–"; }
.faq details p {
  margin: 12px 0 0;
  color: var(--text-muted);
  font-size: 0.97rem;
}

.callout {
  border: 1px solid var(--border);
  border-left: 4px solid var(--primary);
  border-radius: var(--radius-md);
  background: var(--surface);
  padding: 18px 22px;
}
.callout p:last-child { margin-bottom: 0; }

/* ---------- páginas de texto ---------- */

.doc { padding-block: 56px 72px; }
.doc-header { margin-bottom: 40px; }
.doc-meta { color: var(--text-muted); font-size: 0.9rem; margin: 0; }

.doc-body { max-width: 72ch; }
.doc-body h2 { font-size: 1.25rem; margin-top: 36px; }
.doc-body h2:first-of-type { margin-top: 0; }
.doc-body p, .doc-body li { color: var(--text-muted); }
.doc-body strong { color: var(--text); }
.doc-body ul { padding-left: 22px; margin: 0 0 16px; }
.doc-body li { margin-bottom: 6px; }

.toc {
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 18px 22px;
  margin-bottom: 40px;
}
.toc ol { margin: 0; padding-left: 20px; }
.toc li { margin-bottom: 4px; }

.table-wrap { overflow-x: auto; margin-bottom: 20px; }

table {
  border-collapse: collapse;
  width: 100%;
  min-width: 460px;
  font-size: 0.95rem;
}

th, td {
  border: 1px solid var(--border);
  padding: 10px 12px;
  text-align: left;
  vertical-align: top;
}

th { background: var(--bg-alt); font-weight: 600; }
td { color: var(--text-muted); }

/* ---------- rodapé ---------- */

.site-footer {
  border-top: 1px solid var(--border);
  background: var(--bg-alt);
  padding-block: 40px;
  font-size: 0.92rem;
}

.footer-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 24px 48px;
  justify-content: space-between;
  align-items: flex-start;
}

.site-footer p { color: var(--text-muted); margin: 0 0 6px; max-width: 42ch; }

.footer-links { display: flex; flex-direction: column; }

.footer-links a {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  text-decoration: none;
}
.footer-links a:hover { text-decoration: underline; }

.footer-bottom {
  margin-top: 28px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 0.85rem;
}

/* ---------- responsivo ---------- */

@media (max-width: 860px) {
  .hero-grid { grid-template-columns: 1fr; gap: 40px; }
  .hero { padding-block: 44px 40px; }
  section { padding-block: 48px; }
  .doc { padding-block: 40px 56px; }
}

/* Celular: cabeçalho compacto com a navegação numa faixa rolável, botões de
   largura cheia, alvos de toque maiores e tabelas empilhadas. */
@media (max-width: 700px) {
  html { scroll-padding-top: 104px; }

  .container { padding-inline: 18px; }

  .site-header .container {
    min-height: 0;
    padding-block: 6px 0;
    gap: 0;
  }

  .brand { font-size: 1.05rem; }
  .brand img { width: 28px; }

  .site-nav {
    width: 100%;
    flex-wrap: nowrap;
    overflow-x: auto;
    gap: 18px;
    margin-inline: -18px;
    padding-inline: 18px;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-x: contain;
    -webkit-mask-image: linear-gradient(90deg, #000 calc(100% - 28px), transparent);
    mask-image: linear-gradient(90deg, #000 calc(100% - 28px), transparent);
  }
  .site-nav::-webkit-scrollbar { display: none; }
  .site-nav a { min-height: 38px; white-space: nowrap; }

  .hero { padding-block: 30px 36px; }
  .hero-grid { gap: 32px; }
  h1 { font-size: clamp(1.8rem, 7.5vw, 2.4rem); }
  .lead { font-size: 1.05rem; }

  .hero-actions { gap: 10px; margin-top: 24px; }
  .hero-actions .btn { width: 100%; justify-content: center; }

  section { padding-block: 40px; }
  .section-head { margin-bottom: 26px; }
  .grid { gap: 14px; }
  .card { padding: 20px; }
  .steps { gap: 24px; }
  .callout { padding: 16px 18px; }

  .doc-header { margin-bottom: 28px; }
  .doc-body h2 { margin-top: 30px; }
  .toc { padding: 12px 18px; margin-bottom: 32px; }
  .toc a { display: inline-block; padding-block: 6px; }

  .footer-grid { gap: 12px 32px; }

  /* a tabela de permissões vira uma lista de blocos, sem rolagem lateral */
  .table-wrap { overflow-x: visible; }
  table.is-stacked { display: block; min-width: 0; }
  table.is-stacked thead { display: none; }
  table.is-stacked tbody,
  table.is-stacked tr,
  table.is-stacked td { display: block; }
  table.is-stacked tr {
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 12px 14px;
    margin-bottom: 10px;
  }
  table.is-stacked td { border: 0; padding: 0; }
  table.is-stacked td:first-child {
    font-weight: 600;
    color: var(--text);
    margin-bottom: 2px;
  }
}

@media (max-width: 380px) {
  .phone { font-size: 12px; }
  .app-btn { font-size: 11px; }
}
