/* ===== CSS Variables ===== */
:root {
    --bg-color: #FDF5E6;
    --card-bg: #FFFFFF;
    --text-color: #4A3B32;
    --accent-color: #D2B48C;
    --heading-font: 'Playfair Display', serif;
    --body-font: 'Lato', sans-serif;
    --shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    --burgundy: #8B1A2B;
    --cream: #EAE5D9;
}

/* ===== Reset ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background-color: var(--bg-color);
    color: var(--text-color);
    font-family: var(--body-font);
    line-height: 1.6;
    -webkit-tap-highlight-color: transparent;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 16px;
}

/* ===== Navigation Bar ===== */
.navbar {
    position: sticky;
    top: 0;
    width: 100%;
    height: 64px;
    background: #FFFFFF;
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.05);
    z-index: 100;
    display: flex;
    align-items: center;
}

.nav-container {
    max-width: 1200px;
    width: 100%;
    margin: 0 auto;
    padding: 0 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.nav-logo {
    display: flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
}

.nav-icon {
    width: 1.5rem;
    height: 1.5rem;
    color: var(--burgundy);
}

.nav-logo-text {
    font-family: var(--heading-font);
    font-size: 1.2rem;
    font-weight: 700;
    color: #000000;
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 20px;
}

.nav-link-subtle {
    font-family: var(--body-font);
    font-size: 0.8rem;
    color: #8B7355;
    text-decoration: none;
}

/* ===== Hero Section ===== */
.hero {
    position: relative;
    width: 100%;
    height: 50vh;
    min-height: 300px;
    background-image: url('https://images.unsplash.com/photo-1696178465329-da0df96e208f');
    background-size: cover;
    background-position: center;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
}

.hero-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.35);
}

.hero-gradient {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 120px;
    background: linear-gradient(to bottom, transparent, #FDF5E6);
}

.hero-content {
    position: relative;
    z-index: 1;
    padding: 0 16px;
}

.hero-content h1 {
    font-family: var(--heading-font);
    font-size: 3rem;
    color: #FFFFFF;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.7);
    margin-bottom: 12px;
    letter-spacing: 1px;
}

.hero-content .subtitle {
    font-family: var(--body-font);
    font-size: 1.1rem;
    color: #E0E0E0;
    font-style: normal;
    font-weight: 300;
}

/* ===== Loading ===== */
.loading-text {
    text-align: center;
    padding: 60px 0;
    font-size: 1.1rem;
    color: #8B7355;
}

/* ===== Cocktail Grid ===== */
.cocktail-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 24px;
    padding: 24px 0;
}

/* ===== Flip Card ===== */
.flip-card {
    perspective: 1000px;
    cursor: pointer;
    min-height: 380px;
}

.flip-card-inner {
    position: relative;
    width: 100%;
    height: 100%;
    min-height: 380px;
    transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
    transform-style: preserve-3d;
}

.flip-card.flipped .flip-card-inner {
    transform: rotateY(180deg);
}

.flip-card-front,
.flip-card-back {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: var(--shadow);
    border: 1px solid #EDE0D4;
    background-color: var(--card-bg);
}

.flip-card-back {
    transform: rotateY(180deg);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 32px 24px;
    text-align: center;
}

.flip-card-back h3 {
    font-family: var(--heading-font);
    font-size: 1.6rem;
    margin-bottom: 16px;
    color: var(--text-color);
}

.flip-card-back .description {
    font-size: 1.05rem;
    line-height: 1.7;
    color: #6B5B4F;
    max-width: 320px;
}

.flip-card-back .tap-hint {
    margin-top: 24px;
    font-size: 0.8rem;
    color: #B8A898;
    font-style: italic;
}

/* ===== Card Front ===== */
.card-image {
    width: 100%;
    aspect-ratio: 4 / 3;
    object-fit: cover;
    border-bottom: 1px solid #EDE0D4;
    background-color: #f9f9f9;
}

.card-content {
    padding: 20px;
    text-align: center;
}

.card-content h2 {
    font-family: var(--heading-font);
    font-size: 1.5rem;
    margin-bottom: 12px;
    color: var(--text-color);
}

.ingredients-list {
    list-style: none;
    padding: 0;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 6px;
}

.ingredient-tag {
    background-color: #F5DEB3;
    color: #5C4033;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 400;
}

/* ===== Footer ===== */
footer {
    text-align: center;
    padding: 32px 0;
    margin-top: 32px;
    border-top: 1px solid #EDE0D4;
    background-color: transparent;
    color: #8B7355;
    font-size: 0.85rem;
}

/* ===== Modal ===== */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 200;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.modal-overlay:not([hidden]) {
    opacity: 1;
    visibility: visible;
}

.modal-content {
    position: relative;
    background: var(--card-bg);
    border-radius: 12px;
    max-width: 560px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
    transform: translateY(20px) scale(0.96);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border: 1px solid #EDE0D4;
}

.modal-overlay:not([hidden]) .modal-content {
    transform: translateY(0) scale(1);
}

.modal-close {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: none;
    background: rgba(255, 255, 255, 0.9);
    color: var(--text-color);
    font-size: 1.5rem;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
    transition: background 0.2s ease, color 0.2s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.modal-close:hover,
.modal-close:focus {
    background: var(--burgundy);
    color: #FFFFFF;
    outline: none;
}

.modal-image {
    width: 100%;
    aspect-ratio: 16 / 10;
    object-fit: cover;
    border-radius: 12px 12px 0 0;
    background-color: #f9f9f9;
}

.modal-body {
    padding: 28px 32px 32px;
}

.modal-body h2 {
    font-family: var(--heading-font);
    font-size: 2rem;
    color: var(--text-color);
    margin-bottom: 8px;
    line-height: 1.2;
}

.modal-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 16px;
    font-size: 0.9rem;
    color: #8B7355;
}

.modal-meta span {
    background: var(--cream);
    padding: 4px 12px;
    border-radius: 20px;
    font-weight: 500;
}

.modal-description {
    font-size: 1.05rem;
    line-height: 1.7;
    color: #6B5B4F;
    margin-bottom: 24px;
}

.modal-ingredients-section h3 {
    font-family: var(--heading-font);
    font-size: 1.3rem;
    color: var(--text-color);
    margin-bottom: 12px;
}

.modal-ingredients {
    list-style: none;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.modal-ingredients li {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    background: #FAF7F2;
    border-radius: 8px;
    font-size: 0.95rem;
    color: var(--text-color);
    border: 1px solid #F0E6D8;
}

.modal-ingredients li .ing-amount {
    color: #8B7355;
    font-weight: 500;
    font-size: 0.9rem;
}

/* ===== Flip Button ===== */
.flip-btn {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: none;
    background: rgba(255, 255, 255, 0.92);
    color: var(--text-color);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 5;
    transition: background 0.2s ease, color 0.2s ease, transform 0.2s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
}

.flip-btn:hover,
.flip-btn:focus {
    background: var(--burgundy);
    color: #FFFFFF;
    transform: scale(1.08);
    outline: none;
}

.flip-btn svg {
    width: 18px;
    height: 18px;
}

/* ===== Tablet+ ===== */
@media (min-width: 768px) {
    .hero {
        height: 50vh;
    }

    .hero-content h1 {
        font-size: 3.5rem;
    }

    .hero-content .subtitle {
        font-size: 1.3rem;
    }

    .cocktail-grid {
        grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
        gap: 40px;
        padding: 40px 0;
    }

    .card-content h2 {
        font-size: 1.8rem;
    }

    .flip-card {
        min-height: 420px;
    }

    .flip-card-inner {
        min-height: 420px;
    }

    footer {
        padding: 40px 0;
        margin-top: 40px;
    }
}

/* ===== Mobile ===== */
@media (max-width: 767px) {
    .hero {
        height: 40vh;
    }

    .hero-content h1 {
        font-size: 2.2rem;
    }

    .nav-logo-text {
        font-size: 1rem;
    }

    .nav-links {
        gap: 12px;
    }

    .modal-content {
        max-height: 95vh;
        border-radius: 10px;
    }

    .modal-body {
        padding: 20px 20px 24px;
    }

    .modal-body h2 {
        font-size: 1.6rem;
    }

    .modal-description {
        font-size: 1rem;
    }
}
