/* ============================================
   THE CALCULATOR SITE .CO.UK — MAIN STYLESHEET
   ============================================ */

@import url('https://fonts.googleapis.com/css2?family=DM+Serif+Display:ital@0;1&family=DM+Sans:wght@300;400;500;600;700&display=swap');

:root {
  --navy: #0f2040;
  --navy-mid: #1a3560;
  --blue: #1e5cb3;
  --blue-light: #2d7dd2;
  --accent: #e8a020;
  --accent-light: #f4c060;
  --green: #1a9e6e;
  --red: #c0392b;
  --bg: #f4f6fa;
  --bg-card: #ffffff;
  --text: #1a2035;
  --text-mid: #4a5568;
  --text-light: #718096;
  --border: #dde3ef;
  --shadow: 0 2px 16px rgba(15,32,64,0.10);
  --shadow-lg: 0 8px 40px rgba(15,32,64,0.15);
  --radius: 12px;
  --radius-sm: 8px;
  --serif: 'DM Serif Display', Georgia, serif;
  --sans: 'DM Sans', system-ui, sans-serif;
}

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

html { scroll-behavior: smooth; }

body {
  font-family: var(--sans);
  background: var(--bg);
  color: var(--text);
  font-size: 16px;
  line-height: 1.6;
}

/* ---- HEADER ---- */
.site-header {
  background: var(--navy);
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 20px rgba(0,0,0,0.3);
}

.header-inner {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 24px;
  display: flex;
  align-items: center;
  height: 64px;
  gap: 32px;
}

.site-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  flex-shrink: 0;
}

.logo-icon {
  width: 36px;
  height: 36px;
  background: var(--accent);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  font-weight: 700;
  color: var(--navy);
}

.logo-text {
  font-family: var(--serif);
  font-size: 1.25rem;
  color: #fff;
  line-height: 1.1;
}

.logo-text span { color: var(--accent); }

.site-nav {
  display: flex;
  gap: 2px;
  flex: 1;
  overflow-x: auto;
}

.site-nav a {
  color: rgba(255,255,255,0.8);
  text-decoration: none;
  font-size: 0.875rem;
  font-weight: 500;
  padding: 6px 12px;
  border-radius: 6px;
  white-space: nowrap;
  transition: background 0.2s, color 0.2s;
}

.site-nav a:hover, .site-nav a.active {
  background: rgba(255,255,255,0.12);
  color: #fff;
}

.header-search {
  flex-shrink: 0;
  position: relative;
}

.header-search input {
  background: rgba(255,255,255,0.1);
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: 20px;
  padding: 7px 16px 7px 36px;
  color: #fff;
  font-size: 0.85rem;
  width: 200px;
  outline: none;
  transition: all 0.2s;
}

.header-search input::placeholder { color: rgba(255,255,255,0.5); }
.header-search input:focus { background: rgba(255,255,255,0.15); border-color: rgba(255,255,255,0.4); width: 240px; }

.search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: rgba(255,255,255,0.5);
  font-size: 14px;
}

/* ---- BREADCRUMB ---- */
.breadcrumb {
  background: #fff;
  border-bottom: 1px solid var(--border);
  padding: 10px 0;
}

.breadcrumb-inner {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 24px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  color: var(--text-light);
  flex-wrap: wrap;
}

.breadcrumb a {
  color: var(--blue);
  text-decoration: none;
}

.breadcrumb a:hover { text-decoration: underline; }
.breadcrumb .sep { color: var(--text-light); }
.breadcrumb .current { color: var(--text); font-weight: 500; }

/* ---- PAGE LAYOUT ---- */
.page-container {
  max-width: 1280px;
  margin: 0 auto;
  padding: 32px 24px;
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 32px;
  align-items: start;
}

.page-container.full-width {
  grid-template-columns: 1fr;
}

.main-content { min-width: 0; }
.sidebar { min-width: 0; }

/* ---- HERO BANNER (homepage) ---- */
.hero {
  background: linear-gradient(135deg, var(--navy) 0%, var(--navy-mid) 60%, #1a4a8a 100%);
  padding: 72px 24px;
  text-align: center;
  position: relative;
  overflow: hidden;
}

.hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.03'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
}

.hero-inner { max-width: 800px; margin: 0 auto; position: relative; }

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(232,160,32,0.2);
  border: 1px solid rgba(232,160,32,0.4);
  color: var(--accent-light);
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  padding: 5px 14px;
  border-radius: 20px;
  margin-bottom: 20px;
}

.hero h1 {
  font-family: var(--serif);
  font-size: clamp(2rem, 5vw, 3.2rem);
  color: #fff;
  margin-bottom: 16px;
  line-height: 1.15;
}

.hero h1 em { color: var(--accent); font-style: italic; }

.hero p {
  font-size: 1.1rem;
  color: rgba(255,255,255,0.75);
  margin-bottom: 32px;
  max-width: 600px;
  margin-left: auto;
  margin-right: auto;
}

.hero-stats {
  display: flex;
  gap: 40px;
  justify-content: center;
  flex-wrap: wrap;
}

.hero-stat { color: rgba(255,255,255,0.9); }
.hero-stat strong { display: block; font-size: 1.8rem; font-weight: 700; color: var(--accent); }
.hero-stat span { font-size: 0.85rem; color: rgba(255,255,255,0.6); }

/* ---- AD SLOTS ---- */
.ad-slot {
  background: #f8f9fc;
  border: 1px dashed var(--border);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-light);
  font-size: 0.75rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  position: relative;
}

.ad-slot::before {
  content: 'Advertisement';
  position: absolute;
  top: 4px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 0.65rem;
  color: var(--text-light);
  letter-spacing: 0.08em;
}

.ad-slot-leaderboard { height: 90px; width: 100%; margin: 24px 0; }
.ad-slot-sidebar { height: 250px; width: 100%; margin-bottom: 24px; }
.ad-slot-inline { height: 100px; width: 100%; margin: 32px 0; }

/* Google AdSense placeholder — replace with real ad units */
.adsense-unit { display: block; }

/* ---- CATEGORY CARDS ---- */
.category-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px;
  margin: 32px 0;
}

.category-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px 20px;
  text-decoration: none;
  color: inherit;
  transition: transform 0.2s, box-shadow 0.2s, border-color 0.2s;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 12px;
}

.category-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-lg);
  border-color: var(--blue-light);
}

.cat-icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
}

.cat-finance { background: #e8f0fe; }
.cat-tax { background: #fce8e6; }
.cat-property { background: #e6f4ea; }
.cat-health { background: #fef7e0; }
.cat-maths { background: #f3e8fd; }
.cat-everyday { background: #e8f5f9; }
.cat-business { background: #fff3e0; }
.cat-mortgage { background: #e8f0fe; }

.category-card h3 {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
}

.category-card p {
  font-size: 0.82rem;
  color: var(--text-light);
  line-height: 1.4;
}

.cat-count {
  font-size: 0.75rem;
  color: var(--blue);
  font-weight: 600;
  margin-top: auto;
}

/* ---- CALCULATOR CARD ---- */
.calc-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  margin-bottom: 24px;
}

.calc-header {
  background: linear-gradient(135deg, var(--navy) 0%, var(--navy-mid) 100%);
  padding: 28px 32px;
  color: #fff;
}

.calc-header h1 {
  font-family: var(--serif);
  font-size: 1.75rem;
  margin-bottom: 6px;
}

.calc-header p {
  color: rgba(255,255,255,0.7);
  font-size: 0.9rem;
}

.calc-body { padding: 32px; }

.form-group { margin-bottom: 20px; }

.form-group label {
  display: block;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 6px;
}

.form-group .hint {
  font-size: 0.78rem;
  color: var(--text-light);
  margin-top: 4px;
}

.input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.input-prefix, .input-suffix {
  position: absolute;
  font-size: 0.9rem;
  color: var(--text-mid);
  font-weight: 600;
  pointer-events: none;
}

.input-prefix { left: 12px; }
.input-suffix { right: 12px; }

.form-control {
  width: 100%;
  padding: 10px 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 1rem;
  font-family: var(--sans);
  color: var(--text);
  background: #fff;
  transition: border-color 0.2s, box-shadow 0.2s;
  outline: none;
}

.form-control:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(30,92,179,0.12);
}

.has-prefix .form-control { padding-left: 28px; }
.has-suffix .form-control { padding-right: 36px; }

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.btn-calc {
  width: 100%;
  padding: 14px;
  background: var(--blue);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 1rem;
  font-weight: 600;
  font-family: var(--sans);
  cursor: pointer;
  transition: background 0.2s, transform 0.1s;
  margin-top: 8px;
}

.btn-calc:hover { background: var(--blue-light); }
.btn-calc:active { transform: scale(0.99); }

.btn-reset {
  width: 100%;
  padding: 10px;
  background: transparent;
  color: var(--text-mid);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  font-weight: 500;
  font-family: var(--sans);
  cursor: pointer;
  transition: all 0.2s;
  margin-top: 8px;
}

.btn-reset:hover { border-color: var(--text-mid); color: var(--text); }

/* ---- RESULTS PANEL ---- */
.results-panel {
  background: linear-gradient(135deg, #f0f7ff 0%, #e8f0fe 100%);
  border: 1px solid #c5d8f8;
  border-radius: var(--radius);
  padding: 28px;
  margin-top: 24px;
  display: none;
}

.results-panel.show { display: block; }

.results-panel h3 {
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--blue);
  font-weight: 700;
  margin-bottom: 20px;
}

.result-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid rgba(30,92,179,0.1);
}

.result-row:last-child { border-bottom: none; }

.result-label { font-size: 0.9rem; color: var(--text-mid); }

.result-value {
  font-size: 1rem;
  font-weight: 700;
  color: var(--navy);
}

.result-row.highlight .result-label { font-weight: 600; color: var(--text); }
.result-row.highlight .result-value { font-size: 1.4rem; color: var(--blue); }

.result-note {
  font-size: 0.8rem;
  color: var(--text-light);
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid rgba(30,92,179,0.1);
}

/* ---- ARTICLE CONTENT ---- */
.article-content {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 36px;
  margin-top: 24px;
}

.article-content h2 {
  font-family: var(--serif);
  font-size: 1.5rem;
  color: var(--navy);
  margin-bottom: 12px;
  margin-top: 28px;
}

.article-content h2:first-child { margin-top: 0; }

.article-content h3 {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text);
  margin: 20px 0 8px;
}

.article-content p {
  color: var(--text-mid);
  margin-bottom: 14px;
  line-height: 1.75;
}

.article-content ul, .article-content ol {
  padding-left: 24px;
  margin-bottom: 14px;
}

.article-content li {
  color: var(--text-mid);
  margin-bottom: 6px;
  line-height: 1.65;
}

.article-content a { color: var(--blue); }
.article-content a:hover { text-decoration: underline; }

.article-content .callout {
  background: #f0f7ff;
  border-left: 4px solid var(--blue);
  padding: 16px 20px;
  border-radius: 0 8px 8px 0;
  margin: 20px 0;
}

.article-content .callout-warning {
  background: #fff8e1;
  border-left-color: var(--accent);
}

.article-content .callout p { margin: 0; color: var(--text); }

/* ---- RELATED CALCULATORS ---- */
.related-calcs {
  margin-top: 24px;
}

.related-calcs h3 {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 12px;
}

.related-list {
  display: grid;
  gap: 8px;
}

.related-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  text-decoration: none;
  color: var(--text);
  font-size: 0.9rem;
  font-weight: 500;
  transition: all 0.2s;
}

.related-item:hover {
  border-color: var(--blue);
  color: var(--blue);
  background: #f0f7ff;
}

.related-item .ri-icon { font-size: 1.1rem; }
.related-item .ri-arrow { margin-left: auto; color: var(--text-light); font-size: 0.8rem; }

/* ---- SIDEBAR WIDGETS ---- */
.sidebar-widget {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 20px;
}

.widget-header {
  background: var(--navy);
  color: #fff;
  padding: 12px 18px;
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.widget-body { padding: 16px 18px; }

.widget-link-list { list-style: none; }

.widget-link-list li {
  padding: 7px 0;
  border-bottom: 1px solid var(--border);
}

.widget-link-list li:last-child { border-bottom: none; }

.widget-link-list a {
  text-decoration: none;
  color: var(--blue);
  font-size: 0.875rem;
  display: flex;
  align-items: center;
  gap: 6px;
}

.widget-link-list a:hover { text-decoration: underline; }

/* ---- ARTICLES HUB ---- */
.articles-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 20px;
  margin: 24px 0;
}

.article-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  text-decoration: none;
  color: inherit;
  transition: transform 0.2s, box-shadow 0.2s;
  display: flex;
  flex-direction: column;
}

.article-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); }

.article-card-img {
  height: 140px;
  background: linear-gradient(135deg, var(--navy) 0%, var(--blue) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 3rem;
}

.article-card-body { padding: 20px; flex: 1; display: flex; flex-direction: column; }

.article-tag {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--blue);
  margin-bottom: 8px;
}

.article-card h3 {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 8px;
  line-height: 1.35;
}

.article-card p {
  font-size: 0.85rem;
  color: var(--text-light);
  line-height: 1.5;
  flex: 1;
}

.article-card-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 16px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
  font-size: 0.78rem;
  color: var(--text-light);
}

/* ---- TABLES ---- */
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
  margin: 16px 0;
}

.data-table th {
  background: var(--navy);
  color: #fff;
  padding: 10px 14px;
  text-align: left;
  font-weight: 600;
  font-size: 0.82rem;
}

.data-table td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  color: var(--text-mid);
}

.data-table tr:last-child td { border-bottom: none; }
.data-table tr:nth-child(even) td { background: #f8f9fc; }
.data-table .highlight-row td { background: #e8f0fe; font-weight: 600; color: var(--text); }

/* ---- FOOTER ---- */
.site-footer {
  background: var(--navy);
  color: rgba(255,255,255,0.7);
  padding: 56px 24px 24px;
  margin-top: 60px;
}

.footer-grid {
  max-width: 1280px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr 1fr;
  gap: 40px;
  margin-bottom: 48px;
}

.footer-brand .logo-text { color: #fff; font-size: 1.1rem; margin-bottom: 10px; display: block; }
.footer-brand p { font-size: 0.85rem; line-height: 1.6; }

.footer-col h4 {
  color: #fff;
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  margin-bottom: 14px;
}

.footer-col ul { list-style: none; }
.footer-col ul li { margin-bottom: 8px; }
.footer-col ul li a {
  color: rgba(255,255,255,0.6);
  text-decoration: none;
  font-size: 0.85rem;
  transition: color 0.2s;
}

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

.footer-bottom {
  max-width: 1280px;
  margin: 0 auto;
  padding-top: 24px;
  border-top: 1px solid rgba(255,255,255,0.1);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  font-size: 0.8rem;
}

.footer-bottom a { color: rgba(255,255,255,0.5); text-decoration: none; }
.footer-bottom a:hover { color: rgba(255,255,255,0.8); }

/* ---- TAX TABLE WIDGET ---- */
.tax-bands { margin: 12px 0; }
.tax-band-row { display: flex; justify-content: space-between; padding: 8px 0; border-bottom: 1px solid var(--border); font-size: 0.85rem; }
.tax-band-row:last-child { border-bottom: none; }
.tax-band-label { color: var(--text-mid); }
.tax-band-rate { font-weight: 700; color: var(--navy); }
.tax-band-range { color: var(--text-light); font-size: 0.8rem; }

/* ---- PAGE TITLE SECTION ---- */
.page-title-section {
  padding: 36px 24px 24px;
  background: #fff;
  border-bottom: 1px solid var(--border);
  margin-bottom: 0;
}

.page-title-inner {
  max-width: 1280px;
  margin: 0 auto;
}

.page-title-inner .tag {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--blue);
  background: #e8f0fe;
  padding: 3px 10px;
  border-radius: 20px;
  margin-bottom: 10px;
}

.page-title-inner h1 {
  font-family: var(--serif);
  font-size: clamp(1.5rem, 3vw, 2.2rem);
  color: var(--navy);
  margin-bottom: 8px;
}

.page-title-inner .subtitle {
  color: var(--text-light);
  font-size: 0.95rem;
}

/* ---- SECTION HEADINGS ---- */
.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 40px 0 20px;
  padding-bottom: 12px;
  border-bottom: 2px solid var(--border);
}

.section-heading h2 {
  font-family: var(--serif);
  font-size: 1.5rem;
  color: var(--navy);
}

.section-heading a {
  font-size: 0.85rem;
  color: var(--blue);
  text-decoration: none;
  font-weight: 600;
}

.section-heading a:hover { text-decoration: underline; }

/* ---- QUICK CALC LIST ---- */
.quick-calc-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 12px;
  margin: 16px 0;
}

.quick-calc-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  text-decoration: none;
  color: var(--text);
  font-size: 0.9rem;
  font-weight: 500;
  transition: all 0.2s;
}

.quick-calc-item:hover {
  border-color: var(--blue);
  background: #f0f7ff;
  color: var(--blue);
}

.quick-calc-item .qci-icon {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  flex-shrink: 0;
}

/* ---- RESPONSIVE ---- */
@media (max-width: 900px) {
  .page-container { grid-template-columns: 1fr; }
  .footer-grid { grid-template-columns: 1fr 1fr; }
  .form-row { grid-template-columns: 1fr; }
}

@media (max-width: 600px) {
  .site-nav { display: none; }
  .footer-grid { grid-template-columns: 1fr; }
  .hero { padding: 48px 24px; }
  .calc-body { padding: 20px; }
  .article-content { padding: 20px; }
  .header-search { display: none; }
  .category-grid { grid-template-columns: 1fr 1fr; }
}

/* ---- UTILITIES ---- */
.text-center { text-align: center; }
.text-muted { color: var(--text-light); }
.mt-0 { margin-top: 0; }
.mb-24 { margin-bottom: 24px; }
.hidden { display: none; }
.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 20px;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.badge-blue { background: #e8f0fe; color: var(--blue); }
.badge-green { background: #e6f4ea; color: var(--green); }
.badge-orange { background: #fff3e0; color: #e67e22; }
