/* ============================================================
   Second Opinion — site design system
   Shared across the landing page and (via site-frame.js) every
   module page. Mirrors the palette used in the compiled e-book.
   ============================================================ */

:root {
  --bg: #faf9f6;
  --surface: #ffffff;
  --surface-2: #f3ebe1;
  --border: #e2ddd3;
  --text: #2b2823;
  --text-muted: #6b6459;
  --accent: #8a5a3f;
  --accent-strong: #6e4530;
  --accent-soft: #f3ebe1;
  --navy: #2b3a4a;
  --navy-2: #3a4d61;
  --amber: #d9a577;
  --know: #4a7a5c; --know-bg: #eaf3ec;
  --find: #4a6a8a; --find-bg: #eaf0f7;
  --think: #8a6a3f; --think-bg: #f6efe1;
  --warn: #a04f4f; --warn-bg: #f7e9e9;
  --radius: 10px;
  --radius-lg: 16px;
  --shadow: 0 4px 18px rgba(43, 40, 35, 0.08);
  --max-w: 1120px;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #1c1a17;
    --surface: #26221d;
    --surface-2: #332a21;
    --border: #3a352c;
    --text: #ece7dc;
    --text-muted: #a89f8f;
    --accent: #d9a577;
    --accent-strong: #e9bd97;
    --accent-soft: #332a21;
    --navy: #1c2530;
    --navy-2: #263241;
    --know: #8fc9a1; --know-bg: #223228;
    --find: #93b8d9; --find-bg: #202b36;
    --think: #d9bd7f; --think-bg: #332c1e;
    --warn: #d99494; --warn-bg: #362424;
    --shadow: 0 4px 18px rgba(0, 0, 0, 0.35);
  }
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Georgia, serif;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; display: block; }
a { color: var(--accent); }
h1, h2, h3, h4 { font-family: Georgia, "Times New Roman", serif; line-height: 1.2; color: var(--navy); }
:root:not([data-theme="light"]) h1, :root:not([data-theme="light"]) h2,
:root:not([data-theme="light"]) h3, :root:not([data-theme="light"]) h4 { color: var(--text); }
.wrap { max-width: var(--max-w); margin: 0 auto; padding: 0 1.4rem; }

/* ---------- Skip link ---------- */
.skip-link {
  position: absolute; left: -999px; top: 0; z-index: 200;
  background: var(--navy); color: #fff; padding: 0.6rem 1rem; border-radius: 0 0 8px 0;
}
.skip-link:focus { left: 0; }

/* ---------- Site header / nav ---------- */
.site-header {
  position: sticky; top: 0; z-index: 100;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
}
.site-header .bar {
  max-width: var(--max-w); margin: 0 auto; padding: 0.75rem 1.4rem;
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
}
.brand { display: flex; align-items: center; gap: 0.6rem; text-decoration: none; color: var(--navy); }
:root:not([data-theme="light"]) .brand { color: var(--text); }
.brand .mark {
  width: 34px; height: 34px; border-radius: 9px;
  background: linear-gradient(155deg, var(--navy) 0%, var(--navy-2) 55%, var(--accent) 165%);
  display: flex; align-items: center; justify-content: center;
  color: #f4efe6; font-family: Georgia, serif; font-weight: 700; font-size: 0.95rem; letter-spacing: -0.02em;
  flex-shrink: 0;
}
.brand .name { font-family: Georgia, serif; font-weight: 700; font-size: 1.08rem; letter-spacing: -0.01em; }
.brand .name small { display: block; font-family: -apple-system, sans-serif; font-weight: 400; font-size: 0.68rem; color: var(--text-muted); letter-spacing: 0.03em; text-transform: uppercase; margin-top: 1px; }

.nav-links { display: flex; align-items: center; gap: 1.7rem; }
.nav-links a {
  color: var(--text); text-decoration: none; font-size: 0.92rem; font-weight: 500;
  padding: 0.3rem 0.1rem; border-bottom: 2px solid transparent;
}
.nav-links a:hover, .nav-links a.active { color: var(--accent); border-bottom-color: var(--accent); }
.nav-cta {
  background: var(--navy); color: #fdfaf5 !important; padding: 0.55rem 1.05rem !important;
  border-radius: 999px; border-bottom: none !important; font-weight: 600 !important;
}
.nav-cta:hover { opacity: 0.9; border-bottom: none !important; }

.lang-switch { display: flex; border: 1px solid var(--border); border-radius: 999px; overflow: hidden; font-size: 0.78rem; }
.lang-switch button {
  border: none; background: transparent; color: var(--text-muted); padding: 0.35rem 0.7rem; cursor: pointer;
  font-family: inherit; font-weight: 600; letter-spacing: 0.02em;
}
.lang-switch button.active { background: var(--navy); color: #fff; }

.hamburger {
  display: none; flex-direction: column; justify-content: center; gap: 4px;
  width: 40px; height: 40px; border: 1px solid var(--border); border-radius: 8px;
  background: var(--surface); cursor: pointer; padding: 0;
}
.hamburger span { width: 18px; height: 2px; background: var(--text); margin: 0 auto; border-radius: 2px; transition: transform 0.2s, opacity 0.2s; }
.hamburger[aria-expanded="true"] span:nth-child(1) { transform: translateY(6px) rotate(45deg); }
.hamburger[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.hamburger[aria-expanded="true"] span:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }

.mobile-menu {
  display: none; position: fixed; inset: 0; z-index: 150;
  background: rgba(20, 18, 16, 0.55);
}
.mobile-menu.open { display: block; }
.mobile-menu .panel {
  position: absolute; top: 0; right: 0; height: 100%; width: min(320px, 86vw);
  background: var(--bg); box-shadow: -8px 0 24px rgba(0,0,0,0.2);
  padding: 1.4rem 1.4rem 2rem; display: flex; flex-direction: column; gap: 0.3rem;
  animation: slideIn 0.22s ease;
}
@keyframes slideIn { from { transform: translateX(100%); } to { transform: translateX(0); } }
.mobile-menu .panel-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1rem; }
.mobile-menu .close-btn { border: none; background: none; font-size: 1.6rem; line-height: 1; color: var(--text-muted); cursor: pointer; padding: 0.2rem 0.5rem; }
.mobile-menu a {
  color: var(--text); text-decoration: none; font-size: 1.05rem; padding: 0.75rem 0.2rem;
  border-bottom: 1px solid var(--border);
}
.mobile-menu .nav-cta { text-align: center; margin-top: 1rem; }
.mobile-menu .lang-switch { margin-top: 1.2rem; align-self: flex-start; }

@media (max-width: 860px) {
  .nav-links { display: none; }
  .hamburger { display: flex; }
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem;
  padding: 0.85rem 1.5rem; border-radius: 999px; font-weight: 600; font-size: 0.98rem;
  text-decoration: none; cursor: pointer; border: 1px solid transparent; font-family: inherit;
  transition: transform 0.12s ease, opacity 0.12s ease;
}
.btn:active { transform: scale(0.98); }
.btn-primary { background: var(--navy); color: #fdfaf5; }
.btn-primary:hover { opacity: 0.92; }
.btn-accent { background: var(--accent); color: #fff; }
.btn-accent:hover { opacity: 0.92; }
.btn-outline { background: transparent; color: var(--text); border-color: var(--border); }
.btn-outline:hover { border-color: var(--accent); color: var(--accent); }
.btn-block { width: 100%; }
.btn[disabled] { opacity: 0.6; cursor: not-allowed; }

/* ---------- Hero ---------- */
.hero {
  background: linear-gradient(155deg, var(--navy) 0%, var(--navy-2) 55%, var(--accent) 165%);
  color: #f4efe6; padding: 4rem 0 4.5rem; position: relative; overflow: hidden;
}
.hero .wrap { display: grid; grid-template-columns: 1.15fr 0.85fr; gap: 3rem; align-items: center; }
.hero .eyebrow { font-size: 0.8rem; letter-spacing: 0.14em; text-transform: uppercase; color: #d9c9b0; margin: 0 0 1rem; }
.hero h1 { color: #fdfaf5; font-size: clamp(2rem, 4.2vw, 3.1rem); margin: 0 0 1.1rem; letter-spacing: -0.01em; }
.hero p.lede { font-size: 1.12rem; color: #e7dcc9; max-width: 40em; margin: 0 0 1.6rem; }
.hero .cta-row { display: flex; flex-wrap: wrap; gap: 0.9rem; margin-top: 1.6rem; }
.hero .stats { display: flex; gap: 2.2rem; margin-top: 2.4rem; flex-wrap: wrap; }
.hero .stats div strong { display: block; font-size: 1.4rem; color: #fdfaf5; }
.hero .stats div span { font-size: 0.74rem; text-transform: uppercase; letter-spacing: 0.05em; color: #cdbfa4; }
.hero .quote-card {
  background: rgba(255,255,255,0.08); border: 1px solid rgba(255,255,255,0.18);
  border-radius: var(--radius-lg); padding: 1.6rem 1.7rem; backdrop-filter: blur(4px);
}
.hero .quote-card p { font-style: italic; color: #f4efe6; font-size: 1.15rem; margin: 0 0 0.8rem; }
.hero .quote-card .who { font-size: 0.82rem; color: #cdbfa4; }
.hero .book-cover {
  width: 100%; aspect-ratio: 210/297; border-radius: 10px; overflow: hidden;
  box-shadow: 0 18px 40px rgba(0,0,0,0.35); border: 1px solid rgba(255,255,255,0.15);
}
@media (max-width: 900px) {
  .hero .wrap { grid-template-columns: 1fr; }
}

/* ---------- Sections ---------- */
section.block { padding: 4rem 0; }
section.block.tight { padding: 2.5rem 0; }
.block .kicker { font-size: 0.78rem; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; color: var(--accent); margin: 0 0 0.6rem; }
.block h2 { font-size: clamp(1.5rem, 3vw, 2.1rem); margin: 0 0 0.8rem; }
.block p.section-lede { color: var(--text-muted); font-size: 1.05rem; max-width: 46em; margin: 0 0 2rem; }
.alt-bg { background: var(--surface); border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); }

/* ---------- Cards ---------- */
.grid { display: grid; gap: 1.3rem; }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
@media (max-width: 860px) { .grid-3 { grid-template-columns: 1fr 1fr; } }
@media (max-width: 600px) { .grid-3, .grid-2 { grid-template-columns: 1fr; } }

.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg);
  padding: 1.4rem 1.5rem; box-shadow: var(--shadow);
}
.module-card { display: flex; flex-direction: column; gap: 0.7rem; text-decoration: none; color: var(--text); transition: transform 0.15s ease, box-shadow 0.15s ease; }
.module-card:hover { transform: translateY(-3px); box-shadow: 0 10px 26px rgba(43,40,35,0.14); }
.module-card .num { font-family: Georgia, serif; font-weight: 700; color: var(--accent); font-size: 1.4rem; }
.module-card h3 { font-size: 1.08rem; margin: 0; color: var(--text); }
.module-card p { font-size: 0.9rem; color: var(--text-muted); margin: 0; flex: 1; }
.module-card .links { display: flex; gap: 0.9rem; flex-wrap: wrap; font-size: 0.8rem; margin-top: 0.4rem; }
.module-card .links span { color: var(--accent); font-weight: 600; }

.method-card { display: flex; gap: 1rem; align-items: flex-start; }
.method-card .badge {
  width: 42px; height: 42px; border-radius: 10px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center; font-weight: 700; font-family: Georgia, serif;
  font-size: 1rem;
}
.method-card.know .badge { background: var(--know-bg); color: var(--know); }
.method-card.find .badge { background: var(--find-bg); color: var(--find); }
.method-card.think .badge { background: var(--think-bg); color: var(--think); }
.method-card h3 { margin: 0 0 0.3rem; font-size: 1.05rem; }
.method-card p { margin: 0; font-size: 0.92rem; color: var(--text-muted); }

/* ---------- Download / CTA panel ---------- */
.download-panel {
  background: var(--navy); color: #f4efe6; border-radius: var(--radius-lg);
  padding: 2.6rem 2.4rem; display: grid; grid-template-columns: 1fr auto; gap: 2rem; align-items: center;
}
.download-panel h2 { color: #fdfaf5; margin: 0 0 0.5rem; }
.download-panel p { color: #d9c9b0; margin: 0; max-width: 38em; }
@media (max-width: 700px) { .download-panel { grid-template-columns: 1fr; text-align: left; } }

/* ---------- Modal ---------- */
.modal-overlay {
  display: none; position: fixed; inset: 0; z-index: 300; background: rgba(20,18,16,0.6);
  align-items: center; justify-content: center; padding: 1rem;
}
.modal-overlay.open { display: flex; }
.modal {
  background: var(--bg); border-radius: var(--radius-lg); max-width: 440px; width: 100%;
  padding: 1.8rem 1.8rem 1.6rem; box-shadow: 0 20px 60px rgba(0,0,0,0.3); position: relative;
}
.modal .close-btn { position: absolute; top: 0.8rem; right: 0.9rem; border: none; background: none; font-size: 1.5rem; color: var(--text-muted); cursor: pointer; }
.modal h3 { margin: 0 0 0.4rem; font-size: 1.25rem; }
.modal p.sub { color: var(--text-muted); font-size: 0.9rem; margin: 0 0 1.2rem; }
.field { margin-bottom: 0.9rem; }
.field label { display: block; font-size: 0.82rem; font-weight: 600; margin-bottom: 0.3rem; }
.field input, .field select {
  width: 100%; padding: 0.65rem 0.8rem; border-radius: 8px; border: 1px solid var(--border);
  background: var(--surface); color: var(--text); font-family: inherit; font-size: 0.95rem;
}
.field input:focus, .field select:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.hp-field { position: absolute; left: -9999px; }
.form-note { font-size: 0.76rem; color: var(--text-muted); margin-top: 0.9rem; }
.form-status { font-size: 0.86rem; margin-top: 0.8rem; display: none; padding: 0.6rem 0.8rem; border-radius: 8px; }
.form-status.error { display: block; background: var(--warn-bg); color: var(--warn); }
.form-status.success { display: block; background: var(--know-bg); color: var(--know); }

/* ---------- Footer ---------- */
.site-footer { border-top: 1px solid var(--border); padding: 2.6rem 0 2rem; margin-top: 2rem; }
.site-footer .cols { display: grid; grid-template-columns: 1.4fr 1fr 1fr; gap: 2rem; margin-bottom: 2rem; }
.site-footer h4 { font-size: 0.85rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-muted); margin: 0 0 0.8rem; }
.site-footer ul { list-style: none; padding: 0; margin: 0; }
.site-footer li { margin-bottom: 0.5rem; }
.site-footer a { color: var(--text); text-decoration: none; font-size: 0.92rem; }
.site-footer a:hover { color: var(--accent); }
.site-footer p.brand-blurb { color: var(--text-muted); font-size: 0.9rem; max-width: 30em; }
.site-footer .legal { border-top: 1px solid var(--border); padding-top: 1.2rem; font-size: 0.8rem; color: var(--text-muted); display: flex; justify-content: space-between; flex-wrap: wrap; gap: 0.6rem; }
@media (max-width: 700px) { .site-footer .cols { grid-template-columns: 1fr 1fr; } }

/* ---------- Install banner (PWA) ---------- */
.install-banner {
  display: none; position: fixed; left: 1rem; right: 1rem; bottom: 1rem; z-index: 250;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg);
  box-shadow: 0 12px 30px rgba(0,0,0,0.18); padding: 1rem 1.1rem;
  align-items: center; gap: 0.9rem; max-width: 480px; margin: 0 auto;
}
.install-banner.show { display: flex; }
.install-banner .mark { width: 38px; height: 38px; border-radius: 9px; background: linear-gradient(155deg, var(--navy), var(--accent)); flex-shrink: 0; }
.install-banner .txt { flex: 1; }
.install-banner .txt strong { display: block; font-size: 0.92rem; }
.install-banner .txt span { font-size: 0.8rem; color: var(--text-muted); }
.install-banner .actions { display: flex; gap: 0.5rem; }
.install-banner button { border: none; background: none; cursor: pointer; font-family: inherit; }
.install-banner .dismiss { color: var(--text-muted); font-size: 1.2rem; padding: 0.2rem 0.4rem; }
.install-banner .install-btn { background: var(--navy); color: #fff; padding: 0.5rem 0.9rem; border-radius: 999px; font-size: 0.85rem; font-weight: 600; }

/* ---------- i18n visibility ----------
   !important is used deliberately here: language blocks must win over
   any component-specific display rule (e.g. ".stats div strong{display:block}")
   regardless of that rule's specificity, or the inactive language leaks through. */
[data-i18n] { display: none !important; }
[data-lang-active="en"] [data-i18n="en"],
[data-lang-active="pt"] [data-i18n="pt"] { display: revert !important; }
[data-lang-active="en"] span[data-i18n="en"],
[data-lang-active="pt"] span[data-i18n="pt"] { display: inline !important; }

/* ---------- Module page frame (injected header/footer) ---------- */
.module-topbar {
  background: var(--navy); color: #f4efe6; padding: 0.6rem 0;
}
.module-topbar .bar { max-width: 900px; margin: 0 auto; padding: 0 1.5rem; display: flex; align-items: center; justify-content: space-between; gap: 1rem; font-size: 0.84rem; }
.module-topbar a { color: #f4efe6; text-decoration: none; opacity: 0.92; }
.module-topbar a:hover { opacity: 1; text-decoration: underline; }
.module-topbar .crumbs { display: flex; gap: 0.5rem; align-items: center; flex-wrap: wrap; }
.module-topbar .crumbs .sep { opacity: 0.5; }
.module-bottombar {
  max-width: 900px; margin: 2rem auto 0; padding: 1.2rem 1.5rem 2.5rem; display: flex; justify-content: space-between;
  gap: 1rem; flex-wrap: wrap; border-top: 1px solid var(--border); font-size: 0.86rem;
}

/* ---------- Misc ---------- */
.container-narrow { max-width: 760px; margin: 0 auto; padding: 0 1.4rem; }
.badge-pill { display: inline-block; background: var(--surface-2); color: var(--accent); font-size: 0.75rem; font-weight: 700; padding: 0.25rem 0.7rem; border-radius: 999px; letter-spacing: 0.02em; }
.divider { height: 1px; background: var(--border); border: none; margin: 2.5rem 0; }
