:root {
  --ink: #26221f;
  --muted: #756c65;
  --paper: #fffdf9;
  --soft: #f6f1e8;
  --line: #e7ded2;
  --accent: #b53222;
  --accent-dark: #8e2619;
  --gold: #e5ad39;
  --shadow: 0 18px 50px rgba(66, 45, 29, .12);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  color: var(--ink);
  background: var(--paper);
  font-family: "DM Sans", system-ui, sans-serif;
  font-size: 17px;
  line-height: 1.6;
}
button, input { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
a { color: inherit; }

.topbar {
  position: sticky;
  z-index: 10;
  top: 0;
  height: 74px;
  padding: 0 max(24px, calc((100vw - 1180px) / 2));
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(255, 253, 249, .92);
  border-bottom: 1px solid rgba(231, 222, 210, .8);
  backdrop-filter: blur(14px);
}
.brand { display: flex; align-items: center; gap: 11px; font-weight: 700; text-decoration: none; }
.brand-mark { width: 38px; height: 38px; display: grid; place-items: center; border-radius: 12px; color: white; background: var(--accent); font-family: "Fraunces", serif; font-size: 23px; }
.top-actions { display: flex; gap: 10px; }
.icon-button, .list-button { border: 1px solid var(--line); background: white; color: var(--ink); cursor: pointer; }
.icon-button { width: 44px; height: 44px; border-radius: 50%; font-size: 28px; line-height: 1; }
.list-button { height: 44px; padding: 0 12px; border-radius: 22px; display: flex; align-items: center; gap: 8px; font-weight: 600; }
.count { min-width: 24px; height: 24px; padding: 0 6px; display: grid; place-items: center; color: white; background: var(--accent); border-radius: 12px; font-size: 13px; }

main { max-width: 1180px; margin: 0 auto; padding: 30px 24px 80px; }
.breadcrumb { display: flex; gap: 10px; align-items: center; margin-bottom: 26px; color: var(--muted); font-size: 14px; }
.breadcrumb a { text-underline-offset: 3px; }
.recipe { display: grid; grid-template-columns: minmax(0, .9fr) minmax(400px, 1.1fr); gap: 38px 64px; align-items: start; }
.hero-copy { align-self: center; padding: 22px 0; }
.eyebrow, .kicker { margin: 0 0 10px; color: var(--accent); font-weight: 700; letter-spacing: .09em; text-transform: uppercase; font-size: 13px; }
h1, h2 { font-family: "Fraunces", Georgia, serif; line-height: 1.05; }
h1 { margin: 0; font-size: clamp(46px, 5.3vw, 76px); letter-spacing: -.035em; }
h2 { margin: 0; font-size: 38px; letter-spacing: -.02em; }
.intro { max-width: 540px; margin: 24px 0 30px; color: var(--muted); font-size: 18px; }
.quick-facts { display: flex; flex-wrap: wrap; gap: 18px 26px; padding-top: 24px; border-top: 1px solid var(--line); }
.quick-facts > div { display: flex; align-items: center; gap: 10px; }
.fact-icon { width: 36px; height: 36px; display: grid; place-items: center; border-radius: 50%; color: var(--accent); background: #f9e8df; font-weight: 700; }
.quick-facts small, .quick-facts strong { display: block; line-height: 1.25; }
.quick-facts small { color: var(--muted); font-size: 12px; }
.quick-facts strong { margin-top: 3px; font-size: 15px; }

.dish-photo { position: relative; margin: 0; min-height: 590px; overflow: hidden; border-radius: 32px 8px 32px 8px; background: var(--soft); box-shadow: var(--shadow); }
.dish-photo img { position: absolute; width: 100%; height: 100%; object-fit: cover; }
.dish-photo figcaption { position: absolute; right: 18px; bottom: 18px; padding: 8px 13px; border-radius: 16px; background: rgba(255,255,255,.9); color: var(--muted); font-size: 13px; backdrop-filter: blur(8px); }

.panel { padding: 34px; border: 1px solid var(--line); border-radius: 24px; background: var(--soft); }
.section-heading { display: flex; justify-content: space-between; gap: 20px; align-items: end; margin-bottom: 24px; }
.servings { padding: 7px 12px; border-radius: 18px; color: var(--accent-dark); background: #f3ddd4; font-size: 14px; font-weight: 700; white-space: nowrap; }
.ingredient-list { margin: 0; padding: 0; list-style: none; }
.ingredient-list li { border-top: 1px solid var(--line); }
.ingredient-list label { min-height: 76px; display: flex; align-items: center; gap: 14px; cursor: pointer; }
.ingredient-list input { position: absolute; opacity: 0; pointer-events: none; }
.custom-check { width: 24px; height: 24px; flex: 0 0 24px; border: 2px solid #bdb1a7; border-radius: 7px; background: white; transition: .2s; }
.ingredient-list input:checked + .custom-check { border-color: var(--accent); background: var(--accent); box-shadow: inset 0 0 0 5px white; }
.ingredient-list label > span:last-child { width: 100%; display: flex; justify-content: space-between; gap: 20px; }
.ingredient-list small { color: var(--muted); font-size: 15px; }
.ingredient-list input:checked ~ span strong { color: var(--accent); font-weight: 700; text-decoration: none; }
.primary-button { width: 100%; min-height: 52px; margin-top: 20px; border: 0; border-radius: 13px; color: white; background: var(--accent); font-weight: 700; cursor: pointer; transition: transform .15s, background .15s; }
.primary-button:hover { background: var(--accent-dark); }
.primary-button:active { transform: scale(.985); }

.method { padding: 28px 8px 0; }
.steps { margin: 28px 0 0; padding: 0; list-style: none; }
.steps li { display: grid; grid-template-columns: 42px 1fr; gap: 16px; padding: 0 0 22px; }
.steps li > span { width: 38px; height: 38px; display: grid; place-items: center; border-radius: 50%; color: white; background: var(--ink); font-family: "Fraunces", serif; font-weight: 700; }
.steps p { margin: 4px 0 0; }
.tip { margin-top: 12px; padding: 20px; display: flex; gap: 14px; border-left: 4px solid var(--gold); border-radius: 0 14px 14px 0; background: #fff5d9; }
.tip > span { color: #a66c00; }
.tip p { margin: 0; font-size: 15px; }
.tip strong { display: block; }

.recipe-nav { margin-top: 52px; padding: 22px 26px; display: flex; align-items: center; justify-content: space-between; gap: 24px; border: 1px solid var(--line); border-radius: 18px; background: white; box-shadow: 0 10px 30px rgba(66, 45, 29, .07); }
.recipe-nav span > small, .recipe-nav span > strong { display: block; }
.recipe-nav small { color: var(--muted); font-size: 13px; }
.recipe-nav strong { margin-top: 2px; font-family: "Fraunces", Georgia, serif; font-size: 20px; }
.recipe-nav a { flex: 0 0 auto; padding: 11px 16px; border-radius: 11px; color: white; background: var(--accent); font-weight: 700; text-decoration: none; }

.toast { position: fixed; z-index: 20; left: 50%; bottom: 24px; width: max-content; max-width: calc(100vw - 32px); padding: 13px 18px; border-radius: 12px; color: white; background: var(--ink); box-shadow: var(--shadow); transform: translate(-50%, 130%); opacity: 0; transition: .3s ease; }
.toast.show { transform: translate(-50%, 0); opacity: 1; }

@media (max-width: 820px) {
  .recipe { grid-template-columns: 1fr; gap: 26px; }
  .hero-copy { padding-bottom: 0; }
  .dish-photo { grid-row: 2; min-height: 500px; }
  .ingredients { grid-row: 3; }
  .method { grid-row: 4; }
}

@media (max-width: 540px) {
  body { font-size: 16px; }
  .topbar { height: 66px; padding: 0 16px; }
  .brand > span:last-child { display: none; }
  .list-button { padding: 0 10px; }
  main { padding: 18px 16px 56px; }
  .breadcrumb { margin-bottom: 17px; }
  h1 { font-size: 43px; }
  h2 { font-size: 32px; }
  .intro { margin: 18px 0 22px; }
  .quick-facts { gap: 16px; }
  .quick-facts > div { width: calc(50% - 8px); }
  .dish-photo { min-height: 430px; border-radius: 22px 6px 22px 6px; }
  .panel { padding: 24px 20px; }
  .section-heading { align-items: start; flex-direction: column; gap: 12px; }
  .ingredient-list label > span:last-child { flex-direction: column; gap: 1px; }
  .method { padding: 22px 2px 0; }
  .recipe-nav { margin-top: 36px; padding: 20px; align-items: stretch; flex-direction: column; }
  .recipe-nav a { text-align: center; }
}

@media (prefers-reduced-motion: reduce) {
  * { scroll-behavior: auto !important; transition: none !important; }
}

/* Navigation fixe et catalogue */
.site-header { position: sticky; z-index: 30; top: 0; background: rgba(255, 253, 249, .96); border-bottom: 1px solid var(--line); backdrop-filter: blur(14px); }
.site-header .topbar { position: static; border-bottom: 0; background: transparent; backdrop-filter: none; }
.top-actions a { text-decoration: none; }
.search-link { display: grid; place-items: center; }
.active-list { color: white; border-color: var(--accent); background: var(--accent); }
.active-list .count { color: var(--accent); background: white; }
.category-bar { max-width: 1180px; height: 52px; margin: 0 auto; padding: 0 24px 10px; display: flex; align-items: center; gap: 8px; overflow-x: auto; scrollbar-width: none; }
.category-bar::-webkit-scrollbar { display: none; }
.category-pill { min-height: 36px; padding: 7px 15px; flex: 0 0 auto; border: 1px solid var(--line); border-radius: 18px; color: var(--muted); background: white; font-size: 14px; font-weight: 600; text-decoration: none; cursor: pointer; }
.category-pill.active { color: white; border-color: var(--accent); background: var(--accent); }

.category-count { display: inline-flex; min-width: 18px; height: 18px; margin-left: 4px; padding: 0 5px; align-items: center; justify-content: center; border-radius: 999px; background: #f1e7e1; color: var(--accent); font-size: 11px; font-weight: 800; line-height: 1; vertical-align: 1px; }
.category-pill.active .category-count { background: rgba(255,255,255,.22); color: white; }

.catalogue-main { max-width: 2100px; padding-top: 44px; padding-left: clamp(16px, 2vw, 40px); padding-right: clamp(16px, 2vw, 40px); }
.catalogue-heading { display: grid; grid-template-columns: 1fr minmax(320px, 430px); gap: 40px; align-items: end; }
.catalogue-heading h1, .shopping-heading h1 { margin: 0; font-size: clamp(44px, 5vw, 68px); }
.catalogue-heading p:not(.eyebrow), .shopping-heading p { margin: 14px 0 0; color: var(--muted); }
.search-box { min-height: 58px; padding: 0 18px; display: flex; align-items: center; gap: 12px; border: 1px solid var(--line); border-radius: 16px; background: white; box-shadow: 0 8px 24px rgba(66, 45, 29, .07); scroll-margin-top: 140px; }
.search-box > span { color: var(--accent); font-size: 28px; }
.search-box input { width: 100%; border: 0; outline: 0; color: var(--ink); background: transparent; font-size: 16px; }
.catalogue-meta { margin: 42px 0 18px; display: flex; justify-content: space-between; gap: 20px; color: var(--muted); font-size: 14px; }
.catalogue-meta strong { color: var(--ink); }
.recipe-grid { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 18px; align-items: stretch; }
.recipe-card { min-width: 0; overflow: hidden; border: 1px solid var(--line); border-radius: 20px; color: inherit; background: white; box-shadow: 0 10px 30px rgba(66, 45, 29, .08); text-decoration: none; transition: transform .2s, box-shadow .2s; }
.recipe-card:hover { transform: translateY(-4px); box-shadow: var(--shadow); }
.recipe-card[hidden] { display: none; }
.card-photo { position: relative; aspect-ratio: 4 / 3; overflow: hidden; background: var(--soft); }
.card-photo img { width: 100%; height: 100%; object-fit: cover; transition: transform .35s; }
.recipe-card:hover .card-photo img { transform: scale(1.035); }
.card-photo > span { position: absolute; right: 12px; bottom: 12px; padding: 5px 9px; border-radius: 12px; color: var(--ink); background: rgba(255,255,255,.9); font-size: 12px; font-weight: 700; }
.card-copy { padding: 18px; }
.card-copy p { margin: 0 0 7px; color: var(--accent); font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
.card-copy h2 { min-height: 2.25em; margin: 0 0 12px; font-size: 23px; line-height: 1.12; }
.card-copy > span { color: var(--muted); font-size: 13px; }
.empty-state { grid-column: 1 / -1; padding: 48px 24px; display: grid; place-items: center; gap: 4px; border: 1px dashed #cfc2b7; border-radius: 18px; color: var(--muted); text-align: center; background: var(--soft); }
.empty-state[hidden] { display: none; }
.empty-state strong { color: var(--ink); }

/* Liste de courses */
.shopping-main { max-width: 820px; }
.shopping-heading { margin-bottom: 30px; display: flex; align-items: end; justify-content: space-between; gap: 24px; }
.clear-button { min-height: 42px; padding: 8px 14px; border: 1px solid var(--line); border-radius: 11px; color: var(--muted); background: white; cursor: pointer; }
.shopping-items { margin: 0; padding: 0; list-style: none; border: 1px solid var(--line); border-radius: 18px; overflow: hidden; background: white; box-shadow: 0 10px 30px rgba(66,45,29,.07); }
.shopping-items:empty { display: none; }
.shopping-items li { min-height: 72px; padding: 12px 14px 12px 18px; display: flex; align-items: center; gap: 16px; border-bottom: 1px solid var(--line); }
.shopping-items li:last-child { border-bottom: 0; }
.shopping-items label { flex: 1; display: flex; align-items: center; gap: 14px; cursor: pointer; }
.shopping-items input { width: 24px; height: 24px; accent-color: var(--accent); }
.shopping-items label span { display: flex; flex: 1; justify-content: space-between; gap: 20px; }
.shopping-items small { color: var(--muted); }
.shopping-items button { width: 38px; height: 38px; border: 0; border-radius: 50%; color: var(--muted); background: var(--soft); font-size: 24px; cursor: pointer; }
.shopping-items li.done strong, .shopping-items li.done small { color: #a39b95; text-decoration: line-through; }
.shopping-empty a { margin-top: 14px; padding: 10px 15px; border-radius: 11px; color: white; background: var(--accent); font-weight: 700; text-decoration: none; }

@media (max-width: 1599px) {
  .recipe-grid { grid-template-columns: repeat(5, minmax(0, 1fr)); }
}

@media (max-width: 1199px) {
  .recipe-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

@media (max-width: 899px) {
  .catalogue-heading { grid-template-columns: 1fr; gap: 24px; }
  .recipe-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
  .catalogue-meta span { display: none; }
  .card-copy { padding: 14px; }
  .card-copy h2 { font-size: 19px; }
  .shopping-heading { align-items: start; flex-direction: column; }
}

@media (max-width: 649px) {
  .recipe-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
}

@media (max-width: 540px) {
  .site-header .topbar { height: 62px; }
  .category-bar { height: 48px; padding: 0 16px 10px; }
  .category-pill { min-height: 34px; padding: 6px 13px; }
  .catalogue-main { padding-top: 28px; }
  .catalogue-heading h1, .shopping-heading h1 { font-size: 42px; }
  .card-photo { aspect-ratio: 1 / 1; }
  .card-copy h2 { min-height: 3.3em; font-size: 17px; }
  .card-copy > span { font-size: 12px; }
  .shopping-items label span { flex-direction: column; gap: 1px; }
}

button:disabled,input:disabled {opacity:.55;cursor:wait;}
#reset-ingredients {margin-top:12px;width:100%;}
#clear-list {color:var(--accent-dark);border-color:var(--accent);font-weight:700;}
#sync-status {font-size:14px;color:var(--muted);}

/* Repère visuel pour les recettes Thermomix */
.thermomix-badge { position: absolute; z-index: 3; top: 14px; left: 14px; right: auto !important; bottom: auto !important; width: 34px; height: 34px; padding: 0 !important; display: grid; place-items: center; border: 2px solid white; border-radius: 50%; color: white !important; background: var(--accent) !important; box-shadow: 0 4px 12px rgba(0,0,0,.18); font-family: "DM Sans", sans-serif; font-size: 17px !important; font-weight: 800 !important; line-height: 1; }
.dish-photo { position: relative; }
.dish-photo .thermomix-badge { width: 42px; height: 42px; top: 16px; left: 16px; font-size: 20px !important; }

/* Repères transversaux : Thermomix, Four et Repas combinés */
.recipe-badge { position:absolute; z-index:4; top:14px; width:34px; height:34px; padding:0 !important; display:grid; place-items:center; border:2px solid white; border-radius:50%; color:white !important; background:var(--accent) !important; box-shadow:0 4px 12px rgba(0,0,0,.18); font-family:"DM Sans",sans-serif; font-size:16px !important; font-weight:800 !important; line-height:1; }
.card-photo .recipe-badge:nth-of-type(1), .dish-photo .recipe-badge:nth-of-type(1) { left:14px; right:auto !important; bottom:auto !important; }
.card-photo .recipe-badge:nth-of-type(2), .dish-photo .recipe-badge:nth-of-type(2) { left:54px; right:auto !important; bottom:auto !important; }
.card-photo .recipe-badge:nth-of-type(3), .dish-photo .recipe-badge:nth-of-type(3) { left:94px; right:auto !important; bottom:auto !important; }
.dish-photo .recipe-badge { width:42px; height:42px; top:16px; font-size:19px !important; }
.dish-photo .recipe-badge:nth-of-type(1){left:16px}.dish-photo .recipe-badge:nth-of-type(2){left:64px}.dish-photo .recipe-badge:nth-of-type(3){left:112px}
.combined-badge { font-size:12px !important; letter-spacing:-.4px; } .dish-photo .combined-badge { font-size:14px !important; }
.oven-badge { background:#6d5a43 !important; } .combined-badge { background:#267f88 !important; }
.category-pill.special-pill { border-color:rgba(181,50,34,.32); }

.storage-note{margin:22px 0 0;padding:14px 16px;border-left:4px solid #b53222;background:#fff3f1;color:#b53222;font-weight:700;border-radius:10px;}

/* Menu burger global */
.menu-button {
  width: 44px;
  height: 44px;
  flex: 0 0 44px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  color: var(--ink);
  background: white;
  cursor: pointer;
}
.burger-lines { width: 19px; display: grid; gap: 4px; }
.burger-lines i { height: 2px; display: block; border-radius: 2px; background: currentColor; }
.menu-button[aria-expanded="true"] { color: white; border-color: var(--accent); background: var(--accent); }
.menu-backdrop { position: fixed; z-index: 39; inset: 0; background: rgba(38,34,31,.24); backdrop-filter: blur(2px); }
.menu-backdrop[hidden] { display: none; }
.recipe-menu {
  position: fixed;
  z-index: 40;
  top: 68px;
  right: max(24px, calc((100vw - 1180px) / 2));
  width: min(340px, calc(100vw - 32px));
  max-height: calc(100dvh - 84px);
  overflow: auto;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--paper);
  box-shadow: 0 22px 60px rgba(38,34,31,.22);
  transform: translateY(-8px) scale(.98);
  transform-origin: top right;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity .18s ease, transform .18s ease, visibility .18s;
}
.recipe-menu.open { transform: none; opacity: 1; visibility: visible; pointer-events: auto; }
.recipe-menu-head { min-height: 42px; display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 0 4px 10px 8px; }
.recipe-menu-head strong { font-family: "Fraunces", Georgia, serif; font-size: 24px; }
.menu-close { width: 38px; height: 38px; border: 0; border-radius: 50%; color: var(--muted); background: var(--soft); font-size: 28px; line-height: 1; cursor: pointer; }
.recipe-menu-links { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.recipe-menu-links a { min-height: 46px; padding: 10px 12px; display: flex; align-items: center; border: 1px solid var(--line); border-radius: 13px; background: white; font-weight: 650; text-decoration: none; }
.recipe-menu-links a:hover { border-color: rgba(181,50,34,.45); color: var(--accent-dark); background: #fff8f5; }
.recipe-menu-separator { grid-column: 1 / -1; height: 1px; margin: 3px 2px; background: var(--line); }
body.menu-open { overflow: hidden; }

@media (max-width: 820px) {
  .category-bar { display: none; }
  .site-header { min-height: 66px; }
  .recipe-menu { top: 76px; right: 16px; }
  .search-box { scroll-margin-top: 82px; }
}

@media (max-width: 540px) {
  .top-actions { gap: 7px; }
  .icon-button, .menu-button { width: 42px; height: 42px; flex-basis: 42px; }
  .list-button { height: 42px; }
  .list-button > span:nth-child(2) { display: none; }
  .recipe-menu { top: 68px; right: 10px; width: calc(100vw - 20px); max-height: calc(100dvh - 78px); border-radius: 18px; }
  .recipe-menu-links { grid-template-columns: 1fr; }
  .recipe-menu-links a { min-height: 44px; }
}
