/* ============================================================
   Red Dot Investor — Editorial financial-press design system
   ============================================================ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  /* Color */
  --bg: #f7f7f5;
  --surface: #ffffff;
  --ink: #111827;
  --ink-soft: #374151;
  --muted: #6b7280;
  --accent: #0f766e;          /* teal — calm, authoritative */
  --accent-dark: #115e59;
  --accent-ink: #134e4a;
  --border: #e5e7eb;
  --border-strong: #d1d5db;
  --rule: #e9e9e4;
  --tag-bg: #ccfbf1;
  --tag-text: #0f766e;

  /* Type */
  --serif: "Source Serif 4", Georgia, "Times New Roman", serif;
  --sans: "Inter", -apple-system, "Segoe UI", system-ui, sans-serif;

  --shadow-sm: 0 1px 2px rgba(16,24,40,.05);
  --shadow-md: 0 4px 12px rgba(16,24,40,.08);
  --shadow-lg: 0 12px 32px rgba(16,24,40,.12);
}

html { -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; }

body {
  font-family: var(--sans);
  background: var(--bg);
  color: var(--ink);
  line-height: 1.7;
  font-size: 16.5px;
}

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

/* ============ HEADER ============ */
.site-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
}
.site-header .inner {
  max-width: 1040px;
  margin: 0 auto;
  padding: 0 2rem;
  height: 72px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
}
.brand { display: flex; align-items: baseline; gap: 0.75rem; }
.brand .wordmark {
  font-family: var(--serif);
  font-weight: 700;
  font-size: 1.6rem;
  color: var(--ink);
  letter-spacing: -0.02em;
  line-height: 1;
}
.brand .wordmark em { font-style: normal; color: var(--accent); }
.mark-dot { color: #dc2626; font-size: 0.55em; vertical-align: 0.2em; margin: 0 0.08em; }
.brand .tagline {
  font-size: 0.78rem;
  color: var(--muted);
  letter-spacing: 0.01em;
  max-width: 26ch;
  line-height: 1.35;
}
.site-nav a {
  color: var(--ink-soft);
  font-size: 0.9rem;
  font-weight: 500;
  margin-left: 1.5rem;
}
.site-nav a:hover { color: var(--ink); }

@media (max-width: 720px) {
  .site-header .inner { flex-direction: column; height: auto; padding: 0.9rem 1.25rem; gap: 0.4rem; }
  .site-nav a { margin-left: 0; margin-right: 1rem; font-size: 0.82rem; }
  .brand .tagline { display: none; }
}

/* ============ LAYOUT ============ */
.page {
  max-width: 1040px;
  margin: 0 auto;
  padding: 2.5rem 2rem 3rem;
}

/* ============ HOME — HERO ============ */
.hero {
  padding: 2.5rem 0 2rem;
  border-bottom: 3px solid var(--ink);
  margin-bottom: 2.5rem;
}
.hero .kicker {
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 0.9rem;
}
.hero h1 {
  font-family: var(--serif);
  font-size: clamp(2rem, 4.5vw, 3.2rem);
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: -0.02em;
  max-width: 18ch;
}
.hero p {
  margin-top: 1rem;
  color: var(--ink-soft);
  font-size: 1.05rem;
  max-width: 56ch;
}

/* Section heading */
.section-head {
  display: flex;
  align-items: baseline;
  gap: 0.9rem;
  margin: 2.5rem 0 1.5rem;
}
.section-head h2 {
  font-family: var(--serif);
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--ink);
}
.section-head .rule {
  flex: 1;
  height: 1px;
  background: var(--rule);
}
.section-head .count { color: var(--muted); font-size: 0.85rem; }

/* ============ HOME — FEATURED POST ============ */
.featured {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 2.25rem 2.5rem;
  box-shadow: var(--shadow-md);
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.9rem;
  margin-bottom: 2rem;
}
.featured-meta { display: flex; align-items: center; gap: 0.6rem; flex-wrap: wrap; }
.featured-label {
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
}
.featured-date { font-size: 0.8rem; color: var(--muted); }
.dot { color: var(--border-strong); }
.featured h3 { font-family: var(--serif); font-size: clamp(1.6rem, 3vw, 2.15rem); line-height: 1.18; font-weight: 700; max-width: 30ch; }
.featured h3 a { color: var(--ink); }
.featured h3 a:hover { color: var(--accent); }
.featured-tags { display: flex; gap: 0.45rem; flex-wrap: wrap; }
.featured .summary { color: var(--ink-soft); margin-top: 0.2rem; font-size: 1.04rem; max-width: 62ch; }

/* ============ HOME — READ MORE ============ */
.read-more {
  display: inline-block;
  margin-top: 0.9rem;
  color: var(--accent);
  font-weight: 600;
  font-size: 0.9rem;
  letter-spacing: 0.01em;
}
.read-more:hover { color: var(--accent-dark); }
.read-more .arw { display: inline-block; transition: transform .15s; }
.read-more:hover .arw { transform: translateX(3px); }

/* ============ HOME — POST CARD GRID ============ */
.card-grid { list-style: none; display: grid; grid-template-columns: repeat(2, 1fr); gap: 1.25rem; }
.post-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: var(--shadow-sm);
  padding: 1.4rem 1.6rem;
  display: flex;
  flex-direction: column;
  height: 100%;
  transition: transform .15s, box-shadow .15s, border-color .15s;
}
.post-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
  border-color: var(--border-strong);
}
.post-card h3 a { color: var(--ink); }
.post-card h3 a:hover { color: var(--accent); }
.card-meta { display: flex; align-items: center; gap: 0.55rem; flex-wrap: wrap; margin-bottom: 0.7rem; }
.card-date { color: var(--muted); font-size: 0.78rem; font-variant-numeric: tabular-nums; }
.post-card h3 { font-family: var(--serif); font-size: 1.28rem; font-weight: 700; line-height: 1.28; }
.post-card h3 a { color: var(--ink); }
.post-card h3 a:hover { color: var(--accent); }
.post-card .summary { color: var(--ink-soft); font-size: 0.95rem; margin-top: 0.55rem; flex: 1; }
.post-card .read-more { margin-top: 1rem; }

/* ============ TAGS ============ */
.tag {
  display: inline-block;
  background: var(--tag-bg);
  color: var(--tag-text);
  font-size: 0.7rem;
  font-weight: 600;
  padding: 0.18rem 0.6rem;
  border-radius: 999px;
  margin-right: 0.35rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  text-decoration: none;
  transition: background .15s, color .15s;
}
a.tag:hover { background: var(--accent); color: #fff; }
.tag.plain {
  background: var(--border);
  color: var(--ink-soft);
}

/* ============ POST PAGE ============ */
.post-page {
  max-width: 760px;
  margin: 0 auto;
  padding: 3rem 1.5rem 4rem;
}
.back-link {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 500;
  margin-bottom: 2rem;
}
.back-link:hover { color: var(--accent); }
.back-link .arw { color: var(--accent); font-weight: 700; }

.post-header { margin-bottom: 2.25rem; }
.post-header .kicker {
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 0.8rem;
}
.post-header h1 {
  font-family: var(--serif);
  font-size: clamp(1.75rem, 4vw, 2.6rem);
  font-weight: 700;
  line-height: 1.18;
  letter-spacing: -0.02em;
  color: var(--ink);
  margin-bottom: 1.1rem;
}
.post-header .byline {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
  color: var(--muted);
  font-size: 0.85rem;
  padding-bottom: 1.25rem;
  border-bottom: 1px solid var(--border);
}

.post-body {
  font-family: var(--serif);
  font-size: 1.14rem;
  line-height: 1.85;
  color: var(--ink-soft);
}
.post-body h2 {
  font-family: var(--sans);
  font-size: 1.45rem;
  color: var(--ink);
  font-weight: 700;
  margin: 2.5rem 0 1rem;
  letter-spacing: -0.01em;
}
.post-body h3 {
  font-family: var(--sans);
  font-size: 1.18rem;
  color: var(--ink);
  font-weight: 600;
  margin: 1.75rem 0 0.6rem;
}
.post-body p { margin-bottom: 1.35rem; }
.post-body strong { color: var(--ink); font-weight: 700; }
.post-body ul, .post-body ol { margin: 0 0 1.4rem 1.4rem; }
.post-body li { margin-bottom: 0.5rem; }
.post-body li::marker { color: var(--accent); }
.post-body a { border-bottom: 1px solid color-mix(in srgb, var(--accent) 40%, transparent); }
.post-body a:hover { border-bottom-color: var(--accent); }
.post-body blockquote {
  border-left: 3px solid var(--accent);
  background: #f0fdfa;
  margin: 2rem 0;
  padding: 1.25rem 1.5rem;
  border-radius: 0 10px 10px 0;
  font-style: italic;
  color: var(--ink);
  font-size: 1.12rem;
}
.post-body code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  background: #f1f3f5;
  padding: 0.15rem 0.45rem;
  border-radius: 5px;
  font-size: 0.85em;
  color: var(--accent-dark);
}
.post-body pre {
  background: #111827;
  color: #e5e7eb;
  padding: 1.25rem 1.5rem;
  border-radius: 10px;
  overflow-x: auto;
  margin: 1.5rem 0;
  font-size: 0.9rem;
  line-height: 1.6;
}
.post-body pre code { background: none; color: inherit; padding: 0; }

/* Post footer tags */
.post-tags {
  margin-top: 3rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}
.post-tags .label { font-size: 0.8rem; color: var(--muted); margin-right: 0.4rem; }

/* ============ FOOTER ============ */
.site-footer {
  border-top: 1px solid var(--border);
  background: var(--surface);
  margin-top: 3rem;
}
.site-footer .inner {
  max-width: 1040px;
  margin: 0 auto;
  padding: 2.5rem 2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1.5rem;
  flex-wrap: wrap;
}
.site-footer .wordmark { font-family: var(--serif); font-weight: 700; font-size: 1.15rem; color: var(--ink); }
.site-footer .wordmark em { font-style: normal; color: var(--accent); }
.site-footer p { color: var(--muted); font-size: 0.82rem; }

/* ============ MARKET STRIP (home) ============ */
.market-strip { margin: 0 0 1rem; }
.strip-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 0.75rem;
}
.tile {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.8rem 0.9rem 0.6rem;
  box-shadow: var(--shadow-sm);
}
a.tile {
  display: block;
  text-decoration: none;
  color: inherit;
  transition: border-color .15s ease, box-shadow .15s ease;
}
a.tile:hover { border-color: #0f766e; box-shadow: var(--shadow-sm), 0 0 0 3px rgba(15, 118, 110, .12); }
a.tile:focus-visible { border-color: #0f766e; box-shadow: var(--shadow-sm), 0 0 0 3px rgba(15, 118, 110, .18); outline: none; }
.tile-label { font-size: 0.72rem; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; margin-bottom: 0.3rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tile-price { font-size: 1.12rem; font-weight: 700; color: var(--ink); font-variant-numeric: tabular-nums; }
.tile-chg { font-size: 0.8rem; font-weight: 600; margin-bottom: 0.3rem; }
.tile-chg.up, .up { color: #0f766e; }
.tile-chg.down, .down { color: #b91c1c; }
.tile .spark { display: block; width: 100%; height: 30px; margin-top: 0.15rem; }
.tile-loading, .table-loading { color: var(--muted); font-size: 0.9rem; padding: 1.5rem 0; text-align: center; }

/* ============ ETF TABLE ============ */
.table-wrap {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  overflow-x: auto;
  box-shadow: var(--shadow-md);
}
.etf-table { width: 100%; border-collapse: collapse; font-family: var(--sans); }
.etf-table thead th {
  text-align: left;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  padding: 0.9rem 1.1rem;
  border-bottom: 1px solid var(--border);
  background: #fafafa;
}
.etf-table th.num, .etf-table td.num { text-align: right; }
.etf-table tbody td {
  padding: 0.8rem 1.1rem;
  border-bottom: 1px solid var(--border);
  font-size: 0.95rem;
  vertical-align: middle;
}
.etf-table tbody tr:last-child td { border-bottom: none; }
.etf-table tbody tr:hover { background: #fafafa; }
.etf-table tbody tr:target { background: #f2fbf9; box-shadow: inset 3px 0 0 #0f766e; }
.etf-name { font-weight: 600; color: var(--ink); }
.etf-sym { font-size: 0.75rem; color: var(--muted); margin-top: 0.15rem; }
.etf-table td.num { font-variant-numeric: tabular-nums; font-weight: 600; }
.etf-table td.up, .etf-table td.down { font-weight: 700; }
.spark-cell { width: 130px; }
.spark-cell .spark { width: 120px; height: 36px; }

/* ============ CHARTS ============ */
.chart-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 1.5rem;
  box-shadow: var(--shadow-md);
  margin-bottom: 2rem;
}
.compare-wrap { width: 100%; overflow-x: auto; }
svg.compare { width: 100%; height: auto; max-width: 860px; display: block; margin: 0 auto; }
svg.compare text.axis { font-family: var(--sans); font-size: 11px; fill: var(--muted); }
.legend { display: flex; gap: 1.25rem; flex-wrap: wrap; justify-content: center; margin-top: 0.9rem; font-family: var(--sans); font-size: 0.82rem; color: var(--ink-soft); }
.legend-item { display: inline-flex; align-items: center; gap: 0.4rem; font-family: var(--sans); font-size: 0.82rem; color: var(--ink-soft); }
.legend-item i { width: 14px; height: 3px; border-radius: 2px; display: inline-block; }
.chart-caption { text-align: center; color: var(--muted); font-size: 0.75rem; margin-top: 0.5rem; font-family: var(--sans); }

/* ============ INDEX PAGE ============ */
.index-cat {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.25rem 1.5rem;
  margin-bottom: 1.1rem;
  box-shadow: var(--shadow-sm);
}
.index-cat h3 {
  font-family: var(--sans);
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--accent);
  margin-bottom: 0.7rem;
}
.index-cat h3 a { color: var(--accent); }
.index-cat h3 a:hover { color: var(--accent-dark); }
.index-cat ul { list-style: none; }
.index-cat li { padding: 0.3rem 0; border-bottom: 1px dashed var(--border); font-family: var(--serif); font-size: 1rem; }
.index-cat li:last-child { border-bottom: none; }
.index-cat li a { color: var(--ink); }
.index-cat li a:hover { color: var(--accent); }
.index-list { list-style: none; }
.index-list li { padding: 0.55rem 0; border-bottom: 1px solid var(--border); font-family: var(--serif); font-size: 1.05rem; }
.index-list li a { color: var(--ink); }
.index-list li a:hover { color: var(--accent); }
.cat-date { color: var(--muted); font-size: 0.8rem; font-family: var(--sans); }

@media (max-width: 720px) {
  .page { padding: 1.75rem 1.25rem 2.5rem; }
  .post-page { padding: 2rem 1.25rem 3rem; }
  .featured { padding: 1.6rem 1.4rem; }
  .card-grid { grid-template-columns: 1fr; }
  .hero { padding-top: 1.5rem; }
  .site-footer .inner { flex-direction: column; text-align: center; }
  .strip-grid { grid-template-columns: repeat(auto-fill, minmax(125px, 1fr)); }
  .etf-table thead th, .etf-table tbody td { padding: 0.7rem 0.8rem; }
}
