/* ambiPortal – estilos do site (substitui ambiPortalstyles.css / Bootstrap 3) */

/* ---------- Fontes (alojadas localmente: nenhum pedido a terceiros) ---------- */
@font-face {
  font-family: 'Raleway';
  font-style: normal;
  font-weight: 400 800;
  font-display: swap;
  src: url('../fonts/raleway-latin-ext.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: 'Raleway';
  font-style: normal;
  font-weight: 400 800;
  font-display: swap;
  src: url('../fonts/raleway-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* ---------- Tokens ---------- */
:root {
  --green: #6cb33e;
  --green-700: #3f7a1c;
  --green-900: #2b5413;
  --ink: #212121;
  --muted: #566052;
  --line: #e1e7dc;
  --soft: #f3f7ef;
  --dark: #262a25;
  --darker: #1b1e1a;
  --white: #fff;

  --radius: 16px;
  --shadow: 0 10px 30px rgba(24, 48, 12, .10);
  --container: 1200px;
  --gutter: clamp(1rem, 4vw, 2rem);
  --header-h: 72px;

  --fs-body: clamp(1rem, .96rem + .2vw, 1.125rem);
  --fs-h1: clamp(2.1rem, 1.3rem + 3.6vw, 4rem);
  --fs-h2: clamp(1.75rem, 1.25rem + 2vw, 2.75rem);
  --fs-h3: clamp(1.1rem, 1rem + .5vw, 1.35rem);
  --space-section: clamp(3.5rem, 2rem + 6vw, 7rem);
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-h) + 8px);
}
body {
  margin: 0;
  font-family: 'Raleway', system-ui, -apple-system, 'Segoe UI', Roboto, Arial, sans-serif;
  font-size: var(--fs-body);
  line-height: 1.6;
  color: var(--ink);
  background: var(--white);
  -webkit-font-smoothing: antialiased;
  overflow-wrap: break-word;
}
img, svg { max-width: 100%; height: auto; }
img { display: block; }
h1, h2, h3 { line-height: 1.15; margin: 0 0 .5em; }
h1 { font-size: var(--fs-h1); font-weight: 700; }
h2 { font-size: var(--fs-h2); font-weight: 700; }
h3 { font-size: var(--fs-h3); font-weight: 700; }
p { margin: 0 0 1em; }
ul, ol { margin: 0; padding: 0; }
a { color: var(--green-700); text-underline-offset: .15em; }
a:hover { color: var(--green-900); }
button { font: inherit; }

:focus-visible { outline: 3px solid var(--green-900); outline-offset: 3px; border-radius: 4px; }
.on-dark :focus-visible { outline-color: #fff; }

.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;
}
.skip-link {
  position: fixed; left: 1rem; top: -4rem; z-index: 300;
  background: var(--green-900); color: #fff; padding: .75rem 1rem; border-radius: 8px;
  transition: top .2s;
}
.skip-link:focus { top: 1rem; }

.container {
  width: min(100% - 2 * var(--gutter), var(--container));
  margin-inline: auto;
}

/* ---------- Botões ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  min-height: 48px; padding: .7rem 1.5rem;
  border: 2px solid transparent; border-radius: 999px;
  font-weight: 700; font-size: 1rem; line-height: 1.2; text-decoration: none; text-align: center;
  cursor: pointer;
  transition: background-color .2s, color .2s, border-color .2s, transform .2s, box-shadow .2s;
}
.btn:hover { text-decoration: none; transform: translateY(-1px); }
.btn-primary { background: var(--green-700); color: #fff; }
.btn-primary:hover { background: var(--green-900); color: #fff; }
.btn-light { background: #fff; color: var(--green-900); }
.btn-light:hover { background: var(--soft); color: var(--green-900); }
.btn-outline-light { border-color: #fff; color: #fff; background: transparent; }
.btn-outline-light:hover { background: rgba(255, 255, 255, .16); color: #fff; }
.btn-outline-green { border-color: var(--green-700); color: var(--green-700); background: transparent; }
.btn-outline-green:hover { background: var(--green-700); color: #fff; }
.btn-outline-dark { border-color: var(--ink); color: var(--ink); background: transparent; }
.btn-outline-dark:hover { background: var(--ink); color: #fff; }

.link-button {
  background: none; border: 0; padding: 0; color: inherit; cursor: pointer;
  text-decoration: underline; text-underline-offset: .15em;
}

/* ---------- Cabeçalho ---------- */
.site-header {
  position: fixed; inset: 0 0 auto 0; z-index: 100;
  height: var(--header-h);
  background: rgba(255, 255, 255, .92);
  -webkit-backdrop-filter: saturate(160%) blur(10px);
  backdrop-filter: saturate(160%) blur(10px);
  transition: box-shadow .25s, background-color .25s;
}
.site-header.is-scrolled { background: #fff; box-shadow: 0 2px 16px rgba(0, 0, 0, .10); }
.header-inner { height: 100%; display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.brand { display: inline-flex; flex: none; }
.brand img { height: 44px; width: auto; }

.site-nav { display: flex; align-items: center; gap: clamp(1rem, 3vw, 2.5rem); }
.site-nav ul { display: flex; gap: clamp(1rem, 2.5vw, 2rem); list-style: none; }
.site-nav ul a {
  color: var(--ink); font-weight: 600; text-decoration: none; padding: .5rem 0;
  border-bottom: 2px solid transparent;
}
.site-nav ul a:hover { color: var(--green-700); border-bottom-color: var(--green-700); }
.btn-login { min-height: 44px; padding: .5rem 1.25rem; }

.nav-toggle { display: none; }

@media (max-width: 860px) {
  .js .nav-toggle {
    display: inline-flex; align-items: center; justify-content: center;
    width: 48px; height: 48px; padding: 0;
    background: none; border: 2px solid var(--line); border-radius: 12px; cursor: pointer;
  }
  .nav-toggle-bars, .nav-toggle-bars::before, .nav-toggle-bars::after {
    display: block; width: 22px; height: 2px; background: var(--ink); border-radius: 2px;
    transition: transform .25s, background-color .25s;
  }
  .nav-toggle-bars { position: relative; }
  .nav-toggle-bars::before, .nav-toggle-bars::after { content: ''; position: absolute; left: 0; }
  .nav-toggle-bars::before { top: -7px; }
  .nav-toggle-bars::after { top: 7px; }
  .nav-toggle[aria-expanded="true"] .nav-toggle-bars { background: transparent; }
  .nav-toggle[aria-expanded="true"] .nav-toggle-bars::before { transform: translateY(7px) rotate(45deg); }
  .nav-toggle[aria-expanded="true"] .nav-toggle-bars::after { transform: translateY(-7px) rotate(-45deg); }

  .js .site-nav {
    position: absolute; top: 100%; left: 0; right: 0;
    flex-direction: column; align-items: stretch; gap: 1rem;
    padding: 1rem var(--gutter) 1.5rem;
    background: #fff; box-shadow: 0 14px 24px rgba(0, 0, 0, .12);
    visibility: hidden; opacity: 0; transform: translateY(-8px);
    transition: opacity .2s, transform .2s, visibility .2s;
  }
  .js .site-header.is-open .site-nav { visibility: visible; opacity: 1; transform: none; }
  .site-nav ul { flex-direction: column; gap: 0; }
  .site-nav ul a { display: block; padding: .9rem 0; border-bottom: 1px solid var(--line); }
  .btn-login { width: 100%; }

  /* sem JS o menu fica sempre visível por baixo do logótipo */
  html:not(.js) .header-inner { flex-wrap: wrap; height: auto; padding-block: .5rem; }
  html:not(.js) .site-header { height: auto; position: static; }
  html:not(.js) .site-nav { width: 100%; flex-wrap: wrap; justify-content: space-between; }
  html:not(.js) .site-nav ul { flex-direction: row; flex-wrap: wrap; }
}

/* ---------- Secções ---------- */
.section { padding-block: var(--space-section); }
.section-head { max-width: 46rem; margin: 0 auto clamp(2rem, 4vw, 3.5rem); text-align: center; }
.section-head p { color: var(--muted); font-size: 1.1em; margin: 0; }
.lead { font-size: 1.2em; font-weight: 600; line-height: 1.45; }
.eyebrow {
  display: inline-block; margin: 0 0 1rem; padding: .35rem .9rem;
  background: rgba(255, 255, 255, .16); border: 1px solid rgba(255, 255, 255, .35);
  border-radius: 999px; font-size: .9rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase;
}
.on-dark { color: #fff; }
.on-dark a:not(.btn) { color: #fff; }

/* ---------- Hero ---------- */
.hero {
  display: grid; align-items: center;
  min-height: clamp(34rem, 88svh, 52rem);
  padding: calc(var(--header-h) + 3rem) 0 4rem;
  background:
    linear-gradient(90deg, rgba(15, 32, 8, .82) 0%, rgba(15, 32, 8, .55) 55%, rgba(15, 32, 8, .25) 100%),
    url('../images/cover-1920.jpg') center / cover no-repeat;
  background-color: var(--green-900);
}
.hero-content { max-width: 40rem; }
.hero h1 { color: #fff; text-wrap: balance; text-shadow: 0 2px 20px rgba(0, 0, 0, .25); }
.hero-lead { font-size: clamp(1.05rem, 1rem + .4vw, 1.3rem); max-width: 34rem; margin-bottom: 2rem; }
.hero-actions { display: flex; flex-wrap: wrap; gap: .85rem; }

@media (max-width: 767px) {
  .hero {
    min-height: 0;
    background:
      linear-gradient(180deg, rgba(15, 32, 8, .55) 0%, rgba(15, 32, 8, .78) 100%),
      url('../images/cover-mobile.jpg') center / cover no-repeat;
    background-color: var(--green-900);
  }
  .hero-actions .btn { flex: 1 1 100%; }
}

/* ---------- Inscrição / perfis ---------- */
.inscricao { background: var(--soft); }
.cards {
  list-style: none;
  display: grid; gap: clamp(1rem, 2.5vw, 2rem);
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 17rem), 1fr));
}
.card {
  display: flex; flex-direction: column; align-items: center; gap: 1rem;
  padding: 2rem 1.5rem; text-align: center;
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow);
  transition: transform .25s, box-shadow .25s;
}
.card:hover { transform: translateY(-4px); box-shadow: 0 16px 40px rgba(24, 48, 12, .16); }
.card img { height: 120px; width: auto; }
.card h3 { margin: 0; flex: 1; }
.card .btn { width: 100%; max-width: 15rem; }

/* ---------- Vídeo ---------- */
.video-block { margin-top: clamp(2.5rem, 5vw, 4.5rem); }
.video {
  position: relative; width: min(100%, 52rem); margin-inline: auto;
  aspect-ratio: 16 / 9; overflow: hidden;
  border-radius: var(--radius); box-shadow: var(--shadow);
  background: radial-gradient(circle at 30% 20%, #4f9c2a, var(--green-900));
  color: #fff;
}
.video iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.video-facade {
  position: absolute; inset: 0; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 1rem; padding: 1rem;
  color: #fff; text-decoration: none; text-align: center; font-weight: 700;
}
.video-facade[hidden] { display: none; }
.video-facade:hover { color: #fff; }
.play {
  display: grid; place-items: center; width: clamp(64px, 12vw, 88px); aspect-ratio: 1;
  border-radius: 50%; background: #fff; color: var(--green-700);
  box-shadow: 0 8px 24px rgba(0, 0, 0, .3); transition: transform .2s;
}
.video-facade:hover .play { transform: scale(1.08); }
.video-consent {
  position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 1.25rem; text-align: center; background: rgba(27, 52, 14, .96);
}
.video-consent[hidden] { display: none; }
.video-consent p { max-width: 32rem; }

/* ---------- Vantagens ---------- */
.vantagens { background: linear-gradient(135deg, var(--green-700), var(--green-900)); }
.vantagens-grid {
  display: grid; gap: clamp(2rem, 5vw, 4rem); align-items: center;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, .85fr);
}
.vantagens h2 { color: #fff; }
.checklist { list-style: none; margin-top: 1.5rem; display: grid; gap: .85rem; }
.checklist li { position: relative; padding-left: 2.1rem; }
.checklist li::before {
  content: ''; position: absolute; left: 0; top: .2em; width: 1.35em; height: 1.35em;
  border-radius: 50%; background: #fff
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='none' stroke='%233f7a1c' stroke-width='3.2' stroke-linecap='round' stroke-linejoin='round' d='M6 12.5l4 4 8-9'/%3E%3C/svg%3E")
    center / 70% no-repeat;
}
.steps { list-style: none; display: grid; gap: 1rem; }
.steps li {
  display: flex; align-items: center; gap: 1.25rem; padding: 1.1rem 1.25rem;
  background: rgba(255, 255, 255, .12); border: 1px solid rgba(255, 255, 255, .25);
  border-radius: var(--radius); font-weight: 600;
}
.steps img { flex: none; width: 72px; height: 72px; }

@media (max-width: 899px) {
  .vantagens-grid { grid-template-columns: minmax(0, 1fr); }
}

/* ---------- Sobre ---------- */
.sobre { background: #fff; }
.sobre-grid {
  display: grid; gap: clamp(1.5rem, 5vw, 4rem); align-items: center;
  grid-template-columns: minmax(0, .8fr) minmax(0, 1.2fr);
}
.sobre-logo { width: min(100%, 20rem); margin-inline: auto; }
@media (max-width: 767px) {
  .sobre-grid { grid-template-columns: minmax(0, 1fr); text-align: center; }
}

/* ---------- Contactos ---------- */
.contactos { background: var(--dark); }
.contactos-inner { display: flex; flex-direction: column; align-items: center; text-align: center; gap: .5rem; }
.contactos-inner img { width: clamp(110px, 14vw, 160px); height: auto; }
.contactos h2 { color: #fff; margin-top: 1rem; }
.contact-mail { font-size: clamp(1.1rem, 1rem + 1vw, 1.6rem); font-weight: 700; word-break: break-all; }
.social {
  display: inline-grid; place-items: center; width: 48px; height: 48px; margin-top: .5rem;
  border-radius: 50%; background: #fff; color: var(--dark) !important; transition: transform .2s;
}
.social:hover { transform: scale(1.1); }

/* ---------- Rodapé ---------- */
.site-footer { background: var(--darker); padding-block: 2rem; font-size: .92rem; }
.footer-inner {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 1rem 2rem;
}
.footer-brand { margin: 0; opacity: .85; }
.footer-legal ul { list-style: none; display: flex; flex-wrap: wrap; gap: .5rem 1.5rem; }
.footer-legal a, .footer-legal .link-button { color: #fff; opacity: .9; }
.footer-legal a:hover, .footer-legal .link-button:hover { opacity: 1; }

@media (max-width: 767px) {
  .footer-inner { flex-direction: column; text-align: center; }
  .footer-legal ul { justify-content: center; }
}

/* ---------- Cookies ---------- */
.cookie-banner {
  position: fixed; z-index: 200; left: var(--gutter); right: var(--gutter); bottom: var(--gutter);
  width: min(100% - 2 * var(--gutter), 46rem); margin-inline: auto;
  padding: clamp(1.1rem, 3vw, 1.75rem);
  background: #fff; color: var(--ink);
  border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: 0 18px 50px rgba(0, 0, 0, .28);
  max-height: calc(100svh - 2 * var(--gutter)); overflow: auto;
}
.cookie-banner[hidden] { display: none; }
.cookie-banner h2 { font-size: 1.25rem; margin-bottom: .4rem; }
.cookie-banner p { margin-bottom: 1rem; font-size: .95rem; }
.cookie-actions { display: flex; flex-wrap: wrap; gap: .75rem; }
.cookie-actions .btn { flex: 1 1 10rem; }

.cookie-dialog {
  width: min(100% - 2rem, 34rem); max-height: calc(100svh - 2rem);
  padding: 0; border: 0; border-radius: var(--radius); color: var(--ink);
  box-shadow: 0 24px 70px rgba(0, 0, 0, .4);
}
.cookie-dialog::backdrop { background: rgba(10, 20, 6, .6); }
.cookie-dialog form { padding: clamp(1.1rem, 3vw, 1.75rem); }
.cookie-dialog-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: 1rem; }
.cookie-dialog-head h2 { margin: 0; font-size: 1.35rem; }
.dialog-close {
  width: 44px; height: 44px; border: 0; border-radius: 50%; background: var(--soft);
  font-size: 1.6rem; line-height: 1; cursor: pointer;
}
.cookie-dialog fieldset { border: 0; margin: 0 0 1.25rem; padding: 0; display: grid; gap: .75rem; }
.switch-row {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding: 1rem; border: 1px solid var(--line); border-radius: 12px; cursor: pointer;
}
.switch-text { display: grid; gap: .2rem; }
.switch-text small { color: var(--muted); font-size: .85rem; line-height: 1.4; }
.switch-row input { flex: none; width: 1.4rem; height: 1.4rem; accent-color: var(--green-700); }

/* ---------- Páginas legais ---------- */
.legal-hero { padding: calc(var(--header-h) + 3rem) 0 2.5rem; background: var(--soft); border-bottom: 1px solid var(--line); }
.legal-hero h1 { font-size: clamp(1.9rem, 1.3rem + 2.8vw, 3rem); margin-bottom: .5rem; }
.legal-meta { color: var(--muted); margin: 0; }

.legal-wrap {
  display: grid; gap: clamp(1.5rem, 4vw, 4rem); align-items: start;
  grid-template-columns: 16rem minmax(0, 1fr);
  padding-block: clamp(2rem, 5vw, 4rem);
}
.toc {
  position: sticky; top: calc(var(--header-h) + 1rem);
  padding: 1.25rem; border: 1px solid var(--line); border-radius: var(--radius); background: #fff;
  font-size: .95rem;
}
.toc strong { display: block; margin-bottom: .6rem; }
.toc ol { list-style: none; display: grid; gap: .35rem; }
.toc a { text-decoration: none; color: var(--ink); }
.toc a:hover { color: var(--green-700); text-decoration: underline; }

.legal-body { max-width: 46rem; }
.legal-body h2 { font-size: clamp(1.3rem, 1.1rem + 1vw, 1.7rem); margin-top: 2.5rem; padding-top: .5rem; }
.legal-body h2:first-child { margin-top: 0; }
.legal-body h3 { font-size: 1.1rem; margin-top: 1.5rem; }
.legal-body ul, .legal-body ol { padding-left: 1.4rem; margin-bottom: 1em; }
.legal-body li { margin-bottom: .4em; }
.legal-body .notice {
  padding: 1rem 1.25rem; margin-bottom: 2rem;
  background: var(--soft); border-left: 4px solid var(--green-700); border-radius: 8px;
}
.table-wrap { overflow-x: auto; margin-bottom: 1.5em; border: 1px solid var(--line); border-radius: 12px; }
.table-wrap table { width: 100%; border-collapse: collapse; font-size: .92rem; min-width: 34rem; }
.table-wrap th, .table-wrap td { padding: .75rem .9rem; text-align: left; vertical-align: top; border-bottom: 1px solid var(--line); }
.table-wrap th { background: var(--soft); }
.table-wrap tr:last-child td { border-bottom: 0; }

mark.todo {
  background: #fff1a8; color: #4a3b00; padding: .05em .3em; border-radius: 4px;
  outline: 1px dashed #b58900; font-weight: 700;
}

@media (max-width: 899px) {
  .legal-wrap { grid-template-columns: minmax(0, 1fr); }
  .toc { position: static; }
}

/* ---------- Preferências do utilizador ---------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .btn:hover, .card:hover, .social:hover { transform: none; }
}

@media print {
  .site-header, .site-footer, .cookie-banner, .cookie-dialog, .skip-link, .toc { display: none !important; }
  .legal-hero { padding-top: 0; background: none; }
  .legal-wrap { display: block; }
  a { color: inherit; }
}
