/* Pagina "Dipartimenti": un pulsante per ogni dipartimento (generata da scripts/genera-pagine-dipartimenti.py).
   Ogni pulsante porta addosso l'identita' grafica della pagina del suo dipartimento (colori, forma, dettaglio).
   Si appoggia a mift.css. Prefisso dl-. */

/* ---------- intro (al centro) ---------- */
.dl-hero { position: relative; isolation: isolate; overflow: hidden; margin-bottom: 40px; background: #eaf2fb; border-bottom: 2px solid #c9dcee; text-align: center; }
.dl-hero-in { max-width: 1280px; margin: 0 auto; padding: 48px 16px 52px; }
.dl-pre { display: inline-flex; align-items: center; gap: 12px; margin: 0 0 16px; font-size: 13px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: #1B6FA8; }
.dl-pre::before, .dl-pre::after { content: ""; width: 22px; height: 3px; background: #1B6FA8; }
.dl-hero h1 { max-width: 15ch; margin: 0 auto; font-family: 'Poppins', sans-serif; font-weight: 800; font-size: clamp(38px, 11vw, 58px); line-height: 1.03; letter-spacing: -.02em; color: #005687; text-wrap: balance; }
.dl-hero h1 em { font-style: normal; color: #005687; box-shadow: inset 0 -.3em 0 #8fd0ff; }
.dl-lead { max-width: 32rem; margin: 18px auto 0; font-size: 17px; line-height: 1.55; color: #1a1c1e; }
/* il "12" grande, solo contorno, al centro dietro il testo */
.dl-dodici { position: absolute; z-index: -1; left: 50%; bottom: -60px; transform: translateX(-50%); font-family: 'Poppins', sans-serif; font-weight: 800; font-size: 240px; line-height: 1; letter-spacing: -.04em; color: transparent; -webkit-text-stroke: 2px #1B6FA8; opacity: .22; pointer-events: none; user-select: none; }
@media (min-width: 900px) {
  .dl-hero-in { padding: 68px 40px 72px; }
  .dl-hero h1 { max-width: 18ch; font-size: 64px; }
  .dl-lead { font-size: 19px; }
  .dl-dodici { bottom: -110px; font-size: 400px; }
}

/* ---------- griglia ---------- */
.dl-griglia { list-style: none; margin: 0; padding: 0 0 10px; display: grid; gap: 20px; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 640px) { .dl-griglia { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 900px) { .dl-griglia { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 24px; } }
@media (min-width: 1500px) { .dl-griglia { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.dl-griglia > li { animation: dl-su 420ms cubic-bezier(.2,.7,.2,1) both; animation-delay: calc(var(--i, 0) * 40ms); }
@keyframes dl-su { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }

/* ---------- il pulsante: base (le variabili cambiano da un dipartimento all'altro) ---------- */
.mf-pagina .dl-btn, .dl-btn { --bg: #fff; --bd: #005687; --sh: #1B6FA8; --sh-h: #005687; --nome: #005687; --sotto: #41474f; --ib: #e3eefa; --ic: #005687; --ibd: #005687; --vai: #1B6FA8; --n: #8fb5d6;
  position: relative; isolation: isolate; overflow: hidden; display: grid; grid-template-columns: 58px minmax(0, 1fr) 22px; align-items: center; gap: 14px; height: 100%; min-height: 112px; padding: 18px 14px; border: 2px solid var(--bd); border-radius: 14px; background-color: var(--bg); color: #1a1c1e; text-decoration: none; box-shadow: 5px 5px 0 var(--sh); transition: transform 150ms ease, box-shadow 150ms ease; }
.dl-btn:hover { transform: translate(-3px, -3px); box-shadow: 8px 8px 0 var(--sh-h); }
.dl-btn:active { transform: translate(2px, 2px); box-shadow: 2px 2px 0 var(--sh); }
.dl-btn:focus-visible { outline: 3px solid #005687; outline-offset: 4px; }
.dl-n { position: absolute; top: 7px; right: 12px; font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace; font-size: 11px; font-weight: 700; letter-spacing: .08em; color: var(--n); }
.dl-ico { display: flex; align-items: center; justify-content: center; width: 58px; height: 58px; border: 2px solid var(--ibd); border-radius: 12px; background: var(--ib); color: var(--ic); }
.dl-ico .material-symbols-outlined { font-size: 30px; }
.dl-txt { display: grid; gap: 3px; min-width: 0; }
.dl-nome { font-family: 'Poppins', sans-serif; font-weight: 800; font-size: 17px; line-height: 1.15; color: var(--nome); overflow-wrap: break-word; }
@media (min-width: 1024px) { .dl-nome { font-size: 19px; } }
.dl-sotto { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; font-size: 13px; line-height: 1.35; color: var(--sotto); }
.dl-btn > .material-symbols-outlined { font-size: 22px; color: var(--vai); transition: transform 150ms ease; }
.dl-btn:hover > .material-symbols-outlined { transform: translateX(3px); }

/* ---------- le dodici identita' ---------- */
/* BIOMORF: sala diagnostica, fondo scuro e linea di scansione */
.dl-btn[data-t="biomorf"] { --bg: #00263d; --bd: #8fd0ff; --sh: #1B6FA8; --sh-h: #8fd0ff; --nome: #fff; --sotto: #cfe3f5; --ib: #005687; --ic: #8fd0ff; --ibd: #8fd0ff; --vai: #8fd0ff; --n: #8fd0ff; border-radius: 12px; }
.dl-btn[data-t="biomorf"] .dl-ico { border-radius: 50%; background: repeating-radial-gradient(circle, #005687 0 3px, #00344f 3px 6px); }
.dl-btn[data-t="biomorf"]::before { content: ""; position: absolute; z-index: -1; left: 0; right: 0; top: 0; height: 2px; background: #fff; box-shadow: 0 0 10px #8fd0ff; opacity: 0; }
.dl-btn[data-t="biomorf"]:hover::before { animation: dl-scan 1.1s ease-in-out infinite alternate; }
@keyframes dl-scan { from { opacity: .9; transform: translateY(0); } to { opacity: .9; transform: translateY(104px); } }

/* ChiBioFarAm: laboratorio, esagoni */
.dl-btn[data-t="chibiofaram"] { --bg: #e8f3fb; --bd: #005687; --ib: #005687; --ic: #fff; --ibd: #005687; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='56' height='100' viewBox='0 0 56 100'%3E%3Cpath d='M28 66L0 50V16L28 0l28 16v34zM28 100L0 84V66m28 0l28 16v18' fill='none' stroke='%231B6FA8' stroke-opacity='.22' stroke-width='1.5'/%3E%3C/svg%3E"); background-size: 56px 100px; }
.dl-btn[data-t="chibiofaram"] .dl-ico { border: 0; border-radius: 0; width: 56px; height: 62px; clip-path: polygon(50% 0, 100% 25%, 100% 75%, 50% 100%, 0 75%, 0 25%); }

/* COSPECS: fumetto */
.dl-btn[data-t="cospecs"] { --bg: #1B6FA8; --bd: #00466f; --sh: #00466f; --sh-h: #00263d; --nome: #fff; --sotto: #fff; --ib: #fff; --ic: #1B6FA8; --ibd: #fff; --vai: #fff; --n: #cfeaff; border-radius: 26px 26px 26px 4px; }
.dl-btn[data-t="cospecs"] .dl-ico { border-radius: 50%; }

/* DICAM: greca e arco */
.dl-btn[data-t="dicam"] { --bd: #005687; border-radius: 6px; padding-top: 32px; }
.dl-btn[data-t="dicam"]::before { content: ""; position: absolute; z-index: -1; left: 0; right: 0; top: 0; height: 18px; border-bottom: 1px solid #c9dcee; background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='16' viewBox='0 0 24 16' fill='none' stroke='%231B6FA8' stroke-width='2' stroke-linecap='square'%3E%3Cpath d='M1 15V1h18v10H7V6h6'/%3E%3C/svg%3E") 0 50% / 24px 16px repeat-x; }
.dl-btn[data-t="dicam"] .dl-ico { border-radius: 30px 30px 6px 6px; }

/* DIMED: segnaletica d'ospedale */
.dl-btn[data-t="dimed"] { --bg: #00314f; --bd: #00263d; --sh: #1B6FA8; --sh-h: #00314f; --nome: #fff; --sotto: #cfe3f5; --ib: #fff; --ic: #00314f; --ibd: #fff; --vai: #8fd0ff; --n: #8fd0ff; border-width: 3px; border-radius: 8px; }
.dl-btn[data-t="dimed"]::before { content: ""; position: absolute; z-index: -1; left: 0; top: 0; bottom: 0; width: 8px; background: #1B6FA8; }
.dl-btn[data-t="dimed"] .dl-ico { border-radius: 8px; }

/* Economia: scontrino */
.dl-btn[data-t="economia"] { border-radius: 4px 4px 0 0; border-bottom: 3px dashed #005687; }
.dl-btn[data-t="economia"] .dl-ico { border-radius: 50%; }
.dl-btn[data-t="economia"] .dl-sotto { font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace; font-size: 12px; }

/* Giurisprudenza: colonnato */
.dl-btn[data-t="giurisprudenza"] { --bg: #00466f; --bd: #002b45; --sh: #1B6FA8; --sh-h: #002b45; --nome: #fff; --sotto: #dcecf9; --ib: #fff; --ic: #00466f; --ibd: #fff; --vai: #8fd0ff; --n: #8fd0ff; border-radius: 4px; background-image: repeating-linear-gradient(90deg, rgba(255,255,255,.07) 0 14px, transparent 14px 36px); }
.dl-btn[data-t="giurisprudenza"] .dl-ico { border-radius: 4px; }

/* Ingegneria: tavola di progetto */
.dl-btn[data-t="ingegneria"] { --bg: #00314f; --bd: #8fd0ff; --sh: #1B6FA8; --sh-h: #8fd0ff; --nome: #fff; --sotto: #dcecf9; --ib: transparent; --ic: #8fd0ff; --ibd: #8fd0ff; --vai: #8fd0ff; --n: #8fd0ff; border-radius: 3px; background-image: linear-gradient(rgba(143,208,255,.16) 1px, transparent 1px), linear-gradient(90deg, rgba(143,208,255,.16) 1px, transparent 1px); background-size: 20px 20px; }
.dl-btn[data-t="ingegneria"] .dl-ico { border-style: dashed; border-radius: 50%; }

/* MIFT: carta millimetrata */
.dl-btn[data-t="mift"] { --bg: #f7fbff; border-radius: 10px; background-image: linear-gradient(rgba(27,111,168,.14) 1px, transparent 1px), linear-gradient(90deg, rgba(27,111,168,.14) 1px, transparent 1px); background-size: 16px 16px; }
.dl-btn[data-t="mift"] .dl-ico { --ib: #fff; border-radius: 6px; }

/* Patologia Umana: il battito */
.dl-btn[data-t="patologiaumana"] { border-radius: 26px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='28' viewBox='0 0 160 28'%3E%3Cpath d='M0 14H44l6-10 8 22 6-12h14l6-8 6 16 6-8H160' fill='none' stroke='%231B6FA8' stroke-opacity='.4' stroke-width='2' stroke-linejoin='round'/%3E%3C/svg%3E"); background-repeat: repeat-x; background-position: 0 100%; background-size: 160px 28px; }
.dl-btn[data-t="patologiaumana"] .dl-ico { border-radius: 50%; }

/* SCIPOG: scheda elettorale */
.dl-btn[data-t="scipog"] { --bd: #002b45; --sh: #1B6FA8; border-width: 3px; border-radius: 0; }
.dl-btn[data-t="scipog"] .dl-ico { --ib: #fff; --ibd: #002b45; border-width: 3px; border-radius: 4px; }
.dl-btn[data-t="scipog"] .dl-nome { text-transform: uppercase; letter-spacing: .02em; }

/* Scienze Veterinarie: libretto, bordo tratteggiato */
.dl-btn[data-t="scienzeveterinarie"] { border-style: dashed; border-radius: 28px; }
.dl-btn[data-t="scienzeveterinarie"] .dl-ico { border-style: dashed; border-radius: 50%; }

.dl-aiuto { margin: 36px 0 8px; text-align: center; font-size: 16px; color: #41474f; }
.mf-pagina .dl-aiuto a { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; font-weight: 700; color: #005687; }
.dl-aiuto a:hover { text-decoration: underline; }

/* telefono: tessere a due colonne (icona sopra, nome sotto), cosi' i dodici si vedono con poco scorrimento */
@media (max-width: 639px) {
  .dl-hero-in { padding: 36px 16px 40px; }
  .dl-dodici { font-size: 200px; bottom: -40px; }
  .dl-griglia { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 14px; }
  .mf-pagina .dl-btn, .dl-btn { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto 1fr; align-items: start; align-content: start; gap: 12px; min-height: 140px; padding: 16px 12px 14px; box-shadow: 4px 4px 0 var(--sh); }
  .dl-btn:hover { box-shadow: 6px 6px 0 var(--sh-h); }
  .dl-ico { width: 48px; height: 48px; border-radius: 12px; }
  .dl-ico .material-symbols-outlined { font-size: 27px; }
  .dl-btn[data-t="chibiofaram"] .dl-ico { width: 46px; height: 52px; }
  .dl-txt { align-self: end; }
  .dl-nome { font-size: 16px; line-height: 1.18; }
  .dl-sotto, .dl-btn > .material-symbols-outlined { display: none; }
  .dl-n { top: 8px; right: 10px; }
  .dl-btn[data-t="dicam"] { padding-top: 34px; }
  .dl-btn[data-t="cospecs"] { border-radius: 22px 22px 22px 4px; }
  .dl-btn[data-t="patologiaumana"] { border-radius: 22px; padding-bottom: 28px; }
  .dl-btn[data-t="scienzeveterinarie"] { border-radius: 22px; }
  .dl-btn[data-t="dimed"]::before { width: 6px; }
}
@media (max-width: 380px) { .dl-nome { font-size: 15px; } .dl-btn { padding-left: 10px; padding-right: 10px; } }
@media (prefers-reduced-motion: reduce) {
  .dl-griglia > li { animation: none; }
  .dl-btn, .dl-btn > .material-symbols-outlined { transition: none; }
  .dl-btn:hover { transform: none; }
  .dl-btn:hover > .material-symbols-outlined { transform: none; }
  .dl-btn[data-t="biomorf"]:hover::before { animation: none; opacity: 0; }
}
