:root {
    /* Light Theme - Refined, softer palette */
    --bg-color: #fafbfc;
    --surface-color: #ffffff;
    --text-primary: #1a202c;
    --text-secondary: #5a6577;
    --accent-color: #0369a1;
    /* Sky 700: readable normal-size links on white surfaces. */
    --accent-light: #0ea5e9;
    /* Sky 500 */
    --border-color: #e8ecf0;
    --header-bg: rgba(255, 255, 255, 0.95);
    /* Focus Ring */
    --focus-ring: 0 0 0 3px rgba(2, 132, 199, 0.35);

    /* Typography Scale (1.25 ratio) */
    --text-xs: 0.75rem;     /* 12px - captions, labels */
    --text-sm: 0.875rem;    /* 14px - secondary text */
    --text-base: 1rem;      /* 16px - body */
    --text-lg: 1.125rem;    /* 18px - large body */
    --text-xl: 1.25rem;     /* 20px - subheadings */
    --text-2xl: 1.5rem;     /* 24px - headings */
    --text-3xl: 1.875rem;   /* 30px - large headings */
    --text-4xl: 2.25rem;    /* 36px - display */
    --text-5xl: 3rem;       /* 48px - hero */
    --text-6xl: 3.75rem;    /* 60px - large hero */

    /* Font Weights */
    --font-regular: 400;
    --font-medium: 500;
    --font-semibold: 600;
    --font-bold: 700;
    --font-extrabold: 800;

    /* Line Heights */
    --leading-tight: 1.15;
    --leading-snug: 1.35;
    --leading-normal: 1.5;
    --leading-relaxed: 1.625;

    /* Letter Spacing */
    --tracking-tight: -0.02em;
    --tracking-normal: 0;
    --tracking-wide: 0.02em;
}

/* Skip Link (WCAG 2.4.1 Bypass Blocks) */
.skip-link {
    position: absolute;
    top: -100%;
    left: 50%;
    transform: translateX(-50%);
    background: var(--accent-color);
    color: white;
    padding: 0.75rem 1.5rem;
    border-radius: 0 0 8px 8px;
    font-weight: 600;
    z-index: 9999;
    transition: top 0.2s ease;
    text-decoration: none;
}

.skip-link:focus {
    top: 0;
    outline: none;
    box-shadow: var(--focus-ring);
}

/* Focus Visible Styles */
:focus-visible {
    outline: 2px solid var(--accent-color);
    outline-offset: 2px;
}

button:focus-visible,
a:focus-visible {
    box-shadow: var(--focus-ring);
}

/* Reduced Motion Support */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }

    .cursor {
        animation: none;
        opacity: 1;
    }
}

[data-theme="dark"] .cta-btn,
[data-theme="dark"] .skip-link {
    color: #0f172a;
}

[data-theme="dark"] .cta-btn:hover {
    color: #fff;
}

[data-theme="dark"] {
    /* Dark Theme (Navy/Slate) */
    --bg-color: #0f172a;
    /* Slate 900 */
    --surface-color: #1e293b;
    /* Slate 800 */
    --text-primary: #f1f5f9;
    /* Slate 100 */
    --text-secondary: #94a3b8;
    /* Slate 400 */
    --accent-color: #38bdf8;
    /* Sky 400 */
    --border-color: #334155;
    --header-bg: rgba(15, 23, 42, 0.8);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
    transition: background-color 0.3s, color 0.3s;
}

body {
    background-color: var(--bg-color);
    color: var(--text-primary);
    line-height: 1.6;
    overflow-x: hidden;
}

a {
    text-decoration: none;
    color: inherit;
}

/* Header Options */
.header {
    background-color: rgba(255, 255, 255, 0.95);
    /* More solid, less glass */
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);
    padding: 1rem 5%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: fixed;
    /* Floating */
    top: 0;
    left: 0;
    width: 100%;
    z-index: 1000;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
    /* Subtle shadow instead of blur */
    transition: background-color 0.3s cubic-bezier(0.16, 1, 0.3, 1), padding 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Dark mode overrides for header */
[data-theme="dark"] .header {
    background-color: rgba(15, 23, 42, 0.95);
    /* More solid */
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

/* Optional header shrink class on scroll for JS handling */
.header.scrolled {
    padding: 0.5rem 5%;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.03);
}

.nav-links {
    list-style: none;
    display: flex;
    gap: 2rem;
}

.logo {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.5px;
    display: flex;
    align-items: center;
}

.header-logo {
    height: 48px;
    width: auto;
    object-fit: contain;
    display: block;
    transform: scale(2.5);
    transform-origin: left center;
}

.controls {
    display: flex;
    gap: 1rem;
    align-items: center;
}

.icon-btn {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-primary);
    font-size: 1.2rem;
    padding: 0.5rem;
    border-radius: 50%;
    transition: background 0.2s;
}

.icon-btn:hover {
    background-color: var(--border-color);
}

/* Hero Section */
.hero {
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    position: relative;
    padding: 0 5%;
    overflow: hidden;
    padding-top: 80px;
    /* Offset for fixed header */
    background: var(--bg-color);
    /* Simplified - no gradient */
}

#particles-canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    contain: strict;
    /* Performance: Isolate canvas from layout */
}

.hero-content {
    position: relative;
    z-index: 1;
    width: 100%;
    /* Above canvas */
    display: flex;
    flex-direction: column;
    align-items: center;
}

.hero h1 {
    font-size: clamp(2rem, 5vw + 1rem, 3.5rem);
    /* Fluid typography: 2rem min → 3.5rem max */
    font-weight: 800;
    margin-bottom: 2rem;
    /* Increased margin since subtitle is gone */
    min-height: 1.2em;
    background: none;
    /* Removed gradient for typewriter clarity */
    color: var(--text-primary);
    letter-spacing: -0.02em;
    /* Tighter tracking for large display text */
}

/* The complete heading reserves its final size before the animation starts. */
.hero-title {
    position: relative;
    width: 100%;
}

.hero-title-text::after {
    content: '';
    display: inline-block;
    width: 7px;
    height: 1em;
}

.hero-title-animation {
    display: none;
    position: absolute;
    inset: 0;
    pointer-events: none;
}

.hero-title.is-typing .hero-title-text {
    opacity: 0;
}

.hero-title.is-typing .hero-title-animation {
    display: block;
}

@media (prefers-reduced-motion: reduce) {
    .hero-title.is-typing .hero-title-text {
        opacity: 1;
    }

    .hero-title.is-typing .hero-title-animation {
        display: none;
    }
}

/* Typewriter Cursor */
.cursor {
    display: inline-block;
    width: 3px;
    background-color: var(--accent-color);
    animation: blink 1s infinite;
    margin-left: 4px;
    vertical-align: baseline;
    height: 1em;
}

@keyframes blink {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0;
    }
}

.hero p {
    /* Display is handled by fade-in-up now, removing display:none constraint to allow flow */
    margin-bottom: 2rem;
    font-size: clamp(1rem, 2vw + 0.5rem, 1.25rem);
    /* Fluid: 1rem → 1.25rem */
    color: var(--text-secondary);
}

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

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

.fade-in-up {
    opacity: 0;
    animation: fadeInUp 0.8s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.cta-btn {
    background-color: var(--accent-color);
    color: #fff;
    padding: 0.85rem 2.5rem;
    border-radius: 99px;
    font-weight: 600;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 2px 8px rgba(2, 132, 199, 0.25);
    /* Lighter shadow */
    letter-spacing: 0.02em;
}

.cta-btn:hover {
    transform: translateY(-2px);
    /* Smaller movement */
    box-shadow: 0 4px 12px rgba(2, 132, 199, 0.35);
    /* Subtler shadow increase */
    background-color: #0369a1;
    /* Slightly darker, not full contrast flip */
}

/* Showcase Grid */
.showcase {
    padding: 5rem 5%;
}

.section-title {
    text-align: center;
    font-size: clamp(1.5rem, 3vw + 0.5rem, 2rem);
    /* Fluid: 1.5rem → 2rem */
    margin-bottom: 3rem;
    color: var(--text-primary);
}

.grid {
    display: flex;
    justify-content: center;
    gap: 2rem;
    flex-wrap: wrap;
}

.card {
    background-color: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    /* Slightly smaller radius */
    padding: 2rem;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    /* Faster, smoother transition */
    display: flex;
    flex-direction: column;
    height: 100%;
    width: 100%;
    max-width: 400px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
    /* Very subtle shadow */
}

.card:hover {
    transform: translateY(-4px);
    /* Smaller movement */
    border-color: rgba(2, 132, 199, 0.3);
    /* Softer border color */
    box-shadow: 0 8px 16px -4px rgba(0, 0, 0, 0.08);
    /* Gentler shadow */
}

.card-icon {
    width: 60px;
    height: 60px;
    background-color: rgba(3, 105, 161, 0.1);
    /* Sky tone background */
    border-radius: 50%;
    /* Circle background */
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1.5rem;
    color: var(--accent-color);
}

.card-icon-img {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.card-icon-img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.card h3 {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
}

.card p {
    color: var(--text-secondary);
    flex-grow: 1;
    margin-bottom: 1.5rem;
}

.card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: auto;
}

.card-link {
    color: var(--accent-color);
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 0;
    transition: color 0.3s ease;
}

.card-arrow {
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    display: inline-block;
}

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

/* About Section */
.about {
    padding: 5rem 5%;
    background-color: var(--surface-color);
    text-align: center;
}

.about p {
    max-width: 800px;
    margin: 0 auto;
    font-size: 1.2rem;
    color: var(--text-secondary);
}

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

.feature {
    flex: 1;
    min-width: 250px;
    max-width: 350px;
}

/* Scroll Reveal classes */
.reveal {
    opacity: 0;
    transform: translateY(30px);
    transition: all 0.8s cubic-bezier(0.16, 1, 0.3, 1);
    /* Performance optimization */
    content-visibility: auto;
    contain-intrinsic-size: 200px;
}

.reveal.active {
    opacity: 1;
    transform: translateY(0);
}

.feature h3 {
    margin-bottom: 0.5rem;
    font-size: 1.2rem;
}

/* Footer */
footer {
    padding: 3rem 5%;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    flex-wrap: wrap;
    align-items: center;
    gap: 1rem;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.footer-links a {
    margin-left: 1.5rem;
    transition: color 0.2s;
}

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

/* Responsive */
@media (max-width: 768px) {
    .hero h1 {
        font-size: 2.5rem;
    }

    header {
        padding: 1rem;
    }

    footer {
        flex-direction: column;
        text-align: center;
    }

    .footer-links a {
        margin: 0 0.5rem;
    }

    .card {
        padding: 1.5rem;
    }

    .about p {
        font-size: 1rem;
        padding: 0 1rem;
    }
}

/* Extra small screens (320px-480px) */
@media (max-width: 480px) {
    .hero {
        padding-top: 100px;
    }

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

    .hero p {
        font-size: 1rem;
    }

    .cta-btn {
        padding: 0.75rem 2rem;
        font-size: 0.95rem;
    }

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

    .card h3 {
        font-size: 1.25rem;
    }

    .card p {
        font-size: 0.95rem;
    }

    .feature {
        min-width: 100%;
        padding: 0 1rem;
    }

    .feature h3 {
        font-size: 1.1rem;
    }

    .features {
        gap: 2rem;
    }
}
