/* =========================================================
   Pagine legali autonome (privacy.html, cookie.html)
   Stesso aspetto delle vecchie finestre del sito: riusa le
   regole .policy-body di privacy-cookies.css e i colori di style.css.
   ========================================================= */
body.policy-page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background-color: #ebedf0;
  background-image:
    linear-gradient(rgba(0, 0, 0, 0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0, 0, 0, 0.05) 1px, transparent 1px);
  background-size: 10vw 10vh;
  background-attachment: fixed;
}

.policy-header {
  position: sticky; top: 0; z-index: 10;
  background: rgba(240, 242, 246, 0.85);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
}
.policy-header-inner {
  max-width: 920px; margin: 0 auto;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 12px 16px;
}
.policy-logo img { height: 36px; width: auto; }
.policy-tools { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; justify-content: flex-end; }
.policy-lang[hidden] { display: none; }
.policy-back {
  display: inline-flex; align-items: center;
  padding: 9px 16px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-pill);
  font-size: 13px; font-weight: 500;
  white-space: nowrap;
  transition: background 0.2s, color 0.2s, border-color 0.2s;
}
.policy-back:hover { background: var(--text-0); color: #fff; border-color: var(--text-0); }

.policy-main {
  flex: 1;
  width: 100%; max-width: 920px;
  margin: 0 auto;
  padding: 32px 16px 56px;
}
.policy-main:focus { outline: none; }

.policy-card {
  background: rgba(240, 242, 246, 0.95);
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: var(--radius-lg);
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.12), inset 0 1px 0 rgba(255, 255, 255, 0.5);
  padding: 48px 44px 40px;
}
.policy-page .policy-body h1 {
  font-size: clamp(1.6rem, 4vw, 2.2rem);
  margin-bottom: 8px;
  color: var(--text-0);
}
.policy-page .policy-body h2 {
  font-size: 1.15rem;
  letter-spacing: -0.02em;
  margin-top: 30px;
  margin-bottom: 10px;
  color: var(--text-0);
}
.policy-page .policy-body .policy-intro { font-size: 15px; }
.policy-page .policy-body .policy-note {
  padding: 14px 16px;
  border-left: 3px solid var(--accent-green);
  background: var(--accent-green-soft);
  border-radius: var(--radius-sm);
}
.policy-page .policy-body a { color: var(--accent-green-text); }
.policy-page .policy-body code {
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 12px;
  white-space: nowrap;
}
@media (max-width: 720px) {
  .policy-page .policy-body code { white-space: normal; word-break: break-all; }
}

/* Tabelle: finalita -> dati -> base giuridica -> conservazione */
.policy-table-wrap { margin: 6px 0 18px; }
.policy-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  line-height: 1.55;
  color: var(--text-1);
}
.policy-table th,
.policy-table td {
  text-align: left;
  vertical-align: top;
  padding: 12px 12px;
  border-bottom: 1px solid var(--border-strong);
}
.policy-table thead th {
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-2);
  border-bottom-width: 2px;
}
.policy-table tbody th { font-weight: 500; color: var(--text-0); }
.policy-table--4 tbody th { width: 24%; }

/* Su schermi stretti ogni riga diventa una scheda: niente scorrimento orizzontale */
@media (max-width: 720px) {
  .policy-card { padding: 30px 18px 26px; border-radius: var(--radius-md); }
  .policy-table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .policy-table, .policy-table tbody, .policy-table tr, .policy-table th, .policy-table td { display: block; width: 100% !important; }
  .policy-table tr {
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-md);
    padding: 6px 14px;
    margin-bottom: 12px;
    background: rgba(255, 255, 255, 0.45);
  }
  .policy-table th, .policy-table td { border-bottom: 1px solid var(--border); padding: 9px 0; }
  .policy-table tr > :last-child { border-bottom: none; }
  .policy-table [data-label]::before {
    content: attr(data-label);
    display: block;
    font-family: 'JetBrains Mono', ui-monospace, monospace;
    font-size: 10px; font-weight: 500;
    letter-spacing: 0.12em; text-transform: uppercase;
    color: var(--text-2);
    margin-bottom: 3px;
  }
}

.policy-footer {
  text-align: center;
  padding: 0 16px 32px;
  color: var(--text-2);
  font-size: 12px;
}
.policy-footer a { text-decoration: underline; text-underline-offset: 2px; }
.policy-footer a[aria-current="page"] { text-decoration: none; font-weight: 600; color: var(--text-0); }

/* Tema scuro (scelto sul sito, letto da policy-page.js) */
body.dark-theme.policy-page {
  background-color: #141620;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.035) 1px, transparent 1px);
  color: #f0f2f5;
}
body.dark-theme .policy-header { background: rgba(13, 15, 19, 0.92); border-color: rgba(255, 255, 255, 0.08); }
body.dark-theme .policy-back { border-color: rgba(255, 255, 255, 0.2); color: #f0f2f5; }
body.dark-theme .policy-back:hover { background: var(--accent-red); border-color: var(--accent-red); }
body.dark-theme .policy-card { background: rgba(20, 22, 28, 0.97); border-color: rgba(255, 255, 255, 0.1); }
body.dark-theme.policy-page .policy-body h1 { color: #f0f2f5; }
body.dark-theme .policy-body a { color: #3ecf7a; }
body.dark-theme .policy-table,
body.dark-theme .policy-table td { color: #b8bcc4; }
body.dark-theme .policy-table tbody th { color: #f0f2f5; }
body.dark-theme .policy-table th,
body.dark-theme .policy-table td { border-color: rgba(255, 255, 255, 0.12); }
body.dark-theme .policy-footer { color: #7a7f8a; }
body.dark-theme .policy-footer a[aria-current="page"] { color: #f0f2f5; }
@media (max-width: 720px) {
  body.dark-theme .policy-table tr { background: rgba(255, 255, 255, 0.03); border-color: rgba(255, 255, 255, 0.12); }
}

[dir="rtl"] .policy-table th,
[dir="rtl"] .policy-table td { text-align: right; }
[dir="rtl"] .policy-page .policy-body .policy-note { border-left: none; border-right: 3px solid var(--accent-green); }
