/* Reset and base styles */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

:root {
    --color-text: #1a1a1a;
    --color-text-light: #555;
    --color-background: #f0f0f0;
    --color-background-alt: #e4e4e4;
    --color-accent: #2563eb;
    --color-border: #e5e7eb;
    --font-family: 'Fira Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --max-width: 1100px;
    --spacing-xs: 0.5rem;
    --spacing-sm: 1rem;
    --spacing-md: 2rem;
    --spacing-lg: 4rem;
    --spacing-xl: 6rem;
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        --color-text: #f0f0f0;
        --color-text-light: #a0a0a0;
        --color-background: #1a1a2e;
        --color-background-alt: #252538;
        --color-accent: #60a5fa;
        --color-border: #3a3a4a;
    }
}

:root[data-theme="dark"] {
    --color-text: #f0f0f0;
    --color-text-light: #a0a0a0;
    --color-background: #1a1a2e;
    --color-background-alt: #252538;
    --color-accent: #60a5fa;
    --color-border: #3a3a4a;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-family);
    font-size: 16px;
    line-height: 1.6;
    color: var(--color-text);
    background-color: var(--color-background);
}

.container {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0 var(--spacing-md);
}

/* Typography */
h1,
h2,
h3,
h4 {
    line-height: 1.3;
    font-weight: 600;
}

h1 {
    font-size: 2.5rem;
    margin-bottom: var(--spacing-sm);
}

h2 {
    font-size: 1.75rem;
    margin-bottom: var(--spacing-md);
}

/* Sticky section headers */
.section-header {
    position: sticky;
    top: 100px;
    /* below fixed header */
    z-index: 50;
    background: var(--color-background);
    padding: var(--spacing-sm) var(--spacing-md);
    padding-left: max(230px, calc(50vw - var(--max-width) / 2 + var(--spacing-md)));
    margin: 0;
    margin-bottom: var(--spacing-md);
    border-bottom: 1px solid var(--color-border);
}

.services .section-header {
    background: var(--color-background-alt);
}

.header-flourish {
    position: absolute;
    left: 60px;
    top: 50%;
    transform: translateY(-50%);
    width: 120px;
    height: 3px;
    background: linear-gradient(90deg, transparent, var(--color-accent), transparent);
    opacity: 0.4;
}

.header-flourish::before {
    content: '';
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    width: 8px;
    height: 8px;
    background: var(--color-accent);
    border-radius: 50%;
    opacity: 0.8;
}

h3 {
    font-size: 1.25rem;
    margin-bottom: var(--spacing-sm);
    color: var(--color-text);
}

h4 {
    font-size: 1.1rem;
    margin-bottom: var(--spacing-xs);
}

p {
    margin-bottom: var(--spacing-sm);
}

a {
    color: var(--color-accent);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

ul {
    padding-left: 1.5rem;
}

li {
    margin-bottom: var(--spacing-xs);
}

/* Header */
header {
    position: sticky;
    top: 0;
    background: #fefefe;
    border-bottom: 1px solid var(--color-border);
    z-index: 100;
    height: 100px;
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) header {
        background: #03033f;
    }
}

:root[data-theme="dark"] header {
    background: #03033f;
}

header nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 var(--spacing-md);
    height: 100%;
}

.logo-placeholder {
    width: 200px;
}

/* Fixed logo at top */
.sticky-logo {
    position: fixed;
    top: 5px;
    left: var(--spacing-md);
    z-index: 102;
    display: block;
}

.sticky-logo img {
    height: 180px;
    width: auto;
}

/* Space for fixed logo */
.hero-text {
    padding-top: 0;
}

/* Logo theme switching */
.logo-dark {
    display: none !important;
}

.logo-light {
    display: block !important;
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) .logo-light {
        display: none !important;
    }

    :root:not([data-theme="light"]) .logo-dark {
        display: block !important;
    }
}

:root[data-theme="dark"] .logo-light {
    display: none !important;
}

:root[data-theme="dark"] .logo-dark {
    display: block !important;
}

.nav-links {
    display: flex;
    list-style: none;
    gap: var(--spacing-md);
    padding: 0;
}

.nav-links a {
    color: var(--color-text);
    font-weight: 500;
    font-size: 0.95rem;
}

.nav-links a:hover {
    color: var(--color-accent);
    text-decoration: none;
}

/* Theme Toggle */
.theme-toggle {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.5rem;
    color: var(--color-text);
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: background-color 0.2s;
}

.theme-toggle:hover {
    background-color: var(--color-background-alt);
}

.theme-toggle .icon-moon {
    display: none;
}

.theme-toggle .icon-sun {
    display: block;
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) .theme-toggle .icon-sun {
        display: none;
    }

    :root:not([data-theme="light"]) .theme-toggle .icon-moon {
        display: block;
    }
}

:root[data-theme="dark"] .theme-toggle .icon-sun {
    display: none;
}

:root[data-theme="dark"] .theme-toggle .icon-moon {
    display: block;
}

/* Hero Section */
.hero {
    padding: var(--spacing-xl) 0;
    background: var(--color-background-alt);
}

.hero-content {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--spacing-lg);
    align-items: center;
}

.hero h1 {
    max-width: 700px;
}

.hero .subtitle {
    font-size: 1.25rem;
    color: var(--color-text-light);
    margin-bottom: var(--spacing-md);
    max-width: 600px;
}

.hero .intro {
    font-size: 1.1rem;
    max-width: 700px;
    color: var(--color-text-light);
}

.hero-image img {
    width: 100%;
    height: auto;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

/* About Section */
.about {
    padding: var(--spacing-xl) 0;
}

.about-content {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--spacing-lg);
    align-items: center;
}

.about p {
    max-width: 700px;
    color: var(--color-text-light);
}

.expertise {
    margin-top: var(--spacing-lg);
}

.expertise ul {
    color: var(--color-text-light);
}

.about-image img {
    width: 100%;
    height: auto;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

/* Services Section */
.services {
    padding: var(--spacing-xl) 0;
    background: var(--color-background-alt);
}

.services-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--spacing-lg);
}

.service-category {
    background: var(--color-background);
    padding: var(--spacing-md);
    border-radius: 8px;
    border: 1px solid var(--color-border);
}

.service-category>h3 {
    color: var(--color-accent);
    margin-bottom: var(--spacing-md);
    padding-bottom: var(--spacing-sm);
    border-bottom: 1px solid var(--color-border);
}

.service-item {
    margin-bottom: var(--spacing-md);
}

.service-item:last-child {
    margin-bottom: 0;
}

.service-item p,
.service-item ul {
    color: var(--color-text-light);
    font-size: 0.95rem;
}

.service-item ul {
    margin-top: var(--spacing-xs);
}

/* Contact Section */
.contact {
    padding: var(--spacing-xl) 0;
}

.contact-info {
    margin: var(--spacing-md) 0;
}

.contact-info p {
    margin-bottom: var(--spacing-xs);
}

.legal {
    margin-top: var(--spacing-md);
    font-size: 0.9rem;
    color: var(--color-text-light);
    font-style: italic;
}

/* Footer */
footer {
    padding: var(--spacing-md) 0;
    background: #111;
    color: #fff;
    text-align: center;
}

footer p {
    font-size: 0.9rem;
    margin: 0;
    opacity: 0.8;
}

/* Transitions */
h1,
h2,
header,
header nav,
.logo-placeholder,
.nav-links,
.nav-links a,
.theme-toggle,
.sticky-logo,
.sticky-logo img,
.section-header,
.header-flourish {
    transition: all 0.3s ease;
}

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

    h2 {
        font-size: 1.5rem;
    }

    .sticky-logo img {
        height: 100px;
    }

    .sticky-logo {
        top: 4px;
        left: var(--spacing-sm);
    }

    .logo-placeholder {
        width: 130px;
    }

    header nav {
        position: static;
        /* Reset relative if needed, or just remove the rule */
    }

    /* Theme Toggle joins flex flow */
    .theme-toggle {
        position: static;
        margin-left: 0;
    }


    header {
        height: 60px;
    }

    .section-header {
        top: 60px;
        padding-left: 140px;
        padding-top: var(--spacing-xs);
        padding-bottom: var(--spacing-xs);
    }

    .header-flourish {
        left: 28px;
        width: 76px;
    }

    .hero {
        padding: var(--spacing-lg) 0;
    }

    .hero-content {
        grid-template-columns: 1fr;
    }

    .hero-logo {
        width: 140px;
    }

    .hero-image {
        order: -1;
    }

    .hero .subtitle {
        font-size: 1.1rem;
    }

    .about-content {
        grid-template-columns: 1fr;
    }

    .about-image {
        order: -1;
    }

    .services-grid {
        grid-template-columns: 1fr;
        gap: var(--spacing-md);
    }

    .nav-links {
        gap: var(--spacing-sm);
    }

    .about,
    .services,
    .contact {
        padding: var(--spacing-lg) 0;
    }
}

@media (max-width: 480px) {
    h1 {
        font-size: 1.75rem;
    }

    .container {
        padding: 0 var(--spacing-sm);
    }

    /* Basic Flex Sandwich */
    header nav {
        display: flex;
        flex-direction: row;
        /* Single row container */
        align-items: center;
        /* Vertically align items */
        justify-content: flex-start;
        gap: 0;
        padding-right: var(--spacing-sm);
    }

    /* Left: Logo Placeholder */
    .logo-placeholder {
        flex: 0 0 100px;
        /* Keep original placeholder width or slightly reduced if needed, but sticking to basics */
        width: 100px;
        /* Explicit width */
    }

    /* Center: Nav links take remaining space and center themselves */
    .nav-links {
        flex: 1 1 auto;
        /* Take remaining space */
        display: flex;
        justify-content: center;
        /* Center inner items */
        gap: 0.5rem;
        flex-wrap: nowrap;
        margin: 0;
        padding: 0;
    }

    .nav-links li {
        margin-bottom: 0;
    }

    .nav-links a {
        font-size: 0.85rem;
        white-space: nowrap;
    }

    /* Right: Theme Toggle */
    .theme-toggle {
        position: static;
        /* Not absolute */
        flex: 0 0 auto;
        /* Fixed width */
        margin-left: 0;
        right: auto;
    }


}