/* =========================================================================
   Vagas e Bolsas — camada de design profissional (carregada por último)
   Mantém a identidade Brevemito (dourado #F6BC01, zinco da Mafalala,
   faixa capulana) e acrescenta: cabeçalho fixo com navegação, destaque
   com contadores, cartões com acções (guardar/partilhar), estados de
   carregamento, painel "Guardadas", barra do canal e rodapé completo.
   ========================================================================= */

:root {
  --header-h: 68px;
  --shadow-sm: 0 1px 2px rgba(28, 25, 18, 0.06), 0 1px 1px rgba(28, 25, 18, 0.04);
  --shadow-md: 0 8px 24px -8px rgba(28, 25, 18, 0.18);
  --shadow-lg: 0 24px 48px -16px rgba(28, 25, 18, 0.32);
  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
  --whatsapp: #128C4A;
}

html {
  scroll-padding-top: calc(var(--header-h) + 64px);
}

body {
  text-rendering: optimizeLegibility;
}

body.no-scroll {
  overflow: hidden;
}

::selection {
  background: var(--gold);
  color: var(--ink);
}

:focus-visible {
  outline: 3px solid var(--capulana-indigo);
  outline-offset: 2px;
}

.skip-link {
  position: absolute;
  left: 12px;
  top: -60px;
  z-index: 100;
  background: var(--ink);
  color: var(--cream);
  padding: 10px 16px;
  border-radius: var(--radius);
  font-weight: 600;
  text-decoration: none;
}

.skip-link:focus {
  top: 12px;
}

/* ---------- botões genéricos ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 46px;
  padding: 0 22px;
  border-radius: 999px;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.95rem;
  text-decoration: none;
  transition: transform 160ms var(--ease), box-shadow 160ms var(--ease), background 160ms var(--ease);
}

.btn-primary {
  background: var(--gold);
  color: var(--ink);
  box-shadow: 0 4px 0 var(--gold-deep);
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 5px 0 var(--gold-deep);
}

.btn-primary:active {
  transform: translateY(3px);
  box-shadow: 0 1px 0 var(--gold-deep);
}

.btn-ghost {
  color: var(--cream);
  border: 1.5px solid rgba(242, 236, 221, 0.45);
}

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

.btn-whatsapp {
  background: var(--whatsapp);
  color: #fff;
  min-height: 40px;
  padding: 0 18px;
  white-space: nowrap;
}

.icon-btn {
  appearance: none;
  border: 0;
  background: transparent;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  font-size: 1.5rem;
  line-height: 1;
  color: inherit;
  cursor: pointer;
  flex-shrink: 0;
}

.icon-btn:hover {
  background: rgba(28, 25, 18, 0.08);
}

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

.site-header {
  position: sticky;
  top: 0;
  z-index: 40;
  padding: 0;
  background: rgba(255, 255, 255, 0.92);
  -webkit-backdrop-filter: saturate(160%) blur(10px);
  backdrop-filter: saturate(160%) blur(10px);
  border-bottom: 1px solid var(--border);
}

.header-inner {
  min-height: var(--header-h);
  display: flex;
  align-items: center;
  gap: 20px;
  flex-wrap: nowrap !important;
}

.site-header .brand {
  text-decoration: none;
  color: inherit;
  flex-shrink: 0;
}

.brand-sep {
  color: var(--gold-deep);
  font-weight: 500;
  margin: 0 2px;
}

.site-nav {
  display: flex;
  gap: 4px;
  margin-left: auto;
}

.site-nav a {
  position: relative;
  padding: 10px 14px;
  border-radius: 999px;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.92rem;
  color: var(--ink-soft);
  text-decoration: none;
}

.site-nav a:hover {
  color: var(--ink);
  background: rgba(246, 188, 1, 0.14);
}

.site-nav a[aria-current="page"] {
  color: var(--ink);
}

.site-nav a[aria-current="page"]::after {
  content: "";
  position: absolute;
  left: 14px;
  right: 14px;
  bottom: 4px;
  height: 3px;
  border-radius: 3px;
  background: var(--gold);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.saved-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  padding: 0 14px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--panel);
  color: var(--ink);
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 0.88rem;
  cursor: pointer;
}

.saved-toggle:hover {
  border-color: var(--ink-faint);
}

.saved-count {
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--gold);
  color: var(--ink);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.site-header #bm-header-donate-btn {
  min-height: 40px;
  padding: 0 16px;
}

@media (max-width: 860px) {
  .site-nav {
    display: none;
  }
  .header-actions {
    margin-left: auto;
  }
}

@media (max-width: 560px) {
  :root {
    --header-h: 60px;
  }
  .brand-tagline,
  .saved-toggle-label,
  .donate-label {
    display: none;
  }
  .brand-name {
    font-size: 1rem;
  }
  .brand-logo {
    width: 36px;
    height: 36px;
  }
  .saved-toggle,
  .site-header #bm-header-donate-btn {
    padding: 0 12px;
  }
}

/* ---------- destaque (hero) ---------- */

.hero {
  position: relative;
  overflow: hidden;
  color: var(--cream);
  background:
    radial-gradient(1200px 400px at 85% -10%, rgba(246, 188, 1, 0.22), transparent 60%),
    radial-gradient(800px 300px at -10% 110%, rgba(27, 75, 107, 0.55), transparent 60%),
    repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.03) 0 2px, transparent 2px 14px),
    var(--zinc);
}

/* Motivo geométrico discreto, inspirado nos padrões das capulanas */
.hero::after {
  content: "";
  position: absolute;
  right: -60px;
  top: -60px;
  width: 360px;
  height: 360px;
  opacity: 0.12;
  background:
    conic-gradient(from 45deg, var(--gold) 0 25%, transparent 0 50%, var(--capulana-red) 0 75%, transparent 0) 0 0 / 60px 60px;
  border-radius: 50%;
  -webkit-mask: radial-gradient(circle, #000 55%, transparent 70%);
  mask: radial-gradient(circle, #000 55%, transparent 70%);
  pointer-events: none;
}

.hero-inner {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: 1.25fr 1fr;
  gap: 40px;
  align-items: center;
  padding-top: 56px;
  padding-bottom: 56px;
}

.hero-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 14px;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--gold);
}

.live-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #3DDC84;
  box-shadow: 0 0 0 0 rgba(61, 220, 132, 0.6);
  animation: pulse 2.2s infinite;
}

@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(61, 220, 132, 0.55); }
  70% { box-shadow: 0 0 0 10px rgba(61, 220, 132, 0); }
  100% { box-shadow: 0 0 0 0 rgba(61, 220, 132, 0); }
}

.hero h1 {
  margin: 0 0 14px;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(2rem, 4.6vw, 3.25rem);
  line-height: 1.05;
  letter-spacing: -0.02em;
  color: #fff;
  text-wrap: balance;
}

.hero-lead {
  margin: 0 0 26px;
  max-width: 52ch;
  font-size: 1.05rem;
  line-height: 1.6;
  color: rgba(242, 236, 221, 0.85);
}

.hero-cta {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.hero-stats {
  margin: 0;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.hero-stat {
  padding: 18px 20px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(242, 236, 221, 0.14);
}

.hero-stat dt {
  font-size: 0.8rem;
  color: rgba(242, 236, 221, 0.75);
  margin-bottom: 6px;
}

.hero-stat dd {
  margin: 0;
}

.hero-stat-accent {
  grid-column: 1 / -1;
  background: rgba(246, 188, 1, 0.12);
  border-color: rgba(246, 188, 1, 0.4);
}

.stat-number {
  font-family: var(--font-mono);
  font-weight: 600;
  font-size: clamp(2rem, 4vw, 2.6rem);
  line-height: 1;
  color: var(--gold);
  font-variant-numeric: tabular-nums;
}

.hero-updated {
  grid-column: 1 / -1;
  margin: 2px 0 0;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: rgba(242, 236, 221, 0.7);
}

@media (max-width: 860px) {
  .hero-inner {
    grid-template-columns: 1fr;
    gap: 28px;
    padding-top: 36px;
    padding-bottom: 36px;
  }
}

/* Telemóvel: destaque compacto, para as vagas aparecerem logo */
@media (max-width: 560px) {
  .hero-inner {
    padding-top: 24px;
    padding-bottom: 24px;
    gap: 18px;
  }
  .hero-eyebrow {
    margin-bottom: 10px;
    font-size: 0.7rem;
  }
  .hero h1 {
    font-size: 1.75rem;
    margin-bottom: 0;
  }
  .hero-lead,
  .hero-cta {
    display: none;
  }
  .hero-stats {
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
  }
  .hero-stat,
  .hero-stat-accent {
    grid-column: auto;
    padding: 12px;
  }
  .hero-stat dt {
    font-size: 0.7rem;
    line-height: 1.3;
  }
  .stat-number {
    font-size: 1.6rem;
  }
  .tab-long {
    display: none;
  }
}

/* ---------- separadores fixos ao fazer scroll ---------- */

.tabs {
  position: sticky;
  top: var(--header-h);
  z-index: 30;
  background: var(--paper);
  margin-top: 0;
  padding-top: 14px;
}

/* ---------- controlos ---------- */

.control {
  min-height: 46px;
  transition: border-color 160ms var(--ease), box-shadow 160ms var(--ease);
}

.control:hover {
  border-color: var(--ink-faint);
}

.control:focus-visible {
  border-color: var(--capulana-indigo);
  box-shadow: 0 0 0 4px rgba(27, 75, 107, 0.15);
  outline: none;
}

/* ---------- cartões ---------- */

.job-card {
  box-shadow: var(--shadow-sm);
  transition: transform 180ms var(--ease), box-shadow 180ms var(--ease), border-color 180ms var(--ease);
}

.job-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.job-card.is-new {
  border-left-color: #3DAA6B;
}

.badge-new {
  display: inline-block;
  vertical-align: 2px;
  margin-right: 8px;
  padding: 2px 8px;
  border-radius: 6px;
  background: #E5F6EC;
  color: #17643A;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.job-title {
  line-height: 1.35;
}

.card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.card-action {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 34px;
  padding: 0 12px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--panel);
  color: var(--ink-soft);
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 0.8rem;
  text-decoration: none;
  cursor: pointer;
  transition: background 160ms var(--ease), border-color 160ms var(--ease), color 160ms var(--ease);
}

.card-action svg path[stroke] {
  fill: none;
}

.card-action:hover {
  border-color: var(--ink-faint);
  color: var(--ink);
}

.card-save[aria-pressed="true"] {
  background: #FFF6D6;
  border-color: var(--gold);
  color: var(--ink);
}

.card-save[aria-pressed="true"] svg path {
  fill: var(--gold);
}

.card-share:hover {
  border-color: var(--whatsapp);
  color: var(--whatsapp);
}

.job-apply {
  min-height: 42px;
  display: inline-flex;
  align-items: center;
}

/* ---------- carregamento (esqueleto) ---------- */

.skeleton-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.skeleton-card {
  height: 96px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0) 0, rgba(255, 255, 255, 0.7) 50%, rgba(255, 255, 255, 0) 100%) -400px 0 / 400px 100% no-repeat,
    linear-gradient(var(--border), var(--border)) 20px 24px / 55% 14px no-repeat,
    linear-gradient(var(--border), var(--border)) 20px 52px / 35% 10px no-repeat,
    var(--panel);
  animation: shimmer 1.4s infinite linear;
}

@keyframes shimmer {
  to { background-position: calc(100% + 400px) 0, 20px 24px, 20px 52px, 0 0; }
}

/* ---------- "Terminam em breve" ---------- */

.soon-strip {
  margin: 22px 0 0;
  padding: 16px 18px;
  border-radius: 14px;
  background: #FFF4F2;
  border: 1px solid #F3C9C2;
}

.soon-title {
  margin: 0 0 10px;
  font-family: var(--font-display);
  font-weight: 700;
  color: var(--capulana-red);
}

.soon-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 8px;
}

.soon-list a {
  display: flex;
  flex-direction: column;
  gap: 4px;
  height: 100%;
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--panel);
  border: 1px solid #F3C9C2;
  text-decoration: none;
  color: var(--ink);
}

.soon-list a:hover {
  border-color: var(--capulana-red);
}

.soon-name {
  font-weight: 600;
  font-size: 0.88rem;
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.soon-days {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--capulana-red);
}

/* ---------- anúncio no meio da lista de bolsas ---------- */

.list-ad .bm-chess-ad {
  max-width: none;
  margin: 8px 0;
}

/* ---------- banner do canal e bloco do curso ---------- */

.channel-banner {
  margin-top: 8px;
  margin-bottom: 40px;
}

.channel-banner img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 14px;
  box-shadow: var(--shadow-md);
  transition: transform 200ms var(--ease);
}

.channel-banner a:hover img {
  transform: translateY(-2px);
}

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

.site-footer {
  padding: 40px 0 48px;
}

.footer-grid {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 24px 40px;
}

.footer-brand {
  display: flex;
  gap: 14px;
  align-items: flex-start;
}

.site-footer .footer-logo {
  width: 40px;
  height: 40px;
}

.footer-name {
  margin: 0 0 4px !important;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--gold);
  opacity: 1 !important;
}

.footer-text {
  max-width: 44ch;
  line-height: 1.6;
}

.footer-links {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px 20px;
  align-content: start;
}

.footer-links a {
  color: var(--cream);
  text-decoration: none;
  opacity: 0.85;
}

.footer-links a:hover {
  color: var(--gold);
  opacity: 1;
}

.footer-note,
.footer-copy {
  grid-column: 1 / -1;
  margin: 0;
  font-size: 0.78rem;
  line-height: 1.6;
}

.footer-note {
  padding-top: 20px;
  border-top: 1px solid rgba(242, 236, 221, 0.15);
}

@media (max-width: 720px) {
  .footer-grid {
    grid-template-columns: 1fr;
  }
}

/* ---------- painel "Guardadas" ---------- */

.drawer {
  position: fixed;
  inset: 0;
  z-index: 60;
}

.drawer-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(28, 25, 18, 0.5);
  animation: fade-in 200ms var(--ease);
}

.drawer-panel {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(420px, 100%);
  background: var(--paper);
  box-shadow: var(--shadow-lg);
  padding: 18px 20px 28px;
  overflow-y: auto;
  animation: slide-in 260ms var(--ease);
}

@keyframes fade-in { from { opacity: 0; } }
@keyframes slide-in { from { transform: translateX(40px); opacity: 0; } }

.drawer-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.drawer-head h2 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.3rem;
}

.drawer-hint,
.drawer-empty {
  font-size: 0.85rem;
  color: var(--ink-soft);
  line-height: 1.5;
}

.saved-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.saved-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 8px 12px 14px;
  border-radius: var(--radius);
  background: var(--panel);
  border: 1px solid var(--border);
}

.saved-link {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
  text-decoration: none;
  color: var(--ink);
}

.saved-kind {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--gold-deep);
}

.saved-title {
  font-weight: 600;
  font-size: 0.9rem;
  line-height: 1.35;
}

.saved-org {
  font-size: 0.78rem;
  color: var(--ink-soft);
}

/* ---------- barra do canal (aparece a meio da página) ---------- */

.channel-bar {
  position: fixed;
  left: 50%;
  bottom: 16px;
  z-index: 50;
  transform: translateX(-50%);
  width: min(760px, calc(100% - 24px));
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 10px 12px 18px;
  border-radius: 16px;
  background: var(--ink);
  color: var(--cream);
  box-shadow: var(--shadow-lg);
  animation: rise 320ms var(--ease);
}

.channel-bar p {
  margin: 0;
  font-size: 0.88rem;
  line-height: 1.45;
}

.channel-bar strong {
  color: var(--gold);
}

.channel-bar .icon-btn:hover {
  background: rgba(255, 255, 255, 0.1);
}

@keyframes rise { from { transform: translate(-50%, 24px); opacity: 0; } }

@media (max-width: 560px) {
  .channel-bar {
    flex-wrap: wrap;
    padding: 14px;
  }
  .channel-bar p {
    flex: 1 1 calc(100% - 50px);
  }
  .channel-bar .btn-whatsapp {
    flex: 1;
  }
}

/* ---------- voltar ao topo e aviso rápido ---------- */

.back-to-top {
  position: fixed;
  right: 16px;
  bottom: 96px;
  z-index: 45;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  border: 0;
  background: var(--gold);
  color: var(--ink);
  box-shadow: var(--shadow-md);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.toast {
  position: fixed;
  left: 50%;
  top: calc(var(--header-h) + 12px);
  z-index: 70;
  transform: translate(-50%, -8px);
  opacity: 0;
  padding: 10px 16px;
  border-radius: 999px;
  background: var(--ink);
  color: var(--cream);
  font-size: 0.85rem;
  box-shadow: var(--shadow-md);
  transition: opacity 200ms var(--ease), transform 200ms var(--ease);
}

.toast.is-visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

/* ---------- impressão e acessibilidade ---------- */

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }
}

@media print {
  .site-header,
  .hero,
  .tabs,
  .controls,
  .card-actions,
  .list-ad,
  .channel-bar,
  .back-to-top,
  .channel-banner,
  .bm-curso-ingles {
    display: none !important;
  }
}
