/* ===== CSS Variables ===== */
@font-face {
    font-family: 'InterLocal';
    src: url('/static/fonts/inter-latin-var.woff2') format('woff2');
    font-style: normal;
    font-weight: 300 700;
    font-display: swap;
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC,
        U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212,
        U+2215, U+FEFF, U+FFFD;
}

@font-face {
    font-family: 'PlayfairDisplayLocal';
    src: url('/static/fonts/playfair-display-latin-var.woff2') format('woff2');
    font-style: normal;
    font-weight: 400 700;
    font-display: swap;
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC,
        U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212,
        U+2215, U+FEFF, U+FFFD;
}

:root {
    --vermillion: #C41E3A;
    --vermillion-dark: #9B1B30;
    --gold: #D4AF37;
    --gold-light: #F4E4BC;
    --ink: #1a1a1a;
    --ink-light: #2d2d2d;
    --paper: #FAF8F3;
    --paper-dark: #F0EDE5;
    --white: #ffffff;
    --shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    --shadow-hover: 0 20px 40px rgba(0, 0, 0, 0.12);
    --font-sans: 'InterLocal', Inter, 'Segoe UI', Roboto, 'PingFang SC', 'Hiragino Sans GB',
        'Microsoft YaHei', Helvetica, Arial, sans-serif;
    --font-serif: 'PlayfairDisplayLocal', 'Playfair Display', Georgia, 'Times New Roman', serif;
    --font-cjk: 'Noto Serif SC', 'Source Han Serif SC', 'Songti SC', STSong, SimSun, serif;
    --header-offset: 70px;
}

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

html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-sans);
    background: var(--paper);
    color: var(--ink);
    line-height: 1.7;
}

html[lang="ar"] {
    --font-sans: 'Noto Naskh Arabic', 'Noto Sans Arabic', 'Geeza Pro', 'Segoe UI', Tahoma, Arial, sans-serif;
    --font-serif: 'Noto Naskh Arabic', 'Amiri', Georgia, 'Times New Roman', serif;
}

html[dir="rtl"] body {
    direction: rtl;
}

html[dir="rtl"] .logo {
    flex-direction: row-reverse;
}

html[dir="rtl"] .logo-text {
    text-align: right;
}

html[dir="rtl"] .lang-switch,
html[dir="rtl"] .lang-select-mobile {
    direction: ltr;
}

html[dir="rtl"] .lang-switch {
    flex-direction: row;
    unicode-bidi: isolate;
}

html[dir="rtl"] .nav-actions {
    justify-content: flex-start;
}

html[dir="rtl"] .dropdown-menu {
    left: auto;
    right: 0;
}

html[dir="rtl"] .dropdown-menu::before {
    left: auto;
    right: 20px;
}

html[dir="rtl"] .search-box input {
    padding: 0.5rem 2.25rem 0.5rem 1rem;
}

html[dir="rtl"] .search-box svg {
    left: auto;
    right: 0.65rem;
}

html[dir="rtl"] .nav-search-center .search-box input {
    padding: 0.75rem 3rem 0.75rem 1rem;
}

html[dir="rtl"] .nav-search-center .search-box svg {
    left: auto;
    right: 1rem;
}

html[dir="rtl"] .cookie-consent-panel,
html[dir="rtl"] .footer-content,
html[dir="rtl"] .footer-bottom {
    text-align: right;
}

html[dir="rtl"] .recipe-badge {
    left: auto;
    right: 0.75rem;
}

html[dir="rtl"] .recipe-fav {
    left: 0.75rem;
    right: auto;
}

html[dir="rtl"] .recipe-rating {
    margin-left: 0;
    margin-right: auto;
}

/* ===== Typography ===== */
.font-serif {
    font-family: var(--font-serif), var(--font-cjk);
}

.font-chinese {
    font-family: var(--font-cjk);
}

/* ===== Header ===== */
header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    background: rgba(250, 248, 243, 0.98);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--paper-dark);
    transition: box-shadow 0.24s ease;
}

header.is-scrolled {
    box-shadow: 0 2px 20px rgba(0, 0, 0, 0.1);
}

nav {
    max-width: 1400px;
    margin: 0 auto;
    padding: 1rem 2rem;
    display: grid;
    grid-template-columns: auto 1fr auto auto;
    align-items: center;
    gap: 1.5rem;
}

.logo {
    font-family: var(--font-serif), var(--font-cjk);
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.logo-icon {
    width: 48px;
    height: 48px;
    background: linear-gradient(135deg, var(--vermillion) 0%, var(--vermillion-dark) 100%);
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 15px rgba(196, 30, 58, 0.35);
    flex-shrink: 0;
}

.logo-icon svg {
    width: 32px;
    height: 32px;
}

.logo-text {
    display: flex;
    flex-direction: column;
    line-height: 1.2;
}

.logo-chinese {
    font-family: var(--font-cjk);
    font-size: 0.9rem;
    color: var(--gold);
    letter-spacing: 3px;
    font-weight: 600;
}

.logo-brand {
    font-size: 1.15rem;
    color: var(--ink);
    font-weight: 700;
}

/* Navigation */
.nav-links {
    display: flex;
    gap: 2rem;
    list-style: none;
}

.nav-links li {
    position: relative;
}

.nav-links a {
    color: var(--ink);
    text-decoration: none;
    font-weight: 500;
    font-size: 0.9rem;
    transition: color 0.3s;
    position: relative;
    display: flex;
    align-items: center;
    gap: 0.3rem;
}

.nav-links a::after {
    content: '';
    position: absolute;
    bottom: -4px;
    left: 0;
    width: 0;
    height: 2px;
    background: var(--vermillion);
    transition: width 0.3s;
}

.nav-links a:hover,
.nav-links a.active {
    color: var(--vermillion);
}

.nav-links a:hover::after,
.nav-links a.active::after {
    width: 100%;
}

/* Recipes Dropdown Button */
.recipes-btn {
    background: var(--vermillion);
    color: var(--white) !important;
    padding: 0.6rem 1.25rem !important;
    border-radius: 25px;
    font-weight: 600 !important;
}

.recipes-btn::after {
    display: none !important;
}

.recipes-btn:hover {
    background: var(--vermillion-dark) !important;
}

.recipes-btn .dropdown-icon {
    fill: var(--white);
}

/* Dropdown Menu */
.dropdown-icon {
    width: 16px;
    height: 16px;
    transition: transform 0.3s;
}

.nav-links li:hover .dropdown-icon {
    transform: rotate(180deg);
}

.dropdown-menu {
    position: absolute;
    top: 100%;
    left: 0;
    background: var(--white);
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
    padding: 0.5rem;
    min-width: 200px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px);
    transition: all 0.3s;
    z-index: 1001;
    margin-top: 0.5rem;
}

.nav-links li:hover .dropdown-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.nav-links li.open .dropdown-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.nav-links li.open .dropdown-icon {
    transform: rotate(180deg);
}

.dropdown-menu::before {
    content: '';
    position: absolute;
    top: -8px;
    left: 20px;
    width: 0;
    height: 0;
    border-left: 8px solid transparent;
    border-right: 8px solid transparent;
    border-bottom: 8px solid var(--white);
}

.dropdown-menu li {
    list-style: none;
}

.dropdown-menu a {
    padding: 0.875rem 1rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    border-radius: 8px;
    transition: all 0.3s;
    min-height: 44px;
}

.dropdown-menu a::after {
    display: none;
}

.dropdown-menu a:hover,
.dropdown-menu a:active {
    background: var(--paper);
    color: var(--vermillion);
}

/* Touch-friendly improvements */
@media (hover: none) {
    .dropdown-menu a:active {
        background: var(--vermillion);
        color: var(--white);
    }
    
    .dropdown-menu a:active .category-icon-small {
        background: var(--white);
    }
    
    .dropdown-menu a:active .category-icon-small svg {
        fill: var(--vermillion);
    }
}

.dropdown-menu .category-icon-small {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--paper);
    display: flex;
    align-items: center;
    justify-content: center;
}

.dropdown-menu .category-icon-small svg {
    width: 16px;
    height: 16px;
    fill: var(--vermillion);
}

.dropdown-menu .category-icon-small img {
    width: 16px;
    height: 16px;
    object-fit: contain;
}

.dropdown-menu a:hover .category-icon-small {
    background: var(--vermillion);
}

.dropdown-menu a:hover .category-icon-small svg {
    fill: var(--white);
}

.dropdown-menu a:hover .category-icon-small img {
    filter: brightness(0) invert(1);
}

/* Nav Actions */
.nav-actions {
    display: flex;
    gap: 1rem;
    align-items: center;
    justify-content: flex-end;
}

.nav-actions .nav-links {
    display: flex;
    gap: 0;
}

.nav-actions .nav-links li {
    position: relative;
    list-style: none;
}

/* Center Search Box */
.nav-search-center {
    justify-self: center;
    width: 100%;
    max-width: 500px;
}

.nav-search-center .search-box {
    width: 100%;
}

.nav-search-center .search-box input {
    width: 100%;
    padding: 0.75rem 1rem 0.75rem 3rem;
    font-size: 1rem;
    border-radius: 30px;
}

.nav-search-center .search-box svg {
    left: 1rem;
    width: 20px;
    height: 20px;
    cursor: pointer;
}

/* Search Box */
.search-box {
    position: relative;
}

.search-box input {
    background: var(--paper-dark);
    border: 1px solid transparent;
    padding: 0.5rem 1rem 0.5rem 2.25rem;
    border-radius: 25px;
    color: var(--ink);
    width: 200px;
    outline: none;
    transition: all 0.3s;
    font-size: 0.9rem;
}

.search-box input:focus {
    border-color: var(--vermillion);
    background: var(--white);
}

.search-box svg {
    position: absolute;
    left: 0.65rem;
    top: 50%;
    transform: translateY(-50%);
    width: 16px;
    height: 16px;
    fill: var(--ink-light);
}

/* Language Switcher */
.lang-switch {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 0.15rem;
    background: var(--paper-dark);
    border-radius: 20px;
    padding: 3px;
}

.lang-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.3rem 0.5rem;
    border: none;
    background: transparent;
    cursor: pointer;
    font-size: 0.7rem;
    font-weight: 600;
    border-radius: 17px;
    transition: all 0.3s;
    color: var(--ink-light);
    text-decoration: none !important;
}

.lang-btn:visited,
.lang-btn:hover,
.lang-btn:focus-visible,
.lang-btn:active {
    text-decoration: none !important;
}

.lang-btn.active {
    background: var(--vermillion);
    color: var(--white);
}

.lang-btn:hover:not(.active) {
    color: var(--vermillion);
}

.lang-select-mobile {
    display: none;
    border: 1px solid var(--paper-dark);
    border-radius: 16px;
    background: var(--white);
    color: var(--ink);
    font-size: 0.8rem;
    font-weight: 600;
    height: 38px;
    padding: 0 0.65rem;
    min-width: 78px;
}

.search-modal-trigger {
    display: none;
    width: 42px;
    height: 42px;
    border: 1px solid var(--paper-dark);
    border-radius: 50%;
    background: var(--white);
    color: var(--ink);
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.search-modal-trigger svg {
    width: 18px;
    height: 18px;
    fill: currentColor;
}

body.search-modal-open {
    overflow: hidden;
}

.search-modal {
    position: fixed;
    inset: 0;
    z-index: 1300;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
}

.search-modal.is-open {
    opacity: 1;
    pointer-events: auto;
}

.search-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    opacity: 0;
    transition: opacity 0.2s ease;
}

.search-modal.is-open .search-modal-backdrop {
    opacity: 1;
}

.search-modal-panel {
    position: relative;
    width: min(92vw, 460px);
    margin: 12vh auto 0;
    background: var(--white);
    border-radius: 18px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.2);
    padding: 1rem;
    transform: translateY(16px);
    opacity: 0;
    transition: transform 0.2s ease, opacity 0.2s ease;
}

.search-modal.is-open .search-modal-panel {
    transform: translateY(0);
    opacity: 1;
}

.search-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
}

.search-modal-title {
    margin: 0;
    font-size: 1.2rem;
    font-family: var(--font-display), var(--font-cjk);
    color: var(--ink);
}

.search-modal-close {
    width: 36px;
    height: 36px;
    border: none;
    border-radius: 50%;
    background: var(--paper);
    color: var(--ink);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.search-modal-close svg {
    width: 18px;
    height: 18px;
    fill: currentColor;
    pointer-events: none;
}

.search-modal-close svg path {
    pointer-events: none;
}

.search-modal-form {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 0.75rem;
    align-items: center;
    margin-top: 1rem;
}

.search-modal-form input {
    height: 44px;
    border: 1px solid var(--paper-dark);
    border-radius: 14px;
    padding: 0 0.85rem;
    font-size: 0.95rem;
}

.search-modal-form .btn {
    min-height: 44px;
}

/* ===== Buttons ===== */
.btn {
    padding: 0.6rem 1.5rem;
    border-radius: 25px;
    border: none;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    font-size: 0.9rem;
}

.btn-primary {
    background: var(--vermillion);
    color: var(--white);
}

.btn-primary:hover {
    background: var(--vermillion-dark);
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(196, 30, 58, 0.3);
}

.btn-secondary {
    background: transparent;
    color: var(--ink);
    border: 1px solid var(--ink-light);
}

.btn-secondary:hover {
    background: var(--ink);
    color: var(--paper);
}

.btn-gold {
    background: var(--gold);
    color: var(--ink);
}

.btn-gold:hover {
    background: #B8960C;
    transform: translateY(-2px);
}

.btn-outline {
    background: transparent;
    color: var(--white);
    border: 2px solid var(--white);
}

.btn-outline:hover {
    background: var(--white);
    color: var(--vermillion);
}


/* ===== Section Headers ===== */
.section-header {
    text-align: center;
    max-width: 600px;
    margin: 0 auto 3rem;
}

.section-label {
    color: var(--vermillion);
    font-weight: 600;
    font-size: 0.8rem;
    letter-spacing: 2px;
    text-transform: uppercase;
    margin-bottom: 0.5rem;
}

.section-title {
    font-family: var(--font-serif), var(--font-cjk);
    font-size: 2.5rem;
    margin-bottom: 1rem;
}

.section-subtitle {
    color: var(--ink-light);
}

.categories-more-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-top: 1rem;
    padding: 0.45rem 0.95rem;
    border-radius: 999px;
    border: 1px solid rgba(196, 30, 58, 0.2);
    color: var(--vermillion);
    font-weight: 600;
    text-decoration: none;
    transition: all 0.25s ease;
}

.categories-more-link:hover {
    background: var(--vermillion);
    color: var(--white);
}

/* ===== Categories ===== */
.categories {
    padding: 5rem 2rem;
    background: var(--white);
    position: relative;
    z-index: 2;
    clear: both;
}

.categories-grid {
    max-width: 1200px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 1.5rem;
}

.category-card {
    text-align: center;
    cursor: pointer;
    transition: transform 0.3s;
    text-decoration: none;
    color: var(--ink);
}

.category-card:hover {
    transform: translateY(-5px);
}

.category-icon {
    width: 90px;
    height: 90px;
    margin: 0 auto 1rem;
    border-radius: 50%;
    background: var(--paper);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
    border: 2px solid transparent;
}

.category-card:hover .category-icon {
    background: var(--vermillion);
    border-color: var(--vermillion);
}

.category-icon svg {
    width: 40px;
    height: 40px;
    fill: var(--vermillion);
    transition: fill 0.3s;
}

.category-icon img {
    width: 40px;
    height: 40px;
    object-fit: contain;
    transition: transform 0.3s;
}

.category-icon.category-icon-photo {
    background: transparent;
    border-color: rgba(18, 22, 30, 0.08);
    overflow: hidden;
}

.category-icon.category-icon-photo img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    filter: none;
}

.category-card:hover .category-icon svg {
    fill: var(--white);
}

.category-card:hover .category-icon img {
    filter: brightness(0) invert(1);
    transform: scale(1.06);
}

.category-card:hover .category-icon.category-icon-photo {
    background: transparent;
}

.category-card:hover .category-icon.category-icon-photo img {
    filter: none;
    transform: scale(1.08);
}

.category-name {
    font-weight: 600;
    font-size: 0.95rem;
    margin-bottom: 0.25rem;
}

.category-count {
    font-size: 0.8rem;
    color: var(--ink-light);
}

/* ===== Recipes Grid ===== */
.popular-recipes {
    padding: 5rem 2rem;
    background: var(--paper);
    position: relative;
    z-index: 2;
    clear: both;
}

.recipes-grid {
    max-width: 1400px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1.5rem;
    position: relative;
    z-index: 1;
}

.popular-recipes-footer {
    margin-top: 2rem;
    text-align: center;
}

.popular-recipes-footer .btn {
    padding: 0.9rem 2rem;
}

.recipe-card {
    background: var(--white);
    border-radius: 16px;
    overflow: hidden;
    box-shadow: var(--shadow);
    transition: all 0.3s;
    color: var(--ink);
    display: block;
    position: relative;
    isolation: isolate;
}

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

.recipe-card.featured {
    grid-column: span 2;
    grid-row: span 2;
    position: relative;
    min-height: clamp(520px, 56vw, 700px);
}

.recipe-image {
    position: relative;
    aspect-ratio: 16 / 10;
    overflow: hidden;
    isolation: isolate;
}

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

.recipe-card.featured .recipe-image {
    position: absolute;
    inset: 0;
    aspect-ratio: auto;
    height: 100%;
    min-height: 100%;
}

.recipe-image img {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: cover;
    transition: transform 0.5s;
}

.recipe-card.featured .recipe-image img {
    object-position: center;
}

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

.recipe-badge {
    position: absolute;
    top: 0.75rem;
    left: 0.75rem;
    padding: 0.25rem 0.6rem;
    background: var(--vermillion);
    color: var(--white);
    border-radius: 15px;
    font-size: 0.7rem;
    font-weight: 600;
}

.recipe-badge.gold {
    background: var(--gold);
    color: var(--ink);
}

.recipe-fav {
    position: absolute;
    top: 0.75rem;
    right: 0.75rem;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--white);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s;
    border: none;
    z-index: 3;
}

.recipe-fav:hover {
    background: var(--vermillion);
}

.recipe-fav.active {
    background: var(--vermillion);
}

.recipe-fav svg {
    width: 16px;
    height: 16px;
    fill: none;
    stroke: var(--ink);
    stroke-width: 2;
    transition: all 0.3s;
}

.recipe-fav:hover svg {
    fill: var(--white);
    stroke: var(--white);
}

.recipe-fav.active svg {
    fill: var(--white);
    stroke: var(--white);
}

.recipe-content {
    padding: 1.25rem;
    position: relative;
    background: var(--white);
}

.recipe-card-main-link {
    display: block;
    color: inherit;
    text-decoration: none;
}

.recipe-card.featured .recipe-content {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(transparent, rgba(0, 0, 0, 0.8));
    color: var(--white);
    padding: 1.5rem;
    z-index: 2;
}

.recipe-category {
    color: var(--vermillion);
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 0.4rem;
}

.recipe-category-link {
    display: inline-block;
    text-decoration: none;
}

.recipe-category-link:hover {
    opacity: 0.8;
}

.recipe-card.featured .recipe-category {
    color: var(--gold);
}

.recipe-title {
    font-family: var(--font-serif), var(--font-cjk);
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.recipe-card.featured .recipe-title {
    font-size: 1.5rem;
}

.recipe-card-main-link p {
    font-size: 0.85rem;
    color: var(--ink-light);
    margin-bottom: 0.75rem;
    line-height: 1.5;
}

.recipe-desc {
    font-size: 0.85rem;
    color: var(--ink-light);
    margin-bottom: 0.75rem;
    line-height: 1.5;
}

.recipe-card.featured .recipe-desc {
    color: rgba(255, 255, 255, 0.8);
}

.recipe-card.featured .recipe-card-main-link p {
    color: rgba(255, 255, 255, 0.8);
}

.recipe-meta {
    display: flex;
    gap: 1rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--paper-dark);
    align-items: center;
    flex-wrap: wrap;
}

.recipe-card.featured .recipe-meta {
    border-top-color: rgba(255, 255, 255, 0.2);
}

.recipe-meta-item {
    display: flex;
    align-items: center;
    gap: 0.42rem;
    font-size: 0.82rem;
    font-weight: 500;
    line-height: 1.2;
    color: var(--ink-light);
}

.recipe-card.featured .recipe-meta-item {
    color: rgba(255, 255, 255, 0.9);
}

.recipe-meta-item svg {
    width: 15px;
    height: 15px;
    stroke: var(--vermillion);
    stroke-width: 1.85;
    stroke-linecap: round;
    stroke-linejoin: round;
    fill: none;
    flex-shrink: 0;
}

.recipe-card.featured .recipe-meta-item svg {
    stroke: var(--gold);
}

.recipe-rating {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    margin-left: auto;
    line-height: 1;
    font-weight: 600;
    color: var(--ink);
}

.recipe-card-image-link:focus-visible,
.recipe-card-main-link:focus-visible,
.recipe-category-link:focus-visible {
    outline: 2px solid var(--vermillion);
    outline-offset: 4px;
    border-radius: 10px;
}

.recipe-rating svg {
    width: 16px;
    height: 16px;
    fill: var(--gold);
    flex-shrink: 0;
}

.recipe-card.featured .recipe-rating {
    color: rgba(255, 255, 255, 0.92);
}

.favorite-toggle-btn {
    width: 22px;
    height: 22px;
    border: none;
    background: transparent;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.favorite-toggle-btn svg {
    width: 16px;
    height: 16px;
    fill: none;
    stroke: var(--ink);
    stroke-width: 2;
}

.favorite-toggle-btn:hover svg,
.favorite-toggle-btn.active svg {
    fill: var(--vermillion);
    stroke: var(--vermillion);
}

/* ===== CTA Section ===== */
.cta-section {
    padding: 5rem 2rem;
    background: var(--vermillion);
    text-align: center;
    position: relative;
    z-index: 1;
}

.cta-content {
    max-width: 600px;
    margin: 0 auto;
}

.cta-section h2 {
    font-family: var(--font-serif), var(--font-cjk);
    font-size: 2.5rem;
    color: var(--white);
    margin-bottom: 1rem;
}

.cta-section p {
    color: rgba(255, 255, 255, 0.9);
    margin-bottom: 2rem;
}

/* ===== Footer ===== */
footer {
    background: var(--ink);
    color: var(--white);
    padding: 4rem 2rem 2rem;
}

.footer-content {
    max-width: 1400px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: 2fr 1fr 1fr 1fr;
    gap: 3rem;
}

.footer-brand .logo {
    color: var(--white);
    margin-bottom: 1rem;
}

.footer-brand .logo .logo-brand {
    color: var(--white);
}

.footer-brand .logo .logo-chinese {
    color: var(--gold);
}

.footer-brand p {
    color: rgba(255, 255, 255, 0.6);
    font-size: 0.9rem;
    line-height: 1.8;
    margin-bottom: 1.5rem;
}

.footer-links h4 {
    font-family: var(--font-serif), var(--font-cjk);
    font-size: 1.1rem;
    margin-bottom: 1.5rem;
    color: var(--white);
}

.footer-links ul {
    list-style: none;
}

.footer-links li {
    margin-bottom: 0.75rem;
}

.footer-links a {
    color: rgba(255, 255, 255, 0.6);
    text-decoration: none;
    transition: color 0.3s;
    font-size: 0.9rem;
}

.footer-link-btn {
    color: rgba(255, 255, 255, 0.6);
    background: transparent;
    border: 0;
    padding: 0;
    margin: 0;
    font: inherit;
    font-size: 0.9rem;
    cursor: pointer;
    transition: color 0.3s;
}

.footer-links a:hover {
    color: var(--gold);
}

.footer-link-btn:hover {
    color: var(--gold);
}

.footer-bottom {
    max-width: 1400px;
    margin: 3rem auto 0;
    padding-top: 2rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: rgba(255, 255, 255, 0.5);
    font-size: 0.85rem;
}

.social-links {
    display: flex;
    gap: 0.75rem;
}

.social-links a {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
}

.social-links a:hover {
    background: var(--vermillion);
}

.social-links svg {
    width: 16px;
    height: 16px;
    fill: var(--white);
}


/* ===== Cookie Consent Modal ===== */
.cookie-consent-modal {
    position: fixed;
    inset: 0;
    z-index: 1200;
}

.cookie-consent-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
}

.cookie-consent-panel {
    position: relative;
    width: min(520px, calc(100% - 2rem));
    margin: 12vh auto 0;
    background: var(--white);
    border-radius: 16px;
    box-shadow: 0 28px 70px rgba(0, 0, 0, 0.28);
    padding: 1.25rem;
}

.cookie-consent-panel h2 {
    font-family: var(--font-serif), var(--font-cjk);
    margin-bottom: 0.5rem;
}

.cookie-consent-panel p {
    color: #555;
}

.cookie-consent-actions {
    margin-top: 1rem;
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
}

.page-header {
    margin-top: var(--header-offset);
    padding: 4rem 2rem;
    background: linear-gradient(135deg, var(--vermillion-dark) 0%, var(--vermillion) 100%);
    color: var(--white);
    text-align: center;
}

.page-header h1 {
    font-family: var(--font-serif), var(--font-cjk);
    font-size: 3rem;
    margin-bottom: 0.5rem;
}

.page-header .subtitle {
    font-size: 1.1rem;
    opacity: 0.9;
}

.breadcrumb {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    row-gap: 0.3rem;
    flex-wrap: wrap;
    margin-top: 1rem;
    font-size: 0.9rem;
    text-align: center;
}

.breadcrumb a {
    color: rgba(255, 255, 255, 0.8);
    text-decoration: none;
}

.breadcrumb a:hover {
    color: var(--white);
}

.breadcrumb span {
    color: rgba(255, 255, 255, 0.5);
}


/* ===== iPad / Tablet (768px - 1024px) ===== */
@media (max-width: 1024px) {
    :root {
        --header-offset: 67px;
    }

    nav {
        grid-template-columns: auto 1fr auto;
        gap: 1rem;
        padding: 0.75rem 1rem;
    }

    .logo-icon {
        width: 40px;
        height: 40px;
    }

    .logo-icon svg {
        width: 26px;
        height: 26px;
    }

    .logo-brand {
        font-size: 1rem;
    }

    .logo-chinese {
        font-size: 0.8rem;
    }

    .nav-search-center {
        display: none;
    }

    .lang-switch {
        gap: 0.1rem;
    }

    .lang-btn {
        padding: 0.25rem 0.4rem;
        font-size: 0.65rem;
    }

    .recipes-btn {
        padding: 0.5rem 1rem !important;
        font-size: 0.85rem;
    }

    .search-modal-trigger {
        display: inline-flex;
    }

    .search-modal {
        display: block;
    }

    .search-modal-backdrop {
        background: rgba(6, 8, 12, 0.6);
    }

    .search-modal-panel {
        position: absolute;
        inset: 0;
        width: 100%;
        max-width: 100%;
        height: 100dvh;
        margin: 0;
        border-radius: 0;
        box-shadow: none;
        box-sizing: border-box;
        overflow-x: hidden;
        padding: max(0.9rem, env(safe-area-inset-top)) clamp(0.8rem, 3.8vw, 1rem) max(1rem, env(safe-area-inset-bottom));
        display: flex;
        flex-direction: column;
        justify-content: flex-start;
        gap: 1rem;
        transform: translateY(28px);
    }

    .search-modal-header {
        padding-top: 0.15rem;
        display: grid;
        grid-template-columns: minmax(0, 1fr) auto;
        align-items: center;
    }

    .search-modal-title {
        font-size: 1.05rem;
        min-width: 0;
        overflow-wrap: anywhere;
    }

    .search-modal-close {
        flex: 0 0 auto;
        justify-self: end;
    }

    .search-modal-form {
        grid-template-columns: 1fr;
        gap: 0.85rem;
        margin-top: 0;
        width: 100%;
        min-width: 0;
    }

    .search-modal-form input {
        height: 46px;
        font-size: 1rem;
        width: 100%;
        max-width: 100%;
        min-width: 0;
    }

    .search-modal-form .btn {
        width: 100%;
        max-width: 100%;
        min-width: 0;
        min-height: 46px;
    }

    .dropdown-menu {
        left: auto;
        right: 0;
        min-width: 260px;
    }

    .dropdown-menu::before {
        left: auto;
        right: 18px;
    }

    .categories-grid {
        grid-template-columns: repeat(3, 1fr);
    }

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

    .recipe-card.featured {
        grid-column: span 2;
        grid-row: span 1;
        min-height: 460px;
    }

}

/* ===== Mobile (< 768px) ===== */
@media (max-width: 768px) {
    :root {
        --header-offset: 52px;
    }

    nav {
        grid-template-columns: auto auto auto;
        justify-content: space-between;
        gap: 0.5rem;
        padding: 0.5rem 0.6rem;
    }

    .logo {
        gap: 0.5rem;
    }

    .logo-icon {
        width: 36px;
        height: 36px;
        border-radius: 10px;
    }

    .logo-icon svg {
        width: 22px;
        height: 22px;
    }

    .logo-text {
        display: none;
    }

    .nav-actions {
        gap: 0.35rem;
        justify-self: end;
        min-width: 0;
    }

    .lang-switch {
        display: none;
    }

    .lang-select-mobile {
        display: block;
        height: 34px;
        min-width: 68px;
        padding: 0 0.5rem;
        font-size: 0.75rem;
    }

    .recipes-btn {
        padding: 0.44rem 0.76rem !important;
        font-size: 0.82rem;
    }

    .search-modal-trigger {
        width: 36px;
        height: 36px;
    }

    .dropdown-menu {
        min-width: min(84vw, 360px);
    }

    .section-header {
        padding: 0 1rem;
    }

    .section-title {
        font-size: 1.5rem;
    }

    .section-subtitle {
        font-size: 0.9rem;
    }

    .categories {
        padding: 3rem 1rem;
    }

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

    .category-icon {
        width: 70px;
        height: 70px;
    }

    .category-icon svg {
        width: 32px;
        height: 32px;
    }

    .category-icon img {
        width: 32px;
        height: 32px;
    }

    .category-name {
        font-size: 0.85rem;
    }

    .popular-recipes {
        padding: 3rem 1rem;
    }

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

    .recipe-card.featured {
        grid-column: span 1;
        min-height: clamp(360px, 84vw, 430px);
    }

    .recipe-card.featured .recipe-image {
        position: absolute;
        inset: 0;
        aspect-ratio: auto;
        height: 100%;
        min-height: 100%;
    }

    .recipe-card.featured .recipe-content {
        padding: 1.2rem 1.1rem 1rem;
        background: linear-gradient(180deg, rgba(0, 0, 0, 0.03) 0%, rgba(0, 0, 0, 0.84) 42%);
    }

    .recipe-card.featured .recipe-title {
        font-size: 1.15rem;
        margin-bottom: 0.45rem;
    }

    .recipe-card.featured .recipe-card-main-link p {
        display: -webkit-box;
        -webkit-box-orient: vertical;
        -webkit-line-clamp: 5;
        overflow: hidden;
        font-size: 0.84rem;
        line-height: 1.45;
        margin-bottom: 0.65rem;
        color: rgba(255, 255, 255, 0.88);
    }

    .recipe-card.featured .recipe-meta {
        gap: 0.8rem;
        padding-top: 0.65rem;
    }

    .recipe-card.featured .recipe-meta-item {
        font-size: 0.76rem;
    }

    .recipe-card.featured .recipe-rating {
        font-size: 0.78rem;
    }

    .cta-section h2 {
        font-size: 1.5rem;
    }

    .cta-section p {
        font-size: 0.9rem;
        padding: 0 1rem;
    }

    .footer-content {
        grid-template-columns: 1fr;
        gap: 2rem;
        text-align: center;
    }

    .footer-brand .logo {
        justify-content: center;
    }

    .footer-brand p {
        max-width: 300px;
        margin: 0 auto 1.5rem;
    }

    .footer-bottom {
        flex-direction: column;
        gap: 1rem;
        text-align: center;
    }

    .page-header {
        padding: 2rem 1rem;
    }

    .page-header h1 {
        font-size: 1.75rem;
    }

    .breadcrumb {
        gap: 0.35rem;
        font-size: 0.82rem;
    }

    .pagination {
        flex-wrap: wrap;
    }

}

/* ===== Small Mobile (< 480px) ===== */
@media (max-width: 480px) {
    nav {
        grid-template-columns: auto auto auto;
        gap: 0.45rem;
        padding: 0.45rem 0.6rem;
    }

    .logo-icon {
        width: 34px;
        height: 34px;
        border-radius: 10px;
    }

    .logo-icon svg {
        width: 20px;
        height: 20px;
    }

    .nav-actions {
        gap: 0.35rem;
    }

    .recipes-btn {
        padding: 0.42rem 0.72rem !important;
        font-size: 0.78rem;
        border-radius: 999px;
    }

    .recipes-btn .dropdown-icon {
        width: 13px;
        height: 13px;
    }

    .lang-select-mobile {
        min-width: 64px;
        height: 34px;
        padding: 0 0.42rem;
        font-size: 0.72rem;
    }

    .search-modal-trigger {
        width: 36px;
        height: 36px;
    }

    .search-modal-trigger svg {
        width: 16px;
        height: 16px;
    }

    .dropdown-menu {
        position: fixed;
        top: 72px;
        left: 50%;
        right: auto;
        width: min(92vw, 350px);
        min-width: 0;
        max-height: 62vh;
        overflow: auto;
        transform: translate(-50%, 10px);
    }

    .nav-links li.open .dropdown-menu,
    .nav-links li:hover .dropdown-menu {
        transform: translate(-50%, 0);
    }

    .dropdown-menu::before {
        display: none;
    }

    .search-modal-panel {
        padding-left: clamp(0.75rem, 3.2vw, 0.9rem);
        padding-right: clamp(0.75rem, 3.2vw, 0.9rem);
    }

    .search-modal-title {
        font-size: 1rem;
    }

    .section-title {
        font-size: 1.25rem;
    }

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

    .category-icon {
        width: 60px;
        height: 60px;
    }

    .category-icon svg {
        width: 28px;
        height: 28px;
    }

    .category-icon img {
        width: 28px;
        height: 28px;
    }
}

@media (max-width: 390px) {
    .recipes-btn {
        padding: 0.38rem 0.62rem !important;
        font-size: 0.74rem;
    }

    .lang-select-mobile {
        min-width: 58px;
        font-size: 0.68rem;
    }

    .search-modal-trigger {
        width: 34px;
        height: 34px;
    }

    .search-modal-panel {
        padding-left: 0.72rem;
        padding-right: 0.72rem;
    }

    .search-modal-title {
        font-size: 0.96rem;
    }

    .dropdown-menu {
        top: 68px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .search-modal,
    .search-modal-backdrop,
    .search-modal-panel {
        transition: none;
    }
}

@media (max-width: 768px) {
    .cookie-consent-panel {
        margin-top: 16vh;
    }

    .cookie-consent-actions {
        flex-direction: column;
    }

    .cookie-consent-actions .btn {
        width: 100%;
        text-align: center;
    }
}


/* ===== Utility Classes ===== */
.text-center {
    text-align: center;
}

.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.mb-4 { margin-bottom: 2rem; }

.hidden {
    display: none !important;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}
