/* 
 * So Flickering Good — Modern Storefront Design System
 * Quiet Power / Professional Awe / Sovereign Edge
 */

:root {
    --glass-bg: rgba(255,255,255,0.04);
    --glass-border: rgba(255,255,255,0.11);
    --accent: #D4A96A;          /* warm cognac gold */
    --premium-accent: #C9A96E;
    --classic-accent: #7BA891;
    --text: #fff;
    --text-dim: rgba(255,255,255,0.55);
    --text-faint: rgba(255,255,255,0.28);
    --bg: #06050C;              /* near-black with a hint of violet */
    --card-radius: 28px;
    --panel-radius: 24px;
}

*, *::before, *::after { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html { 
    margin: 0; padding: 0; width: 100%; 
    background: var(--bg); color: var(--text); 
    font-family: 'Inter', system-ui, sans-serif; 
    overflow-x: hidden; scroll-behavior: smooth; 
}

body { 
    margin: 0; padding: 0; width: 100%; 
    min-height: 100dvh; background: var(--bg); 
    color: var(--text); font-family: 'Inter', system-ui, sans-serif; 
    overflow-x: hidden; 
}

body:not(.funnel-active):not(.app-visible) { height: 100dvh; overflow: hidden; }
body.funnel-active, body.app-visible { overflow-y: auto; height: auto; }

/* ── Background Video & Vignette ── */
#bg-iframe { 
    position: fixed; inset: 0; width: 100%; height: 100%; 
    border: none; z-index: 0; pointer-events: none; 
    opacity: 0; transition: opacity 3s ease; 
}
.vignette { 
    position: fixed; inset: 0; z-index: 1; pointer-events: none;
    background: radial-gradient(ellipse at 50% 100%, rgba(212,169,106,0.04) 0%, transparent 60%),
                linear-gradient(180deg, rgba(6,5,12,0.65) 0%, rgba(6,5,12,0.15) 40%, rgba(6,5,12,0.75) 100%); 
}

/* ── Boot Sequence ── */
#boot-layer {
    position: fixed; inset: 0; z-index: 9000;
    background: var(--bg);
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0;
    transition: opacity 1.4s ease, filter 1.4s ease;
}
.lotus-sketch {
    width: 140px; height: 140px; margin-bottom: 28px;
    filter: drop-shadow(0 0 18px rgba(212,169,106,0.18));
    transition: transform 3s ease-in-out;
    animation: lotusBreathe 4s infinite 2.5s alternate ease-in-out;
}
.lotus-sketch path {
    fill: none; stroke: rgba(255,255,255,0.85); stroke-width: 1.15;
    stroke-linecap: round; stroke-linejoin: round;
    stroke-dasharray: 260; stroke-dashoffset: 260;
    animation: sketchIn 2.4s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}
.lotus-sketch path:nth-child(1) { stroke-width: 1.5; animation-delay: 0s; }
.lotus-sketch path:nth-child(2) { animation-delay: 0.1s; }
.lotus-sketch path:nth-child(7), .lotus-sketch path:nth-child(8) { stroke: rgba(212,169,106,0.6); }

@keyframes sketchIn { to { stroke-dashoffset: 0; } }
@keyframes lotusBreathe { 
    0% { transform: scale(1); filter: drop-shadow(0 0 18px rgba(212,169,106,0.18)); }
    100% { transform: scale(1.08); filter: drop-shadow(0 0 32px rgba(212,169,106,0.4)); }
}

.greeting-cycler { height: 36px; position: relative; width: 260px; text-align: center; }
.boot-greeting {
    position: absolute; width: 100%; top: 0; left: 0;
    font-size: 1.1rem; font-weight: 200; letter-spacing: 0.22em;
    color: rgba(255,255,255,0.75); opacity: 0; transform: translateY(8px); 
    transition: all 0.9s ease;
}
.boot-greeting.active { opacity: 1; transform: translateY(0); }

#app-root { 
    position: relative; min-height: 100dvh; z-index: 10;
    display: flex; flex-direction: column; opacity: 0; pointer-events: none;
    transition: opacity 1.8s ease; 
}
#app-root.visible { opacity: 1; pointer-events: auto; }

/* ── Floating Nav & Dynamic Island ── */
nav.floating-nav {
    position: fixed; top: 0; left: 0; right: 0; z-index: 500;
    padding: 14px 28px; background: transparent; transition: all 0.5s ease;
}
nav.floating-nav.scrolled {
    background: rgba(6,5,12,0.55); backdrop-filter: blur(30px); -webkit-backdrop-filter: blur(30px);
    border-bottom: 1px solid rgba(255,255,255,0.05); box-shadow: 0 4px 30px rgba(0,0,0,0.3);
}

nav { display: flex; justify-content: space-between; align-items: center; padding: 18px 28px; }
.pill {
    background: var(--glass-bg); backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border); border-radius: 30px;
    padding: 8px 18px; display: flex; align-items: center; gap: 10px;
    cursor: pointer; transition: all 0.25s; font-size: 0.82rem;
}
.pill:hover { background: rgba(255,255,255,0.08); border-color: rgba(255,255,255,0.2); }

#di-wrap { 
    position: fixed; left: 50%; 
    top: calc(14px + env(safe-area-inset-top, 0px)); 
    transform: translateX(-50%); z-index: 501; 
}
#dynamic-island {
    position: relative; display: flex; align-items: center; justify-content: center;
    background: rgba(14,12,24,0.92); backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255,255,255,0.1); border-radius: 50px;
    height: 38px; padding: 0 18px; transition: all 0.45s cubic-bezier(0.34,1.2,0.64,1);
    cursor: pointer; overflow: hidden; white-space: nowrap; min-width: 80px;
}
#dynamic-island.expanded { width: 320px; min-width: 320px; }

/* ── Stage & Container Zero ── */
.stage {
    flex-grow: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
    position: relative; perspective: 2200px; padding: 70px 20px 40px; min-height: 70vh;
}
.container-zero {
    width: 100%; max-width: 560px; position: relative; transform-style: preserve-3d;
    transition: transform 0.85s cubic-bezier(0.34,1.2,0.64,1), max-width 0.85s ease; z-index: 2;
}
.container-zero.flipped { transform: rotateY(180deg); max-width: 960px; }

.card-face {
    background: rgba(255,255,255,0.026); backdrop-filter: blur(50px); -webkit-backdrop-filter: blur(50px);
    border: 1px solid rgba(255,255,255,0.1); border-radius: var(--card-radius);
    padding: 36px 28px; backface-visibility: hidden; -webkit-backface-visibility: hidden;
    width: 100%; box-shadow: 0 24px 60px rgba(0,0,0,0.55), 0 1px 0 rgba(255,255,255,0.04) inset;
}
.card-back { position: absolute; top: 0; left: 0; height: auto; min-height: 100%; transform: rotateY(180deg); }

/* ── Grid Systems ── */
.sfg-product-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 18px; }
.sfg-product-card {
    background: var(--glass-bg); border: 1px solid var(--glass-border);
    border-radius: 20px; overflow: hidden; cursor: pointer; transition: all 0.25s;
}
.sfg-product-card:hover { border-color: rgba(212,169,106,0.25); transform: translateY(-3px); box-shadow: 0 12px 40px rgba(0,0,0,0.4); }

/* ── UI Components ── */
.sfg-stepper { display: flex; align-items: center; gap: 4px; background: rgba(255,255,255,0.06); border: 1px solid rgba(255,255,255,0.1); border-radius: 10px; padding: 2px; }
.sfg-step-btn { width: 32px; height: 32px; border-radius: 8px; border: none; background: rgba(255,255,255,0.04); color: #fff; cursor: pointer; display: flex; align-items: center; justify-content: center; font-size: 1.1rem; transition: background 0.2s; line-height: 1; }
.sfg-step-btn:hover { background: rgba(255,255,255,0.12); }

/* ── App Windows ── */
.app-window {
    position: absolute; top: 50%; left: 50%; width: 92%; max-width: 980px;
    max-height: 88dvh; background: rgba(10,8,18,0.55); backdrop-filter: blur(48px) saturate(1.2);
    -webkit-backdrop-filter: blur(48px) saturate(1.2); border: 1px solid rgba(255,255,255,0.08);
    border-radius: var(--panel-radius); display: flex; flex-direction: column;
    transform: translate(-50%,-50%) scale(0.94); opacity: 0; pointer-events: none;
    transition: all 0.35s cubic-bezier(0.1,0.8,0.3,1);
    box-shadow: inset 0 1px 1px rgba(255,255,255,0.15), 0 40px 100px rgba(0,0,0,0.8);
}
.app-window.open { opacity: 1; transform: translate(-50%,-50%) scale(1); pointer-events: auto; }

/* ── Checkout Modal ── */
.modal-overlay { position: fixed; inset: 0; z-index: 500; background: rgba(0,0,0,0.6); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); opacity: 0; pointer-events: none; transition: opacity 0.3s; display: flex; align-items: flex-end; justify-content: center; }
.modal-overlay.open { opacity: 1; pointer-events: auto; }

/* ── MOBILE HARDENING ── */
@media (max-width: 768px) {
    #dynamic-island { min-width: 60px; height: 34px; }
    #dynamic-island.expanded { width: 92vw; min-width: initial; }
    
    .stage { padding-top: 80px; }
    .container-zero { max-width: 92vw; }
    .container-zero.flipped { max-width: 92vw; }
    
    .card-face { padding: 24px 18px; }
    .sfg-product-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
    
    .sfg-step-btn { width: 44px; height: 44px; font-size: 1.3rem; } /* Enhanced touch target */
    .app-window { width: 100%; height: 100%; border-radius: 0; max-height: 100dvh; }
    
    /* Dynamic Island Safe Zone */
    #di-wrap { top: calc(12px + env(safe-area-inset-top, 0px)); }
}

@media (max-width: 480px) {
    .sfg-section-heading { font-size: 1.6rem; }
    .sfg-hero h2 { font-size: 2.2rem; }
    .input-wrapper { max-width: 100%; }
}
