/* =====================================================================
   THE CRYPTO GUY — Theme: Electric Indigo + Mint
   Light theme by default, dark theme via [data-theme="dark"]
   ===================================================================== */

/* ---------- Design tokens ---------- */
:root {
  /* Brand */
  --indigo: #5B3DF5;
  --indigo-600: #4F2FE0;
  --indigo-700: #4324c2;
  --mint: #00C896;
  --mint-600: #00B187;

  /* Light theme (default) */
  --bg: #ffffff;
  --bg-soft: #f6f5fb;
  --surface: #ffffff;
  --surface-2: #f2f1f9;
  --text: #141226;
  --text-soft: #4a475e;
  --muted: #6b6880;
  --border: #e7e5f1;
  --border-strong: #d7d4e6;
  --accent: var(--indigo);
  --accent-contrast: #ffffff;
  --tag-bg: #efecff;
  --tag-text: #4324c2;
  --shadow: 0 1px 2px rgba(20,18,38,.06), 0 8px 24px rgba(20,18,38,.06);
  --shadow-lg: 0 20px 50px rgba(36,18,120,.14);
  --gradient: linear-gradient(120deg, #5B3DF5 0%, #7b5cff 45%, #00C896 130%);

  --maxw: 1180px;
  --radius: 16px;
  --radius-sm: 10px;
  --font-ui: "Space Grotesk", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-body: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-read: "Source Serif 4", Georgia, "Times New Roman", serif;
}

[data-theme="dark"] {
  --bg: #0d0a1a;
  --bg-soft: #110d22;
  --surface: #16122a;
  --surface-2: #1c1736;
  --text: #f3f1fb;
  --text-soft: #cdc9e2;
  --muted: #9b97b8;
  --border: #2a2444;
  --border-strong: #392f5c;
  --accent: #8b73ff;
  --accent-contrast: #0d0a1a;
  --tag-bg: #241d44;
  --tag-text: #b9a8ff;
  --shadow: 0 1px 2px rgba(0,0,0,.4), 0 10px 30px rgba(0,0,0,.35);
  --shadow-lg: 0 24px 60px rgba(0,0,0,.55);
  --gradient: linear-gradient(120deg, #6f55ff 0%, #8b73ff 45%, #00C896 130%);
}

/* ---------- Reset / base ---------- */
* { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  font-size: 17px;
  transition: background .25s ease, color .25s ease;
  overflow-x: hidden;
}
img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; border: none; background: none; }
.wrap { max-width: var(--maxw); margin: 0 auto; padding: 0 22px; }

h1,h2,h3,h4 { font-family: var(--font-ui); line-height: 1.18; letter-spacing: -.01em; color: var(--text); margin: 0; }

/* ---------- Header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: saturate(160%) blur(14px);
  border-bottom: 1px solid var(--border);
}
.header-inner { display: flex; align-items: center; gap: 18px; height: 68px; }
.brand { display: flex; align-items: center; gap: 11px; font-family: var(--font-ui); font-weight: 700; font-size: 1.2rem; letter-spacing: -.02em; }
.brand .logo {
  width: 38px; height: 38px; border-radius: 11px; display: grid; place-items: center;
  background: var(--gradient); color: #fff; font-weight: 700; font-size: 1.05rem;
  box-shadow: 0 6px 16px rgba(91,61,245,.4);
}
.brand b { color: var(--accent); }
.nav { display: flex; align-items: center; gap: 4px; margin-left: 14px; }
.nav a {
  font-family: var(--font-ui); font-weight: 500; font-size: .92rem; color: var(--text-soft);
  padding: 8px 13px; border-radius: 9px; transition: .15s;
}
.nav a:hover { color: var(--accent); background: var(--surface-2); }
.nav a.active { color: var(--accent); }
.header-actions { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.btn {
  font-family: var(--font-ui); font-weight: 600; font-size: .9rem;
  padding: 9px 18px; border-radius: 999px; transition: .18s; display: inline-flex; align-items: center; gap: 7px;
}
.btn-primary { background: var(--accent); color: var(--accent-contrast); }
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 10px 24px rgba(91,61,245,.35); }
.icon-btn {
  width: 40px; height: 40px; border-radius: 999px; display: grid; place-items: center;
  border: 1px solid var(--border); color: var(--text-soft); transition: .18s; background: var(--surface);
}
.icon-btn:hover { color: var(--accent); border-color: var(--accent); }
.icon-btn svg { width: 19px; height: 19px; }
.theme-toggle .moon { display: none; }
[data-theme="dark"] .theme-toggle .sun { display: none; }
[data-theme="dark"] .theme-toggle .moon { display: block; }

/* mobile nav toggle */
.menu-btn { display: none; }

/* ---------- Hero / featured ---------- */
.hero { padding: 46px 0 18px; }
.eyebrow {
  font-family: var(--font-ui); font-weight: 600; font-size: .78rem; letter-spacing: .14em; text-transform: uppercase;
  color: var(--accent); display: inline-flex; align-items: center; gap: 8px; margin-bottom: 14px;
}
.eyebrow::before { content: ""; width: 22px; height: 2px; background: var(--accent); border-radius: 2px; }

.featured {
  display: grid; grid-template-columns: 1.15fr .85fr; gap: 38px; align-items: center;
  background: var(--surface); border: 1px solid var(--border); border-radius: 24px; padding: 34px;
  box-shadow: var(--shadow);
}
.featured .media { border-radius: 18px; overflow: hidden; aspect-ratio: 16/11; background: var(--surface-2); }
.featured .media img { width: 100%; height: 100%; object-fit: cover; }
.featured h2 { font-size: clamp(1.7rem, 3.4vw, 2.6rem); margin: 14px 0 12px; }
.featured h2 a:hover { color: var(--accent); }
.featured .dek { color: var(--text-soft); font-size: 1.07rem; margin-bottom: 18px; }

/* ---------- Category chips ---------- */
.cat-bar { display: flex; gap: 9px; flex-wrap: wrap; padding: 30px 0 8px; }
.chip {
  font-family: var(--font-ui); font-weight: 500; font-size: .88rem; padding: 8px 16px; border-radius: 999px;
  border: 1px solid var(--border-strong); color: var(--text-soft); background: var(--surface); transition: .15s;
}
.chip:hover { border-color: var(--accent); color: var(--accent); }
.chip.active { background: var(--accent); border-color: var(--accent); color: var(--accent-contrast); }

/* ---------- Post grid ---------- */
.section-title { display: flex; align-items: baseline; justify-content: space-between; margin: 36px 0 20px; }
.section-title h3 { font-size: 1.4rem; }
.grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 26px; }

.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden;
  display: flex; flex-direction: column; transition: .2s; box-shadow: var(--shadow);
}
.card:hover { transform: translateY(-4px); border-color: var(--border-strong); box-shadow: var(--shadow-lg); }
.card .thumb { aspect-ratio: 16/10; background: var(--surface-2); overflow: hidden; }
.card .thumb img { width: 100%; height: 100%; object-fit: cover; transition: .4s; }
.card:hover .thumb img { transform: scale(1.05); }
.card .body { padding: 18px 19px 20px; display: flex; flex-direction: column; flex: 1; }
.tag {
  align-self: flex-start; font-family: var(--font-ui); font-weight: 600; font-size: .72rem; letter-spacing: .04em;
  text-transform: uppercase; color: var(--tag-text); background: var(--tag-bg); padding: 5px 11px; border-radius: 999px; margin-bottom: 12px;
}
.card h4 { font-size: 1.18rem; margin-bottom: 9px; }
.card:hover h4 { color: var(--accent); }
.card .excerpt { color: var(--muted); font-size: .95rem; margin-bottom: 16px; flex: 1; }
.meta { display: flex; align-items: center; gap: 9px; font-size: .82rem; color: var(--muted); font-family: var(--font-ui); margin-top: auto; }
.meta .avatar { width: 26px; height: 26px; border-radius: 999px; object-fit: cover; background: var(--gradient); }
.meta .dot { width: 3px; height: 3px; border-radius: 999px; background: var(--muted); }

/* list style (secondary) */
.list { display: grid; gap: 18px; }
.row {
  display: grid; grid-template-columns: 150px 1fr; gap: 20px; background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius); padding: 14px; transition: .18s;
}
.row:hover { border-color: var(--border-strong); box-shadow: var(--shadow); }
.row .thumb { aspect-ratio: 1/1; border-radius: 10px; overflow: hidden; background: var(--surface-2); }
.row .thumb img { width: 100%; height: 100%; object-fit: cover; }
.row .body { display: flex; flex-direction: column; justify-content: center; }
.row h4 { font-size: 1.08rem; margin-bottom: 8px; }
.row:hover h4 { color: var(--accent); }

/* ---------- Newsletter CTA ---------- */
.subscribe {
  margin: 56px 0 10px; border-radius: 24px; padding: 46px; text-align: center; color: #fff;
  background: var(--gradient); box-shadow: var(--shadow-lg); position: relative; overflow: hidden;
}
.subscribe h3 { color: #fff; font-size: 1.9rem; margin-bottom: 10px; }
.subscribe p { color: rgba(255,255,255,.9); max-width: 520px; margin: 0 auto 22px; }
.subscribe form { display: flex; gap: 10px; max-width: 460px; margin: 0 auto; }
.subscribe input {
  flex: 1; padding: 13px 18px; border-radius: 999px; border: none; font-size: 1rem; font-family: var(--font-body);
}
.subscribe .btn-primary { background: #fff; color: var(--indigo-700); }

/* ---------- Footer ---------- */
.site-footer { border-top: 1px solid var(--border); margin-top: 64px; padding: 46px 0 40px; background: var(--bg-soft); }
.footer-grid { display: grid; grid-template-columns: 1.4fr 1fr 1fr 1fr; gap: 30px; }
.footer-grid h5 { font-family: var(--font-ui); font-size: .8rem; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); margin: 0 0 14px; }
.footer-grid a { display: block; color: var(--text-soft); padding: 5px 0; font-size: .94rem; }
.footer-grid a:hover { color: var(--accent); }
.footer-bottom { margin-top: 34px; padding-top: 22px; border-top: 1px solid var(--border); display: flex; justify-content: space-between; flex-wrap: wrap; gap: 12px; color: var(--muted); font-size: .86rem; }
.socials { display: flex; gap: 10px; }
.socials a { width: 36px; height: 36px; border-radius: 999px; display: grid; place-items: center; border: 1px solid var(--border); color: var(--text-soft); }
.socials a:hover { color: var(--accent); border-color: var(--accent); }
.socials svg { width: 17px; height: 17px; }

/* =====================================================================
   ARTICLE (single post)
   ===================================================================== */
.article { padding: 40px 0 10px; }
.article-head { max-width: 760px; margin: 0 auto; }
.breadcrumb { font-family: var(--font-ui); font-size: .85rem; color: var(--muted); margin-bottom: 20px; }
.breadcrumb a:hover { color: var(--accent); }
.article h1 { font-size: clamp(2rem, 5vw, 3.1rem); margin: 14px 0 18px; }
.article .dek { font-size: 1.25rem; color: var(--text-soft); line-height: 1.5; margin-bottom: 26px; }
.byline { display: flex; align-items: center; gap: 13px; padding: 18px 0; border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); }
.byline .avatar { width: 48px; height: 48px; border-radius: 999px; background: var(--gradient); object-fit: cover; }
.byline .who { font-family: var(--font-ui); font-weight: 600; }
.byline .sub { font-size: .86rem; color: var(--muted); }
.byline .share { margin-left: auto; display: flex; gap: 8px; }

.hero-img { max-width: 980px; margin: 32px auto; border-radius: 20px; overflow: hidden; aspect-ratio: 16/8; background: var(--surface-2); box-shadow: var(--shadow); }
.hero-img img { width: 100%; height: 100%; object-fit: cover; }

.article-body { max-width: 720px; margin: 0 auto; font-family: var(--font-read); font-size: 1.24rem; line-height: 1.78; color: var(--text); }
.article-body > * { margin: 0 0 1.45rem; }
.article-body h2 { font-family: var(--font-ui); font-size: 1.85rem; margin: 2.6rem 0 1rem; }
.article-body h3 { font-family: var(--font-ui); font-size: 1.4rem; margin: 2.1rem 0 .8rem; }
.article-body a { color: var(--accent); text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1px; }
.article-body ul, .article-body ol { padding-left: 1.4em; }
.article-body li { margin-bottom: .6rem; }
.article-body img { border-radius: 14px; margin: 2rem auto; box-shadow: var(--shadow); }
.article-body blockquote {
  border-left: 4px solid var(--accent); padding: 4px 0 4px 24px; margin: 2rem 0; font-style: italic;
  color: var(--text-soft); font-size: 1.35rem;
}
.article-body pre {
  background: var(--surface-2); border: 1px solid var(--border); border-radius: 12px; padding: 18px 20px;
  overflow-x: auto; font-size: .92rem; font-family: ui-monospace, "SF Mono", Menlo, monospace; line-height: 1.6;
}
.article-body code { font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: .9em; background: var(--surface-2); padding: 2px 7px; border-radius: 6px; }
.article-body pre code { background: none; padding: 0; }
.article-body figure { margin: 2rem 0; }
.article-body figcaption { text-align: center; font-family: var(--font-body); font-size: .9rem; color: var(--muted); margin-top: 10px; }
.callout {
  background: var(--surface-2); border: 1px solid var(--border); border-left: 4px solid var(--mint);
  border-radius: 12px; padding: 18px 22px; font-family: var(--font-body); font-size: 1.05rem;
}

.tag-row { max-width: 720px; margin: 36px auto 0; display: flex; flex-wrap: wrap; gap: 9px; }
.tag-row .tag { cursor: default; }

/* progress bar */
.read-progress { position: fixed; top: 0; left: 0; height: 3px; width: 0; background: var(--gradient); z-index: 60; transition: width .1s linear; }

/* related */
.related { margin-top: 56px; }

/* states */
.empty { text-align: center; padding: 70px 20px; color: var(--muted); }
.empty h3 { font-size: 1.3rem; margin-bottom: 8px; color: var(--text); }
.skeleton { background: linear-gradient(90deg, var(--surface-2) 25%, var(--surface) 50%, var(--surface-2) 75%); background-size: 200% 100%; animation: shimmer 1.3s infinite; }
@keyframes shimmer { to { background-position: -200% 0; } }

/* ---------- Responsive ---------- */
@media (max-width: 920px) {
  .featured { grid-template-columns: 1fr; }
  .featured .media { order: -1; }
  .grid { grid-template-columns: repeat(2, 1fr); }
  .footer-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 640px) {
  body { font-size: 16px; }
  .nav { display: none; }
  .menu-btn { display: grid; }
  .grid { grid-template-columns: 1fr; }
  .row { grid-template-columns: 110px 1fr; }
  .footer-grid { grid-template-columns: 1fr; gap: 22px; }
  .subscribe { padding: 32px 22px; }
  .subscribe form { flex-direction: column; }
  .subscribe input, .subscribe .btn { width: 100%; }
  .featured { padding: 20px; }
  .article-body { font-size: 1.14rem; }
}
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); border: 0; }
