/*
 * Check&Love — pagine secondarie: Codice etico, Termini Privacy e Cookie,
 * Tutela dei minori, Crediti. Si appoggia a concept.css (token, header, footer).
 */

/* ---------- barra di lettura (come negli articoli) ---------- */
.read-progress { position: fixed; left: 0; right: 0; top: 0; height: 4px; z-index: 80; pointer-events: none; }
.read-progress i { display: block; height: 100%; background: linear-gradient(90deg, var(--brand), var(--brand-dark)); transform-origin: left; transform: scaleX(var(--p, 0)); }
@supports (animation-timeline: scroll()) {
  .read-progress i { animation: progress linear both; animation-timeline: scroll(root); }
  @keyframes progress { from { transform: scaleX(0); } to { transform: scaleX(1); } }
}

/* ---------- apertura ---------- */
.doc-hero { padding-block: 32px 56px; }
.doc-hero .inner { max-width: 900px; display: grid; grid-template-columns: minmax(0, 1fr); gap: 22px; justify-items: start; }
.doc-hero.center .inner { margin-inline: auto; justify-items: center; text-align: center; }
.doc-hero .display-2 .line { display: block; overflow: clip; padding-bottom: .06em; }
.doc-hero .display-2 .line > span { display: inline-block; animation: rise 1s var(--ease-out) both; }
.doc-hero .display-2 .line:nth-child(2) > span { animation-delay: .1s; }
.doc-hero .lead, .doc-hero .intro, .doc-hero .actions { animation: fade-up .9s .3s var(--ease-out) both; }
.doc-hero .intro { font-size: clamp(18px, 1.5vw, 20px); color: var(--text-body); max-width: 40em; display: grid; gap: 14px; }
.doc-hero .intro a, .notice a, .doc-prose a { color: var(--brand-dark); font-weight: 700; }
.doc-hero .actions { display: flex; flex-wrap: wrap; gap: 12px; }

/* box dell'intestazione di Termini (traducibile in tutte le lingue) */
.notice { position: relative; border-radius: var(--radius); background: var(--brand-soft); padding: clamp(24px, 3.4vw, 36px); display: grid; gap: 14px; font-size: 18px; color: var(--text-body); max-width: min(46em, 100%); }
.notice::before { content: ""; position: absolute; left: clamp(24px, 3.4vw, 36px); top: -9px; width: 18px; height: 18px; border-radius: 50%; background: var(--brand); box-shadow: 0 0 0 6px var(--sand); }
.notice .lang-tag { display: inline-flex; align-items: center; gap: 8px; justify-self: start; padding: 6px 12px; border-radius: 999px; background: var(--white); font-size: 13px; font-weight: 700; color: var(--brand-dark); }

/* ---------- colonna di lettura con indice ---------- */
.doc-layout { display: grid; grid-template-columns: minmax(0, 1fr); gap: 32px; padding-block: 16px clamp(80px, 10vw, 120px); }
@media (min-width: 1020px) { .doc-layout { grid-template-columns: 280px minmax(0, 1fr); gap: 64px; align-items: start; } }

.toc { border-radius: var(--radius-sm); background: var(--white); box-shadow: var(--shadow); }
@media (min-width: 1020px) { .toc { position: sticky; top: 92px; max-height: calc(100vh - 120px); display: flex; flex-direction: column; } }
.toc summary { list-style: none; cursor: pointer; padding: 18px 22px; font-weight: 700; display: flex; justify-content: space-between; align-items: center; }
.toc summary::-webkit-details-marker { display: none; }
.toc summary::after { content: "▾"; font-size: 12px; transition: rotate .3s var(--ease-out); }
.toc[open] summary::after { rotate: 180deg; }
@media (min-width: 1020px) { .toc summary { pointer-events: none; } .toc summary::after { display: none; } }
.toc nav { position: relative; overflow-y: auto; padding: 0 12px 16px; overscroll-behavior: contain; }
.toc ol { list-style: none; margin: 0; padding: 0; }
.toc .part > a { display: block; margin-top: 10px; padding: 8px 10px; border-radius: 10px; font-size: 12px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--brand-dark); text-decoration: none; }
.toc .part ol a { display: grid; grid-template-columns: 26px 1fr; gap: 4px; padding: 6px 10px; border-radius: 10px; font-size: 14px; line-height: 1.3; color: var(--text-muted); text-decoration: none; transition: background .2s, color .2s; }
.toc .part ol a b { font-weight: 700; color: var(--text); }
.toc a { transition: background-color .25s; }
.toc a:hover { background: var(--sand); }
.toc a[aria-current] { background: var(--brand-soft); color: var(--text); }

/* ---------- testo lungo ---------- */
.doc-prose { max-width: 72ch; font-size: 17px; line-height: 1.7; color: var(--text-body); display: grid; gap: 16px; }
.doc-prose h2 { font-family: var(--font-display); font-size: clamp(30px, 3.4vw, 42px); line-height: 1.02; margin-top: 32px; scroll-margin-top: 96px; }
.doc-prose h2:first-child { margin-top: 0; }
.doc-prose h3 { font-size: 19px; line-height: 1.3; margin-top: 20px; color: var(--text); scroll-margin-top: 96px; }
.doc-prose ol { margin: 6px 0 0; padding-left: 1.6em; display: grid; gap: 8px; }
.doc-prose ol ol { margin-top: 8px; }
.doc-prose li::marker { color: var(--brand-dark); font-weight: 700; }
.doc-prose .text-bold { font-weight: 700; color: var(--text); }
.doc-prose a { overflow-wrap: anywhere; }

/* contratto: sempre in inglese e da sinistra a destra, in ogni lingua */
.contract { direction: ltr; text-align: left; }
.contract .part-title { display: flex; align-items: center; gap: 14px; padding-top: 32px; border-top: 1px solid var(--sand-3); }
.contract .part-title:first-child { padding-top: 0; border-top: 0; }
.contract .part-title::before { content: ""; width: 14px; height: 14px; border-radius: 50%; background: var(--brand); flex: none; }

/* torna su */
.to-top { position: fixed; right: max(20px, env(safe-area-inset-right, 0px)); bottom: calc(24px + env(safe-area-inset-bottom, 0px)); z-index: 40; width: 48px; height: 48px; border: 0; border-radius: 50%; background: var(--ink); color: var(--white); font-size: 20px; box-shadow: var(--shadow); opacity: 0; translate: 0 16px; pointer-events: none; transition: opacity .3s, translate .4s var(--ease-spring), background .2s; }
.to-top.show { opacity: 1; translate: 0 0; pointer-events: auto; }
.to-top:hover { background: var(--brand-dark); }
@media (max-width: 1019px) { .to-top { bottom: calc(88px + env(safe-area-inset-bottom, 0px)); } }

/* ---------- Codice etico ---------- */
.ethics-intro { max-width: 46em; font-size: clamp(19px, 1.7vw, 22px); line-height: 1.55; color: var(--text); font-weight: 500; }
.value { background: var(--white); border-radius: var(--radius); padding: clamp(24px, 3vw, 36px); display: grid; gap: 12px; align-content: start; position: relative; overflow: hidden; transition: translate .5s var(--ease-out), box-shadow .5s var(--ease-out); }
.section-white .value { background: var(--sand); }
.value:hover { translate: 0 -6px; box-shadow: var(--shadow); }
.value .badge-ico { width: 52px; height: 52px; border-radius: 16px; display: grid; place-items: center; background: var(--brand-soft); color: var(--brand-dark); font-size: 22px; }
.value h3 { font-family: var(--font-display); font-size: clamp(28px, 2.6vw, 36px); line-height: 1; }
.value p { color: var(--text-body); font-size: 17px; max-width: 34em; padding-right: 48px; }
.value .initial { position: absolute; right: -4px; bottom: -36px; font-family: var(--font-display); font-size: 140px; line-height: 1; color: var(--brand-soft); z-index: 0; pointer-events: none; }
.section-white .value .initial { color: var(--sand-3); }
.value > :not(.initial) { position: relative; z-index: 1; }

.rules { list-style: none; margin: 0; padding: 0; display: grid; gap: 14px; counter-reset: rule; }
@media (min-width: 860px) { .rules { grid-template-columns: repeat(2, 1fr); gap: 18px; } }
.rule { counter-increment: rule; display: grid; grid-template-columns: 56px 1fr; gap: 6px 18px; padding: 24px; border-radius: var(--radius-sm); background: var(--white); align-content: start; }
.rule::before { content: counter(rule, decimal-leading-zero); grid-row: span 2; font-family: var(--font-display); font-size: 40px; line-height: 1; color: var(--brand); }
.rule h3 { font-size: 19px; line-height: 1.25; }
.rule p { color: var(--text-body); font-size: 16.5px; }

.ethics-pair { display: grid; gap: 18px; }
@media (min-width: 960px) { .ethics-pair { grid-template-columns: 1.25fr 1fr; align-items: stretch; } }
.ethics-stack { display: grid; gap: 18px; }
.ethics-card { border-radius: var(--radius); background: var(--sand); padding: clamp(24px, 3vw, 36px); display: grid; gap: 14px; align-content: start; }
.ethics-card .badge-ico { width: 52px; height: 52px; border-radius: 16px; display: grid; place-items: center; background: var(--white); color: var(--brand-dark); font-size: 22px; }
.ethics-card h2 { font-family: var(--font-display); font-size: clamp(28px, 3vw, 38px); line-height: 1.02; }
.ethics-card p { color: var(--text-body); }
.ethics-card a { color: var(--brand-dark); font-weight: 700; }
.ethics-card.big { background: var(--brand-soft); }

.ethics-close { padding: clamp(40px, 7vw, 96px) clamp(24px, 6vw, 80px); display: grid; gap: 24px; justify-items: center; text-align: center; }
.ethics-close h2 { font-family: var(--font-display); font-size: clamp(36px, 5vw, 64px); line-height: 1; }
.ethics-close p { max-width: 40em; font-size: 18px; }
.ethics-close .final { font-family: var(--font-display); font-size: clamp(26px, 3.2vw, 40px); line-height: 1.12; color: var(--white); max-width: 20em; text-wrap: balance; }
.ethics-close .final em { font-style: normal; color: var(--brand); }

/* ---------- Tutela dei minori ---------- */
.safe-grid { display: grid; gap: 18px; }
@media (min-width: 860px) { .safe-grid { grid-template-columns: repeat(3, 1fr); } }
.safe-org { border-radius: var(--radius-sm); background: var(--white); padding: 22px; display: grid; gap: 8px; align-content: start; font-size: 16px; }
.safe-org b { color: var(--text); font-size: 17px; }

/* ---------- Crediti ---------- */
.credits { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 200px), 1fr)); }
.credits li { display: flex; }
.credits a { flex: 1; display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 16px 20px; border-radius: 16px; background: var(--white); font-weight: 700; font-size: 17px; text-decoration: none; color: var(--text); transition: background .25s, color .25s, transform .4s var(--ease-spring); }
.credits a::after { content: "↗"; font-weight: 400; color: var(--text-muted); transition: transform .3s var(--ease-spring), color .25s; }
.credits a:hover { background: var(--ink); color: var(--white); transform: translateY(-3px); }
.credits a:hover::after { color: var(--brand); transform: translate(2px, -2px); }
.signature { margin-top: clamp(56px, 8vw, 96px); padding-top: 32px; border-top: 1px solid var(--sand-3); display: flex; flex-wrap: wrap; justify-content: center; gap: 10px 40px; font-size: 17px; color: var(--text-muted); }
.signature a { color: var(--text); font-weight: 700; text-decoration: none; background: linear-gradient(var(--brand), var(--brand)) left bottom / 0 2px no-repeat; transition: background-size .35s var(--ease-out); }
.signature a:hover { background-size: 100% 2px; }
.signature .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--brand); align-self: center; }

/* ---------- destra-sinistra (arabo): il contratto resta LTR ---------- */
[dir="rtl"] .toc .part ol a { text-align: right; }
