:root{
    color-scheme:light dark;

    --primary:#2563eb;
    --primary-hover:#1d4ed8;
    --accent:#0ea5e9;

    --bg:#ffffff;
    --bg-secondary:#f8fafc;
    --surface:#ffffff;

    --text:#1e293b;
    --text-secondary:#64748b;

    --border:#e2e8f0;

    --success:#16a34a;
    --warning:#d97706;
    --danger:#dc2626;

    --hero-gradient:
        linear-gradient(
            135deg,
            #1e40af,
            #2563eb 55%,
            #0ea5e9
        );

    --shadow:
        0 10px 30px rgba(0,0,0,.08);

    --shadow-large:
        0 25px 60px rgba(15,23,42,.14);
}

@media (prefers-color-scheme:dark){

    :root{
        --primary:#60a5fa;
        --primary-hover:#93c5fd;
        --accent:#38bdf8;

        --bg:#0f172a;
        --bg-secondary:#111827;
        --surface:#1e293b;

        --text:#f8fafc;
        --text-secondary:#94a3b8;

        --border:#334155;

        --success:#4ade80;
        --warning:#fbbf24;
        --danger:#f87171;

        --hero-gradient:
            linear-gradient(
                135deg,
                #172554,
                #1e3a8a 55%,
                #075985
            );

        --shadow:
            0 10px 30px rgba(0,0,0,.35);

        --shadow-large:
            0 25px 60px rgba(0,0,0,.5);
    }
}

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

html{
    scroll-behavior:smooth;
}

body{
    font-family:'Inter',sans-serif;
    background:var(--bg);
    color:var(--text);
    line-height:1.7;
}

a{
    color:inherit;
}

.container{
    width:min(1180px,calc(100% - 48px));
    margin:0 auto;
}

.content-container{
    width:min(880px,calc(100% - 48px));
    margin:0 auto;
}


/* ============================
   NAVIGATION
============================ */

.navbar{
    position:sticky;
    top:0;
    z-index:1000;

    background:color-mix(
        in srgb,
        var(--surface) 92%,
        transparent
    );

    backdrop-filter:blur(16px);

    border-bottom:1px solid var(--border);
}

.nav-container{
    height:70px;

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

.logo{
    text-decoration:none;
    font-weight:800;
    color:var(--primary);
}

.nav-links{
    display:flex;
    align-items:center;
    gap:28px;

    list-style:none;
}

.nav-links a{
    text-decoration:none;
    color:var(--text-secondary);

    font-size:.95rem;
    font-weight:600;
}

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

.nav-contact{
    background:var(--primary);
    color:white !important;

    padding:9px 16px;
    border-radius:8px;
}


/* ============================
   HERO
============================ */

.case-hero{
    position:relative;
    overflow:hidden;

    background:var(--hero-gradient);
    color:white;

    padding:100px 0 90px;
}

.case-hero::after{
    content:"";

    position:absolute;

    width:520px;
    height:520px;

    right:-180px;
    top:-180px;

    border-radius:50%;

    background:
        radial-gradient(
            circle,
            rgba(255,255,255,.14),
            transparent 68%
        );
}

.case-hero-content{
    position:relative;
    z-index:2;

    max-width:930px;
}

.breadcrumb{
    display:flex;
    align-items:center;
    gap:10px;

    margin-bottom:30px;

    color:rgba(255,255,255,.8);
    font-size:.9rem;
}

.breadcrumb a{
    text-decoration:none;
}

.breadcrumb a:hover{
    color:white;
}

.eyebrow{
    display:inline-block;

    margin-bottom:18px;

    color:#bfdbfe;

    font-size:.85rem;
    font-weight:700;
    letter-spacing:.1em;
    text-transform:uppercase;
}

.case-hero h1{
    max-width:930px;

    margin-bottom:25px;

    font-size:clamp(2.6rem,6vw,4.6rem);
    line-height:1.05;
    letter-spacing:-.045em;
}

.case-hero-description{
    max-width:820px;

    color:rgba(255,255,255,.9);

    font-size:1.2rem;
    line-height:1.75;
}

.hero-tags{
    display:flex;
    flex-wrap:wrap;
    gap:10px;

    margin-top:35px;
}

.hero-tag{
    padding:8px 14px;

    background:rgba(255,255,255,.12);
    border:1px solid rgba(255,255,255,.2);
    border-radius:999px;

    backdrop-filter:blur(8px);

    font-size:.85rem;
    font-weight:600;
}


/* ============================
   SUMMARY
============================ */

.case-summary{
    position:relative;
    z-index:5;

    margin-top:-40px;
}

.summary-grid{
    display:grid;
    grid-template-columns:repeat(4,1fr);

    background:var(--surface);

    border:1px solid var(--border);
    border-radius:20px;

    overflow:hidden;

    box-shadow:var(--shadow-large);
}

.summary-item{
    padding:28px;

    border-right:1px solid var(--border);
}

.summary-item:last-child{
    border-right:0;
}

.summary-label{
    margin-bottom:7px;

    color:var(--text-secondary);

    font-size:.75rem;
    font-weight:700;

    letter-spacing:.08em;
    text-transform:uppercase;
}

.summary-value{
    font-weight:700;
    line-height:1.4;
}


/* ============================
   GENERAL
============================ */

.case-section{
    padding:90px 0;
}

.case-section.alt{
    background:var(--bg-secondary);
}

.section-heading{
    margin-bottom:36px;
}

.section-number{
    display:block;

    margin-bottom:10px;

    color:var(--primary);

    font-size:.8rem;
    font-weight:800;
    letter-spacing:.12em;
}

.section-heading h2{
    margin-bottom:16px;

    font-size:clamp(2rem,4vw,2.8rem);
    letter-spacing:-.03em;
}

.section-heading p{
    max-width:780px;

    color:var(--text-secondary);

    font-size:1.08rem;
}

.prose p{
    margin-bottom:24px;
    color:var(--text-secondary);
}

.prose strong{
    color:var(--text);
}


/* ============================
   CALLOUT
============================ */

.design-callout{
    margin:40px 0;

    padding:30px 34px;

    border-left:4px solid var(--primary);

    background:
        color-mix(
            in srgb,
            var(--primary) 7%,
            var(--surface)
        );

    border-radius:0 14px 14px 0;
}

.design-callout p{
    margin:0;

    color:var(--text);

    font-size:1.12rem;
    font-weight:600;
}


/* ============================
   CHALLENGES
============================ */

.challenge-grid{
    display:grid;
    grid-template-columns:repeat(3,1fr);
    gap:20px;

    margin-top:45px;
}

.challenge-card{
    padding:26px;

    background:var(--surface);

    border:1px solid var(--border);
    border-radius:16px;
}

.challenge-number{
    display:flex;
    align-items:center;
    justify-content:center;

    width:38px;
    height:38px;

    margin-bottom:18px;

    border-radius:10px;

    background:
        color-mix(
            in srgb,
            var(--primary) 12%,
            transparent
        );

    color:var(--primary);
    font-weight:800;
}

.challenge-card h3{
    margin-bottom:10px;
    font-size:1.05rem;
}

.challenge-card p{
    color:var(--text-secondary);
    font-size:.94rem;
}


/* ============================
   ARCHITECTURE DIAGRAMS
============================ */

.architecture-card{
    margin-top:45px;

    padding:38px;

    background:var(--surface);

    border:1px solid var(--border);
    border-radius:20px;

    box-shadow:var(--shadow);
}

.architecture-card h3{
    margin-bottom:28px;
    text-align:center;
}

.architecture-flow{
    display:flex;
    align-items:center;
    justify-content:center;
    flex-wrap:wrap;

    gap:14px;
}

.arch-box{
    min-width:170px;

    padding:22px;

    text-align:center;

    background:var(--bg-secondary);

    border:1px solid var(--border);
    border-radius:12px;

    font-weight:700;
}

.arch-box span{
    display:block;

    margin-top:6px;

    color:var(--text-secondary);

    font-size:.8rem;
    font-weight:400;
}

.arch-arrow{
    color:var(--primary);

    font-size:1.6rem;
    font-weight:800;
}


/* ============================
   BEFORE / AFTER
============================ */

.before-after{
    display:grid;
    grid-template-columns:1fr 80px 1fr;
    align-items:center;

    gap:20px;

    margin-top:45px;
}

.state-card{
    padding:30px;

    background:var(--surface);

    border:1px solid var(--border);
    border-radius:18px;

    box-shadow:var(--shadow);
}

.state-card h3{
    margin-bottom:24px;
}

.state-card.before{
    border-top:4px solid var(--warning);
}

.state-card.after{
    border-top:4px solid var(--success);
}

.state-flow{
    display:grid;
    gap:10px;
}

.state-box{
    padding:14px;

    text-align:center;

    background:var(--bg-secondary);

    border-radius:9px;

    font-size:.9rem;
    font-weight:600;
}

.state-down{
    text-align:center;

    color:var(--text-secondary);

    font-weight:800;
}

.transition-arrow{
    text-align:center;

    color:var(--primary);

    font-size:2rem;
    font-weight:800;
}


/* ============================
   LAYER CARDS
============================ */

.layer-grid{
    display:grid;
    grid-template-columns:repeat(2,1fr);
    gap:20px;

    margin-top:45px;
}

.layer-card{
    padding:28px;

    background:var(--surface);

    border:1px solid var(--border);
    border-radius:16px;
}

.layer-card h3{
    margin-bottom:10px;
    color:var(--primary);
}

.layer-card p{
    color:var(--text-secondary);
}

.layer-items{
    display:flex;
    flex-wrap:wrap;

    gap:8px;

    margin-top:18px;
}

.layer-item{
    padding:6px 10px;

    background:var(--bg-secondary);

    border-radius:7px;

    color:var(--text-secondary);

    font-size:.8rem;
    font-weight:600;
}


/* ============================
   USE CASE FLOW
============================ */

.use-case-flow{
    display:flex;
    justify-content:center;
    align-items:center;
    flex-wrap:wrap;

    gap:12px;

    margin-top:45px;
}

.use-case-box{
    min-width:160px;

    padding:20px;

    text-align:center;

    background:var(--surface);

    border:1px solid var(--border);
    border-radius:12px;

    box-shadow:var(--shadow);

    font-weight:700;
}

.use-case-box span{
    display:block;

    margin-top:5px;

    color:var(--text-secondary);

    font-size:.78rem;
    font-weight:400;
}

.use-case-arrow{
    color:var(--primary);

    font-size:1.5rem;
    font-weight:800;
}


/* ============================
   COMMAND / QUERY
============================ */

.cqrs-grid{
    display:grid;
    grid-template-columns:1fr 1fr;
    gap:24px;

    margin-top:45px;
}

.cqrs-card{
    padding:30px;

    background:var(--surface);

    border:1px solid var(--border);
    border-radius:18px;

    box-shadow:var(--shadow);
}

.cqrs-card h3{
    margin-bottom:8px;

    color:var(--primary);
}

.cqrs-card > p{
    color:var(--text-secondary);
}

.cqrs-list{
    list-style:none;

    margin-top:20px;
}

.cqrs-list li{
    padding:10px 0;

    border-bottom:1px solid var(--border);

    color:var(--text-secondary);

    font-family:
        ui-monospace,
        SFMono-Regular,
        Menlo,
        Monaco,
        Consolas,
        monospace;

    font-size:.85rem;
}

.cqrs-list li:last-child{
    border-bottom:0;
}


/* ============================
   READ MODEL
============================ */

.read-model{
    display:grid;
    grid-template-columns:1fr 80px 1fr;
    align-items:center;

    gap:20px;

    margin-top:45px;
}

.read-column{
    display:grid;
    gap:12px;
}

.read-box{
    padding:18px;

    background:var(--surface);

    border:1px solid var(--border);
    border-radius:12px;

    text-align:center;

    font-weight:600;
}

.read-arrow{
    text-align:center;

    color:var(--primary);

    font-size:2rem;
    font-weight:800;
}


/* ============================
   PIPELINE BEHAVIOR
============================ */

.pipeline{
    display:flex;
    justify-content:center;
    align-items:center;
    flex-wrap:wrap;

    gap:12px;

    margin-top:45px;
}

.pipeline-box{
    min-width:140px;

    padding:20px;

    text-align:center;

    background:var(--surface);

    border:1px solid var(--border);
    border-radius:12px;

    box-shadow:var(--shadow);

    font-weight:700;
}

.pipeline-arrow{
    color:var(--primary);

    font-size:1.4rem;
    font-weight:800;
}


/* ============================
   MIGRATION TIMELINE
============================ */

.migration{
    margin-top:45px;
}

.migration-step{
    display:grid;
    grid-template-columns:70px 1fr;

    gap:24px;

    position:relative;

    padding-bottom:36px;
}

.migration-step:not(:last-child)::before{
    content:"";

    position:absolute;

    left:29px;
    top:58px;

    width:2px;
    height:calc(100% - 30px);

    background:var(--border);
}

.migration-number{
    position:relative;
    z-index:2;

    display:flex;
    align-items:center;
    justify-content:center;

    width:60px;
    height:60px;

    border-radius:50%;

    background:var(--primary);
    color:white;

    font-weight:800;
}

.migration-content{
    padding-top:5px;
}

.migration-content h3{
    margin-bottom:7px;
}

.migration-content p{
    color:var(--text-secondary);
}

.migration-tags{
    display:flex;
    flex-wrap:wrap;

    gap:7px;

    margin-top:14px;
}

.migration-tag{
    padding:5px 9px;

    background:var(--bg-secondary);

    border-radius:6px;

    color:var(--text-secondary);

    font-size:.78rem;
    font-weight:600;
}


/* ============================
   TRADEOFF
============================ */

.tradeoff-grid{
    display:grid;
    grid-template-columns:1fr 1fr;
    gap:24px;

    margin-top:45px;
}

.tradeoff-card{
    padding:28px;

    background:var(--surface);

    border:1px solid var(--border);
    border-radius:16px;
}

.tradeoff-card h3{
    margin-bottom:12px;
}

.tradeoff-card p{
    color:var(--text-secondary);
}


/* ============================
   PRINCIPLES
============================ */

.principles-grid{
    display:grid;
    grid-template-columns:repeat(2,1fr);
    gap:20px;

    margin-top:45px;
}

.principle{
    padding:26px;

    background:var(--surface);

    border:1px solid var(--border);
    border-radius:15px;
}

.principle h3{
    margin-bottom:10px;
}

.principle p{
    color:var(--text-secondary);
    font-size:.94rem;
}


/* ============================
   TECHNOLOGIES
============================ */

.technology-grid{
    display:grid;
    grid-template-columns:1fr 1fr;
    gap:24px;

    margin-top:45px;
}

.technology-card{
    padding:30px;

    background:var(--surface);

    border:1px solid var(--border);
    border-radius:16px;
}

.technology-card h3{
    margin-bottom:16px;

    color:var(--primary);
}

.tag-list{
    display:flex;
    flex-wrap:wrap;

    gap:9px;
}

.tag{
    padding:8px 11px;

    background:var(--bg-secondary);

    border:1px solid var(--border);
    border-radius:8px;

    color:var(--text-secondary);

    font-size:.82rem;
    font-weight:600;
}


/* ============================
   OUTCOME
============================ */

.outcome{
    background:var(--hero-gradient);
    color:white;
}

.outcome .section-number{
    color:#bfdbfe;
}

.outcome h2{
    color:white;
}

.outcome .section-heading p{
    color:rgba(255,255,255,.8);
}

.outcome-grid{
    display:grid;
    grid-template-columns:repeat(3,1fr);
    gap:20px;

    margin-top:45px;
}

.outcome-card{
    padding:25px;

    background:rgba(255,255,255,.1);

    border:1px solid rgba(255,255,255,.2);
    border-radius:15px;

    backdrop-filter:blur(8px);
}

.outcome-card strong{
    display:block;

    margin-bottom:7px;

    color:white;
}

.outcome-card span{
    color:rgba(255,255,255,.8);

    font-size:.9rem;
}


/* ============================
   TAKEAWAY
============================ */

.takeaway{
    padding:80px 0;

    text-align:center;
}

.takeaway blockquote{
    max-width:930px;

    margin:0 auto;

    font-size:clamp(1.5rem,3vw,2.2rem);
    line-height:1.45;
    letter-spacing:-.02em;

    font-weight:700;
}

.takeaway strong{
    color:var(--primary);
}


/* ============================
   CTA
============================ */

.case-cta{
    padding:65px 0;

    background:var(--bg-secondary);

    border-top:1px solid var(--border);
}

.cta-container{
    display:flex;
    justify-content:space-between;
    align-items:center;

    gap:30px;
}

.cta-container h2{
    margin-bottom:6px;
}

.cta-container p{
    color:var(--text-secondary);
}

.cta-actions{
    display:flex;
    gap:12px;

    flex-shrink:0;
}

.btn{
    display:inline-block;

    padding:12px 22px;

    border-radius:9px;

    text-decoration:none;

    font-weight:700;
}

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

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

.btn-secondary{
    background:var(--surface);
    color:var(--text);

    border:1px solid var(--border);
}


/* ============================
   FOOTER
============================ */

footer{
    padding:30px 0;

    border-top:1px solid var(--border);

    text-align:center;

    color:var(--text-secondary);

    font-size:.9rem;
}


/* ============================
   RESPONSIVE
============================ */

@media(max-width:900px){

    .nav-links{
        display:none;
    }

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

    .summary-item{
        border-bottom:1px solid var(--border);
    }

    .challenge-grid,
    .outcome-grid{
        grid-template-columns:1fr;
    }

    .layer-grid,
    .cqrs-grid,
    .tradeoff-grid,
    .principles-grid,
    .technology-grid{
        grid-template-columns:1fr;
    }

    .before-after,
    .read-model{
        grid-template-columns:1fr;
    }

    .transition-arrow,
    .read-arrow{
        transform:rotate(90deg);
    }

    .cta-container{
        flex-direction:column;
        align-items:flex-start;
    }
}

@media(max-width:600px){

    .container,
    .content-container{
        width:min(100% - 32px,1180px);
    }

    .case-hero{
        padding:70px 0 75px;
    }

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

    .summary-item{
        border-right:0;
    }

    .case-section{
        padding:65px 0;
    }

    .architecture-flow,
    .use-case-flow,
    .pipeline{
        flex-direction:column;
    }

    .arch-arrow,
    .use-case-arrow,
    .pipeline-arrow{
        transform:rotate(90deg);
    }

    .cta-actions{
        width:100%;
        flex-direction:column;
    }

    .cta-actions .btn{
        text-align:center;
    }
}