/* ============================================================
   UK Tax & Pay Calculators — Shared Stylesheet
   Clean fintech aesthetic. Mobile-first. WCAG AA contrast.
   ============================================================ */

:root {
  --c-bg: #f7f8fb;
  --c-surface: #ffffff;
  --c-border: #e5e8ef;
  --c-border-strong: #cfd4df;
  --c-text: #0f172a;
  --c-text-muted: #5b6478;
  --c-text-faint: #8a93a6;
  --c-primary: #1f5fff;
  --c-primary-dark: #1547cc;
  --c-primary-50: #eef3ff;
  --c-accent: #00b894;
  --c-warn: #d97706;
  --c-danger: #dc2626;
  --c-success: #059669;

  --radius-sm: 8px;
  --radius: 14px;
  --radius-lg: 20px;

  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.04);
  --shadow: 0 6px 20px rgba(15, 23, 42, 0.06);
  --shadow-lg: 0 20px 60px rgba(15, 23, 42, 0.12);

  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: "SF Mono", ui-monospace, "Cascadia Mono", Menlo, monospace;

  --container: 1100px;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.55;
  color: var(--c-text);
  background: var(--c-bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a { color: var(--c-primary); text-decoration: none; }
a:hover { text-decoration: underline; }

img { max-width: 100%; display: block; }

h1, h2, h3, h4 {
  margin: 0 0 0.5em;
  line-height: 1.2;
  color: var(--c-text);
  letter-spacing: -0.01em;
}

h1 { font-size: clamp(1.85rem, 4vw, 2.6rem); font-weight: 700; }
h2 { font-size: clamp(1.4rem, 3vw, 1.85rem); font-weight: 700; }
h3 { font-size: 1.15rem; font-weight: 600; }

p { margin: 0 0 1em; color: var(--c-text); }

.muted { color: var(--c-text-muted); }
.faint { color: var(--c-text-faint); font-size: 0.9em; }

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

/* ---------- Header / Nav ---------- */
.site-header {
  background: var(--c-surface);
  border-bottom: 1px solid var(--c-border);
  position: sticky;
  top: 0;
  z-index: 50;
  backdrop-filter: saturate(150%) blur(8px);
}

.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  max-width: var(--container);
  margin: 0 auto;
  gap: 16px;
}

.logo {
  font-weight: 800;
  font-size: 1.05rem;
  letter-spacing: -0.02em;
  color: var(--c-text);
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.logo:hover { text-decoration: none; }
.logo .dot {
  width: 12px; height: 12px; border-radius: 4px;
  background: linear-gradient(135deg, var(--c-primary), var(--c-accent));
}

.nav-links {
  display: flex;
  gap: 6px;
  list-style: none;
  margin: 0; padding: 0;
  flex-wrap: wrap;
}
.nav-links a {
  display: inline-block;
  padding: 8px 12px;
  border-radius: 8px;
  color: var(--c-text-muted);
  font-weight: 500;
  font-size: 0.95rem;
}
.nav-links a:hover { background: var(--c-primary-50); color: var(--c-primary); text-decoration: none; }
.nav-links a.active { color: var(--c-primary); background: var(--c-primary-50); }

.nav-toggle {
  display: none;
  background: none; border: 1px solid var(--c-border-strong);
  border-radius: 8px;
  padding: 8px 10px;
  cursor: pointer;
  color: var(--c-text);
  font-weight: 500;
}

@media (max-width: 760px) {
  .nav-toggle { display: inline-flex; }
  .nav-links { display: none; width: 100%; flex-direction: column; gap: 2px; padding: 8px 0; }
  .nav-links.open { display: flex; }
  .nav { flex-wrap: wrap; }
}

/* ---------- Hero ---------- */
.hero {
  padding: 56px 0 28px;
  text-align: center;
}
.hero h1 { margin-bottom: 14px; }
.hero p.lede {
  font-size: 1.1rem;
  color: var(--c-text-muted);
  max-width: 640px;
  margin: 0 auto 24px;
}

.badge {
  display: inline-block;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  background: var(--c-primary-50);
  color: var(--c-primary);
  padding: 6px 12px;
  border-radius: 999px;
  margin-bottom: 14px;
}

/* ---------- Cards / Layout ---------- */
.card {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--radius-lg);
  padding: 28px;
  box-shadow: var(--shadow-sm);
}

.calc-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr);
  gap: 24px;
  align-items: flex-start;
  margin: 24px 0 48px;
}
@media (max-width: 860px) {
  .calc-grid { grid-template-columns: 1fr; }
}

.results {
  position: sticky;
  top: 80px;
}

/* Cards-of-cards on hub page */
.tools-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 18px;
  margin: 32px 0;
}
.tool-card {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
  padding: 22px;
  transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease;
  display: flex;
  flex-direction: column;
  gap: 8px;
  text-decoration: none;
  color: inherit;
}
.tool-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow);
  border-color: var(--c-border-strong);
  text-decoration: none;
}
.tool-card .icon {
  width: 38px; height: 38px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--c-primary-50), #e6f7f1);
  display: flex; align-items: center; justify-content: center;
  font-size: 20px;
  margin-bottom: 6px;
}
.tool-card h3 { margin: 0; }
.tool-card p { color: var(--c-text-muted); font-size: 0.94rem; margin: 0; }
.tool-card .arrow { color: var(--c-primary); font-weight: 600; margin-top: 8px; font-size: 0.92rem; }

/* ---------- Forms ---------- */
.field {
  display: block;
  margin-bottom: 18px;
}
.field label {
  display: block;
  font-weight: 600;
  font-size: 0.92rem;
  color: var(--c-text);
  margin-bottom: 6px;
}
.field .hint {
  display: block;
  font-size: 0.82rem;
  color: var(--c-text-muted);
  margin-top: 4px;
}

.input, select.input, .input-group input {
  width: 100%;
  padding: 12px 14px;
  font-size: 1rem;
  font-family: inherit;
  color: var(--c-text);
  background: var(--c-surface);
  border: 1px solid var(--c-border-strong);
  border-radius: var(--radius-sm);
  transition: border-color .15s, box-shadow .15s;
}
.input:focus, select.input:focus, .input-group input:focus {
  outline: none;
  border-color: var(--c-primary);
  box-shadow: 0 0 0 3px rgba(31, 95, 255, 0.15);
}

.input-group {
  display: flex;
  align-items: stretch;
  border: 1px solid var(--c-border-strong);
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--c-surface);
  transition: border-color .15s, box-shadow .15s;
}
.input-group:focus-within {
  border-color: var(--c-primary);
  box-shadow: 0 0 0 3px rgba(31, 95, 255, 0.15);
}
.input-group .prefix, .input-group .suffix {
  padding: 12px 14px;
  background: #f1f3f8;
  color: var(--c-text-muted);
  font-weight: 600;
  display: flex; align-items: center;
  border-right: 1px solid var(--c-border);
}
.input-group .suffix { border-right: none; border-left: 1px solid var(--c-border); }
.input-group input {
  border: none;
  border-radius: 0;
  flex: 1;
  min-width: 0;
}
.input-group input:focus { box-shadow: none; }

.row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}
@media (max-width: 480px) { .row { grid-template-columns: 1fr; } }

.checkbox, .radio-group {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.95rem;
}
.checkbox input { width: 16px; height: 16px; }

.tabs {
  display: inline-flex;
  background: #f1f3f8;
  padding: 4px;
  border-radius: 10px;
  margin-bottom: 18px;
  flex-wrap: wrap;
}
.tabs button {
  background: transparent;
  border: none;
  padding: 8px 14px;
  font-size: 0.92rem;
  font-weight: 600;
  border-radius: 8px;
  cursor: pointer;
  color: var(--c-text-muted);
}
.tabs button.active {
  background: var(--c-surface);
  color: var(--c-text);
  box-shadow: var(--shadow-sm);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 12px 20px;
  font-size: 1rem;
  font-weight: 600;
  border-radius: 10px;
  border: 1px solid transparent;
  cursor: pointer;
  font-family: inherit;
  transition: background .15s, transform .05s;
}
.btn-primary { background: var(--c-primary); color: #fff; }
.btn-primary:hover { background: var(--c-primary-dark); text-decoration: none; }
.btn-primary:active { transform: translateY(1px); }
.btn-secondary { background: var(--c-surface); color: var(--c-text); border-color: var(--c-border-strong); }
.btn-secondary:hover { background: #f1f3f8; text-decoration: none; }

/* ---------- Results panel ---------- */
.result-headline {
  text-align: center;
  padding: 14px 0 8px;
  border-bottom: 1px dashed var(--c-border);
  margin-bottom: 18px;
}
.result-headline .label {
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--c-text-muted);
  font-weight: 600;
}
.result-headline .value {
  font-size: clamp(2rem, 5vw, 2.6rem);
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--c-text);
  margin: 4px 0 2px;
  font-variant-numeric: tabular-nums;
}
.result-headline .sub { color: var(--c-text-muted); font-size: 0.92rem; }

.breakdown { width: 100%; border-collapse: collapse; }
.breakdown th, .breakdown td {
  padding: 10px 4px;
  text-align: right;
  font-variant-numeric: tabular-nums;
  border-bottom: 1px solid var(--c-border);
  font-size: 0.95rem;
}
.breakdown th:first-child, .breakdown td:first-child { text-align: left; font-weight: 500; }
.breakdown th {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--c-text-muted);
  font-weight: 600;
  border-bottom: 2px solid var(--c-border);
}
.breakdown tr.total td {
  font-weight: 700;
  border-top: 2px solid var(--c-border);
  border-bottom: none;
  padding-top: 14px;
}
.breakdown tr.deduction td:not(:first-child) { color: var(--c-danger); }
.breakdown tr.income td:not(:first-child) { color: var(--c-success); }

.bar-stack {
  display: flex;
  height: 14px;
  border-radius: 999px;
  overflow: hidden;
  background: #f1f3f8;
  margin: 14px 0 8px;
}
.bar-stack .seg { height: 100%; }
.legend { display: flex; flex-wrap: wrap; gap: 10px 16px; font-size: 0.85rem; }
.legend .swatch { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: middle; }

/* ---------- Educational content ---------- */
.prose { max-width: 720px; }
.prose h2 { margin-top: 36px; }
.prose h3 { margin-top: 24px; }
.prose ul { padding-left: 22px; }
.prose li { margin-bottom: 6px; }
.prose table { border-collapse: collapse; width: 100%; margin: 12px 0 18px; font-size: 0.95rem; }
.prose th, .prose td { padding: 10px 12px; border-bottom: 1px solid var(--c-border); text-align: left; }
.prose th { background: #f7f8fb; font-weight: 600; }

.faq details {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
  margin-bottom: 10px;
  overflow: hidden;
}
.faq summary {
  cursor: pointer;
  padding: 16px 20px;
  font-weight: 600;
  list-style: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.faq summary::after { content: "+"; font-weight: 400; font-size: 1.4rem; color: var(--c-text-muted); }
.faq details[open] summary::after { content: "–"; }
.faq details[open] summary { border-bottom: 1px solid var(--c-border); }
.faq .answer { padding: 14px 20px 18px; color: var(--c-text-muted); }
.faq .answer p:last-child { margin-bottom: 0; }

/* ---------- Ad slots ---------- */
.ad-slot {
  margin: 28px auto;
  padding: 18px;
  text-align: center;
  background: #f1f3f8;
  border: 1px dashed var(--c-border-strong);
  border-radius: var(--radius);
  color: var(--c-text-faint);
  font-size: 0.85rem;
  min-height: 90px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.ad-slot.in-content { margin: 32px 0; }

/* ---------- Footer ---------- */
.site-footer {
  background: #0f172a;
  color: #cbd5e1;
  padding: 48px 0 28px;
  margin-top: 64px;
}
.site-footer a { color: #cbd5e1; }
.site-footer a:hover { color: #ffffff; }
.footer-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 28px;
  margin-bottom: 32px;
}
.footer-grid h4 { color: #fff; font-size: 0.95rem; text-transform: uppercase; letter-spacing: 0.06em; margin-bottom: 12px; }
.footer-grid ul { list-style: none; padding: 0; margin: 0; }
.footer-grid li { margin-bottom: 6px; font-size: 0.92rem; }
.footer-bottom {
  border-top: 1px solid #1e293b;
  padding-top: 18px;
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  font-size: 0.85rem;
  color: #94a3b8;
}

/* ---------- Misc ---------- */
.disclaimer {
  background: #fff8e6;
  border: 1px solid #f6e0a3;
  color: #6a4f00;
  padding: 12px 14px;
  border-radius: 10px;
  font-size: 0.88rem;
  margin: 18px 0;
}

.tag {
  display: inline-block;
  font-size: 0.74rem;
  font-weight: 600;
  background: #eef3ff;
  color: var(--c-primary);
  padding: 3px 8px;
  border-radius: 999px;
  letter-spacing: 0.02em;
}
.tag.green { background: #e6f7f1; color: var(--c-success); }
.tag.amber { background: #fff4dc; color: #b46a00; }

.quick-links {
  display: flex; flex-wrap: wrap; gap: 8px;
  margin: 14px 0 28px;
}
.quick-links a {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  padding: 8px 12px;
  border-radius: 999px;
  font-size: 0.88rem;
  color: var(--c-text);
}
.quick-links a:hover { background: var(--c-primary-50); color: var(--c-primary); border-color: var(--c-primary-50); text-decoration: none; }

@media print {
  .site-header, .site-footer, .ad-slot, .nav, .nav-toggle, #psc-consent { display: none !important; }
  .card { box-shadow: none; border: 1px solid #ddd; }
}

/* ---------- Cookie consent banner ---------- */
#psc-consent {
  position: fixed;
  left: 16px; right: 16px; bottom: 16px;
  z-index: 9999;
  background: #ffffff;
  color: var(--c-text);
  border: 1px solid var(--c-border-strong);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  padding: 16px 18px;
  font-size: .92rem;
}
#psc-consent .psc-consent-inner {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 16px;
  max-width: var(--container);
  margin: 0 auto;
}
#psc-consent .psc-consent-text {
  flex: 1;
  line-height: 1.45;
}
#psc-consent .psc-consent-actions {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}
#psc-consent .psc-btn {
  padding: 9px 14px;
  font-size: .92rem;
  font-weight: 600;
  border-radius: 8px;
  border: 1px solid transparent;
  cursor: pointer;
  font-family: inherit;
  white-space: nowrap;
}
#psc-consent .psc-btn-primary { background: var(--c-primary); color: #fff; }
#psc-consent .psc-btn-primary:hover { background: var(--c-primary-dark); }
#psc-consent .psc-btn-secondary {
  background: #fff; color: var(--c-text); border-color: var(--c-border-strong);
}
#psc-consent .psc-btn-secondary:hover { background: #f1f3f8; }
@media (max-width: 640px) {
  #psc-consent .psc-consent-inner { flex-direction: column; align-items: stretch; }
  #psc-consent .psc-consent-actions { justify-content: stretch; }
  #psc-consent .psc-btn { flex: 1; }
}

/* ---------- Editorial review stamp ---------- */
.review-stamp {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: .82rem;
  color: var(--c-text-muted);
  background: #f1f3f8;
  border-radius: 999px;
  padding: 6px 12px;
  margin: 12px 0 0;
}
.review-stamp::before {
  content: "✓";
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px; height: 16px;
  border-radius: 50%;
  background: var(--c-success);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
}
