/* =========================================================================
   Instituto Bíblico Maanaim — design tokens
   Palette extracted from the approved mockup (src/template.png).
   ========================================================================= */
:root {
  /* Surfaces */
  --bg:            #140e0a;
  --bg-elevated:   #1a130d;
  --panel:         #1e1814;
  --panel-border:  #33281d;
  --band:          #16100c;

  /* Text */
  --text:          #efebe4;
  --text-muted:    #b3a695;
  --text-dark:     #241b12;

  /* Brand */
  --gold:          #dbab4a;
  --gold-light:    #f3c95a;
  --gold-deep:     #9a7433;
  --royal:         #2d5dbd;
  --cream:         #efebe4;
  --gradient-gold: linear-gradient(135deg, #9a7433 0%, #dbab4a 40%, #f3c95a 60%, #c2903c 100%);

  /* Type */
  --font-display: "Cormorant Garamond", Georgia, "Times New Roman", serif;
  --font-body:    "Work Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;

  /* Layout */
  --wrap:         72rem;
  --wrap-narrow:  48rem;
  --radius:       12px;
  --header-h:     3.5rem;
  --gutter:       1.25rem;
  /* Vertical rhythm shrinks on narrow screens so a phone does not scroll
     through 5rem of empty space between every section. */
  --section-pad:  clamp(3rem, 8vw, 5rem);
  --band-pad:     clamp(2.75rem, 7vw, 4rem);
}

@media (min-width: 48rem) {
  :root { --header-h: 4.25rem; --gutter: 1.5rem; }
}

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

html { scroll-behavior: smooth; scroll-padding-top: calc(var(--header-h) + 1rem); }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 1rem;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  /* Long unbroken words (e-mail, module names) must never push the page wider
     than the viewport — horizontal scroll on a phone breaks every section. */
  overflow-x: hidden;
  overflow-wrap: break-word;
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: rgba(219, 171, 74, 0.18);
}

img { max-width: 100%; height: auto; display: block; }
a { color: inherit; }

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 100;
  padding: 0.75rem 1rem;
  background: var(--gold);
  color: var(--text-dark);
  font-weight: 700;
}
.skip-link:focus { left: 0; }

:focus-visible {
  outline: 2px solid var(--gold-light);
  outline-offset: 3px;
  border-radius: 4px;
}

/* ---------- Layout primitives ---------- */
.wrap {
  width: 100%;
  max-width: var(--wrap);
  margin-inline: auto;
  /* env() keeps content clear of the rounded corners / notch on modern phones. */
  padding-left: max(var(--gutter), env(safe-area-inset-left));
  padding-right: max(var(--gutter), env(safe-area-inset-right));
}
.wrap.narrow { max-width: var(--wrap-narrow); }
.center { text-align: center; }
.section { padding-block: var(--section-pad); }
/* The two closing CTA sections sit back to back; without this their paddings
   add up to a screen-and-a-half of empty space on a phone. */
.section.center + .section.center { padding-top: 0; }
.band {
  padding-block: var(--band-pad);
  background: var(--band);
  border-block: 1px solid var(--panel-border);
}

/* ---------- Typography ---------- */
.eyebrow {
  margin: 0;
  font-family: var(--font-display);
  font-size: 0.75rem;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.section-head { text-align: center; margin-bottom: clamp(2rem, 5vw, 3rem); }
.section-head .section-title { margin-top: 0.75rem; }

.section-title {
  font-family: var(--font-display);
  font-size: clamp(1.875rem, 7vw, 2.5rem);
  font-weight: 700;
  line-height: 1.15;
  margin: 0;
  color: var(--gold);
  text-wrap: balance;
}

.section-sub {
  max-width: 40rem;
  margin: 1rem auto 0;
  color: var(--text-muted);
  text-align: center;
  text-wrap: pretty;
}

/* A CTA placed directly after the section intro needs its own breathing room —
   .section-sub carries no bottom margin. */
.section-sub + .btn { margin-top: 2rem; }

.gold-gradient {
  background: var(--gradient-gold);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.prose {
  margin-top: 1.5rem;
  font-size: clamp(1rem, 0.95rem + 0.4vw, 1.125rem);
  line-height: 1.75;
  color: var(--text-muted);
  text-wrap: pretty;
}

.lead {
  margin-top: 1.25rem;
  max-width: 36rem;
  font-size: clamp(1rem, 0.95rem + 0.4vw, 1.125rem);
  color: var(--text-muted);
  text-wrap: pretty;
}

.fineprint { margin-top: 1.5rem; font-size: 0.875rem; color: var(--text-muted); }

/* ---------- Header ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  border-bottom: 1px solid var(--panel-border);
  background: rgba(20, 14, 10, 0.82);
  backdrop-filter: blur(12px);
  transition: box-shadow 0.25s ease;
}
.site-header.is-scrolled { box-shadow: 0 8px 24px -12px rgba(0, 0, 0, 0.9); }

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  min-height: var(--header-h);
  padding-block: 0.5rem;
}
@media (min-width: 48rem) { .header-inner { gap: 1rem; padding-block: 0.75rem; } }

.brand { display: flex; align-items: center; gap: 0.625rem; text-decoration: none; min-width: 0; }
.brand img { width: 2.25rem; height: auto; flex: none; }
@media (min-width: 48rem) { .brand img { width: 2.75rem; } }
.brand-name {
  font-family: var(--font-display);
  font-size: 0.8125rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  line-height: 1.15;
  text-transform: uppercase;
  color: var(--gold);
}
@media (min-width: 48rem) { .brand-name { font-size: 0.875rem; letter-spacing: 0.18em; } }
/* Below this width the full name plus the CTA cannot share one line, so the
   name breaks after "Instituto Bíblico" instead of disappearing entirely. */
@media (max-width: 30rem) {
  .brand-name { font-size: 0.6875rem; letter-spacing: 0.06em; max-width: 8.25rem; }
}
@media (max-width: 22rem) { .brand-name { display: none; } }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.75rem 1.5rem;
  min-height: 2.75rem;          /* 44px — minimum comfortable touch target */
  border-radius: var(--radius);
  border: 1px solid transparent;
  font-family: var(--font-body);
  font-size: 0.875rem;
  font-weight: 700;
  line-height: 1.25;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  transition: transform 0.12s ease, background-color 0.2s ease, box-shadow 0.2s ease, filter 0.2s ease;
}
.btn:active { transform: scale(0.985); }

.btn-gold {
  background: var(--gradient-gold);
  color: #201607;
  box-shadow: 0 8px 24px -14px rgba(219, 171, 74, 0.9);
}
.btn-gold:hover { filter: brightness(1.08); }

.btn-outline {
  border-color: var(--panel-border);
  color: var(--text);
  background: transparent;
}
.btn-outline:hover { background: rgba(239, 235, 228, 0.06); }

.btn-sm { padding: 0.5rem 1rem; }
.btn-lg { padding: 0.875rem 1.5rem; }
@media (min-width: 40rem) { .btn-lg { padding: 1rem 2rem; font-size: 1rem; } }
.btn-block { width: 100%; max-width: 24rem; }

/* The header CTA is the widest thing in the bar; shrink it on phones so the
   crest and name are not squeezed off the line. */
@media (max-width: 30rem) {
  .header-inner .btn-sm { padding: 0.5rem 0.75rem; font-size: 0.75rem; }
}
/* The CTA keeps its natural width and the brand name takes what is left,
   so the button never breaks across two lines. */
.header-inner .btn { white-space: nowrap; flex: none; }

/* ---------- Hero ---------- */
.hero { padding-block: clamp(2rem, 6vw, 4rem) clamp(3rem, 8vw, 5rem); }
.hero-grid { display: grid; gap: clamp(1.75rem, 6vw, 2.5rem); align-items: center; }
@media (min-width: 48rem) {
  .hero { padding-block: 6rem; }
  .hero-grid { grid-template-columns: 1.1fr 0.9fr; gap: 3rem; }
}

.hero-title {
  margin: 1rem 0 0;
  font-family: var(--font-display);
  font-size: clamp(2.125rem, 9vw, 3.5rem);
  font-weight: 700;
  line-height: 1.1;
  text-wrap: balance;
}

.hero-actions {
  margin-top: 1.75rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
}
/* Equal-width buttons: side by side when they fit, evenly stacked when not —
   the ragged auto-width stack read as a mistake on narrow screens. */
.hero-actions .btn { flex: 1 1 13rem; }
@media (min-width: 48rem) {
  .hero-actions { margin-top: 2.25rem; gap: 1rem; }
  .hero-actions .btn { flex: 0 0 auto; }
}

.hero-crest { position: relative; display: flex; justify-content: center; }
.hero-crest img { position: relative; width: min(24rem, 100%); }
/* On a phone the crest is decorative below the fold — cap it so it does not
   eat a full screen of scroll before the first section. */
@media (max-width: 47.99rem) { .hero-crest img { width: min(15rem, 72%); } }
/* The crest asset carries its own transparent padding, so the glow is inset
   to sit behind the shield itself rather than the empty margins. */
.hero-glow {
  position: absolute;
  inset: 12%;
  border-radius: 50%;
  background: var(--gradient-gold);
  opacity: 0.16;
  filter: blur(64px);
}

/* ---------- Declaração de Fé ---------- */
.faith-grid { display: grid; gap: 1rem; }
@media (min-width: 40rem) { .faith-grid { gap: 1.5rem; } }
@media (min-width: 40rem) { .faith-grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 64rem) { .faith-grid { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 39.99rem) { .panel h3 { font-size: 1.0625rem; } }

.panel {
  padding: 1.25rem;
  border-radius: var(--radius);
  background: var(--panel);
  border: 1px solid var(--panel-border);
  box-shadow: inset 0 1px 0 rgba(239, 235, 228, 0.04);
}
@media (min-width: 40rem) { .panel { padding: 1.5rem; } }
.panel h3 {
  margin: 0;
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--gold);
}
.panel p {
  margin: 0.75rem 0 0;
  font-size: 0.875rem;
  line-height: 1.65;
  color: var(--text-muted);
}

.creed-seal {
  margin-top: 2.5rem;
  text-align: center;
  font-family: var(--font-display);
  font-size: 1.5rem;
}

/* ---------- Cursos ---------- */
.course-list { margin-top: clamp(2rem, 5vw, 3rem); display: grid; gap: 1.25rem; }
@media (min-width: 40rem) { .course-list { gap: 1.5rem; } }

.course {
  padding: 1.25rem;
  border-radius: var(--radius);
  background: var(--cream);
  color: var(--text-dark);
  box-shadow: 0 18px 40px -28px rgba(0, 0, 0, 0.9);
}
@media (min-width: 40rem) { .course { padding: 2rem; } }

.course-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem 0.75rem;
}
.course-head h3 {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(1.25rem, 5vw, 1.5rem);
  font-weight: 700;
  line-height: 1.2;
  color: var(--royal);
  text-wrap: balance;
}

.badge {
  border: 1px solid rgba(45, 93, 189, 0.3);
  border-radius: 999px;
  padding: 0.25rem 0.75rem;
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--royal);
  white-space: nowrap;
}

.course-prereq { margin: 0.75rem 0 0; font-size: 0.875rem; font-weight: 600; }

.modules {
  margin: 1.25rem 0 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 0.5rem;
}
@media (min-width: 40rem) { .modules { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 64rem) { .modules { grid-template-columns: repeat(3, 1fr); } }
.modules li {
  position: relative;
  padding-left: 1.25rem;
  font-size: 0.875rem;
  line-height: 1.35;
}
.modules li::before {
  content: "✦";
  position: absolute;
  left: 0;
  color: var(--gold-deep);
}

/* Collapsible module lists (phones only, added by script.js).
   Without JS every list stays open, exactly as before. */
.course-toggle {
  display: none;
  width: 100%;
  margin-top: 1.25rem;
  padding: 0.75rem 1rem;
  min-height: 2.75rem;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  border: 1px solid rgba(45, 93, 189, 0.35);
  border-radius: var(--radius);
  background: rgba(45, 93, 189, 0.06);
  color: var(--royal);
  font-family: var(--font-body);
  font-size: 0.8125rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  cursor: pointer;
}
.course-toggle::after {
  content: "";
  width: 0.5rem;
  height: 0.5rem;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: translateY(-2px) rotate(45deg);
  transition: transform 0.2s ease;
}
.course-toggle[aria-expanded="true"]::after { transform: translateY(1px) rotate(-135deg); }

.course.is-collapsible .course-toggle { display: flex; }
.course.is-collapsible .modules { display: none; }
.course.is-collapsible.is-open .modules { display: grid; margin-top: 1rem; }

/* ---------- Quote band ---------- */
.quote { max-width: var(--wrap-narrow); margin-inline: auto; text-align: center; }
.quote-text {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(1.375rem, 6vw, 2rem);
  line-height: 1.4;
  color: var(--gold);
  text-wrap: balance;
}
.quote footer { margin-top: 1.25rem; color: var(--text-muted); text-wrap: pretty; }

/* ---------- Contato ---------- */
.contact-actions {
  margin-top: 2rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
}
.contact-actions .btn { padding-block: 1rem; overflow-wrap: anywhere; }
/* The e-mail address is 33 characters — at the default button size it fills the
   whole line on a 360px screen and looks like it is about to break. */
@media (max-width: 30rem) { .contact-actions .btn { font-size: 0.8125rem; } }

/* ---------- Footer ---------- */
.site-footer {
  border-top: 1px solid var(--panel-border);
  padding-block: 2.5rem;
  text-align: center;
  font-size: 0.875rem;
  color: var(--text-muted);
}
.footer-brand {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(0.875rem, 3.5vw, 1rem);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--gold);
}
@media (min-width: 40rem) { .footer-brand { letter-spacing: 0.2em; } }
.footer-ref { margin: 0.75rem 0 0; font-family: var(--font-display); font-size: 1.125rem; }
.footer-verse { max-width: 36rem; margin: 0.75rem auto 0; font-style: italic; line-height: 1.7; }

/* ---------- Reveal on scroll (progressively enhanced by script.js) ---------- */
.js .reveal { opacity: 0; transform: translateY(16px); }
.js .reveal.is-visible {
  opacity: 1;
  transform: none;
  transition: opacity 0.6s ease, transform 0.6s ease;
}
@media (prefers-reduced-motion: reduce) {
  .js .reveal { opacity: 1; transform: none; }
}
