/*
  Styling for the generated legal pages (privacy.html, termini.html).

  Deliberately self-contained: no webfonts, no CDN, no analytics. A privacy
  notice that phones a third party while being read is a contradiction, and
  these pages must stay readable even if everything external is blocked.

  The documents are table-heavy (legal bases, processors, retention periods),
  so most of the work below is making tables survive a phone screen.
*/

:root {
    --ink: #1E2C59;
    --body: #26324f;
    --muted: #5c6683;
    --rule: #dde2ee;
    --bg: #ffffff;
    --bg-soft: #f6f8fc;
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
    margin: 0;
    padding: 2.5rem 1.5rem 5rem;
    background: var(--bg);
    color: var(--body);
    font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto,
                 "Helvetica Neue", Arial, sans-serif;
    font-size: 1rem;
    line-height: 1.7;
    -webkit-font-smoothing: antialiased;
}

main, .page { max-width: 52rem; margin-inline: auto; }

/* ---- Masthead ------------------------------------------------------- */

.site-header {
    max-width: 52rem;
    margin: 0 auto 2.5rem;
    padding-bottom: 1.25rem;
    border-bottom: 1px solid var(--rule);
}

.site-header a {
    color: var(--ink);
    font-weight: 700;
    letter-spacing: 0.06em;
    text-decoration: none;
    font-size: 0.95rem;
}

/* ---- Headings ------------------------------------------------------- */

h1, h2, h3, h4 {
    color: var(--ink);
    line-height: 1.25;
    margin: 2.75rem 0 0.75rem;
    font-weight: 700;
}

h1 { font-size: 2rem; margin-top: 0; letter-spacing: -0.01em; }
h2 { font-size: 1.35rem; padding-top: 0.5rem; }
h3 { font-size: 1.08rem; color: var(--body); }
h4 { font-size: 1rem; color: var(--muted); }

h1 + h3 {
    margin-top: 0.5rem;
    font-weight: 400;
    color: var(--muted);
    font-size: 1rem;
}

p { margin: 0 0 1rem; }

/* ---- Lists ---------------------------------------------------------- */

ul, ol { margin: 0 0 1.25rem; padding-left: 1.35rem; }
li { margin-bottom: 0.45rem; }
li > ul, li > ol { margin-top: 0.45rem; margin-bottom: 0.35rem; }

/* ---- Tables --------------------------------------------------------- */

/*
  Wrapped in .table-scroll by the generator. The retention and legal-basis
  tables are far too wide for a phone, and letting the page itself scroll
  sideways makes the whole document feel broken.
*/
.table-scroll {
    overflow-x: auto;
    margin: 0 0 1.5rem;
    border: 1px solid var(--rule);
    border-radius: 8px;
    -webkit-overflow-scrolling: touch;
}

table {
    border-collapse: collapse;
    width: 100%;
    min-width: 34rem;
    font-size: 0.9rem;
    line-height: 1.55;
}

thead th {
    background: var(--bg-soft);
    color: var(--ink);
    text-align: left;
    font-weight: 700;
    white-space: nowrap;
}

th, td {
    padding: 0.7rem 0.9rem;
    border-bottom: 1px solid var(--rule);
    vertical-align: top;
}

tbody tr:last-child td { border-bottom: 0; }

/* ---- Blockquotes ---------------------------------------------------- */

/*
  Carries the "functionality not yet active" notices. They need to read as
  set apart from the operative text, not as ordinary prose.
*/
blockquote {
    margin: 0 0 1.5rem;
    padding: 0.9rem 1.1rem;
    background: var(--bg-soft);
    border-left: 3px solid var(--ink);
    border-radius: 0 6px 6px 0;
    color: var(--body);
}

blockquote p:last-child { margin-bottom: 0; }

/* ---- Inline ---------------------------------------------------------- */

a { color: var(--ink); text-decoration: underline; text-underline-offset: 2px; }
a:hover, a:focus-visible { text-decoration-thickness: 2px; }

strong { color: var(--ink); font-weight: 700; }

code {
    background: var(--bg-soft);
    border: 1px solid var(--rule);
    border-radius: 4px;
    padding: 0.1em 0.35em;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 0.88em;
}

hr { border: 0; border-top: 1px solid var(--rule); margin: 2.5rem 0; }

/* ---- Footer --------------------------------------------------------- */

.site-footer {
    max-width: 52rem;
    margin: 3.5rem auto 0;
    padding-top: 1.25rem;
    border-top: 1px solid var(--rule);
    color: var(--muted);
    font-size: 0.85rem;
}

.site-footer a { color: var(--muted); }

/* ---- Print ----------------------------------------------------------- */

/*
  Users are entitled to keep a copy of the notice, and the Garante may ask
  for one. Printing must not lose the tables.
*/
@media print {
    body { padding: 0; font-size: 11pt; }
    .site-header, .site-footer { border-color: #ccc; }
    .table-scroll { overflow: visible; border-color: #ccc; }
    table { min-width: 0; font-size: 9.5pt; }
    thead { display: table-header-group; }
    tr, blockquote { break-inside: avoid; }
    a { text-decoration: none; }
}

@media (max-width: 640px) {
    body { padding: 2rem 1.1rem 4rem; }
    h1 { font-size: 1.6rem; }
    h2 { font-size: 1.2rem; }
}
