/* ═══════════════════════════════════════════════════════════
   El Couzina — Pirate / Corsaires Theme Layer
   Wax seals, compass rose, rope, parchment, ornaments, gold leaf
   Inspired by Algerian Barbary corsairs aesthetic
   ═══════════════════════════════════════════════════════════ */

:root {
    --wax-red: #8b0f1a;
    --wax-red-dark: #5e0810;
    --parchment: #f5e8c8;
    --parchment-dark: #e6d4a8;
    --aged-edge: #5C3A12;
    --brass: #b88945;
    --brass-light: #d4a76a;
}

/* ─── Parchment texture overlay (subtle) ─────────────── */
.parchment-overlay {
    position: relative;
    isolation: isolate;
}

.parchment-overlay::after {
    content: '';
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 1;
    opacity: 0.08;
    mix-blend-mode: multiply;
    background-image:
        radial-gradient(ellipse at top, rgba(92, 58, 18, 0.15), transparent 60%),
        radial-gradient(ellipse at bottom right, rgba(184, 137, 69, 0.1), transparent 60%),
        url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 240 240'><filter id='r'><feTurbulence baseFrequency='0.65' numOctaves='3' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 0.36 0 0 0 0 0.23 0 0 0 0 0.07 0 0 0 0.45 0'/></filter><rect width='100%25' height='100%25' filter='url(%23r)'/></svg>");
    background-size: auto, auto, 240px 240px;
}

/* ─── Wax seal (signature/chef badge) ────────────────── */
.wax-seal {
    --seal-size: 78px;
    position: absolute;
    top: var(--space-3);
    right: var(--space-3);
    width: var(--seal-size);
    height: var(--seal-size);
    z-index: 3;
    transform: rotate(-12deg);
    pointer-events: none;
    filter: drop-shadow(0 4px 8px rgba(94, 8, 16, 0.45));
    animation: wax-stamp 0.7s var(--ease-elastic) both;
}

.wax-seal-bg {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background:
        radial-gradient(circle at 30% 25%, rgba(255, 255, 255, 0.35), transparent 50%),
        radial-gradient(circle at 70% 80%, rgba(0, 0, 0, 0.35), transparent 60%),
        linear-gradient(135deg, var(--wax-red) 0%, var(--wax-red-dark) 100%);
    border: 2px solid rgba(0, 0, 0, 0.25);
    display: grid;
    place-items: center;
    position: relative;
    /* Irregular wax edge */
    clip-path: polygon(
        50% 0%, 60% 4%, 70% 2%, 80% 8%, 88% 16%, 96% 24%, 98% 36%, 100% 50%,
        96% 62%, 94% 74%, 86% 84%, 78% 92%, 66% 96%, 54% 100%, 42% 98%, 30% 96%,
        20% 92%, 12% 84%, 6% 74%, 2% 62%, 0% 50%, 4% 38%, 6% 26%, 14% 18%,
        22% 10%, 32% 6%, 42% 2%
    );
}

.wax-seal-emblem {
    width: 56%;
    height: 56%;
    color: rgba(255, 255, 255, 0.92);
    filter: drop-shadow(0 1px 0 rgba(0, 0, 0, 0.35));
}

@keyframes wax-stamp {
    0% { opacity: 0; transform: scale(2.2) rotate(-30deg); }
    50% { opacity: 1; transform: scale(0.95) rotate(-10deg); }
    70% { transform: scale(1.04) rotate(-13deg); }
    100% { opacity: 1; transform: scale(1) rotate(-12deg); }
}

@media (prefers-reduced-motion: reduce) {
    .wax-seal { animation: none; }
}

/* ─── Compass rose (decorative) ──────────────────────── */
.compass-rose {
    width: 56px;
    height: 56px;
    margin: 0 auto var(--space-3);
    color: var(--secondary);
    animation: compass-spin 24s linear infinite;
    transform-origin: center;
}

@keyframes compass-spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

@media (prefers-reduced-motion: reduce) {
    .compass-rose { animation: none; }
}

/* Spin faster on filter change */
.compass-rose.is-spinning {
    animation: compass-fast 0.9s var(--ease-elastic);
}

@keyframes compass-fast {
    from { transform: rotate(0deg) scale(1); }
    50% { transform: rotate(180deg) scale(1.1); }
    to { transform: rotate(360deg) scale(1); }
}

/* ─── Rope divider ───────────────────────────────────── */
.rope-divider {
    display: block;
    width: 100%;
    max-width: 320px;
    height: 14px;
    margin: var(--space-12) auto;
    color: var(--brass);
    opacity: 0.85;
}

.rope-divider svg {
    width: 100%;
    height: 100%;
    display: block;
}

/* ─── Map corner ornaments (4 corners of cards) ──────── */
.map-corners {
    position: relative;
}

.map-corners::before,
.map-corners::after {
    content: '';
    position: absolute;
    width: 18px;
    height: 18px;
    border: 1.5px solid var(--brass);
    pointer-events: none;
    opacity: 0.55;
}

.map-corners::before {
    top: 8px;
    left: 8px;
    border-right: none;
    border-bottom: none;
}

.map-corners::after {
    bottom: 8px;
    right: 8px;
    border-left: none;
    border-top: none;
}

/* ─── Captain's signature accent ────────────────────── */
.captain-script {
    font-family: var(--font-accent);
    font-size: 1.15em;
    color: var(--secondary);
    font-style: italic;
}

/* ─── Quick filters bar ──────────────────────────────── */
.quick-filters {
    display: flex;
    gap: var(--space-2);
    overflow-x: auto;
    padding: var(--space-3) 0 var(--space-2);
    margin-bottom: var(--space-3);
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
    scroll-snap-type: x proximity;
}

.quick-filters::-webkit-scrollbar { display: none; }

.quick-filter {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    padding: 8px 14px;
    min-height: 38px;
    font-family: var(--font-body);
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0.02em;
    color: var(--text-secondary);
    background: transparent;
    border: 1.5px solid var(--border-strong);
    border-radius: var(--radius-full);
    cursor: pointer;
    transition: all var(--duration) var(--ease);
    white-space: nowrap;
    -webkit-tap-highlight-color: transparent;
    scroll-snap-align: start;
}

.quick-filter:hover,
.quick-filter:active {
    color: var(--text);
    border-color: var(--secondary);
}

.quick-filter.is-active {
    background: linear-gradient(135deg, var(--secondary), var(--secondary-dark));
    color: var(--bg-dark);
    border-color: var(--secondary-dark);
    box-shadow: 0 3px 10px rgba(212, 163, 55, 0.35);
}

.quick-filter-emoji {
    font-size: 15px;
    line-height: 1;
}

/* ─── Selection FAB + Drawer (Ma Sélection) ──────────── */
.selection-fab {
    display: none;
    position: fixed;
    left: calc(var(--mobile-gutter) + var(--safe-left));
    bottom: calc(var(--bottom-nav-height) + var(--safe-bottom) + var(--space-4) + 56px);
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--wax-red) 0%, var(--wax-red-dark) 100%);
    color: white;
    box-shadow: 0 6px 18px rgba(94, 8, 16, 0.4);
    border: 2px solid var(--secondary-light);
    z-index: var(--z-fab);
    cursor: pointer;
    place-items: center;
    -webkit-tap-highlight-color: transparent;
    transition: transform 0.35s var(--ease-elastic);
}

.selection-fab.is-visible {
    display: grid;
    animation: chestPop 0.5s var(--ease-elastic);
}

@keyframes chestPop {
    0% { transform: scale(0) rotate(-45deg); }
    100% { transform: scale(1) rotate(0); }
}

.selection-fab:hover,
.selection-fab:active {
    transform: scale(1.06);
}

.selection-fab svg {
    width: 26px;
    height: 26px;
    stroke-width: 2;
}

.selection-fab-count {
    position: absolute;
    top: -6px;
    right: -6px;
    min-width: 24px;
    height: 24px;
    padding: 0 6px;
    border-radius: 999px;
    background: var(--secondary);
    color: var(--bg-dark);
    font-family: var(--font-body);
    font-size: 12px;
    font-weight: 700;
    display: grid;
    place-items: center;
    border: 2px solid white;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
}

/* Selection drawer */
.selection-drawer {
    position: fixed;
    inset: 0;
    z-index: var(--z-modal);
    pointer-events: none;
}

.selection-drawer-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(11, 26, 40, 0.55);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    opacity: 0;
    transition: opacity var(--duration) var(--ease);
}

.selection-drawer-panel {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    max-height: 85dvh;
    background: var(--parchment);
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 240 240'><filter id='r'><feTurbulence baseFrequency='0.7' numOctaves='3' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 0.36 0 0 0 0 0.23 0 0 0 0 0.07 0 0 0 0.18 0'/></filter><rect width='100%25' height='100%25' filter='url(%23r)'/></svg>");
    background-size: 240px 240px;
    color: var(--aged-edge);
    border-top: 4px solid var(--wax-red);
    border-radius: 28px 28px 0 0;
    padding: var(--space-4) var(--space-6) calc(var(--space-8) + var(--safe-bottom));
    box-shadow: 0 -16px 48px rgba(15, 44, 68, 0.35);
    transform: translateY(100%);
    transition: transform 0.5s var(--ease-out-expo);
    overscroll-behavior: contain;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.selection-drawer.is-open { pointer-events: auto; }
.selection-drawer.is-open .selection-drawer-backdrop { opacity: 1; }
.selection-drawer.is-open .selection-drawer-panel { transform: translateY(0); }

.selection-grip {
    width: 44px;
    height: 5px;
    border-radius: 999px;
    background: rgba(94, 58, 18, 0.3);
    margin: 0 auto var(--space-3);
}

.selection-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-3);
    margin-bottom: var(--space-5);
    padding-bottom: var(--space-3);
    border-bottom: 1.5px dashed rgba(94, 58, 18, 0.3);
}

.selection-title {
    font-family: var(--font-display);
    font-size: var(--text-2xl);
    font-weight: 600;
    color: var(--aged-edge);
    line-height: 1.1;
}

.selection-title small {
    display: block;
    font-family: var(--font-accent);
    font-size: 16px;
    color: var(--wax-red);
    font-weight: 400;
    margin-top: 2px;
}

.selection-clear {
    color: var(--text-muted);
    background: transparent;
    border: 1px solid rgba(94, 58, 18, 0.25);
    border-radius: var(--radius-full);
    padding: 6px 12px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--duration) var(--ease);
    -webkit-tap-highlight-color: transparent;
}

.selection-clear:hover,
.selection-clear:active {
    color: var(--wax-red);
    border-color: var(--wax-red);
}

.selection-list {
    list-style: none;
    margin: 0 0 var(--space-5);
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
}

.selection-item {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-3);
    background: rgba(255, 255, 255, 0.5);
    border: 1px solid rgba(94, 58, 18, 0.15);
    border-radius: var(--radius);
    transition: all var(--duration) var(--ease);
}

.selection-item-icon {
    width: 38px;
    height: 38px;
    border-radius: var(--radius-sm);
    background: linear-gradient(135deg, var(--brass-light), var(--brass));
    color: white;
    display: grid;
    place-items: center;
    flex-shrink: 0;
    font-size: 18px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.selection-item-body {
    flex: 1;
    min-width: 0;
}

.selection-item-name {
    font-family: var(--font-display);
    font-size: 15px;
    font-weight: 600;
    color: var(--aged-edge);
    line-height: 1.2;
    margin-bottom: 2px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.selection-item-price {
    font-family: var(--font-display);
    font-size: 13px;
    font-weight: 600;
    color: var(--wax-red);
}

.selection-item-remove {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: transparent;
    color: var(--text-muted);
    display: grid;
    place-items: center;
    cursor: pointer;
    border: 1px solid rgba(94, 58, 18, 0.2);
    flex-shrink: 0;
    transition: all var(--duration) var(--ease);
    -webkit-tap-highlight-color: transparent;
}

.selection-item-remove:hover,
.selection-item-remove:active {
    color: var(--wax-red);
    border-color: var(--wax-red);
    background: rgba(139, 15, 26, 0.06);
}

.selection-item-remove svg {
    width: 14px;
    height: 14px;
    stroke-width: 2.5;
}

.selection-actions {
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
    padding-top: var(--space-2);
    border-top: 1.5px dashed rgba(94, 58, 18, 0.25);
}

.selection-actions .btn {
    width: 100%;
    justify-content: center;
}

.selection-actions .btn-pirate {
    background: linear-gradient(135deg, var(--wax-red) 0%, var(--wax-red-dark) 100%);
    color: white;
    border-color: var(--wax-red-dark);
    box-shadow: 0 6px 18px rgba(94, 8, 16, 0.35);
}

.selection-actions .btn-pirate:hover,
.selection-actions .btn-pirate:active {
    background: linear-gradient(135deg, var(--wax-red-dark) 0%, #3d050a 100%);
    border-color: #3d050a;
    color: white;
    transform: translateY(-2px);
}

.selection-empty {
    text-align: center;
    padding: var(--space-12) var(--space-4);
    color: var(--text-muted);
}

.selection-empty-icon {
    font-size: 4rem;
    margin-bottom: var(--space-3);
    opacity: 0.5;
    line-height: 1;
}

/* ─── Add to selection button on cards ───────────────── */
.menu-item-add {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--secondary), var(--secondary-dark));
    color: var(--bg-dark);
    display: grid;
    place-items: center;
    cursor: pointer;
    border: none;
    flex-shrink: 0;
    box-shadow: 0 3px 8px rgba(176, 134, 42, 0.4);
    transition: all var(--duration) var(--ease);
    -webkit-tap-highlight-color: transparent;
}

.menu-item-add:hover,
.menu-item-add:active {
    transform: scale(1.1) rotate(90deg);
    box-shadow: 0 5px 14px rgba(176, 134, 42, 0.55);
}

.menu-item-add svg {
    width: 18px;
    height: 18px;
    stroke-width: 2.5;
    transition: transform 0.35s var(--ease-elastic);
}

.menu-item.is-selected .menu-item-add {
    background: linear-gradient(135deg, #2D7D5F, #1F5A3F);
    color: white;
    box-shadow: 0 3px 8px rgba(45, 125, 95, 0.4);
}

.menu-item.is-selected .menu-item-add svg {
    transform: rotate(180deg);
}

/* ─── Selection toast variant ────────────────────────── */
.toast-pirate {
    background: linear-gradient(135deg, var(--wax-red), var(--wax-red-dark)) !important;
    color: white !important;
    border-left: 4px solid var(--secondary);
}

/* ─── Move selection FAB position when bottom-nav present (mobile) ─── */
@media (max-width: 1023px) {
    .selection-fab {
        bottom: calc(var(--bottom-nav-height) + var(--safe-bottom) + var(--space-4) + var(--fab-size) + var(--space-3));
    }
}

/* On desktop: bottom right corner */
@media (min-width: 1024px) {
    .selection-fab {
        left: auto;
        right: var(--space-8);
        bottom: var(--space-8);
    }
}

/* ─── Captain's pick card (top of carte) ─────────────── */
.captain-pick {
    position: relative;
    margin: var(--space-6) 0 var(--space-10);
    padding: var(--space-8);
    background:
        linear-gradient(135deg, rgba(245, 232, 200, 0.95), rgba(230, 212, 168, 0.95)),
        url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 240 240'><filter id='r'><feTurbulence baseFrequency='0.65' numOctaves='3' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 0.36 0 0 0 0 0.23 0 0 0 0 0.07 0 0 0 0.4 0'/></filter><rect width='100%25' height='100%25' filter='url(%23r)'/></svg>");
    background-size: auto, 240px 240px;
    border: 2px solid var(--brass);
    border-radius: var(--radius-lg);
    box-shadow: 0 10px 30px rgba(15, 44, 68, 0.15), inset 0 0 0 4px rgba(255, 255, 255, 0.3);
    color: var(--aged-edge);
    overflow: hidden;
}

.captain-pick::before,
.captain-pick::after {
    content: '';
    position: absolute;
    width: 26px;
    height: 26px;
    border: 2px solid var(--brass);
    pointer-events: none;
}

.captain-pick::before {
    top: 10px; left: 10px;
    border-right: none;
    border-bottom: none;
}

.captain-pick::after {
    bottom: 10px; right: 10px;
    border-left: none;
    border-top: none;
}

.captain-pick-eyebrow {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    font-family: var(--font-body);
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: var(--tracking-widest);
    color: var(--wax-red);
    margin-bottom: var(--space-2);
}

.captain-pick-name {
    font-family: var(--font-display);
    font-size: clamp(1.75rem, 4vw, 2.5rem);
    font-weight: 600;
    line-height: 1.05;
    color: var(--aged-edge);
    margin-bottom: var(--space-3);
}

.captain-pick-desc {
    font-size: 14px;
    line-height: 1.6;
    color: rgba(94, 58, 18, 0.85);
    margin-bottom: var(--space-4);
    max-width: 560px;
}

.captain-pick-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-3);
    flex-wrap: wrap;
}

.captain-pick-price {
    font-family: var(--font-display);
    font-size: 28px;
    font-weight: 700;
    color: var(--wax-red);
}

.captain-pick-quote {
    font-family: var(--font-accent);
    font-size: 18px;
    color: var(--brass);
    font-style: italic;
}

/* ─── Hero crescent decoration ───────────────────────── */
.hero-crescent {
    position: absolute;
    top: 12%;
    right: 6%;
    width: clamp(60px, 9vw, 110px);
    height: clamp(60px, 9vw, 110px);
    color: rgba(244, 201, 93, 0.45);
    z-index: 2;
    pointer-events: none;
    animation: crescent-float 7s ease-in-out infinite alternate;
}

@keyframes crescent-float {
    from { transform: translateY(0) rotate(-10deg); }
    to { transform: translateY(-12px) rotate(8deg); }
}

@media (prefers-reduced-motion: reduce) {
    .hero-crescent { animation: none; }
}

/* ─── Wave divider (between sections) ────────────────── */
.wave-divider {
    display: block;
    width: 100%;
    height: 28px;
    color: var(--secondary);
    opacity: 0.55;
    margin: var(--space-2) 0;
}

/* ─── Wax seal badge variant in product list ─────────── */
.menu-item-image .wax-seal { --seal-size: 64px; }

@media (max-width: 480px) {
    .menu-item-image .wax-seal { --seal-size: 56px; }
}
