@import url('https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;600;700&family=Playfair+Display:ital,wght@0,600;0,700;1,600&display=swap');

:root {
    --bg: #f8f5ed;
    --surface: #fffdf8;
    --surface-strong: #fffdf8;
    --text: #232e26;
    --muted: #535e51;
    --primary: #31513b;
    --primary-strong: #203b2a;
    --secondary: #e7eddf;
    --accent: #ad5438;
    --shadow: 0 12px 28px rgba(43, 49, 35, .08);
}
body { background: var(--bg); color: var(--text); font-family: "DM Sans", system-ui, sans-serif; }
h1, h2, h3 { font-family: "Playfair Display", Georgia, serif; }
a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible {
    outline: 2px solid #a2482f; outline-offset: 3px;
}
.cookbook-sr { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.site-header.glass { background: #fffdf8; border-bottom: 1px solid #deded1; box-shadow: none; }
.site-header .brand-icon, .btn.btn-primary { background: var(--primary); color: #fffdf8; box-shadow: none; }
.btn.btn-primary:hover, .btn.btn-primary:focus-visible { background: var(--primary-strong); color: #fffdf8; }
.site-header .main-nav a { color: var(--text); white-space: nowrap; }
.site-header .main-nav a:hover { background: #e7eddf; }
.site-footer { background: #eaece1; border-top: 1px solid #d8dfd3; }
.recipe-card { background: var(--surface); border: 1px solid #deded1; border-radius: 16px; box-shadow: none; }
.recipe-card:hover { box-shadow: var(--shadow); }
.recipe-card .image-wrap { background: #ebece1; }
.recipe-card .badge { background: #e9eee1; color: #31513b; }
.cookbook-hero { display: grid; grid-template-columns: 1fr 1.06fr; gap: clamp(24px, 6vw, 85px); align-items: center; padding-block: clamp(28px, 6vw, 76px) 28px; }
.cookbook-intro { min-width: 0; }
.cookbook-intro h1 { margin: 0 0 20px; font-size: clamp(3rem, 7.2vw, 6.55rem); line-height: .99; letter-spacing: -.065em; }
.cookbook-intro h1 em { color: #a2482f; font-weight: 600; }
.cookbook-intro p { margin: 0 0 24px; font-size: clamp(1rem, 2vw, 1.2rem); color: var(--muted); max-width: 39ch; }
.cookbook-search { display: flex; gap: 7px; padding: 6px; border: 1px solid #c9cebf; border-radius: 14px; background: var(--surface); }
.cookbook-search input { flex: 1; min-width: 0; width: auto; margin: 0; background: transparent; border: 0; box-shadow: none; padding-inline: 10px; font: inherit; }
.cookbook-search .btn { white-space: nowrap; padding-inline: 13px; }
.cookbook-plan { display: inline-flex; align-items: center; gap: 9px; margin-top: 18px; color: var(--primary); font-weight: 700; text-underline-offset: 4px; }
.cookbook-plan:hover { text-decoration: underline; }
.cookbook-photo { margin: 0; aspect-ratio: 1.12; background: #d6d9c7; border-radius: 22px; overflow: hidden; }
.cookbook-photo img { width: 100%; height: 100%; display: block; object-fit: cover; }
.cookbook-categories { display: flex; flex-wrap: wrap; gap: 8px; padding-block: 0 16px; }
.cookbook-categories a { border: 1px solid #d0d6c9; background: var(--surface); color: var(--primary); border-radius: 24px; padding: 7px 13px; font-weight: 600; }
.cookbook-categories a:hover { background: #e7eddf; }
.cookbook-categories .category-all { background: #e7eddf; }
.cookbook-recipes .section-head h2, .cookbook-news .section-head h2 { font-size: clamp(1.8rem, 4vw, 2.8rem); margin: 0; }
.cookbook-recipes .section-head a { color: var(--primary); font-weight: 700; }
@media (max-width: 760px) {
    .site-header .main-nav { width: 100%; flex-wrap: nowrap; overflow-x: auto; }
    .cookbook-hero { grid-template-columns: 1fr; gap: 23px; }
    .cookbook-intro h1 br { display: none; }
    .cookbook-intro h1 { letter-spacing: -.045em; }
    .cookbook-photo { aspect-ratio: 1.55; border-radius: 16px; }
}

/* Shared pages and navigation */
.skip-link { position: fixed; top: 8px; left: 8px; z-index: 1000; background: var(--surface); padding: 10px 15px; transform: translateY(-150%); }
.skip-link:focus { transform: none; }
body::before, .brand-icon::after, .card::before, .recipe-card::before,
.news-card::before, .auth-card::before, .promo-panel::before, .recipe-main-media::after { display: none; }
.site-header .brand strong { font-family: "Playfair Display", Georgia, serif; font-size: 1.28rem; }
.site-header .brand-icon { border-radius: 12px; }
.site-header .nav-wrap { gap: 12px; padding-block: 12px; }
.site-header .main-nav { gap: 4px; }
.site-header .main-nav a { border-radius: 8px; }
.site-header .main-nav a i { color: var(--primary); }
.section .section-head { border-bottom: 1px solid #d9ded0; padding-bottom: 12px; gap: 12px; flex-wrap: wrap; }
.section.alt, .weekly-planner-page { background: #eff0e7; }
.section-head h1 i, .editor-block h2 i { color: var(--primary); }
.card, .auth-card, .news-card, .promo-panel, .editor-block, .comment-item,
.recipe-detail.heroish, .planner-hero, .planner-day-card, .kpi-card,
.admin-link, .split-card, .admin-mini-item {
    border: 1px solid #d9ded0;
    border-radius: 14px;
    background: var(--surface);
    box-shadow: none;
}
.auth-card { max-width: 640px; margin-inline: auto; }
.highlight, .promo-panel { background: #ebeede; }
.badge, .badge.accent { background: #e7eddf; color: var(--primary-strong); }
.badge.warning { background: #faf0d7; color: #6a4718; }
.badge.success, .status-pill.ok { background: #e7eddf; color: #294934; }
.btn.btn-secondary, .btn.btn-outline, .btn.btn-ghost { background: #edf0e7; color: var(--primary-strong); border-color: #d1d9ca; }
.btn.btn-secondary:hover, .btn.btn-outline:hover, .btn.btn-ghost:hover { background: #dde6d8; }
input:not([type="radio"]):not([type="checkbox"]), select, textarea,
.recipe-editor-form input, .recipe-editor-form select, .recipe-editor-form textarea {
    background-color: #fffdf8;
    border-color: #c9d2c5;
    color: var(--text);
}
input[type="radio"], input[type="checkbox"] { accent-color: var(--primary); }
input::placeholder, textarea::placeholder { color: #606a5e; }
.cookbook-search input[type="search"] { border: 0; background: transparent; }
.ingredient-suggestions { background: var(--surface); border-color: #c9d2c5; }
.ingredient-suggestion-item:hover, .ingredient-suggestion-item:focus { background: #e7eddf; }
.ingredient-suggestion-item::before { color: var(--primary); }
.recipe-thumb:hover, .recipe-thumb.active { border-color: var(--primary); }
.ingredient-list li, .step-list li, .serving-control { background: #f0f2e8; border-color: #d9ded0; color: var(--text); }
.ingredient-amount { color: var(--primary-strong); }
.planner-week-nav strong, .planner-day-head, .planner-slot-card, .planner-slot-card.has-recipe,
.planner-empty-preview { background: #ecf0e7; color: var(--text); border-color: #d5ddce; }
.planner-slot-title, .planner-day-head span, .planner-day-head strong { color: var(--primary-strong); }
.planner-slot-card.has-recipe { background: #fffdf8; }
.admin-toolbar { background: var(--surface); border-color: #d9ded0; padding: 8px; border-radius: 12px; }
.admin-toolbar a, .admin-link i { color: var(--primary-strong); }
.admin-toolbar a.active, .admin-toolbar a.active[href="chat.php"] { background: var(--primary); color: white; }
.table-wrap { overflow-x: auto; }
.table-wrap th { background: #e8eee3; color: var(--primary-strong); }
.table-wrap td { border-color: #d9ded0; }
.admin-chat-message { background: #edf0e7; border-color: #d9ded0; }

/* Footer */
.site-footer { margin-top: 32px; padding: clamp(26px,5vw,52px) 0 16px; color: #314438; }
.site-footer .footer-grid { display: grid; grid-template-columns: 1.6fr 1fr 1fr; gap: clamp(18px,5vw,64px); }
.site-footer h4 { margin: 0 0 10px; font-size: 1rem; }
.site-footer a { color: var(--primary-strong); text-underline-offset: 4px; }
.site-footer a:hover { text-decoration: underline; }
.footer-brand > a { font: 700 1.55rem "Playfair Display", Georgia, serif; }
.footer-brand p { max-width: 36ch; }
.site-footer .footer-bottom { margin-top: 24px; padding-top: 13px; border-top: 1px solid #cdd7c9; }

/* Community, private messages, events and consent */
.chat-bubble, .event-slide-toggle { background: var(--primary); color: #fffdf8; border: 1px solid #536951; box-shadow: var(--shadow); }
.chat-bubble { font-size: 1.2rem; }
.chat-bubble span:not(:empty) { background: #a2482f; color: #fff; }
.chat-window, .private-chat-window { background: var(--surface); border: 1px solid #bbcbbb; border-radius: 15px; box-shadow: 0 16px 45px rgba(35,46,38,.22); }
.chat-header, .event-slide-head { background: var(--primary); color: #fffdf8; justify-content: space-between; }
.chat-header .icon-btn, .event-slide-head .icon-btn { background: #466951; color: #fff; border: 1px solid #77917d; }
.chat-header .icon-btn:hover, .event-slide-head .icon-btn:hover { background: var(--primary-strong); }
.chat-messages { background: #f8f5ed; }
.msg.self { background: #dce9da; color: #203b2a; }
.msg.other { background: #fffdf8; color: var(--text); border: 1px solid #dddcd0; }
.msg small { color: #535e51; }
.chat-form { border-top: 1px solid #d9ded0; background: var(--surface); }
.chat-form input { flex: 1; min-width: 0; }
.chat-form button { background: var(--primary); color: white; border: 0; border-radius: 10px; padding: 10px 14px; }
.event-slide-toggle { position: fixed; left: 14px; bottom: 16px; z-index: 40; padding: 10px 14px; border-radius: 12px; }
.event-slide-panel { position: fixed; bottom: 64px; left: 14px; width: min(390px, calc(100vw - 28px)); z-index: 45; border: 1px solid #bbcbbb; border-radius: 15px; overflow: hidden; background: var(--surface); box-shadow: var(--shadow); }
.event-slide-panel[aria-hidden="true"] { display: none; }
.event-slide-head { display: flex; align-items: center; padding: 12px 15px; gap: 10px; }
.event-slide-head small { display: block; }
.event-slide-content { padding: 12px; max-height: 55vh; overflow-y: auto; }
.event-slide-event + .event-slide-event { margin-top: 16px; border-top: 1px solid #d9ded0; padding-top: 12px; }
.event-slide-recipe { display: grid; grid-template-columns: 58px 1fr; gap: 8px; margin-top: 8px; }
.event-slide-img img { width: 58px; height: 46px; object-fit: cover; border-radius: 6px; }
.event-slide-recipe-body small { display: block; }
.event-stars button { background: transparent; border: 0; color: #88532e; cursor: pointer; }
.cookie-banner { background: #fffdf8; border-color: #cbd5c6; }
.cookie-banner__icon { background: #e7eddf; color: var(--primary); }
.cookie-banner__text a { color: var(--primary-strong); }
@media (max-width: 760px) {
    .site-header .main-nav { flex-wrap: wrap; overflow: visible; }
    .site-header .main-nav a { padding: 6px 8px; }
    .site-header .brand strong { font-size: 1rem; }
    .site-header .brand small { display: none; }
    .site-header .nav-actions { flex-wrap: wrap; }
    .site-footer .footer-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .footer-brand { grid-column: 1 / -1; }
    .chat-window, .private-chat-window { max-width: calc(100vw - 24px); }
    .chat-messages { max-height: 42vh; }
}
@media (prefers-reduced-motion: reduce) {
    .reveal { animation: none; opacity: 1; transform: none; }
}

.chat-window:not(.hidden), .private-chat-window { display: flex; flex-direction: column; }
.chat-window, .private-chat-window { height: min(460px, calc(100dvh - 115px)); }
.chat-header, .chat-form { flex-shrink: 0; }
.chat-header { min-height: 60px; padding-block: 9px; }
.chat-messages { flex: 1; min-height: 0; height: auto; align-content: start; }
.chat-window.minimized .chat-messages, .private-chat-window.minimized .chat-messages,
.chat-window.minimized .chat-form, .private-chat-window.minimized .chat-form { display: none; }
.chat-bubble span:empty, .chat-bubble span[hidden] { display: none; }
@media (max-width: 760px) {
    .private-chats { inset: auto 12px 90px; z-index: 61; max-height: calc(100dvh - 105px); overflow: auto; }
    .private-chat-window { flex-shrink: 0; }
    .chat-window { bottom: 90px; }
    .chat-bubble { right: 12px; bottom: 14px; width: 54px; height: 54px; }
}

.recipe-editor-card h1 i, .recipe-editor-form label > i { color: var(--primary); }
.recipe-editor-form label > i { margin-inline-end: .35em; }
.editor-preview:not([hidden]) { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.editor-preview img { width: 76px; height: 62px; border-radius: 8px; object-fit: cover; }
.repeat-row.ingredient-row { display: grid; grid-template-columns: minmax(60px, 1fr) minmax(0, 3fr) auto; gap: 8px; align-items: start; }
.repeat-row.editor-step { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 8px; align-items: start; }
#stepsWrapper { counter-reset: cookbook-step; }
.step-number {
    counter-increment: cookbook-step;
    display: grid; place-items: center; width: 2em; height: 2em; margin-top: 4px;
    border-radius: 50%; background: #e7eddf; color: var(--primary); font-weight: 700;
}
.step-number::before { content: counter(cookbook-step); }
.recipe-editor-form .editor-remove { padding: 9px; min-width: 36px; }
.chat-window .chat-form, .private-chat-window .chat-form { position: relative; gap: 6px; }
.chat-form .chat-smilies > button { background: #e7eddf; color: var(--primary); padding: 8px 10px; }
.chat-smilies-list:not([hidden]) {
    display: grid; grid-template-columns: repeat(6, 1fr); gap: 3px;
    position: absolute; z-index: 2; inset: auto 8px calc(100% + 5px);
    background: var(--surface); border: 1px solid #bbcbbb; border-radius: 12px; padding: 7px;
    box-shadow: var(--shadow);
}
.chat-form .chat-smilies-list button { background: transparent; color: var(--text); padding: 5px 2px; }
.chat-form .chat-smilies-list button:hover, .chat-form .chat-smilies-list button:focus-visible { background: #e7eddf; }

/* Recipe composition */
.cookbook-editor { max-width: 1100px; }
.cookbook-editor-heading {
    display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between;
    gap: 8px 20px; margin-bottom: 20px;
}
.cookbook-editor-heading h1 { margin: 0; font-size: clamp(1.85rem, 5vw, 3rem); }
.cookbook-editor-heading h1 i { color: var(--primary); font-size: .65em; }
.cookbook-editor-heading a { color: var(--primary); text-decoration: underline; text-underline-offset: 4px; }
.cookbook-editor .recipe-editor-form { display: grid; gap: 16px; }
.cookbook-editor-cover, .cookbook-editor-method { display: grid; gap: 16px; align-items: start; }
.cookbook-editor-cover { grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr); align-items: stretch; }
.cookbook-editor-method { grid-template-columns: minmax(0, 1fr) minmax(0, 1.35fr); }
.cookbook-editor .editor-block { min-width: 0; margin: 0; padding: clamp(14px, 2.4vw, 24px); }
.cookbook-editor .editor-block h2 { margin: 0 0 12px; }
.cookbook-editor .recipe-editor-form label { display: block; min-width: 0; }
.cookbook-editor .recipe-editor-form label + label { margin-top: 12px; }
.cookbook-editor .recipe-editor-form label > :is(input, select, textarea) { display: block; width: 100%; margin-top: 5px; }
.cookbook-editor-intro textarea { min-height: 9rem; resize: vertical; }
.cookbook-editor .cookbook-editor-photo { background: #edf0e7; }
.editor-current-photo { display: block; width: 100%; max-height: 168px; object-fit: cover; border-radius: 10px; margin-bottom: 12px; }
.cookbook-editor-fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 140px), 1fr)); gap: 12px; }
.cookbook-editor .cookbook-editor-fields label + label { margin-top: 0; }
.cookbook-editor .editor-step textarea { min-width: 0; width: 100%; }
.cookbook-editor .cookbook-editor-save { margin: 0; padding: 14px 0 0; border-top: 1px solid #d5ddce; }
@media (max-width: 760px) {
    .cookbook-editor-cover, .cookbook-editor-method { grid-template-columns: minmax(0, 1fr); }
    .cookbook-editor .cookbook-editor-save .btn { width: 100%; justify-content: center; }
}

.site-header .brand-icon.brand-logo {
    width: 48px;
    height: 48px;
    flex: 0 0 48px;
    background: #eeeede;
}
.brand-logo img { display: block; width: 44px; height: 44px; object-fit: contain; }
