/* ---------- Design tokens ---------- */
:root {
  --color-primary: #0b5f6b;
  --color-primary-dark: #08444d;
  --color-accent: #1fb6a4;
  --color-accent-light: #e6f7f5;
  --color-ink: #12202b;
  --color-ink-soft: #4a5b66;
  --color-bg: #f5f8f9;
  --color-surface: #ffffff;
  --color-border: #e1e8ea;
  --color-danger: #c4453d;
  --color-success: #1a8f5e;

  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --shadow-sm: 0 1px 3px rgba(18, 32, 43, 0.08);
  --shadow-md: 0 8px 24px rgba(18, 32, 43, 0.1);
  --container-width: 1180px;
}

/* ---------- Reset ---------- */
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--font-sans);
  color: var(--color-ink);
  background: var(--color-bg);
  line-height: 1.55;
}
img { max-width: 100%; display: block; }
a { color: var(--color-primary); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { line-height: 1.2; margin: 0 0 0.5em; }
p { margin: 0 0 1em; }
ul { margin: 0 0 1em; padding-left: 1.25em; }
button { font-family: inherit; }

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

.visually-hidden {
  position: absolute;
  width: 1px; height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}

/* ---------- Header / Nav ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
}
.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
}
.nav-brand {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  font-size: 1.15rem;
  color: var(--color-ink);
}
.nav-brand img { width: 28px; height: 28px; }
.nav-toggle {
  display: none;
  background: none;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  cursor: pointer;
}
.nav-menu {
  display: flex;
  align-items: center;
  gap: 22px;
}
.nav-menu a {
  color: var(--color-ink-soft);
  font-weight: 600;
  font-size: 0.95rem;
}
.nav-menu a[aria-current="page"],
.nav-menu a:hover { color: var(--color-primary); }
.nav-dropdown { position: relative; }
.nav-dropdown-panel {
  display: none;
  position: absolute;
  top: calc(100% + 12px);
  left: 0;
  min-width: 240px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
  padding: 8px;
}
.nav-dropdown:hover .nav-dropdown-panel,
.nav-dropdown:focus-within .nav-dropdown-panel { display: block; }
.nav-dropdown-panel a {
  display: block;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  color: var(--color-ink);
  font-weight: 500;
}
.nav-dropdown-panel a:hover { background: var(--color-accent-light); text-decoration: none; }

@media (max-width: 860px) {
  .nav-toggle { display: inline-flex; }
  .nav-menu {
    display: none;
    position: absolute;
    top: 100%; left: 0; right: 0;
    flex-direction: column;
    align-items: stretch;
    background: var(--color-surface);
    border-bottom: 1px solid var(--color-border);
    padding: 10px 20px 18px;
    gap: 6px;
  }
  .nav-menu.is-open { display: flex; }
  .nav-dropdown-panel { position: static; box-shadow: none; display: block; border: none; padding-left: 10px; }
}

/* ---------- Hero ---------- */
.hero {
  background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-primary-dark) 100%);
  color: #fff;
  padding: 56px 0 64px;
}
.hero h1 { font-size: clamp(1.8rem, 3.4vw, 2.6rem); }
.hero p.lead { font-size: 1.1rem; color: #d7ece9; max-width: 640px; }
.hero-badge {
  display: inline-block;
  background: rgba(255,255,255,0.15);
  border-radius: 999px;
  padding: 4px 14px;
  font-size: 0.8rem;
  font-weight: 600;
  margin-bottom: 14px;
}

/* ---------- Cards ---------- */
.card-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  margin: -32px 0 40px;
}
@media (max-width: 860px) { .card-grid { grid-template-columns: 1fr; margin-top: 24px; } }

.calc-card {
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.calc-card .icon {
  width: 44px; height: 44px;
  border-radius: var(--radius-sm);
  background: var(--color-accent-light);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.4rem;
}
.calc-card h3 { font-size: 1.15rem; margin-bottom: 2px; }
.calc-card p { color: var(--color-ink-soft); font-size: 0.95rem; margin-bottom: 4px; }
.calc-card .btn { margin-top: auto; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border-radius: var(--radius-sm);
  padding: 10px 18px;
  font-weight: 600;
  font-size: 0.95rem;
  border: 1px solid transparent;
  cursor: pointer;
  text-decoration: none;
}
.btn-primary { background: var(--color-accent); color: #fff; }
.btn-primary:hover { background: #17a190; text-decoration: none; }
.btn-outline { background: transparent; border-color: var(--color-border); color: var(--color-ink); }
.btn-outline:hover { border-color: var(--color-primary); color: var(--color-primary); text-decoration: none; }

/* ---------- Section layout ---------- */
.section { padding: 48px 0; }
.section-title { font-size: 1.6rem; margin-bottom: 8px; }
.section-sub { color: var(--color-ink-soft); max-width: 680px; }

/* ---------- Calculator layout ---------- */
.calc-page-hero {
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
  padding: 34px 0;
}
.calc-page-hero h1 { font-size: clamp(1.5rem, 2.6vw, 2.1rem); }
.calc-page-hero p { color: var(--color-ink-soft); max-width: 700px; margin-bottom: 0; }

.calc-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr);
  gap: 28px;
  align-items: start;
  padding: 32px 0;
}
@media (max-width: 960px) {
  .calc-layout { grid-template-columns: 1fr; }
}

.panel {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 24px;
}
.panel + .panel { margin-top: 20px; }
.panel h2 { font-size: 1.2rem; }
.results-panel { position: sticky; top: 90px; }
@media (max-width: 960px) { .results-panel { position: static; } }

/* ---------- Forms ---------- */
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
.form-grid .field-full { grid-column: 1 / -1; }
@media (max-width: 560px) { .form-grid { grid-template-columns: 1fr; } }

.field label {
  display: block;
  font-weight: 600;
  font-size: 0.88rem;
  margin-bottom: 6px;
  color: var(--color-ink);
}
.field .hint { font-size: 0.78rem; color: var(--color-ink-soft); margin-top: 4px; }
.field input[type="text"],
.field input[type="number"],
.field select {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  font-size: 0.98rem;
  background: #fff;
  color: var(--color-ink);
}
.field input:focus, .field select:focus {
  outline: 2px solid var(--color-accent);
  outline-offset: 1px;
}

.toggle-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 0;
}
.toggle-row label { font-weight: 500; font-size: 0.92rem; margin: 0; }
.toggle-row input[type="checkbox"] { width: 18px; height: 18px; accent-color: var(--color-accent); }

.pension-input-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
}

/* ---------- Results ---------- */
.take-home-figure {
  text-align: center;
  padding: 6px 0 18px;
  border-bottom: 1px solid var(--color-border);
  margin-bottom: 18px;
}
.take-home-figure .amount {
  font-size: 2.4rem;
  font-weight: 800;
  color: var(--color-primary);
  display: block;
}
.take-home-figure .label { color: var(--color-ink-soft); font-size: 0.9rem; }

.freq-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 16px;
}
.freq-tabs button {
  border: 1px solid var(--color-border);
  background: #fff;
  border-radius: 999px;
  padding: 6px 13px;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--color-ink-soft);
  cursor: pointer;
}
.freq-tabs button[aria-pressed="true"] {
  background: var(--color-primary);
  border-color: var(--color-primary);
  color: #fff;
}

.breakdown-table { width: 100%; border-collapse: collapse; font-size: 0.92rem; }
.breakdown-table th, .breakdown-table td { text-align: left; padding: 9px 6px; border-bottom: 1px solid var(--color-border); }
.breakdown-table th { color: var(--color-ink-soft); font-weight: 600; font-size: 0.82rem; text-transform: uppercase; letter-spacing: 0.02em; }
.breakdown-table td.num, .breakdown-table th.num { text-align: right; font-variant-numeric: tabular-nums; }
.breakdown-table tr.total td { font-weight: 700; border-top: 2px solid var(--color-ink); border-bottom: none; }
.breakdown-table tr.highlight td { color: var(--color-success); font-weight: 700; }

.bar-chart { margin: 18px 0 4px; }
.bar-chart-track {
  display: flex;
  width: 100%;
  height: 14px;
  border-radius: 999px;
  overflow: hidden;
  background: var(--color-border);
}
.bar-chart-segment { height: 100%; }
.bar-chart-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  margin-top: 10px;
  font-size: 0.82rem;
  color: var(--color-ink-soft);
}
.bar-chart-legend .swatch {
  display: inline-block;
  width: 10px; height: 10px;
  border-radius: 50%;
  margin-right: 6px;
}
.seg-tax { background: #e0663f; }
.seg-ni { background: #f2a93b; }
.seg-loan { background: #6b7fd7; }
.seg-pension { background: #9b7fd4; }
.seg-take-home { background: var(--color-accent); }

/* ---------- Ad slots ---------- */
.ad-slot {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 90px;
  background: repeating-linear-gradient(45deg, #eef2f3, #eef2f3 10px, #e6ecee 10px, #e6ecee 20px);
  border: 1px dashed var(--color-border);
  border-radius: var(--radius-md);
  color: var(--color-ink-soft);
  font-size: 0.8rem;
  margin: 28px 0;
}

/* ---------- Content / FAQ ---------- */
.content-block { max-width: 780px; }
.rates-table { width: 100%; border-collapse: collapse; margin: 16px 0; font-size: 0.92rem; }
.rates-table th, .rates-table td { padding: 8px 10px; border: 1px solid var(--color-border); text-align: left; }
.rates-table th { background: var(--color-accent-light); }

.faq-item {
  border-bottom: 1px solid var(--color-border);
  padding: 16px 0;
}
.faq-item h3 { font-size: 1.02rem; margin-bottom: 6px; }
.faq-item p { color: var(--color-ink-soft); margin-bottom: 0; }

/* ---------- Footer ---------- */
.site-footer {
  background: var(--color-primary-dark);
  color: #cfe6e3;
  padding: 40px 0 24px;
  margin-top: 40px;
}
.footer-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr;
  gap: 24px;
}
@media (max-width: 700px) { .footer-grid { grid-template-columns: 1fr; } }
.site-footer h4 { color: #fff; font-size: 0.95rem; }
.site-footer a { color: #cfe6e3; }
.site-footer ul { list-style: none; padding: 0; }
.site-footer li { margin-bottom: 6px; font-size: 0.9rem; }
.footer-bottom {
  border-top: 1px solid rgba(255,255,255,0.15);
  margin-top: 28px;
  padding-top: 18px;
  font-size: 0.82rem;
  color: #9fc3bf;
}
.disclaimer-note {
  font-size: 0.8rem;
  color: var(--color-ink-soft);
  background: var(--color-accent-light);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  margin-top: 16px;
}

/* ---------- Cookie banner ---------- */
.cookie-banner {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  background: var(--color-ink);
  color: #fff;
  padding: 16px 20px;
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  align-items: center;
  justify-content: space-between;
  z-index: 100;
}
.cookie-banner p { margin: 0; font-size: 0.85rem; max-width: 640px; }
.cookie-banner .btn-primary { flex-shrink: 0; }

/* ---------- Static content pages ---------- */
.prose { max-width: 760px; }
.prose h2 { margin-top: 32px; }
