/* Degù — pagina pubblica. I colori, i font e le misure arrivano dalle variabili impostate nel pannello. */
*,
*::before,
*::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body.dg {
  margin: 0;
  min-height: 100vh;
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  color: var(--text);
  background: var(--bg-color);
  font-family: var(--font-b);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

.dg-bg { position: fixed; inset: 0; z-index: -1; background: var(--bg); }
.dg-bg::after { content: ""; position: absolute; inset: 0; background: var(--overlay); }

.dg-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- Struttura ---------- */
.dg-main {
  flex: 1;
  width: 100%;
  max-width: 1100px;
  margin: 0 auto;
  padding: clamp(48px, 11vh, 120px) 20px clamp(36px, 7vh, 72px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.dg-brand { margin-bottom: clamp(30px, 6vh, 52px); }
.dg-logo { display: block; width: var(--logo-w); max-width: 58vw; height: auto; margin: 0 auto; }
.dg-title {
  margin: 0;
  font-family: var(--font-h);
  font-weight: var(--h-weight);
  font-size: clamp(34px, 8vw, 60px);
  line-height: 1.05;
  text-transform: var(--tt);
  letter-spacing: var(--ls);
}
.dg-tagline {
  margin: 18px 0 0;
  font: 500 12px/1.4 var(--font-b);
  letter-spacing: .24em;
  text-transform: uppercase;
  color: var(--text-soft);
}

.dg-links { width: 100%; display: flex; flex-direction: column; align-items: center; gap: var(--gap); }

/* ---------- Stile tipografico (come il sito attuale) ---------- */
.dg-link {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .45em;
  max-width: 100%;
  padding: .06em .12em;
  color: var(--text);
  text-decoration: none;
  font-family: var(--font-h);
  font-weight: var(--h-weight);
  font-size: var(--fs-d);
  line-height: 1.12;
  text-transform: var(--tt);
  letter-spacing: var(--ls);
  text-wrap: balance;
  -webkit-tap-highlight-color: transparent;
  transition: color .25s ease, transform .2s ease;
}
.dg-label { position: relative; display: inline-block; }
.dg-label::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -.06em;
  height: max(2px, .055em);
  background: currentColor;
  transform: scaleX(0);
  transition: transform .4s cubic-bezier(.2, .7, .2, 1);
}
.dg-link.is-hl { color: var(--accent); }
.dg-link:active { transform: scale(.97); }
.dg-link:focus-visible { outline: 2px solid var(--accent); outline-offset: 6px; border-radius: 4px; }
@media (hover: hover) {
  .dg-link:hover { color: var(--accent); }
  .dg-link:hover .dg-label::after { transform: scaleX(1); }
}

.dg-badge {
  flex: none;
  padding: .5em .75em;
  border-radius: 999px;
  background: var(--accent);
  color: var(--bg-color);
  font: 700 11px/1 var(--font-b);
  letter-spacing: .08em;
  text-transform: uppercase;
  white-space: nowrap;
}

@media (max-width: 640px) {
  .dg-link { font-size: min(var(--fs-m), 14vw); }
}

/* ---------- Stile a pulsanti ---------- */
.style-buttons .dg-links { max-width: 540px; }
.style-buttons .dg-link {
  width: 100%;
  padding: 1.05em 1.4em;
  border-radius: var(--radius);
  background: var(--btn-bg);
  color: var(--btn-text);
  font-size: clamp(15px, 4.4vw, 19px);
  letter-spacing: calc(var(--ls) * .5);
  box-shadow: 0 1px 0 rgba(0, 0, 0, .04), 0 12px 30px -14px rgba(0, 0, 0, .45);
  transition: transform .25s ease, box-shadow .25s ease, background .25s ease, color .25s ease;
}
.style-buttons .dg-label::after { display: none; }
.style-buttons .dg-link.is-hl { background: var(--accent); color: var(--bg-color); }
.style-buttons .dg-badge { background: var(--btn-text); color: var(--btn-bg); }
@media (hover: hover) {
  .style-buttons .dg-link:hover { color: var(--btn-text); transform: translateY(-2px); box-shadow: 0 1px 0 rgba(0, 0, 0, .04), 0 18px 36px -14px rgba(0, 0, 0, .5); }
  .style-buttons .dg-link.is-hl:hover { color: var(--bg-color); }
}

/* ---------- Footer ---------- */
.dg-foot {
  padding: 28px 20px calc(28px + env(safe-area-inset-bottom));
  text-align: center;
  font: 400 12px/1.65 var(--font-b);
  color: var(--text-soft);
}
.dg-legal { margin: 0 auto; max-width: 1100px; display: flex; flex-wrap: wrap; justify-content: center; }
.dg-legal + .dg-legal { margin-top: 2px; }
.dg-legal span:not(:last-child)::after { content: "|"; margin: 0 .6em; opacity: .55; }
.dg-meta { margin: 10px 0 0; display: flex; flex-wrap: wrap; justify-content: center; gap: 4px 18px; }
.dg-foot a,
.dg-linkbtn {
  color: inherit;
  text-decoration: underline;
  text-decoration-color: var(--text-faint);
  text-underline-offset: 3px;
}
.dg-linkbtn { padding: 0; border: 0; background: none; font: inherit; cursor: pointer; }
.dg-foot a:hover,
.dg-linkbtn:hover { color: var(--text); text-decoration-color: currentColor; }

@media (max-width: 640px) {
  .dg-foot { padding-bottom: calc(76px + env(safe-area-inset-bottom)); }
  .dg-legal { flex-direction: column; }
  .dg-legal span::after { display: none; }
}

/* ---------- Privacy: pulsante fluttuante, banner e preferenze ---------- */
.dg-fab {
  position: fixed;
  z-index: 45;
  left: 16px;
  bottom: calc(16px + env(safe-area-inset-bottom));
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: var(--text);
  color: var(--bg-color);
  box-shadow: 0 10px 28px -10px rgba(0, 0, 0, .5);
  cursor: pointer;
  opacity: .9;
  transition: transform .2s ease, opacity .2s ease;
}
.dg-fab:hover { transform: scale(1.07); opacity: 1; }
.dg-fab:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.dg-fab svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linejoin: round; }
.dg-fab svg circle { fill: currentColor; stroke: none; }
.dg-consent:not([hidden]) ~ .dg-fab, .has-consent-open .dg-fab { opacity: 0; pointer-events: none; }

.dg-consent {
  position: fixed;
  z-index: 50;
  left: 12px;
  right: 12px;
  bottom: calc(12px + env(safe-area-inset-bottom));
  max-width: 460px;
  max-height: calc(100vh - 24px);
  overflow-y: auto;
  margin: 0 auto;
  padding: 22px 20px 16px;
  border-radius: 20px;
  background: var(--text);
  color: var(--bg-color);
  font: 400 14px/1.5 var(--font-b);
  text-align: left;
  box-shadow: 0 24px 60px -20px rgba(0, 0, 0, .55);
  animation: dg-rise .45s cubic-bezier(.2, .7, .2, 1) both;
}
.dg-consent[hidden] { display: none; }
@media (min-width: 720px) { .dg-consent { left: 24px; right: auto; bottom: 24px; } }
.dg-consent-title { margin: 0 32px 6px 0; font: 700 16px/1.3 var(--font-b); }
.dg-consent-text { margin: 0 0 4px; opacity: .88; }
.dg-consent a { color: inherit; text-underline-offset: 2px; }
.dg-consent-x { position: absolute; top: 8px; right: 10px; width: 36px; height: 36px; padding: 0; border: 0; border-radius: 50%; background: none; color: inherit; font-size: 24px; line-height: 1; opacity: .6; cursor: pointer; }
.dg-consent-x:hover { opacity: 1; }
.dg-consent-actions { display: flex; gap: 8px; margin-top: 16px; }
/* Accetta e rifiuta con la stessa evidenza (Linee guida Garante 2021) */
.dg-consent-actions button {
  flex: 1;
  min-height: 42px;
  padding: 10px;
  border: 1.5px solid currentColor;
  border-radius: 999px;
  background: transparent;
  color: inherit;
  font: 600 13px/1.1 var(--font-b);
  cursor: pointer;
  transition: background .15s, color .15s;
}
.dg-consent-actions button:hover { background: var(--bg-color); border-color: var(--bg-color); color: var(--text); }
.dg-consent button:focus-visible { outline: 2px solid currentColor; outline-offset: 2px; }
.dg-consent:focus { outline: none; }

/* Finestra preferenze (stile Iubenda): categorie necessarie e facoltative con dettaglio strumenti */
.dg-modal { position: fixed; inset: 0; z-index: 60; display: flex; align-items: center; justify-content: center; padding: 24px; }
.dg-modal[hidden] { display: none; }
.dg-modal-backdrop { position: absolute; inset: 0; background: rgba(10, 10, 12, .55); -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px); animation: dg-fade .25s both; }
.dg-modal-box {
  position: relative;
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 620px;
  max-height: min(780px, calc(100vh - 48px));
  overflow: hidden;
  border-radius: 22px;
  background: #fff;
  color: #1b1b1f;
  font: 400 14.5px/1.55 var(--font-b);
  text-align: left;
  box-shadow: 0 30px 80px -20px rgba(0, 0, 0, .55);
  animation: dg-pop .3s cubic-bezier(.2, .7, .2, 1) both;
}
.dg-modal-box:focus { outline: none; }
.dg-modal a { color: inherit; text-underline-offset: 2px; }
.dg-modal-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 20px 22px 14px; border-bottom: 1px solid #ececee; }
.dg-modal-title { margin: 0; font: 700 18px/1.25 var(--font-b); }
.dg-modal-x { display: grid; place-items: center; width: 36px; height: 36px; flex: none; padding: 0; border: 0; border-radius: 50%; background: #f2f2f4; color: #1b1b1f; font-size: 22px; line-height: 1; cursor: pointer; }
.dg-modal-x:hover { background: #e6e6ea; }
.dg-modal-body { flex: 1; overflow-y: auto; overscroll-behavior: contain; padding: 18px 22px 6px; }
.dg-modal-intro { margin: 0 0 6px; color: #55555c; font-size: 13.5px; }

.dg-purpose { padding: 16px 0; border-top: 1px solid #ececee; }
.dg-modal-intro + .dg-purpose { border-top: 0; }
.dg-purpose-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.dg-purpose-name { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.dg-purpose-name strong { font-size: 15.5px; }
.is-empty .dg-purpose-name strong { color: #8a8a92; }
.dg-tag { padding: 3px 9px; border-radius: 999px; background: var(--ui-accent); color: #fff; font-size: 11.5px; font-weight: 700; letter-spacing: .02em; }
.dg-tag.is-muted { background: #f0f0f2; color: #55555c; }
.dg-purpose-desc { margin: 6px 0 0; color: #55555c; font-size: 13.5px; }
.dg-purpose-none { margin: 8px 0 0; color: #8a8a92; font-size: 12.5px; font-style: italic; }

.dg-vendors { margin-top: 10px; }
.dg-vendors summary { display: inline-flex; align-items: center; gap: 8px; color: var(--ui-accent); font-size: 13px; font-weight: 700; list-style: none; cursor: pointer; }
.dg-vendors summary::-webkit-details-marker { display: none; }
.dg-vendors summary::after { content: ""; width: 6px; height: 6px; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: translateY(-2px) rotate(45deg); transition: transform .2s; }
.dg-vendors[open] summary::after { transform: translateY(1px) rotate(-135deg); }
.dg-vendors summary:focus-visible { outline: 2px solid var(--ui-accent); outline-offset: 3px; border-radius: 4px; }
.dg-vendors ul { display: grid; gap: 8px; margin: 10px 0 0; padding: 0; list-style: none; }
.dg-vendor { padding: 12px 14px; border-radius: 12px; background: #f6f6f7; }
.dg-vendor-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 2px 12px; margin-bottom: 6px; }
.dg-vendor-head span { color: #6b6b73; font-size: 12.5px; }
.dg-vendor dl { display: grid; grid-template-columns: max-content 1fr; gap: 3px 12px; margin: 0 0 6px; font-size: 12.5px; }
.dg-vendor dt { color: #6b6b73; }
.dg-vendor dd { margin: 0; }
.dg-vendor a { font-size: 12.5px; font-weight: 600; }

.dg-switch { position: relative; flex: none; }
.dg-switch input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
.dg-switch i { display: block; position: relative; width: 44px; height: 26px; border-radius: 999px; background: #d4d4d9; transition: background .2s; pointer-events: none; }
.dg-switch i::after { content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .25); transition: transform .2s; }
.dg-switch input:checked + i { background: var(--ui-accent); }
.dg-switch input:checked + i::after { transform: translateX(18px); }
.dg-switch input:focus-visible + i { outline: 2px solid var(--ui-accent); outline-offset: 2px; }
.dg-switch.is-locked { opacity: .5; }
.dg-switch.is-locked input { cursor: not-allowed; }

.dg-modal-foot { padding: 14px 22px calc(16px + env(safe-area-inset-bottom)); border-top: 1px solid #ececee; }
.dg-consent-id { margin: 0 0 10px; color: #8a8a92; font-size: 11.5px; }
.dg-consent-id[hidden] { display: none; }
.dg-consent-id code { font-size: 11.5px; }
/* I tre pulsanti hanno la stessa evidenza */
.dg-modal-actions { display: flex; gap: 8px; }
.dg-modal-actions button {
  flex: 1;
  min-height: 46px;
  padding: 10px 12px;
  border: 0;
  border-radius: 999px;
  background: var(--ui-accent);
  color: #fff;
  font: 700 13.5px/1.15 var(--font-b);
  cursor: pointer;
  transition: filter .15s ease, transform .1s ease;
}
.dg-modal-actions button:hover { filter: brightness(.9); }
.dg-modal-actions button:active { transform: scale(.98); }
.dg-modal-actions button:focus-visible { outline: 2px solid var(--ui-accent); outline-offset: 3px; }

@keyframes dg-pop { from { opacity: 0; transform: translateY(12px) scale(.98); } to { opacity: 1; transform: none; } }
@keyframes dg-sheet { from { transform: translateY(100%); } to { transform: none; } }

@media (max-width: 640px) {
  .dg-modal { padding: 0; align-items: flex-end; }
  .dg-modal-box { max-width: none; max-height: 92vh; max-height: 92dvh; border-radius: 22px 22px 0 0; animation: dg-sheet .32s cubic-bezier(.2, .7, .2, 1) both; }
  .dg-modal-head { padding: 18px 18px 12px; }
  .dg-modal-body { padding: 14px 18px 4px; }
  .dg-modal-foot { padding: 12px 18px calc(14px + env(safe-area-inset-bottom)); }
  .dg-modal-actions { display: grid; grid-template-columns: 1fr 1fr; }
  .dg-modal-actions button:only-child, .dg-modal-actions [data-consent="save"] { grid-column: 1 / -1; }
}

/* ---------- Pagine legali ---------- */
.dg-page { width: 100%; max-width: 760px; margin: 0 auto; padding: 36px 22px 90px; }
.dg-back { display: inline-flex; align-items: center; gap: 14px; color: var(--text-soft); text-decoration: none; font: 500 14px var(--font-b); }
.dg-back:hover { color: var(--text); }
.dg-back img { width: 56px; height: auto; }
.dg-page h1 {
  margin: 40px 0 24px;
  font-family: var(--font-h);
  font-weight: var(--h-weight);
  font-size: clamp(28px, 6vw, 44px);
  line-height: 1.1;
  text-transform: var(--tt);
  letter-spacing: var(--ls);
}
.dg-prose { font: 400 16px/1.7 var(--font-b); }
.dg-prose h2 { margin: 2em 0 .5em; font: 650 19px/1.3 var(--font-b); }
.dg-prose a { color: inherit; }
.dg-prose ul { padding-left: 1.2em; }
.dg-prose li { margin-bottom: .5em; }
.dg-prose code { font-size: .9em; }
.dg-updated { margin: -12px 0 18px; color: var(--text-soft); font-size: 13px; }
.dg-doc-nav { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 28px; }
.dg-doc-nav a { padding: 7px 14px; border: 1px solid var(--text-faint); border-radius: 999px; color: var(--text); text-decoration: none; font: 600 13px/1 var(--font-b); }
.dg-doc-nav a[aria-current] { background: var(--text); color: var(--bg-color); border-color: var(--text); }
.dg-table { overflow-x: auto; margin: 0 0 1em; border: 1px solid var(--text-faint); border-radius: 12px; }
.dg-table table { width: 100%; border-collapse: collapse; font-size: 14px; line-height: 1.45; }
.dg-table th, .dg-table td { padding: 10px 12px; text-align: left; vertical-align: top; border-bottom: 1px solid var(--text-faint); }
.dg-table th { font-weight: 650; font-size: 12.5px; text-transform: uppercase; letter-spacing: .04em; color: var(--text-soft); }
.dg-table tr:last-child td { border-bottom: 0; }
.dg-btn-inline, .dg-prose .dg-linkbtn { padding: 0; border: 0; background: none; color: inherit; font: inherit; font-weight: 650; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
.dg-doc .dg-foot { padding-bottom: calc(80px + env(safe-area-inset-bottom)); }

/* ---------- Animazioni ---------- */
@keyframes dg-rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
@keyframes dg-fade { from { opacity: 0; } to { opacity: 1; } }

/* "backwards": dopo l'entrata hover e tocco tornano a funzionare */
.is-animated .dg-brand { animation: dg-rise .8s cubic-bezier(.2, .7, .2, 1) backwards; }
.is-animated .dg-link { animation: dg-rise .7s cubic-bezier(.2, .7, .2, 1) backwards; animation-delay: calc(140ms + var(--i) * 70ms); }
.is-animated .dg-foot { animation: dg-fade 1s .5s backwards; }
.is-preview * { animation: none !important; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
