/* Fundability Engineering™ Machine — RJ Business Solutions */
:root {
  --bg0: #071512;
  --bg1: #0e241e;
  --bg2: #16352c;
  --ink: #f4f1e8;
  --muted: #9fb0a6;
  --gold: #d4b56a;
  --gold2: #f0d592;
  --teal: #2f8f78;
  --teal2: #49b896;
  --danger: #d86775;
  --warn: #e0a84f;
  --ok: #5ecf9a;
  --line: rgba(212, 181, 106, 0.28);
  --card: rgba(255, 255, 255, 0.035);
  --card2: rgba(255, 255, 255, 0.06);
  --shadow: 0 20px 60px rgba(0, 0, 0, 0.35);
  --serif: "Fraunces", Georgia, serif;
  --sans: "Source Sans 3", system-ui, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, monospace;
  --radius: 18px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family: var(--sans);
  background:
    radial-gradient(1000px 520px at 8% -8%, rgba(47, 143, 120, 0.35), transparent 60%),
    radial-gradient(900px 480px at 100% 0%, rgba(212, 181, 106, 0.16), transparent 55%),
    radial-gradient(700px 400px at 50% 120%, rgba(47, 143, 120, 0.12), transparent 50%),
    linear-gradient(165deg, var(--bg0), var(--bg1) 45%, #0a1a16);
  line-height: 1.55;
}

a { color: var(--gold); }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }

.app-shell { min-height: 100vh; display: flex; flex-direction: column; }

.topbar {
  position: sticky; top: 0; z-index: 50;
  backdrop-filter: blur(14px);
  background: rgba(7, 21, 18, 0.84);
  border-bottom: 1px solid var(--line);
}
.topbar-inner {
  width: min(1240px, calc(100% - 2rem));
  margin: 0 auto;
  display: flex; align-items: center; justify-content: space-between;
  gap: 1rem; padding: .85rem 0;
}
.brand {
  text-decoration: none; color: var(--ink);
  font-family: var(--serif); font-weight: 650; font-size: 1.05rem;
}
.brand span { display: block; font-family: var(--sans); font-size: .72rem; color: var(--muted); font-weight: 500; letter-spacing: .04em; }
.nav { display: flex; flex-wrap: wrap; gap: .55rem; }
.nav a {
  text-decoration: none; color: var(--muted);
  padding: .45rem .75rem; border: 1px solid transparent; border-radius: 999px;
  font-size: .9rem;
}
.nav a:hover, .nav a.active {
  color: var(--ink); border-color: var(--line); background: var(--card2);
}

.main { width: min(1240px, calc(100% - 2rem)); margin: 0 auto; padding: 1.4rem 0 3.5rem; flex: 1; }

.hero {
  display: grid; grid-template-columns: 1.2fr .8fr; gap: 1.5rem;
  align-items: stretch; margin-bottom: 1.5rem;
  animation: rise .7s ease both;
}
@keyframes rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
@keyframes pulseGlow {
  0%, 100% { box-shadow: 0 0 0 0 rgba(47,143,120,.0), var(--shadow); }
  50% { box-shadow: 0 0 0 8px rgba(47,143,120,.08), var(--shadow); }
}

.hero-copy {
  padding: 2rem 1.8rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background:
    linear-gradient(145deg, rgba(47,143,120,.16), transparent 45%),
    var(--card);
  position: relative; overflow: hidden;
}
.hero-copy::after {
  content: ""; position: absolute; inset: auto -20% -40% 40%;
  height: 220px; background: radial-gradient(circle, rgba(212,181,106,.18), transparent 70%);
  pointer-events: none;
}
.eyebrow {
  display: inline-flex; gap: .5rem; align-items: center;
  color: var(--gold); text-transform: uppercase; letter-spacing: .1em;
  font-size: .75rem; border: 1px solid var(--line); padding: .35rem .7rem; border-radius: 999px;
  margin-bottom: 1rem;
}
.hero h1 {
  font-family: var(--serif); font-size: clamp(2.3rem, 5vw, 3.8rem);
  line-height: 1.05; margin: 0 0 .9rem; max-width: 11ch;
}
.lede { color: var(--muted); font-size: 1.08rem; max-width: 46ch; margin: 0 0 1.4rem; }
.cta-row { display: flex; flex-wrap: wrap; gap: .7rem; }
.btn {
  appearance: none; border: 1px solid var(--line); background: transparent; color: var(--ink);
  padding: .75rem 1.05rem; border-radius: 999px; text-decoration: none; display: inline-flex; gap: .45rem; align-items: center;
  transition: transform .2s ease, background .2s ease, border-color .2s ease;
}
.btn:hover { transform: translateY(-1px); border-color: rgba(212,181,106,.55); }
.btn.primary { background: linear-gradient(135deg, var(--teal), #1f6b5a); border-color: transparent; color: white; font-weight: 600; }
.btn.gold { background: linear-gradient(135deg, #c9a24d, #e6c778); color: #1a1408; border: none; font-weight: 700; }

.hero-panel {
  border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--card); padding: 1.2rem; box-shadow: var(--shadow);
  animation: pulseGlow 4.5s ease-in-out infinite;
}
.score-ring {
  width: 160px; height: 160px; margin: .4rem auto 1rem;
  border-radius: 50%;
  display: grid; place-items: center;
  background:
    radial-gradient(circle at center, var(--bg1) 58%, transparent 59%),
    conic-gradient(var(--teal2) var(--p, 0%), rgba(255,255,255,.08) 0);
}
.score-ring strong { font-family: var(--serif); font-size: 2.4rem; display: block; text-align: center; }
.score-ring small { color: var(--muted); display: block; text-align: center; }
.panel-meta { display: grid; gap: .55rem; }
.meta-row {
  display: flex; justify-content: space-between; gap: 1rem;
  padding: .55rem .7rem; border-radius: 12px; background: rgba(0,0,0,.22); border: 1px solid rgba(255,255,255,.04);
  font-size: .92rem;
}
.meta-row span { color: var(--muted); }

.grid { display: grid; gap: 1rem; }
.grid.cols-3 { grid-template-columns: repeat(3, 1fr); }
.grid.cols-2 { grid-template-columns: repeat(2, 1fr); }
.grid.cols-4 { grid-template-columns: repeat(4, 1fr); }

.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 1.15rem 1.2rem; transition: transform .2s ease, border-color .2s ease, background .2s ease;
}
.card:hover { transform: translateY(-2px); border-color: rgba(212,181,106,.5); background: var(--card2); }
.card h3 { font-family: var(--serif); margin: 0 0 .4rem; font-size: 1.2rem; }
.card p { margin: 0; color: var(--muted); font-size: .95rem; }
.card .tag {
  display: inline-block; margin-bottom: .65rem; font-size: .72rem; letter-spacing: .08em;
  text-transform: uppercase; color: var(--gold);
}

.section-head { display: flex; justify-content: space-between; gap: 1rem; align-items: end; margin: 1.8rem 0 1rem; }
.section-head h2 { font-family: var(--serif); margin: 0; font-size: clamp(1.5rem, 3vw, 2rem); }
.section-head p { margin: 0; color: var(--muted); max-width: 48ch; }

.tabs { display: flex; flex-wrap: wrap; gap: .5rem; margin-bottom: 1rem; }
.tab {
  border: 1px solid var(--line); background: transparent; color: var(--muted);
  padding: .55rem .9rem; border-radius: 999px;
}
.tab.active { color: #142019; background: var(--gold); border-color: transparent; font-weight: 700; }

.machine-layout { display: grid; grid-template-columns: 1.15fr .85fr; gap: 1rem; }
.field { display: grid; gap: .35rem; margin-bottom: .85rem; }
.field label { font-size: .86rem; color: var(--muted); }
.field input, .field select, .field textarea {
  width: 100%; background: rgba(0,0,0,.28); color: var(--ink);
  border: 1px solid rgba(255,255,255,.1); border-radius: 12px; padding: .7rem .8rem;
}
.field input:focus, .field select:focus, .field textarea:focus {
  outline: 2px solid rgba(47,143,120,.45); border-color: transparent;
}

.pillar {
  display: grid; grid-template-columns: 1fr auto; gap: .4rem; align-items: center;
  padding: .7rem 0; border-bottom: 1px solid rgba(255,255,255,.06);
}
.pillar:last-child { border-bottom: 0; }
.bar {
  height: 8px; border-radius: 999px; background: rgba(255,255,255,.08); overflow: hidden; margin-top: .35rem;
}
.bar > i { display: block; height: 100%; width: var(--w, 0%); background: linear-gradient(90deg, var(--teal), var(--gold)); }

.badge {
  display: inline-flex; align-items: center; gap: .3rem;
  padding: .2rem .55rem; border-radius: 999px; font-size: .75rem; font-weight: 700;
}
.badge.ok { background: rgba(94,207,154,.15); color: var(--ok); }
.badge.warn { background: rgba(224,168,79,.15); color: var(--warn); }
.badge.bad { background: rgba(216,103,117,.15); color: #e88; }

.tier-card { position: relative; overflow: hidden; }
.tier-card .tier-num {
  font-family: var(--serif); font-size: 3rem; color: rgba(212,181,106,.2);
  position: absolute; right: .8rem; top: .2rem;
}

.table-wrap { overflow: auto; border: 1px solid var(--line); border-radius: 14px; }
table { width: 100%; border-collapse: collapse; font-size: .92rem; }
th, td { padding: .7rem .8rem; border-bottom: 1px solid rgba(255,255,255,.06); text-align: left; vertical-align: top; }
th { background: rgba(212,181,106,.08); color: var(--gold2); font-weight: 600; }
tr:hover td { background: rgba(255,255,255,.02); }

.book-layout { display: grid; grid-template-columns: 280px 1fr; gap: 1rem; min-height: 70vh; }
.book-nav, .book-reader, .side-panel {
  border: 1px solid var(--line); border-radius: var(--radius); background: var(--card);
}
.book-nav { padding: .9rem; overflow: auto; max-height: 78vh; position: sticky; top: 4.5rem; }
.book-nav button {
  width: 100%; text-align: left; background: transparent; border: 0; color: var(--muted);
  padding: .65rem .55rem; border-radius: 10px; margin-bottom: .2rem;
}
.book-nav button.active, .book-nav button:hover { background: rgba(47,143,120,.18); color: var(--ink); }
.book-reader { padding: 1.4rem 1.5rem 2rem; }
.book-reader .progress {
  height: 6px; background: rgba(255,255,255,.08); border-radius: 999px; overflow: hidden; margin: .8rem 0 1.2rem;
}
.book-reader .progress > i { display:block; height:100%; background: var(--gold); width: 0%; transition: width .35s ease; }
.prose { max-width: 72ch; }
.prose h1, .prose h2, .prose h3 { font-family: var(--serif); line-height: 1.2; }
.prose h1 { font-size: 2rem; margin-top: 0; }
.prose h2 { margin-top: 1.8rem; border-bottom: 1px solid var(--line); padding-bottom: .35rem; }
.prose p, .prose li { color: #d7ddd8; }
.prose code { font-family: var(--mono); background: rgba(0,0,0,.35); padding: .1rem .35rem; border-radius: 4px; }
.prose pre { background: rgba(0,0,0,.4); padding: 1rem; overflow: auto; border-radius: 12px; border: 1px solid var(--line); }
.prose table { display: block; overflow: auto; }
.prose blockquote { border-left: 3px solid var(--gold); margin-left: 0; padding-left: 1rem; color: var(--muted); }

.checklist label {
  display: flex; gap: .7rem; align-items: flex-start;
  padding: .7rem; border: 1px solid rgba(255,255,255,.06); border-radius: 12px; margin-bottom: .5rem;
  background: rgba(0,0,0,.18);
}
.checklist input { margin-top: .25rem; }

.rec {
  border-left: 3px solid var(--teal2); padding: .8rem 1rem; margin-bottom: .7rem;
  background: rgba(47,143,120,.1); border-radius: 0 12px 12px 0;
}
.rec strong { display: block; margin-bottom: .2rem; }
.rec em { color: var(--muted); font-style: normal; font-size: .9rem; }

.quiz-q {
  border: 1px solid var(--line); border-radius: 14px; padding: 1rem; margin-bottom: .8rem; background: rgba(0,0,0,.16);
}
.quiz-q .choices { display: grid; gap: .45rem; margin-top: .7rem; }
.quiz-q .choices button { text-align: left; border-radius: 10px; border: 1px solid rgba(255,255,255,.1); background: rgba(255,255,255,.03); color: var(--ink); padding: .65rem .75rem; }
.quiz-q .choices button.correct { border-color: var(--ok); background: rgba(94,207,154,.12); }
.quiz-q .choices button.wrong { border-color: #e88; background: rgba(216,103,117,.12); }

.footer {
  border-top: 1px solid var(--line); color: var(--muted); font-size: .88rem;
  padding: 1.4rem 0 2rem; margin-top: 2rem;
}
.disclaimer {
  margin-top: 1rem; padding: .9rem 1rem; border: 1px solid var(--line); border-radius: 12px;
  background: rgba(0,0,0,.22); color: var(--muted); font-size: .86rem;
}

.empty { color: var(--muted); padding: 2rem; text-align: center; }
.pill-row { display: flex; flex-wrap: wrap; gap: .4rem; margin-top: .6rem; }
.pill {
  font-size: .75rem; border: 1px solid var(--line); border-radius: 999px; padding: .2rem .55rem; color: var(--muted);
}

@media (max-width: 960px) {
  .hero, .machine-layout, .book-layout, .grid.cols-3, .grid.cols-2, .grid.cols-4 { grid-template-columns: 1fr; }
  .book-nav { position: static; max-height: none; }
  .nav { width: 100%; }
  .topbar-inner { flex-direction: column; align-items: flex-start; }
}
