/*
 * styles.css
 * ordessa-web
 *
 * Application stylesheet installed by SwiftWebUIRuntime before the initial mount.
 *
 * SwiftWebUI applies element declarations inline; named selectors, custom
 * properties, pseudo-classes, and media queries belong here.
 */

:root {
    color-scheme: light dark;

    --ordessa-background: #fdf7f0;
    --ordessa-surface: #ffffff;
    --ordessa-surface-elevated: #f6efe6;
    --ordessa-border: #e7d9c8;
    --ordessa-text: #241a12;
    --ordessa-text-secondary: #7a675a;
    --ordessa-accent: #c8442a;
    --ordessa-accent-text: #fff8f2;
    --ordessa-highlight: #f7d774;
}

@media (prefers-color-scheme: dark) {
    :root {
        --ordessa-background: #17110d;
        --ordessa-surface: #221a15;
        --ordessa-surface-elevated: #2c221b;
        --ordessa-border: #3a2c23;
        --ordessa-text: #f6ece2;
        --ordessa-text-secondary: #b7a496;
        --ordessa-accent: #ef6a4c;
        --ordessa-accent-text: #1a0f0a;
        --ordessa-highlight: #6b5320;
    }
}

/*
 * Per-shop palettes.
 *
 * ShopView installs `ordessa-theme-<shop id>` on the mounted root. Custom
 * properties inherit, so redeclaring the accent tokens here recolours the whole
 * subtree without a single view referencing a literal colour.
 *
 * These are the fallbacks now, not the last word: a shop that has set `tint`
 * gets a rule on the same class installed after this sheet, and equal
 * specificity means the later one wins. The two below match what `seed` writes
 * for those shops, so clearing the column leaves the page looking the same.
 */

.ordessa-theme-goudenhap {
    --ordessa-accent: #b8860b;
    --ordessa-accent-text: #fffaf0;
    --ordessa-highlight: #f0dc9a;
}

.ordessa-theme-pizzaveloce {
    --ordessa-accent: #2e7d4f;
    --ordessa-accent-text: #f4fbf6;
    --ordessa-highlight: #ffd9a0;
}

@media (prefers-color-scheme: dark) {
    .ordessa-theme-goudenhap {
        --ordessa-accent: #e0b34a;
        --ordessa-accent-text: #1a1206;
        --ordessa-highlight: #6b5320;
    }

    .ordessa-theme-pizzaveloce {
        --ordessa-accent: #5cbb85;
        --ordessa-accent-text: #0b1a11;
        --ordessa-highlight: #4a3a1c;
    }
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    background: var(--ordessa-background);
    color: var(--ordessa-text);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    -webkit-font-smoothing: antialiased;
}

button {
    font: inherit;
    border: none;
    background: none;
}

/* The mounted root paints the palette; the body behind it must not show through. */
.ordessa-shop,
.ordessa-landing {
    min-height: 100vh;
}

.ordessa-product-card,
.ordessa-shop-card {
    transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.ordessa-product-card:hover,
.ordessa-shop-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 24px 50px rgba(38, 22, 12, 0.14);
}

/* Shop cards are links, so the whole card must read as one target. */
.ordessa-shop-card {
    color: inherit;
    text-decoration: none;
}

.ordessa-shop-card:hover .ordessa-shop-cta {
    text-decoration: underline;
}

.ordessa-back-link:hover {
    text-decoration: underline;
}

.ordessa-pill:hover {
    filter: brightness(0.97);
}

.ordessa-add-button:hover,
.ordessa-checkout-button:hover {
    filter: brightness(1.06);
}

.ordessa-stepper-button {
    width: 30px;
    height: 30px;
    border-radius: 999px;
    font-weight: 700;
    line-height: 1;
    cursor: pointer;
    color: var(--ordessa-text);
    background: var(--ordessa-surface);
    border: 1px solid var(--ordessa-border);
}

.ordessa-stepper-button:hover {
    background: var(--ordessa-highlight);
}

.ordessa-remove-button:hover,
.ordessa-clear-button:hover {
    color: var(--ordessa-accent);
    border-color: var(--ordessa-accent);
}

.ordessa-order-line + .ordessa-order-line {
    border-top: 1px solid var(--ordessa-border);
}

.ordessa-header {
    border-bottom: 1px solid var(--ordessa-border);
}

.ordessa-footer {
    border-top: 1px solid var(--ordessa-border);
}

.ordessa-cart {
    align-self: start;
}

button:focus-visible,
a:focus-visible {
    outline: 3px solid var(--ordessa-accent);
    outline-offset: 2px;
}

@media (max-width: 900px) {
    .ordessa-layout {
        grid-template-columns: minmax(0, 1fr) !important;
    }

    .ordessa-cart {
        position: static !important;
    }

    .ordessa-header,
    .ordessa-footer-content {
        flex-direction: column !important;
        align-items: flex-start !important;
        gap: 12px;
    }
}

/* Loading placeholders ---------------------------------------------------- */

/* Sized like the real cards so the layout does not jump when the data lands. */
.ordessa-skeleton-card {
    min-height: 168px;
}

.ordessa-skeleton-line {
    display: block;
    height: 12px;
    border-radius: 999px;
    background: var(--ordessa-highlight);
    animation: ordessa-pulse 1.4s ease-in-out infinite;
}

.ordessa-skeleton-card .ordessa-skeleton-line:nth-child(2) {
    animation-delay: 0.15s;
}

.ordessa-skeleton-card .ordessa-skeleton-line:nth-child(3) {
    animation-delay: 0.3s;
}

@keyframes ordessa-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.45; }
}

/* Respect a visitor who has asked for less motion. */
@media (prefers-reduced-motion: reduce) {
    .ordessa-skeleton-line {
        animation: none;
    }
}

/* The technical reason behind an unavailable API: for whoever is debugging a
   deployment, not for the visitor ordering friet. */
.ordessa-error-detail {
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    word-break: break-word;
    opacity: 0.75;
}
