/* L'Atelier Gourmand — feuille de style unique (accueil + pages légales) */
:root {
  --bg: #FBF5EA; --surface: #FFFDF8; --ink: #2A1A10; --muted: #6B5444;
  --accent: #A84A08; --on-accent: #fff; --line: #E6D8C3; --gold: #E9A23B; --glow: #F6C87A;
  --serif: "Iowan Old Style", "Palatino Linotype", "Book Antiqua", Palatino, "Noto Serif", Georgia, serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --r: 20px; --head: 64px; --ease: cubic-bezier(.2, .8, .2, 1);
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #17100B; --surface: #231811; --ink: #F7ECDD; --muted: #C9B5A0;
    --accent: #F2B25C; --on-accent: #1B120B; --line: #3D2C20; --glow: #8A4A12;
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
html:has(dialog[open]) { overflow: hidden; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 400 1rem/1.6 var(--sans); overflow-x: clip; }
h1, h2, h3 { font-family: var(--serif); font-weight: 600; line-height: 1.08; letter-spacing: -.015em; margin: 0; text-wrap: balance; }
h2 { font-size: clamp(2rem, 5vw, 3.4rem); }
p { margin: 0; }
a { color: var(--accent); text-underline-offset: 3px; }
button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; }
ul, ol.steps { list-style: none; margin: 0; padding: 0; }
svg.ico { width: 1.5em; height: 1.5em; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; flex: none; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; border-radius: 6px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.wrap { width: min(100% - 2rem, 1200px); margin-inline: auto; }
.skip { position: absolute; left: 1rem; top: -4rem; z-index: 100; background: var(--ink); color: var(--bg); padding: .75rem 1rem; border-radius: 10px; }
.skip:focus { top: 1rem; }
.eyebrow { font-size: .8rem; letter-spacing: .18em; text-transform: uppercase; color: var(--accent); font-weight: 600; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: .5rem; min-height: 48px; padding: 0 1.4rem; border-radius: 999px; font-weight: 600; white-space: nowrap; background: var(--accent); color: var(--on-accent); text-decoration: none; transition: scale .2s var(--ease), box-shadow .2s; }
.btn:hover { scale: 1.03; box-shadow: 0 8px 24px -8px var(--accent); }
.btn:active { scale: .97; }
.btn.ghost { background: none; color: var(--ink); box-shadow: inset 0 0 0 1.5px var(--ink); }
.btn[disabled] { opacity: .6; cursor: progress; }

/* En-tête */
.head { position: sticky; top: 0; z-index: 20; height: var(--head); background: color-mix(in srgb, var(--bg) 78%, transparent); backdrop-filter: blur(14px) saturate(1.4); -webkit-backdrop-filter: blur(14px) saturate(1.4); border-bottom: 1px solid color-mix(in srgb, var(--line) 70%, transparent); }
.head .wrap { height: 100%; display: flex; align-items: center; gap: 1.5rem; }
.logo { font: italic 600 1.35rem var(--serif); color: var(--ink); text-decoration: none; margin-right: auto; white-space: nowrap; }
.logo b { color: var(--accent); font-weight: 600; }
.nav { display: flex; gap: 1.5rem; }
.nav a { color: var(--ink); text-decoration: none; font-weight: 500; padding: .6rem 0; }
.nav a:hover { color: var(--accent); }
#open-cart { display: inline-flex; align-items: center; gap: .6rem; min-height: 44px; padding: 0 1rem; border-radius: 999px; background: var(--ink); color: var(--bg); font-weight: 600; }
#count { min-width: 1.6em; padding: 0 .4em; border-radius: 999px; background: var(--gold); color: #1B120B; font-size: .85rem; text-align: center; }

/* Héro */
.hero { position: relative; isolation: isolate; overflow: clip; padding: clamp(3rem, 9vw, 7rem) 0 clamp(3rem, 7vw, 5rem); }
.hero::before { /* halo « four » qui suit le pointeur */ content: ""; position: absolute; inset: -20%; z-index: -2; background: radial-gradient(40rem 40rem at var(--px, 75%) var(--py, 30%), var(--glow), transparent 60%), radial-gradient(30rem 30rem at 10% 90%, color-mix(in srgb, var(--gold) 45%, transparent), transparent 60%); opacity: .55; animation: breathe 9s ease-in-out infinite alternate; }
.hero::after { /* grain */ content: ""; position: absolute; inset: 0; z-index: -1; opacity: .12; mix-blend-mode: multiply; pointer-events: none; background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='200'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.8' numOctaves='2'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E"); }
@keyframes breathe { to { opacity: .8; scale: 1.08; } }
.hero .wrap { display: grid; gap: 2.5rem; align-items: center; }
.hero h1 { font-size: clamp(2.7rem, 9vw, 6rem); margin: 1rem 0 1.25rem; }
.hero h1 span { display: inline-block; animation: rise .9s var(--ease) both; animation-delay: calc(var(--i) * 90ms); }
.hero h1 em { color: var(--accent); }
@keyframes rise { from { opacity: 0; translate: 0 .6em; rotate: 3deg; filter: blur(6px); } }
.hero .lead { font-size: clamp(1.05rem, 2vw, 1.25rem); color: var(--muted); max-width: 34rem; }
.hero .cta { display: flex; flex-wrap: wrap; gap: .75rem; margin-top: 2rem; }
.ring { width: min(72vw, 420px); aspect-ratio: 1; margin-inline: auto; color: var(--ink); }
.ring .spin { transform-origin: 150px 150px; animation: spin 40s linear infinite; }
.ring text { font: 600 15px var(--sans); letter-spacing: .25em; fill: currentColor; }
.ring .disc { fill: var(--gold); opacity: .9; }
.ring .mark { color: #1B120B; animation: bob 5s ease-in-out infinite alternate; transform-origin: 150px 150px; }
@keyframes spin { to { rotate: 360deg; } }
@keyframes bob { to { rotate: -8deg; scale: 1.06; } }
@media (min-width: 860px) { .hero .wrap { grid-template-columns: 1.25fr 1fr; } }

.marquee { overflow: clip; border-block: 1px solid var(--line); background: var(--surface); padding: .9rem 0; font: italic 1.25rem var(--serif); white-space: nowrap; }
.marquee div { display: inline-block; animation: slide 45s linear infinite; }
.marquee span::after { content: "✦"; margin: 0 1.2rem; color: var(--gold); font-style: normal; }
@keyframes slide { to { translate: -50% 0; } }

/* Sections */
section { padding: clamp(3rem, 8vw, 6rem) 0; scroll-margin-top: var(--head); }
.sec-head { display: grid; gap: .75rem; margin-bottom: 2rem; }
.sec-head p:last-child { color: var(--muted); max-width: 40rem; }

/* Apparition au défilement — 100 % CSS, sans JS, ignorée si non supportée */
@supports (animation-timeline: view()) {
  .reveal { animation: reveal linear both; animation-timeline: view(); animation-range: entry 0% entry 45%; }
  @keyframes reveal { from { opacity: 0; translate: 0 40px; } }
}

/* Carte */
.tools { display: grid; gap: 1rem; }
.search { position: relative; max-width: 26rem; }
.search svg { position: absolute; left: 1rem; top: 50%; translate: 0 -50%; color: var(--muted); pointer-events: none; }
.search input { width: 100%; min-height: 48px; padding: 0 1rem 0 3rem; border-radius: 999px; border: 1.5px solid var(--line); background: var(--surface); }
.chips { position: sticky; top: var(--head); z-index: 10; display: flex; gap: .5rem; overflow-x: auto; padding: .75rem 1rem; margin: 0 -1rem 1rem; background: color-mix(in srgb, var(--bg) 85%, transparent); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); scrollbar-width: none; }
.chips button { flex: none; display: inline-flex; align-items: center; gap: .45rem; min-height: 44px; padding: 0 1rem; border-radius: 999px; border: 1.5px solid var(--line); background: var(--surface); font-weight: 500; transition: background .2s, color .2s, border-color .2s; }
.chips button[aria-pressed="true"] { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.cat { padding: 1.5rem 0 1rem; }
.cat h3 { font-size: clamp(1.5rem, 3.5vw, 2.1rem); display: flex; align-items: center; gap: .75rem; margin-bottom: 1.1rem; }
.cat h3 small { font: 500 .8rem var(--sans); letter-spacing: .04em; color: var(--muted); border: 1px solid var(--line); border-radius: 999px; padding: .2rem .7rem; }
.grid { display: grid; gap: .9rem; grid-template-columns: repeat(auto-fill, minmax(min(100%, 250px), 1fr)); }
.card { position: relative; overflow: hidden; display: grid; grid-template-columns: 1fr auto; gap: .9rem .75rem; align-items: end; padding: 1.1rem; border-radius: var(--r); background: var(--surface); border: 1px solid var(--line); transition: transform .3s var(--ease), box-shadow .3s, border-color .3s; }
.card::before { /* reflet qui suit le pointeur */ content: ""; position: absolute; inset: 0; background: radial-gradient(220px circle at var(--mx, 50%) var(--my, 0), color-mix(in srgb, var(--gold) 30%, transparent), transparent 70%); opacity: 0; transition: opacity .3s; pointer-events: none; }
@media (hover: hover) {
  .card:hover { transform: translateY(-4px); border-color: var(--gold); box-shadow: 0 18px 40px -22px color-mix(in srgb, var(--ink) 55%, transparent); }
  .card:hover::before { opacity: 1; }
}
.card .top { grid-column: 1 / -1; display: flex; gap: .75rem; align-items: flex-start; }
.card .top svg { font-size: 1.25rem; color: var(--accent); margin-top: .1rem; }
.card h4 { margin: 0; font: 600 1.05rem/1.3 var(--sans); }
.card .unit { font-size: .85rem; color: var(--muted); }
.price { font: 600 1.35rem var(--serif); font-variant-numeric: tabular-nums; }
.ctl { position: relative; display: flex; justify-content: flex-end; }
.add { min-height: 44px; padding: 0 1.1rem; border-radius: 999px; background: var(--accent); color: var(--on-accent); font-weight: 600; transition: scale .2s var(--ease); }
.add:hover { scale: 1.05; } .add:active { scale: .94; }
.step { display: inline-flex; align-items: center; border-radius: 999px; background: var(--ink); color: var(--bg); animation: pop .3s var(--ease); }
.step button { width: 44px; height: 44px; font-size: 1.3rem; font-weight: 600; border-radius: 999px; }
.step output { min-width: 1.6em; text-align: center; font-weight: 700; font-variant-numeric: tabular-nums; }
@keyframes pop { from { scale: .8; opacity: 0; } }
.quote { font-size: .85rem; color: var(--muted); text-align: right; }
.empty { padding: 3rem 0; color: var(--muted); text-align: center; }
.allerg { margin-top: 2rem; padding: 1rem 1.25rem; border-radius: var(--r); border: 1px dashed var(--line); color: var(--muted); font-size: .95rem; }

/* Étapes + infos */
.steps { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); counter-reset: s; }
.steps li { counter-increment: s; padding: 1.5rem; border-radius: var(--r); background: var(--surface); border: 1px solid var(--line); }
.steps li::before { content: "0" counter(s); display: block; font: italic 3.2rem/1 var(--serif); color: var(--gold); margin-bottom: .75rem; }
.steps h3 { font-size: 1.35rem; margin-bottom: .4rem; }
.steps p { color: var(--muted); }
.find { background: var(--ink); color: var(--bg); border-radius: calc(var(--r) * 1.5); padding: clamp(1.75rem, 5vw, 3.5rem); display: grid; gap: 1.5rem; }
.find address { font: normal 1.25rem/1.5 var(--serif); }
.find .btn { background: var(--gold); color: #1B120B; justify-self: start; }

.foot { border-top: 1px solid var(--line); padding: 2.5rem 0 3rem; color: var(--muted); font-size: .95rem; }
.foot .wrap { display: grid; gap: 1rem; }
.foot ul { display: flex; flex-wrap: wrap; gap: .25rem 1.5rem; }
.foot a { display: inline-block; padding: .6rem 0; color: var(--ink); }

/* Panier (dialog natif : focus piégé + Échap gérés par le navigateur) */
#cart { position: fixed; inset: 0 0 0 auto; margin: 0; width: min(100%, 470px); height: 100dvh; max-height: none; max-width: none; padding: 0; border: 0; background: var(--bg); color: var(--ink); box-shadow: -30px 0 80px -30px #000a; translate: 100% 0; transition: translate .4s var(--ease), overlay .4s allow-discrete, display .4s allow-discrete; }
#cart[open] { translate: 0 0; }
@starting-style { #cart[open] { translate: 100% 0; } }
#cart::backdrop { background: #1B120B88; backdrop-filter: blur(4px); }
.cart-in { min-height: 100%; display: flex; flex-direction: column; gap: 1.25rem; padding: 1.25rem; }
.cart-top { display: flex; align-items: center; justify-content: space-between; position: sticky; top: 0; z-index: 2; background: var(--bg); margin: -1.25rem -1.25rem 0; padding: 1rem 1.25rem; border-bottom: 1px solid var(--line); }
.cart-top h2 { font-size: 1.7rem; }
.x { width: 44px; height: 44px; border-radius: 999px; background: var(--surface); border: 1px solid var(--line); font-size: 1.4rem; line-height: 1; }
#cart-list li { display: flex; align-items: center; justify-content: space-between; gap: .75rem; padding: .8rem 0; border-bottom: 1px solid var(--line); }
#cart-list strong { display: block; }
#cart-list span { color: var(--muted); font-size: .9rem; }
.total { display: flex; justify-content: space-between; align-items: baseline; font-weight: 600; }
.total .price { font-size: 1.8rem; }
.hint { color: var(--muted); font-size: .9rem; }
#cart-empty, #done { display: none; }
#cart.is-empty #cart-empty { display: block; }
#cart.is-empty :is(#cart-list, .total, #order), #cart.is-done :is(#cart-list, .total, #order, #cart-empty) { display: none; }
#cart.is-done #done { display: grid; gap: 1rem; }
#recap { white-space: pre-wrap; font: .9rem/1.5 ui-monospace, Consolas, monospace; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 1rem; margin: 0; }
#order { display: grid; gap: 1rem; }
#order h3 { font-size: 1.35rem; }
.field { display: grid; gap: .3rem; }
.field label { font-weight: 600; font-size: .95rem; }
.field label i { font-weight: 400; font-style: normal; color: var(--muted); }
.field :is(input:not([type=checkbox]), textarea) { width: 100%; min-height: 48px; padding: .7rem .9rem; border-radius: 12px; border: 1.5px solid var(--line); background: var(--surface); }
.field [aria-invalid="true"] { border-color: #C62828; }
.row { display: grid; grid-template-columns: 1fr 1fr; gap: .75rem; }
.check { display: grid; grid-template-columns: auto 1fr; gap: .25rem .75rem; align-items: start; }
.check input { width: 24px; height: 24px; margin-top: .15rem; accent-color: var(--accent); }
.check label { font-weight: 400; }
.check .err { grid-column: 2; }
.err { color: #C62828; font-size: .875rem; font-weight: 600; min-height: 0; }
@media (prefers-color-scheme: dark) { .err { color: #FF9A8F; } .field [aria-invalid="true"] { border-color: #FF9A8F; } }
.err:empty { display: none; }
#order .btn { width: 100%; min-height: 54px; }
.fly { position: fixed; z-index: 50; width: 18px; height: 18px; margin: -9px; border-radius: 50%; background: var(--gold); pointer-events: none; }

/* Transition de filtre (View Transitions API) */
::view-transition-group(*) { animation-duration: .4s; animation-timing-function: var(--ease); }

/* Pages légales */
.legal { max-width: 46rem; padding: clamp(2rem, 6vw, 4rem) 0; }
.legal h1 { font-size: clamp(2.2rem, 6vw, 3.4rem); margin-bottom: 1rem; }
.legal h2 { font-size: clamp(1.6rem, 4vw, 2.2rem); margin: 3rem 0 1rem; padding-top: 1.5rem; border-top: 1px solid var(--line); scroll-margin-top: calc(var(--head) + 1rem); }
.legal h3 { font: 600 1.1rem var(--sans); margin: 1.5rem 0 .4rem; letter-spacing: 0; }
.legal :is(p, ul, table) { margin-bottom: .9rem; }
.legal ul { list-style: disc; padding-left: 1.25rem; }
.legal table { width: 100%; border-collapse: collapse; font-size: .95rem; }
.legal :is(th, td) { text-align: left; vertical-align: top; padding: .6rem; border: 1px solid var(--line); }
.legal .toc { display: flex; flex-wrap: wrap; gap: .5rem; margin: 1.5rem 0; }
.legal .toc a { display: inline-flex; align-items: center; min-height: 44px; padding: 0 1rem; border-radius: 999px; border: 1.5px solid var(--line); background: var(--surface); color: var(--ink); text-decoration: none; font-weight: 500; }
.todo { background: var(--gold); color: #1B120B; padding: 0 .35em; border-radius: 4px; font-weight: 600; }
.tablewrap { overflow-x: auto; }

/* Mobile : le bouton panier devient une barre fixe sous le pouce */
@media (max-width: 760px) {
  .nav { display: none; }
  .head { backdrop-filter: none; -webkit-backdrop-filter: none; background: var(--bg); } /* un backdrop-filter emprisonnerait le bouton fixe dans l'en-tête */
  body:has(#open-cart) { padding-bottom: 5.5rem; }
  #open-cart { position: fixed; z-index: 30; left: 1rem; right: 1rem; bottom: calc(1rem + env(safe-area-inset-bottom)); justify-content: center; min-height: 56px; background: var(--accent); color: var(--on-accent); box-shadow: 0 14px 34px -10px #000a; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition: none !important; }
  ::view-transition-group(*), ::view-transition-old(*), ::view-transition-new(*) { animation: none !important; }
}
