/* ==========================================================================
   NEURIS — Estilos Base
   Reset, custom properties, tipografia, grid, utilitários
   ========================================================================== */

/* --- Custom Properties --- */
:root {
  /* Paleta — Tema Claro (principal, default) */
  --color-bg: #ffffff;
  --color-surface: #e4ecf4;
  --color-surface-hover: #d8e3ee;
  --color-accent: #00c8a0;
  --color-accent-hover: #00ddb0;
  --color-accent-dim: rgba(0, 200, 160, 0.10);
  --color-accent-secondary: #f59e0b;
  /* Teal para uso em texto — mais escuro para passar WCAG AA em fundo claro (5.3:1) */
  --color-accent-text: #007a62;
  --color-text: #0d1117;
  --color-text-secondary: #4a5568;
  --color-muted: #94a3b8;
  --color-border: rgba(0, 0, 0, 0.08);
  --color-border-accent: rgba(0, 200, 160, 0.25);
  --color-navbar-scrolled: rgba(255, 255, 255, 0.92);
  --color-mobile-menu: rgba(255, 255, 255, 0.98);

  /* Footer — Navy institucional da Brand Identity v2 */
  --color-footer-bg: #0F172A;
  --color-footer-text: #e8edf2;
  --color-footer-tagline: #9ca3af;   /* contraste 7.5:1 sobre footer-bg */
  --color-footer-link: #8b949e;      /* contraste 6.3:1 sobre footer-bg */
  --color-footer-muted: #9ca3af;     /* contraste 7.5:1 — copyright e privacidade */
  --color-footer-icon: #9ca3af;
  --color-footer-border: rgba(255, 255, 255, 0.07); /* separadores internos do footer navy */

  /* Contexto Navy (stats + footer) — texto e separadores sobre #0F172A */
  --color-stats-label: rgba(255, 255, 255, 0.65);  /* 5.2:1 sobre navy — WCAG AA large */
  --color-stats-divider: rgba(255, 255, 255, 0.08);

  /* Watermark — número decorativo de fundo nos pilares */
  --color-watermark: rgba(0, 0, 0, 0.045);

  /* Gradiente do hero sobre a imagem de fundo */
  --hero-gradient: linear-gradient(
    to right,
    #ffffff 0%,
    rgba(255, 255, 255, 0.97) 30%,
    rgba(255, 255, 255, 0.80) 50%,
    rgba(255, 255, 255, 0.40) 70%,
    rgba(255, 255, 255, 0.10) 90%,
    transparent 100%
  );

  /* Tipografia */
  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-display: 'Space Grotesk', 'Inter', sans-serif;
  --font-mono: 'JetBrains Mono', monospace;

  --text-xs: 0.75rem;
  --text-sm: 0.875rem;
  --text-base: 1rem;
  --text-lg: 1.125rem;
  --text-xl: 1.25rem;
  --text-2xl: 1.5rem;
  --text-3xl: 2rem;
  --text-4xl: 2.75rem;
  --text-5xl: 3.5rem;
  --text-6xl: 4.5rem;

  --leading-tight: 1.1;
  --leading-snug: 1.25;
  --leading-normal: 1.6;
  --leading-relaxed: 1.75;

  --weight-light: 300;
  --weight-regular: 400;
  --weight-medium: 500;
  --weight-semibold: 600;
  --weight-bold: 700;

  /* Espaçamento (base 8px) */
  --space-1: 0.25rem;   /* 4px */
  --space-2: 0.5rem;    /* 8px */
  --space-3: 0.75rem;   /* 12px */
  --space-4: 1rem;      /* 16px */
  --space-5: 1.5rem;    /* 24px */
  --space-6: 2rem;      /* 32px */
  --space-8: 3rem;      /* 48px */
  --space-10: 4rem;     /* 64px */
  --space-12: 5rem;     /* 80px */
  --space-16: 7rem;     /* 112px */
  --space-20: 9rem;     /* 144px */

  /* Layout */
  --container-max: 1200px;
  --container-padding: var(--space-5);

  /* Bordas e sombras */
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;
  --radius-2xl: 20px;

  /* Transições — tema (mais suave que animações de UI) */
  --duration-theme: 250ms;
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --duration-fast: 200ms;
  --duration-base: 400ms;
  --duration-slow: 600ms;

  /* Navbar */
  --navbar-height: 56px;

  /* ── Tokens de documento — exclusivos da carta/PDF ────────────────────────
     Não usar na UI do site nem do admin. Representam o "papel" do
     letterhead institucional, fixo independentemente do tema claro/escuro
     (tal como o navy do footer é sempre #0F172A). O utilizador escolhe,
     no editor, entre fundo branco ou bege/creme — ambos definidos aqui. */
  --letter-paper-bg-branco: #ffffff;
  --letter-paper-bg-creme: #f4efe7;
  --letter-paper-text: #0d1117;
  --letter-paper-text-secondary: #4a5568;
  --letter-paper-muted: #94a3b8;
  --letter-paper-border: rgba(13, 17, 23, 0.12);
  --letter-paper-border-soft: rgba(13, 17, 23, 0.08);
  --letter-paper-accent: #00c8a0;
  --letter-paper-highlight: rgba(255, 255, 255, 0.6);
}

/* Fallback quando Lenis CDN falha — evita inline style no <html> */
.scroll-smooth {
  scroll-behavior: smooth;
}

/* --- Tema Escuro (secundário) --- */
[data-theme="dark"] {
  --color-bg: #080a0d;
  --color-surface: #0f1218;
  --color-surface-hover: #161b24;
  --color-accent: #00c8a0;
  --color-accent-dim: rgba(0, 200, 160, 0.12);
  /* Em fundo escuro o teal original passa WCAG AA (8.7:1) — sem necessidade de escurecer */
  --color-accent-text: #00c8a0;
  --color-text: #e8edf2;
  --color-text-secondary: #94a3b8;
  --color-muted: #4a5568;
  --color-border: rgba(255, 255, 255, 0.06);
  --color-border-accent: rgba(0, 200, 160, 0.20);
  --color-navbar-scrolled: rgba(8, 10, 13, 0.92);
  --color-mobile-menu: rgba(8, 10, 13, 0.98);
  --color-watermark: rgba(255, 255, 255, 0.05);

  /* Gradiente do hero sobre a imagem de fundo */
  --hero-gradient: linear-gradient(
    to right,
    #080a0d 0%,
    rgba(8, 10, 13, 0.97) 30%,
    rgba(8, 10, 13, 0.80) 50%,
    rgba(8, 10, 13, 0.40) 70%,
    rgba(8, 10, 13, 0.10) 90%,
    transparent 100%
  );
}

/* --- Transição suave ao mudar de tema --- */
body,
.navbar,
.area-card,
.pilares,
.contacto,
.footer {
  transition: background-color var(--duration-theme) ease,
              color var(--duration-theme) ease,
              border-color var(--duration-theme) ease;
}

/* --- Reset --- */
*,
*::before,
*::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  font-size: 16px;
  /* scroll-behavior gerido pelo Lenis; .scroll-smooth é fallback quando o CDN falha */
  scroll-padding-top: var(--navbar-height);
  -webkit-text-size-adjust: 100%;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-body);
  font-weight: var(--weight-regular);
  font-size: var(--text-base);
  line-height: var(--leading-normal);
  color: var(--color-text);
  background-color: var(--color-bg);
  overflow-x: hidden;
}

img,
svg {
  display: block;
  max-width: 100%;
}

a {
  color: inherit;
  text-decoration: none;
}

ul, ol {
  list-style: none;
}

button,
input,
textarea {
  font: inherit;
  color: inherit;
  border: none;
  background: none;
  outline: none;
}

button {
  cursor: pointer;
}

textarea {
  resize: vertical;
}

::selection {
  background: var(--color-accent);
  color: var(--color-bg);
}

/* --- Skip Link (acessibilidade — teclado / screen reader) --- */
.skip-link {
  position: absolute;
  top: -100%;
  left: var(--space-4);
  z-index: 9999;
  padding: var(--space-2) var(--space-5);
  background: var(--color-accent);
  color: #0d1117;
  font-family: var(--font-body);
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
  border-radius: var(--radius-sm);
  text-decoration: none;
  white-space: nowrap;
  transition: top 200ms ease;
}

.skip-link:focus {
  top: var(--space-2);
  outline: 2px solid var(--color-text);
  outline-offset: 3px;
}

/* --- Tipografia Base --- */
h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: var(--weight-semibold);
  line-height: var(--leading-tight);
  letter-spacing: -0.02em;
}

/* --- Container --- */
.container {
  width: 100%;
  max-width: var(--container-max);
  margin: 0 auto;
  padding-left: var(--container-padding);
  padding-right: var(--container-padding);
}

/* --- Etiquetas de secção --- */
.section-label {
  font-family: var(--font-body);
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--color-accent-text);
  margin-bottom: var(--space-4);
}

.section-title {
  font-size: var(--text-3xl);
  color: var(--color-text);
  margin-bottom: var(--space-6);
}

/* --- Botões --- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-body);
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  letter-spacing: 0.02em;
  padding: 14px 32px;
  border-radius: var(--radius-sm);
  transition: all var(--duration-fast) var(--ease-out);
  white-space: nowrap;
}

.btn--primary {
  /* Glassmorphism teal — mesmo tratamento que .contacto__btn */
  background: linear-gradient(
    135deg,
    rgba(0, 200, 160, 0.14) 0%,
    rgba(0, 200, 160, 0.05) 100%
  );
  border: 1px solid rgba(0, 200, 160, 0.40);
  color: var(--color-accent-text);
  backdrop-filter: blur(12px) saturate(140%);
  -webkit-backdrop-filter: blur(12px) saturate(140%);
  box-shadow:
    0 2px 16px rgba(0, 200, 160, 0.12),
    inset 0 1px 0 rgba(0, 200, 160, 0.18);
}

.btn--primary:hover {
  background: linear-gradient(
    135deg,
    rgba(0, 200, 160, 0.22) 0%,
    rgba(0, 200, 160, 0.10) 100%
  );
  border-color: rgba(0, 200, 160, 0.60);
  box-shadow:
    0 6px 24px rgba(0, 200, 160, 0.22),
    inset 0 1px 0 rgba(0, 200, 160, 0.25);
  transform: translateY(-1px);
}

[data-theme="dark"] .btn--primary {
  background: linear-gradient(
    135deg,
    rgba(0, 200, 160, 0.18) 0%,
    rgba(0, 200, 160, 0.07) 100%
  );
  box-shadow:
    0 4px 24px rgba(0, 200, 160, 0.20),
    inset 0 1px 0 rgba(0, 200, 160, 0.22),
    inset 0 -1px 0 rgba(0, 0, 0, 0.20);
}

[data-theme="dark"] .btn--primary:hover {
  box-shadow:
    0 8px 32px rgba(0, 200, 160, 0.32),
    inset 0 1px 0 rgba(0, 200, 160, 0.30),
    inset 0 -1px 0 rgba(0, 0, 0, 0.20);
}

.btn--ghost {
  /* Secundário — texto puro com underline, sem caixa */
  padding: 0 0 2px;
  min-height: 44px;
  align-items: flex-end;
  background: none;
  border: none;
  color: var(--color-text-secondary);
  font-size: var(--text-sm);
  font-weight: var(--weight-regular);
  letter-spacing: 0.01em;
  gap: var(--space-2);
  border-bottom: 1px solid var(--color-muted);
  border-radius: 0;
  transition: color var(--duration-fast) var(--ease-out),
              border-color var(--duration-fast) var(--ease-out);
}

.btn--ghost::after {
  content: '→';
  font-size: var(--text-base);
  display: inline-block;
  transition: transform var(--duration-fast) var(--ease-out);
}

.btn--ghost:hover {
  color: var(--color-text);
  border-color: var(--color-text);
}

.btn--ghost:hover::after {
  transform: translateX(4px);
}

.btn--full {
  width: 100%;
}

/* Acessibilidade — focus visível para teclado (qualquer elemento interactivo) */
:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 3px;
  border-radius: 2px;
}

/* --- Responsivo --- */
@media (min-width: 768px) {
  :root {
    --container-padding: var(--space-8);
  }

  .section-title {
    font-size: var(--text-4xl);
  }
}

@media (min-width: 1200px) {
  :root {
    --container-padding: var(--space-10);
  }

  .section-title {
    font-size: var(--text-5xl);
  }
}

/* Honeypot — campo fora do ecrã para deteção de bots */
.honeypot {
  position: absolute;
  left: -9999px;
  top: auto;
  width: 1px;
  height: 1px;
  overflow: hidden;
}
