/*
  ============================================================================
  LEARN TO LOVE MONEY — SHARED SITE STYLES
  ============================================================================
  Used across index.html, tools/, learning/, and blogs/. Holds the brand
  tokens, the shared nav bar, card/rail/footer patterns, and the reset.
  Each page adds only page-specific CSS in its own <style> tag.
  ============================================================================
*/

:root {
  --bg-base: #0C1F16;
  --bg-mid: #0A1A13;
  --bg-deep: #060F0B;

  --gold: #B8912F;
  --gold-bright: #D9B15A;
  --mint: #7FD9A8;
  --blue: #5FA8D3;
  --rust: #D9695A;

  --cream: #F5F1E6;
  --body-copy: #C7D0C9;
  --muted-label: #8FA096;
  --footnote: #6E7D74;

  --card-bg: #0F241A;
  --card-bg-alt: #14291D;
  --card-border: rgba(184, 145, 47, 0.22);
  --card-border-hover: rgba(217, 177, 90, 0.55);

  --font-head: 'Gelasio', Georgia, 'Times New Roman', serif;
  --font-body: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', 'Liberation Sans', Arial, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }

body {
  min-height: 100vh;
  font-family: var(--font-body);
  color: var(--body-copy);
  background:
    radial-gradient(120% 60% at 50% 0%, rgba(184, 145, 47, 0.08), transparent 60%),
    linear-gradient(180deg, var(--bg-base) 0%, var(--bg-mid) 55%, var(--bg-deep) 100%);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
}

a { text-decoration: none; color: inherit; }

/* In-text links inside blog post bodies (to courses, tools, other posts) */
.post-body a {
  color: var(--gold-bright);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}
.post-body a:hover { color: var(--cream); }

h1, h2, h3 { font-family: var(--font-head); color: var(--cream); margin: 0; }

/* ============================== SITE NAV ============================== */

.site-nav {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(6, 15, 11, 0.82);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(184, 145, 47, 0.16);
}

.site-nav-inner {
  max-width: 960px;
  margin: 0 auto;
  padding: 14px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.nav-logo {
  display: flex;
  align-items: center;
  gap: 9px;
  flex-shrink: 0;
}

.nav-logo-mark {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  overflow: hidden;
  flex-shrink: 0;
  display: flex;
}

.nav-logo-mark img { width: 100%; height: 100%; object-fit: cover; display: block; }

.nav-logo-text {
  font-family: var(--font-head);
  font-weight: 700;
  font-size: 15.5px;
  color: var(--cream);
  white-space: nowrap;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 26px;
  list-style: none;
  margin: 0;
  padding: 0;
}

.nav-links a {
  font-size: 14px;
  font-weight: 600;
  color: var(--muted-label);
  padding: 6px 0;
  border-bottom: 2px solid transparent;
  transition: color 0.15s ease, border-color 0.15s ease;
}

.nav-links a:hover,
.nav-links a.active {
  color: var(--cream);
}

.nav-links a.active {
  border-color: var(--gold-bright);
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 18px;
  flex-shrink: 0;
}

.nav-contact {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--muted-label);
  white-space: nowrap;
  transition: color 0.15s ease;
}

@media (hover: hover) {
  .nav-contact:hover { color: var(--gold-bright); }
}

.nav-cta {
  flex-shrink: 0;
  font-family: var(--font-head);
  font-weight: 600;
  font-size: 13.5px;
  color: var(--bg-deep);
  background: linear-gradient(135deg, var(--gold-bright), var(--gold));
  border: none;
  border-radius: 999px;
  padding: 9px 18px;
  white-space: nowrap;
}

/* ---------- Search (icon lives outside nav-actions so it never
   collapses behind the mobile hamburger) ---------- */
.nav-search-btn {
  flex-shrink: 0;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: 1px solid var(--card-border);
  color: var(--muted-label);
  cursor: pointer;
  transition: border-color 0.15s ease, color 0.15s ease;
}

@media (hover: hover) {
  .nav-search-btn:hover { border-color: var(--gold-bright); color: var(--gold-bright); }
}

.search-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(6, 15, 11, 0.75);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  padding: 90px 16px 40px;
  overflow-y: auto;
}

.search-overlay.open { display: flex; justify-content: center; }

.search-panel {
  width: 100%;
  max-width: 560px;
  height: fit-content;
  background: linear-gradient(180deg, var(--card-bg-alt) 0%, var(--card-bg) 100%);
  border: 1px solid var(--card-border);
  border-radius: 16px;
  padding: 18px;
  box-shadow: 0 24px 60px rgba(0,0,0,0.45);
}

.search-panel-head {
  display: flex;
  align-items: center;
  gap: 10px;
  border-bottom: 1px solid var(--card-border);
  padding-bottom: 14px;
  margin-bottom: 12px;
  color: var(--muted-label);
}

.search-input {
  flex: 1;
  min-width: 0;
  background: transparent;
  border: none;
  color: var(--cream);
  font-family: var(--font-body);
  font-size: 16px;
}

.search-input:focus { outline: none; }
.search-input::placeholder { color: var(--footnote); }

.search-close {
  flex-shrink: 0;
  background: transparent;
  border: none;
  color: var(--muted-label);
  cursor: pointer;
  font-size: 22px;
  line-height: 1;
  padding: 2px 4px;
}

@media (hover: hover) {
  .search-close:hover { color: var(--gold-bright); }
}

.search-results {
  display: flex;
  flex-direction: column;
  gap: 2px;
  max-height: 60vh;
  overflow-y: auto;
}

.search-result {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 11px 10px;
  border-radius: 10px;
  transition: background 0.15s ease;
}

@media (hover: hover) {
  .search-result:hover { background: rgba(255,255,255,0.05); }
}

.search-result-top {
  display: flex;
  align-items: center;
  gap: 9px;
}

.search-result-type {
  flex-shrink: 0;
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--bg-deep);
  background: var(--mint);
  padding: 2px 7px;
  border-radius: 999px;
}

.search-result-title {
  font-family: var(--font-head);
  font-size: 15px;
  color: var(--cream);
}

.search-result-desc {
  font-size: 12.5px;
  color: var(--muted-label);
  line-height: 1.55;
}

.search-empty {
  font-size: 13px;
  color: var(--footnote);
  text-align: center;
  padding: 22px 10px;
  margin: 0;
}

.nav-toggle {
  display: none;
  flex-direction: column;
  gap: 4px;
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 6px;
}

.nav-toggle span {
  width: 20px;
  height: 2px;
  background: var(--cream);
  border-radius: 2px;
}

.nav-mobile-panel {
  display: none;
  flex-direction: column;
  gap: 2px;
  max-width: 960px;
  margin: 0 auto;
  padding: 4px 20px 16px;
}

.nav-mobile-panel.open { display: flex; }

.nav-mobile-panel a {
  font-size: 14.5px;
  font-weight: 600;
  color: var(--muted-label);
  padding: 10px 4px;
  border-bottom: 1px solid rgba(143, 160, 150, 0.12);
}

.nav-mobile-panel a.active { color: var(--gold-bright); }

@media (max-width: 640px) {
  .nav-links { display: none; }
  .nav-actions { display: none; }
  .nav-toggle { display: flex; }
}

.nav-mobile-cta {
  margin-top: 10px;
  display: inline-block;
  text-align: center;
  font-family: var(--font-head);
  font-weight: 600;
  font-size: 14px;
  color: var(--bg-deep) !important;
  background: linear-gradient(135deg, var(--gold-bright), var(--gold));
  border-radius: 999px;
  padding: 11px 18px;
}

.nav-mobile-contact {
  border-bottom: none !important;
}

/* ============================== PAGE SHELL ============================== */

.shell {
  max-width: 960px;
  margin: 0 auto;
  padding: 0 20px;
}

.narrow-shell {
  max-width: 560px;
  margin: 0 auto;
  padding: 0 20px;
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--muted-label);
  margin: 20px 0;
}

.back-link .arrow {
  width: 7px;
  height: 7px;
  border-left: 2px solid var(--muted-label);
  border-bottom: 2px solid var(--muted-label);
  transform: rotate(45deg);
}

@media (hover: hover) {
  .back-link:hover { color: var(--gold-bright); }
  .back-link:hover .arrow { border-color: var(--gold-bright); }
}

/* ============================== RAILS ============================== */

.rail {
  padding-top: 40px;
  padding-bottom: 40px;
}

.rail-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 18px;
}

.rail-title {
  font-family: var(--font-head);
  font-size: 21px;
  color: var(--cream);
}

.rail-viewall {
  font-size: 13px;
  font-weight: 600;
  color: var(--gold-bright);
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.rail-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}

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

/* ============================== CONTENT CARDS ============================== */

.content-card {
  display: flex;
  flex-direction: column;
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 16px;
  overflow: hidden;
  transition: border-color 0.15s ease, transform 0.1s ease, background 0.15s ease;
}

@media (hover: hover) {
  .content-card:hover {
    border-color: var(--gold-bright);
    background: #122a1e;
  }
}

.content-card:active { transform: scale(0.98); }

.card-tile {
  position: relative;
  height: 92px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  font-family: var(--font-head);
  font-size: 26px;
  color: var(--bg-deep);
  font-weight: 700;
}

/* Shared notebook-paper base for the logo-watermarked tiles: cream fill +
   ruled horizontal lines + a coral double margin line, generated with CSS
   gradients so it fills the full rectangle (no circular crop). */
.card-tile.tone-gold,
.card-tile.tone-mint,
.card-tile.tone-blue {
  background-color: #EFE9D6;
  background-repeat: no-repeat, no-repeat, no-repeat;
  background-position: center, 0 0, 0 0;
  background-size: cover, 100% 100%, 100% 100%;
  background-image:
    linear-gradient(135deg, var(--tile-tint), var(--tile-tint)),
    linear-gradient(to right,
      transparent 0 15.5%, rgba(217, 105, 90, 0.5) 15.5% 16%, transparent 16% 16.6%,
      rgba(217, 105, 90, 0.36) 16.6% 17%, transparent 17% 100%),
    repeating-linear-gradient(to bottom,
      rgba(0, 0, 0, 0.07) 0, rgba(0, 0, 0, 0.07) 1px,
      transparent 1px, transparent 21px);
}

.card-tile.tone-gold { --tile-tint: rgba(184, 145, 47, 0.42); }
.card-tile.tone-mint { --tile-tint: rgba(43, 122, 79, 0.42); }
.card-tile.tone-blue { --tile-tint: rgba(95, 168, 211, 0.42); }
.card-tile.tone-rust { background: linear-gradient(135deg, var(--rust), #b8493c); }

/* Shared hexagon icon badge — the site's one icon style (dark hex, gold
   glyph, cream ring), used on the Home Explore/Topics tiles, the Home
   Learning rail, and the /learning hub's category cards. */
.hex-icon-wrap {
  width: 62px;
  height: 62px;
  flex-shrink: 0;
  clip-path: polygon(25% 6%, 75% 6%, 100% 50%, 75% 94%, 25% 94%, 0% 50%);
  background: rgba(245, 241, 230, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
}

.hex-icon {
  width: 54px;
  height: 54px;
  clip-path: polygon(25% 6%, 75% 6%, 100% 50%, 75% 94%, 25% 94%, 0% 50%);
  background: var(--bg-deep);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--gold-bright);
}

.hex-icon svg { width: 24px; height: 24px; }

.hex-icon-wrap.sm { width: 46px; height: 46px; }
.hex-icon-wrap.sm .hex-icon { width: 40px; height: 40px; }
.hex-icon-wrap.sm .hex-icon svg { width: 19px; height: 19px; }

.card-body { padding: 16px 18px 18px; flex: 1; display: flex; flex-direction: column; }

.card-meta {
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--gold-bright);
  margin: 0 0 8px;
}

.card-meta.locked {
  color: var(--muted-label);
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.card-meta.locked svg { width: 10px; height: 10px; fill: var(--muted-label); }

.card-title-sm {
  font-family: var(--font-head);
  font-size: 16.5px;
  color: var(--cream);
  margin: 0 0 6px;
  line-height: 1.3;
}

.card-desc {
  font-size: 13px;
  color: var(--body-copy);
  margin: 0;
  line-height: 1.5;
  flex: 1;
}

/* Simple horizontal list-style card (used for single-item rails) */

.list-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 18px;
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 16px;
  transition: border-color 0.15s ease, transform 0.1s ease, background 0.15s ease;
}

@media (hover: hover) {
  .list-card:hover {
    border-color: var(--gold-bright);
    background: #122a1e;
  }
}

.list-card:active { transform: scale(0.98); }

.list-card-icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-head);
  font-weight: 700;
  font-size: 18px;
  color: var(--bg-deep);
}

.list-card-text { flex: 1; min-width: 0; }

.list-card-tag {
  display: inline-block;
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--bg-deep);
  background: var(--mint);
  padding: 3px 8px;
  border-radius: 999px;
  margin-bottom: 7px;
}

.list-card-title {
  font-family: var(--font-head);
  font-size: 17px;
  color: var(--cream);
  margin: 0 0 3px;
  line-height: 1.3;
}

.list-card-desc {
  font-size: 13.5px;
  color: var(--body-copy);
  margin: 0;
  line-height: 1.4;
}

.chevron {
  flex-shrink: 0;
  width: 9px;
  height: 9px;
  border-right: 2px solid var(--muted-label);
  border-bottom: 2px solid var(--muted-label);
  transform: rotate(-45deg);
}

/* ============================== FOOTER ============================== */

.site-footer {
  margin-top: 30px;
  padding: 0 20px 50px;
}

.footer-newsletter {
  max-width: 960px;
  margin: 0 auto;
  background: var(--card-bg-alt);
  border: 1px solid var(--card-border);
  border-radius: 24px;
  padding: 40px 28px;
  text-align: center;
}

.footer-newsletter h2 {
  font-size: 22px;
  margin-bottom: 8px;
}

.footer-newsletter p {
  font-size: 13.5px;
  color: var(--muted-label);
  margin: 0 0 22px;
}

.footer-form {
  display: flex;
  max-width: 380px;
  margin: 0 auto;
  gap: 8px;
}

@media (max-width: 480px) {
  .footer-form { flex-direction: column; }
}

.footer-form input[type="email"] {
  flex: 1;
  min-width: 0;
  background: rgba(0,0,0,0.28);
  border: 1px solid var(--card-border);
  border-radius: 10px;
  color: var(--cream);
  font-family: var(--font-body);
  font-size: 14.5px;
  padding: 13px 16px;
}

.footer-form input[type="email"]:focus {
  outline: none;
  border-color: var(--gold-bright);
}

.footer-form button {
  flex-shrink: 0;
  font-family: var(--font-head);
  font-weight: 600;
  font-size: 14.5px;
  color: var(--bg-deep);
  background: linear-gradient(135deg, var(--gold-bright), var(--gold));
  border: none;
  border-radius: 10px;
  padding: 13px 22px;
  cursor: pointer;
}

.footer-form-note {
  font-size: 11px;
  color: var(--footnote);
  margin: 12px 0 0 !important;
}

.footer-form-success {
  display: none;
  font-size: 14px;
  color: var(--mint);
  font-weight: 600;
}

.footer-form-success.show { display: block; }

.social-row {
  display: flex;
  justify-content: center;
  gap: 14px;
  margin: 34px 0 18px;
}

.social-icon {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  transition: border-color 0.15s ease, transform 0.1s ease;
}

.social-icon svg { width: 17px; height: 17px; fill: var(--cream); }

@media (hover: hover) {
  .social-icon:hover { border-color: var(--mint); }
}

.social-icon:active { transform: scale(0.92); }

.footer-links {
  display: flex;
  justify-content: center;
  gap: 18px;
  margin: 0 0 18px;
}

.footer-links a {
  font-size: 12px;
  font-weight: 600;
  color: var(--muted-label);
  transition: color 0.15s ease;
}

@media (hover: hover) {
  .footer-links a:hover { color: var(--gold-bright); }
}

.footer-disclaimer {
  max-width: 560px;
  margin: 0 auto 22px;
  padding: 0 20px;
  font-size: 11px;
  line-height: 1.6;
  color: var(--footnote);
  text-align: center;
}

.footer-copyright {
  text-align: center;
  font-size: 11.5px;
  color: var(--footnote);
  margin: 0 0 30px;
}

.footer-wordmark {
  text-align: center;
  font-family: var(--font-head);
  font-weight: 700;
  font-size: clamp(34px, 9vw, 64px);
  line-height: 1;
  background: linear-gradient(135deg, var(--gold-bright), var(--gold));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  word-break: break-word;
}

@media (prefers-reduced-motion: reduce) {
  .content-card, .list-card, .social-icon { transition: none; }
}

/* ============================== ARTICLE LAYOUT ==============================
   Shared by every long-form article: the 3 blog posts and the 12 Library
   pieces. A centered hero (meta row, category tag, title, dek) sits above a
   3-column grid — author/share sidebar, the article body, and an
   auto-generated "On this page" TOC with scrollspy (see initArticleToc in
   site.js). Below ~980px it collapses to a single column with the TOC shown
   as a static box above the body. */

.article-hero {
  max-width: 720px;
  margin: 0 auto;
  padding: 40px 20px 6px;
  text-align: center;
}

.article-meta-row {
  font-size: 12px;
  letter-spacing: 0.02em;
  color: var(--muted-label);
  margin: 0 0 14px;
}

.article-tag {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--gold-bright);
  margin: 0 0 14px;
}

.article-title {
  font-family: var(--font-head);
  font-size: clamp(28px, 5vw, 40px);
  line-height: 1.2;
  color: var(--cream);
  margin: 0 0 16px;
}

.article-dek {
  font-size: 15.5px;
  line-height: 1.6;
  color: var(--body-copy);
  max-width: 600px;
  margin: 0 auto;
}

.article-shell {
  max-width: 1080px;
  margin: 30px auto 0;
  padding: 0 20px 60px;
  display: grid;
  grid-template-columns: 190px minmax(0, 1fr) 220px;
  gap: 40px;
  align-items: start;
}

.article-shell.no-toc { grid-template-columns: 190px minmax(0, 1fr); }

.article-sidebar-left {
  position: sticky;
  top: 96px;
}

.article-sidebar-label {
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted-label);
  margin: 0 0 12px;
}

.article-author {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 30px;
}

.article-author img {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}

.article-author span {
  font-family: var(--font-head);
  font-size: 14px;
  color: var(--cream);
}

.article-share-row { display: flex; gap: 8px; }

.article-share-btn {
  position: relative;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  color: var(--cream);
  cursor: pointer;
  padding: 0;
  transition: border-color 0.15s ease, color 0.15s ease;
}

.article-share-btn svg { width: 16px; height: 16px; }

@media (hover: hover) {
  .article-share-btn:hover { border-color: var(--gold-bright); color: var(--gold-bright); }
}

.article-share-btn.is-copied { color: var(--mint); border-color: var(--mint); }

.share-copied-label {
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%) translateY(4px);
  margin-bottom: 8px;
  padding: 5px 11px;
  border-radius: 999px;
  background: var(--mint);
  color: var(--bg-deep);
  font-family: var(--font-body);
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s ease, transform 0.15s ease;
}

.article-share-btn.is-copied .share-copied-label {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.article-content { min-width: 0; }

.article-toc {
  position: sticky;
  top: 96px;
}

.article-toc nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
  border-left: 2px solid var(--card-border);
}

.article-toc a {
  display: block;
  padding: 7px 0 7px 16px;
  margin-left: -2px;
  border-left: 2px solid transparent;
  font-size: 13.5px;
  line-height: 1.4;
  color: var(--muted-label);
  text-decoration: none;
  transition: color 0.15s ease, border-color 0.15s ease;
}

.article-toc a.is-active { color: var(--gold-bright); border-left-color: var(--gold-bright); }

@media (hover: hover) {
  .article-toc a:hover { color: var(--cream); }
}

@media (max-width: 980px) {
  .article-shell { grid-template-columns: 1fr; gap: 24px; }

  .article-toc {
    position: static;
    order: -1;
    padding: 16px 18px;
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 14px;
  }

  .article-toc nav { border-left: none; gap: 0; }
  .article-toc a { padding: 5px 0; border-left: none; }

  .article-sidebar-left {
    position: static;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
  }

  .article-author { margin: 0; }
}

@media (prefers-reduced-motion: reduce) {
  .article-share-btn { transition: none; }
  .article-toc a { transition: none; }
}
