/* ============================================================
   FinTips.space — shared design system
   Editorial layout first: hierarchy, rhythm, whitespace.
   Palette deliberately restrained (ink / paper / one navy accent).
   ============================================================ */

:root {
  --ink: #16211b;
  --ink-soft: #43504a;
  --ink-faint: #71807a;
  --paper: #fdfdfc;
  --surface: #f5f6f4;
  --line: #e3e6e2;
  --accent: #14532d;
  --accent-bright: #166534;
  --accent-wash: #eef4ef;
  --warn-bg: #fbf7ec;
  --warn-line: #eadfbc;
  --serif: Georgia, 'Times New Roman', 'Songti SC', serif;
  --sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Consolas, 'Courier New', monospace;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(22, 33, 27, 0.06), 0 8px 24px -12px rgba(22, 33, 27, 0.12);
}

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

html { scroll-behavior: smooth; }

body {
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.75;
  color: var(--ink);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
}

.container { max-width: 1080px; margin: 0 auto; padding: 0 20px; }
.narrow { max-width: 720px; margin: 0 auto; padding: 0 20px; }

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

:focus-visible { outline: 2px solid var(--accent-bright); outline-offset: 2px; border-radius: 3px; }

.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- Header ---------- */
.site-header { background: var(--paper); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 50; }
.site-header .container { display: flex; align-items: center; justify-content: space-between; gap: 16px; height: 64px; }
.logo { font-family: var(--serif); font-size: 1.25rem; font-weight: 700; letter-spacing: -0.01em; color: var(--ink); white-space: nowrap; }
.logo:hover { text-decoration: none; }
.logo .logo-mark { color: var(--accent); }
.main-nav { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.main-nav a { font-size: 0.92rem; color: var(--ink-soft); padding: 6px 10px; border-radius: 6px; }
.main-nav a:hover { color: var(--accent); background: var(--accent-wash); text-decoration: none; }
.main-nav a.nav-cta { color: #fff; background: var(--accent); margin-left: 6px; }
.main-nav a.nav-cta:hover { background: var(--accent-bright); }

/* ---------- Hero (homepage) ---------- */
.hero { padding: 56px 0 40px; border-bottom: 1px solid var(--line); }
.hero .eyebrow { font-size: 0.8rem; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; color: var(--accent); margin-bottom: 14px; }
.hero h1 { font-family: var(--serif); font-size: clamp(1.9rem, 4.5vw, 2.9rem); line-height: 1.15; letter-spacing: -0.015em; max-width: 21ch; margin-bottom: 18px; }
.hero .lede { font-size: 1.13rem; color: var(--ink-soft); max-width: 58ch; margin-bottom: 24px; }
.trust-chips { display: flex; flex-wrap: wrap; gap: 10px; }
.chip { font-size: 0.85rem; color: var(--ink-soft); background: var(--surface); border: 1px solid var(--line); border-radius: 999px; padding: 6px 14px; }
.chip strong { color: var(--ink); }

/* ---------- Featured post ---------- */
.featured { padding: 36px 0 8px; }
.featured-inner { display: grid; grid-template-columns: 1.15fr 1fr; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; background: var(--surface); }
.featured-media img { width: 100%; height: 100%; min-height: 260px; object-fit: cover; display: block; }
.featured-body { padding: 32px 32px 28px; display: flex; flex-direction: column; justify-content: center; gap: 12px; }
.featured-body .kicker { font-size: 0.78rem; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; color: var(--accent); }
.featured-body h2 { font-family: var(--serif); font-size: 1.65rem; line-height: 1.25; letter-spacing: -0.01em; }
.featured-body h2 a { color: var(--ink); }
.featured-body p { color: var(--ink-soft); font-size: 0.98rem; }
.featured-body .btn { align-self: flex-start; margin-top: 4px; }

.btn { display: inline-block; background: var(--accent); color: #fff !important; font-weight: 600; font-size: 0.95rem; padding: 10px 20px; border-radius: 8px; transition: background 0.15s; }
.btn:hover { background: var(--accent-bright); text-decoration: none; }

/* ---------- Category sections & post rows ---------- */
.category-section { padding: 40px 0 8px; }
.cat-head { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; border-bottom: 2px solid var(--ink); padding-bottom: 10px; margin-bottom: 6px; }
.cat-title { font-family: var(--serif); font-size: 1.45rem; letter-spacing: -0.01em; }
.cat-count { font-size: 0.85rem; color: var(--ink-faint); }

.post-row { display: grid; grid-template-columns: 168px 1fr; gap: 20px; padding: 20px 0; border-bottom: 1px solid var(--line); align-items: start; }
.post-row:last-child { border-bottom: none; }
.post-thumb { width: 168px; aspect-ratio: 16 / 10; object-fit: cover; border-radius: 8px; display: block; background: var(--surface); }
.post-row h3 { font-size: 1.08rem; line-height: 1.4; margin-bottom: 6px; }
.post-row h3 a { color: var(--ink); }
.post-row h3 a:hover { color: var(--accent); }
.post-row .excerpt { font-size: 0.92rem; color: var(--ink-soft); margin-bottom: 8px; }
.post-meta { font-size: 0.82rem; color: var(--ink-faint); display: flex; flex-wrap: wrap; gap: 6px 14px; }
.badge { display: inline-block; font-size: 0.72rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--accent); background: var(--accent-wash); border-radius: 999px; padding: 3px 10px; }

/* ---------- Breadcrumbs ---------- */
.breadcrumbs { font-size: 0.84rem; color: var(--ink-faint); padding: 20px 0 0; }
.breadcrumbs a { color: var(--ink-soft); }
.breadcrumb-sep { margin: 0 8px; color: var(--line); }

/* ---------- Article ---------- */
article.post { padding: 28px 0 8px; }
.post-header { margin-bottom: 28px; }
.post-header h1 { font-family: var(--serif); font-size: clamp(1.8rem, 4vw, 2.5rem); line-height: 1.2; letter-spacing: -0.015em; margin-bottom: 14px; }
.byline { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 10px; font-size: 0.88rem; color: var(--ink-faint); }
.byline a { font-weight: 600; }
.byline-sep { color: var(--line); }

.post-body h2 { font-family: var(--serif); font-size: 1.55rem; line-height: 1.3; letter-spacing: -0.01em; margin: 2.4em 0 0.7em; scroll-margin-top: 84px; }
.post-body h3 { font-size: 1.2rem; margin: 1.9em 0 0.6em; scroll-margin-top: 84px; }
.post-body p { margin-bottom: 1.15em; }
.post-body ul, .post-body ol { margin: 0 0 1.15em 1.4em; }
.post-body li { margin-bottom: 0.45em; }
.post-body strong { color: var(--ink); }
.post-body img { max-width: 100%; height: auto; border-radius: var(--radius); }

/* Callout boxes */
.key-takeaways { background: var(--accent-wash); border: 1px solid #d7e5da; border-radius: var(--radius); padding: 22px 24px; margin: 26px 0; }
.key-takeaways h2 { font-family: var(--sans); font-size: 0.82rem; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; color: var(--accent); margin: 0 0 10px; }
.key-takeaways ul { margin: 0 0 0 1.2em; }
.key-takeaways li { margin-bottom: 6px; font-size: 0.96rem; }
.key-takeaways li:last-child { margin-bottom: 0; }

.toc-box { border: 1px solid var(--line); border-radius: var(--radius); padding: 20px 24px; margin: 26px 0; background: var(--surface); }
.toc-box h2 { font-family: var(--sans); font-size: 0.82rem; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; color: var(--ink-faint); margin: 0 0 10px; }
.toc-box ol { margin-left: 1.2em; font-size: 0.94rem; columns: 1; }
.toc-box li { margin-bottom: 4px; }

.methodology-box { border-left: 3px solid var(--accent); background: var(--surface); border-radius: 0 var(--radius) var(--radius) 0; padding: 18px 22px; margin: 26px 0; font-size: 0.93rem; }
.methodology-box h2 { font-family: var(--sans); font-size: 0.82rem; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; color: var(--ink-soft); margin: 0 0 8px; }
.methodology-box p { margin-bottom: 0.5em; }
.methodology-box p:last-child { margin-bottom: 0; }

.disclaimer-box { font-size: 0.84rem; color: var(--ink-faint); background: var(--warn-bg); border: 1px solid var(--warn-line); border-radius: 8px; padding: 12px 16px; margin: 22px 0; }
.disclaimer-box strong { color: var(--ink-soft); }

/* Figures */
.article-figure { margin: 28px 0; }
.article-figure img { margin: 0; box-shadow: var(--shadow); }
.article-figure figcaption { font-size: 0.83rem; color: var(--ink-faint); margin-top: 10px; text-align: center; }

/* TradingView widgets */
.tv-widget { margin: 28px 0; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; background: #fff; }
.tv-widget .tradingview-widget-container__widget { min-height: 220px; }
.tv-caption { font-size: 0.83rem; color: var(--ink-faint); text-align: center; padding: 10px 16px; border-top: 1px solid var(--line); background: var(--surface); margin: 0; }

/* Tables */
.table-wrap { overflow-x: auto; margin: 26px 0; border: 1px solid var(--line); border-radius: var(--radius); -webkit-overflow-scrolling: touch; }
table { width: 100%; border-collapse: collapse; font-size: 0.92rem; }
th, td { padding: 11px 14px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: top; }
thead th { background: var(--surface); font-weight: 700; font-size: 0.85rem; letter-spacing: 0.02em; }
tbody tr:last-child td { border-bottom: none; }
tbody tr:nth-child(even) { background: #fafbf9; }

code { font-family: var(--mono); font-size: 0.88em; background: var(--surface); border: 1px solid var(--line); padding: 1px 6px; border-radius: 5px; }
pre { background: #101812; color: #e8efe9; padding: 20px; border-radius: var(--radius); overflow-x: auto; margin: 24px 0; font-size: 0.88rem; line-height: 1.6; }
pre code { background: none; border: none; padding: 0; color: inherit; }

blockquote { border-left: 3px solid var(--accent); padding: 6px 0 6px 20px; margin: 24px 0; color: var(--ink-soft); font-style: italic; }

hr { border: none; border-top: 1px solid var(--line); margin: 36px 0; }

/* Affiliate product cards */
.inline-product-card { display: flex; align-items: center; gap: 18px; border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; margin: 26px 0; background: #fff; box-shadow: var(--shadow); }
.inline-product-card img { width: 76px; height: 76px; object-fit: cover; border-radius: 8px; margin: 0; flex-shrink: 0; box-shadow: none; }
.inline-product-info { flex: 1; min-width: 0; }
.inline-product-info .prod-label { font-size: 0.72rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-faint); }
.inline-product-info a { font-weight: 700; color: var(--ink); display: inline-block; }
.inline-product-info a:hover { color: var(--accent); }
.inline-product-meta { display: flex; flex-wrap: wrap; gap: 4px 16px; font-size: 0.86rem; margin-top: 4px; }
.inline-product-rating { color: #9a6b00; }
.inline-product-note { font-size: 0.83rem; color: var(--ink-faint); margin-top: 6px; margin-bottom: 0; }

.product-summary-box { border: 1px solid var(--line); border-radius: var(--radius); padding: 22px 24px; margin: 32px 0; background: var(--surface); }
.product-summary-box h2, .product-summary-box h3 { font-family: var(--sans); font-size: 1rem; margin-bottom: 14px; }
.product-summary-box .aff-note { font-size: 0.8rem; color: var(--ink-faint); margin-top: 12px; margin-bottom: 0; }
.product-comparison-table img { width: 44px; height: 44px; object-fit: cover; border-radius: 6px; margin: 0; box-shadow: none; }

/* FAQ */
.faq-section { margin: 36px 0; }
.faq-section > h2 { margin-bottom: 0.6em; }
.faq-item { padding: 16px 0; border-bottom: 1px solid var(--line); }
.faq-item:last-child { border-bottom: none; }
.faq-question { font-weight: 700; font-size: 1.02rem; margin-bottom: 6px; }
.faq-answer { color: var(--ink-soft); margin-bottom: 0; }

/* Sources & references */
.sources-section { margin: 40px 0 8px; border-top: 2px solid var(--ink); padding-top: 22px; }
.sources-section h2 { font-family: var(--sans); font-size: 0.85rem; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; color: var(--ink-soft); margin: 0 0 14px; }
.sources-section ol { margin-left: 1.4em; font-size: 0.9rem; color: var(--ink-soft); }
.sources-section li { margin-bottom: 10px; }
.sources-section .src-note { font-size: 0.8rem; color: var(--ink-faint); margin-top: 12px; margin-bottom: 0; }

/* Author box (in-article) */
.author-box { display: flex; gap: 16px; align-items: flex-start; border: 1px solid var(--line); border-radius: var(--radius); padding: 20px 22px; margin: 36px 0; background: var(--surface); }
.author-avatar { width: 52px; height: 52px; border-radius: 50%; background: var(--accent); color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 700; flex-shrink: 0; font-size: 1.05rem; }
.author-details .author-name { font-weight: 700; display: block; }
.author-details .author-name a { color: var(--ink); }
.author-details .author-credential { font-size: 0.83rem; color: var(--ink-faint); display: block; margin-top: 2px; }
.author-details .author-bio { font-size: 0.92rem; color: var(--ink-soft); margin-top: 8px; margin-bottom: 0; }

/* Related */
.related-articles { margin: 42px 0; }
.related-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 14px; margin-top: 16px; }
.related-card { border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; background: #fff; transition: box-shadow 0.15s, transform 0.15s; }
.related-card:hover { box-shadow: var(--shadow); text-decoration: none; transform: translateY(-1px); }
.related-card h4 { font-size: 0.98rem; line-height: 1.4; color: var(--ink); margin-bottom: 6px; }
.related-card p { font-size: 0.83rem; color: var(--ink-faint); margin-bottom: 0; }

/* Ad slot (reserved for post-approval units) */
.ad-slot { margin: 30px 0; text-align: center; min-height: 0; }

/* ---------- Author profile pages ---------- */
.profile-header { display: flex; gap: 24px; align-items: flex-start; padding: 40px 0 8px; }
.avatar-lg { width: 96px; height: 96px; border-radius: 50%; background: var(--accent); color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 2rem; flex-shrink: 0; }
.profile-header h1 { font-family: var(--serif); font-size: 2.1rem; letter-spacing: -0.015em; margin-bottom: 4px; }
.profile-role { font-size: 0.95rem; color: var(--accent); font-weight: 600; margin-bottom: 10px; }
.profile-meta { font-size: 0.85rem; color: var(--ink-faint); }
.article-list { list-style: none; margin: 0; }
.article-list li { border-bottom: 1px solid var(--line); padding: 16px 0; }
.article-list li:last-child { border-bottom: none; }
.article-list a { font-weight: 600; color: var(--ink); display: block; }
.article-list a:hover { color: var(--accent); }
.article-list .post-meta { margin-top: 4px; }

/* ---------- Footer ---------- */
.site-footer { margin-top: 64px; border-top: 1px solid var(--line); background: var(--surface); }
.footer-cols { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 32px; padding: 40px 0 28px; }
.footer-brand p { font-size: 0.88rem; color: var(--ink-faint); margin-top: 10px; max-width: 40ch; }
.footer-col h4 { font-size: 0.78rem; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; color: var(--ink-faint); margin-bottom: 12px; }
.footer-col a { display: block; font-size: 0.9rem; color: var(--ink-soft); padding: 3px 0; }
.footer-legal { border-top: 1px solid var(--line); padding: 18px 0 26px; font-size: 0.8rem; color: var(--ink-faint); display: flex; flex-wrap: wrap; gap: 8px 20px; justify-content: space-between; }
.footer-legal a { color: var(--ink-faint); }

/* ---------- 404 / misc ---------- */
.error-page { text-align: center; padding: 90px 0; }
.error-page h1 { font-family: var(--serif); font-size: 3.4rem; margin-bottom: 10px; }
.error-page p { color: var(--ink-soft); margin-bottom: 24px; }

/* ---------- Responsive ---------- */
@media (min-width: 721px) { .toc-box ol { columns: 2; column-gap: 40px; } }
@media (max-width: 900px) {
  .featured-inner { grid-template-columns: 1fr; }
  .featured-media img { max-height: 240px; }
  .footer-cols { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 680px) {
  body { font-size: 16px; }
  .site-header .container { height: auto; padding-top: 10px; padding-bottom: 10px; flex-direction: column; align-items: flex-start; gap: 4px; }
  .main-nav { margin-top: 2px; }
  .hero { padding: 36px 0 28px; }
  .post-row { grid-template-columns: 1fr; gap: 12px; }
  .post-thumb { width: 100%; aspect-ratio: 16 / 9; }
  .inline-product-card { flex-direction: row; }
  .footer-cols { grid-template-columns: 1fr; gap: 24px; }
  .profile-header { flex-direction: column; }
}

@media print {
  .site-header, .site-footer, .tv-widget, .ad-slot, .related-articles, .toc-box, .disclaimer-box { display: none; }
  body { font-size: 12pt; }
}

/* ============================================================
   Homepage (index.html) — appended rules only
   ============================================================ */

/* Masthead: long site name needs a slightly smaller logo */
.home .site-header .logo { font-size: 1.05rem; }

/* Directory rows: compact ~120px thumbnails */
.home .post-row { grid-template-columns: 120px 1fr; gap: 16px; }
.home .post-thumb { width: 120px; }
.home .post-row .excerpt {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Four-column footer (brand + categories + site + authors) */
@media (min-width: 901px) {
  .home .footer-cols { grid-template-columns: 2fr 1fr 1fr 1fr; }
}

/* Mobile directory rows stay as compact list rows */
@media (max-width: 680px) {
  .home .post-row { grid-template-columns: 96px 1fr; gap: 12px; }
  .home .post-thumb { width: 96px; aspect-ratio: 16 / 10; }
}

/* Cookie consent */
.cookie-banner { position: fixed; left: 0; right: 0; bottom: 0; z-index: 999; display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; padding: 0.85rem 1.25rem; background: #111827; color: #e5e7eb; font-size: 0.9rem; }
.cookie-banner p { margin: 0; }
.cookie-banner a { color: #93c5fd; text-decoration: underline; }
.cookie-banner button { flex-shrink: 0; padding: 0.45rem 1.1rem; border: none; border-radius: 6px; background: #4361ee; color: #fff; font-weight: 600; cursor: pointer; }
.cookie-banner button:hover { background: #3a56d4; }
/* Breadcrumbs */
.breadcrumb { font-size: 0.85rem; color: #6b7280; margin-bottom: 0.75rem; }
.breadcrumb a { color: #4361ee; text-decoration: none; }
.breadcrumb a:hover { text-decoration: underline; }
.breadcrumb .sep { margin: 0 0.4rem; color: #9ca3af; }

/* Related guides */
.related-guides { margin-top: 2.5rem; padding: 1.5rem; background: #f8fafc; border: 1px solid #e5e7eb; border-radius: 12px; }
.related-guides h2 { font-size: 1.25rem; margin-top: 0; margin-bottom: 1rem; }
.related-guides ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.85rem; }
.related-guides li { line-height: 1.5; }
.related-guides a.title-link { color: #1f2937; font-weight: 600; text-decoration: none; }
.related-guides a.title-link:hover { color: #4361ee; }
.related-guides p { margin: 0.15rem 0 0; color: #6b7280; font-size: 0.9rem; }