:root {
  --color-page: #f6f6f4;
  --color-bg: #ffffff;
  --color-bg-soft: #eef0ee;
  --color-text: #1c2024;
  --color-muted: #5f6672;
  --color-border: #e1e4e0;
  --color-accent: #0f4c5c;
  --color-accent-dark: #0b3947;
  --color-accent-bg: #e6f0f1;
  --color-gold: #a8790c;
  --max-width: 720px;
  --max-width-wide: 1040px;
  --radius: 10px;
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, 0.06);
  --shadow-md: 0 8px 20px rgba(16, 24, 40, 0.09);

  --font-serif: Georgia, 'Times New Roman', 'Noto Serif', serif;
  --font-sans: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;

  /* Categorical chart palette (validated order, see dataviz skill) */
  --chart-series-1: #2a78d6;
  --chart-series-2: #eb6834;
  --chart-series-3: #1baf7a;
  --chart-series-4: #eda100;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

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

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

a:hover {
  text-decoration: underline;
}

h1,
h2,
h3 {
  font-family: var(--font-serif);
  font-weight: 700;
  color: var(--color-text);
}

/* ---------- Header ---------- */

.site-header {
  background: var(--color-accent-dark);
  position: sticky;
  top: 0;
  z-index: 10;
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.15);
}

.site-header-inner {
  max-width: var(--max-width-wide);
  margin: 0 auto;
  padding: 0.9rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.site-logo {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  text-decoration: none;
  color: #ffffff;
}

.site-logo-mark {
  width: 34px;
  height: 34px;
  color: #ffffff;
  flex-shrink: 0;
}

.site-logo-word {
  font-family: var(--font-serif);
  font-size: 1.55rem;
  letter-spacing: 0.01em;
  text-transform: uppercase;
}

.site-logo-word-bold {
  font-weight: 700;
}

.site-logo-word-regular {
  font-weight: 400;
  opacity: 0.85;
}

.site-logo-word-tld {
  font-weight: 400;
  opacity: 0.85;
  text-transform: lowercase;
}

.site-nav {
  display: flex;
  gap: 1.5rem;
  font-size: 0.9rem;
  font-weight: 600;
}

.site-nav a {
  color: rgba(255, 255, 255, 0.72);
  text-decoration: none;
  padding: 0.3rem 0;
  border-bottom: 2px solid transparent;
}

.site-nav a:hover {
  color: #ffffff;
  text-decoration: none;
}

.site-nav a[aria-current='page'] {
  color: #ffffff;
  border-bottom-color: #ffffff;
}

/* ---------- Layout ---------- */

main {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 2.25rem 1.25rem 3.5rem;
}

main.wide {
  max-width: var(--max-width-wide);
}

.page-intro {
  color: var(--color-muted);
  font-size: 1.08rem;
  max-width: 60ch;
  margin-top: -0.5rem;
}

h1 {
  font-size: 1.95rem;
  letter-spacing: -0.01em;
  margin-bottom: 0.5rem;
  line-height: 1.2;
}

h2 {
  font-size: 1.3rem;
  margin-top: 2.25rem;
  letter-spacing: -0.005em;
}

table {
  border-collapse: collapse;
  width: 100%;
  margin: 1rem 0;
  font-size: 0.95rem;
}

th,
td {
  border: 1px solid var(--color-border);
  padding: 0.6rem 0.8rem;
  text-align: left;
}

th {
  background: var(--color-bg-soft);
}

details {
  border-bottom: 1px solid var(--color-border);
  padding: 0.85rem 0;
}

summary {
  cursor: pointer;
  font-weight: 600;
}

summary::marker {
  color: var(--color-accent);
}

details p {
  color: var(--color-muted);
  margin-top: 0.6rem;
  margin-bottom: 0;
}

/* ---------- Breadcrumb ---------- */

.breadcrumb {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  font-size: 0.85rem;
  color: var(--color-muted);
  margin-bottom: 0.9rem;
}

.breadcrumb a {
  color: var(--color-muted);
  font-weight: 600;
}

.breadcrumb a:hover {
  color: var(--color-accent);
}

.breadcrumb-current {
  color: var(--color-text);
  font-weight: 600;
}

/* ---------- Cluster badge ---------- */

.cluster-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  font-family: var(--font-serif);
  font-weight: 700;
  border-radius: 9px;
  flex-shrink: 0;
}

.cluster-badge-md {
  width: 38px;
  height: 38px;
  font-size: 1.05rem;
}

.cluster-badge-lg {
  width: 52px;
  height: 52px;
  font-size: 1.4rem;
  border-radius: 12px;
}

/* ---------- Hero & trust row ---------- */

.hero {
  padding: 1rem 0 0.5rem;
  margin-bottom: 0.5rem;
}

.hero h1 {
  font-size: 2.4rem;
}

.trust-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem 1.4rem;
  margin-top: 1.2rem;
}

.trust-item {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.86rem;
  color: var(--color-muted);
  font-weight: 600;
}

.trust-item::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--color-accent);
  display: inline-block;
}

/* ---------- How it works steps ---------- */

.steps {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 1.5rem;
  margin: 1.75rem 0 2.75rem;
}

.step-number {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--color-accent-bg);
  color: var(--color-accent-dark);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-family: var(--font-serif);
  margin-bottom: 0.6rem;
  font-size: 0.95rem;
}

.step h3 {
  margin: 0 0 0.3rem;
  font-size: 1.05rem;
}

.step p {
  margin: 0;
  color: var(--color-muted);
  font-size: 0.92rem;
}

/* ---------- Card grids (homepage, cluster listing) ---------- */

.cluster-section {
  margin-top: 2.75rem;
}

.cluster-section-heading {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  margin-bottom: 1.1rem;
}

.cluster-section-heading h2 {
  margin: 0;
  flex: 1;
}

.cluster-section-heading a {
  font-size: 0.9rem;
  font-weight: 600;
  white-space: nowrap;
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 0.9rem;
}

.card {
  display: block;
  padding: 1.1rem 1.2rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  background: var(--color-bg);
  color: var(--color-text);
  text-decoration: none;
  box-shadow: var(--shadow-sm);
  transition: box-shadow 0.15s ease, border-color 0.15s ease, transform 0.15s ease;
}

.card:hover {
  box-shadow: var(--shadow-md);
  border-color: var(--color-accent);
  transform: translateY(-1px);
  text-decoration: none;
}

.card-title {
  font-weight: 700;
  font-size: 1rem;
  margin-bottom: 0.25rem;
}

.card-meta {
  color: var(--color-muted);
  font-size: 0.85rem;
}

/* ---------- Calculator widget ---------- */

.calculator-widget {
  border: 1px solid var(--color-border);
  border-radius: 14px;
  padding: 1.4rem;
  margin: 1.5rem 0 2rem;
  background: var(--color-bg-soft);
  box-shadow: var(--shadow-sm);
}

.calculator-form {
  display: grid;
  gap: 1rem;
}

@media (min-width: 520px) {
  .calculator-form {
    grid-template-columns: 1fr 1fr;
  }
}

.calculator-field {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  font-size: 0.9rem;
}

.calculator-field-label {
  font-weight: 600;
  color: var(--color-text);
}

.calculator-field input,
.calculator-field select {
  padding: 0.6rem 0.7rem;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  font-size: 1rem;
  font-family: var(--font-sans);
  background: var(--color-bg);
  color: var(--color-text);
}

.calculator-field input:focus,
.calculator-field select:focus {
  outline: 2px solid var(--color-accent);
  outline-offset: 1px;
}

.calculator-results {
  margin-top: 1.4rem;
  border-top: 1px solid var(--color-border);
  padding-top: 1rem;
  display: grid;
  gap: 0.45rem;
}

.calculator-result-row {
  display: flex;
  justify-content: space-between;
  font-size: 0.95rem;
  padding: 0.15rem 0;
  font-variant-numeric: tabular-nums;
}

.calculator-result-emphasized {
  font-family: var(--font-serif);
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--color-accent-dark);
  background: var(--color-accent-bg);
  padding: 0.7rem 0.9rem;
  border-radius: 8px;
  margin-top: 0.4rem;
}

/* ---------- Footer ---------- */

.site-footer {
  border-top: 1px solid var(--color-border);
  background: var(--color-bg-soft);
  margin-top: 3.5rem;
}

.site-footer-inner {
  max-width: var(--max-width-wide);
  margin: 0 auto;
  padding: 2.75rem 1.25rem 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

.footer-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr;
  gap: 2rem;
}

@media (max-width: 640px) {
  .footer-grid {
    grid-template-columns: 1fr;
  }
}

.footer-brand-logo {
  font-family: var(--font-serif);
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--color-text);
}

.footer-brand-tagline {
  color: var(--color-muted);
  font-size: 0.9rem;
  margin-top: 0.4rem;
  max-width: 32ch;
}

.footer-col h4 {
  font-family: var(--font-sans);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--color-muted);
  margin: 0 0 0.85rem;
  font-weight: 700;
}

.footer-col ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.55rem;
}

.footer-col a {
  color: var(--color-text);
  font-size: 0.92rem;
  font-weight: 500;
}

.footer-col a:hover {
  color: var(--color-accent);
}

.footer-bottom {
  border-top: 1px solid var(--color-border);
  padding-top: 1.25rem;
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.5rem;
  font-size: 0.82rem;
  color: var(--color-muted);
}

/* ---------- Cost breakdown chart ---------- */

.cost-chart {
  margin-top: 1.4rem;
  border-top: 1px solid var(--color-border);
  padding-top: 1.1rem;
}

.cost-chart-heading {
  margin: 0 0 0.8rem;
  font-family: var(--font-sans);
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--color-muted);
}

.cost-chart-bar {
  display: flex;
  gap: 2px;
  height: 24px;
  width: 100%;
}

.cost-chart-segment {
  height: 100%;
}

.cost-chart-segment:first-child {
  border-top-left-radius: 4px;
  border-bottom-left-radius: 4px;
}

.cost-chart-segment:last-child {
  border-top-right-radius: 4px;
  border-bottom-right-radius: 4px;
}

.cost-chart-segment-1 {
  background: var(--chart-series-1);
}
.cost-chart-segment-2 {
  background: var(--chart-series-2);
}
.cost-chart-segment-3 {
  background: var(--chart-series-3);
}
.cost-chart-segment-4 {
  background: var(--chart-series-4);
}

.cost-chart-legend {
  list-style: none;
  margin: 0.9rem 0 0;
  padding: 0;
  display: grid;
  gap: 0.45rem;
}

.cost-chart-legend-item {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  font-size: 0.9rem;
}

.cost-chart-swatch {
  width: 12px;
  height: 12px;
  border-radius: 3px;
  flex-shrink: 0;
}

.cost-chart-legend-label {
  color: var(--color-text);
  flex: 1;
}

.cost-chart-legend-value {
  color: var(--color-text);
  font-variant-numeric: tabular-nums;
}

.cost-chart-legend-pct {
  color: var(--color-muted);
}

/* ---------- Table of contents ---------- */

.page-toc {
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  background: var(--color-bg-soft);
  padding: 1rem 1.2rem;
  margin: 1.5rem 0;
}

.page-toc-heading {
  margin: 0 0 0.6rem;
  font-family: var(--font-sans);
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--color-muted);
}

.page-toc ul {
  margin: 0;
  padding: 0;
  list-style: none;
  columns: 2;
  gap: 1.5rem;
}

.page-toc li {
  break-inside: avoid;
  margin-bottom: 0.4rem;
}

.page-toc a {
  font-size: 0.92rem;
  font-weight: 600;
}
