:root {
    /* Default to morning/light theme */
    --bg-color: #FAFAF7;
    --text-color: #4A4540;
    --accent-color: #C8B4A2;
    --coffee-color: #6B4E31;
    --btn-bg: #FFFFFF;
    --shadow: rgba(74, 69, 64, 0.08);
    --transition: all 0.4s cubic-bezier(0.2, 0.8, 0.2, 1);
}

/* html.theme-* — set by theme-init.js before first paint to prevent flash-of-wrong-theme */
html.theme-morning {
    --bg-color: #FAFAF7;
    --text-color: #4A4540;
    --accent-color: #C8B4A2;
    --coffee-color: #6B4E31;
    --btn-bg: #FFFFFF;
    --shadow: rgba(74, 69, 64, 0.08);
}

html.theme-afternoon {
    --bg-color: #FAF4E8;
    --text-color: #5C4B40;
    --accent-color: #D4A373;
    --coffee-color: #8B5A2B;
    --btn-bg: #FFFFFF;
    --shadow: rgba(92, 75, 64, 0.08);
}

html.theme-evening {
    --bg-color: #1A1817;
    --text-color: #E6E0D8;
    --accent-color: #8C7A6B;
    --coffee-color: #3D2B1F;
    --btn-bg: #262321;
    --shadow: rgba(0, 0, 0, 0.3);
}

/* Morning Theme */
body.theme-morning {
    --bg-color: #FAFAF7;
    --text-color: #4A4540;
    --accent-color: #C8B4A2;
    --coffee-color: #6B4E31;
    --btn-bg: #FFFFFF;
    --shadow: rgba(74, 69, 64, 0.08);
}

/* Afternoon Theme */
body.theme-afternoon {
    --bg-color: #FAF4E8;
    --text-color: #5C4B40;
    --accent-color: #D4A373;
    --coffee-color: #8B5A2B;
    --btn-bg: #FFFFFF;
    --shadow: rgba(92, 75, 64, 0.08);
}

/* Evening Theme */
body.theme-evening {
    --bg-color: #1A1817;
    --text-color: #E6E0D8;
    --accent-color: #8C7A6B;
    --coffee-color: #3D2B1F;
    --btn-bg: #262321;
    --shadow: rgba(0, 0, 0, 0.3);
}

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

body {
    font-family: ui-serif, Georgia, Cambria, "Times New Roman", Times, serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    overflow-x: hidden;
    padding: 2rem;
    transition: background-color 1s ease, color 1s ease;
}

.container {
    max-width: 800px;
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2rem;
    animation: fadeIn 1s ease-out;
    margin-top: 1rem;
}

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

/* Top Bar */
.top-bar {
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: 1.5rem 2rem;
}

/* Theme Picker Styles */
.theme-picker {
    position: relative;
}

.theme-toggle-btn {
    background: var(--btn-bg);
    border: 1px solid rgba(200, 180, 162, 0.4);
    color: var(--text-color);
    width: 46px;
    height: 46px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 10px var(--shadow);
    transition: var(--transition);
}

.theme-toggle-btn:hover {
    transform: translateY(2px);
    box-shadow: 0 8px 16px rgba(74, 69, 64, 0.15);
    border-color: var(--accent-color);
}

body.theme-evening .theme-toggle-btn:hover {
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.4);
    background: var(--btn-bg);
    border-color: #FFFFFF;
}

.theme-menu {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 0.75rem;
    background: var(--btn-bg);
    border: 1px solid rgba(200, 180, 162, 0.4);
    border-radius: 12px;
    box-shadow: 0 8px 24px var(--shadow);
    padding: 0.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    opacity: 0;
    pointer-events: none;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    transform: translateY(-10px);
    min-width: 150px;
    z-index: 60;
}

.theme-menu.active {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0);
}

.theme-menu .menu-item {
    padding: 0.5rem 1rem;
    background: transparent;
    border: none;
    color: var(--text-color);
    font-family: inherit;
    font-size: 1rem;
    cursor: pointer;
    border-radius: 8px;
    transition: background 0.2s, color 0.2s;
    text-align: left;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.theme-menu .menu-item:hover {
    background: var(--accent-color);
    color: #FFFFFF;
}

.theme-menu .menu-item.active-theme {
    background: rgba(200, 180, 162, 0.15);
    font-weight: 600;
}

/* Typography & Content Styles */
.breadcrumb {
    align-self: flex-start;
    font-size: 0.9rem;
    color: var(--accent-color);
    margin-bottom: 0.5rem;
}

.breadcrumb a {
    color: var(--accent-color);
    text-decoration: none;
}

.breadcrumb a:hover {
    text-decoration: underline;
}

h1 {
    font-size: 2.5rem;
    font-weight: 400;
    text-align: center;
    color: var(--text-color);
}

.content {
    width: 100%;
    line-height: 1.6;
}

.content h2 {
    font-size: 1.8rem;
    font-weight: 400;
    margin-top: 2rem;
    margin-bottom: 1rem;
    border-bottom: 1px solid rgba(200, 180, 162, 0.3);
    padding-bottom: 0.5rem;
}

.content p {
    margin-bottom: 1rem;
}

.content ul, .content ol {
    margin-bottom: 1.5rem;
    padding-left: 1.5rem;
}

.content li {
    margin-bottom: 0.5rem;
}

.content a {
    color: var(--accent-color);
    text-decoration: none;
    border-bottom: 1px solid rgba(200, 180, 162, 0.4);
    transition: var(--transition);
}

.content a:hover {
    border-bottom-color: var(--text-color);
    color: var(--text-color);
}

/* Recipe specific */
.ingredients {
    background: var(--btn-bg);
    padding: 1.5rem;
    border-radius: 16px;
    box-shadow: 0 4px 12px var(--shadow);
    margin-bottom: 2rem;
    border: 1px solid rgba(200, 180, 162, 0.2);
}

.recipe-meta {
    display: flex;
    gap: 2rem;
    margin-bottom: 2rem;
    font-style: italic;
    color: var(--accent-color);
    justify-content: center;
}

@media (max-width: 600px) {
    .container {
        padding: 1rem;
        margin-top: 0;
    }
    h1 {
        font-size: 2rem;
    }
    .recipe-meta {
        flex-direction: column;
        gap: 0.5rem;
        align-items: center;
    }
}
