/*
Theme Name: UK Tax Calc
Theme URI: https://uktaxcalc.co.uk
Author: UK Tax Calc
Description: Premium UK tax calculator website theme. Matches the React SPA design exactly. Compatible with Yoast SEO and RankMath.
Version: 1.0.0
License: GPL-2.0-or-later
Text Domain: uk-tax-calc
Tags: custom-menu, footer-widgets, full-width-template, blog
*/

/* ─── Design Tokens ─────────────────────────────────────────────────────── */
:root {
  --background:        hsl(210, 20%, 98%);
  --foreground:        hsl(222, 47%, 11%);
  --border:            hsl(214, 32%, 91%);
  --card:              hsl(0, 0%, 100%);
  --card-foreground:   hsl(222, 47%, 11%);
  --primary:           hsl(180, 100%, 25%);
  --primary-fg:        hsl(0, 0%, 100%);
  --primary-hover:     hsl(180, 100%, 20%);
  --muted:             hsl(210, 40%, 96.1%);
  --muted-fg:          hsl(215, 16%, 47%);
  --accent:            hsl(210, 40%, 96.1%);
  --destructive:       hsl(0, 84%, 60%);
  --radius:            0.5rem;
  --font-sans:         'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --shadow-sm:         0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow-md:         0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
  --shadow-xl:         0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);
  --shadow-2xl:        0 25px 50px -12px rgb(0 0 0 / 0.25);
}

/* ─── Reset & Base ──────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

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

body {
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.5;
  color: var(--foreground);
  background-color: var(--background);
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a { color: inherit; text-decoration: none; }
img { max-width: 100%; height: auto; display: block; }
button { cursor: pointer; font-family: inherit; }
ul, ol { list-style: none; }
h1,h2,h3,h4,h5,h6 { font-weight: 700; line-height: 1.25; }

/* ─── Layout ────────────────────────────────────────────────────────────── */
.site-wrapper { min-height: 100vh; display: flex; flex-direction: column; }
.site-main { flex: 1; background: var(--background); }
.container { max-width: 1280px; margin: 0 auto; padding: 0 1rem; }
@media (min-width: 640px)  { .container { padding: 0 1.5rem; } }
@media (min-width: 1024px) { .container { padding: 0 2rem; } }

/* ─── Navbar ────────────────────────────────────────────────────────────── */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--background);
  border-bottom: 1px solid var(--border);
}

.nav-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}

.nav-left { display: flex; align-items: center; gap: 2rem; }

.site-logo {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--primary);
  text-decoration: none;
  flex-shrink: 0;
}

/* Desktop nav */
.nav-links {
  display: none;
  align-items: center;
  gap: 1.5rem;
}
@media (min-width: 768px) { .nav-links { display: flex; } }

.nav-right {
  display: none;
  align-items: center;
  gap: 0.75rem;
}
@media (min-width: 768px) { .nav-right { display: flex; } }

/* Dropdown trigger buttons */
.nav-dropdown-trigger {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.25rem 0.25rem;
  padding-top: 0.25rem;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--muted-fg);
  background: none;
  border: none;
  cursor: pointer;
  transition: color 0.15s;
}
.nav-dropdown-trigger:hover,
.nav-dropdown-trigger.active-trigger { color: var(--foreground); }
.nav-dropdown-trigger.calculators-trigger { color: var(--foreground); }

.nav-dropdown-trigger svg {
  width: 14px;
  height: 14px;
  transition: transform 0.2s;
}
.nav-dropdown-trigger.open svg { transform: rotate(180deg); }

/* Dropdown panels */
.nav-dropdown { position: relative; }

.dropdown-panel {
  display: none;
  position: absolute;
  top: calc(100% + 0.75rem);
  left: 50%;
  transform: translateX(-50%);
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 0.75rem;
  box-shadow: var(--shadow-2xl);
  z-index: 100;
  overflow: hidden;
}
.dropdown-panel.open { display: block; }

/* Calculators mega dropdown */
.dropdown-calculators { width: 780px; }

.calc-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  divide-x: 1px solid var(--border);
}

.calc-col {
  padding: 1.25rem;
  border-right: 1px solid var(--border);
}
.calc-col:last-child { border-right: none; }

.calc-col-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 1rem;
}
.calc-col-header svg { width: 16px; height: 16px; }
.calc-col-label {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted-fg);
}

.calc-col ul { display: flex; flex-direction: column; gap: 0.125rem; }
.calc-col a {
  display: block;
  font-size: 0.875rem;
  color: var(--muted-fg);
  padding: 0.375rem 0.5rem;
  border-radius: 0.25rem;
  transition: color 0.15s, background 0.15s;
}
.calc-col a:hover { color: var(--primary); background: color-mix(in srgb, var(--primary) 5%, transparent); }

.dropdown-footer {
  border-top: 1px solid var(--border);
  background: color-mix(in srgb, var(--muted) 40%, transparent);
  padding: 0.75rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.dropdown-footer span { font-size: 0.875rem; color: var(--muted-fg); }
.dropdown-footer a { font-size: 0.875rem; font-weight: 500; color: var(--primary); }
.dropdown-footer a:hover { text-decoration: underline; }

/* Resources dropdown */
.dropdown-resources { width: 320px; padding: 0.5rem; }

.resource-link {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.625rem 0.75rem;
  border-radius: 0.5rem;
  transition: background 0.15s;
}
.resource-link:hover { background: var(--muted); }

.resource-icon {
  margin-top: 2px;
  padding: 6px;
  border-radius: 6px;
  background: color-mix(in srgb, var(--primary) 10%, transparent);
  color: var(--primary);
  flex-shrink: 0;
}
.resource-icon svg { width: 14px; height: 14px; }

.resource-text-title { font-size: 0.875rem; font-weight: 500; color: var(--foreground); }
.resource-text-desc  { font-size: 0.75rem; color: var(--muted-fg); margin-top: 1px; }

/* CTA Button */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  font-size: 0.875rem;
  font-weight: 500;
  padding: 0.5rem 1rem;
  border-radius: var(--radius);
  border: none;
  cursor: pointer;
  transition: background 0.15s, opacity 0.15s;
  text-decoration: none;
}
.btn-primary { background: var(--primary); color: var(--primary-fg); }
.btn-primary:hover { background: var(--primary-hover); }
.btn-ghost { background: transparent; color: var(--foreground); border: 1px solid transparent; }
.btn-ghost:hover { background: var(--muted); }
.btn svg { width: 16px; height: 16px; }

.btn-lg { padding: 0.75rem 1.5rem; font-size: 1rem; }
.btn-outline { background: transparent; color: var(--foreground); border: 1px solid var(--border); }
.btn-outline:hover { background: var(--muted); }

/* ─── Mobile hamburger ──────────────────────────────────────────────────── */
.mobile-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.5rem;
  background: none;
  border: none;
  color: var(--muted-fg);
  border-radius: 0.375rem;
}
.mobile-toggle:hover { color: var(--foreground); }
.mobile-toggle svg { width: 24px; height: 24px; }
@media (min-width: 768px) { .mobile-toggle { display: none; } }

/* Mobile menu */
.mobile-menu {
  display: none;
  border-top: 1px solid var(--border);
  background: var(--background);
  max-height: 80vh;
  overflow-y: auto;
}
.mobile-menu.open { display: block; }
@media (min-width: 768px) { .mobile-menu { display: none !important; } }

.mobile-menu-top { padding: 0.75rem 1rem; }
.mobile-menu-top .btn { width: 100%; justify-content: center; }

.mobile-category {
  border-top: 1px solid color-mix(in srgb, var(--border) 50%, transparent);
}
.mobile-category:first-child { border-top: none; }

.mobile-cat-trigger {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1rem;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--foreground);
  background: none;
  border: none;
  cursor: pointer;
}
.mobile-cat-trigger svg { width: 16px; height: 16px; color: var(--muted-fg); transition: transform 0.2s; }
.mobile-cat-trigger.open svg { transform: rotate(180deg); }

.mobile-cat-items {
  display: none;
  padding: 0.75rem 1rem 0.75rem 2.25rem;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.25rem;
}
.mobile-cat-items.open { display: grid; }
.mobile-cat-items a { font-size: 0.875rem; color: var(--muted-fg); padding: 0.375rem 0.5rem; border-radius: 0.25rem; }
.mobile-cat-items a:hover { color: var(--primary); background: color-mix(in srgb, var(--primary) 5%, transparent); }

.mobile-extras {
  border-top: 1px solid color-mix(in srgb, var(--border) 50%, transparent);
  padding: 0.5rem 1rem 0.75rem;
}
.mobile-extras a {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.625rem 0.75rem;
  font-size: 0.875rem;
  color: var(--muted-fg);
  border-radius: 0.375rem;
}
.mobile-extras a:hover { color: var(--foreground); }
.mobile-extras svg { width: 16px; height: 16px; }

/* ─── Category color accents ────────────────────────────────────────────── */
.color-personal   { color: hsl(217, 91%, 60%); }
.color-business   { color: hsl(43, 96%, 56%); }
.color-property   { color: hsl(142, 71%, 45%); }
.color-expenses   { color: hsl(271, 91%, 65%); }

/* ─── Footer ────────────────────────────────────────────────────────────── */
.site-footer {
  background: var(--background);
  border-top: 1px solid var(--border);
  margin-top: auto;
}

.footer-top {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 2rem;
  padding: 3rem 0;
}
@media (min-width: 768px) {
  .footer-top { grid-template-columns: repeat(5, 1fr); }
}

.footer-brand { grid-column: span 2; }
@media (min-width: 768px) { .footer-brand { grid-column: span 1; } }

.footer-brand-name { font-size: 1.125rem; font-weight: 700; color: var(--primary); }
.footer-brand-desc { margin-top: 0.75rem; font-size: 0.875rem; color: var(--muted-fg); line-height: 1.6; }
.footer-brand-link {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  margin-top: 1rem;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--primary);
}
.footer-brand-link:hover { text-decoration: underline; }
.footer-brand-link svg { width: 14px; height: 14px; }

.footer-col h3 {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--foreground);
}

.footer-col ul { margin-top: 0.75rem; display: flex; flex-direction: column; gap: 0.5rem; }
.footer-col a { font-size: 0.875rem; color: var(--muted-fg); transition: color 0.15s; }
.footer-col a:hover { color: var(--foreground); }

.footer-resources { padding: 2rem 0; border-top: 1px solid var(--border); }
.footer-resources-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.5rem;
}
@media (min-width: 768px) {
  .footer-resources-grid { grid-template-columns: repeat(4, 1fr); }
}

.footer-popular { grid-column: span 2; }

.footer-popular-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.5rem;
  margin-top: 0.75rem;
}

.footer-bottom {
  border-top: 1px solid var(--border);
  padding: 1.5rem 0;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}
@media (min-width: 768px) {
  .footer-bottom {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
  }
}

.footer-bottom p { font-size: 0.875rem; color: var(--muted-fg); }
.footer-bottom-links { display: flex; gap: 1rem; }
.footer-bottom-links a { font-size: 0.875rem; color: var(--muted-fg); transition: color 0.15s; }
.footer-bottom-links a:hover { color: var(--foreground); }

/* ─── Content area ──────────────────────────────────────────────────────── */
.content-wrap {
  max-width: 1280px;
  margin: 0 auto;
  padding: 2rem 1rem;
}
@media (min-width: 640px) { .content-wrap { padding: 2rem 1.5rem; } }
@media (min-width: 1024px) { .content-wrap { padding: 2rem 2rem; } }

/* ─── Cards ─────────────────────────────────────────────────────────────── */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.card:hover { border-color: var(--primary); }
.card-header { padding: 1.5rem; }
.card-content { padding: 1.5rem; }
.card-title { font-size: 1rem; font-weight: 600; color: var(--card-foreground); }
.card-desc { font-size: 0.875rem; color: var(--muted-fg); margin-top: 0.5rem; line-height: 1.6; }

/* ─── Badge ─────────────────────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  font-size: 0.75rem;
  font-weight: 500;
  padding: 0.125rem 0.625rem;
  border-radius: 9999px;
  background: var(--muted);
  color: var(--muted-fg);
}
.badge-primary { background: var(--primary); color: var(--primary-fg); }

/* ─── Hero section ──────────────────────────────────────────────────────── */
.hero {
  background: linear-gradient(to bottom, color-mix(in srgb, var(--primary) 5%, transparent), var(--background));
  border-bottom: 1px solid var(--border);
}
.hero-inner {
  max-width: 64rem;
  margin: 0 auto;
  padding: 5rem 1rem;
  text-align: center;
}
.hero h1 {
  font-size: clamp(2.25rem, 5vw, 3.75rem);
  font-weight: 800;
  letter-spacing: -0.025em;
  color: var(--foreground);
  line-height: 1.1;
}
.hero h1 .accent { display: block; color: var(--primary); }
.hero p { margin-top: 1.25rem; max-width: 40rem; margin-left: auto; margin-right: auto; font-size: 1.125rem; color: var(--muted-fg); }
.hero-actions { margin-top: 1.5rem; display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 0.75rem; }
.hero-search-wrap { margin-top: 2rem; max-width: 36rem; margin-left: auto; margin-right: auto; position: relative; }
.hero-search {
  position: relative;
}
.hero-search svg { position: absolute; left: 1rem; top: 50%; transform: translateY(-50%); width: 20px; height: 20px; color: var(--muted-fg); pointer-events: none; }
.hero-search input {
  width: 100%;
  padding: 1rem 1rem 1rem 3rem;
  font-size: 1rem;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 0.75rem;
  box-shadow: var(--shadow-sm);
  color: var(--foreground);
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
  font-family: var(--font-sans);
}
.hero-search input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 20%, transparent); }
.search-results {
  display: none;
  position: absolute;
  top: calc(100% + 0.5rem);
  left: 0;
  right: 0;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 0.75rem;
  box-shadow: var(--shadow-xl);
  z-index: 30;
  overflow: hidden;
}
.search-results.open { display: block; }
.search-result-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1rem;
  font-size: 0.875rem;
  border-bottom: 1px solid color-mix(in srgb, var(--border) 50%, transparent);
  transition: background 0.15s;
  cursor: pointer;
}
.search-result-item:last-child { border-bottom: none; }
.search-result-item:hover { background: color-mix(in srgb, var(--primary) 5%, transparent); }
.search-result-item span { font-weight: 500; }
.search-result-item svg { width: 16px; height: 16px; color: var(--muted-fg); }
.search-no-result { padding: 0.75rem 1rem; font-size: 0.875rem; color: var(--muted-fg); }

/* ─── Page / Post content ───────────────────────────────────────────────── */
.entry-content {
  font-size: 1rem;
  line-height: 1.75;
  color: var(--foreground);
}
.entry-content h1 { font-size: 2rem; margin: 1.5rem 0 0.75rem; }
.entry-content h2 { font-size: 1.5rem; margin: 1.5rem 0 0.75rem; }
.entry-content h3 { font-size: 1.25rem; margin: 1.25rem 0 0.5rem; }
.entry-content p  { margin-bottom: 1rem; }
.entry-content ul, .entry-content ol { margin: 0 0 1rem 1.5rem; }
.entry-content ul { list-style: disc; }
.entry-content ol { list-style: decimal; }
.entry-content li { margin-bottom: 0.25rem; }
.entry-content a  { color: var(--primary); text-decoration: underline; }
.entry-content blockquote { border-left: 4px solid var(--primary); padding-left: 1rem; color: var(--muted-fg); font-style: italic; margin: 1rem 0; }
.entry-content code { background: var(--muted); padding: 0.125rem 0.375rem; border-radius: 0.25rem; font-size: 0.875em; }
.entry-content pre { background: var(--muted); padding: 1rem; border-radius: var(--radius); overflow-x: auto; margin-bottom: 1rem; }
.entry-content table { width: 100%; border-collapse: collapse; margin-bottom: 1rem; }
.entry-content th, .entry-content td { padding: 0.625rem 0.75rem; border: 1px solid var(--border); text-align: left; }
.entry-content th { background: var(--muted); font-weight: 600; }

/* ─── Blog listing ──────────────────────────────────────────────────────── */
.posts-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.5rem;
  margin-top: 2rem;
}
@media (min-width: 640px) { .posts-grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1024px) { .posts-grid { grid-template-columns: repeat(3, 1fr); } }

.post-card { display: block; height: 100%; }
.post-card .card { height: 100%; transition: border-color 0.15s; }
.post-card:hover .card { border-color: var(--primary); }
.post-meta { font-size: 0.75rem; color: var(--muted-fg); margin-bottom: 0.5rem; }
.post-title { font-size: 1.125rem; font-weight: 600; line-height: 1.4; color: var(--foreground); }
.post-excerpt { font-size: 0.875rem; color: var(--muted-fg); margin-top: 0.5rem; line-height: 1.6; }

/* ─── 404 ───────────────────────────────────────────────────────────────── */
.page-404 { text-align: center; padding: 5rem 1rem; }
.page-404 h1 { font-size: 5rem; color: var(--primary); }
.page-404 h2 { font-size: 1.5rem; margin-top: 0.5rem; }
.page-404 p  { color: var(--muted-fg); margin-top: 0.5rem; font-size: 1.125rem; }
.page-404 .btn { margin-top: 1.5rem; }

/* ─── Section helpers ───────────────────────────────────────────────────── */
.section { padding: 4rem 0; }
.section-muted { background: color-mix(in srgb, var(--muted) 30%, transparent); border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); }
.section-title { font-size: 1.5rem; font-weight: 700; margin-bottom: 2rem; }

/* Grid helpers */
.grid-2 { display: grid; grid-template-columns: 1fr; gap: 1.25rem; }
.grid-3 { display: grid; grid-template-columns: 1fr; gap: 1.25rem; }
.grid-4 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1.25rem; }
@media (min-width: 640px) {
  .grid-2 { grid-template-columns: repeat(2, 1fr); }
  .grid-3 { grid-template-columns: repeat(2, 1fr); }
}
@media (min-width: 1024px) {
  .grid-3 { grid-template-columns: repeat(3, 1fr); }
  .grid-4 { grid-template-columns: repeat(4, 1fr); }
}

/* ─── WP Alignment helpers ──────────────────────────────────────────────── */
.aligncenter { display: block; margin-left: auto; margin-right: auto; }
.alignright { float: right; margin-left: 1rem; }
.alignleft { float: left; margin-right: 1rem; }
