:root {
    /* Medrock Palette */
    --bg-app: #e8eef4;
    --surface: #ffffff;
    --primary: #4D69DE;
    --primary-dark: #3F5AD3;
    --primary-light: #F0F3FF;

    --text-main: #111827;
    --text-muted: #6b7280;

    --line: #e2e8f0;
    --radius: 20px;

    /* Shadows */
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

* {
    box-sizing: border-box;
}

html,
body {
    height: 100%;
}

body {
    margin: 0;
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    color: var(--text-main);
    background: var(--bg-app);
    overflow-x: hidden;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

/* Background */
body::before {
    content: "";
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background:
        radial-gradient(50vw 50vh at 10% 10%, rgba(77, 105, 222, 0.08), transparent 100%),
        radial-gradient(40vw 40vh at 90% 80%, rgba(77, 105, 222, 0.05), transparent 100%);
    pointer-events: none;
    z-index: -1;
}

/* Slides layout */
.deck {
    scroll-snap-type: y mandatory;
    overflow-y: auto;
    height: 100vh;
    scroll-behavior: smooth;
}

section.slide {
    scroll-snap-align: start;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    /* Center content vertically */
    padding: 80px 40px;
    /* More padding on sides */
    position: relative;
}

/* Fluid Container */
.wrap {
    width: 100%;
    max-width: 1600px;
    /* Allow it to get very wide on huge screens, but keep sane text line lengths via grid */
    margin: 0 auto;
}

/* Top nav */
.topbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 50;
    padding: 16px 40px;
    background: rgba(232, 238, 244, 0.8);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.5);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    font-weight: 700;
    color: var(--primary);
    font-size: 18px;
}

.brand span {
    color: var(--text-muted);
    font-weight: 400;
    font-size: 14px;
    margin-left: 8px;
    padding-left: 12px;
    border-left: 1px solid var(--line);
}

.nav {
    display: flex;
    gap: 24px;
}

.nav a {
    text-decoration: none;
    color: var(--text-muted);
    font-size: 14px;
    font-weight: 500;
    transition: color 0.2s;
}

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

/* Typography */
h1 {
    font-size: clamp(40px, 5vw, 64px);
    letter-spacing: -0.03em;
    font-weight: 800;
    margin-bottom: 24px;
    color: var(--text-main);
    line-height: 1.1;
    max-width: 25ch;
    /* Prevent lines from getting too long */
}

h2 {
    font-size: clamp(32px, 3.5vw, 48px);
    letter-spacing: -0.02em;
    font-weight: 700;
    margin-bottom: 24px;
    color: var(--text-main);
}

h3 {
    font-size: 20px;
    font-weight: 600;
    margin-bottom: 12px;
    color: var(--text-main);
}

p {
    padding: 2px;
    /* For outline visibility when editing */
    margin: 0 0 16px 0;
    color: var(--text-muted);
    font-size: 16px;
    line-height: 1.6;
}

/* Editing Highlights */
[contenteditable="true"]:hover {
    outline: 1px dashed var(--primary);
    background: rgba(77, 105, 222, 0.05);
    cursor: text;
}

[contenteditable="true"]:focus {
    outline: 2px solid var(--primary);
    background: #fff;
    border-radius: 4px;
}

/* Fluid Grid System */
.grid-cols {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 32px;
    width: 100%;
    align-items: stretch;
}

.col {
    display: flex;
    flex-direction: column;
    justify-content: center;
}

/* Cards */
.card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    padding: 40px;
    height: 100%;
    /* Fill column height */
    display: flex;
    flex-direction: column;
}

.card.soft {
    padding: 32px;
    background: #f8fafc;
    border: 1px solid var(--line);
    box-shadow: none;
}

/* Inner Grids */
.inner-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
}

/* Elements */
.pill {
    display: inline-flex;
    padding: 6px 12px;
    border-radius: 99px;
    background: var(--primary-light);
    color: var(--primary);
    font-size: 13px;
    font-weight: 600;
    margin-right: 8px;
    margin-bottom: 8px;
}

.list {
    margin: 0;
    padding-left: 20px;
    color: var(--text-muted);
    line-height: 1.7;
}

.list li {
    margin-bottom: 8px;
}

.price {
    font-size: clamp(32px, 4vw, 48px);
    font-weight: 800;
    letter-spacing: -0.03em;
    margin: 12px 0 4px;
    color: var(--text-main);
}

.subprice {
    color: var(--text-muted);
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 16px;
}

/* Calculator */
.calc {
    display: grid;
    /* Should be grid */
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.field {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

label {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-muted);
}

input {
    padding: 12px;
    border-radius: 12px;
    border: 1px solid var(--line);
    font-size: 16px;
    outline: none;
    width: 100%;
    /* Full width */
}

input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(77, 105, 222, 0.1);
}

.result {
    grid-column: span 2;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    background: var(--primary-light);
    padding: 24px;
    border-radius: 16px;
    border: 1px solid rgba(77, 105, 222, 0.1);
}

.metric {
    background: #fff;
    padding: 16px;
    border-radius: 12px;
    border: 1px solid rgba(77, 105, 222, 0.1);
}

.metric b {
    display: block;
    font-size: 20px;
    color: var(--primary);
    margin-bottom: 4px;
}

.metric span {
    font-size: 13px;
    color: var(--text-muted);
}

/* Buttons */
.btn {
    display: inline-flex;
    padding: 12px 24px;
    border-radius: 12px;
    background: #fff;
    border: 1px solid var(--line);
    color: var(--text-main);
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.2s;
}

.btn.primary {
    background: var(--primary);
    color: #fff;
    border-color: transparent;
    box-shadow: 0 4px 12px rgba(77, 105, 222, 0.3);
}

.btn.primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(77, 105, 222, 0.4);
}

/* Floating Save Button */
.save-float {
    position: fixed;
    bottom: 24px;
    right: 24px;
    background: var(--text-main);
    color: #fff;
    padding: 16px 24px;
    border-radius: 99px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
    cursor: pointer;
    z-index: 100;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 10px;
    transition: transform 0.2s;
}

.save-float:hover {
    transform: scale(1.05);
}

/* Responsive Media Queries */
@media (max-width: 1024px) {
    section.slide {
        padding: 80px 24px;
    }

    .grid-cols {
        gap: 24px;
    }

    .card {
        padding: 32px;
    }
}

@media (max-width: 768px) {

    /* Stack columns on mobile */
    .grid-cols {
        grid-template-columns: 1fr;
    }

    /* Stack inner grids on mobile too */
    .inner-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }

    /* Reset height to auto since stacking */
    .card {
        height: auto;
        padding: 24px;
        /* Reduce padding from 32/40px */
    }

    section.slide {
        padding: 60px 16px 32px;
        /* Reduce side padding to maximize width */
        height: auto;
        min-height: auto;
        display: block;
        /* Normal block flow */
    }

    .deck {
        scroll-snap-type: none;
        /* Disable snap on mobile often feels better, but strict user req was adaptation */
        height: auto;
        overflow-y: visible;
    }

    .nav {
        display: none;
    }

    .brand span {
        display: none;
    }

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

    .result {
        grid-template-columns: 1fr;
        grid-column: span 1;
    }
}

/* Print (Hide tools) */
@media print {

    .save-float,
    .topbar {
        display: none !important;
    }

    [contenteditable="true"] {
        border: none !important;
        outline: none !important;
        background: transparent !important;
    }
}