/* ═══════════════════════════════════════════
   UK Calculator Hub — Core Design System
   ═══════════════════════════════════════════ */

/* ── TOKENS ── */
:root {
    --ink: #1a1a2e;
    --ink-light: #3d3d5c;
    --ink-muted: #6b6b8a;
    --surface: #faf9f7;
    --card: #ffffff;
    --border: #e8e6e1;
    --accent: #c45d3e;
    --accent-dark: #a84a2f;
    --accent-light: #fdf0ec;
    --green: #2d8f5e;
    --green-light: #edf7f1;
    --blue: #3b6b9a;
    --blue-light: #eef4fa;
    --warning: #d4930a;
    --warning-light: #fef8eb;
    --radius: 10px;
    --shadow-sm: 0 1px 3px rgba(26,26,46,0.06);
    --shadow-md: 0 4px 16px rgba(26,26,46,0.08);
    --shadow-lg: 0 8px 32px rgba(26,26,46,0.12);
    --max-width: 860px;
    --max-width-wide: 1080px;
}

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

html {
    scroll-behavior: smooth;
    -webkit-font-smoothing: antialiased;
}

body {
    font-family: 'DM Sans', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--surface);
    color: var(--ink);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

img { max-width: 100%; display: block; }
a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-dark); }

/* ── FONTS ── */
.font-display {
    font-family: 'DM Serif Display', Georgia, serif;
    font-weight: 400;
}

/* ── NAV ── */
.site-nav {
    background: var(--ink);
    border-bottom: 1px solid rgba(255,255,255,0.06);
    position: sticky;
    top: 0;
    z-index: 100;
}

.nav-inner {
    max-width: var(--max-width-wide);
    margin: 0 auto;
    padding: 0 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 56px;
}

.nav-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    color: white;
    font-weight: 700;
    font-size: 0.95rem;
    letter-spacing: -0.01em;
    text-decoration: none;
}

.nav-logo .logo-mark {
    width: 28px;
    height: 28px;
    background: var(--accent);
    border-radius: 7px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'DM Serif Display', serif;
    font-size: 0.85rem;
    color: white;
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 6px;
    list-style: none;
}

.nav-links a {
    color: rgba(255,255,255,0.6);
    font-size: 0.85rem;
    font-weight: 500;
    padding: 8px 14px;
    border-radius: 6px;
    transition: color 0.2s, background 0.2s;
    text-decoration: none;
}

.nav-links a:hover,
.nav-links a.active {
    color: white;
    background: rgba(255,255,255,0.08);
}

/* Tools dropdown */
.nav-dropdown { position: relative; }
.nav-dropdown > a::after { content: ' ▾'; font-size: 0.7rem; }
.nav-dropdown-menu {
    display: none; position: absolute; top: 100%; left: 0;
    background: var(--card, #1a1a1a); border: 1px solid rgba(255,255,255,0.1);
    border-radius: 8px; padding: 8px 0; min-width: 260px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.3); z-index: 100;
    max-height: 70vh; overflow-y: auto;
}
.nav-dropdown:hover .nav-dropdown-menu,
.nav-dropdown.open .nav-dropdown-menu { display: block; }
.nav-dropdown-menu a {
    display: block; padding: 8px 18px; font-size: 0.84rem;
    color: rgba(255,255,255,0.7); white-space: nowrap;
}
.nav-dropdown-menu a:hover { color: white; background: rgba(255,255,255,0.06); }
.nav-dropdown-cat {
    font-size: 0.68rem; font-weight: 700; text-transform: uppercase;
    letter-spacing: 0.06em; color: rgba(255,255,255,0.3);
    padding: 10px 18px 4px; pointer-events: none;
}
.nav-dropdown-cat:first-child { padding-top: 4px; }

.nav-hamburger {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
    color: white;
}

.nav-hamburger svg {
    display: block;
}

/* ── PAGE HEADER ── */
.page-header {
    background: var(--ink);
    color: white;
    position: relative;
    overflow: hidden;
}

.page-header::before {
    content: '';
    position: absolute;
    top: -50%; right: -20%;
    width: 600px; height: 600px;
    background: radial-gradient(circle, rgba(196,93,62,0.15) 0%, transparent 70%);
    pointer-events: none;
}

.page-header-inner {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 48px 24px 44px;
    position: relative;
}

.page-header .breadcrumb {
    font-size: 0.8rem;
    color: rgba(255,255,255,0.4);
    margin-bottom: 16px;
}

.page-header .breadcrumb a {
    color: rgba(255,255,255,0.5);
    text-decoration: none;
}

.page-header .breadcrumb a:hover {
    color: rgba(255,255,255,0.8);
}

.page-header .breadcrumb .sep {
    margin: 0 8px;
}

.badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: rgba(255,255,255,0.08);
    border: 1px solid rgba(255,255,255,0.12);
    padding: 6px 14px;
    border-radius: 100px;
    font-size: 0.78rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: rgba(255,255,255,0.7);
    margin-bottom: 20px;
}

.badge .dot {
    width: 7px; height: 7px;
    border-radius: 50%;
    background: var(--accent);
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}

.page-header h1 {
    font-family: 'DM Serif Display', Georgia, serif;
    font-size: clamp(1.9rem, 5vw, 2.75rem);
    font-weight: 400;
    line-height: 1.15;
    margin-bottom: 14px;
    letter-spacing: -0.01em;
}

.page-header .subtitle {
    font-size: 1.05rem;
    color: rgba(255,255,255,0.6);
    max-width: 560px;
    line-height: 1.55;
}

/* ── CONTAINERS ── */
.container {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0 24px;
}

.container-wide {
    max-width: var(--max-width-wide);
    margin: 0 auto;
    padding: 0 24px;
}

/* ── CARDS ── */
.card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
}

.card-elevated {
    box-shadow: var(--shadow-md);
}

.card-section {
    padding: 32px 36px;
}

.card-section + .card-section {
    border-top: 1px solid var(--border);
}

/* ── FORM ELEMENTS ── */
.section-label {
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--ink-muted);
    margin-bottom: 20px;
}

.input-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.input-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.input-group.full-width {
    grid-column: 1 / -1;
}

.input-group label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--ink-light);
}

.input-group .hint {
    font-size: 0.75rem;
    color: var(--ink-muted);
    margin-top: -2px;
}

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

.input-wrap .prefix {
    position: absolute; left: 14px;
    font-size: 0.95rem; font-weight: 600;
    color: var(--ink-muted);
    pointer-events: none; z-index: 1;
}

.input-wrap .suffix {
    position: absolute; right: 14px;
    font-size: 0.85rem; font-weight: 500;
    color: var(--ink-muted);
    pointer-events: none;
}

input[type="number"], input[type="text"], input[type="email"], select, textarea {
    width: 100%;
    padding: 12px 14px;
    font-family: 'DM Sans', sans-serif;
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--ink);
    background: var(--surface);
    border: 1.5px solid var(--border);
    border-radius: 8px;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
    -moz-appearance: textfield;
}

input::-webkit-outer-spin-button,
input::-webkit-inner-spin-button {
    -webkit-appearance: none;
}

input:focus, select:focus, textarea:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-light);
}

.has-prefix { padding-left: 32px !important; }
.has-suffix { padding-right: 32px !important; }

select {
    cursor: pointer;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%236b6b8a' stroke-width='2.5'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    padding-right: 36px;
}

/* ── BUTTONS ── */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 24px;
    font-family: 'DM Sans', sans-serif;
    font-size: 0.92rem;
    font-weight: 700;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.2s, transform 0.1s, box-shadow 0.2s;
    letter-spacing: 0.02em;
    text-decoration: none;
}

.btn:active { transform: scale(0.99); }

.btn-primary {
    color: white;
    background: var(--accent);
}
.btn-primary:hover {
    background: var(--accent-dark);
    box-shadow: var(--shadow-md);
    color: white;
}

.btn-secondary {
    color: var(--ink);
    background: var(--card);
    border: 1.5px solid var(--border);
}
.btn-secondary:hover {
    background: var(--surface);
    border-color: var(--ink-muted);
    color: var(--ink);
}

.btn-full { width: 100%; }
.btn-lg { padding: 16px 24px; font-size: 1rem; }

/* ── RESULTS COMMON ── */
.hero-stat {
    background: var(--ink);
    color: white;
    border-radius: var(--radius);
    padding: 36px;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.hero-stat::before {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(ellipse at top right, rgba(196,93,62,0.12) 0%, transparent 60%);
}

.hero-stat-label {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: rgba(255,255,255,0.5);
    margin-bottom: 8px;
    position: relative;
}

.hero-stat-value {
    font-family: 'DM Serif Display', serif;
    font-size: clamp(2.2rem, 6vw, 3rem);
    font-weight: 400;
    position: relative;
}

.hero-stat-sub {
    font-size: 0.88rem;
    color: rgba(255,255,255,0.5);
    margin-top: 6px;
    position: relative;
}

/* ── BREAKDOWN TABLE ── */
.breakdown-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}

.breakdown-header {
    padding: 18px 24px;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--ink-muted);
}

.breakdown-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 24px;
    border-bottom: 1px solid var(--border);
    font-size: 0.92rem;
}

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

.breakdown-row .label {
    color: var(--ink-light);
    display: flex;
    align-items: center;
    gap: 8px;
}

.breakdown-row .label .icon {
    width: 8px; height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

.breakdown-row .value {
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    color: var(--ink);
}

.breakdown-row.total-row {
    background: var(--surface);
    font-weight: 700;
}

.breakdown-row.total-row .value {
    color: var(--accent);
    font-size: 1.05rem;
}

/* ── FAQ ── */
.faq-list { margin-top: 24px; }

.faq-item {
    border-bottom: 1px solid var(--border);
    padding: 18px 0;
}
.faq-item:first-child { border-top: 1px solid var(--border); }

.faq-q {
    font-weight: 700;
    font-size: 0.95rem;
    color: var(--ink);
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
}

.faq-q::after {
    content: '+';
    font-size: 1.3rem;
    font-weight: 300;
    color: var(--ink-muted);
    flex-shrink: 0;
}

.faq-item.open .faq-q::after { content: '−'; }

.faq-a {
    font-size: 0.9rem;
    line-height: 1.7;
    color: var(--ink-light);
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease, padding 0.3s ease;
}

.faq-item.open .faq-a {
    max-height: 300px;
    padding-top: 12px;
}

/* ── CONTENT PROSE ── */
.prose h2 {
    font-family: 'DM Serif Display', serif;
    font-size: 1.6rem;
    font-weight: 400;
    margin-bottom: 16px;
    margin-top: 40px;
    color: var(--ink);
}

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

.prose p {
    font-size: 0.95rem;
    line-height: 1.7;
    color: var(--ink-light);
    margin-bottom: 14px;
    max-width: 680px;
}

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

.footer-inner {
    max-width: var(--max-width-wide);
    margin: 0 auto;
    padding: 40px 24px;
    display: grid;
    grid-template-columns: 2fr 1fr 1fr;
    gap: 40px;
}

.footer-brand {
    max-width: 320px;
}

.footer-brand .nav-logo {
    color: var(--ink);
    margin-bottom: 12px;
}

.footer-brand .nav-logo .logo-mark {
    background: var(--ink);
}

.footer-brand p {
    font-size: 0.82rem;
    color: var(--ink-muted);
    line-height: 1.6;
}

.footer-col h4 {
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--ink-muted);
    margin-bottom: 14px;
}

.footer-col ul {
    list-style: none;
}

.footer-col li {
    margin-bottom: 8px;
}

.footer-col a {
    font-size: 0.85rem;
    color: var(--ink-light);
    text-decoration: none;
    transition: color 0.2s;
}

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

.footer-bottom {
    border-top: 1px solid var(--border);
    padding: 20px 24px;
    text-align: center;
    font-size: 0.78rem;
    color: var(--ink-muted);
    max-width: var(--max-width-wide);
    margin: 0 auto;
}

/* ── ANIMATIONS ── */
@keyframes fadeSlideUp {
    from { opacity: 0; transform: translateY(12px); }
    to { opacity: 1; transform: translateY(0); }
}

.fade-in {
    animation: fadeSlideUp 0.4s ease;
}

/* ── RESPONSIVE ── */
@media (max-width: 768px) {
    .nav-links { display: none; }
    .nav-hamburger { display: block; }

    .nav-links.open {
        display: flex;
        flex-direction: column;
        position: absolute;
        top: 56px;
        left: 0;
        right: 0;
        background: var(--ink);
        border-bottom: 1px solid rgba(255,255,255,0.1);
        padding: 12px;
        gap: 4px;
    }

    .nav-links.open a {
        padding: 12px 16px;
    }

    .nav-dropdown-menu {
        position: static; background: transparent; border: none;
        box-shadow: none; min-width: 0; padding: 0 0 0 16px;
    }
    .nav-dropdown.open .nav-dropdown-menu { display: block; }
    .nav-dropdown:hover .nav-dropdown-menu { display: none; }
    .nav-dropdown.open:hover .nav-dropdown-menu { display: block; }
    .nav-dropdown-menu a { padding: 8px 16px; font-size: 0.82rem; }
    .nav-dropdown-cat { padding: 8px 16px 2px; }

    .footer-inner {
        grid-template-columns: 1fr;
        gap: 28px;
    }
}

@media (max-width: 640px) {
    .card-section { padding: 24px 20px; }
    .input-grid { grid-template-columns: 1fr; }
    .page-header-inner { padding: 36px 20px 32px; }
}

/* ── AD UNITS ── */
.ad-unit {
    max-width: var(--max-width);
    margin: 24px auto;
    padding: 0 24px;
    text-align: center;
}
.ad-unit-inner {
    background: var(--surface);
    border: 1px dashed var(--border);
    border-radius: 8px;
    padding: 20px;
    min-height: 90px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--ink-muted);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}
/* Once AdSense is active, hide the placeholder text */
.ad-unit-inner ins { width: 100%; }
.ad-unit-inner .ad-placeholder { display: block; }
.ad-unit-inner ins + .ad-placeholder { display: none; }

.ad-unit--article {
    max-width: 720px;
    padding: 0;
    margin: 2em auto;
}
.ad-unit--slim .ad-unit-inner {
    min-height: 60px;
}

/* ── Scroll Animations (added Feb 2026) ── */
@keyframes fadeUp { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }
@keyframes slideInLeft { from { opacity: 0; transform: translateX(-16px); } to { opacity: 1; transform: translateX(0); } }
.fade-up { animation: fadeUp .6s ease both; }
.fade-up-d1 { animation-delay: .1s; }
.fade-up-d2 { animation-delay: .2s; }
.fade-up-d3 { animation-delay: .3s; }

/* ── Enhanced card hover ── */
.tool-card { transition: all .28s cubic-bezier(.4,0,.2,1); }
.tool-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); }

/* ── Improved hero gradient ── */
.home-hero::after { 
    content: ''; position: absolute; bottom: 0; left: 0; right: 0; height: 120px; 
    background: linear-gradient(to bottom, transparent, var(--surface)); pointer-events: none; z-index: 1; 
}

/* ── Blog card improvements ── */
.blog-card { transition: all .25s ease; }
.blog-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); border-color: var(--accent); }

/* ── Footer email link ── */
.footer-email { color: var(--accent); font-weight: 500; }
.footer-email:hover { text-decoration: underline; }

/* Focus Visible - Keyboard Accessibility */
*:focus-visible {
  outline: 2px solid var(--accent, #58a6ff);
  outline-offset: 2px;
  border-radius: 3px;
}

a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
[tabindex]:focus-visible {
  outline: 2px solid var(--accent, #58a6ff);
  outline-offset: 2px;
}

.skip-link:focus {
  outline: 2px solid var(--accent, #58a6ff);
  outline-offset: 2px;
}

/* Screen reader only - visually hidden but accessible */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
