/* ═══════════════════════════════════════════════════════════════════
   sercontino.com – foglio di stile principale
   Palette ricavata dal logo, contrasti verificati WCAG 2.1 AA/AAA:
     Inchiostro  #282728  su avorio 14,1:1
     Bordeaux    #733646  su avorio  8,5:1 · bianco su bordeaux 9,0:1
     Bronzo      #A76F45  solo decorativo / bordi (3,96:1)
     Bronzo testo #85532C su avorio  6,1:1
   ═══════════════════════════════════════════════════════════════════ */

@font-face { font-family: "Atkinson Hyperlegible"; font-style: normal; font-weight: 400; font-display: swap; src: url("../fonts/atkinson-hyperlegible-latin-400-normal.woff2") format("woff2"); }
@font-face { font-family: "Atkinson Hyperlegible"; font-style: italic; font-weight: 400; font-display: swap; src: url("../fonts/atkinson-hyperlegible-latin-400-italic.woff2") format("woff2"); }
@font-face { font-family: "Atkinson Hyperlegible"; font-style: normal; font-weight: 700; font-display: swap; src: url("../fonts/atkinson-hyperlegible-latin-700-normal.woff2") format("woff2"); }
@font-face { font-family: "Atkinson Hyperlegible"; font-style: italic; font-weight: 700; font-display: swap; src: url("../fonts/atkinson-hyperlegible-latin-700-italic.woff2") format("woff2"); }
@font-face { font-family: "Alegreya"; font-style: normal; font-weight: 500; font-display: swap; src: url("../fonts/alegreya-latin-500-normal.woff2") format("woff2"); }
@font-face { font-family: "Alegreya"; font-style: italic; font-weight: 500; font-display: swap; src: url("../fonts/alegreya-latin-500-italic.woff2") format("woff2"); }
@font-face { font-family: "Alegreya"; font-style: normal; font-weight: 600; font-display: swap; src: url("../fonts/alegreya-latin-600-normal.woff2") format("woff2"); }

:root {
  --ink: #282728;
  --ink-soft: #5A5254;
  --bordeaux: #733646;
  --bordeaux-dark: #5C2836;
  --bordeaux-tint: #F4E9EC;
  --bronze: #A76F45;
  --bronze-text: #85532C;
  --bronze-tint: #F3ECE4;
  --ivory: #FBF8F4;
  --white: #FFFFFF;
  --line: #8C7B70;        /* bordi dei campi: 3,8:1 */
  --line-soft: #E4D9CE;   /* separatori decorativi */
  --error: #A1282E;       /* 6,6:1 su bianco */
  --error-tint: #FBECEC;
  --success: #2D6A3E;     /* 6,5:1 su bianco */
  --success-tint: #EAF4EC;
  --warning: #7A5200;
  --warning-tint: #FBF3E0;
  --focus: #282728;

  --font: "Atkinson Hyperlegible", "Segoe UI", Verdana, system-ui, sans-serif;
  --font-title: "Alegreya", Georgia, "Times New Roman", serif;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(40, 39, 40, .06), 0 6px 20px rgba(40, 39, 40, .06);
  --wrap: 72rem;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  display: flex; flex-direction: column;
  font-family: var(--font);
  font-size: 1.125rem;          /* 18 px */
  line-height: 1.65;
  color: var(--ink);
  background: var(--ivory);
}
main { flex: 1 0 auto; }
main:focus { outline: none; }
img, video, iframe { max-width: 100%; }
img { height: auto; }

h1, h2, h3, h4 { font-family: var(--font-title); font-weight: 600; line-height: 1.2; color: var(--ink); margin: 1.6em 0 .5em; }
h1 { font-size: clamp(1.9rem, 1.4rem + 2vw, 2.6rem); margin-top: .4em; color: var(--bordeaux-dark); }
h1::after { content: ""; display: block; width: 3.5rem; height: 3px; margin-top: .45em; border-radius: 3px; background: var(--bronze); }
h2 { font-size: clamp(1.45rem, 1.2rem + 1vw, 1.8rem); }
h3 { font-size: 1.3rem; }
p, ul, ol, dl, blockquote { margin: 0 0 1em; }
strong { font-weight: 700; }

a { color: var(--bordeaux); text-decoration: underline; text-decoration-thickness: .08em; text-underline-offset: .18em; }
a:hover { color: var(--bordeaux-dark); text-decoration-thickness: .16em; }

/* Focus ben visibile per la navigazione da tastiera (WCAG 2.4.7 / 2.4.11) */
:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; border-radius: 4px; }
.btn:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 3px solid var(--focus); outline-offset: 3px; box-shadow: 0 0 0 6px var(--ivory);
}

.visually-hidden { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.skip-link { position: absolute; left: 1rem; top: -10rem; z-index: 100; padding: .75rem 1.25rem; background: var(--ink); color: var(--white); border-radius: var(--radius); font-weight: 700; }
.skip-link:focus { top: 1rem; color: var(--white); }

.wrap { width: 100%; max-width: var(--wrap); margin: 0 auto; padding: 0 1.25rem; }
.main { padding-top: 1.5rem; padding-bottom: 4rem; }
.narrow { max-width: 34rem; margin: 0 auto; }
.narrow-wide, .prose { max-width: 46rem; }
.lead { font-size: 1.2rem; color: var(--ink-soft); }
.meta, .hint { color: var(--ink-soft); font-size: 1rem; }
.hint { margin: .1rem 0 .4rem; }

/* ── Intestazioni ──────────────────────────────────────────────── */
.site-header { background: var(--white); border-bottom: 1px solid var(--line-soft); }
.site-header--public .wrap { padding-top: 1rem; padding-bottom: 1rem; }
.brand { display: inline-block; line-height: 0; border-radius: 6px; }
.site-header--public .brand img { width: min(340px, 80vw); }
.header-row { display: flex; align-items: center; justify-content: space-between; gap: .75rem; flex-wrap: wrap; padding-top: .75rem; padding-bottom: .75rem; }
.site-header--private .brand img { width: min(300px, 52vw); }

.main-nav { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; }
.main-nav ul { list-style: none; display: flex; flex-wrap: wrap; gap: .25rem; margin: 0; padding: 0; }
.main-nav a, .main-nav .link-button {
  display: inline-flex; align-items: center; min-height: 48px; padding: .4rem .85rem;
  color: var(--ink); text-decoration: none; border-radius: 8px; font-weight: 700;
}
.main-nav a:hover, .main-nav .link-button:hover { background: var(--bronze-tint); color: var(--bordeaux-dark); }
.main-nav a[aria-current="page"] { color: var(--bordeaux-dark); background: var(--bordeaux-tint); box-shadow: inset 0 -3px 0 var(--bordeaux); }
.nav-user { border-left: 1px solid var(--line-soft); padding-left: .75rem !important; }
.nav-user form { margin: 0; }
.badge { display: inline-block; min-width: 1.6em; margin-left: .35em; padding: 0 .4em; border-radius: 1em; background: var(--bordeaux); color: var(--white); font-size: .85rem; text-align: center; line-height: 1.6; }

.nav-toggle { display: none; }
@media (max-width: 52rem) {
  .js .nav-toggle {
    display: inline-flex; align-items: center; gap: .6rem; min-height: 48px; padding: .5rem .9rem; margin-left: auto;
    font: inherit; font-weight: 700; color: var(--ink); background: var(--white); border: 2px solid var(--ink); border-radius: 8px; cursor: pointer;
  }
  .nav-toggle__bars, .nav-toggle__bars::before, .nav-toggle__bars::after { display: block; width: 20px; height: 2px; background: currentColor; position: relative; }
  .nav-toggle__bars::before, .nav-toggle__bars::after { content: ""; position: absolute; left: 0; }
  .nav-toggle__bars::before { top: -6px; } .nav-toggle__bars::after { top: 6px; }
  .js .main-nav { display: none; width: 100%; flex-direction: column; align-items: stretch; padding-bottom: .5rem; }
  .js .main-nav.is-open { display: flex; }
  .main-nav ul { flex-direction: column; }
  .main-nav a, .main-nav .link-button { width: 100%; }
  .nav-user { border-left: 0; border-top: 1px solid var(--line-soft); padding: .5rem 0 0 !important; }
}

/* ── Home ──────────────────────────────────────────────────────── */
.home { display: flex; align-items: center; justify-content: center; padding: 2rem 1.25rem 3rem; }
.home__inner { width: 100%; max-width: 32rem; text-align: center; }
.home__logo { margin: 0 auto 2rem; line-height: 0; }
.home__logo::after { display: none; }
.home__logo img { width: min(420px, 88vw); }
.home__actions ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 1rem; align-items: center; }
.home__actions li { width: min(22rem, 100%); }
.home__actions .btn { width: 100%; }
.home .flash-zone { text-align: left; }

/* ── Pulsanti ──────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  min-height: 48px; padding: .6rem 1.4rem;
  font: inherit; font-weight: 700; line-height: 1.25; text-align: center; text-decoration: none;
  border: 2px solid transparent; border-radius: 999px; cursor: pointer;
  transition: background-color .15s ease, color .15s ease, border-color .15s ease;
}
.btn--primary { background: var(--bordeaux); color: var(--white); border-color: var(--bordeaux); }
.btn--primary:hover { background: var(--bordeaux-dark); border-color: var(--bordeaux-dark); color: var(--white); }
.btn--secondary { background: var(--white); color: var(--bordeaux-dark); border-color: var(--bordeaux); }
.btn--secondary:hover { background: var(--bordeaux-tint); color: var(--bordeaux-dark); }
.btn--muted { background: var(--bronze-tint); color: var(--ink); border-color: var(--line); }
.btn--danger { background: var(--white); color: var(--error); border-color: var(--error); }
.btn--danger:hover { background: var(--error-tint); }
.btn--large { min-height: 56px; font-size: 1.2rem; padding: .8rem 2rem; }
.btn--small { min-height: 44px; padding: .35rem 1rem; font-size: 1rem; }
.btn--block { width: 100%; }
.btn[disabled] { opacity: .65; cursor: progress; }
.link-button { background: none; border: 0; padding: 0; font: inherit; color: var(--bordeaux); text-decoration: underline; text-underline-offset: .18em; cursor: pointer; }
.button-row { display: flex; flex-wrap: wrap; gap: .75rem; align-items: center; margin: 1.25rem 0; padding: 0; list-style: none; }
.inline-form { display: inline; margin: 0; }

/* ── Avvisi ────────────────────────────────────────────────────── */
.notice { border-left: 6px solid; border-radius: var(--radius); padding: 1rem 1.25rem; margin: 0 0 1.5rem; background: var(--white); }
.notice p:last-child, .notice ul:last-child { margin-bottom: 0; }
.notice__title { font-family: var(--font); font-size: 1.15rem; margin: 0 0 .4rem; }
.notice--error   { border-color: var(--error);   background: var(--error-tint); }
.notice--success { border-color: var(--success); background: var(--success-tint); }
.notice--info    { border-color: var(--bordeaux); background: var(--bordeaux-tint); }
.notice--warning { border-color: var(--warning); background: var(--warning-tint); }
.notice--error .notice__title, .error-summary a { color: var(--error); }
.error-summary:focus { outline: 3px solid var(--focus); outline-offset: 3px; }

/* ── Moduli ────────────────────────────────────────────────────── */
.card { background: var(--white); border: 1px solid var(--line-soft); border-radius: calc(var(--radius) * 1.4); padding: 1.5rem; box-shadow: var(--shadow); margin-bottom: 1.5rem; }
.form .field { margin-bottom: 1.35rem; }
label { display: block; font-weight: 700; margin-bottom: .25rem; }
.req, .opt { font-weight: 400; font-size: .95rem; color: var(--ink-soft); }
input[type=text], input[type=email], input[type=password], input[type=tel], input[type=url], input[type=search], input[type=number], textarea, select {
  width: 100%; min-height: 50px; padding: .6rem .85rem;
  font: inherit; color: var(--ink); background: var(--white);
  border: 2px solid var(--line); border-radius: 8px;
}
textarea { min-height: 7rem; resize: vertical; line-height: 1.55; }
input:hover, textarea:hover { border-color: var(--ink-soft); }
.input-short { max-width: 8rem; }
.field--error input, .field--error textarea, [aria-invalid="true"] { border-color: var(--error); border-width: 3px; }
.field-error { color: var(--error); font-weight: 700; margin: .1rem 0 .35rem; }

.pw-wrap { display: flex; gap: .5rem; }
.pw-wrap input { flex: 1; }
.pw-toggle { flex: none; min-width: 6.5rem; min-height: 50px; padding: 0 .8rem; font: inherit; font-weight: 700; color: var(--bordeaux-dark); background: var(--white); border: 2px solid var(--line); border-radius: 8px; cursor: pointer; }
.pw-toggle:hover { background: var(--bronze-tint); }

.field--check, .check-row, .radio-row { display: grid; grid-template-columns: auto 1fr; column-gap: .7rem; align-items: start; margin-bottom: .8rem; }
.field--check .field-error, .check-row .hint, .radio-row + .hint { grid-column: 1 / -1; }
.check-row .hint { grid-column: 2; margin: 0; }
.field--check .field-error { grid-column: 1 / -1; }
input[type=checkbox], input[type=radio] { width: 1.5rem; height: 1.5rem; margin: .15rem 0 0; accent-color: var(--bordeaux); cursor: pointer; }
.field--check label, .check-row label, .radio-row label { font-weight: 400; margin: 0; cursor: pointer; }
label.check { display: inline-flex; align-items: center; gap: .5rem; font-weight: 400; }

.fieldset { border: 1px solid var(--line-soft); border-radius: var(--radius); padding: 1rem 1.25rem .5rem; margin: 0 0 1.35rem; }
.fieldset legend { font-weight: 700; padding: 0 .35rem; }
.fieldset--nested { margin: .5rem 0 .5rem 2.2rem; }
.fieldset[disabled] { opacity: .6; }

.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.link-list { list-style: none; padding: 0; text-align: center; }
.link-list li { margin: .5rem 0; }

/* ── Area riservata ────────────────────────────────────────────── */
.section-cards, .content-grid { list-style: none; padding: 0; display: grid; gap: 1.25rem; grid-template-columns: repeat(auto-fill, minmax(16rem, 1fr)); margin: 1.5rem 0 2.5rem; }
.section-card, .content-card {
  position: relative; background: var(--white); border: 1px solid var(--line-soft); border-radius: calc(var(--radius) * 1.4);
  padding: 1.4rem 1.5rem; box-shadow: var(--shadow); border-top: 4px solid var(--bronze);
}
.section-card h2, .content-card__title { margin: 0 0 .5rem; font-size: 1.4rem; }
.section-card a, .content-card__title a { color: var(--bordeaux-dark); text-decoration: none; }
/* l'intera scheda è cliccabile, ma il link resta uno solo per gli screen reader */
.section-card a::after, .content-card__title a::after { content: ""; position: absolute; inset: 0; border-radius: inherit; }
.section-card:hover, .content-card:hover { border-color: var(--bronze); }
.section-card:hover a, .content-card:hover .content-card__title a { text-decoration: underline; }
.section-card:focus-within, .content-card:focus-within { outline: 3px solid var(--focus); outline-offset: 3px; }
.section-card a:focus-visible, .content-card__title a:focus-visible { outline: none; }
.content-card p:last-child, .section-card p:last-child { margin-bottom: 0; }
.content-card__icon { display: inline-grid; place-items: center; width: 2.6rem; height: 2.6rem; margin-bottom: .75rem; border-radius: 50%; background: var(--bronze-tint); color: var(--bronze-text); font-size: 1.1rem; }

.plain-list { padding-left: 1.2rem; }
.plain-list li { margin-bottom: .5rem; }

.breadcrumb ol { list-style: none; display: flex; flex-wrap: wrap; gap: .25rem; padding: 0; margin: 0 0 .5rem; font-size: 1rem; }
.breadcrumb li + li::before { content: "›"; margin: 0 .4rem; color: var(--ink-soft); }

.player { margin: 1rem 0 1.5rem; max-width: 60rem; }
.player video { width: 100%; border-radius: var(--radius); background: var(--ink); }
.yt { position: relative; aspect-ratio: 16 / 9; border-radius: var(--radius); overflow: hidden; background: var(--bronze-tint); border: 1px solid var(--line-soft); }
.yt iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.yt__placeholder { height: 100%; display: flex; flex-direction: column; justify-content: center; padding: 1.5rem; max-width: 40rem; margin: 0 auto; }
@supports not (aspect-ratio: 1) { .yt { padding-top: 56.25%; } .yt__placeholder { position: absolute; inset: 0; } }
@media (max-width: 30rem) { .yt { aspect-ratio: auto; } .yt.is-loaded { aspect-ratio: 16 / 9; } }
.transcript { margin-top: 2rem; padding: 1.25rem 1.5rem; background: var(--white); border-radius: var(--radius); border: 1px solid var(--line-soft); max-width: 60rem; }
.transcript h2 { margin-top: 0; }

.pdf-frame { border: 1px solid var(--line-soft); border-radius: var(--radius); overflow: hidden; background: var(--white); }
.pdf-frame iframe { display: block; width: 100%; height: 80vh; min-height: 30rem; border: 0; }

.download-list { list-style: none; padding: 0; margin: 1.5rem 0; }
.download-item { display: flex; gap: 1.25rem; align-items: center; justify-content: space-between; flex-wrap: wrap; background: var(--white); border: 1px solid var(--line-soft); border-left: 4px solid var(--bronze); border-radius: var(--radius); padding: 1.1rem 1.4rem; margin-bottom: 1rem; }
.download-item.is-highlight { border-color: var(--bordeaux); }
.download-item__text { flex: 1 1 20rem; }
.download-item__title { margin: 0 0 .3rem; font-size: 1.3rem; }
.download-item .prose p { margin-bottom: .4rem; }
.download-item .meta { margin: 0; }

.prose ul { padding-left: 1.3rem; }
.prose li { margin-bottom: .35rem; }

/* ── Tabelle ───────────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; margin: 1rem 0 1.5rem; border: 1px solid var(--line-soft); border-radius: var(--radius); background: var(--white); }
table { width: 100%; border-collapse: collapse; font-size: 1rem; }
caption { text-align: left; padding: .8rem 1rem; font-weight: 700; color: var(--ink-soft); }
th, td { text-align: left; vertical-align: top; padding: .75rem 1rem; border-top: 1px solid var(--line-soft); }
thead th { background: var(--bronze-tint); border-top: 0; }
tbody th { font-weight: 700; }

/* ── Footer ────────────────────────────────────────────────────── */
.site-footer { flex-shrink: 0; background: var(--white); border-top: 1px solid var(--line-soft); font-size: 1rem; }
.footer-row { display: flex; flex-wrap: wrap; gap: .5rem 2rem; align-items: center; justify-content: space-between; padding-top: 1.1rem; padding-bottom: 1.1rem; }
.footer-row p { margin: 0; color: var(--ink-soft); }
.site-footer ul { list-style: none; display: flex; flex-wrap: wrap; gap: .25rem 1.25rem; margin: 0; padding: 0; }
.site-footer a, .site-footer .link-button { display: inline-block; padding: .55rem 0; color: var(--ink); }

/* ── Consenso cookie ───────────────────────────────────────────── */
.cookie-banner { position: fixed; z-index: 50; left: 0; right: 0; bottom: 0; background: var(--white); border-top: 4px solid var(--bronze); box-shadow: 0 -8px 30px rgba(40, 39, 40, .12); padding: 1.1rem 0 .5rem; max-height: 80vh; overflow: auto; }
.cookie-banner .wrap { position: relative; padding-right: 3.5rem; }
.cookie-banner h2 { margin: 0 0 .4rem; font-size: 1.35rem; }
.cookie-banner p { margin-bottom: .5rem; max-width: 60rem; }
.cookie-banner .button-row { margin: .5rem 0; }
.cookie-close { position: absolute; top: 0; right: 1.25rem; width: 48px; height: 48px; font-size: 2rem; line-height: 1; background: none; border: 0; color: var(--ink); cursor: pointer; border-radius: 50%; }
.cookie-close:hover { background: var(--bronze-tint); }
.cookie-dialog { width: min(38rem, calc(100vw - 2rem)); max-height: calc(100vh - 2rem); border: 0; border-radius: calc(var(--radius) * 1.5); padding: 0; color: var(--ink); background: var(--white); box-shadow: 0 20px 60px rgba(40, 39, 40, .3); }
.cookie-dialog::backdrop { background: rgba(40, 39, 40, .55); }
.cookie-form { padding: 1.5rem 1.75rem; }
.cookie-form h2 { margin-top: 0; }
.cookie-form fieldset { border: 0; padding: 0; margin: 0; }
.switch-row { display: grid; grid-template-columns: auto 1fr; column-gap: .7rem; padding: .85rem 0; border-top: 1px solid var(--line-soft); }
.switch-row label { margin: 0; }
.switch-row .hint { grid-column: 2; margin: .15rem 0 0; }

.checklist { list-style: none; padding: 0; }
.checklist .ok span { color: var(--success); }
.checklist .ko { color: var(--error); }

/* ── Preferenze utente ─────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
}
@media (forced-colors: active) {
  .btn, .pw-toggle, .nav-toggle { border: 2px solid ButtonText; }
  h1::after { background: CanvasText; }
  :focus-visible { outline: 3px solid Highlight; }
}
@media print {
  .site-header, .site-footer, .cookie-banner, .skip-link, .button-row { display: none !important; }
  body { background: #fff; }
}
