/* Casa Modesta - Core Design System */

@font-face {
    font-family: 'BebasNeue';
    src: url('../fonts/BebasNeue-Regular.woff2') format('woff2'),
         url('../fonts/BebasNeue-Regular.woff') format('woff');
    font-weight: normal;
    font-style: normal;
    font-display: swap;
}

:root {
    /* Default Light Mode (Casa Luxe) */
    --cm-bg: #f7f1e8;
    --cm-surface: #fffaf3;
    --cm-surface-2: #f2e9dd;
    --cm-border: #e4d8c7;
    --cm-ink: #15110f;
    --cm-muted: #6f665e;
    --cm-accent: #c69d58;
    --cm-shadow: rgba(26, 18, 12, 0.12);
    
    /* Typography */
    --cm-font-primary: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    --cm-font-serif: 'Playfair Display', Georgia, serif;
    --cm-font-display: 'BebasNeue', sans-serif;
}

/* Dark Mode Override (Casa Luxe) */
[data-mode="dark"] {
    --cm-bg: #090806;
    --cm-surface: #14100d;
    --cm-surface-2: #1e1712;
    --cm-border: #30271f;
    --cm-ink: #fff7ec;
    --cm-muted: #cbbfad;
    --cm-accent: #d3ad68;
    --cm-shadow: rgba(0, 0, 0, 0.38);
}

/* CSS Resets & Foundation */
*, *::before, *::after {
    box-sizing: border-box;
}

html, body {
    margin: 0;
    padding: 0;
    width: 100%;
    height: 100%;
    background-color: var(--cm-bg);
    color: var(--cm-ink);
    font-family: var(--cm-font-primary);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-x: hidden;
}

/* Mobile-First App Container */
.cm-app-container {
    max-width: 480px;
    margin: 0 auto;
    min-height: 100vh;
    background-color: var(--cm-bg);
    position: relative;
    box-shadow: 0 0 40px var(--cm-shadow);
    display: flex;
    flex-direction: column;
}

/* Global Typography */
h1, h2, h3, h4, h5, h6 {
    font-family: var(--cm-font-serif);
    color: var(--cm-ink);
    margin-top: 0;
    font-weight: 600;
}

.cm-display-text {
    font-family: var(--cm-font-display);
    text-transform: uppercase;
    letter-spacing: 1px;
}

a {
    color: var(--cm-ink);
    text-decoration: none;
    transition: color 0.2s ease;
}

/* Reusable Surface Cards */
.cm-card {
    background-color: var(--cm-surface);
    border: 1px solid var(--cm-border);
    border-radius: 16px;
    padding: 20px;
    box-shadow: 0 4px 12px var(--cm-shadow);
}

.cm-card-inner {
    background-color: var(--cm-surface-2);
    border-radius: 12px;
    padding: 16px;
}

/* Desktop App-Constraint Override */
@media (min-width: 769px) {
    body {
        display: flex;
        flex-direction: column; /* Fixes the split */
        align-items: center;    /* Centers the app */
        background-color: #e5e5e5;
        min-height: 100vh;
    }
    
    .cm-app-container, 
    .cm-header, 
    .cm-bottom-nav, 
    .cm-footer {
        width: 100% !important;
        max-width: 480px !important; /* Strict clamp */
        margin: 0 auto;
        left: auto !important;
        right: auto !important;
        transform: none !important; /* Removes translateX(-50%) conflicts on desktop */
    }

    .cm-bottom-nav {
        position: fixed;
        bottom: 24px;
    }
}
