/* Reset & Variables */
:root {
    --color-bg: #fcfcfc;
    /* Slightly warmer white */
    --color-text: #2c2c2c;
    --color-text-light: #555;
    --color-accent: #c5a028;
    /* Muted Gold */
    --color-card-bg: #ffffff;
    --color-border: #ebebeb;
    --color-dark: #111111;
    --color-story-bg: #f4f4f0;
    /* Warm, paper-like tone */
    --color-teal: #2A9D8F;
    /* Teal Accent */

    --font-sans: 'Inter', sans-serif;
    --font-serif: 'Playfair Display', serif;

    --spacing-unit: 1rem;
    --container-width: 1280px;
    --border-radius: 2px;
    /* Sharper, more elegant corners */
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.04);
    --shadow-md: 0 12px 24px rgba(0, 0, 0, 0.08);
    --transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    --font-display: 'Playfair Display', serif;
}

body.dark-mode {
    --color-bg: #0f0f0f;
    --color-text: #e0e0e0;
    --color-text-light: #a0a0a0;
    --color-card-bg: #1a1a1a;
    --color-border: #333333;
    --color-dark: #ffffff;
    --color-story-bg: #141414;
    --shadow-sm: 0 4px 20px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 16px 40px rgba(0, 0, 0, 0.5);
}

/* Dark Mode Transitions */
body,
.navbar,
.ingredient-card,
.story-section,
footer {
    transition: background-color 0.4s ease, color 0.4s ease, border-color 0.4s ease, box-shadow 0.4s ease;
}

body.dark-mode .navbar {
    background: rgba(18, 18, 18, 0.9);
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

body.dark-mode .grid-view .card-image {
    background-color: #2a2a2a;
}

body.dark-mode .grid-view .card-image.placeholder {
    background-color: #252525;
    color: #555;
}

body.dark-mode .slider {
    background-color: #333;
}

body.dark-mode input:checked+.slider {
    background-color: var(--color-accent);
}

body.dark-mode .story-section::before {
    color: rgba(255, 255, 255, 0.05);
}

body.dark-mode footer {
    background-color: #121212;
    border-top: 1px solid #333;
}

body.dark-mode .intro {
    background: darkslategray;
}

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

body {
    font-family: var(--font-sans);
    background-color: var(--color-bg);
    color: var(--color-text);
    line-height: 1.7;
    -webkit-font-smoothing: antialiased;
    font-weight: 300;
}

/* Typography */
h1,
h2,
h3 {
    font-family: var(--font-serif);
    font-weight: 600;
    color: var(--color-dark);
    letter-spacing: -0.02em;
}

h1 {
    font-size: 4rem;
    line-height: 1.05;
    margin-bottom: 1.5rem;
}

h2 {
    font-size: 2.25rem;
    margin-bottom: 2rem;
    text-align: center;
    position: relative;
    padding-bottom: 1rem;
}

h2::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 60px;
    height: 1px;
    background-color: var(--color-accent);
}

h3 {
    font-size: 1.35rem;
    margin-bottom: 0.75rem;
    letter-spacing: 0;
}

p {
    margin-bottom: 1.5rem;
}

/* Navbar */
.navbar {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    padding: 1.5rem 3rem;
    z-index: 1000;
    transition: var(--transition);
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid rgba(0, 0, 0, 0.03);
}

.nav-container {
    max-width: 1400px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.nav-actions {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.theme-toggle, .lang-toggle {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--color-dark);
    font-size: 1.2rem;
    padding: 0.5rem;
    border-radius: 50%;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
}

.theme-toggle:hover {
    background-color: rgba(0, 0, 0, 0.05);
    transform: rotate(15deg);
}

.lang-toggle:hover {
    background-color: rgba(0, 0, 0, 0.05);
}

body.dark-mode .theme-toggle:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

.logo {
    display: flex;
    align-items: center;
    gap: 1rem;
    text-decoration: none;
    color: var(--color-dark);
    font-family: var(--font-serif);
    font-weight: 700;
    font-size: 1.125rem;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.logo img {
    height: 36px;
    width: auto;
}

/* Hero Section */
.hero {
    position: relative;
    height: 85vh;
    min-height: 700px;
    max-height: 950px;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    color: white;
    padding-bottom: 6rem;
    overflow: hidden;
}

.hero.main-hero {
    height: 60vh;
    min-height: 500px;
    align-items: center;
    padding-bottom: 0;
}

.hero-bg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
}

.hero-bg img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transform: scale(1.05);
    animation: slowZoom 30s infinite alternate;
}

@keyframes slowZoom {
    from {
        transform: scale(1.05);
    }

    to {
        transform: scale(1.15);
    }
}

.overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.6) 0%, rgba(0, 0, 0, 0.1) 50%, rgba(0, 0, 0, 0) 100%);
}

/* Hero Section Redesign */
.hero.main-hero {
    height: auto;
    padding: 6rem 2rem 3rem;
    background-color: var(--color-bg);
    display: flex;
    align-items: center;
    justify-content: center;
}

.hero.main-hero .hero-content {
    width: var(--container-width);
    position: relative;
    padding: 3rem;
    border: 1px solid var(--color-border);
    background-color: #fafaf9;
    background-image:
        linear-gradient(30deg, #f5f5f4 12%, transparent 12.5%, transparent 87%, #f5f5f4 87.5%, #f5f5f4),
        linear-gradient(150deg, #f5f5f4 12%, transparent 12.5%, transparent 87%, #f5f5f4 87.5%, #f5f5f4),
        linear-gradient(30deg, #f5f5f4 12%, transparent 12.5%, transparent 87%, #f5f5f4 87.5%, #f5f5f4),
        linear-gradient(150deg, #f5f5f4 12%, transparent 12.5%, transparent 87%, #f5f5f4 87.5%, #f5f5f4);
    background-size: 80px 140px;
    background-position: 0 0, 0 0, 40px 70px, 40px 70px;
}

body.dark-mode .hero.main-hero .hero-content {
    background-color: #1a1a1a;
    background-image:
        linear-gradient(30deg, #262626 12%, transparent 12.5%, transparent 87%, #262626 87.5%, #262626),
        linear-gradient(150deg, #262626 12%, transparent 12.5%, transparent 87%, #262626 87.5%, #262626),
        linear-gradient(30deg, #262626 12%, transparent 12.5%, transparent 87%, #262626 87.5%, #262626),
        linear-gradient(150deg, #262626 12%, transparent 12.5%, transparent 87%, #262626 87.5%, #262626);
}

/* Decorative corners for Hero */
.hero.main-hero .hero-content::before,
.hero.main-hero .hero-content::after {
    content: '';
    position: absolute;
    width: 20px;
    height: 20px;
    border: 2px solid var(--color-accent);
    transition: var(--transition);
}

.hero.main-hero .hero-content::before {
    top: -1px;
    left: -1px;
    border-right: none;
    border-bottom: none;
}

.hero.main-hero .hero-content::after {
    bottom: -1px;
    right: -1px;
    border-left: none;
    border-top: none;
}

.hero.main-hero h1 {
    font-size: 4.5rem;
    color: var(--color-dark);
    margin-bottom: 1.5rem;
    text-shadow: none;
}

.hero.main-hero p {
    color: var(--color-text-light);
    font-size: 1.2rem;
    max-width: 500px;
}

.category {
    text-transform: uppercase;
    letter-spacing: 3px;
    font-size: 0.75rem;
    color: var(--color-accent);
    display: block;
    margin-bottom: 1.5rem;
    font-weight: 600;
    display: flex;
    gap: 8px;
}

.category-pill {
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(8px);
    padding: 4px 6px;
    border-radius: 5px;
    white-space: nowrap;
    font-size: 0.7rem;
}

.category.higher-contrast {
    text-shadow: 0 0 3px rgba(0, 0, 0, 0.9);
}

/* Default Hero (Recipe Page) */
.hero:not(.main-hero) h1 {
    color: white;
    text-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
}

.meta {
    display: flex;
    justify-content: center;
    gap: 4rem;
    margin-top: 3rem;
    padding-top: 2rem;
    border-top: 1px solid rgba(255, 255, 255, 0.15);
}

.meta-item {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.meta-item .label {
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 2px;
    opacity: 0.9;
    margin-bottom: 0.5rem;
}

.meta-item .value {
    font-family: var(--font-serif);
    font-size: 1.5rem;
    font-weight: 400;
    font-style: italic;
}

/* Main Container */
.recipe-container {
    max-width: var(--container-width);
    margin: 0 auto;
    padding: 0 2rem;
    position: relative;
    z-index: 10;
}

/* Intro Section */
.intro {
    background: white;
    padding: 5rem 4rem;
    margin: -4rem auto 6rem;
    position: relative;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-md);
    text-align: center;
    max-width: 800px;
}

.intro-content p {
    font-family: var(--font-serif);
    font-size: 1.35rem;
    line-height: 1.8;
    color: var(--color-text);
    font-style: italic;
    margin: 0;
}

.drop-cap::first-letter {
    font-size: 4rem;
    float: left;
    line-height: 0.8;
    padding-right: 0.5rem;
    padding-top: 0.2rem;
    color: var(--color-accent);
    font-style: normal;
}

/* Ingredients Section */
.ingredients-section {
    margin-bottom: 6rem;
}

.ingredients-separator {
    margin-top: 1rem;
    margin-bottom: 0.5rem;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 3rem;
    border-bottom: 1px solid var(--color-border);
    padding-bottom: 1rem;
}

.section-header h2 {
    margin: 0;
    font-size: 1.75rem;
    padding: 0;
}

.section-header h2::after {
    display: none;
}

.instructions-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* Toggle Switch */
.view-toggle {
    display: flex;
    align-items: center;
    gap: 1rem;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-weight: 600;
    color: var(--color-text-light);
    font-family: var(--font-sans);
}

.switch {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 22px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #e0e0e0;
    transition: .4s;
}

.slider:before {
    position: absolute;
    content: "";
    height: 16px;
    width: 16px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: .4s;
}

input:checked+.slider {
    background-color: var(--color-dark);
}

input:checked+.slider:before {
    transform: translateX(22px);
}

.slider.round {
    border-radius: 22px;
}

.slider.round:before {
    border-radius: 50%;
}

.toggle-label.active {
    color: var(--color-dark);
}

.screen-toggle {
    margin-bottom: 1rem;
    padding-bottom: 1rem;
}

.toggle-screen-label.active {
    color: var(--color-dark);
}

/* Ingredients Grid View */
.ingredients-container.grid-view {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 2rem;
}

.grid-view .ingredient-card {
    background: var(--color-card-bg);
    border-radius: var(--border-radius);
    overflow: hidden;
    transition: var(--transition);
    box-shadow: var(--shadow-sm);
    display: flex;
    flex-direction: column;
}

.grid-view .ingredient-card:hover {
    transform: translateY(-8px);
    box-shadow: var(--shadow-md);
}

.grid-view .card-image {
    height: 160px;
    width: 100%;
    background-color: #f0f0f0;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.grid-view .card-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.6s ease;
}

.grid-view .ingredient-card:hover .card-image img {
    transform: scale(1.1);
}

.grid-view .card-image.placeholder {
    background-color: #f8f8f8;
    color: #ccc;
    font-family: var(--font-serif);
    font-style: italic;
    font-size: 1.2rem;
}

.grid-view .card-info {
    padding: 1.5rem;
    text-align: center;
}

.grid-view .amount {
    display: block;
    font-family: var(--font-serif);
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--color-accent);
    margin-bottom: 0.25rem;
}

.grid-view .name {
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--color-dark);
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* Ingredients List View */
.ingredients-container.list-view {
    display: flex;
    flex-direction: column;
}

.list-view .ingredient-card {
    display: flex;
    align-items: center;
    padding: 1.25rem 0;
    border-bottom: 1px solid var(--color-border);
}

.list-view .card-image {
    display: none;
    /* Hide images in list view for cleaner look */
}

.list-view .card-info {
    display: flex;
    width: 100%;
    align-items: center;
}

.list-view .amount {
    font-weight: 700;
    color: var(--color-dark);
    width: 120px;
    flex-shrink: 0;
    font-family: var(--font-serif);
}

.list-view .name {
    color: var(--color-text);
    font-size: 1.1rem;
}

/* Checked State for Ingredients */
.ingredient-card {
    cursor: pointer;
    position: relative;
}

.ingredient-card.checked .card-image img,
.ingredient-card.checked .card-image span {
    opacity: 0.5;
    filter: grayscale(100%);
}

.ingredient-card.checked .name {
    text-decoration: line-through;
    color: var(--color-text-light);
}

.ingredient-card.checked .amount {
    opacity: 0.6;
}

/* Checkbox Styles */
.check-indicator {
    margin-right: 1.5rem;
    display: none;
    /* Hidden by default (Grid View) */
}

.list-view .check-indicator {
    display: flex;
    align-items: center;
    justify-content: center;
}

.ingredient-checkbox {
    appearance: none;
    -webkit-appearance: none;
    width: 20px;
    height: 20px;
    border: 2px solid var(--color-border);
    border-radius: 4px;
    cursor: pointer;
    position: relative;
    transition: var(--transition);
}

.ingredient-checkbox:checked {
    background-color: var(--color-accent);
    border-color: var(--color-accent);
}

.ingredient-checkbox:checked::after {
    content: '✓';
    position: absolute;
    color: white;
    font-size: 14px;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-weight: bold;
}

body.dark-mode .ingredient-checkbox {
    border-color: #444;
    background-color: #2a2a2a;
}

body.dark-mode .ingredient-checkbox:checked {
    background-color: var(--color-accent);
    border-color: var(--color-accent);
}

/* Story Section */
.story-section {
    background-color: var(--color-story-bg);
    padding: 5rem 4rem;
    margin-bottom: 6rem;
    border-radius: var(--border-radius);
    text-align: center;
    position: relative;
}

.story-section::before {
    content: '"';
    position: absolute;
    top: 2rem;
    left: 50%;
    transform: translateX(-50%);
    font-family: var(--font-serif);
    font-size: 6rem;
    color: rgba(0, 0, 0, 0.05);
    line-height: 1;
}

.story-content {
    max-width: 700px;
    margin: 0 auto;
}

.story-content h2 {
    font-size: 1.5rem;
    margin-bottom: 2rem;
    letter-spacing: 2px;
    text-transform: uppercase;
}

.story-content h2::after {
    width: 40px;
}

.story-content p {
    font-size: 1.1rem;
    color: var(--color-text-light);
}

/* Instructions Section */
.instructions-section {
    margin-bottom: 6rem;
}

.step {
    display: grid;
    grid-template-columns: 80px 1fr;
    gap: 3rem;
    margin-bottom: 4rem;
    padding-bottom: 4rem;
    border-bottom: 1px solid var(--color-border);
}

.step:last-child {
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: none;
}

.step-number {
    font-family: var(--font-serif);
    font-size: 3.5rem;
    font-weight: 700;
    color: var(--color-accent);
    opacity: 0.4;
    line-height: 0.8;
}

.step-content h3 {
    color: var(--color-dark);
    margin-top: 0;
    font-size: 1.5rem;
    margin-bottom: 1rem;
}

.step-content p {
    color: var(--color-text);
    font-size: 1.1rem;
    line-height: 1.8;
    margin: 0;
}

/* Footer */
footer {
    text-align: center;
    padding: 6rem 0 4rem;
    color: var(--color-text-light);
    border-top: 1px solid var(--color-border);
    background-color: white;
}

.footer-logo {
    height: 60px;
    width: auto;
    margin-bottom: 1.5rem;
    opacity: 0.8;
    transition: var(--transition);
}

.footer-logo:hover {
    opacity: 1;
    transform: scale(1.05);
}

/* Responsive */
@media (max-width: 768px) {
    h1 {
        font-size: 2.75rem;
    }

    .hero {
        height: 70vh;
    }

    .intro {
        padding: 3rem 2rem;
        margin-top: -2rem;
    }

    .intro-content p {
        font-size: 1.15rem;
    }

    .step {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .step-number {
        font-size: 2.5rem;
    }

    .grid-view {
        grid-template-columns: repeat(2, 1fr);
        gap: 1rem;
    }

    .navbar {
        padding: 0.5rem 1rem;
    }
}

@media (max-width: 480px) {
    .grid-view {
        grid-template-columns: 1fr;
    }

    .grid-view {
        grid-template-columns: 1fr;
    }
}

/* --- Welcome Page Styles --- */

/* Search Bar */
.search-container {
    position: relative;
    max-width: 600px;
    width: 100%;
}

.search-container input {
    width: 100%;
    padding: 1.25rem 2rem;
    padding-right: 4rem;
    border-radius: 2px;
    border: none;
    background: rgba(255, 255, 255, 0.95);
    font-family: var(--font-sans);
    font-size: 1.1rem;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    transition: var(--transition);
    color: var(--color-text);
}

.search-container input:focus {
    outline: none;
    background: white;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.25);
    transform: translateY(-2px);
}

body.dark-mode .search-container input {
    background: #2a2a2a;
    color: white;
}

body.dark-mode .search-container input:focus {
    background: #333;
}

.search-btn {
    position: absolute;
    right: 1rem;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    padding: 0.5rem;
    cursor: pointer;
    color: var(--color-text);
    opacity: 0.5;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
}

.search-btn:hover {
    opacity: 1;
    color: var(--color-teal);
}

body.dark-mode .search-btn {
    color: white;
}

/* Feed Header & Filters */
.feed-header {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 3rem;
    margin-top: 2rem;
    flex-direction: column;
    gap: 1.5rem;
}

.feed-header h2 {
    font-size: 2.5rem;
    margin: 0;
    font-weight: 400;
}

.feed-header h2::after {
    display: block;
    content: '';
    width: 40px;
    height: 1px;
    background: var(--color-accent);
    margin: 1rem auto 0;
    position: static;
    transform: none;
}

.tags-filter {
    display: flex;
    gap: 1.5rem;
    overflow-x: auto;
    padding-bottom: 1rem;
    width: 100%;
    justify-content: center;
    -webkit-overflow-scrolling: touch;
}

/* Hide scrollbar for cleaner look but keep functionality */
.tags-filter::-webkit-scrollbar {
    height: 4px;
}

.tags-filter::-webkit-scrollbar-track {
    background: transparent;
}

.tags-filter::-webkit-scrollbar-thumb {
    background: var(--color-border);
    border-radius: 4px;
}

.tag {
    background: transparent;
    border: 1px solid var(--color-border);
    padding: 0.75rem 1.5rem;
    border-radius: 0;
    /* Square buttons as requested */
    font-family: var(--font-sans);
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    cursor: pointer;
    transition: var(--transition);
    color: var(--color-text-light);
    font-weight: 500;
    white-space: nowrap;
    flex-shrink: 0;
}

.tag:hover,
.tag.active {
    background-color: var(--color-dark);
    color: white;
    border-color: var(--color-dark);
}

body.dark-mode .tag:hover,
body.dark-mode .tag.active {
    background-color: var(--color-accent);
    border-color: var(--color-accent);
    color: #000;
}

/* Recipe Grid */
.recipe-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    gap: 3rem;
    padding-bottom: 4rem;
}

.recipe-card {
    background-color: var(--color-card-bg);
    border-radius: var(--border-radius);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
    border: 1px solid var(--color-border);
    display: flex;
    flex-direction: column;
    height: 100%;
}

.recipe-card:hover {
    transform: translateY(-8px);
    box-shadow: var(--shadow-md);
    border-color: var(--color-border);
}

.card-link {
    text-decoration: none;
    color: inherit;
    display: block;
    height: 100%;
}

.recipe-card .card-image {
    height: 320px;
    width: 100%;
    position: relative;
    overflow: hidden;
    background-color: #f0f0f0;
    border-bottom: 1px solid var(--color-border);
}

.recipe-card .card-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.8s cubic-bezier(0.16, 1, 0.3, 1);
}

.recipe-card:hover .card-image img {
    transform: scale(1.05);
}

.recipe-card .card-content {
    padding: 2rem;
    text-align: center;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    height: calc(100% - 320px);
}

.recipe-card h3 {
    font-size: 1.75rem;
    margin-bottom: 0.5rem;
    line-height: 1.2;
    font-weight: 400;
}

.description {
    font-size: 1rem;
    color: var(--color-text-light);
    margin-bottom: 1rem;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    font-weight: 300;
    opacity: 0.8;
}

.card-meta {
    display: flex;
    justify-content: center;
    gap: 0.75rem;
    padding-top: 1.5rem;
    margin-top: auto;
    /* Push to bottom */
    border-top: 1px solid var(--color-border);
}

.card-meta span {
    font-size: 0.7rem;
    color: var(--color-dark);
    text-transform: uppercase;
    letter-spacing: 1px;
    font-weight: 600;
    background-color: rgba(197, 160, 40, 0.15);
    /* Light gold background */
    padding: 0.5rem 1rem;
    border-radius: 2px;
    transition: var(--transition);
}

body.dark-mode .card-meta span {
    background-color: rgba(197, 160, 40, 0.2);
    color: var(--color-accent);
}

/* No Results */
.no-results {
    text-align: center;
    padding: 4rem 0;
    color: var(--color-text-light);
}

.no-results.hidden {
    display: none;
}

.btn-text {
    background: none;
    border: none;
    color: var(--color-accent);
    font-weight: 600;
    cursor: pointer;
    margin-top: 1rem;
    text-decoration: underline;
}

@media (max-width: 768px) {
    .hero.main-hero h1 {
        font-size: 3rem;
    }

    .feed-header {
        flex-direction: column;
        align-items: center;
        gap: 1rem;
    }

    .tags-filter {
        flex-wrap: wrap;
        justify-content: center;
        overflow-x: visible;
        padding-bottom: 0;
        gap: 0.75rem;
    }

    .recipe-grid {
        grid-template-columns: 1fr;
        gap: 3rem;
    }

    .recipe-card .card-image {
        height: 300px;
    }

    .recipe-card .card-content {
        height: calc(100% - 300px);
    }
}

/* --- Recipe Page Layout Redesign --- */

.recipe-content-wrapper {
    display: grid;
    grid-template-columns: 350px 1fr;
    gap: 4rem;
    align-items: start;
    margin-bottom: 6rem;
    position: relative;
}

.recipe-sidebar {
    position: sticky;
    top: 120px;
    /* Account for fixed navbar */
    height: fit-content;
    max-height: calc(100vh - 140px);
    overflow-y: auto;
    padding-right: 1rem;
    /* Scrollbar spacing */
}

/* Custom Scrollbar for Sidebar */
.recipe-sidebar::-webkit-scrollbar {
    width: 4px;
}

.recipe-sidebar::-webkit-scrollbar-track {
    background: transparent;
}

.recipe-sidebar::-webkit-scrollbar-thumb {
    background: var(--color-border);
    border-radius: 4px;
}

.recipe-main {
    min-width: 0;
    /* Prevent grid blowout */
}

/* Sidebar Ingredient Adjustments */
.recipe-sidebar .ingredients-section {
    margin-bottom: 0;
}

.recipe-sidebar .section-header {
    margin-bottom: 1.5rem;
    padding-bottom: 0.5rem;
}

.recipe-sidebar .section-header h2 {
    font-size: 1.5rem;
}

/* Force compact grid in sidebar */
.recipe-sidebar .ingredients-container.grid-view {
    grid-template-columns: 1fr;
    gap: 1rem;
}

.recipe-sidebar .grid-view .ingredient-card {
    flex-direction: row;
    align-items: center;
    padding: 0.75rem;
    min-height: auto;
}

.recipe-sidebar .grid-view .card-image {
    width: 60px;
    height: 60px;
    flex-shrink: 0;
    margin-right: 1rem;
    border-bottom: none;
    border-radius: var(--border-radius);
}

.recipe-sidebar .grid-view .card-info {
    padding: 0;
    text-align: left;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
}

.recipe-sidebar .grid-view .amount {
    font-size: 1rem;
    margin-bottom: 0;
}

.recipe-sidebar .grid-view .name {
    font-size: 0.85rem;
}

/* Story Section Adjustments for Main Column */
.recipe-main .story-section {
    margin-top: 0;
    padding: 3rem;
    text-align: left;
    margin-bottom: 4rem;
}

.recipe-main .story-section::before {
    left: 2rem;
    transform: none;
    font-size: 4rem;
    top: 1.5rem;
}

.recipe-main .story-content {
    margin: 0;
    max-width: none;
}

.recipe-main .story-content h2 {
    text-align: left;
}

.recipe-main .story-content h2::after {
    left: 0;
    transform: none;
}

/* Instructions Adjustments */
.recipe-main .instructions-section h2 {
    text-align: left;
}

.recipe-main .instructions-section h2::after {
    left: 0;
    transform: none;
}

/* Responsive Layout */
@media (max-width: 1024px) {
    .recipe-content-wrapper {
        grid-template-columns: 1fr;
        gap: 3rem;
    }

    .recipe-sidebar {
        position: static;
        max-height: none;
        overflow-y: visible;
        padding-right: 0;
    }

    .recipe-sidebar .ingredients-container.grid-view {
        grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    }

    .recipe-sidebar .grid-view .ingredient-card {
        flex-direction: column;
        padding: 0;
    }

    .recipe-sidebar .grid-view .card-image {
        width: 100%;
        height: 140px;
        margin-right: 0;
        border-radius: 0;
    }

    .recipe-sidebar .grid-view .card-info {
        padding: 1rem;
        text-align: center;
        align-items: center;
    }
}

@media (max-width: 768px) {

    /* --- Mobile Layout Reordering --- */
    .recipe-content-wrapper {
        display: flex;
        flex-direction: column;
        gap: 2rem;
    }

    /* Use display: contents to allow direct ordering of sections */
    .recipe-sidebar,
    .recipe-main {
        display: contents;
    }

    /* Order sections: Story (1) -> Ingredients (2) -> Instructions (3) */
    .story-section {
        order: 1;
        margin-bottom: 0;
        padding: 2rem 1.5rem;
    }

    .ingredients-section {
        order: 2;
        margin-bottom: 3rem;
        width: 100%;
    }

    .story-section,
    .instructions-section {
        width: 100%;
    }

    .instructions-section {
        order: 3;
    }

    /* Fix ingredient grid to be 2 columns on mobile */
    .ingredients-section .ingredients-container.grid-view {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 1rem;
    }

    .ingredients-section .grid-view .ingredient-card {
        flex-direction: column !important;
        padding: 0 !important;
    }

    .ingredients-section .grid-view .card-image {
        width: 100% !important;
        height: 120px !important;
        margin-right: 0 !important;
    }

    .ingredients-section .grid-view .card-info {
        padding: 0.75rem !important;
        text-align: center !important;
        align-items: center !important;
    }

    /* Fix list view to take full width */
    .ingredients-section .list-view .card-info {
        width: 100%;
    }

    .ingredients-section .list-view .amount {
        width: 100px;
    }

    /* --- Mobile Typography & Spacing Reductions --- */
    h1 {
        font-size: 2.5rem;
        line-height: 1.1;
    }

    .hero.main-hero h1 {
        font-size: 2.5rem;
    }

    h2 {
        font-size: 1.75rem;
        margin-bottom: 1.5rem;
    }

    .intro-content p,
    .story-content p,
    .step-content p {
        font-size: 1rem;
        line-height: 1.6;
    }

    .drop-cap::first-letter {
        font-size: 3rem;
        padding-right: 0.25rem;
    }

    .step-number {
        font-size: 2.5rem;
    }

    .step {
        gap: 1rem;
        margin-bottom: 2.5rem;
        padding-bottom: 2.5rem;
    }

    .step-content h3 {
        font-size: 1.25rem;
    }

    .meta {
        gap: 1.5rem;
        margin-top: 2rem;
        padding-top: 1.5rem;
    }

    .meta-item .value {
        font-size: 1.25rem;
    }

    .recipe-container {
        padding: 0 1.5rem;
    }

    .intro {
        padding: 2rem 1.5rem;
        margin-top: -2rem;
    }
}