/* Banner cookie — Cucina Lorenzo de' Medici
   Autonomo, nessuna dipendenza esterna. */

.ldmc,
.ldmc * { box-sizing: border-box; }

.ldmc {
  --ldm: #97293e;
  --ldm-dark: #7a2033;
  --ink: #1d1d1f;
  --muted: #6b6560;
  --line: #e6e1dc;
  --radius: 14px;
  font-family: inherit;
}

.ldmc[hidden] { display: none !important; }

/* ---------- Banner ---------- */

.ldmc-bar {
  position: fixed;
  z-index: 2147483000;
  left: 50%;
  bottom: 20px;
  transform: translateX(-50%);
  width: min(960px, calc(100vw - 32px));
  background: var(--ldm);
  color: #fff;
  border-radius: var(--radius);
  box-shadow: 0 18px 50px rgba(0, 0, 0, .28);
  padding: 22px 24px;
  padding-bottom: calc(22px + env(safe-area-inset-bottom, 0px));
  animation: ldmc-in .38s cubic-bezier(.16, 1, .3, 1) both;
}

@keyframes ldmc-in {
  from { opacity: 0; transform: translateX(-50%) translateY(22px); }
  to   { opacity: 1; transform: translateX(-50%) translateY(0); }
}

.ldmc-bar__logo {
  display: block;
  width: 132px;
  max-width: 40%;
  height: auto;
  margin-bottom: 14px;
}

.ldmc-bar__title {
  margin: 0 0 6px;
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: -.01em;
  color: #fff;
  line-height: 1.3;
}

.ldmc-bar__text {
  margin: 0 0 16px;
  font-size: .9rem;
  line-height: 1.55;
  color: rgba(255, 255, 255, .92);
  max-width: 70ch;
}

.ldmc-bar__text a {
  color: #fff;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.ldmc-bar__text a:hover { opacity: .82; }

.ldmc-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

/* Pulsanti: stesso peso visivo per accetta e rifiuta (requisito GDPR) */
.ldmc-btn {
  font: 600 .875rem/1 inherit;
  cursor: pointer;
  border-radius: 999px;
  padding: 12px 22px;
  border: 1.5px solid transparent;
  transition: background-color .18s ease, color .18s ease, border-color .18s ease;
  white-space: nowrap;
}

.ldmc-btn:focus-visible {
  outline: 3px solid #fff;
  outline-offset: 2px;
}

.ldmc-btn--solid { background: #fff; color: var(--ldm); border-color: #fff; }
.ldmc-btn--solid:hover { background: rgba(255, 255, 255, .88); }

.ldmc-btn--outline { background: transparent; color: #fff; border-color: rgba(255, 255, 255, .75); }
.ldmc-btn--outline:hover { background: rgba(255, 255, 255, .14); }

.ldmc-btn--link {
  background: none;
  border: none;
  color: #fff;
  text-decoration: underline;
  text-underline-offset: 3px;
  padding: 12px 6px;
  font-weight: 500;
}

.ldmc-btn--link:hover { opacity: .82; }

@media (max-width: 560px) {
  .ldmc-bar { bottom: 0; width: 100vw; border-radius: var(--radius) var(--radius) 0 0; padding: 20px 18px; }
  .ldmc-actions { flex-direction: column; align-items: stretch; }
  .ldmc-btn { width: 100%; text-align: center; }
}

/* ---------- Pannello preferenze ---------- */

.ldmc-overlay {
  position: fixed;
  inset: 0;
  z-index: 2147483001;
  background: rgba(20, 15, 15, .55);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: ldmc-fade .22s ease both;
}

@keyframes ldmc-fade { from { opacity: 0; } to { opacity: 1; } }

.ldmc-panel {
  background: #fff;
  color: var(--ink);
  width: min(620px, 100%);
  max-height: min(86vh, 760px);
  border-radius: var(--radius);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 24px 70px rgba(0, 0, 0, .35);
}

.ldmc-panel__head {
  background: var(--ldm);
  color: #fff;
  padding: 18px 22px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-shrink: 0;
}

.ldmc-panel__title { margin: 0; font-size: 1.05rem; font-weight: 700; }

.ldmc-close {
  background: none;
  border: none;
  color: #fff;
  cursor: pointer;
  font-size: 1.6rem;
  line-height: 1;
  padding: 2px 6px;
  border-radius: 6px;
}

.ldmc-close:hover { opacity: .75; }
.ldmc-close:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }

.ldmc-panel__body { padding: 20px 22px; overflow-y: auto; flex: 1; }

.ldmc-intro { margin: 0 0 18px; font-size: .9rem; line-height: 1.6; color: var(--muted); }

.ldmc-group {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 16px 18px;
  margin-bottom: 12px;
}

.ldmc-group__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 8px;
}

.ldmc-group__title { margin: 0; font-size: .95rem; font-weight: 700; }
.ldmc-group__desc { margin: 0; font-size: .85rem; line-height: 1.55; color: var(--muted); }

.ldmc-always {
  font-size: .72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--ldm);
  background: rgba(151, 41, 62, .09);
  padding: 5px 10px;
  border-radius: 999px;
  white-space: nowrap;
}

/* Interruttore */
.ldmc-switch { position: relative; flex-shrink: 0; width: 46px; height: 26px; }
.ldmc-switch input { position: absolute; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }

.ldmc-switch__track {
  position: absolute;
  inset: 0;
  background: #c9c2bb;
  border-radius: 999px;
  transition: background-color .2s ease;
  pointer-events: none;
}

.ldmc-switch__track::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 20px;
  height: 20px;
  background: #fff;
  border-radius: 50%;
  transition: transform .2s ease;
  box-shadow: 0 1px 3px rgba(0, 0, 0, .25);
}

.ldmc-switch input:checked + .ldmc-switch__track { background: var(--ldm); }
.ldmc-switch input:checked + .ldmc-switch__track::after { transform: translateX(20px); }
.ldmc-switch input:focus-visible + .ldmc-switch__track { outline: 3px solid var(--ldm); outline-offset: 2px; }

.ldmc-panel__foot {
  border-top: 1px solid var(--line);
  padding: 16px 22px;
  padding-bottom: calc(16px + env(safe-area-inset-bottom, 0px));
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}

.ldmc-panel__foot .ldmc-btn--solid { background: var(--ldm); color: #fff; border-color: var(--ldm); }
.ldmc-panel__foot .ldmc-btn--solid:hover { background: var(--ldm-dark); border-color: var(--ldm-dark); }
.ldmc-panel__foot .ldmc-btn--outline { color: var(--ldm); border-color: var(--ldm); }
.ldmc-panel__foot .ldmc-btn--outline:hover { background: rgba(151, 41, 62, .08); }

.ldmc-panel__foot .ldmc-link { font-size: .82rem; color: var(--muted); text-decoration: underline; text-underline-offset: 2px; }
.ldmc-panel__foot .ldmc-link:hover { color: var(--ink); }

@media (max-width: 560px) {
  .ldmc-overlay { padding: 0; align-items: flex-end; }
  .ldmc-panel { max-height: 92vh; border-radius: var(--radius) var(--radius) 0 0; }
  .ldmc-panel__foot { flex-direction: column-reverse; align-items: stretch; }
  .ldmc-panel__foot .ldmc-btn { width: 100%; }
  .ldmc-panel__foot .ldmc-link { text-align: center; padding-top: 4px; }
}

/* ---------- Segnaposto contenuti bloccati ---------- */

.ldmc-ph {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  min-height: 220px;
  padding: 28px 22px;
  text-align: center;
  background: #241b1d url("/cookie/placeholder.jpg") center / cover no-repeat;
  border-radius: 10px;
  color: #fff;
}

.ldmc-ph::before {
  content: "";
  position: absolute;
  inset: 0;
  background: rgba(30, 20, 22, .68);
  border-radius: 10px;
}

.ldmc-ph > * { position: relative; }

.ldmc-ph__text { margin: 0; font-size: .9rem; line-height: 1.55; max-width: 44ch; }

.ldmc-ph__btn {
  font: 600 .85rem/1 inherit;
  cursor: pointer;
  background: #fff;
  color: var(--ldm);
  border: none;
  border-radius: 999px;
  padding: 11px 20px;
}

.ldmc-ph__btn:hover { background: rgba(255, 255, 255, .88); }
.ldmc-ph__btn:focus-visible { outline: 3px solid #fff; outline-offset: 2px; }

/* ---------- Rispetto delle preferenze di sistema ---------- */

@media (prefers-reduced-motion: reduce) {
  .ldmc-bar,
  .ldmc-overlay { animation: none; }
  .ldmc-switch__track,
  .ldmc-switch__track::after,
  .ldmc-btn { transition: none; }
}
