/* ============================================================
   Gestware · Centro de ayuda
   Visual identity aligned with the main app's landing page
   (Inter · blue #2563eb · slate palette).
   ============================================================ */

:root {
  /* Light — slate / blue (matches landing page) */
  --paper:      #f8fafc;   /* slate-50  */
  --paper-2:    #ffffff;
  --card:       #ffffff;
  --ink:        #0f172a;   /* slate-900 */
  --ink-soft:   #334155;   /* slate-700 */
  --ink-mute:   #64748b;   /* slate-500 */
  --line:       #e2e8f0;   /* slate-200 */
  --line-soft:  #f1f5f9;   /* slate-100 */
  --accent:     #2563eb;   /* blue-600  */
  --accent-2:   #1d4ed8;   /* blue-700  */
  --accent-ink: #ffffff;
  --mark-bg:    #dbeafe;   /* blue-100  */
  --mark-ink:   #1e40af;   /* blue-800  */
  --shadow:     0 1px 2px rgba(15,23,42,.04), 0 12px 30px -16px rgba(15,23,42,.22);
  --shadow-sm:  0 1px 2px rgba(15,23,42,.06);
  --shadow-accent: 0 4px 14px rgba(37,99,235,.25);
  --radius:     16px;
  --radius-sm:  12px;
  --maxw:       1140px;
}

[data-theme="dark"] {
  --paper:      #0b1120;
  --paper-2:    #0f172a;   /* slate-900 */
  --card:       #18233b;
  --ink:        #e8edf5;
  --ink-soft:   #c2ccdb;
  --ink-mute:   #8896ab;
  --line:       #283549;
  --line-soft:  #1c2740;
  --accent:     #3b82f6;   /* blue-500 */
  --accent-2:   #60a5fa;
  --accent-ink: #07101f;
  --mark-bg:    #1e3a8a;
  --mark-ink:   #bfdbfe;
  --shadow:     0 1px 2px rgba(0,0,0,.3), 0 18px 40px -20px rgba(0,0,0,.7);
  --shadow-sm:  0 1px 2px rgba(0,0,0,.35);
  --shadow-accent: 0 6px 20px rgba(59,130,246,.35);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }

body {
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--paper);
  color: var(--ink);
  line-height: 1.6;
  letter-spacing: -0.011em;
  min-height: 100vh;
  position: relative;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  transition: background .4s ease, color .4s ease;
}

/* ---- atmosphere: soft top gradient + faint grid (landing-style) ---- */
.grain {
  position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background:
    linear-gradient(180deg, var(--paper-2) 0%, transparent 420px),
    linear-gradient(to right, color-mix(in srgb, var(--ink) 4%, transparent) 1px, transparent 1px),
    linear-gradient(to bottom, color-mix(in srgb, var(--ink) 4%, transparent) 1px, transparent 1px);
  background-size: 100% 100%, 56px 56px, 56px 56px;
  -webkit-mask-image: linear-gradient(180deg, #000 0, transparent 560px);
  mask-image: linear-gradient(180deg, #000 0, transparent 560px);
  opacity: .7;
}

.glow {
  position: fixed; z-index: 0; pointer-events: none;
  border-radius: 50%; filter: blur(100px);
}
.glow--a { top: -200px; right: -120px; width: 540px; height: 540px;
  background: radial-gradient(circle, var(--accent) 0%, transparent 70%); opacity: .14; }
.glow--b { top: 360px; left: -200px; width: 460px; height: 460px;
  background: radial-gradient(circle, #38bdf8 0%, transparent 70%); opacity: .08; }

/* ---- header ---- */
.site-header {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; padding: 13px clamp(18px, 5vw, 56px);
  background: color-mix(in srgb, var(--paper) 78%, transparent);
  backdrop-filter: blur(16px) saturate(1.5);
  border-bottom: 1px solid var(--line-soft);
}
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); }
.brand__mark {
  display: grid; place-items: center; width: 34px; height: 34px;
  color: var(--accent-ink); background: var(--accent);
  border-radius: 10px; box-shadow: var(--shadow-accent);
}
.brand__mark svg { width: 19px; height: 19px; }
.brand__name {
  font-weight: 800; font-size: 1.28rem; letter-spacing: -0.03em; line-height: 1;
}
.brand__sub {
  font-size: .66rem; font-weight: 600; text-transform: uppercase;
  letter-spacing: .12em; color: var(--ink-mute);
  border: 1px solid var(--line); border-radius: 999px; padding: 3px 9px;
}

.header-tools { display: flex; align-items: center; gap: 10px; }
.lang-switch {
  display: flex; align-items: center; gap: 2px;
  padding: 3px; border: 1px solid var(--line); border-radius: 11px;
  background: var(--card);
}
.lang-btn {
  font: inherit; font-size: .76rem; font-weight: 600; letter-spacing: .02em;
  color: var(--ink-mute); cursor: pointer; text-transform: uppercase;
  padding: 6px 9px; border: none; border-radius: 8px; background: transparent;
  transition: background .2s, color .2s;
}
.lang-btn:hover { color: var(--ink); }
.lang-btn.active { background: var(--accent); color: var(--accent-ink); }
@media (max-width: 520px) {
  .lang-btn { padding: 6px 7px; font-size: .72rem; }
  .brand__sub { display: none; }
}

.theme-toggle {
  display: grid; place-items: center; width: 40px; height: 40px;
  border: 1px solid var(--line); border-radius: 11px;
  background: var(--card); color: var(--ink-soft); cursor: pointer;
  transition: transform .25s ease, border-color .25s, color .25s;
}
.theme-toggle:hover { transform: translateY(-1px); border-color: var(--accent); color: var(--accent); }
.theme-toggle svg { width: 19px; height: 19px; }
.theme-toggle .icon-moon { display: none; }
[data-theme="dark"] .theme-toggle .icon-sun { display: none; }
[data-theme="dark"] .theme-toggle .icon-moon { display: block; }

/* ---- main ---- */
main { position: relative; z-index: 1; max-width: var(--maxw); margin: 0 auto; padding: 0 clamp(18px, 5vw, 56px); }

/* ---- hero ---- */
.hero { padding: clamp(46px, 9vw, 92px) 0 clamp(30px, 5vw, 50px); max-width: 760px; }
.hero__eyebrow {
  font-size: .74rem; font-weight: 600; text-transform: uppercase;
  letter-spacing: .18em; color: var(--accent);
  display: inline-flex; align-items: center; gap: 10px;
}
.hero__eyebrow::before { content: ""; width: 26px; height: 2px; border-radius: 2px; background: var(--accent); display: inline-block; }
.hero__title {
  font-weight: 800; font-size: clamp(2.7rem, 7.5vw, 4.8rem); line-height: 1.04;
  letter-spacing: -0.035em; margin: 18px 0 0;
}
.hero__title em { font-style: normal; color: var(--accent); }
.hero__lead {
  margin-top: 20px; font-size: clamp(1.02rem, 2.2vw, 1.2rem);
  color: var(--ink-soft); max-width: 56ch;
}
.hero__lead strong { color: var(--ink); font-weight: 600; }

.search {
  margin-top: 30px; position: relative; display: flex; align-items: center;
  max-width: 560px;
}
.search__icon {
  position: absolute; left: 18px; width: 20px; height: 20px; color: var(--ink-mute);
  pointer-events: none;
}
.search input {
  width: 100%; font: inherit; font-size: 1.02rem; color: var(--ink);
  padding: 15px 52px 15px 50px;
  background: var(--card); border: 1px solid var(--line);
  border-radius: 12px; box-shadow: var(--shadow);
  transition: border-color .25s, box-shadow .25s;
}
.search input::placeholder { color: var(--ink-mute); }
.search input:focus {
  outline: none; border-color: var(--accent);
  box-shadow: var(--shadow), 0 0 0 4px color-mix(in srgb, var(--accent) 16%, transparent);
}
.search__kbd {
  position: absolute; right: 16px; font-family: inherit; font-size: .8rem;
  color: var(--ink-mute); border: 1px solid var(--line); border-radius: 7px;
  padding: 2px 9px; background: var(--paper);
}
.hero__meta { margin-top: 16px; font-size: .92rem; color: var(--ink-mute); }
.hero__meta b { color: var(--accent); font-weight: 600; }

/* ---- layout ---- */
.layout {
  display: grid; grid-template-columns: 232px 1fr; gap: clamp(28px, 5vw, 64px);
  padding-bottom: 100px; align-items: start;
}
/* Sem isto, em ecrã estreito a fila horizontal de temas (.cat-nav, nowrap) impõe a
   sua largura à coluna 1fr e a página inteira fica mais larga que o ecrã — o texto
   saía cortado à direita. Com min-width: 0 a coluna fica na largura do ecrã e a
   fila de temas desliza dentro dela, como pretendido. */
.layout > * { min-width: 0; }

/* ---- category rail ---- */
.rail { position: sticky; top: 84px; }
.rail__title {
  font-size: .72rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: .12em; color: var(--ink-mute); margin: 0 0 14px 12px;
}
.cat-nav { display: flex; flex-direction: column; gap: 2px; }
.cat-btn {
  display: flex; align-items: center; gap: 11px; width: 100%;
  font: inherit; font-size: .93rem; font-weight: 500; text-align: left;
  color: var(--ink-soft); cursor: pointer;
  padding: 10px 12px; border: none; border-radius: 10px; background: transparent;
  transition: background .2s, color .2s;
}
.cat-btn:hover { background: var(--line-soft); color: var(--ink); }
.cat-btn.active { background: color-mix(in srgb, var(--accent) 10%, transparent); color: var(--accent-2); }
.cat-btn.active .cat-btn__ic { color: var(--accent); }
.cat-btn__ic { display: grid; place-items: center; width: 20px; height: 20px; color: var(--ink-mute); flex: none; }
.cat-btn__ic svg { width: 18px; height: 18px; }
.cat-btn__label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cat-btn__count {
  font-size: .75rem; font-weight: 600; color: var(--ink-mute);
  background: var(--line-soft); border-radius: 999px; padding: 1px 8px; flex: none;
}
.cat-btn.active .cat-btn__count { background: color-mix(in srgb, var(--accent) 18%, transparent); color: var(--accent-2); }

/* ---- sections ---- */
.section { margin-bottom: 42px; scroll-margin-top: 84px; }
.section__head { display: flex; align-items: center; gap: 13px; margin-bottom: 18px; padding-bottom: 14px; border-bottom: 1px solid var(--line); }
.section__ic {
  display: grid; place-items: center; width: 38px; height: 38px; flex: none;
  color: var(--accent); background: color-mix(in srgb, var(--accent) 10%, transparent);
  border-radius: 11px;
}
.section__ic svg { width: 20px; height: 20px; }
.section__title { font-weight: 700; font-size: 1.4rem; letter-spacing: -0.025em; }
.section__n { margin-left: auto; font-size: .82rem; color: var(--ink-mute); }

/* ---- accordion ---- */
.qa { display: flex; flex-direction: column; gap: 9px; }
.item {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius-sm); overflow: hidden;
  transition: border-color .25s, box-shadow .25s, transform .25s;
}
.item:hover { border-color: color-mix(in srgb, var(--accent) 45%, var(--line)); }
.item.open { border-color: color-mix(in srgb, var(--accent) 60%, var(--line)); box-shadow: var(--shadow); }
.item__q {
  display: flex; align-items: center; gap: 16px; width: 100%;
  font: inherit; font-size: 1.02rem; font-weight: 600; color: var(--ink);
  text-align: left; cursor: pointer; padding: 16px 19px; background: none; border: none;
  letter-spacing: -0.015em;
}
.item__q:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; border-radius: var(--radius-sm); }
.item__sign { position: relative; width: 17px; height: 17px; flex: none; margin-left: auto; color: var(--accent); }
.item__sign::before, .item__sign::after {
  content: ""; position: absolute; background: currentColor; border-radius: 2px;
  transition: transform .3s cubic-bezier(.4,0,.2,1);
}
.item__sign::before { top: 8px; left: 0; width: 17px; height: 2px; }
.item__sign::after  { left: 8px; top: 0; width: 2px; height: 17px; }
.item.open .item__sign::after { transform: scaleY(0); }
.item.open .item__sign::before { transform: rotate(180deg); }

.item__body { display: grid; grid-template-rows: 0fr; transition: grid-template-rows .34s cubic-bezier(.4,0,.2,1); }
.item.open .item__body { grid-template-rows: 1fr; }
.item__bodyInner { overflow: hidden; }
.item__a {
  padding: 0 19px 19px; color: var(--ink-soft); font-size: .98rem; max-width: 70ch;
  border-top: 1px solid transparent;
}
.item.open .item__a { border-top-color: var(--line-soft); padding-top: 15px; }

mark { background: var(--mark-bg); color: var(--mark-ink); border-radius: 3px; padding: 0 2px; font-weight: 600; }

/* ---- empty state ---- */
.empty { text-align: center; padding: 70px 20px; color: var(--ink-mute); }
.empty svg { width: 40px; height: 40px; opacity: .5; margin-bottom: 16px; }
.empty p { font-size: 1.05rem; }
.empty span { color: var(--ink); font-weight: 600; }
.btn-ghost {
  margin-top: 18px; font: inherit; font-weight: 600; font-size: .92rem; color: var(--accent);
  cursor: pointer; padding: 9px 18px; border: 1px solid var(--accent); border-radius: 10px; background: none;
  transition: background .2s, color .2s, box-shadow .2s;
}
.btn-ghost:hover { background: var(--accent); color: var(--accent-ink); box-shadow: var(--shadow-accent); }

/* ---- footer ---- */
.site-footer {
  position: relative; z-index: 1; border-top: 1px solid var(--line-soft);
  max-width: var(--maxw); margin: 0 auto; padding: 36px clamp(18px, 5vw, 56px) 56px;
}
.site-footer__row { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.site-footer__tag { font-size: .82rem; color: var(--ink-mute); border-left: 1px solid var(--line); padding-left: 16px; }
.site-footer__note { margin-top: 12px; font-size: .82rem; color: var(--ink-mute); max-width: 60ch; }
.site-footer__cookies {
  margin-top: 12px; padding: 0; border: 0; background: none; font: inherit;
  font-size: .82rem; color: var(--ink-mute); text-decoration: underline;
  text-underline-offset: 3px; cursor: pointer; transition: color .18s ease;
}
.site-footer__cookies:hover { color: var(--ink); }

/* ---- reveal on load ---- */
@keyframes rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
.reveal { opacity: 0; animation: rise .6s cubic-bezier(.2,.7,.2,1) forwards; }

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
  html { scroll-behavior: auto; }
}

/* ---- responsive ---- */
@media (max-width: 880px) {
  .layout { grid-template-columns: 1fr; gap: 8px; }
  .rail { position: static; margin-bottom: 8px; }
  .rail__title { display: none; }
  .cat-nav {
    flex-direction: row; gap: 8px; overflow-x: auto; padding-bottom: 8px;
    scrollbar-width: none; -webkit-overflow-scrolling: touch;
  }
  .cat-nav::-webkit-scrollbar { display: none; }
  .cat-btn { width: auto; flex: none; border: 1px solid var(--line); background: var(--card); white-space: nowrap; }
  .cat-btn__label { overflow: visible; }
}
@media (max-width: 520px) {
  .item__q { font-size: .96rem; padding: 14px 16px; }
  .search__kbd { display: none; }
}

/* ---- screenshots inside an answer ---- */
.item__fig { margin: 0; padding: 0 19px 19px; max-width: 780px; }
.item__shot {
  display: block; width: 100%; padding: 0; overflow: hidden; cursor: zoom-in;
  border: 1px solid var(--line); border-radius: var(--radius-sm);
  background: var(--card); box-shadow: var(--shadow-sm);
  transition: border-color .2s ease, box-shadow .2s ease;
}
.item__shot:hover { border-color: var(--accent); box-shadow: var(--shadow); }
.item__shot:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.item__shot img { display: block; width: 100%; height: auto; }
.item__cap { margin-top: 9px; font-size: .82rem; line-height: 1.5; color: var(--ink-mute); }

/* ---- lightbox ---- */
.zoom {
  position: fixed; inset: 0; z-index: 90; display: none; cursor: zoom-out;
  align-items: center; justify-content: center; padding: 28px;
  background: rgba(15, 23, 42, .74); -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px);
}
.zoom.open { display: flex; }
.zoom img {
  max-width: 100%; max-height: 100%; background: #fff;
  border-radius: var(--radius-sm); box-shadow: 0 24px 60px -20px rgba(0, 0, 0, .8);
}
.zoom__close {
  position: absolute; top: 16px; right: 20px; width: 38px; height: 38px;
  display: flex; align-items: center; justify-content: center;
  border: 1px solid rgba(255, 255, 255, .3); border-radius: 50%;
  background: rgba(15, 23, 42, .55); color: #fff; font-size: 22px; line-height: 1; cursor: pointer;
}
.zoom__close:hover { background: rgba(15, 23, 42, .85); }
.zoom__close:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }

@media (max-width: 640px) {
  .item__fig { padding: 0 16px 16px; }
  .zoom { padding: 14px; }
}

/* ---- section title → página do tema (app.js) ---- */
.section__link { color: inherit; text-decoration: none; }
.section__link:hover { color: var(--accent); text-decoration: underline; text-underline-offset: 4px; }

/* ============================================================
   Páginas por tema (/ayuda/<tema>/), geradas pelo build-pages.mjs.
   HTML estático, sem app.js: as perguntas vão todas abertas.
   ============================================================ */
a.lang-btn, a.cat-btn { text-decoration: none; }

.btn-primary {
  display: inline-block; font-weight: 600; font-size: .95rem; text-decoration: none;
  color: var(--accent-ink); background: var(--accent);
  padding: 11px 20px; border-radius: 10px; box-shadow: var(--shadow-accent);
  transition: background .2s, transform .2s;
}
.btn-primary:hover { background: var(--accent-2); transform: translateY(-1px); }
.btn-primary--header { font-size: .82rem; padding: 8px 14px; box-shadow: none; }
@media (max-width: 520px) { .btn-primary--header { display: none; } }

.crumbs {
  display: flex; flex-wrap: wrap; gap: 8px; padding-top: 26px;
  font-size: .86rem; color: var(--ink-mute);
}
.crumbs a { color: var(--ink-mute); text-decoration: none; }
.crumbs a:hover { color: var(--accent); }

.hero--tema { padding-top: clamp(20px, 4vw, 38px); }
.hero__title--tema { font-size: clamp(2.1rem, 5.5vw, 3.4rem); }

.tema-qa { display: flex; flex-direction: column; gap: 12px; }
.tema-item {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius-sm); padding: 18px 20px; scroll-margin-top: 84px;
}
.tema-item:target { border-color: var(--accent); box-shadow: var(--shadow); }
.tema-item h2 { font-size: 1.06rem; font-weight: 600; line-height: 1.4; letter-spacing: -0.015em; }
.tema-item p { margin-top: 10px; color: var(--ink-soft); font-size: .98rem; max-width: 70ch; }
.tema-item a { color: var(--accent); }
.tema-item .item__fig { padding: 14px 0 0; }
.tema-item .item__fig img {
  display: block; width: 100%; height: auto;
  border: 1px solid var(--line); border-radius: var(--radius-sm);
}

.tema-todas { margin-top: 22px; font-weight: 600; font-size: .95rem; }
.tema-todas a { color: var(--accent); text-decoration: none; }
.tema-todas a:hover { text-decoration: underline; text-underline-offset: 3px; }

.tema-cta {
  margin-top: 34px; padding: clamp(22px, 4vw, 32px); border-radius: var(--radius);
  background: color-mix(in srgb, var(--accent) 7%, var(--card));
  border: 1px solid color-mix(in srgb, var(--accent) 28%, var(--line));
}
.tema-cta h2 { font-size: 1.35rem; font-weight: 700; letter-spacing: -0.025em; }
.tema-cta p { margin-top: 8px; color: var(--ink-soft); max-width: 60ch; }
.tema-cta__acoes { margin-top: 18px; display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.tema-cta__acoes .btn-ghost { margin-top: 0; text-decoration: none; display: inline-block; }
