:root {
  --forest: #182D21;
  --forest-light: #23402f;
  --forest-lighter: #2f5a41;
  --gold: #C9A54B;
  --gold-light: #e3c57e;
  --ivory: #F7F4EE;
  --charcoal: #2F2F2F;
  --white: #ffffff;
  --danger: #b3452f;
  --success: #3f7a53;
  --radius: 14px;
  --shadow: 0 10px 30px rgba(24, 45, 33, 0.12);
  --serif: Georgia, "Times New Roman", serif;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--ivory);
  color: var(--charcoal);
  font-family: var(--sans);
  scroll-behavior: smooth;
}

img, svg { max-width: 100%; }

.hidden { display: none !important; }

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
}

/* ---------- Demo banner ---------- */
#demoBanner {
  background: var(--gold);
  color: var(--forest);
  text-align: center;
  font-size: 0.8rem;
  font-weight: 600;
  padding: 0.45rem 1rem;
  position: sticky;
  top: 0;
  z-index: 50;
}

/* ---------- Top nav ---------- */
.topnav {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  row-gap: 0.5rem;
  background: var(--forest);
  color: var(--ivory);
  padding: 0.7rem 1.25rem;
  box-shadow: var(--shadow);
}

@media (max-width: 640px) {
  .topnav { justify-content: center; text-align: center; }
  .navtabs { order: 3; width: 100%; justify-content: center; }
  .navright { order: 2; }
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-family: var(--serif);
  font-size: 1.15rem;
  letter-spacing: 0.02em;
  color: var(--ivory);
  background: none;
  padding: 0;
}

.brand .mark {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, var(--forest-lighter), var(--forest));
  border: 1.5px solid var(--gold);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--serif);
  font-size: 0.7rem;
  color: var(--gold-light);
  flex-shrink: 0;
}

.navtabs {
  display: flex;
  gap: 0.15rem;
  flex-wrap: wrap;
}

.navtab {
  background: transparent;
  color: var(--ivory);
  opacity: 0.75;
  padding: 0.5rem 0.8rem;
  border-radius: 999px;
  font-size: 0.88rem;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.navtab:hover { opacity: 1; background: rgba(255,255,255,0.06); }

.navtab.active {
  opacity: 1;
  background: var(--gold);
  color: var(--forest);
  font-weight: 600;
}

.navright {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.pill-btn {
  background: var(--gold);
  color: var(--forest);
  padding: 0.5rem 1rem;
  border-radius: 999px;
  font-weight: 600;
  font-size: 0.85rem;
}
.pill-btn:hover { background: var(--gold-light); }

.pill-btn.ghost {
  background: transparent;
  color: var(--ivory);
  border: 1px solid rgba(247,244,238,0.4);
}
.pill-btn.ghost:hover { border-color: var(--gold); color: var(--gold-light); }

.cart-badge {
  position: relative;
}
.cart-count {
  position: absolute;
  top: -6px;
  right: -8px;
  background: var(--danger);
  color: white;
  font-size: 0.65rem;
  border-radius: 999px;
  padding: 0.05rem 0.35rem;
  min-width: 16px;
  text-align: center;
}

/* ---------- Layout ---------- */
main { max-width: 1080px; margin: 0 auto; padding: 2rem 1.25rem 5rem; }
.view { animation: fadein 0.25s ease; }
@keyframes fadein { from { opacity: 0; transform: translateY(6px);} to { opacity: 1; transform: translateY(0);} }

h1, h2, h3, h4 { font-family: var(--serif); color: var(--forest); margin: 0 0 0.5rem; }
p { line-height: 1.6; }
.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--gold);
  margin-bottom: 0.4rem;
  display: block;
}

/* ---------- Hero ---------- */
.hero {
  text-align: center;
  padding: 3.5rem 1rem 2.5rem;
  background: radial-gradient(circle at 50% 0%, var(--forest-light), var(--forest) 70%);
  color: var(--ivory);
  border-radius: var(--radius);
  margin-bottom: 2.5rem;
}
.hero h1 {
  color: var(--ivory);
  font-size: clamp(1.8rem, 4vw, 2.9rem);
  max-width: 720px;
  margin: 0 auto 0.8rem;
}
.hero p.lede {
  max-width: 560px;
  margin: 0 auto 1.6rem;
  color: rgba(247,244,238,0.85);
  font-size: 1.05rem;
}
.hero .cta-row { display: flex; gap: 0.8rem; justify-content: center; flex-wrap: wrap; }

.btn {
  padding: 0.75rem 1.5rem;
  border-radius: 999px;
  font-weight: 600;
  font-size: 0.95rem;
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}
.btn:hover { transform: translateY(-1px); }
.btn-gold { background: var(--gold); color: var(--forest); }
.btn-gold:hover { background: var(--gold-light); }
.btn-outline { background: transparent; border: 1.5px solid rgba(247,244,238,0.5); color: var(--ivory); }
.btn-outline:hover { border-color: var(--gold); color: var(--gold-light); }
.btn-forest { background: var(--forest); color: var(--ivory); }
.btn-forest:hover { background: var(--forest-light); }
.btn-block { width: 100%; }
.btn-small { padding: 0.45rem 0.9rem; font-size: 0.82rem; }

/* ---------- Grid cards ---------- */
.grid {
  display: grid;
  gap: 1.1rem;
}
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.grid-4 { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }

.card {
  background: var(--white);
  border-radius: var(--radius);
  padding: 1.4rem;
  box-shadow: var(--shadow);
  border: 1px solid rgba(24,45,33,0.06);
}

.section { margin-bottom: 3rem; }
.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 1.2rem;
  gap: 1rem;
  flex-wrap: wrap;
}
.section-head p { margin: 0; color: #5c5c5c; max-width: 520px; }

/* ---------- Pillars (Home) ---------- */
.pillar-card {
  text-align: center;
  border-top: 3px solid var(--gold);
}
.pillar-card .num {
  font-family: var(--serif);
  font-size: 1.6rem;
  color: var(--gold);
}

/* ---------- Inefficiency callout ---------- */
.callout {
  background: var(--forest);
  color: var(--ivory);
  border-radius: var(--radius);
  padding: 1.8rem;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
}
.callout h3 { color: var(--gold-light); }
.callout .col p { color: rgba(247,244,238,0.85); }
@media (max-width: 700px) { .callout { grid-template-columns: 1fr; } }

/* ---------- Shop ---------- */
.product-card { display: flex; flex-direction: column; gap: 0.6rem; }
.product-swatch {
  height: 110px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--forest-lighter), var(--forest));
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--gold-light);
  font-family: var(--serif);
  font-size: 0.85rem;
  text-align: center;
  padding: 0.5rem;
}
.product-card .price { color: var(--forest); font-weight: 700; }
.product-card .tag {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--gold);
  font-weight: 700;
}

/* ---------- Cart drawer ---------- */
.drawer-overlay {
  position: fixed;
  inset: 0;
  background: rgba(24,45,33,0.45);
  z-index: 60;
  display: flex;
  justify-content: flex-end;
}
.drawer {
  background: var(--ivory);
  width: min(380px, 100%);
  height: 100%;
  padding: 1.5rem;
  overflow-y: auto;
  box-shadow: -10px 0 30px rgba(0,0,0,0.2);
}
.drawer-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1rem; }
.cart-item { display: flex; justify-content: space-between; align-items: center; padding: 0.6rem 0; border-bottom: 1px solid rgba(24,45,33,0.1); }
.cart-total { display: flex; justify-content: space-between; font-weight: 700; margin-top: 1rem; font-size: 1.1rem; }

/* ---------- Academy ---------- */
.pillar-block { margin-bottom: 1.6rem; }
.pillar-title-row { display: flex; align-items: center; gap: 0.6rem; margin-bottom: 0.6rem; }
.lock-tag {
  font-size: 0.68rem;
  background: var(--gold);
  color: var(--forest);
  padding: 0.15rem 0.55rem;
  border-radius: 999px;
  font-weight: 700;
}
.course-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.7rem 1rem;
  background: var(--white);
  border-radius: 10px;
  margin-bottom: 0.5rem;
  border: 1px solid rgba(24,45,33,0.06);
}
.course-row.locked { opacity: 0.55; }
.progress-bar {
  height: 8px;
  border-radius: 999px;
  background: rgba(24,45,33,0.1);
  overflow: hidden;
  width: 120px;
}
.progress-fill { height: 100%; background: var(--gold); }

/* ---------- Dashboard ---------- */
.dash-grid { display: grid; grid-template-columns: 1.3fr 1fr; gap: 1.2rem; }
@media (max-width: 800px) { .dash-grid { grid-template-columns: 1fr; } }

.stat-row { display: flex; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.2rem; }
.stat {
  flex: 1;
  min-width: 130px;
  background: var(--white);
  border-radius: var(--radius);
  padding: 1rem 1.2rem;
  box-shadow: var(--shadow);
  border-top: 3px solid var(--gold);
}
.stat .label { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.08em; color: #7a7a7a; }
.stat .value { font-family: var(--serif); font-size: 1.7rem; color: var(--forest); }

.wealth-card {
  background: linear-gradient(160deg, var(--forest), var(--forest-light));
  color: var(--ivory);
  border-radius: var(--radius);
  padding: 1.6rem;
  position: relative;
  overflow: hidden;
}
.wealth-card::after {
  content: "";
  position: absolute;
  right: -40px;
  top: -40px;
  width: 140px;
  height: 140px;
  border-radius: 50%;
  border: 1px solid rgba(201,165,75,0.3);
}
.wealth-card .eyebrow { color: var(--gold-light); }
.wealth-card h3 { color: var(--ivory); }
.wealth-card p { color: rgba(247,244,238,0.85); }

.habit-item {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0.6rem 0;
  border-bottom: 1px solid rgba(24,45,33,0.08);
}
.habit-item:last-child { border-bottom: none; }
.habit-item input { width: 18px; height: 18px; accent-color: var(--gold); }
.habit-item.done label { text-decoration: line-through; color: #9a9a9a; }

.xp-bar-wrap { margin-top: 0.4rem; }
.xp-bar { height: 10px; border-radius: 999px; background: rgba(24,45,33,0.1); overflow: hidden; }
.xp-fill { height: 100%; background: linear-gradient(90deg, var(--gold), var(--gold-light)); }

/* ---------- Membership ---------- */
.tier-card {
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
  border: 2px solid transparent;
}
.tier-card.featured { border-color: var(--gold); }
.tier-card .tier-name { font-family: var(--serif); font-size: 1.25rem; color: var(--forest); }
.tier-card .tier-price { font-size: 1.6rem; font-weight: 700; color: var(--forest); }
.tier-card .tier-price span { font-size: 0.85rem; font-weight: 400; color: #8a8a8a; }
.tier-card ul { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 0.45rem; font-size: 0.88rem; }
.tier-card ul li::before { content: "✓ "; color: var(--gold); font-weight: 700; }
.current-tag {
  font-size: 0.68rem;
  background: var(--forest);
  color: var(--ivory);
  padding: 0.15rem 0.6rem;
  border-radius: 999px;
  align-self: flex-start;
}

/* ---------- Modal ---------- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(24,45,33,0.5);
  z-index: 70;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}
.modal {
  background: var(--ivory);
  border-radius: var(--radius);
  padding: 2rem;
  width: min(420px, 100%);
  box-shadow: var(--shadow);
  position: relative;
}
.modal .close-x {
  position: absolute;
  top: 0.8rem;
  right: 1rem;
  background: none;
  color: var(--forest);
  font-size: 1.3rem;
}
.field { margin-bottom: 1rem; }
.field label { display: block; font-size: 0.82rem; font-weight: 600; margin-bottom: 0.3rem; color: var(--forest); }
.field input {
  width: 100%;
  padding: 0.65rem 0.8rem;
  border-radius: 8px;
  border: 1.5px solid rgba(24,45,33,0.2);
  font-size: 0.95rem;
  font-family: inherit;
}
.field input:focus { outline: none; border-color: var(--gold); }

/* ---------- Toast ---------- */
#toast {
  position: fixed;
  bottom: 1.4rem;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--forest);
  color: var(--ivory);
  padding: 0.75rem 1.4rem;
  border-radius: 999px;
  font-size: 0.9rem;
  box-shadow: var(--shadow);
  opacity: 0;
  pointer-events: none;
  transition: all 0.25s ease;
  z-index: 90;
  border: 1px solid var(--gold);
}
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

footer {
  text-align: center;
  padding: 2rem 1rem;
  color: #8a8a8a;
  font-size: 0.82rem;
}

.signin-gate {
  text-align: center;
  padding: 3rem 1rem;
}
.signin-gate .mark-lg {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  margin: 0 auto 1rem;
  background: radial-gradient(circle at 30% 30%, var(--forest-lighter), var(--forest));
  border: 2px solid var(--gold);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--serif);
  color: var(--gold-light);
}
