/* CryptoProfitCalculator — main stylesheet
   Light content, dark navy header/footer, indigo accents. No gradients. */

:root {
  --navy: #141a2e;
  --navy-soft: #1a1a2e;
  --indigo: #4f46e5;
  --indigo-dark: #4338ca;
  --indigo-light: #eef2ff;
  --text: #1e2433;
  --text-muted: #5b6478;
  --bg: #ffffff;
  --bg-alt: #f8fafc;
  --border: #e5e8f0;
  --radius: 10px;
  --max-width: 1100px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  color: var(--text);
  background: var(--bg);
  line-height: 1.65;
  font-size: 1rem;
}
img { max-width: 100%; height: auto; display: block; }
a { color: var(--indigo); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { line-height: 1.25; margin: 0 0 0.6em; font-weight: 700; letter-spacing: -0.01em; }
h1 { font-size: 2.1rem; }
h2 { font-size: 1.55rem; }
h3 { font-size: 1.2rem; }
p { margin: 0 0 1em; }
.container { max-width: var(--max-width); margin: 0 auto; padding: 0 1.25rem; }
.container-narrow { max-width: 760px; }
.skip-link {
  position: absolute; left: -9999px; top: 0; z-index: 200;
  background: var(--indigo); color: #fff; padding: 0.6rem 1rem; border-radius: 0 0 6px 0;
}
.skip-link:focus { left: 0; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-block; padding: 0.7rem 1.6rem; border-radius: 8px;
  font-weight: 600; font-size: 1rem; border: 1px solid transparent;
  cursor: pointer; text-decoration: none; line-height: 1.4;
}
.btn:hover { text-decoration: none; }
.btn-primary { background: var(--indigo); color: #fff; }
.btn-primary:hover { background: var(--indigo-dark); }
.btn-secondary { background: #fff; color: var(--indigo); border-color: var(--indigo); }
.btn-secondary:hover { background: var(--indigo-light); }

/* ---------- Header ---------- */
.site-header {
  background: var(--navy); color: #fff;
  position: sticky; top: 0; z-index: 100;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.08);
}
.header-inner { display: flex; align-items: center; gap: 1.5rem; min-height: 68px; }
.brand { display: flex; align-items: center; gap: 0.7rem; color: #fff; margin-right: auto; }
.brand:hover { text-decoration: none; }
.brand-logo { border-radius: 8px; }
.brand-text { display: flex; flex-direction: column; line-height: 1.2; }
.brand-name { font-weight: 700; font-size: 1.1rem; }
.brand-tagline { font-size: 0.78rem; color: #aeb6cc; }
.primary-nav ul { display: flex; gap: 0.25rem; list-style: none; margin: 0; padding: 0; }
.primary-nav a { color: #dbe1f1; padding: 0.55rem 0.85rem; border-radius: 6px; font-weight: 500; font-size: 0.95rem; }
.primary-nav a:hover { color: #fff; background: rgba(255, 255, 255, 0.08); text-decoration: none; }
.nav-toggle {
  display: none; background: none; border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 6px; padding: 0.55rem; cursor: pointer; margin-left: auto;
}
.nav-toggle span { display: block; width: 22px; height: 2px; background: #fff; margin: 5px 0; border-radius: 2px; transition: transform 0.2s, opacity 0.2s; }
.nav-toggle[aria-expanded="true"] span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-toggle[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.nav-toggle[aria-expanded="true"] span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* ---------- Ad slots ---------- */
.ad-slot {
  margin: 1.5rem auto; padding: 0.75rem; background: var(--bg-alt);
  border: 1px solid var(--border); border-radius: var(--radius);
  text-align: center; max-width: var(--max-width);
}
.ad-label {
  display: block; font-size: 0.68rem; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--text-muted); margin-bottom: 0.5rem;
}
.ad-header { margin-top: 0; border-radius: 0 0 var(--radius) var(--radius); border-top: 0; }
.ad-home-hero, .ad-sidebar { margin-left: auto; margin-right: auto; }

/* ---------- Hero / calculator ---------- */
.hero { background: var(--bg-alt); border-bottom: 1px solid var(--border); padding: 3rem 0 3.5rem; }
.hero-text { text-align: center; max-width: 720px; margin: 0 auto 2rem; }
.hero-text h1 { font-size: 2.5rem; margin-bottom: 0.4rem; }
.hero-subtitle { font-size: 1.15rem; color: var(--text-muted); margin: 0; }
.calculator-wrap {
  background: #fff; border: 1px solid var(--border); border-radius: 12px;
  padding: 1.75rem; max-width: 680px; margin: 0 auto;
  box-shadow: 0 4px 18px rgba(20, 26, 46, 0.06);
}

/* ---------- Dark theme ---------- */
[data-theme="dark"] {
  --text: #e6e9f2;
  --text-muted: #9aa3ba;
  --bg: #101426;
  --bg-alt: #161b30;
  --border: #262d47;
  --indigo-light: #232a4a;
}
[data-theme="dark"] .calculator-wrap,
[data-theme="dark"] .post-card,
[data-theme="dark"] .faq-item,
[data-theme="dark"] .share-btn,
[data-theme="dark"] .page-link {
  background: var(--bg-alt);
}
[data-theme="dark"] .btn-secondary {
  background: transparent;
}
[data-theme="dark"] .form-row input[type="text"],
[data-theme="dark"] .form-row input[type="email"],
[data-theme="dark"] .form-row textarea {
  background: var(--bg-alt);
}
[data-theme="dark"] .author-logo { background: var(--bg); }
[data-theme="dark"] .post-card:hover { box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45); }
[data-theme="dark"] .article-content pre { background: #0b0e1c; }
[data-theme="dark"] .form-success { background: #0c2b22; border-color: #14532d; color: #a7f3d0; }
[data-theme="dark"] .form-error { background: #2b0f0f; border-color: #7f1d1d; color: #fecaca; }
[data-theme="dark"] img { filter: none; }

/* Theme toggle button */
.theme-toggle {
  display: inline-flex; align-items: center; justify-content: center;
  width: 40px; height: 40px; border-radius: 8px; cursor: pointer;
  background: rgba(255, 255, 255, 0.08); border: 1px solid rgba(255, 255, 255, 0.18);
  color: #fff; font-size: 1.15rem; line-height: 1; flex-shrink: 0;
}
.theme-toggle:hover { background: rgba(255, 255, 255, 0.16); }
.theme-toggle .theme-icon-moon { display: none; }
[data-theme="dark"] .theme-toggle .theme-icon-sun { display: none; }
[data-theme="dark"] .theme-toggle .theme-icon-moon { display: inline; }

/* ---------- How to use ---------- */
.how-to-use { padding: 3rem 0; }
.how-to-use h2 { text-align: center; margin-bottom: 1.75rem; }
.how-to-use-body { max-width: 760px; margin: 0 auto; }
.how-to-use-body p { color: var(--text-muted); margin-bottom: 1rem; }
.how-to-use-body ol { margin: 0 0 1rem 1.25rem; padding: 0; }
.how-to-use-body ol li { margin-bottom: 0.75rem; line-height: 1.65; }
.how-to-use-body ol li strong { color: var(--text); }

/* ---------- FAQ ---------- */
.faq h2, .latest-posts h2 { text-align: center; margin-bottom: 2rem; }
.faq { background: var(--bg-alt); border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); padding: 3.5rem 0; }
.faq-list { max-width: 760px; margin: 0 auto; }
.faq-item {
  background: #fff; border: 1px solid var(--border); border-radius: var(--radius);
  margin-bottom: 0.9rem; overflow: hidden;
}
.faq-item summary {
  padding: 1.1rem 1.4rem; font-weight: 600; cursor: pointer; list-style: none;
  display: flex; justify-content: space-between; align-items: center; gap: 1rem;
}
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary::after { content: "+"; font-size: 1.4rem; color: var(--indigo); font-weight: 400; flex-shrink: 0; }
.faq-item[open] summary::after { content: "–"; }
.faq-item summary:hover { color: var(--indigo); }
.faq-item p { padding: 0 1.4rem 1.2rem; margin: 0; color: var(--text-muted); }

/* ---------- Post cards / grids ---------- */
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; margin-bottom: 1.75rem; }
.section-head h2 { margin: 0; }
.link-more { font-weight: 600; white-space: nowrap; }
.post-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.5rem; }
.latest-posts { padding: 3.5rem 0; }
.post-card {
  background: #fff; border: 1px solid var(--border); border-radius: var(--radius);
  overflow: hidden; display: flex; flex-direction: column;
  transition: box-shadow 0.2s, transform 0.2s;
}
.post-card:hover { box-shadow: 0 8px 24px rgba(20, 26, 46, 0.1); transform: translateY(-2px); }
.post-card-media img { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; }
.post-card-body { padding: 1.25rem; display: flex; flex-direction: column; flex: 1; }
.post-card h3, .post-card-title { font-size: 1.08rem; margin-bottom: 0.5rem; }
.post-card h3 a, .post-card-title a { color: var(--text); }
.post-card h3 a:hover, .post-card-title a:hover { color: var(--indigo); text-decoration: none; }
.post-card-excerpt { color: var(--text-muted); font-size: 0.93rem; margin: 0 0 0.9rem; flex: 1; }
.post-card-date, .post-card-meta { font-size: 0.85rem; color: var(--text-muted); }
.post-card-meta { display: flex; align-items: center; gap: 0.5rem; }
.meta-sep { color: #b9c0d4; }

/* ---------- CTA ---------- */
.cta { background: var(--navy); color: #fff; padding: 3.5rem 0; }
.cta-inner { text-align: center; max-width: 640px; }
.cta-inner h2 { color: #fff; }
.cta-inner p { color: #aeb6cc; margin-bottom: 1.5rem; }

/* ---------- Page hero / blog listing ---------- */
.page-hero { background: var(--bg-alt); border-bottom: 1px solid var(--border); padding: 2.75rem 0; text-align: center; }
.page-hero h1 { margin-bottom: 0.4rem; }
.page-subtitle { color: var(--text-muted); font-size: 1.1rem; margin: 0; }
.blog-listing { padding: 3rem 0; }
.empty-state { text-align: center; color: var(--text-muted); padding: 3rem 0; }

/* ---------- Pagination ---------- */
.pagination { display: flex; justify-content: center; align-items: center; gap: 0.5rem; margin-top: 2.5rem; flex-wrap: wrap; }
.page-link {
  min-width: 42px; padding: 0.55rem 0.8rem; text-align: center;
  border: 1px solid var(--border); border-radius: 8px; color: var(--text);
  font-weight: 500; background: #fff;
}
.page-link:hover { border-color: var(--indigo); color: var(--indigo); text-decoration: none; }
.page-current { background: var(--indigo); border-color: var(--indigo); color: #fff; font-weight: 700; }
.page-prev, .page-next { padding-left: 1.1rem; padding-right: 1.1rem; }

/* ---------- Article ---------- */
.article-wrap { padding: 2.5rem 0 3.5rem; }
.breadcrumb { font-size: 0.88rem; color: var(--text-muted); margin-bottom: 1.75rem; display: flex; gap: 0.6rem; flex-wrap: wrap; align-items: center; }
.breadcrumb-current { color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 420px; }
.article-layout { display: block; }
.article-layout.has-sidebar { display: grid; grid-template-columns: 1fr 300px; gap: 2.5rem; align-items: start; }
.article-title { margin-bottom: 0.6rem; }
.article-meta { color: var(--text-muted); font-size: 0.92rem; margin-bottom: 1.75rem; display: flex; gap: 0.6rem; align-items: center; }
.article-featured { margin: 0 0 2rem; }
.article-featured img { border-radius: var(--radius); width: 100%; }
.article-sidebar { position: sticky; top: 88px; }
.ad-sidebar { margin-top: 0; }

.article-content { font-size: 1.05rem; }
.article-content h2 { font-size: 1.6rem; margin: 2.2em 0 0.7em; }
.article-content h3 { font-size: 1.3rem; margin: 1.8em 0 0.6em; }
.article-content h4 { font-size: 1.1rem; margin: 1.5em 0 0.5em; }
.article-content p, .article-content ul, .article-content ol { margin-bottom: 1.2em; }
.article-content ul, .article-content ol { padding-left: 1.6rem; }
.article-content li { margin-bottom: 0.4em; }
.article-content img { border-radius: var(--radius); margin: 1.5em auto; }
.article-content figure { margin: 1.5em 0; }
.article-content figcaption { text-align: center; font-size: 0.88rem; color: var(--text-muted); margin-top: 0.5rem; }
.article-content blockquote {
  border-left: 4px solid var(--indigo); background: var(--bg-alt);
  margin: 1.5em 0; padding: 1rem 1.4rem; border-radius: 0 var(--radius) var(--radius) 0;
  color: var(--text-muted);
}
.article-content blockquote p:last-child { margin-bottom: 0; }
.article-content table { width: 100%; border-collapse: collapse; margin: 1.5em 0; font-size: 0.95rem; display: block; overflow-x: auto; }
.article-content th, .article-content td { border: 1px solid var(--border); padding: 0.65rem 0.9rem; text-align: left; }
.article-content th { background: var(--bg-alt); font-weight: 600; }
.article-content code {
  background: var(--bg-alt); border: 1px solid var(--border); border-radius: 4px;
  padding: 0.12em 0.4em; font-size: 0.88em;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
.article-content pre {
  background: var(--navy-soft); color: #e7eaf4; padding: 1.2rem; border-radius: var(--radius);
  overflow-x: auto; font-size: 0.9rem; line-height: 1.6; margin: 1.5em 0;
}
.article-content pre code { background: none; border: 0; padding: 0; color: inherit; font-size: inherit; }

/* ---------- Share box / author / related ---------- */
.share-box { border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); padding: 1.25rem 0; margin: 2.5rem 0; display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; }
.share-label { font-weight: 600; }
.share-buttons { display: flex; gap: 0.6rem; flex-wrap: wrap; }
.share-btn {
  padding: 0.5rem 1rem; border: 1px solid var(--border); border-radius: 8px;
  color: var(--text); font-size: 0.9rem; font-weight: 500; background: #fff; cursor: pointer;
}
.share-btn:hover { border-color: var(--indigo); color: var(--indigo); text-decoration: none; }
.author-box {
  display: flex; gap: 1.1rem; align-items: center;
  background: var(--bg-alt); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 1.4rem; margin-bottom: 3rem;
}
.author-logo { border-radius: 10px; flex-shrink: 0; background: #fff; }
.author-name { font-weight: 700; margin: 0 0 0.25rem; }
.author-bio { color: var(--text-muted); font-size: 0.93rem; margin: 0; }
.related-posts h2 { margin-bottom: 1.5rem; }

/* ---------- Comments (frontend) ---------- */
.comments-section { margin: 0 0 3rem; }
.comments-section h2 { margin-bottom: 1.5rem; }
.comments-section .comment-list { display: flex; flex-direction: column; gap: 1.25rem; margin-bottom: 2.5rem; }
.comments-section .comment-item {
  background: var(--bg-alt); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 1.25rem 1.4rem;
}
.comments-section .comment-head { display: flex; align-items: baseline; gap: 0.7rem; margin-bottom: 0.5rem; flex-wrap: wrap; }
.comments-section .comment-head .meta { color: var(--text-muted); font-size: 0.85rem; }
.comments-section .comment-body { margin: 0; }
.comments-section .empty { color: var(--text-muted); }
.comment-form-wrap { background: var(--bg-alt); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.75rem; }
.comment-form-wrap h3 { margin-bottom: 1.25rem; }

/* ---------- Generic page ---------- */
.page-wrap { padding: 2.75rem 0 3.5rem; }
.page-title { margin-bottom: 1.25rem; }

/* ---------- Contact form ---------- */
.contact-section { margin-top: 3rem; }
.contact-section h2 { margin-bottom: 1.25rem; }
.contact-form { max-width: 560px; }
.form-row { margin-bottom: 1.1rem; }
.form-row label { display: block; font-weight: 600; margin-bottom: 0.4rem; font-size: 0.95rem; }
.form-row input[type="text"], .form-row input[type="email"], .form-row textarea {
  width: 100%; padding: 0.7rem 0.9rem; border: 1px solid var(--border); border-radius: 8px;
  font-family: inherit; font-size: 1rem; color: var(--text); background: #fff;
}
.form-row input:focus, .form-row textarea:focus { outline: 2px solid var(--indigo); outline-offset: 1px; border-color: var(--indigo); }
.form-row textarea { resize: vertical; }
.form-honeypot { position: absolute; left: -9999px; top: auto; width: 1px; height: 1px; overflow: hidden; }
.form-message { padding: 1rem 1.25rem; border-radius: var(--radius); margin-bottom: 1.5rem; }
.form-success { background: #ecfdf5; border: 1px solid #a7f3d0; color: #065f46; }
.form-error { background: #fef2f2; border: 1px solid #fecaca; color: #991b1b; }

/* ---------- 404 ---------- */
.error-page { padding: 5rem 0; }
.error-inner { text-align: center; }
.error-code { font-size: 4.5rem; font-weight: 800; color: var(--indigo); margin: 0 0 0.25rem; line-height: 1; }
.error-text { color: var(--text-muted); margin-bottom: 2rem; }
.error-actions { display: flex; gap: 0.9rem; justify-content: center; flex-wrap: wrap; }

/* ---------- Footer ---------- */
.site-footer { background: var(--navy); color: #aeb6cc; padding: 3rem 0 0; margin-top: 0; }
.ad-footer { background: rgba(255, 255, 255, 0.04); border-color: rgba(255, 255, 255, 0.12); }
.ad-footer .ad-label { color: #8b94ad; }
.footer-inner { display: flex; justify-content: space-between; gap: 2.5rem; flex-wrap: wrap; padding-bottom: 2rem; }
.footer-brand .brand { margin: 0 0 0.8rem; }
.footer-tagline { font-size: 0.92rem; margin: 0; max-width: 320px; }
.footer-nav ul { list-style: none; margin: 0; padding: 0; display: flex; gap: 1.4rem; flex-wrap: wrap; }
.footer-nav a { color: #dbe1f1; font-size: 0.95rem; }
.footer-nav a:hover { color: #fff; }
.footer-bottom { border-top: 1px solid rgba(255, 255, 255, 0.1); padding: 1.25rem 0 1.75rem; }
.footer-text { font-size: 0.9rem; margin: 0 0 0.4rem; }
.footer-disclaimer { font-size: 0.85rem; color: #8b94ad; margin: 0; }

/* ---------- Cookie banner ---------- */
.cookie-banner {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 150;
  background: var(--navy); color: #dbe1f1; padding: 1rem 1.25rem;
  display: flex; align-items: center; justify-content: center; gap: 1.25rem; flex-wrap: wrap;
  box-shadow: 0 -4px 18px rgba(0, 0, 0, 0.25);
}
.cookie-banner[hidden] { display: none !important; }
.cookie-banner p { margin: 0; font-size: 0.92rem; max-width: 640px; }

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  .post-grid { grid-template-columns: repeat(2, 1fr); }
  .article-layout.has-sidebar { grid-template-columns: 1fr; }
  .article-sidebar { position: static; }
}
@media (max-width: 760px) {
  h1 { font-size: 1.75rem; }
  .hero-text h1 { font-size: 2rem; }
  .hero { padding: 2.25rem 0 2.75rem; }
  .calculator-wrap { padding: 1.25rem; }
  .nav-toggle { display: block; }
  .primary-nav {
    position: absolute; top: 100%; left: 0; right: 0;
    background: var(--navy); border-top: 1px solid rgba(255, 255, 255, 0.1);
    display: none;
  }
  .primary-nav.open { display: block; }
  .primary-nav ul { flex-direction: column; gap: 0; padding: 0.75rem 1.25rem 1.25rem; }
  .primary-nav a { display: block; padding: 0.7rem 0.4rem; border-radius: 4px; }
  .site-header { position: sticky; }
  .breadcrumb-current { max-width: 220px; }
  .author-box { flex-direction: column; align-items: flex-start; }
  .footer-inner { flex-direction: column; }
  .share-box { flex-direction: column; align-items: flex-start; }
}
@media (max-width: 560px) {
  .post-grid { grid-template-columns: 1fr; }
  .cookie-banner { text-align: center; }
}

/* ---------- Appearance settings (admin customizable) ---------- */
body {
  background-color: var(--ap-bg, #ffffff);
  color: var(--ap-text, #1a1a2e);
  font-size: var(--ap-font-size, 16px);
}
body, p, li, span, div {
  font-family: var(--ap-font-body, system-ui, -apple-system, sans-serif);
}
h1, h2, h3, h4, h5, h6 {
  font-family: var(--ap-font-heading, var(--ap-font-body, system-ui, -apple-system, sans-serif));
}
.site-header, header.site-header {
  background-color: var(--ap-header-bg, #0f172a);
}
.site-footer, footer.site-footer {
  background-color: var(--ap-footer-bg, #0f172a);
}
a { color: var(--ap-primary, #144682); }
.btn-primary, button.btn-primary, .calc-btn {
  background-color: var(--ap-primary, #144682);
  border-radius: var(--ap-radius, 4px);
}
.accent, .text-accent { color: var(--ap-accent, #22a355); }
.card, .post-card, .calc-card {
  border-radius: var(--ap-radius, 4px);
}
.container, .wrap, main .container {
  max-width: var(--ap-width, 1200px);
}

/* ---------- Settings tabs ---------- */
.settings-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 24px;
  border-bottom: 2px solid var(--border, #e5e7eb);
  flex-wrap: wrap;
}
.settings-tabs a {
  padding: 10px 18px;
  text-decoration: none;
  color: var(--text-muted, #64748b);
  font-weight: 500;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
}
.settings-tabs a:hover { color: var(--text, #1a1a2e); }
.settings-tabs a.active {
  color: var(--ap-primary, #144682);
  border-bottom-color: var(--ap-primary, #144682);
}

/* ---------- Color inputs ---------- */
.form-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
@media (max-width: 640px) { .form-grid-2 { grid-template-columns: 1fr; } }
.color-input { display: flex; gap: 8px; align-items: center; }
.color-input input[type=color] {
  width: 48px; height: 38px; padding: 2px;
  border: 1px solid var(--border, #e5e7eb);
  border-radius: 6px; cursor: pointer;
}
.color-input .color-hex { flex: 1; font-family: monospace; }
