/* ==========================================================================
   UK Take Home Calculator - shared stylesheet
   Replaces the Tailwind Play CDN (dev-only, causes FOUC + poor CWV).
   Implements only the utility subset actually used by the guides/legals pages,
   plus the shared design tokens used by the hand-written calculator pages.
   ========================================================================== */

:root {
  --bg: #f0f6ff;
  --card: #ffffff;
  --primary: #1d6bee;
  --primary-light: #ebf3ff;
  --green: #00b87a;
  --green-light: #eafbf4;
  --red: #f43f5e;
  --red-light: #fff1f3;
  --amber: #f59e0b;
  --amber-light: #fffbeb;
  --purple: #8b5cf6;
  --purple-light: #f5f3ff;
  --teal: #06b6d4;
  --text: #0d1b36;
  --text-muted: #64748b;
  --text-light: #94a3b8;
  --border: #e2ebfb;
  --shadow: 0 2px 16px rgba(29, 107, 238, 0.08);
  --shadow-hover: 0 4px 24px rgba(29, 107, 238, 0.14);
  --radius: 16px;
  --radius-sm: 10px;
  --radius-xs: 6px;

  --indigo-600: #4f46e5;
  --indigo-700: #4338ca;
  --slate-50: #f8fafc;
  --slate-100: #f1f5f9;
  --slate-200: #e2e8f0;
  --slate-300: #cbd5e1;
  --slate-400: #94a3b8;
  --slate-500: #64748b;
  --slate-600: #475569;
  --slate-700: #334155;
  --slate-800: #1e293b;
  --slate-900: #0f172a;
}

*,
*::before,
*::after { box-sizing: border-box; }

* { margin: 0; padding: 0; }

html {
  font-size: 16px;
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: 'Manrope', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', sans-serif;
  background: #ffffff;
  color: var(--text);
  min-height: 100vh;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

img, svg { display: block; max-width: 100%; }
svg { fill: none; }

/* ---------- Shared site chrome (hand-written pages) ---------- */

.header {
  background: var(--card);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
  padding: 0 24px;
}
.header-inner {
  max-width: 1280px;
  margin: auto;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: 'Space Grotesk', ui-sans-serif, system-ui, sans-serif;
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--text);
  text-decoration: none;
}
.logo-icon {
  width: 36px;
  height: 36px;
  background: linear-gradient(135deg, var(--primary), #4facfe);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 18px;
  flex-shrink: 0;
}
.logo-sub {
  font-size: 0.7rem;
  font-weight: 500;
  color: var(--text-muted);
  display: block;
  line-height: 1;
}
.header-right { display: flex; align-items: center; gap: 12px; }
.nav-link {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-muted);
  text-decoration: none;
  padding: 6px 12px;
  border-radius: 8px;
  transition: 0.2s;
}
.nav-link:hover { color: var(--primary); background: var(--primary-light); }

.article-main {
  max-width: 1100px;
  margin: 0 auto;
  padding: 32px 24px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: 32px;
  align-items: start;
}
.article-main > .content { min-width: 0; }
@media (max-width: 900px) {
  .article-main { grid-template-columns: 1fr; gap: 24px; padding: 20px 16px; }
}

.hero-card {
  background: linear-gradient(135deg, #1d6bee 0%, #1a56dc 40%, #0e43c8 100%);
  border-radius: var(--radius);
  padding: 40px 32px;
  color: #fff;
  position: relative;
  overflow: hidden;
  box-shadow: 0 8px 32px rgba(29, 107, 238, 0.25);
  margin-bottom: 28px;
}
.hero-card::before {
  content: '';
  position: absolute;
  top: -50px;
  right: -30px;
  width: 220px;
  height: 220px;
  background: rgba(255, 255, 255, 0.06);
  border-radius: 50%;
}
.hero-label {
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  opacity: 0.7;
  margin-bottom: 8px;
}
.hero-title {
  font-family: 'Space Grotesk', ui-sans-serif, system-ui, sans-serif;
  font-size: 2.2rem;
  font-weight: 700;
  line-height: 1.2;
  margin-bottom: 12px;
}
.hero-text { font-size: 1rem; opacity: 0.85; max-width: 680px; }

.section-card {
  background: var(--card);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  padding: 28px;
  margin-bottom: 20px;
  transition: 0.2s;
}
.section-card:hover { box-shadow: var(--shadow-hover); }
.card-title {
  font-family: 'Space Grotesk', ui-sans-serif, system-ui, sans-serif;
  font-size: 1.15rem;
  font-weight: 700;
  margin-bottom: 14px;
  color: var(--text);
}
.card-lead { font-size: 0.95rem; color: var(--text-muted); margin-bottom: 18px; }

.data-table {
  width: 100%;
  border-collapse: collapse;
  margin: 14px 0;
  font-size: 0.88rem;
}
.data-table th {
  background: var(--primary-light);
  color: var(--primary);
  text-align: left;
  padding: 10px 12px;
  font-weight: 700;
  border-bottom: 2px solid var(--border);
}
.data-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  color: var(--text);
}
.data-table tr:hover { background: #ffffff; }

.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 0.72rem;
  font-weight: 700;
}
.badge-blue { background: var(--primary-light); color: var(--primary); }
.badge-amber { background: var(--amber-light); color: #92400e; }
.badge-red { background: var(--red-light); color: var(--red); }
.badge-purple { background: var(--purple-light); color: var(--purple); }

.tips-card {
  background: linear-gradient(135deg, #fffbeb, #fef9e7);
  border: 1px solid #fcd34d;
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 20px;
  box-shadow: 0 2px 12px rgba(245, 158, 11, 0.08);
}
.tips-title {
  font-size: 0.8rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: #92400e;
  margin-bottom: 12px;
}
.tip-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 9px;
  font-size: 0.88rem;
  color: #78350f;
  line-height: 1.5;
}
.tip-icon { font-size: 1.1rem; flex-shrink: 0; }

.sidebar { display: flex; flex-direction: column; gap: 16px; margin-top: 0; position: sticky; top: 88px; }
.toc-card {
  background: var(--card);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  padding: 20px;
  box-shadow: var(--shadow);
}
.toc-title {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-muted);
  letter-spacing: 0.08em;
  margin-bottom: 12px;
}
.toc-list { list-style: none; }
.toc-list li { margin-bottom: 8px; }
.toc-list a {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.85rem;
  font-weight: 600;
  display: block;
  padding: 4px 0 4px 10px;
  border-left: 3px solid transparent;
  transition: 0.2s;
}
.toc-list a:hover { color: var(--primary); border-left-color: var(--primary); }

.cta-card {
  background: linear-gradient(135deg, var(--primary-light), #fff);
  border: 2px solid var(--primary);
  border-radius: var(--radius);
  padding: 20px;
  text-align: center;
}
.cta-btn {
  display: inline-block;
  margin-top: 10px;
  background: var(--primary);
  color: #fff;
  text-decoration: none;
  padding: 10px 20px;
  border-radius: 8px;
  font-weight: 700;
  font-size: 0.85rem;
  transition: 0.2s;
}
.cta-btn:hover { background: #1557d4; transform: translateY(-1px); }

footer {
  border-top: 1px solid var(--border);
  background: var(--card);
  padding: 28px 24px;
  margin-top: 32px;
}
.footer-inner {
  max-width: 1280px;
  margin: auto;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}
.footer-disclaimer {
  font-size: 0.75rem;
  color: var(--text-muted);
  max-width: 600px;
  line-height: 1.7;
}
.footer-disclaimer strong { color: var(--text); }
.footer-links { display: flex; gap: 16px; flex-wrap: wrap; }
.footer-link {
  font-size: 0.78rem;
  color: var(--text-muted);
  text-decoration: none;
  font-weight: 600;
}
.footer-link:hover { color: var(--primary); }

/* ---------- Utility subset (replaces Tailwind Play CDN) ---------- */

.antialiased { -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }
.content-max { max-width: 1100px; }

.block { display: block; }
.inline-block { display: inline-block; }
.flex { display: flex; }
.inline-flex { display: inline-flex; }
.grid { display: grid; }
.hidden { display: none; }

.flex-col { flex-direction: column; }
.flex-wrap { flex-wrap: wrap; }
.flex-shrink-0 { flex-shrink: 0; }
.items-start { align-items: flex-start; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.justify-center { justify-content: center; }

.grid-cols-1 { grid-template-columns: repeat(1, minmax(0, 1fr)); }
.grid-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }

.gap-2 { gap: 0.5rem; }
.gap-3 { gap: 0.75rem; }
.gap-4 { gap: 1rem; }
.gap-6 { gap: 1.5rem; }
.gap-8 { gap: 2rem; }

.w-full { width: 100%; }
.w-4 { width: 1rem; }
.w-5 { width: 1.25rem; }
.w-10 { width: 2.5rem; }
.h-4 { height: 1rem; }
.h-5 { height: 1.25rem; }
.h-10 { height: 2.5rem; }
.max-w-2xl { max-width: 42rem; }
.max-w-3xl { max-width: 48rem; }
.max-w-none { max-width: none; }

.mx-auto { margin-left: auto; margin-right: auto; }
.mb-2 { margin-bottom: 0.5rem; }
.mb-3 { margin-bottom: 0.75rem; }
.mb-4 { margin-bottom: 1rem; }
.mb-6 { margin-bottom: 1.5rem; }
.mb-8 { margin-bottom: 2rem; }
.mb-10 { margin-bottom: 2.5rem; }
.mb-16 { margin-bottom: 4rem; }
.mt-2 { margin-top: 0.5rem; }
.mt-4 { margin-top: 1rem; }
.mt-6 { margin-top: 1.5rem; }
.mt-8 { margin-top: 2rem; }
.mt-10 { margin-top: 2.5rem; }
.mt-12 { margin-top: 3rem; }

.p-4 { padding: 1rem; }
.p-6 { padding: 1.5rem; }
.p-8 { padding: 2rem; }
.px-2 { padding-left: 0.5rem; padding-right: 0.5rem; }
.px-4 { padding-left: 1rem; padding-right: 1rem; }
.px-6 { padding-left: 1.5rem; padding-right: 1.5rem; }
.py-1 { padding-top: 0.25rem; padding-bottom: 0.25rem; }
.py-2 { padding-top: 0.5rem; padding-bottom: 0.5rem; }
.py-4 { padding-top: 1rem; padding-bottom: 1rem; }
.py-8 { padding-top: 2rem; padding-bottom: 2rem; }
.py-10 { padding-top: 2.5rem; padding-bottom: 2.5rem; }
.py-12 { padding-top: 3rem; padding-bottom: 3rem; }
.pt-6 { padding-top: 1.5rem; }
.pb-6 { padding-bottom: 1.5rem; }

.text-\[10px\] { font-size: 10px; }
.text-xs { font-size: 0.75rem; line-height: 1rem; }
.text-sm { font-size: 0.875rem; line-height: 1.25rem; }
.text-base { font-size: 1rem; line-height: 1.5rem; }
.text-lg { font-size: 1.125rem; line-height: 1.75rem; }
.text-xl { font-size: 1.25rem; line-height: 1.75rem; }
.text-2xl { font-size: 1.5rem; line-height: 2rem; }
.text-3xl { font-size: 1.875rem; line-height: 2.25rem; }
.text-4xl { font-size: 2.25rem; line-height: 2.5rem; }

.font-medium { font-weight: 500; }
.font-semibold { font-weight: 600; }
.font-bold { font-weight: 700; }
.font-extrabold { font-weight: 800; }
.uppercase { text-transform: uppercase; }
.tracking-wider { letter-spacing: 0.05em; }
.tracking-tight { letter-spacing: -0.025em; }
.leading-relaxed { line-height: 1.625; }
.text-center { text-align: center; }
.underline { text-decoration: underline; }
.list-disc { list-style-type: disc; }
.list-decimal { list-style-type: decimal; }
.list-inside { list-style-position: inside; }
.space-y-2 > * + * { margin-top: 0.5rem; }
.space-y-3 > * + * { margin-top: 0.75rem; }
.space-y-4 > * + * { margin-top: 1rem; }
.space-y-6 > * + * { margin-top: 1.5rem; }

.text-white { color: #fff; }
.text-slate-400 { color: var(--slate-400); }
.text-slate-500 { color: var(--slate-500); }
.text-slate-600 { color: var(--slate-600); }
.text-slate-700 { color: var(--slate-700); }
.text-slate-800 { color: var(--slate-800); }
.text-slate-900 { color: var(--slate-900); }
.text-indigo-600 { color: var(--indigo-600); }
.text-blue-600 { color: #2563eb; }
.text-emerald-600 { color: #059669; }
.text-amber-600 { color: #d97706; }
.text-rose-600 { color: #e11d48; }

.bg-white { background-color: #fff; }
.bg-slate-50 { background-color: var(--slate-50); }
.bg-slate-100 { background-color: var(--slate-100); }
.bg-slate-900 { background-color: var(--slate-900); }
.bg-indigo-50 { background-color: #eef2ff; }
.bg-indigo-600 { background-color: var(--indigo-600); }
.bg-blue-50 { background-color: #eff6ff; }
.bg-emerald-50 { background-color: #ecfdf5; }
.bg-amber-50 { background-color: #fffbeb; }
.bg-rose-50 { background-color: #fff1f2; }

.bg-gradient-to-br {
  background-image: linear-gradient(to bottom right, var(--tw-from, transparent), var(--tw-to, transparent));
}
.from-indigo-600 { --tw-from: var(--indigo-600); }
.to-sky-400 { --tw-to: #38bdf8; }

.border { border: 1px solid var(--slate-200); }
.border-b { border-bottom: 1px solid var(--slate-200); }
.border-t { border-top: 1px solid var(--slate-200); }
.border-l-4 { border-left: 4px solid var(--slate-200); }
.border-slate-200 { border-color: var(--slate-200); }
.border-slate-300 { border-color: var(--slate-300); }
.border-indigo-600 { border-color: var(--indigo-600); }
.border-indigo-500 { border-color: #6366f1; }

.rounded-md { border-radius: 0.375rem; }
.rounded-lg { border-radius: 0.5rem; }
.rounded-xl { border-radius: 0.75rem; }
.rounded-2xl { border-radius: 1rem; }
.rounded-full { border-radius: 9999px; }

.shadow-sm { box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05); }
.shadow-md { box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1); }

.sticky { position: sticky; }
.relative { position: relative; }
.absolute { position: absolute; }
.top-0 { top: 0; }
.z-50 { z-index: 50; }
.overflow-hidden { overflow: hidden; }
.overflow-x-auto { overflow-x: auto; }

.transition-colors { transition: color 0.2s, background-color 0.2s, border-color 0.2s; }
.transition-all { transition: all 0.2s; }
.duration-300 { transition-duration: 0.3s; }

.hover\:bg-indigo-700:hover { background-color: var(--indigo-700); }
.hover\:bg-slate-50:hover { background-color: var(--slate-50); }
.hover\:text-indigo-600:hover { color: var(--indigo-600); }
.hover\:text-slate-900:hover { color: var(--slate-900); }
.hover\:underline:hover { text-decoration: underline; }

.card-hover { transition: transform 0.25s, border-color 0.25s, box-shadow 0.25s; }
.card-hover:hover {
  transform: translateY(-2px);
  border-color: #6366f1;
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.05);
}
.group:hover .group-hover\:text-indigo-600 { color: var(--indigo-600); }

.prose { color: var(--slate-700); line-height: 1.75; }
.prose h2 {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--slate-900);
  margin: 2rem 0 1rem;
}
.prose h3 {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--slate-900);
  margin: 1.5rem 0 0.75rem;
}
.prose p { margin-bottom: 1rem; }
.prose ul, .prose ol { margin: 0 0 1rem 1.25rem; }
.prose li { margin-bottom: 0.375rem; }
.prose a { color: var(--indigo-600); text-decoration: underline; }
.prose strong { color: var(--slate-900); font-weight: 700; }
.prose table { width: 100%; border-collapse: collapse; margin: 1rem 0; font-size: 0.9rem; }
.prose th, .prose td { border: 1px solid var(--slate-200); padding: 0.5rem 0.75rem; text-align: left; }
.prose th { background: var(--slate-50); font-weight: 700; color: var(--slate-900); }

@media (min-width: 640px) {
  .sm\:block { display: block; }
  .sm\:flex { display: flex; }
  .sm\:text-left { text-align: left; }
}
@media (min-width: 768px) {
  .md\:grid-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .md\:grid-cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .md\:text-4xl { font-size: 2.25rem; line-height: 2.5rem; }
  .md\:flex { display: flex; }
  .md\:hidden { display: none; }
}
@media (min-width: 1024px) {
  .lg\:grid-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .lg\:grid-cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .lg\:grid-cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

/* Graceful degradation when a CDN chart library fails to load */
.chart-fallback {
  display: none;
  padding: 16px;
  border: 1px dashed var(--border);
  border-radius: var(--radius-sm);
  background: var(--slate-50);
  color: var(--text-muted);
  font-size: 0.85rem;
  text-align: center;
}
.chart-unavailable .chart-fallback { display: block; }
.chart-unavailable canvas { display: none; }

/* ---------- Guide article components (shared by all guide pages) ---------- */

.content { width: 100%; }

/* B-family guide cards (Tailwind-style pages) — aligned with .section-card */
.guide-section {
  background: var(--card);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  padding: 28px;
  margin-bottom: 20px;
  transition: 0.2s;
}
.guide-section:hover { box-shadow: var(--shadow-hover); }
.guide-header { border-bottom: 1px solid var(--border); padding-bottom: 16px; margin-bottom: 20px; }
.guide-tag {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 9999px;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 12px;
}

.footer-cols {
  display: flex;
  gap: 40px;
  flex-wrap: wrap;
}
.footer-col { min-width: 130px; }
.footer-col-title {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text);
  margin-bottom: 10px;
}
.footer-col-links { display: flex; flex-direction: column; gap: 6px; }

/* Simple bar visualisation used in some guides (e.g. 100k tax trap) */
.viz-row { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; }
.viz-label { width: 200px; font-size: 0.8rem; font-weight: 600; color: var(--text-muted); flex-shrink: 0; }
.viz-bar-wrap { flex: 1; background: var(--slate-100); border-radius: 6px; overflow: hidden; position: relative; height: 28px; }
.viz-fill { height: 100%; display: flex; align-items: center; justify-content: flex-end; padding-right: 8px; color: #fff; font-weight: 700; font-size: 0.75rem; border-radius: 6px; }
.viz-pct { text-shadow: 0 1px 2px rgba(0,0,0,0.25); }
.viz-current { position: absolute; top: -4px; bottom: -4px; width: 3px; background: var(--amber); border-radius: 2px; }
