/* ==========================================================================
   GDPR Cookie Banner + Internal Reader Modal (Shared V1 & V2)
   ========================================================================== */

body.modal-open {
  overflow: hidden;
}

/* Cookie Banner (Garante Privacy IT compliant) */
.cookie-banner {
  position: fixed;
  bottom: 1.15rem;
  left: 50%;
  transform: translateX(-50%) translateY(24px);
  width: min(760px, calc(100% - 2rem));
  z-index: 310;
  background: #ffffff;
  color: #1b1f1c;
  border: 1px solid rgba(20, 62, 38, 0.22);
  border-radius: 14px;
  padding: 1.25rem 1.45rem;
  box-shadow: 0 22px 60px rgba(10, 28, 18, 0.24);
  opacity: 0;
  pointer-events: none;
  transition: opacity 280ms ease, transform 340ms cubic-bezier(0.22, 1, 0.36, 1);
}

.cookie-banner.is-visible {
  opacity: 1;
  pointer-events: auto;
  transform: translateX(-50%) translateY(0);
}

.cookie-banner__top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.5rem;
}

.cookie-banner__title {
  font-family: 'Lora', Georgia, serif;
  font-size: 1.05rem;
  font-weight: 600;
  color: #143e26;
  margin: 0;
}

.cookie-banner__close {
  border: 1px solid rgba(20, 62, 38, 0.18);
  background: #f6f8f6;
  color: #143e26;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  font-size: 1.05rem;
  line-height: 1;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  cursor: pointer;
}

.cookie-banner__close:hover {
  background: #e7ede8;
}

.cookie-banner__text {
  margin: 0 0 1rem;
  font-size: 0.86rem;
  line-height: 1.55;
  color: #4c554f;
}

.cookie-banner__text button {
  background: none;
  border: none;
  padding: 0;
  color: #143e26;
  font-weight: 600;
  text-decoration: underline;
  font-size: inherit;
  cursor: pointer;
}

.cookie-banner__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  justify-content: flex-end;
}

.ck-btn {
  padding: 0.56rem 1rem;
  border-radius: 7px;
  font-size: 0.83rem;
  font-weight: 600;
  border: 1px solid transparent;
  cursor: pointer;
  transition: background 180ms ease, border-color 180ms ease, color 180ms ease;
}

.ck-btn--primary {
  background: #143e26;
  color: #ffffff;
}

.ck-btn--primary:hover {
  background: #1d5234;
}

.ck-btn--outline {
  background: #ffffff;
  color: #143e26;
  border-color: rgba(20, 62, 38, 0.28);
}

.ck-btn--outline:hover {
  background: #f3f6f4;
  border-color: #143e26;
}

/* V3: align cookie chrome to Source Sans / clinical tokens (HIG familiarity) */
.page-v3 .cookie-banner {
  border-radius: 4px;
  border-color: rgba(21, 32, 40, 0.18);
  box-shadow: 0 16px 40px rgba(11, 18, 24, 0.16);
}

.page-v3 .cookie-banner__title {
  font-family: 'Source Serif 4', Georgia, serif;
  color: #152028;
}

.page-v3 .cookie-banner__close {
  width: 44px;
  height: 44px;
  border-radius: 2px;
}

.page-v3 .ck-btn {
  min-height: 44px;
  border-radius: 2px;
  font-family: 'Source Sans 3', system-ui, sans-serif;
}

.page-v3 .ck-btn--primary {
  background: #1f5c4d;
}

.page-v3 .ck-btn--primary:hover {
  background: #17473c;
}

.page-v3 .cookie-banner__close:focus-visible,
.page-v3 .ck-btn:focus-visible {
  outline: 2px solid #1f5c4d;
  outline-offset: 2px;
}

/* Internal Reader & Preferences Modal */
.site-modal {
  position: fixed;
  inset: 0;
  z-index: 350;
  display: grid;
  place-items: center;
  padding: 1.25rem;
  background: rgba(13, 33, 22, 0.58);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 240ms ease;
}

.site-modal.is-open {
  opacity: 1;
  pointer-events: auto;
}

.site-modal__dialog {
  width: min(780px, 100%);
  max-height: 88vh;
  background: #ffffff;
  color: #1b1f1c;
  border-radius: 14px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: 0 28px 80px rgba(0, 0, 0, 0.3);
  transform: translateY(14px) scale(0.98);
  transition: transform 280ms cubic-bezier(0.22, 1, 0.36, 1);
}

.site-modal.is-open .site-modal__dialog {
  transform: translateY(0) scale(1);
}

.site-modal__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 1.5rem;
  border-bottom: 1px solid rgba(20, 62, 38, 0.12);
  background: #faf9f5;
}

.site-modal__kicker {
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: #5a7040;
}

.site-modal__close {
  border: 1px solid rgba(20, 62, 38, 0.2);
  background: #ffffff;
  color: #143e26;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  font-size: 1.2rem;
  line-height: 1;
  display: grid;
  place-items: center;
  cursor: pointer;
}

.site-modal__close:hover {
  background: #143e26;
  color: #ffffff;
}

.site-modal__body {
  padding: clamp(1.35rem, 3vw, 2.2rem);
  overflow-y: auto;
  line-height: 1.7;
  font-size: 0.96rem;
  color: #3a403c;
}

.site-modal__hero {
  width: 100%;
  max-height: 290px;
  object-fit: cover;
  border-radius: 10px;
  margin-bottom: 1.35rem;
}

.site-modal__hero--doc {
  max-height: min(72vh, 720px);
  object-fit: contain;
  background: #f3f5f1;
}

.attestati-block {
  margin-top: 1.75rem;
  padding-top: 1.35rem;
  border-top: 1px solid rgba(20, 62, 38, 0.12);
}

.attestati-block__title {
  font-family: 'Lora', Georgia, serif;
  font-size: 1.15rem;
  color: #143e26;
  margin: 0 0 0.35rem;
}

.attestati-block__lead {
  margin: 0 0 0.85rem;
  font-size: 0.92rem;
  color: #5a655d;
}

.attestati-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: block;
}

.attestati-list > li {
  margin: 0;
  border-bottom: 1px solid rgba(20, 62, 38, 0.12);
}

.attestati-list > li:first-child {
  border-top: 1px solid rgba(20, 62, 38, 0.12);
}

.attestati-row {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin: 0;
  padding: 1rem 0.15rem;
  text-align: left;
  cursor: pointer;
  color: inherit;
  background: transparent;
  border: 0;
  border-radius: 0;
  transition: background-color 0.18s ease, color 0.18s ease;
}

.attestati-row__text {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  min-width: 0;
}

.attestati-row__title {
  font-size: 0.98rem;
  font-weight: 600;
  color: #143e26;
  line-height: 1.35;
}

.attestati-row__meta {
  font-size: 0.82rem;
  color: #6f7c73;
  line-height: 1.35;
}

.attestati-row__cta {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  font-size: 0.82rem;
  font-weight: 600;
  color: #608334;
  white-space: nowrap;
}

.attestati-row__chev {
  display: block;
}

.attestati-row__cta--soon {
  color: #7a6a3a;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  background: none;
  padding: 0;
  border-radius: 0;
}

.attestati-row:hover {
  background: rgba(96, 131, 52, 0.06);
}

.attestati-row:hover .attestati-row__title {
  text-decoration: underline;
  text-underline-offset: 0.18em;
}

.attestati-row:hover .attestati-row__cta:not(.attestati-row__cta--soon) {
  color: #143e26;
}

.attestati-row:focus {
  outline: none;
}

.attestati-row:focus-visible {
  outline: 2px solid #608334;
  outline-offset: 2px;
  background: rgba(96, 131, 52, 0.08);
}

.attestati-row:active {
  opacity: 0.92;
}

@media (max-width: 540px) {
  .attestati-row {
    align-items: flex-start;
    padding: 1rem 0;
  }
}

/* --- Selettore sedi (#contatti) ----------------------------------------- */
.sede-selector {
  display: grid;
  gap: 0.85rem;
  margin-bottom: 0.25rem;
  padding-bottom: 1.25rem;
  border-bottom: 1px solid rgba(20, 62, 38, 0.12);
}

.sede-selector__label {
  margin: 0;
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #5a655d;
}

.sede-selector__options {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
}

.sede-option {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.15rem;
  width: 100%;
  min-height: 44px;
  margin: 0;
  padding: 0.85rem 1rem;
  text-align: left;
  cursor: pointer;
  color: #143e26;
  background: transparent;
  border: 1px solid rgba(20, 62, 38, 0.18);
  border-radius: 10px;
  transition:
    border-color 0.18s ease,
    background-color 0.18s ease,
    color 0.18s ease;
}

.sede-option__city {
  font-family: 'Lora', Georgia, serif;
  font-size: 1.05rem;
  font-weight: 600;
  line-height: 1.2;
}

.sede-option:hover {
  border-color: rgba(96, 131, 52, 0.55);
  background: rgba(96, 131, 52, 0.06);
}

.sede-option:focus {
  outline: none;
}

.sede-option:focus-visible {
  outline: 2px solid #608334;
  outline-offset: 3px;
  border-color: #608334;
}

.sede-option.is-active,
.sede-option[aria-checked="true"] {
  background: #143e26;
  border-color: #143e26;
  color: #fff;
  box-shadow: none;
}

.sede-option.is-active:focus-visible,
.sede-option[aria-checked="true"]:focus-visible {
  outline-color: #608334;
  outline-offset: 3px;
}

.sede-selector__address {
  margin: 0;
  display: grid;
  gap: 0.2rem;
}

.sede-selector__address-label {
  font-size: 0.75rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #6f7c73;
}

.sede-selector__address-value {
  font-size: 1rem;
  font-weight: 500;
  color: #143e26;
  line-height: 1.35;
}

@media (max-width: 360px) {
  .sede-selector__options {
    grid-template-columns: 1fr;
  }
}

@media (prefers-reduced-motion: reduce) {
  .sede-option,
  .attestati-row {
    transition: none;
  }
}

.percorso-card__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1.25rem;
  margin-top: 0.35rem;
}

.site-modal__body h1 {
  font-family: 'Lora', Georgia, serif;
  font-size: clamp(1.5rem, 2.8vw, 2rem);
  line-height: 1.22;
  color: #143e26;
  margin: 0 0 0.5rem;
}

.site-modal__meta {
  font-size: 0.82rem;
  color: #6f7c73;
  margin: 0 0 1.4rem;
}

.site-modal__body h2 {
  font-family: 'Lora', Georgia, serif;
  font-size: 1.2rem;
  color: #143e26;
  margin: 1.65rem 0 0.55rem;
}

.site-modal__body h3 {
  font-family: 'Lora', Georgia, serif;
  font-size: 1.04rem;
  color: #143e26;
  margin: 1.2rem 0 0.4rem;
}

.site-modal__body p {
  margin: 0 0 0.95rem;
}

.site-modal__body ul {
  margin: 0 0 1rem;
  padding-left: 1.25rem;
}

.site-modal__body li {
  margin-bottom: 0.45rem;
}

.site-modal__cta {
  margin-top: 1.75rem;
  padding-top: 1.25rem;
  border-top: 1px solid rgba(20, 62, 38, 0.12);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

/* Cookie Preference Rows */
.ck-pref-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1.25rem;
  padding: 1rem 1.15rem;
  border: 1px solid rgba(20, 62, 38, 0.14);
  border-radius: 10px;
  background: #faf9f5;
  margin-bottom: 0.85rem;
}

.ck-pref-row strong {
  display: block;
  color: #143e26;
  font-size: 0.95rem;
  margin-bottom: 0.2rem;
}

.ck-pref-row span {
  display: block;
  font-size: 0.84rem;
  color: #525b55;
  line-height: 1.5;
}

.ck-switch {
  position: relative;
  display: inline-block;
  width: 46px;
  height: 26px;
  flex-shrink: 0;
  margin-top: 2px;
}

.ck-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.ck-switch__slider {
  position: absolute;
  inset: 0;
  background: #c7cfc9;
  border-radius: 999px;
  transition: background 200ms ease;
  cursor: pointer;
}

.ck-switch__slider::before {
  content: "";
  position: absolute;
  width: 20px;
  height: 20px;
  left: 3px;
  top: 3px;
  border-radius: 50%;
  background: #ffffff;
  transition: transform 200ms ease;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.ck-switch input:checked + .ck-switch__slider {
  background: #143e26;
}

.ck-switch input:checked + .ck-switch__slider::before {
  transform: translateX(20px);
}

.ck-switch input:disabled + .ck-switch__slider {
  opacity: 0.65;
  cursor: not-allowed;
}

@media (max-width: 620px) {
  .cookie-banner {
    bottom: 0.75rem;
    padding: 1rem 1.1rem;
  }

  .cookie-banner__actions {
    justify-content: stretch;
  }

  .cookie-banner__actions .ck-btn {
    flex: 1 1 auto;
    text-align: center;
  }
}

@media (max-width: 900px) {
  .cookie-banner {
    left: 1rem;
    right: 1rem;
    width: auto;
    max-width: none;
    transform: translateY(24px);
  }
  .cookie-banner.is-visible {
    transform: translateY(0);
  }
  body.modal-open {
    position: fixed;
    inset: 0;
    width: 100%;
  }
}
