/* ─── SweetCrumbs Bakery — design tokens + global layout (roadmap §12.1) ─── */

:root {
    /* Brand Colours — Honey Gold, Editorial Premium */
    --color-primary:       #C98A2E;  /* Honey gold */
    --color-primary-dark:  #9E6B1F;  /* Deep honey */
    --color-secondary:     #F3E6C9;  /* Honey cream */
    --color-accent:        #7E9256;  /* Sage */
    --color-bg:            #FCF8F0;  /* Ivory */
    --color-surface:       #FFFFFF;
    --color-text:          #2E2118;  /* Deep ink */
    --color-text-muted:    #7C6E5C;  /* Muted ink */
    --color-success:       #7E9256;  /* Sage */
    --color-error:         #C0392B;
    --color-warning:       #C98A2E;  /* Honey (warm alerts) */
    --color-border:        #EADBC4;

    /* Typography */
    --font-display: 'Playfair Display', Georgia, serif;
    --font-body:    'DM Sans', 'Helvetica Neue', Arial, sans-serif;
    --font-size-xs:   11px;
    --font-size-sm:   13px;
    --font-size-base: 15px;
    --font-size-lg:   18px;
    --font-size-xl:   22px;
    --font-size-2xl:  28px;
    --font-size-3xl:  36px;

    /* Spacing */
    --space-xs:  4px;   --space-sm:  8px;
    --space-md:  16px;  --space-lg:  24px;
    --space-xl:  40px;  --space-2xl: 64px;

    /* Radii */
    --radius-sm:   8px;
    --radius-md:   16px;
    --radius-lg:   24px;
    --radius-full: 999px;

    /* Shadows */
    --shadow-card:  0 2px 12px rgba(46,33,24,0.08);
    --shadow-modal: 0 8px 40px rgba(46,33,24,0.16);
    --shadow-btn:   0 4px 12px rgba(201,138,46,0.32);

    /* Layout */
    --bottom-nav-height: 64px;
    --header-height:     56px;
}

/* Self-hosted fonts (files in /assets/fonts/, downloaded at build time) */
@font-face {
    font-family: 'Playfair Display';
    src: url('/assets/fonts/playfair-display-700.woff2') format('woff2');
    font-weight: 700; font-display: swap;
}
@font-face {
    font-family: 'DM Sans';
    src: url('/assets/fonts/dm-sans-400.woff2') format('woff2');
    font-weight: 400; font-display: swap;
}
@font-face {
    font-family: 'DM Sans';
    src: url('/assets/fonts/dm-sans-500.woff2') format('woff2');
    font-weight: 500; font-display: swap;
}
@font-face {
    font-family: 'DM Sans';
    src: url('/assets/fonts/dm-sans-700.woff2') format('woff2');
    font-weight: 700; font-display: swap;
}

/* ─── Reset ─── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
    font-family: var(--font-body);
    font-size: var(--font-size-base);
    color: var(--color-text);
    background: var(--color-bg);
    min-height: 100vh;
    overflow-x: hidden;
}
img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
button { font: inherit; cursor: pointer; border: none; background: none; color: inherit; }
input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3 { font-family: var(--font-display); line-height: 1.2; }

/* ─── App shell ─── */
.app-header {
    position: fixed; top: 0; left: 0; right: 0; z-index: 50;
    height: var(--header-height);
    display: flex; align-items: center; gap: var(--space-sm);
    padding: 0 var(--space-md);
    background: rgba(252,248,240,0.92);
    backdrop-filter: blur(8px);
    border-bottom: 1px solid var(--color-border);
}
.header-brand { display: flex; align-items: center; gap: 6px; flex: 1; }
.header-logo { font-size: 22px; }
.header-name { font-family: var(--font-display); font-weight: 700; font-size: var(--font-size-lg); }
.header-back { font-size: 26px; width: 36px; height: 36px; line-height: 1; }
.header-bell { position: relative; font-size: 19px; width: 44px; height: 44px; }
.bell-badge {
    position: absolute; top: 4px; right: 4px;
    background: var(--color-error); color: #fff;
    font-size: 10px; font-family: var(--font-body);
    min-width: 16px; height: 16px; border-radius: var(--radius-full);
    display: flex; align-items: center; justify-content: center; padding: 0 3px;
}

#app-root {
    padding: calc(var(--header-height) + var(--space-md)) var(--space-md)
             calc(var(--bottom-nav-height) + env(safe-area-inset-bottom) + var(--space-lg));
    max-width: 560px; margin: 0 auto;
    min-height: 100vh;
}

/* ─── Bottom nav ─── */
.bottom-nav {
    position: fixed; bottom: 0; left: 0; right: 0; z-index: 50;
    height: calc(var(--bottom-nav-height) + env(safe-area-inset-bottom));
    padding-bottom: env(safe-area-inset-bottom);
    display: flex;
    background: var(--color-surface);
    border-top: 1px solid var(--color-border);
}
.nav-item {
    flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: 2px; position: relative;
    font-size: var(--font-size-xs); color: var(--color-text-muted);
    min-height: 44px;
}
.nav-item.active { color: var(--color-primary); font-weight: 700; }
.cart-badge {
    position: absolute; top: 6px; left: calc(50% + 4px);
    background: var(--color-error); color: #fff;
    font-size: 10px; min-width: 16px; height: 16px;
    border-radius: var(--radius-full);
    display: flex; align-items: center; justify-content: center; padding: 0 3px;
}

/* ─── Loading ─── */
.page-loading { display: flex; justify-content: center; padding: var(--space-2xl) 0; }
.spinner {
    width: 36px; height: 36px;
    border: 3px solid var(--color-border);
    border-top-color: var(--color-primary);
    border-radius: 50%;
    animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ─── Utility ─── */
.muted   { color: var(--color-text-muted); }
.small   { font-size: var(--font-size-sm); }
.center  { text-align: center; }
.mt-md   { margin-top: var(--space-md); }
.mt-lg   { margin-top: var(--space-lg); }
.mb-md   { margin-bottom: var(--space-md); }
.hidden  { display: none !important; }
.price   { font-weight: 700; color: var(--color-primary-dark); }
.section-title {
    font-family: var(--font-display); font-size: var(--font-size-xl);
    margin: var(--space-lg) 0 var(--space-md);
}
.hscroll {
    display: flex; gap: var(--space-md); overflow-x: auto;
    scroll-snap-type: x mandatory; padding-bottom: var(--space-sm);
    margin: 0 calc(-1 * var(--space-md)); padding-left: var(--space-md); padding-right: var(--space-md);
    -webkit-overflow-scrolling: touch; scrollbar-width: none;
}
.hscroll::-webkit-scrollbar { display: none; }
.hscroll > * { scroll-snap-align: start; flex-shrink: 0; }
