/*
Theme Name: The Bitcoin Digest
Theme URI: https://thebitcoindigest.com
Author: The Bitcoin Digest
Author URI: https://thebitcoindigest.com
Description: A premium editorial WordPress theme for Bitcoin news, reviews, guides, and analysis. Features dark mode, Nostr integration, Lightning zaps, and affiliate management.
Version: 1.0.2
Requires at least: 6.4
Requires PHP: 8.1
License: Proprietary
Text Domain: tbd
Tags: bitcoin, cryptocurrency, editorial, dark-mode, custom-post-types
*/

/* ══════════════════════════════════════════════════
   DESIGN SYSTEM — CSS Custom Properties
   ══════════════════════════════════════════════════ */

:root {
  /* Brand Navy — updated from #333d4e */
  --brand: #1a2d44;
  --brand-h: #273d58;
  --brand-dk: #162639;
  --brand-m: #e7e8e9;
  --brand-s: #f4f5f6;

  /* Accent — Bitcoin Orange */
  --acc: #f7931a;
  --acc-h: #e8850f;
  --acc-m: #fef7ed;
  --acc-b: #fde5c2;

  /* Greyscale */
  --w: #ffffff;
  --g50: #fafaf9;
  --g100: #f5f5f4;
  --g150: #eeeeec;
  --g200: #e7e5e4;
  --g300: #d6d3d1;
  --g400: #a8a29e;
  --g500: #78716c;
  --g600: #57534e;
  --g700: #44403c;
  --g800: #292524;
  --g900: #1c1917;

  /* Semantic */
  --ok: #22c55e;
  --err: #ef4444;
  --pg: var(--w);
  --sf: var(--g50);

  /* Shadows */
  --sh-s: 0 1px 2px rgba(0,0,0,.04);
  --sh-m: 0 4px 12px rgba(0,0,0,.06);
  --sh-l: 0 12px 32px rgba(0,0,0,.08);

  /* Typography */
  --fd: 'Newsreader', Georgia, serif;
  --fb: 'DM Sans', sans-serif;
  --fm: 'JetBrains Mono', monospace;

  /* Spacing */
  --r: 12px;
}

/* Dark Mode */
[data-theme="dark"] {
  --brand: #8a9bb0;
  --brand-dk: #0e0f11;
  --brand-m: #121518;
  --brand-s: #0f1114;

  --acc: #f7931a;
  --acc-h: #fba630;
  --acc-m: #1a1408;

  --w: #e8e8e8;
  --g50: #0a0a0b;
  --g100: #0f1012;
  --g150: #141518;
  --g200: #1a1c20;
  --g300: #2a2d32;
  --g400: #4a4e56;
  --g500: #7a7e86;
  --g600: #b0b4bc;
  --g700: #d0d4dc;
  --g800: #e8eaee;
  --g900: #f5f5f7;

  --pg: #09090b;
  --sf: #0e0f11;

  --sh-s: 0 1px 2px rgba(0,0,0,.3);
  --sh-m: 0 4px 12px rgba(0,0,0,.4);
  --sh-l: 0 12px 32px rgba(0,0,0,.5);
}


/* ══════════════════════════════════════════════════
   RESET & BASE
   ══════════════════════════════════════════════════ */

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

body {
  background: var(--pg);
  color: var(--g700);
  font-family: var(--fb);
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

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

.wrap { max-width: 1320px; margin: 0 auto; padding: 0 40px; }


/* ══════════════════════════════════════════════════
   NAVIGATION
   ══════════════════════════════════════════════════ */

.nav {
  background: #111318;
  position: sticky;
  top: 0;
  z-index: 200;
  border-bottom: 1px solid rgba(255,255,255,.06);
}

.nav-brand {
  max-width: 1320px;
  margin: 0 auto;
  padding: 24px 40px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.nav-logo {
  font-family: var(--fd);
  font-size: 28px;
  font-weight: 700;
  color: #fff;
  letter-spacing: -.5px;
}
.nav-logo span { color: var(--acc); }

.nav-utils {
  display: flex;
  align-items: center;
  gap: 14px;
}

.nav-block {
  font-family: var(--fm);
  font-size: 12px;
  color: #888;
  display: flex;
  align-items: center;
  gap: 6px;
}
.nav-block .blk-h {
  font-weight: 700;
  color: var(--acc);
}

.nav-social {
  display: flex;
  gap: 8px;
}
.nav-social a {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  border: 1px solid #333;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  color: #999;
  transition: all .15s;
}
.nav-social a:hover { border-color: var(--acc); color: var(--acc); }

.th-btn {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  border: 1px solid #333;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  color: #999;
  background: transparent;
  cursor: pointer;
  transition: all .15s;
}
.th-btn:hover { border-color: var(--acc); color: var(--acc); }

.hamburger {
  display: none;
  width: 36px;
  height: 36px;
  border-radius: 8px;
  border: 1px solid #333;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  color: #999;
  background: transparent;
  cursor: pointer;
}

.nav-row {
  max-width: 1320px;
  margin: 0 auto;
  padding: 0 40px 12px;
  display: flex;
  gap: 4px;
  align-items: center;
}

.nav-item > a {
  font-family: var(--fb);
  font-size: 13px;
  font-weight: 500;
  color: #ccc;
  padding: 6px 14px;
  border-radius: 6px;
  transition: all .15s;
}
.nav-item > a:hover,
.nav-item.active > a {
  background: rgba(255,255,255,.08);
  color: #fff;
}

/* Mega Menu */
.mega {
  display: none;
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  background: #111318;
  border: 1px solid #222;
  border-radius: var(--r);
  padding: 24px;
  min-width: 600px;
  z-index: 250;
}
.nav-item:hover .mega { display: block; }
.mega-grid { display: grid; gap: 24px; }
.mega-grid-2 { grid-template-columns: 1fr 1fr; }
.mega-grid-3 { grid-template-columns: repeat(3, 1fr); }

.mega-col-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: #666;
  margin-bottom: 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.mega-col-label a {
  font-size: 10px;
  color: var(--acc);
  text-transform: none;
  letter-spacing: 0;
}

.mega-link {
  display: flex;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 8px;
  transition: background .15s;
  cursor: pointer;
}
.mega-link:hover { background: rgba(255,255,255,.04); }
.mega-icon { font-size: 18px; }
.mega-link-text { font-size: 13px; font-weight: 600; color: #eee; }
.mega-link-sub { font-size: 11px; color: #888; margin-top: 2px; }

.mega-badge {
  display: inline-flex;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .5px;
}
.mega-badge-new { background: rgba(34,197,94,.15); color: #22c55e; }

/* Mobile Drawer */
.mobile-drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: 300px;
  max-width: 85vw;
  background: #111318;
  z-index: 301;
  transform: translateX(100%);
  transition: transform .3s;
  padding: 24px;
  overflow-y: auto;
}
.mobile-drawer.open { transform: translateX(0); }

.mobile-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.5);
  z-index: 300;
  display: none;
}
.mobile-overlay.open { display: block; }

.mobile-close {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  border: 1px solid #333;
  background: transparent;
  color: #999;
  font-size: 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.mobile-menu { list-style: none; margin-top: 32px; }
.mobile-menu a {
  display: block;
  padding: 10px 0;
  font-size: 15px;
  font-weight: 500;
  color: #ccc;
  border-bottom: 1px solid #222;
}
.mobile-menu a:hover { color: var(--acc); }


/* ══════════════════════════════════════════════════
   MARKET STRIP
   ══════════════════════════════════════════════════ */

.mkt {
  border-bottom: 1px solid var(--g200);
  overflow-x: auto;
}
.mkt-in {
  max-width: 1320px;
  margin: 0 auto;
  padding: 9px 32px;
  display: flex;
  gap: 24px;
  align-items: center;
  white-space: nowrap;
}
.mkt-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--g500);
}
.mkt-val { font-family: var(--fm); font-weight: 600; color: var(--g800); }
.mkt-chg { font-family: var(--fm); font-weight: 600; font-size: 11px; }
.mkt-chg.up { color: var(--ok); }
.mkt-chg.dn { color: var(--err); }
.mkt-sep { width: 1px; height: 16px; background: var(--g200); flex-shrink: 0; }


/* ══════════════════════════════════════════════════
   BREADCRUMBS
   ══════════════════════════════════════════════════ */

.bc { padding: 16px 0 12px; font-size: 12px; color: var(--g400); }
.bc a { color: var(--g500); transition: color .15s; }
.bc a:hover { color: var(--acc); }
.bc .sep { margin: 0 6px; color: var(--g300); }


/* ══════════════════════════════════════════════════
   TYPOGRAPHY — PROSE
   ══════════════════════════════════════════════════ */

.prose { font-family: var(--fd); font-size: 17px; line-height: 1.85; color: var(--g700); }
.prose h2 {
  font-size: 24px;
  font-weight: 700;
  color: var(--g800);
  margin: 40px 0 16px;
  padding-top: 24px;
  border-top: 1px solid var(--g200);
  scroll-margin-top: 100px;
}
.prose h3 {
  font-size: 19px;
  font-weight: 600;
  color: var(--g800);
  margin: 28px 0 12px;
}
.prose p { margin-bottom: 18px; }
.prose a { color: var(--acc); text-decoration: underline; text-underline-offset: 2px; }
.prose a:hover { color: var(--acc-h); }
.prose ul, .prose ol { margin: 0 0 18px 24px; }
.prose li { margin-bottom: 6px; }
.prose blockquote {
  border-left: 3px solid var(--acc);
  padding: 16px 24px;
  margin: 24px 0;
  background: var(--sf);
  border-radius: 0 var(--r) var(--r) 0;
  font-style: italic;
  color: var(--g600);
}
.prose img { border-radius: var(--r); margin: 24px 0; }
.prose code {
  font-family: var(--fm);
  font-size: 14px;
  background: var(--sf);
  padding: 2px 6px;
  border-radius: 4px;
  color: var(--acc);
}
.prose pre {
  background: var(--sf);
  border: 1px solid var(--g200);
  border-radius: var(--r);
  padding: 20px;
  overflow-x: auto;
  font-family: var(--fm);
  font-size: 13px;
  line-height: 1.6;
  margin: 24px 0;
}


/* ══════════════════════════════════════════════════
   TABLE OF CONTENTS (Sidebar)
   ══════════════════════════════════════════════════ */

.toc {
  position: sticky;
  top: 100px;
  max-height: calc(100vh - 120px);
  overflow-y: auto;
}
.toc-title {
  font-family: var(--fm);
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--g400);
  margin-bottom: 12px;
}
.toc a {
  display: block;
  font-size: 13px;
  color: var(--g500);
  padding: 5px 0 5px 14px;
  border-left: 2px solid var(--g200);
  transition: all .15s;
}
.toc a:hover { color: var(--g800); border-color: var(--g400); }
.toc a.active { color: var(--acc); border-color: var(--acc); font-weight: 600; }


/* ══════════════════════════════════════════════════
   CARDS
   ══════════════════════════════════════════════════ */

.card {
  border: 1px solid var(--g200);
  border-radius: var(--r);
  overflow: hidden;
  background: var(--pg);
  transition: border-color .2s, box-shadow .2s;
}
.card:hover { border-color: var(--g300); box-shadow: var(--sh-m); }

.card-img {
  aspect-ratio: 16/9;
  overflow: hidden;
  background: var(--sf);
}
.card-img img { width: 100%; height: 100%; object-fit: cover; transition: transform .3s; }
.card:hover .card-img img { transform: scale(1.03); }

.card-body { padding: 16px 20px; }
.card-meta {
  font-size: 11px;
  color: var(--g500);
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}

.badge {
  display: inline-flex;
  padding: 2px 8px;
  border-radius: 4px;
  font-family: var(--fm);
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .5px;
}
.badge-news { background: rgba(37,99,235,.1); color: #2563eb; }
.badge-learn { background: rgba(34,197,94,.1); color: #16a34a; }
.badge-review { background: rgba(247,147,26,.1); color: var(--acc); }
.badge-101 { background: rgba(168,85,247,.1); color: #a855f7; }
.badge-invest { background: rgba(6,182,212,.1); color: #06b6d4; }


/* ══════════════════════════════════════════════════
   NEWSLETTER
   ══════════════════════════════════════════════════ */

.nl-card {
  border: 1px solid var(--g200);
  border-radius: var(--r);
  padding: 40px;
  text-align: center;
  background: var(--sf);
  margin: 48px 0;
}
.nl-card h3 {
  font-family: var(--fd);
  font-size: 24px;
  font-weight: 700;
  color: var(--g800);
  margin-bottom: 8px;
}
.nl-card p {
  font-size: 14px;
  color: var(--g500);
  margin-bottom: 20px;
}
.nl-f {
  display: flex;
  gap: 8px;
  max-width: 440px;
  margin: 0 auto;
}
.nl-f input {
  flex: 1;
  padding: 12px 16px;
  border: 2px solid var(--g200);
  border-radius: 8px;
  font-family: var(--fb);
  font-size: 14px;
  background: var(--pg);
  color: var(--g800);
  outline: none;
}
.nl-f input:focus { border-color: var(--acc); }
.nl-f button {
  padding: 12px 24px;
  background: var(--acc);
  color: #fff;
  border: none;
  border-radius: 8px;
  font-family: var(--fb);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s;
  white-space: nowrap;
}
.nl-f button:hover { background: var(--acc-h); }


/* ══════════════════════════════════════════════════
   REVIEW CARD / SCORE
   ══════════════════════════════════════════════════ */

.rv-badge {
  display: inline-flex;
  padding: 4px 10px;
  border-radius: 6px;
  font-family: var(--fm);
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .5px;
}
.rv-badge-pick { background: rgba(247,147,26,.12); color: var(--acc); }
.rv-badge-btc { background: rgba(247,147,26,.08); color: var(--acc); }
.rv-badge-oss { background: rgba(34,197,94,.1); color: #16a34a; }

.rv-score {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: 3px solid var(--acc);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--fm);
  font-size: 18px;
  font-weight: 700;
  color: var(--acc);
  flex-shrink: 0;
}

.pros, .cons { list-style: none; }
.pros li::before { content: '✓ '; color: var(--ok); font-weight: 700; }
.cons li::before { content: '✗ '; color: var(--err); font-weight: 700; }


/* ══════════════════════════════════════════════════
   BUTTONS
   ══════════════════════════════════════════════════ */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 24px;
  border-radius: 8px;
  font-family: var(--fb);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all .15s;
  border: none;
}
.btn-primary { background: var(--acc); color: #fff; }
.btn-primary:hover { background: var(--acc-h); }
.btn-secondary { background: transparent; color: var(--g700); border: 2px solid var(--g200); }
.btn-secondary:hover { border-color: var(--g400); color: var(--g800); }
.btn-ghost { background: transparent; color: var(--acc); }
.btn-ghost:hover { background: var(--acc-m); }


/* ══════════════════════════════════════════════════
   FOOTER
   ══════════════════════════════════════════════════ */

.ft {
  border-top: 1px solid var(--g200);
  padding: 64px 0 32px;
  margin-top: 72px;
}
.ft-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 32px;
  margin-bottom: 40px;
}
.ft-brand {
  font-family: var(--fd);
  font-size: 18px;
  font-weight: 700;
  color: var(--g200);
  margin-bottom: 12px;
}
.ft-brand span { color: var(--acc); }
.ft-desc {
  font-size: 13px;
  color: var(--g500);
  line-height: 1.6;
  max-width: 280px;
}
.ft-col-title {
  font-family: var(--fm);
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--g400);
  margin-bottom: 14px;
}
.ft-col a {
  display: block;
  font-size: 13px;
  color: var(--g500);
  padding: 4px 0;
  transition: color .15s;
}
.ft-col a:hover { color: var(--acc); }
.ft-bottom {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 24px;
  border-top: 1px solid var(--g200);
  font-size: 11px;
  color: var(--g400);
}

/* Footer responsive */
@media (min-width: 768px) {
  .ft-grid { grid-template-columns: 1.5fr repeat(3, 1fr); gap: 44px; }
}


/* ══════════════════════════════════════════════════
   AUTHOR BOX
   ══════════════════════════════════════════════════ */

.author-box {
  display: flex;
  gap: 20px;
  padding: 24px;
  border: 1px solid var(--g200);
  border-radius: var(--r);
  margin: 40px 0;
}
.author-box-av {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: var(--sf);
  flex-shrink: 0;
  overflow: hidden;
}
.author-box-av img { width: 100%; height: 100%; object-fit: cover; }
.author-box-name {
  font-size: 16px;
  font-weight: 700;
  color: var(--g800);
  margin-bottom: 2px;
}
.author-box-role { font-size: 12px; color: var(--g500); margin-bottom: 8px; }
.author-box-bio { font-size: 13px; color: var(--g600); line-height: 1.6; }
.author-box-socials {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}
.author-box-socials a {
  font-size: 12px;
  color: var(--g400);
  transition: color .15s;
}
.author-box-socials a:hover { color: var(--acc); }


/* ══════════════════════════════════════════════════
   RELATED ARTICLES
   ══════════════════════════════════════════════════ */

.related { margin: 48px 0; }
.related-title {
  font-family: var(--fd);
  font-size: 22px;
  font-weight: 700;
  color: var(--g800);
  margin-bottom: 20px;
}
.related-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
}
.related-card { border: 1px solid var(--g200); border-radius: var(--r); overflow: hidden; }
.related-card-img {
  aspect-ratio: 16/9;
  overflow: hidden;
  background: var(--sf);
}
.related-card-img img { width: 100%; height: 100%; object-fit: cover; }
.related-card-body { padding: 14px 16px; }
.related-card-meta {
  font-size: 11px;
  color: var(--g500);
  margin-bottom: 4px;
}
.related-card h4 {
  font-family: var(--fd);
  font-size: 15px;
  font-weight: 600;
  color: var(--g800);
  line-height: 1.4;
}


/* ══════════════════════════════════════════════════
   UTILITY
   ══════════════════════════════════════════════════ */

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  border: 0;
}

.disclosure {
  font-size: 11px;
  color: var(--g400);
  border-top: 1px solid var(--g200);
  padding-top: 16px;
  margin-top: 32px;
  line-height: 1.6;
}


/* ══════════════════════════════════════════════════
   RESPONSIVE — GLOBAL
   ══════════════════════════════════════════════════ */

@media (max-width: 900px) {
  .nav-row { display: none; }
  .hamburger { display: flex; }
  .nav-brand { padding: 14px 20px 12px; }
  .nav-social { display: none; }
  .wrap { padding: 0 20px; }
  .related-grid { grid-template-columns: 1fr; }
}

@media (max-width: 500px) {
  .nl-f { flex-direction: column; }
  .nl-f button { width: 100%; }
  .author-box { flex-direction: column; text-align: center; }
}


/* ═══ NAV MENU FIX — WordPress menu items ═══ */
.nav-row {
  max-width: 1320px;
  margin: 0 auto;
  padding: 0 40px 12px;
  display: flex;
  gap: 0;
  align-items: center;
  justify-content: space-between;
}
.nav-row > li,
.nav-row .menu-item {
  list-style: none;
  display: inline-block;
  flex: 1;
}
.nav-row > li > a,
.nav-row .menu-item > a {
  font-family: var(--fb);
  font-size: 14px;
  font-weight: 400;
  color: #999;
  padding: 8px 0;
  text-decoration: none;
  transition: color .15s;
  display: block;
}
.nav-row > li > a:hover,
.nav-row .menu-item > a:hover,
.nav-row .current-menu-item > a {
  color: #fff;
}
/* Dropdown arrows for items with children */
.nav-row .menu-item-has-children > a::after {
  content: ' ▾';
  font-size: 10px;
  opacity: .5;
}
.nav-row .sub-menu {
  display: none;
}

/* Social icons in nav */
.nav-social a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: rgba(255,255,255,.08);
  color: #ccc;
  text-decoration: none;
  font-size: 16px;
  transition: all .15s;
}
.nav-social a:hover {
  background: rgba(255,255,255,.15);
  color: #fff;
}

/* Dark mode toggle button */
.th-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: rgba(255,255,255,.08);
  color: #ccc;
  border: none;
  cursor: pointer;
  font-size: 16px;
  transition: all .15s;
}
.th-btn:hover {
  background: rgba(255,255,255,.15);
  color: #fff;
}

/* Footer list fix */
.ft-grid ul {
  list-style: none;
  padding: 0;
  margin: 0;
}
.ft-grid ul li {
  margin-bottom: 8px;
}
.ft-grid ul li a {
  color: #999;
  text-decoration: none;
  font-size: 14px;
}
.ft-grid ul li a:hover {
  color: var(--acc, #f7931a);
}
