:root {
    --brand: #e0552b; --brand-dark: #c0431d; --brand-soft: #fff0e9;
    --accent: #2e9e5b; --bg: #fbf7f0; --card: #ffffff;
    --ink: #2a2320; --muted: #8c7f74; --line: #ece2d6;
    --shadow: 0 1px 2px rgba(60,40,20,.06), 0 6px 18px rgba(60,40,20,.06);
    --radius: 14px; --maxw: 1100px;
    --serif: 'Fraunces', Georgia, 'Times New Roman', serif;
    --sans: 'Inter', 'Helvetica Neue', Helvetica, Arial, sans-serif;
}
*, *::before, *::after { box-sizing: border-box; }
html { overflow-x: hidden; }
body { margin: 0; font-family: var(--sans); color: var(--ink); background: var(--bg); line-height: 1.55; -webkit-font-smoothing: antialiased; overflow-x: hidden; max-width: 100%; }
a { color: var(--brand-dark); }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.section-title { font-family: var(--serif); font-size: 22px; margin: 0 0 18px; }
.brand-logo { width: 1.2em; height: 1.2em; border-radius: 6px; object-fit: cover; flex: 0 0 auto; }

/* ── Nav ─────────────────────────────────────────────────────────────────── */
.nav { display: flex; align-items: center; gap: 14px; padding: 12px 20px; background: var(--card); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 30; max-width: 100%; }
.nav-burger { background: none; border: none; font-size: 19px; color: var(--ink); cursor: pointer; width: 40px; height: 40px; border-radius: 10px; }
.nav-burger:hover { background: var(--brand-soft); color: var(--brand); }
.nav-brand { font-family: var(--serif); font-weight: 700; font-size: 22px; color: var(--brand); text-decoration: none; white-space: nowrap; display: inline-flex; align-items: center; gap: 8px; }
.nav-search { flex: 1 1 0; min-width: 0; max-width: 520px; display: flex; align-items: center; gap: 10px; background: var(--bg); border: 1px solid var(--line); border-radius: 999px; padding: 9px 16px; color: var(--muted); }
.nav-search input { flex: 1; min-width: 0; width: 100%; border: none; background: transparent; font-size: 15px; color: var(--ink); outline: none; }
.nav-search:focus-within { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.nav-right { display: flex; align-items: center; gap: 4px; margin-left: auto; }
.nav-icon { color: var(--muted); font-size: 17px; text-decoration: none; min-width: 40px; height: 40px; padding: 0 10px; display: inline-flex; align-items: center; justify-content: center; gap: 6px; border-radius: 10px; background: none; border: none; cursor: pointer; font-family: var(--sans); }
.nav-icon:hover { background: var(--brand-soft); color: var(--brand); }
.lang-btn span { font-size: 13px; font-weight: 600; }

/* Language dropdown */
.lang-dd { position: relative; }
.lang-menu { position: absolute; right: 0; top: 46px; background: var(--card); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow); padding: 6px; display: grid; grid-template-columns: repeat(2, 1fr); gap: 4px; min-width: 130px; z-index: 40; }
.lang-opt { border: none; background: none; padding: 8px 12px; border-radius: 8px; font-size: 13px; font-weight: 600; color: var(--ink); cursor: pointer; text-align: left; }
.lang-opt:hover { background: var(--bg); }
.lang-opt.active { background: var(--brand-soft); color: var(--brand); }

/* ── Drawer ──────────────────────────────────────────────────────────────── */
.drawer-scrim { position: fixed; inset: 0; background: rgba(40,28,20,.4); opacity: 0; visibility: hidden; transition: opacity .25s ease; z-index: 50; }
.drawer-scrim.open { opacity: 1; visibility: visible; }
.drawer { position: fixed; top: 0; left: 0; height: 100%; width: 280px; max-width: 82vw; background: var(--card); box-shadow: 4px 0 24px rgba(40,28,20,.18); transform: translateX(-100%); transition: transform .28s cubic-bezier(.4,0,.2,1); z-index: 60; display: flex; flex-direction: column; }
.drawer.open { transform: translateX(0); }
.drawer-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 18px; border-bottom: 1px solid var(--line); }
.drawer-brand { font-family: var(--serif); font-weight: 700; font-size: 20px; color: var(--brand); display: inline-flex; gap: 8px; align-items: center; }
.drawer-close { background: none; border: none; font-size: 20px; color: var(--muted); cursor: pointer; }
.drawer-nav { display: flex; flex-direction: column; padding: 10px; gap: 2px; }
.drawer-nav a, .drawer-logout { display: flex; align-items: center; gap: 14px; padding: 13px 14px; border-radius: 10px; text-decoration: none; color: var(--ink); font-weight: 500; font-size: 15px; background: none; border: none; cursor: pointer; font-family: var(--sans); text-align: left; width: 100%; }
.drawer-nav a:hover, .drawer-logout:hover { background: var(--brand-soft); color: var(--brand); }
.drawer-nav a i, .drawer-logout i { width: 20px; text-align: center; color: var(--brand); }

/* ── Recipe grid + cards ─────────────────────────────────────────────────── */
.recipe-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.recipe-card { position: relative; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); transition: transform .15s ease, box-shadow .15s ease; }
.recipe-card:hover { transform: translateY(-3px); box-shadow: 0 8px 24px rgba(60,40,20,.13); }
.rc-link { text-decoration: none; color: inherit; display: flex; flex-direction: column; height: 100%; }
.rc-media { position: relative; aspect-ratio: 16 / 11; background: var(--brand-soft); overflow: hidden; }
.rc-media img { width: 100%; height: 100%; object-fit: cover; display: block; position: relative; z-index: 1; }
.rc-ph { position: absolute; inset: 0; display: none; align-items: center; justify-content: center; color: #e3b8a4; font-size: 42px; }
.rc-media.rc-noimg .rc-ph { display: flex; }
.rc-host { position: absolute; top: 8px; left: 8px; z-index: 2; max-width: calc(100% - 52px); background: rgba(0,0,0,.6); color: #fff; font-size: 11px; font-weight: 500; padding: 3px 9px; border-radius: 999px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rc-host.verified { background: rgba(46,158,91,.95); }
.rc-host .fa-circle-check { font-size: 10px; }
.rc-time { position: absolute; bottom: 8px; left: 8px; z-index: 2; background: rgba(0,0,0,.62); color: #fff; font-size: 12px; font-weight: 500; padding: 3px 9px; border-radius: 999px; display: inline-flex; align-items: center; gap: 5px; }
.rc-bookmark { position: absolute; top: 6px; right: 6px; z-index: 5; width: 34px; height: 34px; border-radius: 50%; border: none; background: rgba(255,255,255,.92); color: var(--ink); font-size: 15px; cursor: pointer; display: flex; align-items: center; justify-content: center; box-shadow: 0 1px 4px rgba(0,0,0,.2); }
.rc-bookmark:hover { background: #fff; color: var(--brand); }
.rc-bookmark.on { background: var(--brand); color: #fff; }
.rc-body { padding: 12px 14px 14px; display: flex; flex-direction: column; gap: 7px; flex: 1; }
.rc-title { font-family: var(--serif); font-weight: 600; font-size: 16.5px; margin: 0; line-height: 1.25; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.rc-meta { margin-top: auto; display: flex; align-items: center; gap: 12px; font-size: 12.5px; color: var(--muted); }
.rc-meta i { margin-right: 3px; }
.rc-fridge { display: flex; gap: 8px; flex-wrap: wrap; font-size: 12px; }
.rc-have { color: var(--accent); font-weight: 600; }
.rc-need { color: var(--muted); }
.rc-ready { color: var(--brand); font-weight: 600; }

/* ── Empty states / pagination / footer ──────────────────────────────────── */
.empty-state { text-align: center; padding: 60px 20px; color: var(--muted); }
.empty-state i { font-size: 46px; color: #e3b8a4; }
.empty-state h2 { font-family: var(--serif); color: var(--ink); margin: 16px 0 6px; }
.empty-state p { margin: 0; }
.pagination { display: flex; align-items: center; justify-content: center; gap: 16px; margin: 36px 0 10px; }
.page-btn { background: var(--card); border: 1px solid var(--line); border-radius: 999px; padding: 9px 18px; text-decoration: none; color: var(--brand-dark); font-weight: 600; box-shadow: var(--shadow); }
.page-btn:hover { border-color: var(--brand); }
.page-info { color: var(--muted); font-size: 14px; }
.footer { max-width: var(--maxw); margin: 48px auto 0; padding: 26px 22px 40px; border-top: 1px solid var(--line); display: flex; align-items: center; gap: 14px; flex-wrap: wrap; color: var(--muted); font-size: 14px; }
.footer-brand { font-family: var(--serif); font-weight: 700; color: var(--brand); display: inline-flex; gap: 7px; align-items: center; }

/* ── Auth + profile ──────────────────────────────────────────────────────── */
.auth-main { max-width: 420px; margin: 50px auto 0; padding: 0 20px; }
.auth-card { background: var(--card); border: 1px solid var(--line); border-radius: 18px; box-shadow: var(--shadow); padding: 30px 28px; }
.auth-title { font-family: var(--serif); font-size: 26px; margin: 0 0 4px; }
.auth-sub { color: var(--muted); margin: 0 0 22px; font-size: 14px; }
.auth-field { display: flex; flex-direction: column; gap: 5px; margin-bottom: 16px; }
.auth-field label { font-size: 13px; font-weight: 600; color: var(--muted); }
.auth-field input { border: 1px solid var(--line); border-radius: 10px; padding: 11px 14px; font-size: 15px; font-family: var(--sans); background: var(--bg); }
.auth-field input:focus { outline: none; border-color: var(--brand); background: #fff; }
.auth-btn { width: 100%; border: none; background: var(--brand); color: #fff; font-weight: 600; font-size: 15px; padding: 13px; border-radius: 11px; cursor: pointer; }
.auth-btn:hover { background: var(--brand-dark); }
.auth-alt { text-align: center; margin: 18px 0 0; font-size: 14px; color: var(--muted); }
.auth-err { background: #fdecea; color: #c0392b; border-radius: 10px; padding: 10px 14px; font-size: 14px; margin-bottom: 16px; }
.profile-main { max-width: 520px; margin: 40px auto 0; padding: 0 20px; }
.profile-card { background: var(--card); border: 1px solid var(--line); border-radius: 18px; box-shadow: var(--shadow); padding: 30px; text-align: center; }
.profile-avatar { width: 92px; height: 92px; border-radius: 50%; background: var(--brand-soft); color: var(--brand); display: flex; align-items: center; justify-content: center; font-size: 42px; margin: 0 auto 16px; }
.profile-name { font-family: var(--serif); font-size: 24px; margin: 0 0 4px; }
.profile-email { color: var(--muted); margin: 0 0 22px; }
.profile-links { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
.profile-links a, .profile-logout { text-decoration: none; border: 1px solid var(--line); border-radius: 10px; padding: 10px 16px; color: var(--ink); font-weight: 600; font-size: 14px; background: var(--bg); cursor: pointer; font-family: var(--sans); }
.profile-links a:hover, .profile-logout:hover { border-color: var(--brand); color: var(--brand); }

.list-main { max-width: var(--maxw); margin: 24px auto 0; padding: 0 22px; }

@media (max-width: 640px) {
    .nav { gap: 6px; padding: 10px 10px; }
    .nav-brand { font-size: 18px; flex: 0 0 auto; }
    .nav-search { max-width: none; padding: 8px 12px; }
    .nav-right { gap: 0; }
    .nav-burger { width: 36px; }
    .nav-icon { min-width: 34px; padding: 0 6px; font-size: 16px; }
    .lang-btn span { display: none; }
    .recipe-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
    .rc-title { font-size: 15px; }
}

/* Hide the brand wordmark on very narrow screens so the search bar keeps room. */
@media (max-width: 360px) {
    .nav-brand .brand-text { display: none; }
}
