/* toolswitchhub — editorial design system
   Direction: serious business publication. Serif headlines, generous whitespace,
   restrained colour, prominent bylines. No webfont requests: system serif stacks
   avoid both the render-blocking fetch and the GDPR question around Google Fonts. */

:root {
  --bg: #fbfaf8;
  --bg-card: #ffffff;
  --bg-sunken: #f4f2ee;
  --text: #1c1b19;
  --text-secondary: #5f5b54;
  --text-muted: #8a857c;
  --accent: #1b4965;
  --accent-dark: #0f3049;
  --accent-wash: #eaf0f4;
  --border: #e5e1d8;
  --border-strong: #d3cec2;
  --danger: #9e2b25;
  --success: #1e6b4f;
  --radius: 4px;
  --max-width: 1120px;
  --measure: 40rem;

  --font-serif: "Iowan Old Style", "Source Serif Pro", Charter, Georgia, "Times New Roman", ui-serif, serif;
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;

  font-size: 16px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 {
  font-family: var(--font-serif);
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--text);
}

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

.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 28px;
}

/* ---------- Header ---------- */
header.site-header {
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  padding: 22px 0;
}
header.site-header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}
a.logo, .logo {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-serif);
  font-weight: 600;
  font-size: 1.3rem;
  letter-spacing: -0.02em;
  color: var(--text);
  text-decoration: none;
}
a.logo:hover { text-decoration: none; }
a.logo:hover .logo-word { color: var(--accent-dark); }
.logo img { display: block; flex: none; border-radius: 5px; }
.logo-word { line-height: 1; }
.logo-word span { color: var(--accent); }
nav.main-nav ul {
  list-style: none;
  display: flex;
  gap: 26px;
  margin: 0;
  padding: 0;
}
nav.main-nav a {
  color: var(--text-secondary);
  font-size: 0.88rem;
  letter-spacing: 0.02em;
}
nav.main-nav a:hover { color: var(--accent); text-decoration: none; }

/* ---------- Hero ---------- */
.hero {
  padding: 72px 0 52px;
  max-width: 46rem;
  margin: 0 auto;
  text-align: left;
  border-bottom: 1px solid var(--border);
}
.hero .kicker {
  font-family: var(--font-sans);
  font-size: 0.75rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 16px;
}
.hero h1 {
  font-size: 2.6rem;
  margin: 0 0 18px;
  line-height: 1.18;
}
.hero p {
  color: var(--text-secondary);
  font-size: 1.1rem;
  line-height: 1.65;
  margin: 0 0 28px;
}
.btn {
  display: inline-block;
  background: var(--accent);
  color: #fff;
  padding: 11px 22px;
  border-radius: var(--radius);
  font-weight: 500;
  font-size: 0.92rem;
  border: 1px solid var(--accent);
  cursor: pointer;
  font-family: var(--font-sans);
}
.btn:hover { background: var(--accent-dark); border-color: var(--accent-dark); text-decoration: none; }
.btn-secondary {
  background: transparent;
  color: var(--accent);
  border: 1px solid var(--border-strong);
}
.btn-secondary:hover { background: var(--accent-wash); color: var(--accent-dark); border-color: var(--border-strong); }

/* ---------- Sections ---------- */
main { padding: 0 0 80px; }

.section-title {
  font-size: 0.78rem;
  font-family: var(--font-sans);
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin: 56px 0 4px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}

.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
  margin-bottom: 20px;
}
.card h2 { font-size: 1.3rem; }
.card p { color: var(--text-secondary); font-size: 0.94rem; }

.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  margin-top: 48px;
}

/* ---------- Article lists ---------- */
.article-list { list-style: none; padding: 0; margin: 0; }
.article-item {
  padding: 26px 0;
  border-bottom: 1px solid var(--border);
}
.article-item:last-child { border-bottom: none; }
.article-item h3 {
  margin: 0 0 8px;
  font-size: 1.35rem;
  line-height: 1.3;
}
.article-item h3 a { color: var(--text); }
.article-item h3 a:hover { color: var(--accent); text-decoration: none; }
.article-item .dek {
  color: var(--text-secondary);
  font-size: 0.95rem;
  margin: 0 0 10px;
  max-width: 44rem;
}
.article-meta {
  font-family: var(--font-sans);
  font-size: 0.78rem;
  color: var(--text-muted);
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}
.article-meta > span:not(:last-child)::after {
  content: "·";
  margin-left: 8px;
  color: var(--border-strong);
}
.kicker-tag {
  color: var(--accent);
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  font-size: 0.72rem;
}

/* ---------- Calculator ---------- */
.calc-form label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  margin: 18px 0 6px;
  color: var(--text-secondary);
  letter-spacing: 0.01em;
}
.calc-form input, .calc-form select {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  font-size: 0.95rem;
  font-family: var(--font-sans);
  background: #fff;
  color: var(--text);
}
.calc-form input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-wash);
}
.calc-form .field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
}

.result-box {
  margin-top: 32px;
  padding: 26px;
  border-radius: var(--radius);
  background: var(--bg-sunken);
  border: 1px solid var(--border);
}
.result-headline {
  font-family: var(--font-serif);
  font-size: 1.5rem;
  font-weight: 600;
  line-height: 1.3;
  margin-bottom: 6px;
}
.result-headline.positive { color: var(--success); }
.result-headline.negative { color: var(--danger); }
.result-sub { color: var(--text-secondary); font-size: 0.9rem; margin-bottom: 22px; }

.form-error {
  margin-top: 16px;
  padding: 10px 14px;
  background: #fdeceb;
  border: 1px solid #edc4c1;
  border-radius: var(--radius);
  color: var(--danger);
  font-size: 0.85rem;
}

.res-h {
  font-family: var(--font-sans);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.11em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin: 34px 0 10px;
}

.chart-mount { margin: 26px 0 8px; }
.chart-mount svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart-mount .grid-l { stroke: var(--border); stroke-width: 1; }
.chart-mount .c-axis { stroke: var(--border-strong); stroke-width: 1; }
.chart-mount .c-ax { font-family: var(--font-sans); font-size: 12px; fill: var(--text-muted); }
.chart-mount .c-line { fill: none; stroke-width: 2.5; stroke-linejoin: round; }
.chart-mount .c-stay { stroke: #6f96ad; }
.chart-mount .c-switch { stroke: var(--accent); }
.chart-mount .c-be { stroke: var(--danger); stroke-width: 1; stroke-dasharray: 4 4; }
.chart-mount .c-be-dot { fill: var(--danger); }
.chart-mount .c-be-lbl { font-family: var(--font-sans); font-size: 12px; font-weight: 600; fill: var(--danger); }
.chart-legend {
  display: flex;
  gap: 22px;
  flex-wrap: wrap;
  font-family: var(--font-sans);
  font-size: 0.82rem;
  color: var(--text-secondary);
  margin-top: 10px;
}
.chart-legend i { display: inline-block; width: 14px; height: 3px; border-radius: 2px; margin-right: 7px; vertical-align: middle; }
.chart-legend .sw-stay { background: #6f96ad; }
.chart-legend .sw-new { background: var(--accent); }

.year-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
  font-variant-numeric: tabular-nums;
}
.year-table th, .year-table td { text-align: right; padding: 10px 0; border-bottom: 1px solid var(--border); }
.year-table th:first-child, .year-table td:first-child { text-align: left; }
.year-table th {
  color: var(--text-muted);
  font-weight: 600;
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.year-table .total td { font-weight: 600; border-bottom: none; border-top: 2px solid var(--border-strong); }
.year-table .pos { color: var(--success); }
.year-table .neg { color: var(--danger); }

.hidden-cost-table tr.em td { font-weight: 600; }
.hidden-cost-table tr.warn td { color: var(--danger); }

.assumption {
  font-family: var(--font-sans);
  font-size: 0.78rem;
  color: var(--text-muted);
  line-height: 1.6;
  margin: 18px 0 0;
}

.cost-bar-row { margin-bottom: 16px; }
.cost-bar-label {
  display: flex;
  justify-content: space-between;
  font-size: 0.85rem;
  margin-bottom: 5px;
  font-variant-numeric: tabular-nums;
}
.cost-bar-track {
  background: var(--border);
  border-radius: 2px;
  height: 8px;
  overflow: hidden;
}
.cost-bar-fill {
  height: 100%;
  border-radius: 2px;
  background: var(--accent);
}
.cost-bar-fill.candidate { background: #6f96ad; }

.hidden-cost-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 22px;
  font-size: 0.9rem;
  font-variant-numeric: tabular-nums;
}
.hidden-cost-table th, .hidden-cost-table td {
  text-align: left;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}
.hidden-cost-table td:last-child, .hidden-cost-table th:last-child { text-align: right; }
.hidden-cost-table th {
  color: var(--text-muted);
  font-weight: 600;
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

/* ---------- Related cases panel ---------- */
.related-cases { margin-top: 56px; }
.related-cases h3 { font-size: 1.25rem; margin-bottom: 6px; }
.related-cases .hint { color: var(--text-secondary); font-size: 0.88rem; margin-bottom: 20px; max-width: 40rem; }
.case-card {
  border-left: 2px solid var(--border-strong);
  border-radius: 0;
  padding: 4px 0 4px 18px;
  margin-bottom: 20px;
  background: transparent;
}
.case-card .case-name { font-weight: 600; font-family: var(--font-serif); font-size: 1.05rem; }
.case-card .case-mech {
  font-family: var(--font-sans);
  font-size: 0.7rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
  font-weight: 600;
}
.case-card .case-note { font-size: 0.9rem; color: var(--text-secondary); margin-top: 5px; }

/* ---------- Article page ---------- */
article.article-body {
  background: transparent;
  border: none;
  border-radius: 0;
  padding: 56px 0 0;
  max-width: var(--measure);
  margin: 0 auto;
}
article.article-body h1 {
  font-size: 2.4rem;
  line-height: 1.18;
  margin: 0 0 20px;
  letter-spacing: -0.02em;
}
.article-body .byline {
  font-family: var(--font-sans);
  color: var(--text-muted);
  font-size: 0.8rem;
  padding-bottom: 28px;
  margin-bottom: 36px;
  border-bottom: 1px solid var(--border);
  line-height: 1.7;
}
.article-body .byline strong { color: var(--text-secondary); font-weight: 600; }
.article-body .standfirst {
  font-family: var(--font-serif);
  font-size: 1.22rem;
  line-height: 1.6;
  color: var(--text-secondary);
  margin: 0 0 34px;
}
.article-body h2 {
  font-size: 1.5rem;
  margin: 48px 0 14px;
  line-height: 1.3;
}
.article-body p, .article-body li {
  font-family: var(--font-serif);
  font-size: 1.12rem;
  line-height: 1.75;
}
.article-body p { margin: 0 0 22px; }
.article-body ul, .article-body ol { padding-left: 24px; margin: 0 0 22px; }
.article-body li { margin-bottom: 12px; }
.article-body strong { font-weight: 600; }

.pull-stat {
  border-left: 2px solid var(--accent);
  padding: 4px 0 4px 22px;
  margin: 34px 0;
}
.pull-stat .num {
  font-family: var(--font-serif);
  font-size: 2rem;
  font-weight: 600;
  line-height: 1.1;
  display: block;
}
.pull-stat .lbl {
  font-family: var(--font-sans);
  font-size: 0.82rem;
  color: var(--text-secondary);
  margin-top: 4px;
  display: block;
}

/* ---------- Charts ---------- */
figure.chart {
  margin: 40px 0;
  padding: 26px 24px 20px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
figure.chart svg { display: block; width: 100%; height: auto; overflow: visible; }
figure.chart figcaption {
  font-family: var(--font-sans);
  font-size: 0.82rem;
  line-height: 1.6;
  color: var(--text-secondary);
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}

.chart .grid line { stroke: var(--border); stroke-width: 1; }
.chart .axis { stroke: var(--border-strong); stroke-width: 1; }
.chart .axis-label {
  font-family: var(--font-sans);
  font-size: 13px;
  fill: var(--text-muted);
}
.chart .axis-note { font-family: var(--font-sans); font-size: 12px; fill: var(--text-muted); }
.chart .ln { fill: none; stroke-width: 2.5; stroke-linecap: round; }
.chart .ln-users { stroke: #6f96ad; }
.chart .ln-val { stroke: var(--accent); }
.chart .dot { fill: var(--accent); }
.chart .dot-users { fill: #6f96ad; }
.chart .pt-label {
  font-family: var(--font-sans);
  font-size: 14px;
  fill: var(--text);
}
.chart .pt-label .delta { font-size: 13px; fill: var(--text-muted); }
.chart .pt-label .delta.down { fill: var(--danger); }

.chart .tl-axis { stroke: var(--border-strong); stroke-width: 1.5; }
.chart .tl-dot { fill: var(--bg-card); stroke: var(--border-strong); stroke-width: 2; }
.chart .tl-dot.hl { fill: var(--accent); stroke: var(--accent); }
.chart .tl-date {
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 600;
  fill: var(--text-secondary);
}
.chart .tl-date .hl { fill: var(--accent); }
.chart .tl-body {
  font-family: var(--font-sans);
  font-size: 12.5px;
  fill: var(--text-muted);
}
.chart .tl-body .hl { fill: var(--text); }

.article-body .sources {
  margin-top: 56px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
  font-family: var(--font-sans);
  font-size: 0.82rem;
  line-height: 1.65;
  color: var(--text-muted);
}
.article-body .sources p { font-family: var(--font-sans); font-size: 0.82rem; line-height: 1.65; }
.article-body .sources strong { color: var(--text-secondary); }

.cta-box {
  margin: 44px 0;
  padding: 26px;
  background: var(--bg-sunken);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-family: var(--font-sans);
  font-size: 0.94rem;
  color: var(--text-secondary);
}
.cta-box a.btn { margin-top: 14px; }

.draft-notice {
  background: #fdf6e7;
  border: 1px solid #e8d5a8;
  color: #6b4c07;
  padding: 14px 18px;
  border-radius: var(--radius);
  font-family: var(--font-sans);
  font-size: 0.85rem;
  line-height: 1.6;
  margin-bottom: 28px;
}

/* ---------- Footer ---------- */
footer.site-footer {
  border-top: 1px solid var(--border);
  padding: 40px 0;
  color: var(--text-muted);
  font-size: 0.82rem;
}
footer.site-footer .container {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}
footer.site-footer a { color: var(--text-muted); }
footer.site-footer a:hover { color: var(--accent); }

/* ---------- Responsive ---------- */
@media (max-width: 860px) {
  .grid-2 { grid-template-columns: 1fr; gap: 20px; }
}
@media (max-width: 760px) {
  .container { padding: 0 20px; }
  .hero { padding: 44px 0 36px; }
  .hero h1 { font-size: 1.85rem; }
  .hero p { font-size: 1rem; }
  .calc-form .field-row { grid-template-columns: 1fr; gap: 0; }
  article.article-body { padding-top: 36px; }
  article.article-body h1 { font-size: 1.75rem; }
  .article-body h2 { font-size: 1.25rem; margin-top: 36px; }
  .article-body p, .article-body li { font-size: 1.05rem; }
  .article-body .standfirst { font-size: 1.1rem; }
  .article-item h3 { font-size: 1.15rem; }
  header.site-header { padding: 16px 0; }
  header.site-header .container { justify-content: center; }
  nav.main-nav ul { gap: 18px; }
  footer.site-footer .container { justify-content: center; text-align: center; }
}
