/*
Theme Name: Charlie Bit Me
Theme URI: https://charliebitme.fun
Description: Standalone editorial theme for cryptocurrency news and analysis.
Version: 1.0.0
Author: Jake Holloway
Text Domain: charliebitme
*/

/* ── Design tokens ─────────────────────────────────── */
:root {
  --bg:          #FFFFFF;
  --surface:     #F7F8FA;
  --card:        #FFFFFF;
  --text:        #14171A;
  --text-sec:    #536471;
  --accent:      #E63946;
  --accent-hover:#C1121F;
  --green:       #1DA882;
  --green-hover: #178E6E;
  --border:      #EFF3F4;
  --border-dark: #CFD9DE;
  --shadow:      0 1px 3px rgba(0,0,0,.06);
  --shadow-lg:   0 4px 12px rgba(0,0,0,.08);

  --font-display: 'Space Grotesk', system-ui, sans-serif;
  --font-body:    'DM Sans', system-ui, sans-serif;

  --sp-1: 4px;  --sp-2: 8px;  --sp-3: 12px; --sp-4: 16px;
  --sp-5: 20px; --sp-6: 24px; --sp-8: 32px; --sp-10: 40px;
  --sp-12: 48px; --sp-16: 64px;

  --radius: 6px;
  --radius-lg: 10px;
  --measure: 72ch;
  --content-max: 1200px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg:          #0F1419;
    --surface:     #1A1F26;
    --card:        #1E2732;
    --text:        #E7E9EA;
    --text-sec:    #8B98A5;
    --accent:      #F2555E;
    --accent-hover:#FF6B73;
    --green:       #2CC295;
    --green-hover: #3DD8A8;
    --border:      #2F3336;
    --border-dark: #3E4144;
    --shadow:      0 1px 3px rgba(0,0,0,.2);
    --shadow-lg:   0 4px 12px rgba(0,0,0,.3);
  }
}

/* ── Reset & base ──────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 100%; scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }

body {
  font-family: var(--font-body);
  font-size: 17px;
  line-height: 1.7;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; height: auto; display: block; }
a { color: var(--accent); text-decoration: none; transition: color .15s; }
a:hover { color: var(--accent-hover); }

/* ── Skip link ─────────────────────────────────────── */
.skip-link {
  position: absolute; left: -9999px; top: var(--sp-2);
  background: var(--accent); color: #fff; padding: var(--sp-2) var(--sp-4);
  font-weight: 600; z-index: 1000; border-radius: var(--radius);
}
.skip-link:focus { left: var(--sp-4); }

/* ── Layout ────────────────────────────────────────── */
.wrap { max-width: var(--content-max); margin: 0 auto; padding: 0 var(--sp-6); }

/* ── Header ────────────────────────────────────────── */
.site-header {
  border-bottom: 1px solid var(--border);
  background: var(--bg);
  position: sticky; top: 0; z-index: 100;
}
.site-header .wrap {
  display: flex; align-items: center; justify-content: space-between;
  height: 64px;
}
.site-logo {
  font-family: var(--font-display);
  font-size: 22px; font-weight: 700; color: var(--text);
  letter-spacing: -0.5px;
}
.site-logo:hover { color: var(--text); }
.site-logo span { color: var(--accent); }

.main-nav { display: flex; gap: var(--sp-6); align-items: center; list-style: none; }
.main-nav ul { display: flex; gap: var(--sp-6); list-style: none; padding: 0; margin: 0; }
.main-nav li { list-style: none; }
.main-nav a {
  font-family: var(--font-display);
  font-size: 14px; font-weight: 500; color: var(--text-sec);
  text-transform: uppercase; letter-spacing: 0.5px;
  padding: var(--sp-2) 0;
  border-bottom: 2px solid transparent;
  transition: color .15s, border-color .15s;
}
.main-nav a:hover,
.main-nav a[aria-current="page"] {
  color: var(--text); border-bottom-color: var(--accent);
}

.mobile-toggle {
  display: none; background: none; border: none; cursor: pointer;
  color: var(--text); padding: var(--sp-2); min-width: 48px; min-height: 48px;
}
.mobile-toggle svg { width: 24px; height: 24px; }

@media (max-width: 768px) {
  .mobile-toggle { display: flex; align-items: center; justify-content: center; }
  .main-nav {
    display: none; position: absolute; top: 64px; left: 0; right: 0;
    background: var(--bg); border-bottom: 1px solid var(--border);
    flex-direction: column; padding: var(--sp-4) var(--sp-6); gap: 0;
  }
  .main-nav.is-open { display: flex; }
  .main-nav a { padding: var(--sp-3) 0; border-bottom: none; font-size: 15px; }
}

/* ── Hero ──────────────────────────────────────────── */
.hero-section {
  padding: var(--sp-12) 0;
  border-bottom: 1px solid var(--border);
}
.hero-inner {
  display: grid; grid-template-columns: 1fr 1fr; gap: var(--sp-10);
  align-items: center;
}
.hero-tag {
  display: inline-block;
  font-family: var(--font-display); font-size: 12px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 1px;
  color: var(--accent); margin-bottom: var(--sp-4);
}
.hero-title {
  font-family: var(--font-display);
  font-size: clamp(28px, 4vw, 44px); font-weight: 700;
  line-height: 1.15; letter-spacing: -0.5px;
  color: var(--text); margin-bottom: var(--sp-4);
}
.hero-excerpt {
  font-size: 18px; color: var(--text-sec);
  line-height: 1.6; margin-bottom: var(--sp-6);
  max-width: 50ch;
}
.hero-meta {
  font-size: 14px; color: var(--text-sec);
  font-family: var(--font-display);
}
.hero-img {
  border-radius: var(--radius-lg); overflow: hidden;
  aspect-ratio: 16/10; background: var(--surface);
}
.hero-img img { width: 100%; height: 100%; object-fit: cover; }

@media (max-width: 768px) {
  .hero-inner { grid-template-columns: 1fr; gap: var(--sp-6); }
  .hero-img { order: -1; }
}

/* ── Section headings ──────────────────────────────── */
.section-heading {
  font-family: var(--font-display);
  font-size: 13px; font-weight: 600; text-transform: uppercase;
  letter-spacing: 1.5px; color: var(--text-sec);
  padding-bottom: var(--sp-3);
  border-bottom: 2px solid var(--accent);
  display: inline-block; margin-bottom: var(--sp-8);
}

/* ── Post cards ────────────────────────────────────── */
.post-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: var(--sp-8);
}
.post-card {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden; background: var(--card);
  transition: box-shadow .2s, transform .2s;
}
.post-card:hover { box-shadow: var(--shadow-lg); transform: translateY(-2px); }
.post-card__img {
  aspect-ratio: 16/9; overflow: hidden; background: var(--surface);
}
.post-card__img img { width: 100%; height: 100%; object-fit: cover; }
.post-card__body { padding: var(--sp-5); }
.post-card__cat {
  font-family: var(--font-display);
  font-size: 11px; font-weight: 600; text-transform: uppercase;
  letter-spacing: 1px; color: var(--accent);
  margin-bottom: var(--sp-2);
}
.post-card__title {
  font-family: var(--font-display);
  font-size: 18px; font-weight: 600; line-height: 1.3;
  margin-bottom: var(--sp-3);
}
.post-card__title a { color: var(--text); }
.post-card__title a:hover { color: var(--accent); }
.post-card__excerpt {
  font-size: 15px; color: var(--text-sec); line-height: 1.6;
  margin-bottom: var(--sp-3);
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}
.post-card__meta {
  font-size: 13px; color: var(--text-sec);
  font-family: var(--font-display);
  display: flex; gap: var(--sp-3); align-items: center;
}
.post-card__meta .dot::before { content: '\00B7'; }

/* ── Pillar cards (homepage) ───────────────────────── */
.pillar-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: var(--sp-6);
}
.pillar-card {
  padding: var(--sp-8);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--card);
  transition: border-color .2s, box-shadow .2s;
}
.pillar-card:hover { border-color: var(--accent); box-shadow: var(--shadow-lg); }
.pillar-card__title {
  font-family: var(--font-display);
  font-size: 20px; font-weight: 600; margin-bottom: var(--sp-3);
}
.pillar-card__title a { color: var(--text); }
.pillar-card__title a:hover { color: var(--accent); }
.pillar-card__desc { font-size: 15px; color: var(--text-sec); line-height: 1.6; }

/* ── Answer capsule ────────────────────────────────── */
.answer-capsule {
  border-left: 3px solid var(--accent);
  padding: var(--sp-5) var(--sp-6);
  background: var(--surface);
  border-radius: 0 var(--radius) var(--radius) 0;
  margin-bottom: var(--sp-8);
  font-size: 18px; line-height: 1.6;
}

/* ── Breadcrumbs ───────────────────────────────────── */
.breadcrumbs {
  font-size: 13px; color: var(--text-sec);
  font-family: var(--font-display);
  padding: var(--sp-4) 0;
}
.breadcrumbs a { color: var(--text-sec); }
.breadcrumbs a:hover { color: var(--accent); }
.breadcrumbs .sep { margin: 0 var(--sp-2); }

/* ── Article ───────────────────────────────────────── */
.article-header { padding: var(--sp-8) 0 var(--sp-6); }
.article-header__cat {
  font-family: var(--font-display);
  font-size: 12px; font-weight: 600; text-transform: uppercase;
  letter-spacing: 1px; color: var(--accent);
  margin-bottom: var(--sp-3);
}
.article-header h1 {
  font-family: var(--font-display);
  font-size: clamp(26px, 3.5vw, 38px); font-weight: 700;
  line-height: 1.2; letter-spacing: -0.3px;
  margin-bottom: var(--sp-4);
}
.article-meta {
  display: flex; flex-wrap: wrap; gap: var(--sp-4); align-items: center;
  font-size: 14px; color: var(--text-sec);
  font-family: var(--font-display);
  padding-bottom: var(--sp-6);
  border-bottom: 1px solid var(--border);
}
.article-meta a { color: var(--text-sec); }
.article-meta a:hover { color: var(--accent); }
.article-meta .reading-time { color: var(--accent); font-weight: 500; }

.article-featured {
  margin-bottom: var(--sp-8); border-radius: var(--radius-lg);
  overflow: hidden;
}
.article-featured img { width: 100%; }

.article-content {
  max-width: var(--measure); margin: 0 auto;
  padding-bottom: var(--sp-12);
}
.article-content h2 {
  font-family: var(--font-display);
  font-size: 24px; font-weight: 600; line-height: 1.3;
  margin: var(--sp-10) 0 var(--sp-4);
  padding-top: var(--sp-4);
}
.article-content h3 {
  font-family: var(--font-display);
  font-size: 20px; font-weight: 600; line-height: 1.3;
  margin: var(--sp-8) 0 var(--sp-3);
}
.article-content p { margin-bottom: var(--sp-5); }
.article-content ul, .article-content ol {
  margin: 0 0 var(--sp-5) var(--sp-6);
}
.article-content li { margin-bottom: var(--sp-2); }
.article-content blockquote {
  border-left: 3px solid var(--accent);
  padding: var(--sp-4) var(--sp-6);
  margin: var(--sp-6) 0;
  background: var(--surface);
  border-radius: 0 var(--radius) var(--radius) 0;
  font-style: italic;
}
.article-content a { text-decoration: underline; text-underline-offset: 2px; }
.article-content strong { font-weight: 600; }

/* ── Tables ────────────────────────────────────────── */
.table-wrap { overflow-x: auto; margin: var(--sp-6) 0; }
.article-content table {
  width: 100%; border-collapse: collapse;
  font-size: 15px;
}
.article-content th {
  font-family: var(--font-display);
  font-weight: 600; text-align: left;
  padding: var(--sp-3) var(--sp-4);
  background: var(--surface);
  border-bottom: 2px solid var(--border-dark);
  font-size: 13px; text-transform: uppercase; letter-spacing: 0.5px;
}
.article-content td {
  padding: var(--sp-3) var(--sp-4);
  border-bottom: 1px solid var(--border);
}
.article-content tr:hover td { background: var(--surface); }

/* ── TOC ───────────────────────────────────────────── */
.toc {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--sp-6); margin-bottom: var(--sp-8);
}
.toc__title {
  font-family: var(--font-display);
  font-size: 14px; font-weight: 600; text-transform: uppercase;
  letter-spacing: 1px; margin-bottom: var(--sp-4);
  color: var(--text);
}
.toc ol { list-style: none; counter-reset: toc; padding: 0; margin: 0; }
.toc li { counter-increment: toc; margin-bottom: var(--sp-2); }
.toc li::before {
  content: counter(toc) '.';
  font-family: var(--font-display); font-weight: 600;
  color: var(--accent); margin-right: var(--sp-2);
  font-size: 14px;
}
.toc a {
  color: var(--text-sec); font-size: 15px;
  text-decoration: none;
}
.toc a:hover { color: var(--accent); }

/* ── FAQ ───────────────────────────────────────────── */
.faq-section {
  background: var(--surface); border-radius: var(--radius-lg);
  padding: var(--sp-8); margin: var(--sp-10) 0;
}
.faq-section h2 {
  font-family: var(--font-display);
  font-size: 20px; font-weight: 600; margin-bottom: var(--sp-6);
}
.faq-item { border-bottom: 1px solid var(--border); padding: var(--sp-5) 0; }
.faq-item:last-child { border-bottom: none; }
.faq-item dt {
  font-family: var(--font-display);
  font-weight: 600; font-size: 16px; cursor: pointer;
  display: flex; justify-content: space-between; align-items: center;
  min-height: 48px; color: var(--text);
}
.faq-item dt::after { content: '+'; font-size: 20px; color: var(--accent); flex-shrink: 0; margin-left: var(--sp-4); }
.faq-item.is-open dt::after { content: '\2212'; }
.faq-item dd {
  display: none; padding-top: var(--sp-3);
  font-size: 15px; color: var(--text-sec); line-height: 1.7;
}
.faq-item.is-open dd { display: block; }

/* ── Sources ───────────────────────────────────────── */
.sources-block {
  border-top: 2px solid var(--border);
  padding-top: var(--sp-6); margin-top: var(--sp-10);
}
.sources-block h3 {
  font-family: var(--font-display);
  font-size: 14px; font-weight: 600; text-transform: uppercase;
  letter-spacing: 1px; margin-bottom: var(--sp-4);
}
.sources-block ol {
  list-style-position: inside; padding: 0;
  font-size: 14px; color: var(--text-sec);
}
.sources-block li { margin-bottom: var(--sp-2); }
.sources-block a { text-decoration: underline; }

/* ── CTA card ──────────────────────────────────────── */
.cta-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--sp-8); text-align: center;
  margin: var(--sp-10) 0;
}
.cta-card__title {
  font-family: var(--font-display);
  font-size: 22px; font-weight: 600; margin-bottom: var(--sp-3);
}
.cta-card__text { color: var(--text-sec); margin-bottom: var(--sp-6); }
.cta-card .btn { display: inline-block; }

/* ── Buttons ───────────────────────────────────────── */
.btn {
  display: inline-block;
  font-family: var(--font-display); font-size: 14px; font-weight: 600;
  padding: var(--sp-3) var(--sp-6);
  border-radius: var(--radius); border: none; cursor: pointer;
  transition: background .15s, transform .1s;
  min-height: 48px; line-height: 48px; padding-top: 0; padding-bottom: 0;
}
.btn:active { transform: scale(0.98); }
.btn--primary { background: var(--accent); color: #fff; }
.btn--primary:hover { background: var(--accent-hover); color: #fff; }
.btn--outline {
  background: transparent; border: 1px solid var(--border-dark);
  color: var(--text);
}
.btn--outline:hover { border-color: var(--accent); color: var(--accent); }

/* ── Author bio ────────────────────────────────────── */
.author-bio {
  display: flex; gap: var(--sp-6); align-items: flex-start;
  padding: var(--sp-8); background: var(--surface);
  border-radius: var(--radius-lg); margin: var(--sp-10) 0;
}
.author-bio__avatar {
  width: 80px; height: 80px; border-radius: 50%;
  flex-shrink: 0; overflow: hidden; background: var(--border);
}
.author-bio__avatar img { width: 100%; height: 100%; object-fit: cover; }
.author-bio__name {
  font-family: var(--font-display);
  font-size: 18px; font-weight: 600; margin-bottom: var(--sp-1);
}
.author-bio__name a { color: var(--text); }
.author-bio__name a:hover { color: var(--accent); }
.author-bio__role { font-size: 14px; color: var(--accent); margin-bottom: var(--sp-3); }
.author-bio__text { font-size: 15px; color: var(--text-sec); line-height: 1.6; }

@media (max-width: 520px) {
  .author-bio { flex-direction: column; align-items: center; text-align: center; }
}

/* ── Author page ───────────────────────────────────── */
.author-page { padding: var(--sp-12) 0; }
.author-page__header {
  display: flex; gap: var(--sp-8); align-items: flex-start;
  margin-bottom: var(--sp-12);
}
.author-page__avatar {
  width: 120px; height: 120px; border-radius: 50%;
  overflow: hidden; flex-shrink: 0; background: var(--border);
}
.author-page__avatar img { width: 100%; height: 100%; object-fit: cover; }
.author-page__name {
  font-family: var(--font-display);
  font-size: 32px; font-weight: 700; margin-bottom: var(--sp-2);
}
.author-page__role {
  font-size: 16px; color: var(--accent);
  font-family: var(--font-display); margin-bottom: var(--sp-4);
}
.author-page__bio { font-size: 17px; color: var(--text-sec); line-height: 1.7; max-width: 60ch; }

@media (max-width: 520px) {
  .author-page__header { flex-direction: column; align-items: center; text-align: center; }
}

/* ── Related posts ─────────────────────────────────── */
.related-posts {
  border-top: 2px solid var(--border);
  padding-top: var(--sp-8); margin-top: var(--sp-10);
}
.related-posts h2 {
  font-family: var(--font-display);
  font-size: 14px; font-weight: 600; text-transform: uppercase;
  letter-spacing: 1px; margin-bottom: var(--sp-6);
}

/* ── Footer ────────────────────────────────────────── */
.site-footer {
  border-top: 1px solid var(--border);
  background: var(--surface); padding: var(--sp-12) 0 var(--sp-8);
}
.footer-grid {
  display: grid; grid-template-columns: 2fr 1fr 1fr 1fr;
  gap: var(--sp-8); margin-bottom: var(--sp-10);
}
.footer-col__title {
  font-family: var(--font-display);
  font-size: 13px; font-weight: 600; text-transform: uppercase;
  letter-spacing: 1px; margin-bottom: var(--sp-4); color: var(--text);
}
.footer-col a {
  display: block; color: var(--text-sec); font-size: 15px;
  padding: var(--sp-1) 0;
}
.footer-col a:hover { color: var(--accent); }
.footer-col p { font-size: 15px; color: var(--text-sec); line-height: 1.6; }
.footer-bottom {
  border-top: 1px solid var(--border);
  padding-top: var(--sp-6);
  font-size: 13px; color: var(--text-sec);
  display: flex; justify-content: space-between; flex-wrap: wrap; gap: var(--sp-4);
}
.footer-bottom a { color: var(--text-sec); }
.footer-bottom a:hover { color: var(--accent); }

@media (max-width: 768px) {
  .footer-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 480px) {
  .footer-grid { grid-template-columns: 1fr; }
}

/* ── Disclosure ────────────────────────────────────── */
.disclosure-block {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--sp-4) var(--sp-5);
  font-size: 14px; color: var(--text-sec);
  margin-bottom: var(--sp-6);
}

/* ── Info box ──────────────────────────────────────── */
.info-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--sp-6);
  margin: var(--sp-6) 0;
}
.info-box__title {
  font-family: var(--font-display);
  font-size: 15px; font-weight: 600; margin-bottom: var(--sp-3);
}

/* ── Sidebar (latest) ──────────────────────────────── */
.sidebar-latest { list-style: none; padding: 0; }
.sidebar-latest li {
  padding: var(--sp-4) 0;
  border-bottom: 1px solid var(--border);
}
.sidebar-latest li:last-child { border-bottom: none; }
.sidebar-latest a {
  font-family: var(--font-display);
  font-size: 15px; font-weight: 500; color: var(--text);
  line-height: 1.4;
}
.sidebar-latest a:hover { color: var(--accent); }
.sidebar-latest .meta {
  font-size: 12px; color: var(--text-sec); margin-top: var(--sp-1);
}

/* ── Homepage sections ─────────────────────────────── */
.home-section { padding: var(--sp-10) 0; }
.home-section + .home-section { border-top: 1px solid var(--border); }

.trust-row {
  background: var(--surface);
  padding: var(--sp-8); border-radius: var(--radius-lg);
  text-align: center;
  font-size: 15px; color: var(--text-sec);
}
.trust-row strong { color: var(--text); }

/* ── Search ────────────────────────────────────────── */
.search-page { padding: var(--sp-12) 0; min-height: 50vh; }
.search-page h1 {
  font-family: var(--font-display);
  font-size: 28px; font-weight: 700; margin-bottom: var(--sp-6);
}
.search-form {
  display: flex; gap: var(--sp-3); margin-bottom: var(--sp-8);
  max-width: 500px;
}
.search-form input[type="search"] {
  flex: 1; font-size: 16px; padding: var(--sp-3) var(--sp-4);
  border: 1px solid var(--border-dark); border-radius: var(--radius);
  background: var(--bg); color: var(--text);
  font-family: var(--font-body); min-height: 48px;
}
.search-form button { min-width: 48px; }

/* ── 404 ───────────────────────────────────────────── */
.error-page { padding: var(--sp-16) 0; text-align: center; min-height: 50vh; }
.error-page h1 {
  font-family: var(--font-display);
  font-size: 48px; font-weight: 700; color: var(--accent);
  margin-bottom: var(--sp-4);
}
.error-page p { font-size: 18px; color: var(--text-sec); margin-bottom: var(--sp-8); }

/* ── Archive ───────────────────────────────────────── */
.archive-header { padding: var(--sp-10) 0 var(--sp-6); }
.archive-header h1 {
  font-family: var(--font-display);
  font-size: 32px; font-weight: 700; margin-bottom: var(--sp-3);
}
.archive-header .desc { font-size: 17px; color: var(--text-sec); max-width: 60ch; }

/* ── Figures ───────────────────────────────────────── */
.article-content figure {
  margin: var(--sp-8) 0;
}
.article-content figcaption {
  font-size: 13px; color: var(--text-sec);
  text-align: center; margin-top: var(--sp-2);
  font-style: italic;
}
.article-content figure img {
  border-radius: var(--radius);
}

/* ── Last reviewed ─────────────────────────────────── */
.last-reviewed {
  font-size: 13px; color: var(--text-sec);
  font-family: var(--font-display);
}

/* ── Print ─────────────────────────────────────────── */
@media print {
  .site-header, .site-footer, .toc, .related-posts, .cta-card { display: none; }
  body { font-size: 12pt; color: #000; }
  a { color: #000; text-decoration: underline; }
}
