: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;

    --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;

        --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;
}

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

/*
============================
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:900px;
}

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

    margin-bottom:30px;

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

.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:850px;

    font-size:clamp(2.6rem,6vw,4.6rem);
    line-height:1.05;

    letter-spacing:-.045em;

    margin-bottom:25px;
}

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

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

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

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

    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;
}

/*
============================
CASE STUDY 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;

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

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

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

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

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

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

.section-number{
    display:block;

    color:var(--primary);

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

    margin-bottom:10px;
}

.section-heading h2{
    font-size:clamp(2rem,4vw,2.8rem);
    letter-spacing:-.03em;

    margin-bottom:16px;
}

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

    color:var(--text-secondary);
    font-size:1.08rem;
}

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

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

/*
============================
PROBLEM CARDS
============================
*/

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

    margin-top:45px;
}

.challenge-card{
    background:var(--surface);

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

    padding:26px;
}

.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;
}

/*
============================
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;
}

/*
============================
DATA MODEL
============================
*/

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

    margin-top:45px;
}

.entity-card{
    background:var(--surface);

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

    overflow:hidden;

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

.entity-header{
    padding:18px 22px;

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

    color:var(--primary);

    font-weight:800;
}

.entity-fields{
    list-style:none;
    padding:18px 22px;
}

.entity-fields li{
    padding:7px 0;

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

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

    font-size:.88rem;

    color:var(--text-secondary);
}

.entity-fields li:last-child{
    border-bottom:0;
}

/*
============================
RELATIONSHIP DIAGRAM
============================
*/

.relationship{
    margin-top:50px;

    padding:40px;

    background:var(--surface);

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

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

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

    flex-wrap:wrap;
    gap:14px;
}

.flow-box{
    min-width:180px;

    padding:20px;

    text-align:center;

    background:var(--bg-secondary);

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

    font-weight:700;
}

.flow-box span{
    display:block;

    margin-top:5px;

    color:var(--text-secondary);
    font-size:.8rem;
    font-weight:400;
}

.flow-arrow{
    color:var(--primary);
    font-size:1.5rem;
    font-weight:800;
}

/*
============================
APPROVAL MODEL
============================
*/

.approval-demo{
    display:grid;
    grid-template-columns:1fr 80px 1fr;

    align-items:center;

    gap:20px;

    margin-top:45px;
}

.approval-panel{
    background:var(--surface);

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

    padding:28px;

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

.approval-panel h3{
    margin-bottom:20px;
}

.manager-row{
    display:flex;
    justify-content:space-between;
    align-items:center;

    padding:12px 0;

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

.manager-row:last-child{
    border-bottom:0;
}

.status{
    padding:5px 9px;

    border-radius:999px;

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

.status.pending{
    background:
        color-mix(
            in srgb,
            var(--warning) 14%,
            transparent
        );

    color:var(--warning);
}

.status.approved{
    background:
        color-mix(
            in srgb,
            var(--success) 14%,
            transparent
        );

    color:var(--success);
}

.status.resolved{
    background:var(--bg-secondary);
    color:var(--text-secondary);
}

.approval-transition{
    text-align:center;
    color:var(--primary);

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

/*
============================
SWAP VISUALIZATION
============================
*/

.swap-model{
    display:grid;
    grid-template-columns:1fr 1fr;
    gap:26px;

    margin-top:45px;
}

.shift-card{
    position:relative;

    padding:28px;

    background:var(--surface);

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

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

.shift-label{
    display:inline-block;

    margin-bottom:18px;

    padding:6px 10px;

    border-radius:8px;

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

    color:var(--primary);

    font-size:.75rem;
    font-weight:800;
}

.shift-card h3{
    margin-bottom:8px;
}

.shift-card > p{
    color:var(--text-secondary);
    margin-bottom:20px;
}

.approval-group{
    margin-top:18px;

    padding:16px;

    background:var(--bg-secondary);

    border-radius:10px;
}

.approval-group strong{
    display:block;
    margin-bottom:5px;
}

.approval-group span{
    color:var(--text-secondary);
    font-size:.9rem;
}

/*
============================
DAY PART TIMELINE
============================
*/

.daypart-visual{
    margin-top:45px;

    padding:35px;

    background:var(--surface);

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

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

.daypart-times{
    display:flex;
    justify-content:space-between;

    margin-bottom:10px;

    color:var(--text-secondary);

    font-size:.8rem;
}

.daypart-bar{
    display:grid;
    grid-template-columns:45% 55%;

    height:60px;

    overflow:hidden;

    border-radius:12px;
}

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

    font-size:.88rem;
    font-weight:700;
}

.daypart.morning{
    background:#dbeafe;
    color:#1e40af;
}

.daypart.evening{
    background:#e0e7ff;
    color:#3730a3;
}

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

    .daypart.morning{
        background:#1e3a8a;
        color:#bfdbfe;
    }

    .daypart.evening{
        background:#312e81;
        color:#c7d2fe;
    }
}

.daypart-approvals{
    display:grid;
    grid-template-columns:45% 55%;

    margin-top:16px;
}

.daypart-approval{
    text-align:center;

    color:var(--text-secondary);

    font-size:.85rem;
}

/*
============================
WORKFLOW
============================
*/

.workflow{
    margin-top:50px;
}

.workflow-step{
    display:grid;
    grid-template-columns:64px 1fr;
    gap:25px;

    position:relative;

    padding-bottom:35px;
}

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

    position:absolute;

    top:52px;
    left:27px;

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

    background:var(--border);
}

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

    width:56px;
    height:56px;

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

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

    border-radius:50%;

    font-weight:800;
}

.step-content{
    padding:6px 0 0;
}

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

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

/*
============================
CQRS
============================
*/

.query-diagram{
    display:grid;
    grid-template-columns:1fr 80px 1fr;

    align-items:center;
    gap:20px;

    margin-top:45px;
}

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

.query-box{
    padding:18px;

    background:var(--surface);

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

    text-align:center;

    font-weight:600;
}

.query-arrow{
    text-align:center;

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

/*
============================
DESIGN 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;
}

/*
============================
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;

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

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

    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;
}

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

.takeaway{
    padding:80px 0;
    text-align:center;
}

.takeaway blockquote{
    max-width:850px;
    margin:0 auto;

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

    font-weight:700;
}

.takeaway blockquote 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{
    border:1px solid var(--border);
    background:var(--surface);
    color:var(--text);
}

/*
============================
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;
    }

    .entity-grid,
    .swap-model,
    .principles-grid{
        grid-template-columns:1fr;
    }

    .approval-demo,
    .query-diagram{
        grid-template-columns:1fr;
    }

    .approval-transition,
    .query-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;
    }

    .relationship{
        padding:25px 18px;
    }

    .relationship-flow{
        flex-direction:column;
    }

    .flow-arrow{
        transform:rotate(90deg);
    }

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

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