/* Investory Tools — main.css
   Restrained editorial-research identity. Hairline structure, one pine accent. */

:root {
  --ink: #16202a;
  --ink-soft: #33414d;
  --muted: #5b6670;
  --faint: #8a949c;
  --paper: #fbfbf9;
  --surface: #ffffff;
  --surface-2: #f4f5f2;
  --line: #e3e6e1;
  --line-strong: #cfd4cd;
  --accent: #0f6e5c;
  --accent-ink: #0a4d40;
  --accent-soft: #e7f1ee;
  --warn: #9a5b06;
  --warn-soft: #fbf1e0;
  --radius: 6px;
  --radius-lg: 10px;
  --maxw: 1120px;
  --measure: 44rem; /* ~700px article */
  --font-head: "Newsreader", Georgia, "Times New Roman", serif;
  --font-body: "IBM Plex Sans", system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, sans-serif;
  --shadow: 0 1px 2px rgba(22, 32, 42, .04);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } *, *::before, *::after { animation-duration: .001ms !important; transition-duration: .001ms !important; } }

body {
  margin: 0;
  font-family: var(--font-body);
  color: var(--ink);
  background: var(--paper);
  font-size: 17px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  font-variant-numeric: tabular-nums;
}

h1, h2, h3, h4 { font-family: var(--font-head); color: var(--ink); line-height: 1.15; font-weight: 560; letter-spacing: -0.01em; margin: 0 0 .5em; }
h1 { font-size: clamp(2rem, 4.4vw, 3rem); font-weight: 600; }
h2 { font-size: clamp(1.5rem, 2.6vw, 2rem); margin-top: 1.9em; }
h3 { font-size: 1.25rem; margin-top: 1.6em; }
p { margin: 0 0 1.05em; }
a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-ink); text-decoration: underline; text-underline-offset: 2px; }
strong { font-weight: 600; }
small { font-size: .85rem; color: var(--muted); }
img { max-width: 100%; height: auto; display: block; }
ul, ol { padding-left: 1.15rem; margin: 0 0 1.05em; }
li { margin: .3em 0; }
hr { border: 0; border-top: 1px solid var(--line); margin: 2rem 0; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 3px; }

.container { width: 100%; max-width: var(--maxw); margin: 0 auto; padding: 0 20px; }
.article { max-width: var(--measure); margin: 0 auto; padding: 0 20px; }
.wide { max-width: var(--maxw); }
.section { padding: 3.2rem 0; }
.section--tight { padding: 2rem 0; }
.center { text-align: center; }
.muted { color: var(--muted); }
.eyebrow { font-family: var(--font-body); font-size: .8rem; font-weight: 600; color: var(--accent-ink); letter-spacing: .02em; margin: 0 0 .6rem; }

/* ---------- Header / nav ---------- */
.site-header { position: sticky; top: 0; z-index: 50; background: rgba(251,251,249,.92); backdrop-filter: saturate(1.1) blur(6px); border-bottom: 1px solid var(--line); }
.nav { display: flex; align-items: center; gap: 1.4rem; height: 62px; }
.brand { display: flex; align-items: baseline; gap: .5rem; font-family: var(--font-head); font-weight: 600; font-size: 1.28rem; color: var(--ink); letter-spacing: -.02em; white-space: nowrap; }
.brand:hover { text-decoration: none; color: var(--ink); }
.brand .mark { display:inline-block; width: 12px; height: 12px; border-radius: 3px; background: var(--accent); transform: rotate(45deg); }
.nav-links { display: flex; gap: 1.1rem; margin-left: .5rem; }
.nav-links a { color: var(--ink-soft); font-size: .95rem; font-weight: 500; padding: .35rem 0; border-bottom: 2px solid transparent; }
.nav-links a:hover { color: var(--accent-ink); text-decoration: none; border-bottom-color: var(--accent); }
.nav-right { margin-left: auto; display: flex; align-items: center; gap: .8rem; }
.icon-btn { display: inline-grid; place-items: center; width: 38px; height: 38px; border: 1px solid var(--line-strong); border-radius: var(--radius); background: var(--surface); color: var(--ink-soft); cursor: pointer; }
.icon-btn:hover { border-color: var(--accent); color: var(--accent-ink); }
.nav-toggle { display: none; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: .4rem; font-family: var(--font-body); font-weight: 600; font-size: .95rem; padding: .62rem 1.05rem; border-radius: var(--radius); border: 1px solid transparent; cursor: pointer; transition: background .15s ease, border-color .15s ease, color .15s ease; }
.btn--primary { background: var(--accent); color: #fff; }
.btn--primary:hover { background: var(--accent-ink); color: #fff; text-decoration: none; }
.btn--ghost { background: var(--surface); color: var(--ink); border-color: var(--line-strong); }
.btn--ghost:hover { border-color: var(--accent); color: var(--accent-ink); text-decoration: none; }
.btn--sm { padding: .42rem .8rem; font-size: .88rem; }
.btn--block { width: 100%; }

/* ---------- Hero ---------- */
.hero { padding: 3.6rem 0 2.4rem; border-bottom: 1px solid var(--line); }
.hero__inner { max-width: 52rem; }
.hero h1 { margin-bottom: .35em; }
.hero .lede { font-size: 1.16rem; color: var(--ink-soft); max-width: 40rem; }
.hero__cta { display: flex; flex-wrap: wrap; gap: .7rem; margin: 1.4rem 0 1rem; }
.trust-line { font-size: .9rem; color: var(--muted); display: flex; flex-wrap: wrap; gap: .5rem 1rem; }
.trust-line span { display: inline-flex; align-items: center; gap: .4rem; }
.dot { width: 5px; height: 5px; border-radius: 50%; background: var(--accent); display: inline-block; }

/* ---------- Cards ---------- */
.grid { display: grid; gap: 1rem; }
.grid--2 { grid-template-columns: repeat(2, 1fr); }
.grid--3 { grid-template-columns: repeat(3, 1fr); }
.grid--4 { grid-template-columns: repeat(4, 1fr); }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 1.3rem 1.3rem 1.4rem; display: flex; flex-direction: column; }
.card h3 { margin-top: 0; font-size: 1.18rem; }
.card p { color: var(--muted); font-size: .95rem; flex: 1; }
.card__link { margin-top: .8rem; font-weight: 600; font-size: .92rem; }
.card--link { transition: border-color .15s ease, transform .15s ease; }
.card--link:hover { border-color: var(--line-strong); }
a.card { color: inherit; }
a.card:hover { text-decoration: none; }

.tile { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: .95rem 1.05rem; font-weight: 600; font-size: .95rem; color: var(--ink); transition: border-color .15s ease; }
.tile:hover { border-color: var(--accent); color: var(--accent-ink); text-decoration: none; }
.tile small { display: block; font-weight: 400; margin-top: .15rem; }

/* ---------- Breadcrumbs ---------- */
.breadcrumbs { font-size: .84rem; color: var(--muted); padding: 1rem 0 .2rem; }
.breadcrumbs ol { list-style: none; display: flex; flex-wrap: wrap; gap: .4rem; padding: 0; margin: 0; }
.breadcrumbs li::after { content: "›"; margin-left: .4rem; color: var(--faint); }
.breadcrumbs li:last-child::after { content: ""; }
.breadcrumbs a { color: var(--muted); }
.breadcrumbs a:hover { color: var(--accent-ink); }

/* ---------- Article content ---------- */
.prose { }
.prose > p:first-of-type { font-size: 1.08rem; color: var(--ink-soft); }
.answer-box { background: var(--accent-soft); border: 1px solid #cfe4dd; border-left: 3px solid var(--accent); border-radius: var(--radius); padding: 1rem 1.15rem; margin: 0 0 1.4rem; }
.answer-box p { margin: 0; font-size: 1rem; }

/* Trust / disclosure / disclaimer boxes */
.notice { border-radius: var(--radius); padding: .85rem 1.05rem; font-size: .92rem; margin: 1.2rem 0; }
.notice--disclosure { background: var(--surface-2); border: 1px solid var(--line); color: var(--ink-soft); }
.notice--verify { background: var(--warn-soft); border: 1px solid #e9d6ac; color: #6b4304; }
.notice--disclaimer { background: var(--surface-2); border: 1px dashed var(--line-strong); color: var(--muted); font-size: .86rem; }
.notice strong { color: inherit; }

.trust-box { border: 1px solid var(--line); border-radius: var(--radius); padding: .8rem 1rem; font-size: .86rem; color: var(--muted); display: flex; flex-wrap: wrap; gap: .3rem 1.4rem; margin: 1.4rem 0; background: var(--surface); }
.trust-box b { color: var(--ink-soft); font-weight: 600; }

/* ---------- Tables ---------- */
.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; margin: 1.2rem 0; border: 1px solid var(--line); border-radius: var(--radius); }
table { width: 100%; border-collapse: collapse; font-size: .92rem; min-width: 560px; }
thead th { text-align: left; background: var(--surface-2); color: var(--ink); font-weight: 600; padding: .7rem .85rem; border-bottom: 1px solid var(--line-strong); white-space: nowrap; }
tbody td { padding: .7rem .85rem; border-bottom: 1px solid var(--line); vertical-align: top; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:nth-child(even) td { background: #fcfcfb; }
td .yes { color: var(--accent-ink); font-weight: 600; }
td .no { color: var(--faint); }

/* ---------- FAQ ---------- */
.faq { margin: 1.5rem 0; }
.faq details { border-bottom: 1px solid var(--line); padding: .3rem 0; }
.faq summary { cursor: pointer; font-weight: 600; font-family: var(--font-head); font-size: 1.08rem; padding: .7rem 0; list-style: none; display: flex; justify-content: space-between; gap: 1rem; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; color: var(--accent); font-weight: 400; font-size: 1.3rem; line-height: 1; }
.faq details[open] summary::after { content: "–"; }
.faq details > p { margin: 0 0 1rem; color: var(--ink-soft); }

/* ---------- Calculator ---------- */
.calc { display: grid; grid-template-columns: 340px 1fr; gap: 1.6rem; margin: 1.4rem 0 2rem; align-items: start; }
.calc__panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 1.2rem 1.25rem 1.4rem; }
.calc__panel h2, .calc__results h2 { margin-top: 0; font-size: 1.15rem; }
.field { margin-bottom: .95rem; }
.field label { display: block; font-size: .88rem; font-weight: 600; color: var(--ink-soft); margin-bottom: .3rem; }
.field .hint { font-weight: 400; color: var(--muted); }
.input-wrap { position: relative; display: flex; align-items: center; }
.input-wrap .affix { position: absolute; left: .7rem; color: var(--muted); font-size: .95rem; pointer-events: none; }
.input-wrap .affix-r { left: auto; right: .7rem; }
.input-wrap.has-prefix input { padding-left: 1.6rem; }
.input-wrap.has-suffix input { padding-right: 2.2rem; }
input[type="number"], input[type="text"], input[type="email"], select, textarea {
  width: 100%; font-family: var(--font-body); font-size: 1rem; color: var(--ink);
  padding: .55rem .7rem; border: 1px solid var(--line-strong); border-radius: var(--radius);
  background: var(--surface); appearance: none; -webkit-appearance: none;
}
input:focus, select:focus, textarea:focus { border-color: var(--accent); outline: none; box-shadow: 0 0 0 3px var(--accent-soft); }
select { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%235b6670' d='M1 1l5 5 5-5'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right .75rem center; padding-right: 2rem; }
.toggle-row { display: flex; align-items: center; gap: .6rem; }
.toggle-row input[type="checkbox"] { width: auto; }
.calc__actions { display: flex; gap: .6rem; margin-top: .4rem; }

.calc__results { }
.result-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: .8rem; margin-bottom: 1.2rem; }
.result { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: .85rem 1rem; }
.result .label { font-size: .8rem; color: var(--muted); margin: 0 0 .25rem; }
.result .value { font-size: 1.45rem; font-family: var(--font-head); font-weight: 600; color: var(--ink); margin: 0; letter-spacing: -.01em; }
.result--accent { background: var(--accent-soft); border-color: #cfe4dd; }
.result--accent .value { color: var(--accent-ink); }
.chart-wrap { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 1rem 1rem .6rem; margin-bottom: 1.2rem; }
.chart-wrap h3 { margin: 0 0 .3rem; font-size: 1rem; }
.chart-legend { display: flex; gap: 1.2rem; font-size: .82rem; color: var(--muted); margin-top: .3rem; }
.chart-legend span { display: inline-flex; align-items: center; gap: .4rem; }
.swatch { width: 11px; height: 11px; border-radius: 2px; display: inline-block; }
svg.chart { width: 100%; height: auto; display: block; }
.rows-editor .row-line { display: grid; grid-template-columns: 1fr 1fr 1fr auto; gap: .5rem; margin-bottom: .5rem; align-items: end; }
.rows-editor .row-line .rm { border: 1px solid var(--line-strong); background: var(--surface); border-radius: var(--radius); width: 38px; height: 40px; cursor: pointer; color: var(--muted); }
.rows-editor .row-line .rm:hover { border-color: var(--warn); color: var(--warn); }

/* ---------- Newsletter ---------- */
.newsletter { background: var(--ink); color: #eef1ee; border-radius: var(--radius-lg); padding: 2rem 1.8rem; }
.newsletter h2 { color: #fff; margin-top: 0; }
.newsletter p { color: #c3ccc7; }
.newsletter .nl-form { display: flex; gap: .6rem; max-width: 30rem; margin-top: 1rem; flex-wrap: wrap; }
.newsletter .nl-form input { flex: 1; min-width: 200px; background: #1f2b35; border-color: #33414d; color: #fff; }
.newsletter .nl-form input::placeholder { color: #8a949c; }
.newsletter small { color: #8a949c; }

/* ---------- Footer ---------- */
.site-footer { border-top: 1px solid var(--line); background: var(--surface-2); margin-top: 3rem; }
.footer-grid { display: grid; grid-template-columns: 1.4fr 1fr 1fr 1fr; gap: 1.6rem; padding: 2.6rem 0 1.6rem; }
.footer-grid h4 { font-family: var(--font-body); font-size: .82rem; letter-spacing: .02em; color: var(--muted); text-transform: none; margin: 0 0 .8rem; }
.footer-grid ul { list-style: none; padding: 0; margin: 0; }
.footer-grid li { margin: .4rem 0; }
.footer-grid a { color: var(--ink-soft); font-size: .92rem; }
.footer-grid a:hover { color: var(--accent-ink); }
.footer-brand p { color: var(--muted); font-size: .9rem; max-width: 22rem; }
.footer-bottom { border-top: 1px solid var(--line); padding: 1rem 0 2rem; font-size: .82rem; color: var(--muted); display: flex; flex-wrap: wrap; gap: .5rem 1.2rem; justify-content: space-between; }

/* ---------- 404 ---------- */
.error-page { text-align: center; padding: 5rem 0; }
.error-page .code { font-family: var(--font-head); font-size: 4rem; color: var(--accent); margin: 0; }

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  .calc { grid-template-columns: 1fr; }
  .footer-grid { grid-template-columns: 1fr 1fr; }
  .grid--4 { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 720px) {
  body { font-size: 16px; }
  .nav-links { display: none; }
  .nav-toggle { display: inline-grid; }
  .nav[data-open="true"] .nav-links { display: flex; position: absolute; left: 0; right: 0; top: 62px; flex-direction: column; background: var(--paper); border-bottom: 1px solid var(--line); padding: .6rem 20px 1rem; gap: .2rem; }
  .nav[data-open="true"] .nav-links a { padding: .6rem 0; border-bottom: 1px solid var(--line); }
  .grid--3 { grid-template-columns: 1fr; }
  .result-grid { grid-template-columns: 1fr 1fr; }
  .newsletter { padding: 1.5rem 1.2rem; }
}
@media (max-width: 480px) {
  .grid--2, .grid--4 { grid-template-columns: 1fr; }
  .rows-editor .row-line { grid-template-columns: 1fr 1fr auto; }
}

/* ---------- v2 additions ---------- */
.form-note { font-size: .9rem; margin: .7rem 0 0; min-height: 1.2em; }
.form-note--ok { color: var(--accent-ink); }
.form-note--err { color: #9b2c1f; }
.newsletter .form-note--ok { color: #9fd9c8; }
.newsletter .form-note--err { color: #f2b8ad; }
.hp { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); border: 0; }

/* At a Glance: a definition grid, readable by people and parsers alike */
.glance { border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--surface); margin: 1.4rem 0; }
.glance h2 { font-size: 1.05rem; margin: 0; padding: .8rem 1.1rem; border-bottom: 1px solid var(--line); }
.glance dl { margin: 0; display: grid; grid-template-columns: minmax(8rem, 30%) 1fr; }
.glance dt, .glance dd { margin: 0; padding: .6rem 1.1rem; border-bottom: 1px solid var(--line); font-size: .93rem; }
.glance dt { color: var(--muted); font-weight: 600; }
.glance dl > :nth-last-child(-n+2) { border-bottom: 0; }
@media (max-width: 480px) { .glance dl { grid-template-columns: 1fr; } .glance dt { border-bottom: 0; padding-bottom: 0; } }

.sources { font-size: .92rem; }
.sources li { margin: .45em 0; }
.figure { margin: 1.6rem 0; }
.figure svg { width: 100%; height: auto; border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--surface); }
.figure figcaption { font-size: .85rem; color: var(--muted); margin-top: .5rem; }
.checklist li { margin: .6em 0; }
.sitemap-list { columns: 2; column-gap: 2rem; }
.sitemap-list li { break-inside: avoid; }
@media (max-width: 640px) { .sitemap-list { columns: 1; } }
.hub-intro { max-width: 46rem; }
.hub-intro p { color: var(--ink-soft); }
