@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600&family=Poppins:wght@600;700;800&family=Sora:wght@400;600;700&display=swap');

:root {
    --bg-dark: #f8fafc;
    --bg-card: rgba(255, 255, 255, 0.8);
    --primary: #4f46e5;
    --primary-gradient: linear-gradient(135deg, #6366f1 0%, #a855f7 100%);
    --secondary-gradient: linear-gradient(135deg, #06b6d4 0%, #3b82f6 100%);
    --accent: #f43f5e;
    --text-main: #0f172a;
    --text-muted: #64748b;
    --border: rgba(15, 23, 42, 0.1);
    --glass-bg: #ffffff;
    --glass-blur: none;
    --header-bg: #ffffff;
    --transition: all 0.2s ease-out;
}

[data-theme="dark"] {
    --bg-dark: #0a0c10;
    --bg-card: rgba(255, 255, 255, 0.05);
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --border: rgba(255, 255, 255, 0.1);
    --glass-bg: #1e293b;
    --header-bg: #0a0c10;
}

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

body {
    background-color: var(--bg-dark);
    color: var(--text-main);
    font-family: 'Inter', sans-serif;
    line-height: 1.6;
    overflow-x: hidden;
    min-height: 100vh;
}

h1,
h2,
h3 {
    font-family: 'Poppins', sans-serif;
    letter-spacing: -0.02em;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 2rem;
}

/* Header & Nav */
body>header {
    height: 70px;
    border-bottom: 1px solid var(--border);
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    background: var(--header-bg);
    /* Removed backdrop-filter for performance */
    display: flex;
    align-items: center;
}

/* Add padding to body to account for fixed header */
body {
    padding-top: 70px;
}

nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    font-size: 1.5rem;
    font-weight: 800;
    background: var(--primary-gradient);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    text-decoration: none;
    display: flex;
    align-items: center;
}

.nav-links {
    display: flex;
    align-items: center;
}

.nav-links a {
    color: var(--text-muted);
    text-decoration: none;
    margin-left: 2rem;
    font-size: 0.9rem;
    font-weight: 500;
    transition: var(--transition);
}

.nav-links a:hover {
    color: var(--text-main);
}

.nav-links #theme-toggle {
    margin-left: 2rem;
}

.btn-nav-premium {
    background: var(--primary-gradient);
    color: white !important;
    padding: 0.5rem 1.2rem !important;
    border-radius: 999px;
    font-size: 0.8rem !important;
    font-weight: 600 !important;
    transition: var(--transition);
    border: none;
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.3);
}

.btn-nav-premium:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(99, 102, 241, 0.4);
    opacity: 0.9;
}

.menu-toggle {
    display: none;
    flex-direction: column;
    justify-content: space-between;
    width: 30px;
    height: 21px;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0;
    z-index: 1001;
}

.menu-toggle span {
    width: 100%;
    height: 3px;
    background-color: var(--text-main);
    border-radius: 10px;
    transition: all 0.3s linear;
    position: relative;
    transform-origin: 1px;
}

/* Hamburger Animation */
.menu-toggle.open span:first-child {
    transform: rotate(45deg);
}

.menu-toggle.open span:nth-child(2) {
    opacity: 0;
    transform: translateX(20px);
}

.menu-toggle.open span:last-child {
    transform: rotate(-45deg);
}

/* Hero Section */
.hero {
    padding: 5rem 0;
    text-align: center;
    background: transparent;
    /* Removed radial-gradient */
}

.hero h1 {
    font-size: 3.5rem;
    margin-bottom: 1.5rem;
    background: linear-gradient(to bottom, var(--text-main) 0%, var(--text-muted) 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.hero p {
    font-size: 1.25rem;
    color: var(--text-muted);
    max-width: 600px;
    margin: 0 auto 2.5rem;
}

/* Components */
.glass-card {
    background: var(--glass-bg);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 2rem;
    transition: transform 0.2s ease-out;
    display: flex;
    flex-direction: column;
}

.glass-card h3 {
    margin-bottom: 1rem;
}

.glass-card p {
    flex-grow: 1;
    margin-bottom: 1.5rem;
}

.glass-card p:last-child {
    margin-bottom: 0;
}

.glass-card .btn {
    margin-top: 1.5rem;
    align-self: flex-start;
}

.glass-card:hover {
    transform: translateY(-5px);
    border-color: rgba(99, 102, 241, 0.4);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
}

.feature-icon {
    margin-bottom: 1.5rem;
    color: #6366f1;
    /* Indigo color matching the theme */
}

.feature-icon svg {
    stroke: #6366f1;
    filter: drop-shadow(0 4px 6px rgba(99, 102, 241, 0.2));
}

.btn {
    display: inline-block;
    padding: 1rem 2rem;
    border-radius: 9999px;
    font-weight: 600;
    text-decoration: none;
    transition: var(--transition);
    cursor: pointer;
    border: none;
}

.btn-primary {
    background: var(--primary-gradient);
    color: white;
    box-shadow: 0 10px 20px -5px rgba(99, 102, 241, 0.5);
}

.btn-primary:hover {
    box-shadow: 0 15px 30px -5px rgba(99, 102, 241, 0.6);
    transform: scale(1.02);
}

/* Calculator Form */
.calc-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    margin-top: 3rem;
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    color: var(--text-muted);
    font-size: 0.9rem;
}

.form-group input,
.form-group select {
    width: 100%;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 0.8rem 1rem;
    color: var(--text-main);
    font-family: inherit;
    transition: var(--transition);
}

.form-group input:focus {
    outline: none;
    border-color: var(--primary);
    background: rgba(255, 255, 255, 0.08);
}

.form-group p {
    margin-bottom: 0;
    margin-top: 0.5rem;
}

/* State Grid */
.state-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 1rem;
    margin-top: 3rem;
}

.state-card {
    text-align: center;
    padding: 1.5rem;
    border-radius: 15px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    text-decoration: none;
    color: var(--text-main);
    transition: var(--transition);
}

.state-card:hover {
    background: var(--primary-gradient);
    border-color: transparent;
    transform: translateY(-3px);
}

.state-card .abbr {
    display: block;
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 0.2rem;
}

.state-card:hover .abbr {
    color: rgba(255, 255, 255, 0.8);
}

.state-card.coming-soon {
    opacity: 0.5;
    cursor: default;
    pointer-events: none;
    /* Disable all interactions including hover animation */
}

.state-card.coming-soon-container {
    opacity: 0.6;
    cursor: default;
    position: relative;
}

.state-card.coming-soon-container:hover {
    transform: none;
    background: var(--bg-card);
    border-color: var(--border);
}

.state-card.coming-soon-container .abbr {
    color: var(--text-muted);
}

/* Tables */
.table-container {
    overflow-x: auto;
    margin-top: 2rem;
}

table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
}

th,
td {
    padding: 1rem;
    border-bottom: 1px solid var(--border);
}

th {
    color: var(--text-muted);
    font-weight: 500;
    font-size: 0.9rem;
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.animate-in {
    opacity: 1;
    transform: translateY(0);
    will-change: opacity, transform;
    visibility: visible;
}

.animate-in.visible {
    opacity: 1;
    transform: translateY(0);
    visibility: visible;
}

@media (max-width: 768px) {
    .container {
        padding: 0 1.5rem;
    }

    .hero h1 {
        font-size: 2.5rem;
    }

    .calc-grid {
        grid-template-columns: 1fr;
    }

    .hero {
        padding: 3rem 0;
    }

    .menu-toggle {
        display: flex;
    }

    .nav-links {
        position: fixed;
        top: 0;
        right: -100%;
        height: 100vh;
        width: 70%;
        max-width: 300px;
        background: var(--header-bg);
        flex-direction: column;
        justify-content: center;
        align-items: center;
        gap: 2.5rem;
        transition: right 0.3s ease-in-out;
        box-shadow: -10px 0 30px rgba(0, 0, 0, 0.1);
        z-index: 1000;
    }

    .nav-links.active {
        right: 0;
    }

    .nav-links a {
        font-size: 1.2rem;
        margin: 0;
    }

    .nav-links #theme-toggle {
        margin-left: 0;
    }

    /* Overlay when menu is open */
    .menu-overlay {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100vh;
        background: rgba(0, 0, 0, 0.5);
        opacity: 0;
        visibility: hidden;
        transition: all 0.3s ease-in-out;
        z-index: 999;
    }

    .menu-overlay.active {
        opacity: 1;
        visibility: visible;
    }
}

/* Blog Styles */
.blog-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 2.5rem;
    margin-top: 3rem;
}

.blog-card {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.blog-card .image-placeholder {
    width: 100%;
    height: 220px;
    background: var(--primary-gradient);
    border-radius: 12px;
    margin-bottom: 1rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: white;
    padding: 2rem;
    text-align: center;
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

.blog-card .image-placeholder h3 {
    margin: 0;
    font-size: 1.5rem;
    line-height: 1.2;
    font-weight: 700;
    color: white !important;
    z-index: 2;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.5);
}

.blog-card .image-placeholder h3 a {
    color: white !important;
    text-decoration: none;
}

/* Make entire placeholder clickable if it contains a link */
.blog-card-link {
    text-decoration: none;
    display: block;
    color: inherit;
}

.blog-card:hover .image-placeholder {
    transform: translateY(-5px);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15), inset 0 0 100px rgba(0, 0, 0, 0.2);
}

/* Category Specific Highlights */
.blog-card[data-category="calculations"] .image-placeholder {
    background: linear-gradient(135deg, #6366f1 0%, #a855f7 100%);
}

.blog-card[data-category="mortgage-basics"] .image-placeholder {
    background: linear-gradient(135deg, #06b6d4 0%, #3b82f6 100%);
}

.blog-card[data-category="home-affordability"] .image-placeholder {
    background: linear-gradient(135deg, #f59e0b 0%, #ef4444 100%);
}

.blog-card[data-category="refinancing"] .image-placeholder {
    background: linear-gradient(135deg, #10b981 0%, #3b82f6 100%);
}

.blog-category {
    display: inline-block;
    padding: 0.3rem 0.8rem;
    border-radius: 20px;
    background: rgba(15, 23, 42, 0.05);
    color: var(--text-muted);
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    margin-bottom: 0.8rem;
    border: 1px solid var(--border);
}

/* Remove the display:none that was hiding titles */
.blog-card>h3 {
    display: none;
}

.blog-card p {
    color: var(--text-muted);
    font-size: 0.95rem;
    margin-bottom: 1.5rem;
    flex-grow: 1;
}

.blog-card .meta {
    font-size: 0.85rem;
    color: var(--text-muted);
    display: flex;
    gap: 1rem;
}

/* Article Page Styles */
.article-header {
    padding: 5rem 0 3rem;
    text-align: center;
}

.article-header h1 {
    font-size: 3.5rem;
    max-width: 900px;
    margin: 0 auto 1.5rem;
}

.article-content {
    max-width: 800px;
    margin: 0 auto 5rem;
    font-size: 1.1rem;
    line-height: 1.8;
}

.article-content h2 {
    margin: 3rem 0 1.5rem;
    font-size: 2rem;
}

.article-content h3 {
    margin: 2rem 0 1rem;
    font-size: 1.5rem;
}

.article-content p {
    margin-bottom: 1.5rem;
}

.article-content ul,
.article-content ol {
    margin-bottom: 1.5rem;
    padding-left: 1.5rem;
}

.article-content li {
    margin-bottom: 0.5rem;
}

.article-content blockquote {
    border-left: 4px solid var(--primary);
    padding: 1rem 2rem;
    background: var(--bg-card);
    border-radius: 0 12px 12px 0;
    margin: 2rem 0;
    font-style: italic;
    color: var(--text-main);
}

/* Blog Filter */
.blog-filters {
    display: flex;
    justify-content: center;
    gap: 1rem;
    margin-bottom: 3rem;
    flex-wrap: wrap;
}

.filter-btn {
    padding: 0.6rem 1.2rem;
    border-radius: 9999px;
    border: 1px solid var(--border);
    background: var(--bg-card);
    color: var(--text-main);
    cursor: pointer;
    transition: var(--transition);
    font-weight: 500;
}

.filter-btn.active,
.filter-btn:hover {
    background: var(--primary-gradient);
    color: white;
    border-color: transparent;
}

/* Legal & Compliance */
.cookie-banner {
    position: fixed;
    bottom: 2rem;
    left: 2rem;
    right: 2rem;
    z-index: 2000;
    max-width: 1200px;
    margin: 0 auto;
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 1.5rem 2rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 2rem;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.2);
    transform: translateY(150%);
    transition: transform 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}

.cookie-banner.visible {
    transform: translateY(0);
}

.cookie-banner p {
    font-size: 0.9rem;
    color: var(--text-main);
    margin: 0;
}

.cookie-actions {
    display: flex;
    gap: 1rem;
    flex-shrink: 0;
}

.legal-disclaimer {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 1rem;
    text-align: center;
    opacity: 0.7;
    font-style: italic;
}

@media (max-width: 768px) {
    .cookie-banner {
        flex-direction: column;
        bottom: 1rem;
        left: 1rem;
        right: 1rem;
        padding: 1.5rem;
        text-align: center;
    }

    .cookie-actions {
        width: 100%;
        justify-content: center;
    }
}