/* Spazio docenti: elenco e pagine personali. Usa le variabili del portale. */
.teacher-directory {
  border-top: 1px solid var(--border);
  padding-top: 2.4rem;
}
.teacher-directory h2 {
  font-size: 2rem;
  margin-bottom: 0.7rem;
}
.teacher-directory-intro {
  max-width: 740px;
  margin-bottom: 2rem;
}
.teacher-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 2rem 1.75rem;
  list-style: none;
  margin: 0;
  padding: 0;
}
.teacher-card > a {
  display: flex;
  flex-direction: column;
  height: 100%;
  border: 1px solid var(--border);
  background: #fff;
  color: var(--foreground);
  text-decoration: none;
  transition: border-color 0.15s;
}
.teacher-card > a:hover {
  border-color: var(--red);
}
.teacher-card figure {
  margin: 0;
  aspect-ratio: 1 / 1;
  overflow: hidden;
  background: var(--pale);
}
.teacher-card img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.teacher-card-body {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  padding: 1.15rem 1.2rem 1.3rem;
  flex: 1;
}
.teacher-card-body strong {
  font-size: 1.4rem;
  line-height: 1.2;
  font-weight: 600;
}
.teacher-card-role {
  color: var(--muted-foreground);
  font-size: 1rem;
}
.teacher-card-meta {
  font-size: 0.94rem;
  color: var(--muted-foreground);
  margin-bottom: 0.6rem;
}
.teacher-card-body .text-link {
  margin-top: auto;
}

.teacher-hero {
  display: grid;
  grid-template-columns: minmax(240px, 420px) 1fr;
  gap: 3.5rem;
  align-items: center;
  padding-block: 2.5rem 3rem;
}
.teacher-hero figure {
  margin: 0;
}
.teacher-hero img {
  display: block;
  width: 100%;
  height: auto;
  max-height: 560px;
  object-fit: cover;
  border: 1px solid var(--border);
}
.teacher-hero figcaption {
  margin-top: 0.5rem;
  font-size: 0.85rem;
  color: var(--muted-foreground);
}
.teacher-hero h1 {
  font-size: clamp(2.6rem, 5vw, 4.4rem);
  line-height: 1.06;
  letter-spacing: -0.025em;
  font-weight: 600;
  margin: 0.4rem 0 1rem;
}
.teacher-role {
  font-size: 1.3rem;
  line-height: 1.4;
  max-width: 34ch;
  margin-bottom: 1.6rem;
}
.teacher-actions,
.teacher-work-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.9rem 1.4rem;
}
.teacher-actions .action,
.teacher-work-actions .action {
  gap: 0.7rem;
}
.teacher-cv-pending {
  cursor: not-allowed;
  color: var(--muted-foreground);
  border-color: var(--border);
  background: var(--pale);
}
.teacher-cv-pending:hover {
  background: var(--pale);
  color: var(--muted-foreground);
  border-color: var(--border);
}
.teacher-section {
  padding-block: 3rem;
  border-top: 1px solid var(--border);
}
.teacher-section > h2 {
  font-size: 2rem;
  margin-bottom: 1.4rem;
}
.teacher-bio {
  max-width: 68ch;
}
.teacher-bio p + p {
  margin-top: 1rem;
}
.teacher-works {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 1.75rem;
  list-style: none;
  margin: 0;
  padding: 0;
}
.teacher-work {
  display: flex;
  flex-direction: column;
  height: 100%;
  border: 1px solid var(--border);
  border-top: 4px solid var(--red);
  padding: 1.5rem 1.5rem 1.6rem;
  background: #fff;
}
.teacher-work h3 {
  font-size: 1.5rem;
  line-height: 1.2;
  margin: 0.2rem 0 0.7rem;
}
.teacher-work > p:not(.category) {
  margin-bottom: 1.4rem;
}
.teacher-work-actions {
  margin-top: auto;
}
.teacher-work-meta {
  font-weight: 400;
  font-size: 0.9rem;
  opacity: 0.9;
}
.teacher-empty {
  max-width: 60ch;
  color: var(--muted-foreground);
}
.teacher-pager {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1.5rem;
  padding-block: 2.5rem 4rem;
  border-top: 1px solid var(--border);
}
.teacher-pager a {
  display: inline-flex;
  align-items: center;
  gap: 0.8rem;
  color: var(--foreground);
  text-decoration: underline;
  text-underline-offset: 4px;
}
.teacher-pager small {
  display: block;
  font-size: 0.82rem;
  color: var(--muted-foreground);
  text-decoration: none;
}
.teacher-pager-all {
  font-weight: 600;
}
.teacher-page-state {
  padding-block: 4rem;
}
@media (max-width: 760px) {
  .teacher-hero {
    grid-template-columns: 1fr;
    gap: 1.6rem;
    padding-block: 1.5rem 2rem;
  }
  .teacher-hero img {
    max-height: 420px;
  }
  .teacher-works {
    grid-template-columns: 1fr;
  }
  .teacher-pager {
    flex-wrap: wrap;
  }
  .teacher-pager-all {
    order: 3;
    width: 100%;
  }
}

/* Integrazione nel portale esistente (nessuna ricostruzione di portale.js) */
body.docenti-mode main#contenuto { display: none; }
body.docenti-dir .directory-empty { display: none; }
#docenti-root:focus, #docenti-directory-live:focus { outline: none; }
#docenti-directory-live { padding-block: 2.5rem 3rem; margin-bottom: 1rem; }

/* Pagina elenco: solo intestazione, introduzione e docenti */
body.docenti-dir main#contenuto > :not(.breadcrumbs):not(.page-head):not(#docenti-directory-live) { display: none !important; }
body.docenti-dir .page-head > .page-intro:not(.teacher-intro-live),
body.docenti-dir .page-head > .action { display: none; }
body.docenti-dir main#contenuto > .page-head { display: none !important; }
.docenti-heading { padding-top: 1.7rem; margin-bottom: 3rem; }
#docenti-directory-live { border-top: 0; padding-top: 0; }
#docenti-directory-live > .eyebrow,
#docenti-directory-live > h2,
#docenti-directory-live > .teacher-directory-intro { display: none; }

/* Schede lavoro con miniatura */
.teacher-work { flex-direction: row; align-items: flex-start; gap: 1.2rem; }
.teacher-work-thumb { flex: 0 0 96px; display: block; aspect-ratio: 3 / 4; overflow: hidden; border: 1px solid var(--border); background: var(--pale); }
.teacher-work-thumb img { display: block; width: 100%; height: 100%; object-fit: cover; object-position: top left; }
.teacher-work-body { display: flex; flex-direction: column; flex: 1; min-width: 0; align-self: stretch; }
.teacher-work-body > p:not(.category) { margin-bottom: 1.2rem; }
.teacher-work-body .teacher-work-actions { margin-top: auto; }
.teacher-work h3 { margin-top: 0.1rem; }

/* Pagina di lettura del lavoro */
.work-page { padding-block: 1.5rem 3rem; max-width: 860px; }
.work-head h1 { font-size: clamp(2.2rem, 4.4vw, 3.6rem); line-height: 1.08; letter-spacing: -0.02em; font-weight: 600; margin: 0.4rem 0 0.9rem; }
.work-author { color: var(--muted-foreground); margin-bottom: 2rem; }
.work-author a { color: var(--foreground); text-decoration: underline; text-underline-offset: 4px; }
.work-body { max-width: 70ch; font-size: 1.125rem; line-height: 1.65; }
.work-body h2 { font-size: 1.7rem; line-height: 1.2; margin: 2.6rem 0 0.9rem; padding-top: 1.4rem; border-top: 1px solid var(--border); }
.work-body h3 { font-size: 1.3rem; margin: 1.8rem 0 0.6rem; }
.work-body p, .work-body ul, .work-body ol, .work-body table, .work-body blockquote, .work-body aside { margin-bottom: 1rem; }
.work-body ul, .work-body ol { padding-left: 1.4rem; }
.work-body ul { list-style: disc; }
.work-body ol { list-style: decimal; }
.work-body li { margin-bottom: 0.5rem; }
.work-body li > p { margin-bottom: 0.4rem; }
.work-body blockquote { border-left: 4px solid var(--red); padding: 0.2rem 0 0.2rem 1.2rem; color: var(--foreground); }
.work-body .work-box { background: var(--pale); border-left: 4px solid var(--red); padding: 1.1rem 1.3rem; }
.work-body .work-box p:last-child { margin-bottom: 0; }
.work-body table { width: 100%; border-collapse: collapse; font-size: 1rem; display: block; overflow-x: auto; }
.work-body th, .work-body td { border: 1px solid var(--border); padding: 0.55rem 0.7rem; text-align: left; vertical-align: top; }
.work-body th { background: var(--pale); }
.work-footer { display: flex; flex-wrap: wrap; align-items: center; gap: 1rem 1.6rem; margin-top: 3rem; padding-top: 1.6rem; border-top: 1px solid var(--border); }
.work-footer .action { gap: 0.7rem; }
@media (max-width: 760px) {
  .teacher-work-thumb { flex-basis: 76px; }
}

/* Copertina personale del docente */
.teacher-cover { position: relative; overflow: hidden; background: #0b3548; color: #fff; isolation: isolate; }
.teacher-cover-bg { position: absolute; inset: -40px; background-size: cover; background-position: center; filter: blur(34px) saturate(1.1); transform: scale(1.1); z-index: -2; }
.teacher-cover::after { content: ""; position: absolute; inset: 0; background: linear-gradient(90deg, rgba(8,38,54,.94) 0%, rgba(8,38,54,.82) 55%, rgba(8,38,54,.6) 100%); z-index: -1; }
.teacher-cover-in { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(260px, 0.95fr); gap: 3.5rem; align-items: center; padding-block: 3.2rem 3.6rem; }
.teacher-cover-kicker { font-size: .82rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: #ffd9e0; margin: 0 0 1rem; }
.teacher-cover h1 { color: #fff; font-size: clamp(2.6rem, 5.4vw, 4.6rem); line-height: 1.04; letter-spacing: -.025em; font-weight: 600; margin: 0 0 1rem; }
.teacher-cover h1:focus { outline: none; }
.teacher-cover .teacher-role { color: #fff; font-size: 1.3rem; line-height: 1.4; max-width: 34ch; margin: 0 0 .6rem; }
.teacher-cover-meta { color: #cfe3ea; margin: 0 0 1.8rem; font-size: 1rem; }
.teacher-cover .teacher-actions { display: flex; flex-wrap: wrap; gap: .9rem 1.2rem; }
.teacher-cover-btn { background: transparent; color: #fff; border: 1px solid #fff; cursor: pointer; }
.teacher-cover-btn:hover { background: #fff; color: #0b3548; }
.teacher-cover .teacher-cv-pending { background: rgba(255,255,255,.12); color: #fff; border-color: rgba(255,255,255,.55); }
.teacher-cover .teacher-cv-pending:hover { background: rgba(255,255,255,.12); color: #fff; border-color: rgba(255,255,255,.55); }
.teacher-cover-fig { margin: 0; justify-self: end; max-width: 520px; width: 100%; }
.teacher-cover-fig img { display: block; width: 100%; height: auto; max-height: 540px; object-fit: contain; background: #fff; border: 6px solid #fff; box-shadow: 0 18px 44px rgba(0,0,0,.35); }
.teacher-cover-fig figcaption { margin-top: .6rem; font-size: .85rem; color: #cfe3ea; text-align: right; }
@media (max-width: 860px) {
  .teacher-cover-in { grid-template-columns: 1fr; gap: 1.8rem; padding-block: 2rem 2.4rem; }
  .teacher-cover-fig { order: -1; justify-self: stretch; max-width: 460px; }
  .teacher-cover-fig figcaption { text-align: left; }
}
@media (prefers-reduced-motion: no-preference) { .teacher-cover-fig img { transition: transform .3s; } }
@media print, (forced-colors: active) { .teacher-cover { background: #fff; color: #000; } .teacher-cover-bg, .teacher-cover::after { display: none; } .teacher-cover h1, .teacher-cover .teacher-role { color: #000; } }
.teacher-cover h1:focus, .teacher-cover h1:focus-visible { outline: 0 !important; box-shadow: none !important; }
.teacher-cover-fig img { max-height: 440px; width: auto; max-width: 100%; margin-left: auto; }
.teacher-cover-fig { display: flex; flex-direction: column; align-items: flex-end; }
@media (max-width: 860px) { .teacher-cover-fig { align-items: flex-start; } .teacher-cover-fig img { margin-left: 0; } }
#docenti-root .teacher-cover h1:focus, #docenti-root .teacher-cover h1:focus-visible, #docenti-root h1[tabindex]:focus { outline: 0 !important; outline-color: transparent !important; box-shadow: none !important; border: 0 !important; }

/* Gallerie dei contributi docenti: scorrimento nativo, senza riproduzione automatica. */
.work-body .work-gallery{min-width:0;max-width:100%;margin:1.8rem 0 2rem;padding:0}
.work-body .work-gallery h2{font-size:1.5rem;margin:0 0 .6rem;padding:0;border:0}
.work-gallery-help{font-size:.95rem;color:var(--muted-foreground);line-height:1.6;margin:0 0 1rem}
.work-gallery-track{display:flex;gap:16px;overflow-x:auto;overscroll-behavior-x:contain;scroll-snap-type:x mandatory;scrollbar-width:thin;max-width:100%;padding:0 0 8px;position:relative}
.work-body .work-gallery-slide{flex:0 0 100%;min-width:0;scroll-snap-align:start;margin:0}
.work-gallery-photo{display:block;position:relative;border-radius:12px;overflow:hidden;background:var(--pale,#f2f5f6);color:var(--foreground);text-decoration:none}
.work-gallery-photo img{display:block;width:100%;height:clamp(240px,55vw,480px);object-fit:contain}
.work-gallery-photo>span{position:absolute;bottom:12px;right:12px;background:#fff;color:#17374b;border:1px solid #b9c5ce;border-radius:8px;padding:10px 14px;min-height:44px;font-size:.9rem;font-weight:700;box-sizing:border-box}
.work-body .work-gallery-slide figcaption{font-size:.95rem;line-height:1.6;padding:.8rem .15rem 0;overflow-wrap:anywhere}
.work-gallery-controls{display:flex;align-items:center;justify-content:space-between;gap:12px;flex-wrap:wrap;margin-top:12px}
.work-gallery-controls[hidden]{display:none}
.work-gallery-controls button{display:inline-flex;align-items:center;justify-content:center;gap:8px;min-height:48px;padding:10px 16px;border:1px solid #b4c1cb;background:#fff;color:#17374b;border-radius:9px;font:inherit;font-size:1rem;cursor:pointer}
.work-gallery-controls button:hover:not(:disabled){background:#edf3f7}
.work-gallery-controls button:active:not(:disabled){background:#dce8f0}
.work-gallery-controls button:disabled{opacity:.45;cursor:default}
.work-gallery-count{margin:0!important;font-size:.95rem;font-weight:600;color:var(--foreground)}
.work-gallery-track:focus-visible,.work-gallery-photo:focus-visible,.work-gallery-controls button:focus-visible{outline:3px solid #2360c1;outline-offset:3px}
.work-gallery-photo:focus-visible{outline-offset:-3px}
body.work-gallery-open{overflow:hidden}
.work-gallery-dialog{width:min(1120px,calc(100vw - 20px));height:min(920px,calc(100dvh - 20px));max-width:none;max-height:none;box-sizing:border-box;border:1px solid #47505c;border-radius:14px;padding:16px;background:#10151c;color:#fff;overflow:auto;overscroll-behavior:contain}
.work-gallery-dialog::backdrop{background:#080c12e8}
.work-gallery-dialog-layout{display:grid;grid-template-rows:auto minmax(160px,1fr) auto auto;gap:12px;height:100%;min-height:100%;min-width:0}
.work-gallery-dialog-layout>*{min-width:0}
.work-gallery-dialog header{display:flex;justify-content:space-between;align-items:center;gap:12px;flex-wrap:wrap}
.work-gallery-dialog header p{margin:0;font-size:1rem;font-weight:600;flex:1 1 5rem;overflow-wrap:anywhere}
.work-gallery-dialog button{min-height:48px;padding:10px 16px;border:1px solid #6e7c8c;border-radius:9px;background:#253140;color:#fff;font:inherit;font-size:1rem;cursor:pointer;display:inline-flex;align-items:center;justify-content:center;gap:10px;min-width:0;max-width:100%;overflow-wrap:anywhere}
.work-gallery-dialog button:hover:not(:disabled){background:#34465b}
.work-gallery-dialog button:disabled{opacity:.4;cursor:default}
.work-gallery-dialog button:focus-visible{outline:3px solid #a6d7ff;outline-offset:3px}
.work-gallery-dialog-image{min-height:160px;min-width:0;display:flex;align-items:center;justify-content:center;overflow:hidden}
.work-gallery-dialog-image img{display:block;width:100%;height:100%;max-width:100%;max-height:100%;object-fit:contain}
.work-gallery-dialog-caption{margin:0;font-size:.95rem;line-height:1.5;overflow-wrap:anywhere}
.work-gallery-dialog nav{display:flex;justify-content:space-between;gap:12px;flex-wrap:wrap}
.work-gallery-dialog nav button{flex:1 1 8rem}
@media(max-width:500px){.work-gallery-controls{gap:8px}.work-gallery-controls button{font-size:.9rem;padding-inline:12px}.work-gallery-count{font-size:.875rem}.work-gallery-dialog{padding:12px}.work-gallery-dialog nav button{flex:1;min-width:0;font-size:.9rem;padding-inline:8px}}
@media print{.work-gallery-track{display:block;overflow:visible}.work-gallery-slide{break-inside:avoid;margin-bottom:1rem!important}.work-gallery-photo img{height:auto;max-height:none}.work-gallery-photo>span,.work-gallery-controls,.work-gallery-help,.work-gallery-dialog{display:none!important}}
