/* =========================================================
   HowToCooks — main stylesheet
   Colours are set once here; change them to re-theme the site.
   ========================================================= */
:root {
    --bg:        #FFFBF5;
    --surface:   #FFFFFF;
    --tint:      #FBF1E4;
    --ink:       #2A211B;
    --ink-soft:  #6B5E54;
    --line:      #EFE3D3;
    --brand:     #D9542B;
    --brand-dark:#B8431F;
    --herb:      #4F7A45;
    --gold:      #F2B233;
    --radius:    16px;
    --shadow:    0 1px 2px rgba(42,33,27,.05), 0 8px 24px rgba(42,33,27,.07);
    --font-head: 'Fraunces', Georgia, serif;
    --font-body: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
    margin: 0; background: var(--bg); color: var(--ink);
    font: 16px/1.65 var(--font-body);
    -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; height: auto; display: block; }
a { color: var(--brand); text-decoration: none; }
a:hover { color: var(--brand-dark); }
h1, h2, h3, h4 { font-family: var(--font-head); line-height: 1.2; margin: 0 0 .5em; color: var(--ink); letter-spacing: -.01em; }
h1 { font-size: clamp(1.9rem, 4.5vw, 2.9rem); }
h2 { font-size: clamp(1.4rem, 3vw, 1.85rem); }
h3 { font-size: 1.2rem; }

.container { width: 100%; max-width: 1200px; margin: 0 auto; padding: 0 20px; }
.container.narrow { max-width: 780px; }
.muted { color: var(--ink-soft); font-size: .85rem; }
.accent { color: var(--brand); }

/* ---------- Buttons & chips ---------- */
.btn {
    display: inline-flex; align-items: center; gap: .4em; justify-content: center;
    background: var(--brand); color: #fff; border: 0; border-radius: 999px;
    padding: .7em 1.4em; font: 600 .95rem var(--font-body); cursor: pointer;
    transition: background .2s, transform .1s;
}
.btn:hover { background: var(--brand-dark); color: #fff; }
.btn:active { transform: scale(.97); }
.btn-ghost { background: transparent; color: var(--ink); border: 1.5px solid var(--line); }
.btn-ghost:hover { background: var(--tint); color: var(--ink); }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chips-center { justify-content: center; }
.chip {
    display: inline-block; padding: .4em 1em; border-radius: 999px;
    background: var(--surface); border: 1px solid var(--line); color: var(--ink);
    font-size: .88rem; font-weight: 500; transition: all .15s;
}
.chip:hover, .chip.active { background: var(--ink); border-color: var(--ink); color: #fff; }
.chip-sm { font-size: .78rem; padding: .3em .8em; }
.eyebrow {
    display: inline-block; font-size: .78rem; font-weight: 600; letter-spacing: .06em;
    text-transform: uppercase; color: var(--herb); margin-bottom: .6em;
}
.badge { background: var(--gold); color: var(--ink); font-size: .75rem; font-weight: 600; padding: .25em .7em; border-radius: 999px; }

/* ---------- Header ---------- */
.site-header {
    position: sticky; top: 0; z-index: 50;
    background: rgba(255,251,245,.92); backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--line);
}
.header-inner { display: flex; align-items: center; gap: 24px; height: 68px; }
.logo {
    display: flex; align-items: center; gap: 8px;
    font: 700 1.4rem var(--font-head); color: var(--ink); white-space: nowrap;
}
.logo:hover { color: var(--ink); }
.logo-mark { width: 36px; height: 36px; border-radius: 10px; }
.main-nav { display: flex; align-items: center; gap: 4px; margin-left: auto; }
.main-nav > a, .nav-more-btn {
    color: var(--ink); font-weight: 500; font-size: .92rem; padding: .5em .8em; border-radius: 8px;
    background: none; border: 0; cursor: pointer; font-family: inherit;
}
.main-nav > a:hover, .nav-more-btn:hover { background: var(--tint); }
.nav-more { position: relative; }
.nav-dropdown {
    display: none; position: absolute; right: 0; top: 100%; min-width: 200px;
    background: var(--surface); border: 1px solid var(--line); border-radius: 12px;
    box-shadow: var(--shadow); padding: 8px; flex-direction: column;
}
.nav-more:hover .nav-dropdown, .nav-more.open .nav-dropdown { display: flex; }
.nav-dropdown a { color: var(--ink); padding: .45em .8em; border-radius: 8px; font-size: .9rem; }
.nav-dropdown a:hover { background: var(--tint); }
.header-actions { display: flex; gap: 6px; }
.icon-btn {
    display: grid; place-items: center; width: 42px; height: 42px; border-radius: 50%;
    border: 0; background: transparent; color: var(--ink); cursor: pointer;
}
.icon-btn:hover { background: var(--tint); }
.menu-btn { display: none; }
.header-search { display: none; border-top: 1px solid var(--line); padding: 14px 0; background: var(--bg); }
.header-search.open { display: block; }
.header-search .container { display: flex; gap: 10px; }
.header-search input { flex: 1; }

input[type=search], input[type=text] {
    font: inherit; padding: .75em 1.1em; border-radius: 999px;
    border: 1.5px solid var(--line); background: var(--surface); color: var(--ink); outline: none;
}
input[type=search]:focus { border-color: var(--brand); }

/* ---------- Hero ---------- */
.hero { padding: 56px 0 64px; background: radial-gradient(ellipse at top right, #FCE7D2 0, transparent 60%); }
.hero-grid { display: grid; grid-template-columns: 1.1fr 1fr; gap: 56px; align-items: center; }
.hero h1 { font-size: clamp(2.3rem, 5.5vw, 3.8rem); margin-bottom: .35em; }
.hero h1 em { font-style: italic; color: var(--brand); }
.hero-text > p { font-size: 1.1rem; color: var(--ink-soft); max-width: 34em; margin: 0 0 1.6em; }
.hero-search {
    display: flex; gap: 8px; background: var(--surface); padding: 6px;
    border-radius: 999px; box-shadow: var(--shadow); max-width: 520px; margin-bottom: 20px;
}
.hero-search input { flex: 1; border: 0; min-width: 0; }
.hero-search-sm { margin: 20px auto 0; box-shadow: none; border: 1.5px solid var(--line); }
.list-hero .hero-search-sm { margin-left: 0; }
.hero-feature {
    position: relative; display: block; border-radius: 28px; overflow: hidden;
    aspect-ratio: 4/3.4; box-shadow: 0 30px 60px -20px rgba(42,33,27,.35); transform: rotate(1.2deg);
    transition: transform .3s;
}
.hero-feature:hover { transform: rotate(0); }
.hero-feature img { width: 100%; height: 100%; object-fit: cover; }
.hero-feature-info {
    position: absolute; left: 0; right: 0; bottom: 0; padding: 60px 24px 22px;
    background: linear-gradient(transparent, rgba(20,14,10,.85)); color: #fff;
}
.hero-feature-info h2 { color: #fff; margin: .4em 0 .25em; font-size: 1.45rem; }
.hero-feature-info > span:last-child { font-size: .9rem; opacity: .9; }

/* ---------- Sections & grids ---------- */
.section { padding: 56px 0; }
.section-top-sm { padding-top: 24px; }
.section-tint { background: var(--tint); }
.section-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 22px; gap: 12px; }
.section-head h2 { margin: 0; }
.link-arrow { font-weight: 600; white-space: nowrap; }
.grid { display: grid; gap: 24px; }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 48px; }

/* ---------- Recipe card ---------- */
.card {
    background: var(--surface); border-radius: var(--radius); overflow: hidden;
    box-shadow: var(--shadow); display: flex; flex-direction: column;
    transition: transform .2s, box-shadow .2s;
}
.card:hover { transform: translateY(-4px); box-shadow: 0 2px 4px rgba(42,33,27,.05), 0 16px 36px rgba(42,33,27,.12); }
.card-img { position: relative; display: block; aspect-ratio: 4/3; overflow: hidden; background: var(--tint); }
.card-img img { width: 100%; height: 100%; object-fit: cover; transition: transform .4s; }
.card:hover .card-img img { transform: scale(1.05); }
.card-tag {
    position: absolute; top: 12px; left: 12px; background: rgba(255,255,255,.94);
    color: var(--ink); font-size: .72rem; font-weight: 600; padding: .3em .75em; border-radius: 999px;
}
.card-body { padding: 16px 18px 18px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.card-body h3 { font-size: 1.05rem; margin: 0; line-height: 1.35; }
.card-body h3 a { color: var(--ink); }
.card-body h3 a:hover { color: var(--brand); }
.card-meta { display: flex; flex-wrap: wrap; gap: 12px; font-size: .8rem; color: var(--ink-soft); margin-top: auto; }
.card-small .card-body { padding: 12px 14px 14px; }
.card-small .card-body h3 { font-size: .95rem; }

/* ---------- Category tiles ---------- */
.cat-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 16px; }
.cat-tile {
    position: relative; display: flex; flex-direction: column; justify-content: flex-end;
    aspect-ratio: 1; border-radius: var(--radius); overflow: hidden; padding: 14px; color: #fff;
}
.cat-tile img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; transition: transform .4s; }
.cat-tile::after { content: ''; position: absolute; inset: 0; background: linear-gradient(transparent 35%, rgba(20,14,10,.8)); }
.cat-tile:hover img { transform: scale(1.08); }
.cat-name, .cat-count { position: relative; z-index: 1; }
.cat-name { font: 600 1.05rem var(--font-head); color: #fff; }
.cat-count { font-size: .75rem; opacity: .85; color: #fff; }

/* ---------- Ranked list ---------- */
.rank-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 14px; }
.rank-list a {
    display: flex; align-items: center; gap: 14px; color: var(--ink);
    background: var(--surface); padding: 10px; border-radius: 14px; box-shadow: var(--shadow);
}
.rank-list a:hover strong { color: var(--brand); }
.rank { font: 700 1.6rem var(--font-head); color: var(--brand); width: 28px; text-align: center; flex-shrink: 0; }
.rank-list img { width: 72px; height: 72px; border-radius: 10px; object-fit: cover; flex-shrink: 0; }
.rank-text { display: flex; flex-direction: column; min-width: 0; }
.rank-text strong { font-weight: 600; font-size: .95rem; line-height: 1.35; }
.rank-text small { color: var(--ink-soft); font-size: .8rem; }
.rank-list-sm a { box-shadow: none; padding: 6px; background: transparent; }
.rank-list-sm img { width: 60px; height: 60px; }
.rank-list-sm strong { font-size: .88rem; }

/* ---------- List pages ---------- */
.list-hero { padding: 28px 0 8px; }
.list-hero h1 { margin-bottom: .2em; }
.list-hero p { color: var(--ink-soft); margin: 0; }
.filter-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 18px; }
.filter-sep { width: 1px; height: 22px; background: var(--line); margin: 0 6px; }
.breadcrumb { font-size: .85rem; color: var(--ink-soft); padding: 18px 0 0; }
.breadcrumb a { color: var(--ink-soft); }
.breadcrumb a:hover { color: var(--brand); }
.pagination { display: flex; justify-content: center; flex-wrap: wrap; gap: 6px; margin-top: 40px; }
.pagination a, .pagination span {
    min-width: 42px; height: 42px; display: grid; place-items: center; padding: 0 14px;
    border-radius: 999px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); font-weight: 500;
}
.pagination a:hover { border-color: var(--ink); }
.pagination .current { background: var(--ink); color: #fff; border-color: var(--ink); }
.pagination .dots { border: 0; background: none; }
.empty { text-align: center; padding: 40px 0; max-width: 560px; margin: 0 auto; }
.empty-icon { font-size: 3.5rem; margin: 0; }
.empty .hero-search-sm { margin-bottom: 30px; }

/* ---------- Single post ---------- */
.post-layout { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 56px; padding-top: 16px; padding-bottom: 60px; }
.post-header { margin: 12px 0 24px; }
.post-cats { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 14px; }
.post-meta { display: flex; flex-wrap: wrap; gap: 18px; color: var(--ink-soft); font-size: .9rem; }
.post-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 20px; }
.post-hero { margin: 0 0 32px; border-radius: 22px; overflow: hidden; background: var(--tint); }
.post-hero img { width: 100%; max-height: 560px; object-fit: cover; }

.post-content { font-size: 1.06rem; line-height: 1.8; }
.post-content > * { margin: 0 0 1.2em; }
.post-content h2 { margin-top: 1.8em; font-size: 1.65rem; }
.post-content h3 { margin-top: 1.5em; font-size: 1.3rem; }
.post-content h4 { margin-top: 1.2em; font-size: 1.08rem; font-family: var(--font-body); font-weight: 600; }
.post-content h2 strong, .post-content h3 strong, .post-content h4 strong { font-weight: inherit; }
.post-content img { border-radius: 14px; margin: 0 auto; }
.post-content figure { margin: 1.6em 0; }
.post-content figcaption { text-align: center; color: var(--ink-soft); font-size: .85rem; margin-top: .5em; }
.post-content ul, .post-content ol { padding-left: 1.4em; }
.post-content li { margin-bottom: .45em; }
.post-content li::marker { color: var(--brand); }
.post-content a { text-decoration: underline; text-decoration-color: rgba(217,84,43,.35); text-underline-offset: 3px; }
.post-content blockquote { border-left: 4px solid var(--gold); background: var(--tint); margin: 1.5em 0; padding: 1em 1.4em; border-radius: 0 12px 12px 0; }
.post-content table { width: 100%; border-collapse: collapse; font-size: .95rem; display: block; overflow-x: auto; }
.post-content th, .post-content td { border: 1px solid var(--line); padding: .6em .8em; text-align: left; }
.post-content th { background: var(--tint); }
.post-content iframe { max-width: 100%; border-radius: 12px; }
.static-content { padding-bottom: 60px; }

/* ---------- Recipe card (the box) ---------- */
.recipe-card {
    background: var(--surface); border: 2px solid var(--line); border-radius: 24px;
    padding: 32px; margin: 48px 0; scroll-margin-top: 90px;
}
.recipe-card-head { display: flex; gap: 22px; align-items: center; margin-bottom: 24px; }
.recipe-card-head h2 { margin-bottom: .3em; }
.recipe-card-head p { color: var(--ink-soft); margin: 0; font-size: .95rem; }
.recipe-card-thumb { width: 130px; height: 130px; border-radius: 50%; object-fit: cover; flex-shrink: 0; border: 5px solid var(--tint); }
.recipe-stats {
    display: flex; flex-wrap: wrap; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line);
    padding: 16px 0; margin-bottom: 28px;
}
.recipe-stats > div { flex: 1; min-width: 90px; text-align: center; padding: 4px 8px; }
.recipe-stats > div + div { border-left: 1px solid var(--line); }
.recipe-stats small { display: block; color: var(--ink-soft); font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; font-weight: 600; }
.recipe-stats strong { font-size: 1rem; }
.recipe-body { display: grid; grid-template-columns: 1fr; gap: 32px; }
.recipe-body:has(.recipe-steps) { grid-template-columns: minmax(0, 1fr) minmax(0, 1.3fr); }
.recipe-ingredients h4 { font-family: var(--font-body); font-size: .85rem; text-transform: uppercase; letter-spacing: .06em; color: var(--herb); margin: 18px 0 8px; }
.ing-list { list-style: none; margin: 0; padding: 0; }
.ing-list li { border-bottom: 1px dashed var(--line); }
.ing-list label { display: flex; gap: 12px; padding: 10px 0; cursor: pointer; align-items: flex-start; }
.ing-list input { accent-color: var(--herb); width: 18px; height: 18px; margin-top: 4px; flex-shrink: 0; }
.ing-list input:checked + span { text-decoration: line-through; color: var(--ink-soft); }
.ing-qty { color: var(--brand); font-weight: 600; }
.ing-note { color: var(--ink-soft); font-style: normal; }
.step-list { list-style: none; padding: 0; margin: 0; counter-reset: step; }
.step-list li { position: relative; padding: 0 0 22px 52px; counter-increment: step; }
.step-list li::before {
    content: counter(step); position: absolute; left: 0; top: 0; width: 34px; height: 34px;
    display: grid; place-items: center; background: var(--brand); color: #fff; border-radius: 50%;
    font-weight: 700; font-size: .9rem;
}
.step-list p { margin: 4px 0 0; }
.step-list img { border-radius: 12px; margin-top: 10px; }
.nutrition-box { margin-top: 28px; background: var(--tint); border-radius: 16px; padding: 20px 22px; }
.nutrition-box h3 small { font-family: var(--font-body); font-size: .8rem; color: var(--ink-soft); font-weight: 400; }
.nutri-grid { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 8px; }
.nutri-grid > div { background: var(--surface); border-radius: 12px; padding: 10px 16px; text-align: center; min-width: 84px; }
.nutri-grid strong { display: block; font-size: 1.15rem; }
.nutri-grid small { color: var(--ink-soft); font-size: .75rem; }
.related { margin-top: 56px; }

/* ---------- Sidebar ---------- */
.sidebar { display: flex; flex-direction: column; gap: 28px; }
.widget { background: var(--surface); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); }
.widget h3 { font-size: 1.1rem; margin-bottom: 14px; }
.widget-search { display: flex; gap: 8px; }
.widget-search input { flex: 1; min-width: 0; }
.widget-search .btn { padding: .6em 1em; }
@media (min-width: 1001px) { .sidebar > .widget:nth-child(2) { position: sticky; top: 90px; } }

/* ---------- Footer ---------- */
.site-footer { background: #2A211B; color: #D8CCC0; padding: 56px 0 0; margin-top: 40px; }
.footer-grid { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 40px; }
.logo-light { color: #fff; }
.logo-light:hover { color: #fff; }
.footer-about { max-width: 360px; font-size: .92rem; }
.site-footer h4 { color: #fff; font-family: var(--font-body); font-size: .8rem; text-transform: uppercase; letter-spacing: .08em; }
.site-footer ul { list-style: none; padding: 0; margin: 0; }
.site-footer li { margin-bottom: .5em; }
.site-footer a { color: #D8CCC0; font-size: .92rem; }
.site-footer a:hover { color: #fff; }
.footer-bottom { border-top: 1px solid rgba(255,255,255,.1); margin-top: 40px; padding: 20px; font-size: .82rem; text-align: center; }

/* ---------- Responsive ---------- */
@media (max-width: 1100px) {
    .main-nav > a:nth-child(n+6) { display: none; }
    .cat-grid { grid-template-columns: repeat(4, 1fr); }
}
@media (max-width: 1000px) {
    .grid-4 { grid-template-columns: repeat(3, 1fr); }
    .post-layout { grid-template-columns: 1fr; gap: 20px; }
    .two-col { grid-template-columns: 1fr; }
}
@media (max-width: 860px) {
    .menu-btn { display: grid; }
    .header-actions { margin-left: auto; }
    .main-nav {
        display: none; position: absolute; top: 68px; left: 0; right: 0; background: var(--bg);
        flex-direction: column; align-items: stretch; padding: 12px 20px 20px;
        border-bottom: 1px solid var(--line); box-shadow: var(--shadow); max-height: calc(100vh - 68px); overflow-y: auto;
    }
    .main-nav.open { display: flex; }
    .main-nav > a, .main-nav > a:nth-child(n+6) { display: block; padding: .8em .6em; border-bottom: 1px solid var(--line); border-radius: 0; }
    .nav-more-btn { display: none; }
    .nav-dropdown { display: flex; position: static; box-shadow: none; border: 0; padding: 0; background: none; }
    .nav-dropdown a { padding: .8em .6em; border-bottom: 1px solid var(--line); border-radius: 0; font-size: .92rem; }
    .hero { padding: 32px 0 40px; }
    .hero-grid { grid-template-columns: 1fr; gap: 32px; }
    .hero-feature { transform: none; aspect-ratio: 4/3; }
    .grid-4 { grid-template-columns: repeat(2, 1fr); gap: 16px; }
    .cat-grid { grid-template-columns: repeat(3, 1fr); gap: 12px; }
    .footer-grid { grid-template-columns: 1fr 1fr; }
    .footer-grid > div:first-child { grid-column: 1 / -1; }
    .recipe-card { padding: 22px 18px; margin: 36px 0; }
    .recipe-body:has(.recipe-steps) { grid-template-columns: 1fr; }
    .recipe-card-thumb { width: 84px; height: 84px; }
}
@media (max-width: 520px) {
    .container { padding: 0 16px; }
    .section { padding: 40px 0; }
    .grid-4, .grid-2 { grid-template-columns: 1fr 1fr; gap: 12px; }
    .card-body { padding: 12px; }
    .card-body h3 { font-size: .92rem; }
    .card-tag { font-size: .65rem; top: 8px; left: 8px; }
    .card-meta { gap: 8px; font-size: .74rem; }
    .cat-grid { grid-template-columns: repeat(2, 1fr); }
    .recipe-card-head { flex-direction: column; text-align: center; }
    .recipe-stats > div { min-width: 33%; }
    .recipe-stats > div:nth-child(4) { border-left: 0; }
    .rank-list img { width: 60px; height: 60px; }
    .post-content { font-size: 1rem; }
    .logo { font-size: 1.25rem; }
}

/* ---------- Print: only the recipe card ---------- */
@media print {
    body.print-recipe .site-header, body.print-recipe .site-footer, body.print-recipe .sidebar,
    body.print-recipe .breadcrumb, body.print-recipe .post-header, body.print-recipe .post-hero,
    body.print-recipe .post-content, body.print-recipe .related { display: none !important; }
    body { background: #fff; }
    .post-layout { display: block; padding: 0; }
    .recipe-card { border: 0; margin: 0; padding: 0; }
    .ing-list input { display: none; }
}
