/* Inline button for back-link (small, not full width) */
.btn-inline {
    display: inline-block;
    width: auto;
    min-width: 0;
    max-width: 300px;
    padding: 0.4em 1em;
    font-size: 1em;
    border-radius: 8px;
    margin: 0.5em 0;
    box-shadow: 0 2px 8px rgba(0,0,0,0.07);
    cursor: pointer; /* Add cursor pointer to buttons */
    background: var(--accent) !important;
    color: white !important; /* Force white text color */
    border: none;
    padding: 10px 14px;
    border-radius: 10px;
    font-weight: 700;
    transition: transform 180ms cubic-bezier(.2,.9,.2,1), box-shadow 180ms ease, opacity 140ms ease;
    will-change: transform, box-shadow;
}

.btn-inline:hover {
    transform: translateY(-3px) scale(1.02);
    box-shadow: 0 12px 30px rgba(16,24,40,0.12);
}

@import url('https://fonts.googleapis.com/css2?family=Dancing+Script:wght@400;700&display=swap');
:root{
    --accent:#e76f51;
    --muted:#6b7280;
    --bg:#cfc2b8;
    --card:#e5e7eb; /* neutral light gray cards */
    --text-light:#eaecef; /* page body text over background */
    --text-dark:#111111;  /* text used on cards */
    --radius:12px;
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial;
}
/* Prevent iOS from auto-resizing text unexpectedly; keep control over font sizes */
html { -webkit-text-size-adjust: 100%; }
html,body{
    height:100%;
    margin:0;
    color:var(--text-light);
    min-height:100vh;
    box-sizing:border-box;
}

/* use border-box everywhere to avoid unexpected overflow from padding/borders */
*, *::before, *::after { box-sizing: border-box; }

/* Heading font for body content (Dancing Script) — exclude h4 per request */
h1,h2,h3,h5,h6{
    font-family: 'Dancing Script', cursive;
    color: var(--text-light);
}

/* Fixed background layer using a pseudo-element for consistent behavior across browsers/devices */
body::before{
    content: "";
    position:fixed;
    inset:0;
    background-image: linear-gradient(rgba(0,0,0,0.30), rgba(0,0,0,0.30)), url('https://t3.ftcdn.net/jpg/02/30/65/32/360_F_230653294_5anAftMO11TB2Sy9IDR3MwLTacW22z4y.jpg');
    background-repeat: no-repeat;
    background-position: center center;
    background-size: cover;
    z-index:-1;
    pointer-events:none;
}

/* ensure page content sits above the fixed background layer */
.container{position:relative;z-index:1;max-width:1100px;margin:0 auto;padding:1rem;display:flex;flex-direction:column;min-height:100vh}
header{display:flex;justify-content:space-between;align-items:center;gap:16px;position:relative;z-index:2}
.brand{flex:0 0 auto}
nav a{pointer-events:auto}
.brand{display:flex;align-items:center;gap:12px;text-decoration:none;color:inherit}
.brand:hover{opacity:0.9}
.logo{width:44px;height:44px;border-radius:10px;background:linear-gradient(135deg,var(--accent),#f4a261);display:inline-block}
/* When the logo is an <img> element use the image and remove the background gradient. */
.brand img.logo{background:none;display:block;object-fit:cover}
nav a{margin-left:14px;color:var(--muted);text-decoration:none;font-weight:600}
nav a:hover{color:var(--accent)}
.hero{display:grid;grid-template-columns:1fr minmax(0,360px);gap:20px;margin-top:22px;align-items:center}
.hero-card{background:var(--card);padding:28px;border-radius:var(--radius);box-shadow:0 10px 30px rgba(16,24,40,0.08);border:1px solid rgba(0,0,0,0.04);color:var(--text-dark);max-width:100%;box-sizing:border-box}
/* Ensure headings inside the hero/search card use dark color (override global heading color) */
.hero-card h1, .hero-card h2, .hero-card h3, .hero-card h4{
    color: var(--text-dark);
}
/* Heading sizes increased by ~4px for better legibility */
h1{margin:0 0 8px 0;font-size:32px}
h2{margin:0 0 8px 0;font-size:26px}
h3{margin:0 0 8px 0;font-size:22px}
h4{margin:0 0 8px 0;font-size:18px}
h5{margin:0 0 8px 0;font-size:16px}
h6{margin:0 0 8px 0;font-size:14px}
p.lead{margin:0;color:var(--muted)}
.search{margin-top:16px;display:flex;gap:8px;flex-wrap:wrap}
.search input{flex:1;padding:12px 14px;border-radius:10px;border:1px solid rgba(0,0,0,0.08);font-size:16px;background:var(--card);color:var(--text-dark);min-width:0}
.search button{background:var(--accent);color:white;border:none;padding:0 14px;border-radius:10px;font-weight:700}

/* Prevent search controls from forcing a larger minimum width on small screens */
.search button{flex:0 0 auto}

/* Filters row styling (small, compact controls) */
.filters-row{display:flex;gap:12px;align-items:center;flex-wrap:wrap}
.filters-row label{display:flex;flex-direction:column;font-size:13px;color:var(--muted)}
.filters-row select, .filters-row input{padding:8px 10px;border-radius:8px;border:1px solid rgba(0,0,0,0.06);background:var(--card);color:var(--text-dark)}
.filters-row #clearFilters{background:transparent;border:1px solid rgba(0,0,0,0.06);padding:8px 10px;border-radius:10px;font-size:13px;color:var(--muted)}

/* Recipe Info Styling */
.recipe-info {
    background: var(--card);
    border-radius: var(--radius);
    padding: 20px;
    margin: 20px 0;
    box-shadow: 0 6px 18px rgba(16,24,40,0.06);
    border:1px solid rgba(0,0,0,0.04);
}

.time-info {
    display: flex;
    gap: 20px;
    margin-bottom: 15px;
}

.time-info span {
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--muted);
}

.recipe-details {
    display: flex;
    gap: 20px;
    padding-top: 10px;
    border-top: 1px solid #eee;
}

.recipe-details span {
    display: flex;
    align-items: center;
    gap: 6px;
}

.nutrition-info {
    background: #f8f9fa;
    border-radius: var(--radius);
    padding: 15px;
    margin-top: 20px;
}

.nutrition-info h4 {
    margin: 0 0 12px 0;
    color: var(--muted);
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

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

.nutrition-grid div {
    text-align: center;
}

.nutrition-grid span {
    display: block;
    color: var(--muted);
    font-size: 13px;
    margin-bottom: 4px;
}

.nutrition-grid strong {
    font-size: 16px;
    color: var(--accent);
}
.search button{background:var(--accent);color:white;border:none;padding:0 14px;border-radius:10px;font-weight:700}
.side-card{background:var(--card);padding:18px;border-radius:12px;box-shadow:0 6px 18px rgba(16,24,40,0.06);border:1px solid rgba(0,0,0,0.04);color:var(--text-dark)}
.grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(240px,1fr));gap:16px;margin-top:22px}
.card{background:var(--card);border-radius:12px;overflow:hidden;box-shadow:0 10px 30px rgba(16,24,40,0.08);display:flex;flex-direction:column;border:1px solid rgba(0,0,0,0.04);color:var(--text-dark)}

/* Ensure headings inside card components are dark (they inherit white globally) */
.card h1,.card h2,.card h3,.card h4,.card h5,.card h6{
    color:var(--text-dark);
}
.thumb{height:150px;background-size:cover;background-position:center}
.card-body{padding:14px;display:flex;flex-direction:column;gap:8px;flex:1}
.meta{display:flex;justify-content:space-between;color:var(--muted);font-size:13px}
.tags{display:flex;gap:8px;flex-wrap:wrap}
.tag{background:#fff4f1;color:var(--accent);padding:6px 8px;border-radius:999px;font-size:13px;font-weight:600;cursor:pointer;user-select:none}

/* active tag chip state */
.tag.active{background:var(--accent);color:white}

/* Category button styling used on the categories page */
.cat{
    display:flex;
    align-items:center;
    justify-content:space-between;
    gap:12px;
    padding:12px 14px;
    margin:0; /* grid gap will handle spacing */
    background:var(--card);
    color:var(--text-dark);
    border-radius:10px;
    border:1px solid rgba(0,0,0,0.04);
    text-align:left;
    font-weight:700;
    text-decoration:none;
    cursor:pointer;
    transition: transform 200ms cubic-bezier(.2,.9,.2,1), box-shadow 200ms ease, background 160ms ease;
    align-self:stretch; /* ensure full column height */
}

.cat:hover, .cat:focus-visible{
    transform: translateY(-4px) scale(1.01);
    box-shadow: 0 16px 36px rgba(16,24,40,0.12);
}

.cat:focus-visible{ outline: none; box-shadow: 0 0 0 4px rgba(231,111,81,0.09), 0 16px 36px rgba(16,24,40,0.12); }

.cat span:first-child{ text-transform:capitalize; }

/* Category list grid: 3 columns on desktop, responsive down to 1 column on small screens */
.list#categoryList, #categoryList.list {
    display:grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap:12px;
    align-items:start;
}

@media (max-width:860px){
    .list#categoryList, #categoryList.list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width:500px){
    .list#categoryList, #categoryList.list { grid-template-columns: 1fr; }
}
footer{
    /* push footer to bottom of the page container */
    margin-top: auto;
    /* visual styling */
    color:var(--muted);
    font-size:13px;
    background:transparent; /* allow the background image to show through */
    /* increase min-height so the copy sits visually lower, and align content to bottom */
    min-height:120px;
    padding:20px 16px 22px;
    display:flex;
    align-items:flex-end; /* position footer content toward the bottom */
    justify-content:center; /* center horizontally */
    text-align:center;
}
.load-more{background:transparent;border:1px solid #eee;padding:10px 14px;border-radius:10px;cursor:pointer}

/* Standard site button used across pages */
.button{display:inline-block;background:var(--accent);color:white;padding:10px 14px;border-radius:10px;text-decoration:none;font-weight:700;border:none;cursor:pointer}
.button:hover{transform:translateY(-3px) scale(1.02);box-shadow:0 12px 30px rgba(16,24,40,0.12)}

/* Ensure primary interactive controls show pointer cursor for clarity */
.search button, #clearFilters, .load-more {
    cursor: pointer;
}

/* Interactive hover / focus polish for buttons and cards */
.search button, #clearFilters, .load-more, .tag {
    transition: transform 180ms cubic-bezier(.2,.9,.2,1), box-shadow 180ms ease, opacity 140ms ease;
    will-change: transform, box-shadow;
}

.search button:hover, #clearFilters:hover, .load-more:hover, .tag:hover,
.search button:focus-visible, #clearFilters:focus-visible, .load-more:focus-visible, .tag:focus-visible {
    transform: translateY(-3px) scale(1.03);
    box-shadow: 0 12px 30px rgba(16,24,40,0.12);
    opacity: 0.98;
}

/* Accessible focus styles */
.search button:focus-visible, #clearFilters:focus-visible, .load-more:focus-visible {
    outline: none;
    box-shadow: 0 0 0 4px rgba(231,111,81,0.12), 0 12px 30px rgba(16,24,40,0.12);
}

/* Recipe card hover/active states — scale without affecting layout, keep crisp shadow */
.card{
    transition: transform 200ms cubic-bezier(.2,.9,.2,1), box-shadow 200ms ease; 
    will-change: transform, box-shadow;
    transform-origin: center center;
}
.card:hover, .card:focus-within, .card:focus {
    transform: translateY(-6px) scale(1.02);
    box-shadow: 0 20px 40px rgba(16,24,40,0.18);
    z-index: 5; /* ensure hovered card appears above siblings */
}

/* Ensure cards are keyboard-focusable when they are anchors */
.card:focus { outline: none; }
.card:focus-visible { box-shadow: 0 0 0 4px rgba(231,111,81,0.09), 0 20px 40px rgba(16,24,40,0.18); }

/* Recipe page specifics */
.recipe-header { margin-bottom: 0; }
/* Prevent the recipe content from overlapping the header. Previously this used a large
    negative top margin to pull content up under a header image; since header thumbnails
    were removed, reset that behavior and add a modest top padding for separation. */
.recipe-content { margin-top: 0; }
.recipe-thumb{display:block;height:300px;background-size:cover;background-position:center;border-radius:12px;margin-bottom:1rem}
.content{margin-top:14px;line-height:1.6}
.servings-control {
    margin: 1rem 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.servings-control input {
    width: 3rem;
    text-align: center;
    padding: 0.25rem;
    border: 1px solid #ddd;
    border-radius: 4px;
}
.adjust-servings {
    background: var(--accent);
    color: white;
    border: none;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    padding: 0;
    line-height: 1;
}

/* Reusable utility classes to replace inline styles */
.brand-title{font-weight:800}
.brand-sub{font-size:13px;color:var(--muted)}
.brand-title{color:#ffffff;text-shadow:0 1px 2px rgba(0,0,0,0.45)}
.card-title{font-weight:700}
.page-title{margin-top:22px}
.small-muted{color:var(--muted);font-size:14px}
.back-link{display:inline-block;margin-bottom:12px;background:var(--accent);color:var(--text-dark);text-decoration:none;position:relative;z-index:3;pointer-events:auto;padding:8px 12px;border-radius:8px;border:none;font-weight:600;cursor:pointer;transition:transform 180ms cubic-bezier(.2,.9,.2,1), box-shadow 180ms ease}
.back-link:hover{transform:translateY(-2px);box-shadow:0 8px 20px rgba(16,24,40,0.12)}

@media (max-width:860px){
    .hero{grid-template-columns:1fr}
    /* Make filters compact on narrower screens */
    .filters-row{gap:8px}
    .filters-row label{font-size:12px}
    .filters-row input{min-width:160px}
    .side-card{order:2}
    .container{padding:0.5rem}
    h1{font-size:22px}
    /* Stack search controls vertically on narrow screens to avoid horizontal overflow */
    .search{flex-direction:column;align-items:stretch;gap:10px}
    .search input{width:100%}
    .search button{width:100%}
    /* Ensure form controls are sufficiently large on mobile to avoid browser auto-zoom */
    input, textarea, select, button { font-size: 16px; }
    /* override inline min-width on tag input when present */
    #tagFilter{min-width:0 !important;width:100% !important}
}

@media (max-width:500px){
    .container{padding:0.25rem}
    .card-body{padding:8px}
    .hero-card{padding:14px}
    .brand-title{font-size:18px}
    .brand-sub{font-size:11px}
}

/* Mobile footer adjustments: stack and center content for small viewports */
@media (max-width:860px){
    /* Use block layout on small screens to avoid anonymous flex items
       which can split inline text into multiple stacked lines. Center text
       and reduce padding so the footer remains compact. */
    footer{
        min-height:88px;
        padding:12px 10px;
        display:block;
        text-align:center;
    }
    footer span#year{ display:inline; margin-right:6px; }
}

/* Portfolio-specific layout: image + small caption box */
.portfolio-list{display:grid;grid-template-columns:repeat(auto-fill,minmax(220px,1fr));gap:14px;margin-top:12px}

/* Image-first portfolio cards: large photo with concise caption underneath */
.portfolio-item{display:block;text-decoration:none;color:inherit;border-radius:12px;overflow:hidden}
.portfolio-item:hover .portfolio-thumb{transform:scale(1.03)}
.portfolio-thumb{width:100%;height:180px;border-radius:12px;background-size:cover;background-position:center;display:block;transition:transform 200ms cubic-bezier(.2,.9,.2,1)}
.portfolio-caption{padding:10px 8px;background:var(--card);color:var(--text-dark);border-radius:0 0 12px 12px}
.portfolio-caption .card-title{font-weight:700;color:var(--text-dark);margin-bottom:4px}
.portfolio-caption .small-muted{color:var(--muted);font-size:13px}

@media (max-width:640px){
    .portfolio-thumb{height:160px}
    .portfolio-list{grid-template-columns:repeat(auto-fill,minmax(180px,1fr));gap:10px}
}
