/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #2563eb;
    --primary-dark: #1e40af;
    --primary-light: #3b82f6;
    --secondary-color: #10b981;
    --accent-color: #f59e0b;
    --text-dark: #1f2937;
    --text-medium: #4b5563;
    --text-light: #6b7280;
    --text-lighter: #9ca3af;
    --bg-light: #f9fafb;
    --bg-white: #ffffff;
    --bg-gray: #f3f4f6;
    --border-color: #e5e7eb;
    --border-light: #f3f4f6;
    --shadow-sm: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --radius: 12px;
    --radius-sm: 8px;
}

html {
    scroll-behavior: smooth;
}

/* Use system fonts first to prevent CLS, Inter loads async */
body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    line-height: 1.6;
    color: var(--text-dark);
    background-color: var(--bg-white);
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}

/* Container */
.container {
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 24px;
}

/* Header - fixed min-height to prevent CLS */
.header {
    background-color: var(--bg-white);
    box-shadow: var(--shadow-sm);
    position: sticky;
    top: 0;
    z-index: 1000;
    border-bottom: 1px solid var(--border-color);
    min-height: 80px;
    contain: layout style;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 0;
    min-height: 56px;
}

.logo {
    font-size: 1.75rem;
    font-weight: 800;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-decoration: none;
    letter-spacing: -0.5px;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.logo-icon {
    display: block;
    object-fit: contain;
    flex-shrink: 0;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    border-radius: var(--radius-sm);
    padding: 0.25rem;
}

.logo-desktop {
    width: 48px;
    height: 48px;
    display: block;
}

.logo-mobile {
    width: 32px;
    height: 32px;
    display: none;
}

.nav {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    flex-wrap: wrap;
}

.nav-link {
    color: var(--text-medium);
    text-decoration: none;
    font-weight: 500;
    font-size: 0.95rem;
    padding: 0.625rem 1rem;
    border-radius: var(--radius-sm);
    position: relative;
    min-height: 40px;
    display: inline-flex;
    align-items: center;
}

.nav-link:hover {
    color: var(--primary-color);
    background-color: var(--bg-light);
}

.nav-link.active {
    color: var(--primary-color);
    background-color: rgba(37, 99, 235, 0.1);
}

.header-actions {
    display: flex;
    gap: 0.75rem;
    align-items: center;
}

.btn {
    padding: 0.625rem 1.25rem;
    border-radius: var(--radius-sm);
    font-weight: 600;
    font-size: 0.95rem;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    transition: var(--transition);
    border: none;
    cursor: pointer;
    white-space: nowrap;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    color: white;
    box-shadow: var(--shadow-md);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.btn-outline {
    background-color: transparent;
    color: var(--primary-color);
    border: 2px solid var(--primary-color);
}

.btn-outline:hover {
    background-color: var(--primary-color);
    color: white;
}

.btn-hero-outline {
    background: rgba(255, 255, 255, 0.1);
    color: white;
    border-color: white;
}

.btn-hero-outline:hover {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border-color: white;
}

/* Hero Section */
.hero {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 50%, #f093fb 100%);
    color: white;
    padding: 5rem 0;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.hero::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url('data:image/svg+xml,<svg width="100" height="100" xmlns="http://www.w3.org/2000/svg"><defs><pattern id="grid" width="100" height="100" patternUnits="userSpaceOnUse"><path d="M 100 0 L 0 0 0 100" fill="none" stroke="rgba(255,255,255,0.1)" stroke-width="1"/></pattern></defs><rect width="100" height="100" fill="url(%23grid)"/></svg>');
    opacity: 0.3;
}

.hero-content {
    position: relative;
    z-index: 1;
}

.hero-title {
    font-size: 3.5rem;
    font-weight: 800;
    margin-bottom: 1.5rem;
    line-height: 1.1;
    letter-spacing: -1px;
}

.hero-description {
    font-size: 1.25rem;
    opacity: 0.95;
    max-width: 700px;
    margin: 0 auto 2rem;
    line-height: 1.7;
}

.hero-cta {
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
    margin-top: 2rem;
}

.hero-stats {
    display: flex;
    justify-content: center;
    gap: 3rem;
    margin-top: 3rem;
    flex-wrap: wrap;
}

.stat-item {
    text-align: center;
}

.stat-number {
    font-size: 2.5rem;
    font-weight: 800;
    display: block;
    margin-bottom: 0.25rem;
}

.stat-label {
    font-size: 0.95rem;
    opacity: 0.9;
}

/* Section */
.section {
    padding: 5rem 0;
}

.section-alt {
    background-color: var(--bg-light);
}

.section-header {
    text-align: center;
    margin: 0 auto 3rem;
}

.section-title {
    font-size: 2.5rem;
    font-weight: 800;
    margin-bottom: 1rem;
    color: var(--text-dark);
    line-height: 1.2;
    letter-spacing: -0.5px;
    max-width: 700px;
    margin-left: auto;
    margin-right: auto;
}

.section-description {
    color: var(--text-medium);
    font-size: 1.1rem;
    line-height: 1.7;
    max-width: 100%;
    width: 100%;
}

/* Card Grid */
.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 2rem;
    margin-top: 2rem;
}

.card {
    background-color: var(--bg-white);
    border-radius: var(--radius);
    padding: 2rem;
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border-color);
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    min-height: 80px;
}

a.card {
    text-decoration: none;
    color: inherit;
    cursor: pointer;
}

a.card:hover {
    text-decoration: none;
    color: inherit;
}

a.card .card-title {
    color: var(--primary-color);
    margin: 0;
    text-align: center;
    font-weight: 700;
    position: relative;
    padding-right: 1.5rem;
    transition: var(--transition);
}

a.card .card-title::after {
    content: '→';
    position: absolute;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    font-size: 1.25rem;
    opacity: 0.7;
    transition: var(--transition);
}

a.card:hover .card-title {
    color: var(--primary-dark);
}

a.card:hover .card-title::after {
    opacity: 1;
    transform: translateY(-50%) translateX(4px);
}

a.card {
    justify-content: center;
    align-items: center;
}

.card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    transform: scaleX(0);
    transition: var(--transition);
}

.card:hover {
    transform: translateY(-8px);
    box-shadow: var(--shadow-xl);
    border-color: var(--primary-color);
}

.card:hover::before {
    transform: scaleX(1);
}

.card-icon {
    width: 56px;
    height: 56px;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1.5rem;
    font-size: 1.75rem;
    color: white;
    box-shadow: var(--shadow-md);
}

.card-title {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 0.75rem;
    color: var(--text-dark);
    line-height: 1.3;
}

.card-description {
    color: var(--text-medium);
    margin-bottom: 1.5rem;
    line-height: 1.7;
    flex-grow: 1;
}

.card-link {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    transition: var(--transition);
    font-size: 1rem;
    padding: 0.5rem 1rem;
    background: rgba(37, 99, 235, 0.08);
    border-radius: var(--radius-sm);
    border: 2px solid rgba(37, 99, 235, 0.2);
}

.card-link:hover {
    color: var(--primary-dark);
    gap: 0.75rem;
    background: rgba(37, 99, 235, 0.15);
    border-color: var(--primary-color);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.card-link::after {
    content: '→';
    transition: var(--transition);
    font-size: 1.1rem;
    font-weight: 700;
}

.card-link:hover::after {
    transform: translateX(6px);
}

/* Focus state for card links */
.card-link:focus {
    outline: 3px solid var(--primary-color);
    outline-offset: 2px;
}

/* Features Section */
.features {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 2rem;
    margin-top: 3rem;
}

.feature {
    text-align: center;
    padding: 1.5rem;
}

.feature-icon {
    width: 64px;
    height: 64px;
    background: linear-gradient(135deg, var(--secondary-color) 0%, #059669 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1rem;
    font-size: 1.75rem;
    color: white;
    box-shadow: var(--shadow-md);
}

.feature-title {
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    color: var(--text-dark);
}

.feature-description {
    color: var(--text-medium);
    font-size: 0.95rem;
    line-height: 1.6;
}

/* Footer */
.footer {
    background: linear-gradient(135deg, #1f2937 0%, #111827 100%);
    color: white;
    padding: 4rem 0 2rem;
    min-height: 300px;
    contain: layout style;
}

.footer-content {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 3rem;
    margin-bottom: 3rem;
}

.footer-section h3 {
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 1.5rem;
    color: white;
}

.footer-links {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.footer-links a {
    color: rgba(255, 255, 255, 0.8);
    text-decoration: none;
    transition: var(--transition);
    font-size: 0.95rem;
}

.footer-links a:hover {
    color: white;
    padding-left: 4px;
}

.footer-bottom {
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    padding-top: 2rem;
    text-align: center;
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.9rem;
}

.social-links {
    display: flex;
    gap: 1rem;
    margin-top: 1rem;
    justify-content: center;
}

.social-link {
    width: 40px;
    height: 40px;
    background-color: rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    text-decoration: none;
    transition: var(--transition);
}

.social-link:hover {
    background-color: var(--primary-color);
    transform: translateY(-2px);
}

/* Search Bar */
.search-bar {
    max-width: 600px;
    margin: 2rem auto;
    position: relative;
}

.search-input {
    width: 100%;
    padding: 1rem 1.5rem 1rem 3.5rem;
    border: 2px solid var(--border-color);
    border-radius: var(--radius);
    font-size: 1rem;
    transition: var(--transition);
    background-color: var(--bg-white);
}

.search-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.search-icon {
    position: absolute;
    left: 1.25rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-light);
    font-size: 1.25rem;
}

/* Responsive Design */
@media (max-width: 1024px) {
    .container {
        padding: 0 20px;
    }
    
    .hero-title {
        font-size: 2.75rem;
    }
    
    .card-grid {
        grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
        gap: 1.5rem;
    }
}

@media (max-width: 768px) {
    .logo-desktop {
        display: none;
    }
    
    .logo-mobile {
        display: block;
    }
    
    .header-content {
        flex-direction: column;
        gap: 1rem;
        padding: 1rem 0;
    }

    .nav {
        display: grid;
        grid-template-columns: repeat(3, 1fr);
        gap: 0.75rem;
        width: 100%;
        padding: 0;
    }

    .nav-link {
        font-size: 0.875rem;
        padding: 0.75rem 1rem;
        text-align: center;
        background-color: var(--bg-light);
        border: 1.5px solid var(--border-color);
        border-radius: var(--radius-sm);
        color: var(--text-dark);
        font-weight: 600;
        box-shadow: var(--shadow-sm);
        transition: var(--transition);
        white-space: nowrap;
        display: flex;
        align-items: center;
        justify-content: center;
        min-height: 44px;
    }

    .nav-link:hover,
    .nav-link:active {
        background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
        color: white;
        border-color: var(--primary-color);
        transform: translateY(-2px);
        box-shadow: var(--shadow-md);
    }

    .nav-link.active {
        background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
        color: white;
        border-color: var(--primary-color);
        box-shadow: var(--shadow-md);
    }

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

    .btn {
        font-size: 0.875rem;
        padding: 0.5rem 1rem;
    }

    .hero {
        padding: 3rem 0;
    }

    .hero-title {
        font-size: 2rem;
    }

    .hero-description {
        font-size: 1rem;
        margin-bottom: 1.5rem;
    }

    .hero-cta {
        flex-direction: column;
        align-items: stretch;
    }

    .hero-stats {
        gap: 2rem;
    }

    .stat-number {
        font-size: 2rem;
    }

    .section {
        padding: 3rem 0;
    }

    .section-title {
        font-size: 2rem;
    }

    .section-description {
        font-size: 1rem;
    }

    .card-grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }

    .card {
        padding: 1.5rem;
    }

    .footer-content {
        grid-template-columns: 1fr;
        gap: 2rem;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 0 16px;
    }

    .logo {
        font-size: 1.5rem;
    }

    .nav {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.5rem;
    }

    .nav-link {
        font-size: 0.8rem;
        padding: 0.625rem 0.75rem;
        min-height: 40px;
    }

    .hero-title {
        font-size: 1.75rem;
    }

    .section-title {
        font-size: 1.75rem;
    }

    .card {
        padding: 1.25rem;
    }

    .card-icon {
        width: 48px;
        height: 48px;
        font-size: 1.5rem;
    }
}

/* Performance Optimizations */
img {
    max-width: 100%;
    height: auto;
    display: block;
}

img[loading="lazy"] {
    content-visibility: auto;
}

/* Optimize paint and composite */
.header {
    contain: layout style;
}

.card {
    contain: layout style paint;
}

/* Reduce layout thrashing */
.logo-icon {
    aspect-ratio: 1;
}

/* Focus styles for accessibility */
.nav-link:focus,
.card-link:focus,
.btn:focus,
.search-input:focus {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

/* Smooth scroll */
html {
    scroll-behavior: smooth;
}

/* Loading states */
.card {
    will-change: transform;
}

/* Content Pages Styles */
.content-wrapper {
    max-width: 1280px;
    margin: 0 auto;
    width: 100%;
}

.content-block {
    margin-bottom: 2rem;
}

.content-block h2 {
    font-size: 1.75rem;
    font-weight: 700;
    margin-bottom: 1rem;
    color: var(--text-dark);
}

.content-block h3 {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 0.75rem;
    color: var(--text-dark);
}

.content-block p {
    color: var(--text-medium);
    line-height: 1.8;
    font-size: 1.05rem;
    margin-bottom: 1rem;
}

.content-block ul {
    color: var(--text-medium);
    line-height: 1.8;
    font-size: 1.05rem;
    padding-left: 1.5rem;
}

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

.content-block ul li:last-child {
    margin-bottom: 0;
}

.content-box {
    background: var(--bg-light);
    padding: 2rem;
    border-radius: var(--radius);
    margin-top: 3rem;
}

.content-box h2 {
    font-size: 1.75rem;
    font-weight: 700;
    margin-bottom: 1rem;
    color: var(--text-dark);
}

.content-box h3 {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--text-dark);
}

.content-box p {
    color: var(--text-medium);
    line-height: 1.8;
    font-size: 1.05rem;
    margin-bottom: 1.5rem;
}

.content-box p:last-child {
    margin-bottom: 0;
}

.content-highlight {
    background: var(--bg-light);
    padding: 2rem;
    border-radius: var(--radius);
    margin-top: 3rem;
    border-left: 4px solid var(--primary-color);
}

.content-highlight p:first-child {
    color: var(--text-dark);
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.content-highlight p:last-child {
    color: var(--text-medium);
    line-height: 1.8;
    font-size: 1.05rem;
    margin-bottom: 0;
}

.content-link {
    color: var(--primary-color);
    text-decoration: none;
    transition: var(--transition);
}

.content-link:hover {
    color: var(--primary-dark);
    text-decoration: underline;
}

.section-top-padding {
    padding-top: 3rem;
}

.card-grid-single {
    grid-template-columns: 1fr;
    gap: 2rem;
    margin-bottom: 3rem;
}

.card-grid-small {
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
}

.card-link-block {
    text-decoration: none;
    display: block;
}

/* Enhanced styling for card links to make them more prominent */
a.card.card-link-block {
    cursor: pointer;
    position: relative;
    justify-content: flex-start;
    align-items: center;
}

a.card.card-link-block .card-title {
    color: var(--primary-color);
    font-weight: 700;
    font-size: 1.5rem;
    text-align: left;
    margin: 0;
    padding: 0.5rem 2rem 0.5rem 1rem;
    position: relative;
    transition: var(--transition);
    width: 100%;
}

a.card.card-link-block .card-title::after {
    content: '→';
    position: absolute;
    right: 0.5rem;
    top: 50%;
    transform: translateY(-50%);
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--primary-color);
    opacity: 0.8;
    transition: var(--transition);
}

a.card.card-link-block:hover .card-title {
    color: var(--primary-dark);
    transform: scale(1.05);
}

a.card.card-link-block:hover .card-title::after {
    opacity: 1;
    transform: translateY(-50%) translateX(6px);
    color: var(--primary-dark);
}

/* Add a subtle background highlight on hover for better visibility */
a.card.card-link-block:hover {
    background: linear-gradient(135deg, rgba(37, 99, 235, 0.05) 0%, rgba(30, 64, 175, 0.05) 100%);
}

/* Focus state for accessibility */
a.card.card-link-block:focus {
    outline: 3px solid var(--primary-color);
    outline-offset: 2px;
}

a.card.card-link-block:focus .card-title {
    color: var(--primary-dark);
}

.footer-text {
    color: rgba(255, 255, 255, 0.8);
    margin-top: 1rem;
    line-height: 1.7;
}

.content-spacing {
    margin-top: 1.5rem;
}

.content-spacing p {
    margin-bottom: 0.75rem;
}

.content-spacing p:last-child {
    margin-bottom: 0;
}

.content-box-small {
    background: var(--bg-light);
    padding: 1.5rem;
    border-radius: var(--radius-sm);
    margin-bottom: 1rem;
}

.content-box-small h3 {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 0.75rem;
    color: var(--text-dark);
}

.content-box-small p {
    color: var(--text-medium);
    line-height: 1.8;
    font-size: 1.05rem;
    margin-bottom: 0;
}

/* Breadcrumbs - min-height to prevent CLS */
.breadcrumbs {
    padding: 1rem 0;
    margin-bottom: 2rem;
    border-bottom: 1px solid var(--border-color);
    min-height: 52px;
}

.breadcrumb-list {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
    list-style: none;
    margin: 0;
    padding: 0;
}

.breadcrumb-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-medium);
    font-size: 0.95rem;
}

.breadcrumb-item:not(:last-child)::after {
    content: '›';
    color: var(--text-light);
    margin-left: 0.5rem;
}

.breadcrumb-link {
    color: var(--text-medium);
    text-decoration: none;
    transition: var(--transition);
}

.breadcrumb-link:hover {
    color: var(--primary-color);
}

.breadcrumb-item.active {
    color: var(--text-dark);
    font-weight: 500;
}

/* Print styles */
@media print {
    .header,
    .footer,
    .hero-cta {
        display: none;
    }
}
