/* Roast & Ritual - Coffee-Themed Premium Design System */

:root {
    --bg-canvas: #FAF8F5; /* Oatmeal Cream */
    --bg-surface: #F3EFEA; /* Warm Latte */
    --bg-surface-elevated: #EAE3DB; /* Roasted Almond */
    
    --text-primary: #261E1A; /* Espresso Black */
    --text-muted: #5C4E46; /* Cocoa Brown */
    --text-subtle: #8A796E; /* Warm Sand */
    
    --accent: #A97C50; /* Caramel/Honey Brown */
    --accent-hover: #C6986C;
    --accent-glow: rgba(169, 124, 80, 0.12);
    
    --border-subtle: #E2DCD5; /* Soft Linen */
    --border-strong: #D1C7BD; /* Toasted Almond */
    
    --font-display: 'Cormorant Garamond', Georgia, serif;
    --font-chalk: 'Chalk', 'Cormorant Garamond', serif;
    --font-ui: 'Plus Jakarta Sans', system-ui, sans-serif;
    
    --radius-xs: 4px;
    --radius-sm: 8px;
    --radius-md: 16px;
    --radius-lg: 24px;
    --radius-pill: 100px;
    
    --ease-out-cubic: cubic-bezier(0.215, 0.61, 0.355, 1);
    --ease-in-out-sine: cubic-bezier(0.445, 0.05, 0.55, 0.95);
    
    --shadow-nav: 0 -8px 32px rgba(38, 30, 26, 0.06);
    --shadow-card: 0 4px 16px rgba(38, 30, 26, 0.04);
}

/* Reset & Base Setup */
@font-face {
    font-family: 'Chalk';
    src: url('chalk/chalk.ttf') format('truetype');
    font-weight: normal;
    font-style: normal;
    font-display: swap;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
}

html, body {
    width: 100%;
    height: 100%;
    background-color: #EFEBE4; /* Neutral framing canvas for desktop users */
    color: var(--text-primary);
    font-family: var(--font-ui);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

/* Container Frame - bounds width for premium mobile experience */
#app {
    width: 100%;
    max-width: 500px;
    min-height: 100vh;
    margin: 0 auto;
    background-color: var(--bg-canvas);
    border-left: 1px solid var(--border-subtle);
    border-right: 1px solid var(--border-subtle);
    position: relative;
    padding-bottom: 96px; /* Space for sticky nav */
    overflow-x: hidden;
}

@media (max-width: 380px) {
    .home-hero h1 { font-size: 3rem; }
    .brand-eyebrow { font-size: 0.9rem; }
    .nav-label { font-size: 0.75rem; }
    .category-btn { padding: 8px 14px; font-size: 0.8rem; }
}

/* Views & Transitions */
.view {
    display: none;
    opacity: 0;
    padding: 24px 20px;
}

.view.active {
    display: block;
    animation: slideInUp 0.5s var(--ease-out-cubic) forwards;
}

@keyframes slideInUp {
    from {
        opacity: 0;
        transform: translateY(12px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Typography Rules */
h1, h2, h3, h4 {
    font-family: var(--font-display);
    font-weight: 500;
    letter-spacing: -0.01em;
}

/* Home Hero Section */
.home-hero {
    margin-bottom: 28px;
    padding-top: 12px;
}

.brand-eyebrow {
    font-family: var(--font-display);
    font-size: 1rem;
    font-style: italic;
    color: var(--accent);
    margin-bottom: 8px;
}

.home-hero h1 {
    font-family: var(--font-chalk);
    font-size: 3.8rem;
    line-height: 0.95;
    margin-bottom: 14px;
    color: var(--text-primary);
    text-wrap: balance;
}

.home-hero p {
    color: var(--text-muted);
    font-size: 1.05rem;
    line-height: 1.5;
    text-wrap: pretty;
}

/* Swipeable Category Slider Bar */
.category-bar-wrapper {
    position: sticky;
    top: 0;
    background-color: var(--bg-canvas);
    z-index: 50;
    margin-left: -20px;
    margin-right: -20px;
    padding: 12px 20px;
    border-bottom: 1px solid var(--border-subtle);
}

.category-slider {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
}

/* Hide scrollbar for category slider */
.category-slider::-webkit-scrollbar {
    display: none;
}
.category-slider {
    -ms-overflow-style: none;
    scrollbar-width: none;
}

.category-btn {
    flex: 0 0 auto;
    font-family: var(--font-ui);
    font-size: 0.85rem;
    font-weight: 500;
    padding: 10px 18px;
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-pill);
    background-color: var(--bg-surface);
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.3s var(--ease-out-cubic);
}

.category-btn:hover {
    color: var(--text-primary);
    border-color: var(--border-strong);
}

.category-btn.active {
    background-color: var(--text-primary);
    color: var(--bg-canvas);
    border-color: var(--text-primary);
    font-weight: 600;
    box-shadow: 0 4px 12px rgba(38, 30, 26, 0.12);
}

/* Menu Items List */
.menu-list {
    display: flex;
    flex-direction: column;
    margin-top: 16px;
}

/* Cafe Menu Item Layout */
.menu-item {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 24px 0;
    border-bottom: 1px solid var(--border-subtle);
    opacity: 0;
    transform: translateY(8px);
    animation: itemReveal 0.4s var(--ease-out-cubic) forwards;
}

@keyframes itemReveal {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Sequential delay reveals */
.menu-item:nth-child(1) { animation-delay: 0.05s; }
.menu-item:nth-child(2) { animation-delay: 0.1s; }
.menu-item:nth-child(3) { animation-delay: 0.15s; }
.menu-item:nth-child(4) { animation-delay: 0.2s; }
.menu-item:nth-child(5) { animation-delay: 0.25s; }

.menu-item:last-child {
    border-bottom: none;
}

.menu-item-row {
    display: flex;
    gap: 16px;
    align-items: flex-start;
}

.menu-item-content {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.menu-item-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 8px;
    margin-bottom: 4px;
}

.menu-item-title {
    font-size: 1.15rem;
    font-weight: 600;
    color: var(--text-primary);
    line-height: 1.25;
}

.menu-item-price {
    font-family: var(--font-ui);
    font-weight: 700;
    font-size: 1.05rem;
    color: var(--accent);
}

.menu-item-desc {
    color: var(--text-muted);
    font-size: 0.88rem;
    line-height: 1.45;
    text-wrap: pretty;
}

.image-container {
    position: relative;
    width: 80px;
    height: 80px;
    border-radius: var(--radius-sm);
    background-color: var(--bg-surface);
    overflow: hidden;
    flex-shrink: 0;
    border: 1px solid var(--border-subtle);
}

.menu-item-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0;
    transition: opacity 0.4s var(--ease-out-cubic);
}

.menu-item-image.loaded {
    opacity: 1;
}

/* Image Shimmer */
.skeleton-shimmer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, #F3EFEA 25%, #FAF8F5 50%, #F3EFEA 75%);
    background-size: 200% 100%;
    animation: shimmer 1.6s infinite linear;
}

@keyframes shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* --- Specialty Coffee Profiling Card --- */
.coffee-profile-card {
    background-color: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    padding: 12px 14px;
    margin-top: 4px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    font-size: 0.8rem;
}

.profile-meta-row {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.meta-badge {
    background-color: var(--bg-canvas);
    border: 1px solid var(--border-strong);
    color: var(--text-muted);
    padding: 3px 8px;
    border-radius: var(--radius-pill);
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.meta-badge i {
    color: var(--accent);
    font-size: 0.9rem;
}

.profile-notes {
    color: var(--text-muted);
    font-style: italic;
    line-height: 1.4;
    padding-left: 2px;
}

.profile-notes strong {
    font-style: normal;
    color: var(--text-primary);
    font-weight: 600;
}

/* Flavor Profile Slider Meters */
.profile-meters {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 6px 12px;
    border-top: 1px dashed var(--border-strong);
    padding-top: 8px;
    margin-top: 4px;
}

.meter-group {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.meter-label {
    color: var(--text-subtle);
    font-weight: 500;
    font-size: 0.75rem;
    min-width: 50px;
}

.meter-bar-wrapper {
    flex: 1;
    height: 4px;
    background-color: var(--bg-surface-elevated);
    border-radius: var(--radius-pill);
    overflow: hidden;
    position: relative;
}

.meter-fill {
    height: 100%;
    background-color: var(--accent);
    border-radius: var(--radius-pill);
    transition: width 0.8s var(--ease-out-cubic);
}

/* Search Header Styling */
.search-header {
    position: sticky;
    top: 0;
    background-color: var(--bg-canvas);
    z-index: 50;
    margin-left: -20px;
    margin-right: -20px;
    padding: 12px 20px 20px;
    border-bottom: 1px solid var(--border-subtle);
}

.search-title-wrapper {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 16px;
}

.search-title-wrapper h2 {
    font-size: 2.2rem;
    color: var(--text-primary);
}

.search-count {
    font-family: var(--font-ui);
    font-size: 0.85rem;
    color: var(--text-subtle);
}

.search-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.search-icon {
    position: absolute;
    left: 18px;
    color: var(--text-subtle);
    font-size: 1.15rem;
    pointer-events: none;
    transition: color 0.3s;
}

.search-input-wrapper input {
    width: 100%;
    padding: 16px 48px 16px 50px;
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-pill);
    background-color: var(--bg-surface);
    color: var(--text-primary);
    font-family: var(--font-ui);
    font-size: 1rem;
    outline: none;
    transition: all 0.3s var(--ease-out-cubic);
}

.search-input-wrapper input:focus {
    border-color: var(--text-primary);
    background-color: var(--bg-surface-elevated);
    box-shadow: 0 0 0 3px rgba(38, 30, 26, 0.05);
}

.search-input-wrapper input:focus + .search-icon {
    color: var(--text-primary);
}

.search-clear-btn {
    position: absolute;
    right: 18px;
    background: none;
    border: none;
    color: var(--text-subtle);
    cursor: pointer;
    font-size: 1.15rem;
    display: none;
    padding: 4px;
}

.search-clear-btn:hover {
    color: var(--text-primary);
}

/* Quick Filter Tags */
.quick-tags-wrapper {
    display: flex;
    gap: 6px;
    margin-top: 12px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.quick-tags-wrapper::-webkit-scrollbar {
    display: none;
}

.quick-tag {
    flex: 0 0 auto;
    font-family: var(--font-ui);
    font-size: 0.78rem;
    padding: 6px 12px;
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-pill);
    background-color: var(--bg-surface);
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.2s ease;
}

.quick-tag:hover {
    color: var(--text-primary);
    border-color: var(--border-strong);
}

.quick-tag.active {
    background-color: var(--text-primary);
    color: var(--bg-canvas);
    border-color: var(--text-primary);
}

.search-results-container {
    padding-top: 8px;
}

.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 80px 20px;
    color: var(--text-muted);
    text-align: center;
    animation: fadeIn 0.4s var(--ease-out-cubic) forwards;
}

.empty-state i {
    font-size: 3rem;
    color: var(--text-subtle);
    margin-bottom: 16px;
}

.empty-state p {
    font-size: 1.05rem;
    margin-bottom: 8px;
}

.empty-state span {
    font-size: 0.88rem;
    color: var(--text-subtle);
}

/* Editorial Story View */
.editorial-header {
    margin-bottom: 24px;
}

.editorial-hero-img {
    width: 100%;
    height: 240px;
    object-fit: cover;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-subtle);
    margin-bottom: 24px;
    background-color: var(--bg-surface);
}

.editorial-body {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.editorial-body p {
    font-size: 1.02rem;
    line-height: 1.6;
    color: var(--text-muted);
    text-wrap: pretty;
}

.editorial-body p:first-of-type {
    font-family: var(--font-display);
    font-size: 1.4rem;
    line-height: 1.4;
    color: var(--text-primary);
    position: relative;
    padding-left: 16px;
    border-left: 2px solid var(--accent);
}

/* Floating Glassmorphism Tab Bar Navigation */
.glass-nav {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 6px;
    padding: 6px;
    background-color: rgba(250, 248, 245, 0.85);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-pill);
    box-shadow: var(--shadow-nav);
    z-index: 100;
    width: calc(100% - 40px);
    max-width: 420px;
}

.nav-item {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    background: transparent;
    border-radius: var(--radius-pill);
    padding: 12px;
    cursor: pointer;
    color: var(--text-muted);
    transition: all 0.4s var(--ease-out-cubic);
    overflow: hidden;
}

.nav-icon-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.35rem;
}

.nav-label {
    max-width: 0;
    opacity: 0;
    font-family: var(--font-ui);
    font-weight: 500;
    font-size: 0.88rem;
    white-space: nowrap;
    transition: all 0.4s var(--ease-out-cubic);
}

/* Active Tab morphing layout */
.nav-item.active {
    background-color: var(--text-primary);
    color: var(--bg-canvas);
    flex: 1.6;
    padding: 12px 18px 12px 14px;
}

.nav-item.active .nav-label {
    max-width: 80px;
    opacity: 1;
    margin-left: 8px;
}

/* General Animations */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* Hover styles for desktop users */
@media (hover: hover) {
    .nav-item:not(.active):hover {
        background-color: rgba(38, 30, 26, 0.04);
        color: var(--text-primary);
    }
    .category-btn:not(.active):hover {
        background-color: var(--bg-surface-elevated);
    }
}
