:root {
    --bg: #ffffff;
    --text: #111111;
    --muted: #6b6b6b;
    --accent: #ff4d2e;
    --border: rgba(0,0,0,0.08);
}

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

img {
    display: block;
    max-width: 100%;
    height: auto;
}

body {
    font-family: "Helvetica Neue", Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
}

/* =========================
   NAVIGATION
   ========================= */

nav {
    position: sticky;
    top: 0;
    background: white;
    border-bottom: 1px solid var(--border);
    z-index: 100;
}

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

.logo {
    font-weight: 800;
    letter-spacing: -0.5px;
}

.nav-toggle-btn {
    display: none;
    border: 1px solid var(--border);
    background: #fff;
    color: var(--text);
    border-radius: 10px;
    padding: 8px 12px;
    font-size: 1.1rem;
    line-height: 1;
    cursor: pointer;
}

.nav-toggle-btn:hover {
    border-color: rgba(0, 0, 0, 0.2);
}

.nav-links a {
    margin-left: 18px;
    text-decoration: none;
    color: var(--text);
    font-size: 0.95rem;
    position: relative;
    transition: color 0.2s ease;
}

.nav-links a:hover {
    color: var(--accent);
}

.nav-links a.active {
    color: var(--accent);
    font-weight: 600;
}

.nav-links a.active::after {
    content: "";
    position: absolute;
    left: 0;
    bottom: -6px;
    width: 100%;
    height: 2px;
    background: var(--accent);
}

/* =========================
   HERO
   ========================= */

.hero {
    max-width: 1100px;
    margin: auto;
    padding: 90px 20px 60px;
}

.hero h1 {
    font-size: 5rem;
    letter-spacing: -2px;
    line-height: 1;
    margin-bottom: 20px;
}

.subtitle {
    font-size: 1.2rem;
    color: var(--accent);
    font-weight: 600;
    margin-bottom: 15px;
}

.hero-text {
    max-width: 650px;
    color: var(--muted);
    font-size: 1.05rem;
}

/* =========================
   LAYOUT
   ========================= */

.container {
    max-width: 1100px;
    margin: auto;
    padding: 20px;
}

.section-title {
    font-size: 2.2rem;
    letter-spacing: -1px;
    margin: 70px 0 20px;
}

/* =========================
   GRID
   ========================= */

.grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 18px;
}

/* =========================
   CATEGORY CARDS
   ========================= */

.card {
    display: block;
    padding: 28px 0;
    border-top: 1px solid var(--border);
    text-decoration: none;
    color: inherit;
    transition: transform 0.25s ease;
}

.card:hover {
    transform: translateX(6px);
}

.section-card {
    padding: 0;
    border: 1px solid var(--border);
    border-radius: 18px;
    overflow: hidden;
    background: white;
    box-shadow: 0 6px 18px rgba(0,0,0,.04);
    transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.section-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 24px rgba(0,0,0,.08);
}

.section-card-image {
    width: 100%;
    height: 220px;
    object-fit: cover;
    display: block;
}

.section-card-content {
    padding: 20px;
}

.section-card-content h2 {
    font-size: 1.4rem;
    letter-spacing: -0.5px;
    margin-bottom: 8px;
}

.section-card-content p {
    color: var(--muted);
    max-width: 600px;
    margin-bottom: 12px;
}

.card h2 {
    font-size: 1.4rem;
    letter-spacing: -0.5px;
    margin-bottom: 6px;
}

.card p {
    color: var(--muted);
    max-width: 600px;
}

.tag {
    display: inline-block;
    margin-top: 10px;
    font-size: 0.75rem;
    color: var(--accent);
    border: 1px solid var(--border);
    padding: 4px 10px;
    border-radius: 999px;
}

/* =========================
   SEARCH
   ========================= */

.search-section {
    margin: 8px 0 24px;
}

.search-row {
    display: flex;
    gap: 10px;
    align-items: center;
    margin: 10px 0 14px;
}

.search-box {
    flex: 1;
    min-width: 0;
    padding: 14px 16px;
    border: 1px solid var(--border);
    border-radius: 999px;
    font-size: 1rem;
}

.search-clear {
    border: 1px solid var(--border);
    background: white;
    padding: 12px 16px;
    border-radius: 999px;
    cursor: pointer;
    font-size: 0.95rem;
}

.search-help {
    color: var(--muted);
    margin-top: -8px;
    margin-bottom: 8px;
}

.search-controls {
    display: grid;
    grid-template-columns: repeat(3, minmax(180px, 1fr));
    gap: 10px;
    margin: 0 0 14px;
}

.search-filter-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.search-filter-group label {
    font-size: 0.78rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--muted);
    font-weight: 600;
}

.filter-select {
    appearance: none;
    -webkit-appearance: none;
    background: linear-gradient(180deg, #ffffff, #f8f8f8);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 10px 12px;
    font-size: 0.95rem;
    color: var(--text);
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.filter-select:hover {
    border-color: rgba(0, 0, 0, 0.2);
}

.filter-select:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(255, 77, 46, 0.18);
}

.search-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.search-tag-btn {
    background: linear-gradient(180deg, #ffffff 0%, #f6f6f6 100%);
    border: 1px solid rgba(0, 0, 0, 0.08);
    padding: 7px 14px;
    font-weight: 600;
    letter-spacing: 0.01em;
    cursor: pointer;
    transition: transform 0.15s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.search-tag-btn:hover {
    transform: translateY(-1px);
    border-color: rgba(0, 0, 0, 0.2);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.06);
}

.search-tag-btn.active {
    background: linear-gradient(180deg, #ff6b4f 0%, var(--accent) 100%);
    color: white;
    border-color: var(--accent);
    box-shadow: 0 8px 16px rgba(255, 77, 46, 0.28);
}

.sort-filter-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 24px;
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid var(--border);
}

.sort-control,
.filter-control {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
}

.sort-label,
.filter-label {
    font-size: 14px;
    font-weight: 500;
    color: var(--text);
}

.sort-select {
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: 4px;
    background: white;
    font-family: inherit;
    font-size: 14px;
    cursor: pointer;
    color: var(--text);
}

.sort-select:hover {
    border-color: #999;
}

.category-buttons {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.category-btn {
    background: linear-gradient(180deg, #ffffff 0%, #f6f6f6 100%);
    border: 1px solid rgba(0, 0, 0, 0.08);
    padding: 7px 14px;
    font-weight: 600;
    letter-spacing: 0.01em;
    cursor: pointer;
    font-size: 13px;
    transition: transform 0.15s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.category-btn:hover {
    transform: translateY(-1px);
    border-color: rgba(0, 0, 0, 0.2);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.06);
}

.category-btn.active {
    background: linear-gradient(180deg, #ff6b4f 0%, var(--accent) 100%);
    color: white;
    border-color: var(--accent);
    box-shadow: 0 8px 16px rgba(255, 77, 46, 0.28);
}

@media (max-width: 768px) {
    .search-controls {
        grid-template-columns: 1fr;
    }

    .sort-filter-controls {
        flex-direction: column;
        gap: 16px;
    }
    
    .sort-control,
    .filter-control {
        flex-direction: column;
        align-items: flex-start;
    }
}

.no-results {
    padding: 16px 0 8px;
    color: var(--muted);
    font-style: italic;
}

.search-results {
    margin-top: 48px;
    padding-top: 32px;
    border-top: 1px solid var(--border);
}

.search-results-title {
    font-size: 18px;
    font-weight: 500;
    margin-bottom: 24px;
    color: var(--text);
}

/* =========================
   FEATURED
   ========================= */

.featured {
    margin-top: 80px;
}

.recipe-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 0;
}

.recipe-card {
    display: block;
    border-top: 1px solid var(--border);
    padding: 20px 0;
    text-decoration: none;
    color: inherit;
    transition: transform 0.25s ease;
}

.recipe-card:hover {
    transform: translateX(6px);
}

.recipe-card h3 {
    font-size: 1.2rem;
    letter-spacing: -0.3px;
    margin-bottom: 6px;
}

.recipe-card p {
    color: var(--muted);
    max-width: 600px;
}

/* =========================
   ABOUT SECTION
   ========================= */

.about {
    margin: 80px 0 40px;
    padding: 40px;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: #fff;
}

.about p {
    margin-bottom: 16px;
    color: var(--muted);
    max-width: 750px;
    font-size: 1.05rem;
}

.about h3 {
    margin: 25px 0 12px;
    font-size: 1.2rem;
}

.about ul {
    margin-top: 10px;
    padding-left: 20px;
    max-width: 750px;
}

.about li {
    margin-bottom: 12px;
    color: var(--muted);
    line-height: 1.6;
}

.about strong {
    color: var(--text);
}

/* =========================
   FOOTER
   ========================= */

footer {
    text-align: center;
    padding: 60px 20px;
    color: var(--muted);
    font-size: 0.9rem;
}

/* =========================
   CHAT WIDGET (FRONTEND BETA)
   ========================= */

.chat-widget {
    position: fixed;
    right: 16px;
    bottom: 16px;
    z-index: 400;
}

.chat-fab {
    border: 0;
    background: linear-gradient(180deg, #ff6b4f 0%, var(--accent) 100%);
    color: #fff;
    font-weight: 700;
    padding: 12px 16px;
    border-radius: 999px;
    cursor: pointer;
    box-shadow: 0 10px 20px rgba(255, 77, 46, 0.28);
}

.chat-panel {
    display: none;
    width: min(92vw, 360px);
    height: min(70vh, 480px);
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 14px;
    box-shadow: 0 14px 34px rgba(0,0,0,.16);
    margin-bottom: 10px;
    overflow: hidden;
}

.chat-panel.open {
    display: grid;
    grid-template-rows: auto 1fr auto;
}

.chat-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 8px;
    padding: 12px;
    border-bottom: 1px solid var(--border);
}

.chat-header p {
    margin: 2px 0 0;
    font-size: 0.78rem;
    color: var(--muted);
}

.chat-close {
    border: 1px solid var(--border);
    background: #fff;
    border-radius: 8px;
    width: 30px;
    height: 30px;
    cursor: pointer;
    font-size: 1rem;
    line-height: 1;
}

.chat-messages {
    padding: 12px;
    overflow-y: auto;
    background: #fafafa;
}

.chat-msg {
    max-width: 90%;
    margin-bottom: 10px;
    padding: 9px 11px;
    border-radius: 10px;
    font-size: 0.92rem;
    line-height: 1.4;
}

.chat-msg.user {
    margin-left: auto;
    background: #ffe9e3;
    border: 1px solid rgba(255, 77, 46, 0.2);
}

.chat-msg.assistant {
    margin-right: auto;
    background: #fff;
    border: 1px solid var(--border);
}

.chat-form {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 8px;
    padding: 10px;
    border-top: 1px solid var(--border);
    background: #fff;
}

.chat-input {
    border: 1px solid var(--border);
    border-radius: 9px;
    padding: 10px 11px;
    font-size: 0.92rem;
}

.chat-send {
    border: 0;
    border-radius: 9px;
    background: var(--text);
    color: #fff;
    padding: 10px 13px;
    font-weight: 600;
    cursor: pointer;
}

/* =========================
   MOBILE
   ========================= */

@media (max-width: 700px) {
    .nav-container {
        flex-wrap: wrap;
        align-items: center;
        gap: 8px;
        padding: 12px 14px;
    }

    .nav-toggle-btn {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        margin-left: auto;
        min-height: 44px;
        min-width: 44px;
    }

    .nav-links {
        display: none;
        align-items: center;
        gap: 8px;
        width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        padding-bottom: 2px;
    }

    .nav-links.open {
        display: flex;
    }

    .nav-links a {
        margin-left: 0;
        flex: 0 0 auto;
        white-space: nowrap;
        padding: 8px 10px;
        border: 1px solid var(--border);
        border-radius: 999px;
        font-size: 0.9rem;
        line-height: 1.2;
    }

    .nav-links a.active::after {
        display: none;
    }

    .hero {
        padding: 54px 16px 36px;
    }

    .hero h1 {
        font-size: 2.8rem;
    }

    .search-row {
        flex-direction: column;
        align-items: stretch;
    }

    .search-clear {
        width: 100%;
    }

    .recipe-card {
        display: block;
        overflow: hidden;
        border-radius: 18px;
        background: white;
        text-decoration: none;
        color: inherit;
        box-shadow: 0 10px 25px rgba(0,0,0,.08);
        transition: transform .25s ease, box-shadow .25s ease;
    }

    .recipe-card:hover {
        transform: translateY(-6px);
        box-shadow: 0 16px 35px rgba(0,0,0,.12);
    }
}

.recipe-image {
    width: 100%;
    height: 240px;
    object-fit: cover;
    display: block;
    transition: height 260ms ease, max-height 260ms ease;
}

/* When search yields a single result, prevent the image from expanding too tall */
.recipe-grid.single-result .recipe-image {
    height: 260px;
    max-height: 320px;
    object-fit: cover;
}

/* Single-result layout: centre the result and constrain widths for readability */
.recipe-grid.single-result {
    grid-template-columns: 1fr;
    justify-items: center;
    gap: 24px;
}

.recipe-grid.single-result .recipe-card {
    max-width: 900px;
    width: 100%;
    padding: 18px 0;
}

.recipe-grid.single-result .recipe-content {
    max-width: 720px;
}

/* Slightly tighter image on small screens */
@media (max-width: 700px) {
    .recipe-grid.single-result .recipe-image {
        height: 220px;
    }
}

.recipe-content {
    padding: 20px;
}

.recipe-content h3 {
    margin-bottom: 10px;
}

.recipe-content p {
    color: #666;
    line-height: 1.6;
    margin-bottom: 10px;
}

/* Metadata in cards: hidden by default, revealed in single-result layout */
.recipe-card .recipe-meta {
    display: none;
    gap: 14px;
    margin: 12px 0 6px;
    color: var(--muted);
    font-size: 0.95rem;
    align-items: center;
}

.recipe-card .recipe-meta .recipe-meta-item strong {
    font-weight: 600;
    margin-right: 6px;
    color: var(--text);
}

.recipe-grid.single-result .recipe-card .recipe-meta {
    display: flex;
}

.recipe-hero {
    max-width: 1200px;
    margin: 0 auto;
    padding: 60px 20px 40px;
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(280px, 360px);
    gap: 32px;
    align-items: center;
}

.recipe-hero-copy {
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    padding-top: 0;
}

.recipe-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    width: fit-content;
    margin-bottom: 20px;
    font-size: 0.9rem;
    color: var(--accent);
    font-weight: 600;
}

.recipe-badge::before {
    content: "🔒";
    font-size: 1.1rem;
}

.recipe-hero h1 {
    font-size: 2.6rem;
    letter-spacing: -0.8px;
    line-height: 1.1;
    margin-bottom: 18px;
    color: var(--text);
}

.recipe-meta {
    display: flex;
    align-items: center;
    gap: 24px;
    margin-bottom: 24px;
    font-size: 0.95rem;
    color: var(--muted);
}

.recipe-meta-item {
    display: flex;
    align-items: center;
    gap: 6px;
}

.recipe-meta-item strong {
    color: var(--text);
}

.recipe-hero-description {
    font-size: 1.05rem;
    line-height: 1.7;
    color: var(--muted);
    margin-bottom: 28px;
    max-width: 520px;
}

.recipe-author {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 28px;
    padding-bottom: 24px;
    border-bottom: 1px solid var(--border);
}

.recipe-author-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #ccc;
    flex-shrink: 0;
}

.recipe-author-name {
    font-weight: 600;
    font-size: 0.95rem;
}

.recipe-actions {
    display: flex;
    gap: 12px;
}

.recipe-actions button {
    padding: 12px 24px;
    border-radius: 999px;
    border: none;
    font-weight: 600;
    cursor: pointer;
    font-size: 0.95rem;
    transition: all 0.25s ease;
}

.recipe-actions .btn-save {
    background: var(--text);
    color: white;
}

.recipe-actions .btn-save:hover {
    background: var(--accent);
}

.recipe-actions .btn-add {
    background: white;
    color: var(--text);
    border: 1px solid var(--border);
}

.recipe-actions .btn-add:hover {
    background: #f5f5f5;
}

.recipe-hero-image {
    width: 100%;
    height: 360px;
    object-fit: cover;
    border-radius: 18px;
    display: block;
    box-shadow: 0 12px 28px rgba(0,0,0,.10);
}

.lemon-pasta-hero .recipe-hero-image {
    width: 100%;
    max-width: 320px;
    height: 280px;
    justify-self: end;
    margin-left: auto;
}

.sticky-beef-mince-hero .recipe-hero-image {
    width: 100%;
    max-width: 320px;
    height: 320px;
    justify-self: end;
    margin-left: auto;
}

@media (max-width: 900px) {
    .recipe-hero {
        grid-template-columns: 1fr;
        gap: 24px;
    }

    .recipe-hero-copy {
        padding-top: 0;
    }

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

    .recipe-hero-image {
        height: 320px;
    }

    .recipe-hero-description {
        max-width: 100%;
    }
}

@media (max-width: 700px) {
    .recipe-hero {
        padding: 40px 20px 30px;
        gap: 20px;
    }

    .recipe-hero h1 {
        font-size: 1.8rem;
    }

    .recipe-hero-image {
        height: 260px;
    }

    .recipe-meta {
        gap: 16px;
        font-size: 0.85rem;
        flex-wrap: wrap;
    }

    .recipe-hero-image {
        min-height: 280px;
    }

    .recipe-actions {
        flex-direction: column;
    }

    .recipe-actions button {
        width: 100%;
    }
}

.about {
    margin: 80px 0;
}

.about-grid {
    display: grid;
    grid-template-columns: 1.2fr 1fr;
    gap: 60px;
    align-items: center;
}

.about-image img {
    width: 100%;
    height: 450px;
    object-fit: cover;
    border-radius: 18px;
}

.eyebrow {
    text-transform: uppercase;
    letter-spacing: 3px;
    color: #999;
    font-size: .85rem;
    margin-bottom: 12px;
}

.about h2 {
    font-size: 2.4rem;
    margin-bottom: 20px;
}

.about-intro {
    color: #666;
    line-height: 1.8;
    margin-bottom: 35px;
}

.about-features {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.feature {
    background: #fff;
    padding: 18px 22px;
    border-radius: 14px;
    box-shadow: 0 6px 18px rgba(0,0,0,.06);
    font-weight: 600;
}

/* =========================
   SMALL PHONES (iPhone / narrow)
   Improvements: more compact spacing, smaller hero type, responsive images, full-width controls
   ========================= */
@media (max-width: 480px) {
    .nav-container {
        padding: 10px 14px;
    }

    .logo {
        font-size: 1rem;
    }

    .hero h1 {
        font-size: 2rem;
    }

    .section-title {
        font-size: 1.6rem;
        margin: 40px 0 12px;
    }

    .container {
        padding: 12px;
    }

    .grid,
    .recipe-grid {
        grid-template-columns: 1fr;
    }

    .filter-select,
    .sort-select,
    .search-clear,
    .search-tag-btn,
    .category-btn {
        min-height: 44px;
    }

    .search-tag-btn,
    .category-btn {
        padding: 8px 12px;
    }

    .sort-control,
    .filter-control {
        width: 100%;
        align-items: stretch;
    }

    .sort-select,
    .filter-select {
        width: 100%;
    }

    .recipe-hero {
        padding: 20px 12px 18px;
        gap: 14px;
        grid-template-columns: 1fr;
    }

    .recipe-hero h1 {
        font-size: 1.4rem;
    }

    .recipe-hero-description {
        font-size: 0.95rem;
        margin-bottom: 18px;
    }

    .recipe-hero-image {
        width: 100%;
        height: auto;
        max-width: 100%;
        border-radius: 12px;
        box-shadow: 0 8px 20px rgba(0,0,0,.08);
    }

    .recipe-actions {
        width: 100%;
        gap: 10px;
    }

    .recipe-actions button {
        width: 100%;
        min-height: 44px; /* touch target */
        padding: 10px 12px;
        font-size: 0.95rem;
    }

    #servings {
        width: 100%;
        margin: 8px 0 10px;
    }

    #servingValue {
        font-weight: 700;
        font-size: 1rem;
    }

    #ingredients li {
        font-size: 0.98rem;
        padding-bottom: 6px;
    }

    /* Stack the about section and let the photo scale to fit the page */
    .about-grid {
        grid-template-columns: 1fr;
        gap: 18px;
    }

    .about-content {
        order: 1;
    }

    .about-image {
        order: 2;
        display: flex;
        justify-content: center;
        align-items: center;
    }

    .about-image img {
        width: 100%;
        height: auto;
        max-width: 100%;
        border-radius: 12px;
        margin: 0;
    }

    .recipe-image {
        width: 100%;
        height: auto;
        max-width: 100%;
    }

    .recipe-image {
        width: 100%;
        height: auto;
        aspect-ratio: 16/9;
        max-height: 360px;
        object-fit: cover;
    }

    .chat-widget {
        right: 10px;
        bottom: 10px;
    }

    .chat-fab {
        min-height: 44px;
        min-width: 44px;
    }

    .chat-panel {
        width: min(96vw, 360px);
        height: min(74vh, 520px);
    }
}