/* Base Reset & Variables */
:root {
    --bg-color: #fcfcfc;
    --text-primary: #111827;
    --text-secondary: #4b5563;
    --accent-color: #2563eb;
    --accent-hover: #1d4ed8;
    --card-bg: #ffffff;
    --divider-color: #e5e7eb;
    --font-primary: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    --max-width: 1200px;
    --radius-md: 8px;
    --radius-lg: 12px;
}

html {
    scroll-behavior: smooth;
}

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

body {
    background-color: var(--bg-color);
    color: var(--text-primary);
    font-family: var(--font-primary);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

/* Typography */
h1 {
    font-size: clamp(2.5rem, 5vw, 4rem);
    font-weight: 800;
    line-height: 1.1;
    letter-spacing: -0.03em;
    margin-bottom: 1.5rem;
    text-transform: uppercase;
}

h2 {
    font-size: 1.5rem;
    font-weight: 800;
    margin-bottom: 2rem;
    text-transform: uppercase;
}

h3 {
    font-size: 1.2rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

a {
    color: inherit;
    text-decoration: none;
    transition: color 0.2s;
}

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

/* Layout */
main {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0 2rem;
}

.section-divider {
    border: none;
    border-top: 1px solid var(--divider-color);
    margin: 4rem 0;
}

/* Navigation */
.navbar {
    position: sticky;
    top: 0;
    z-index: 1000;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 4rem;
    /* More padding, less margin gap effectively */
    max-width: 100%;
    background-color: rgba(252, 252, 252, 0.85);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-bottom: 1px solid transparent;
    /* Hidden by default */
    transition: all 0.3s ease;
    font-size: clamp(0.9rem, 1.2vw, 1.1rem);
    font-weight: 600;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.logo {
    color: var(--text-primary);
    text-decoration: none;
    transition: opacity 0.2s ease;
}

.logo:hover {
    opacity: 0.7;
    color: var(--text-primary);
}

.navbar.scrolled {
    border-bottom: 1px solid rgba(229, 231, 235, 0.8);
    background-color: rgba(252, 252, 252, 0.92);
}

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

.hamburger span {
    width: 100%;
    height: 2px;
    background-color: var(--text-primary);
    transition: all 0.3s ease;
}

.hamburger.active span:nth-child(1) {
    transform: translateY(9.5px) rotate(45deg);
}

.hamburger.active span:nth-child(2) {
    opacity: 0;
}

.hamburger.active span:nth-child(3) {
    transform: translateY(-9.5px) rotate(-45deg);
}

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

/* Hero Section */
.hero {
    display: flex;
    align-items: center;
    min-height: 70vh;
    padding: 4rem 0;
    position: relative;
}

.hero-content {
    flex: 0 0 fit-content;
    z-index: 2;
    padding-right: 2rem;
}

.hero h1,
.hero p.subheadline {
    white-space: nowrap;
}

.subheadline {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 1rem;
}

.italics-line {
    font-style: italic;
    color: var(--text-secondary);
    margin-bottom: 2rem;
    font-size: 1.1rem;
}

.proof-line {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 2.5rem;
    padding-left: 1rem;
    border-left: 3px solid var(--accent-color);
}

.cta-group {
    display: flex;
    gap: 1rem;
}

.btn {
    display: inline-block;
    padding: 0.8rem 1.8rem;
    font-weight: 600;
    font-size: 0.9rem;
    text-transform: uppercase;
    border-radius: 4px;
    letter-spacing: 0.05em;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-primary {
    background-color: var(--accent-color);
    color: white;
    border: 1px solid var(--accent-color);
    box-shadow: 0 4px 6px -1px rgba(37, 99, 235, 0.1), 0 2px 4px -1px rgba(37, 99, 235, 0.06);
}

.btn-primary:hover {
    background-color: var(--accent-hover);
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 10px 15px -3px rgba(37, 99, 235, 0.2);
}

.btn-secondary {
    background-color: transparent;
    color: var(--text-primary);
    border: 1px solid var(--divider-color);
}

.btn-secondary:hover {
    border-color: var(--text-secondary);
    color: var(--text-primary);
}

.hero-graphic {
    position: absolute;
    right: -5%;
    top: 50%;
    transform: translateY(-50%);
    width: 70%;
    height: 650px;
    opacity: 0.65;
    background-image: radial-gradient(circle at 50% 50%, var(--divider-color) 2px, transparent 2px);
    background-size: 30px 30px;
    mask-image: linear-gradient(to right, transparent, black 95%);
    -webkit-mask-image: linear-gradient(to right, transparent, black 95%);
    z-index: 1;
}

/* What I Do Section */
.what-i-do {
    padding: 4rem 0;
}

.section-desc {
    max-width: 800px;
    margin-bottom: 3rem;
    font-size: 1.1rem;
    color: var(--text-secondary);
}

.focus-lead {
    font-weight: 700;
    font-size: 1.15rem;
    margin-bottom: 2rem;
    color: var(--text-primary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.focus-list {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    max-width: 900px;
}

.focus-item {
    border-left: 2px solid var(--divider-color);
    padding: 0.5rem 0 0.5rem 1.5rem;
    font-size: 1.15rem;
    color: var(--text-secondary);
    transition: all 0.3s ease;
    line-height: 1.5;
}

.focus-item:hover {
    border-left-color: var(--accent-color);
    color: var(--text-primary);
    transform: translateX(5px);
}

/* Case Studies Section */
.case-studies-section {
    padding: 4rem 0 6rem 0;
}

.case-study-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 2rem;
}

.cs-card {
    background: var(--card-bg);
    border: 1px solid var(--divider-color);
    border-radius: var(--radius-md);
    padding: 2rem;
    cursor: pointer;
    position: relative;
    transition: all 0.3s cubic-bezier(0.2, 0.8, 0.2, 1);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
}

.cs-card::after {
    content: "→";
    position: absolute;
    right: 2rem;
    bottom: 2rem;
    font-size: 1.5rem;
    color: var(--accent-color);
    opacity: 0;
    transform: translateX(-10px);
    transition: all 0.3s ease;
}

.cs-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 12px 24px -5px rgba(0, 0, 0, 0.1);
    border-color: var(--accent-color);
}

.cs-card:hover::after {
    opacity: 1;
    transform: translateX(0);
}

.cs-card h3 {
    font-size: 1.25rem;
    margin-bottom: 1rem;
}

.cs-card p {
    font-size: 0.9rem;
    margin-bottom: 0.5rem;
    color: var(--text-secondary);
}

.cs-card strong {
    color: var(--text-primary);
}

/* Modal Implementation */
.modal-overlay {
    display: none;
    /* Hidden by default */
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: rgba(252, 252, 252, 0.01);
    backdrop-filter: blur(80px) saturate(250%) contrast(90%);
    -webkit-backdrop-filter: blur(80px) saturate(250%) contrast(90%);
    /* Extreme 'Liquid Glass' effect with high distortion and blur */
    z-index: 9999;
    opacity: 0;
    transform: scale(0.90);
    transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    transform-origin: center center;
}

/* Modal active class triggered by JS */
.modal-overlay.active {
    display: flex;
    opacity: 1;
    transform: scale(1);
    flex-direction: column;
}

/* In transition states */
.modal-overlay.entering {
    display: flex;
}

.modal-overlay.leaving {
    opacity: 0;
    transform: scale(0.98);
}

.modal-container {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
}

.modal-close-btn {
    position: absolute;
    top: 1.5rem;
    right: 2.5rem;
    background: none;
    border: none;
    font-size: 3rem;
    line-height: 1;
    cursor: pointer;
    color: var(--text-primary);
    z-index: 10000;
    transition: color 0.2s;
    background-color: rgba(255, 255, 255, 0.8);
    border-radius: 50%;
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-close-btn:hover {
    color: var(--accent-hover);
}

.modal-scroll-area {
    flex: 1;
    overflow-y: auto;
    padding: 4rem 2rem;
}

.modal-content {
    max-width: 800px;
    margin: 0 auto;
}

/* Markdown typography styles for modal */
.cs-doc h1 {
    font-size: clamp(1.8rem, 4vw, 2.5rem);
    margin-bottom: 2rem;
    text-transform: none;
    line-height: 1.2;
}

.cs-doc h2 {
    font-size: 1.5rem;
    margin-top: 3.5rem;
    margin-bottom: 1.5rem;
    padding-bottom: 0.5rem;
    font-weight: 700;
}

.cs-doc h3 {
    font-size: 1.2rem;
    margin-top: 2rem;
    margin-bottom: 0.75rem;
    font-weight: 600;
}

.cs-doc hr {
    border: none;
    border-top: 1px solid var(--divider-color);
    margin: 3rem 0;
}

.cs-doc p {
    font-size: 1.1rem;
    line-height: 1.6;
    margin-bottom: 1.5rem;
    color: var(--text-secondary);
}

/* Demo Blocks (Takeaways) */
.cs-demo-grid {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    margin: 2rem 0;
}

.cs-demo-block {
    background: #f8fafc;
    border-left: 2px solid var(--accent-color);
    padding: 1.5rem 2rem;
    transition: all 0.3s ease;
}

.cs-demo-block:hover {
    background: #f1f5f9;
    transform: translateX(5px);
}

.cs-demo-block h3 {
    margin-top: 0;
    margin-bottom: 0.5rem;
    font-size: 1.15rem;
    color: var(--text-primary);
}

.cs-demo-block p {
    margin-bottom: 0;
    font-size: 1rem;
    color: var(--text-secondary);
}

.cs-doc ul,
.cs-doc ol {
    margin-bottom: 2rem;
    padding-left: 1.5rem;
}

.cs-doc li {
    font-size: 1.1rem;
    line-height: 1.6;
    margin-bottom: 0.75rem;
    color: var(--text-secondary);
}

.cs-doc strong {
    color: var(--text-primary);
    font-weight: 600;
}

/* Tables */
.tradeoff-table,
.comparison-table {
    width: 100%;
    border-collapse: collapse;
    margin: 2rem 0;
    font-size: 0.95rem;
    background: #fff;
    border: 1px solid var(--divider-color);
}

.tradeoff-table th,
.comparison-table th {
    background: #f8fafc;
    text-align: left;
    padding: 1rem;
    border-bottom: 2px solid var(--divider-color);
    font-weight: 700;
    color: var(--text-primary);
}

.tradeoff-table td,
.comparison-table td {
    padding: 1rem;
    border-bottom: 1px solid var(--divider-color);
    vertical-align: top;
    line-height: 1.5;
}

.tradeoff-table tr:last-child td,
.comparison-table tr:last-child td {
    border-bottom: none;
}

.cs-doc .callout {
    background: #f1f5f9;
    border-left: 4px solid var(--accent-color);
    padding: 2rem;
    font-size: 1.2rem;
    font-weight: 500;
    margin: 4rem 0;
    color: var(--text-primary);
    line-height: 1.6;
}

/* Contact Footer */
.contact-section {
    padding: 7rem 0;
    border-top: 1px solid var(--divider-color);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    min-height: 50vh;
    /* Ensures contact section is a clear destination while allowing subtle cutoff */
}

.contact-section h2 {
    font-size: 3rem;
    margin-bottom: 5rem;
    letter-spacing: -0.02em;
}

.contact-links {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    font-weight: 700;
    text-transform: uppercase;
    font-size: 1.25rem;
}

/* Responsive */
@media (max-width: 768px) {
    .navbar {
        padding: 1rem 2rem;
    }

    .hamburger {
        display: flex;
    }

    .nav-links {
        position: fixed;
        top: -100%;
        left: 0;
        width: 100%;
        height: 100vh;
        background-color: rgba(252, 252, 252, 0.98);
        backdrop-filter: blur(15px);
        -webkit-backdrop-filter: blur(15px);
        flex-direction: column;
        justify-content: center;
        align-items: center;
        gap: 3rem;
        transition: top 0.6s cubic-bezier(0.16, 1, 0.3, 1),
            opacity 0.4s ease,
            visibility 0.6s ease;
        z-index: 1000;
        font-size: 1.5rem;
        visibility: hidden;
        pointer-events: none;
        opacity: 0;
    }

    .nav-links.active {
        top: 0;
        visibility: visible;
        pointer-events: auto;
        opacity: 1;
        transition: top 0.6s cubic-bezier(0.16, 1, 0.3, 1),
            opacity 0.4s ease;
        /* No delay when opening */
    }

    .hero {
        flex-direction: column;
        padding: 10rem 0 4rem 0;
        /* More top padding for sticky nav overlap */
    }

    .hero-content {
        margin-bottom: 3rem;
        padding-right: 0;
    }

    .hero h1,
    .hero p.subheadline {
        white-space: normal;
        /* allow wrap on small mobile */
    }

    .hero-graphic {
        position: relative;
        width: 100%;
        height: 300px;
        right: 0;
        top: 0;
        transform: none;
        margin-top: 2rem;
    }

    .contact-section {
        flex-direction: column;
        gap: 1rem;
    }

    .contact-links {
        width: 100%;
        flex-direction: column;
        gap: 0.5rem;
    }
}