/* ==========================================================================
   jifu.trade v2 — beginner long-term investing
   Design: calm, editorial, readable. No trading-desk aesthetics.
   Palette: paper #F7F6F3 / ink #111111 / muted #6B6B68 / accent #1B7A3D
   ========================================================================== */

*, *::before, *::after { box-sizing: border-box; }

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  overflow-x: hidden;
}

body {
  margin: 0;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
  background: #F7F6F3;
  color: #111111;
  line-height: 1.65;
}

h1, h2, h3 {
  font-family: 'Playfair Display', Georgia, serif;
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.2;
  margin: 0 0 0.5rem;
}

h1 { font-size: clamp(1.7rem, 3.5vw + 0.5rem, 2.75rem); }
h2 { font-size: clamp(1.35rem, 2vw + 0.4rem, 1.85rem); }
h3 { font-size: 1.15rem; }

p { margin: 0 0 1rem; }
a { color: #1B7A3D; }

.container { max-width: 1080px; margin: 0 auto; padding: 0 1.25rem; }

/* ── Header ─────────────────────────────────────────────────────────────── */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: rgba(247, 246, 243, 0.94);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid #E4E3DF;
}
.header-inner {
  max-width: 1080px; margin: 0 auto; padding: 0.85rem 1.25rem;
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
}
.brand { display: flex; align-items: baseline; gap: 0.6rem; text-decoration: none; }
.brand strong {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: 1.25rem; letter-spacing: -0.03em; color: #111;
}
.brand span { font-size: 0.72rem; color: #6B6B68; letter-spacing: 0.04em; text-transform: uppercase; }
.site-nav { display: flex; gap: 1.4rem; align-items: center; }
.site-nav a {
  color: #6B6B68; text-decoration: none; font-size: 0.85rem; font-weight: 500;
  transition: color 0.15s;
}
.site-nav a:hover, .site-nav a[aria-current="page"] { color: #111; }

/* ── Staleness banner (see app.js) ──────────────────────────────────────── */
#freshness { display: none; }
#freshness.is-stale {
  display: block;
  background: #FFF4E5; border-bottom: 1px solid #E8C89A;
  color: #7A5200; font-size: 0.85rem; padding: 0.6rem 1.25rem; text-align: center;
}
#freshness.is-stale strong { color: #5C3D00; }

/* ── Hero ───────────────────────────────────────────────────────────────── */
.hero { padding: 3rem 0 1.5rem; }
.hero .eyebrow {
  font-size: 0.72rem; font-weight: 600; letter-spacing: 0.12em;
  text-transform: uppercase; color: #6B6B68; margin-bottom: 0.75rem;
}
.hero p.lede { font-size: 1.1rem; color: #444; max-width: 62ch; }
.hero-actions { display: flex; gap: 0.75rem; flex-wrap: wrap; margin-top: 1.5rem; }

.btn {
  display: inline-block; padding: 0.7rem 1.35rem; border-radius: 999px;
  font-size: 0.9rem; font-weight: 600; text-decoration: none;
  border: 1px solid transparent; cursor: pointer; transition: all 0.15s;
}
.btn-primary { background: #1B7A3D; color: #fff; }
.btn-primary:hover { background: #15612F; }
.btn-ghost { background: transparent; color: #111; border-color: #D6D5D0; }
.btn-ghost:hover { border-color: #111; }

/* ── Sections ───────────────────────────────────────────────────────────── */
.section { padding: 2.5rem 0; }
.section + .section { border-top: 1px solid #E4E3DF; }
.section-head { margin-bottom: 1.5rem; }
.section-head .eyebrow {
  font-size: 0.72rem; font-weight: 600; letter-spacing: 0.12em;
  text-transform: uppercase; color: #6B6B68; margin-bottom: 0.4rem;
}
.section-head p { color: #555; max-width: 68ch; margin: 0.4rem 0 0; }

/* ── Tabs ───────────────────────────────────────────────────────────────── */
.tabs { display: flex; gap: 0.5rem; margin-bottom: 1.5rem; flex-wrap: wrap; }
.tab {
  padding: 0.5rem 1.1rem; border-radius: 999px; border: 1px solid #D6D5D0;
  background: transparent; font: inherit; font-size: 0.85rem; font-weight: 500;
  color: #555; cursor: pointer; transition: all 0.15s;
}
.tab:hover { border-color: #111; color: #111; }
.tab[aria-selected="true"] { background: #111; border-color: #111; color: #fff; }

/* ── Asset cards ────────────────────────────────────────────────────────── */
.asset-grid { display: grid; gap: 2px; background: #E4E3DF; border: 1px solid #E4E3DF; border-radius: 12px; overflow: hidden; }
@media (min-width: 720px) { .asset-grid { grid-template-columns: 1fr 1fr; } }

.asset {
  background: #fff; padding: 1.25rem 1.35rem;
  display: flex; flex-direction: column; gap: 0.6rem;
}
.asset-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; }
.asset-sym {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: 1.35rem; font-weight: 700; letter-spacing: -0.02em; margin: 0;
}
.asset-name { font-size: 0.82rem; color: #6B6B68; margin: 0.1rem 0 0; }
.asset-price { text-align: right; white-space: nowrap; }
.asset-price .px { font-size: 1.05rem; font-weight: 600; font-variant-numeric: tabular-nums; }
.asset-price .chg { font-size: 0.78rem; font-variant-numeric: tabular-nums; }
.chg-up { color: #1B7A3D; }
.chg-down { color: #C0392B; }

.asset-why {
  font-size: 0.9rem; color: #333; margin: 0;
  padding-left: 0.85rem; border-left: 2px solid #1B7A3D;
}

.asset-meta { display: flex; flex-wrap: wrap; gap: 0.4rem 1.1rem; font-size: 0.78rem; color: #6B6B68; }
.asset-meta b { color: #333; font-weight: 600; font-variant-numeric: tabular-nums; }

/* ── Metric glossary tooltips ───────────────────────────────────────────── */
.metric {
  position: relative;
  cursor: help;
  border-bottom: 1px dotted #B9B8B3;
  padding-bottom: 1px;
}
.metric:focus { outline: 2px solid #1B7A3D; outline-offset: 2px; border-radius: 3px; }
.metric-q {
  display: inline-flex; align-items: center; justify-content: center;
  width: 12px; height: 12px; margin-left: 3px; border-radius: 50%;
  background: #D6D5D0; color: #555; font-size: 9px; font-weight: 700;
  line-height: 1; vertical-align: 1px;
}
.metric-tip {
  visibility: hidden; opacity: 0;
  position: absolute; left: 0; bottom: calc(100% + 8px);
  width: min(260px, 78vw); z-index: 30;
  background: #111; color: #fff; font-size: 0.75rem; line-height: 1.45;
  padding: 0.6rem 0.75rem; border-radius: 7px;
  box-shadow: 0 6px 20px rgba(0,0,0,0.18);
  transition: opacity 0.14s ease; pointer-events: none;
}
.metric:hover .metric-tip,
.metric:focus .metric-tip { visibility: visible; opacity: 1; }

/* Touch devices: no hover, so reveal the tip on tap (via :focus). */
@media (hover: none) {
  .metric { cursor: pointer; }
}

/* ── 52-week position bar ───────────────────────────────────────────────── */
.range { margin-top: auto; }
.range-bar { position: relative; height: 4px; background: #ECEBE7; border-radius: 999px; }
.range-fill { position: absolute; inset: 0 auto 0 0; background: #1B7A3D; border-radius: 999px; }
.range-mark {
  position: absolute; top: -3px; width: 2px; height: 10px;
  background: #111; border-radius: 1px;
}
.range-labels {
  display: flex; justify-content: space-between;
  font-size: 0.7rem; color: #8A8A85; margin-top: 0.3rem;
  font-variant-numeric: tabular-nums;
}

/* ── Empty / error states ───────────────────────────────────────────────── */
.empty {
  padding: 2rem 1.25rem; text-align: center; color: #8A8A85;
  font-size: 0.9rem; background: #fff; border-radius: 12px;
}
.empty code { background: #F0EFEB; padding: 0.1rem 0.4rem; border-radius: 4px; font-size: 0.85em; }

/* ── Education blocks ───────────────────────────────────────────────────── */
.steps { counter-reset: step; list-style: none; padding: 0; margin: 0; }
.steps li {
  counter-increment: step; position: relative;
  padding: 0 0 1.5rem 3.25rem; border-left: 1px solid #E4E3DF; margin-left: 1rem;
}
.steps li:last-child { border-left-color: transparent; padding-bottom: 0; }
.steps li::before {
  content: counter(step);
  position: absolute; left: -1rem; top: -0.15rem;
  width: 2rem; height: 2rem; border-radius: 50%;
  background: #111; color: #fff; font-size: 0.85rem; font-weight: 600;
  display: flex; align-items: center; justify-content: center;
}
.steps h3 { margin: 0 0 0.35rem; }
.steps p { margin: 0; color: #444; font-size: 0.95rem; }

.terms { display: grid; gap: 2px; background: #E4E3DF; border: 1px solid #E4E3DF; border-radius: 12px; overflow: hidden; }
@media (min-width: 720px) { .terms { grid-template-columns: 1fr 1fr; } }
.term { background: #fff; padding: 1.15rem 1.25rem; }
.term h3 { font-size: 1rem; margin: 0 0 0.35rem; }
.term p { margin: 0; font-size: 0.9rem; color: #444; }

.callout {
  background: #fff; border: 1px solid #E4E3DF; border-left: 3px solid #1B7A3D;
  border-radius: 8px; padding: 1.15rem 1.35rem; margin: 1.5rem 0;
}
.callout p:last-child { margin-bottom: 0; }
.callout h3 { margin-top: 0; }

/* ── Footer ─────────────────────────────────────────────────────────────── */
.site-footer {
  border-top: 1px solid #E4E3DF; margin-top: 2rem;
  padding: 2rem 0 3rem; font-size: 0.82rem; color: #6B6B68;
}
.site-footer a { color: #6B6B68; }
.disclaimer {
  background: #F0EFEB; border-radius: 8px; padding: 1rem 1.25rem;
  font-size: 0.78rem; color: #555; margin-bottom: 1.25rem;
}
