/* ============================================================
   Videoteca Dott. Michele Coppola — stile pubblico
   Palette brand: blu #0d5c8f / #1a72ab, giallo #f0c419
   Font: DM Sans (self-hosted, estratto dal prototipo originale)
   ============================================================ */

/* DM Sans variabile (300–700). Due sottoinsiemi: latino base ed esteso. */
@font-face {
  font-family: "DM Sans";
  font-style: normal;
  font-weight: 300 700;
  font-display: swap;
  src: url("/assets/fonts/dmsans-2.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "DM Sans";
  font-style: normal;
  font-weight: 300 700;
  font-display: swap;
  src: url("/assets/fonts/dmsans-1.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

:root {
  --blue: #0d5c8f;
  --blue-d: #083f63;
  --blue-l: #1a72ab;
  --yellow: #f0c419;
  --yellow-d: #d9ae06;
  --ink: #22303f;
  --muted: #5c6a78;
  --line: #e4e9ef;
  --bg: #ffffff;
  --bg-soft: #f4f7fa;
  --radius: 12px;
  --shadow: 0 6px 24px rgba(13, 92, 143, 0.10);
  --maxw: 1180px;
}
* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  font-family: "DM Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  color: var(--ink);
  background: var(--bg);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; display: block; }
.container { max-width: var(--maxw); margin: 0 auto; padding: 0 20px; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ---------- Header / Nav ---------- */
.site-header {
  position: sticky; top: 0; z-index: 100;
  background: #fff; border-bottom: 1px solid var(--line);
}
.nav {
  display: flex; align-items: center; justify-content: space-between;
  height: 76px; gap: 20px;
}
.brand { display: flex; flex-direction: column; align-items: center; line-height: 1; padding: 4px 6px; gap: 2px; }
.brand:hover { text-decoration: none; }
.brand .mark {
  font-weight: 600; font-size: 44px; letter-spacing: -1px; color: var(--blue-l); line-height: 1;
}
.brand .brand-name { font-size: 9.5px; color: var(--blue-l); letter-spacing: .4px; font-weight: 400; }
.brand .brand-sub { font-size: 9.5px; color: var(--blue-l); letter-spacing: .4px; font-weight: 400; }
.nav-links { display: flex; align-items: center; gap: 6px; list-style: none; }
.nav-links > li { position: relative; }
.nav-links a.top, .nav-links button.top {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 10px 14px; border-radius: 8px; font-size: 15px; font-weight: 600;
  color: var(--ink); background: none; border: none; cursor: pointer; font-family: inherit;
}
.nav-links a.top:hover, .nav-links button.top:hover { background: var(--bg-soft); text-decoration: none; }
.nav-links a.top.active { color: var(--blue); }
.caret { font-size: 10px; opacity: .7; }
.dropdown {
  position: absolute; top: 100%; left: 0; min-width: 260px;
  background: #fff; border: 1px solid var(--line); border-radius: 10px;
  box-shadow: var(--shadow); padding: 8px; display: none; list-style: none;
}
.nav-links > li:hover .dropdown, .dropdown.open { display: block; }
.dropdown a { display: block; padding: 9px 12px; border-radius: 7px; font-size: 14.5px; color: var(--ink); }
.dropdown a:hover { background: var(--bg-soft); color: var(--blue); text-decoration: none; }
.nav-actions { display: flex; align-items: center; gap: 8px; }
.icon-btn {
  width: 40px; height: 40px; border-radius: 50%; border: 1px solid var(--line);
  background: #fff; color: var(--blue); display: inline-flex; align-items: center; justify-content: center;
  cursor: pointer; font-size: 17px;
}
.icon-btn:hover { background: var(--bg-soft); }
.nav-toggle { display: none; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font-weight: 700; font-size: 15px; padding: 12px 22px; border-radius: 9px;
  border: none; cursor: pointer; font-family: inherit; transition: transform .05s, background .15s;
}
.btn:active { transform: translateY(1px); }
.btn-yellow { background: var(--yellow); color: #3a2f00; }
.btn-yellow:hover { background: var(--yellow-d); text-decoration: none; }
.btn-blue { background: var(--blue); color: #fff; }
.btn-blue:hover { background: var(--blue-d); text-decoration: none; }
.btn-ghost { background: #fff; color: var(--blue); border: 1px solid var(--line); }
.btn-ghost:hover { background: var(--bg-soft); text-decoration: none; }
.btn-block { width: 100%; }
.btn-sm { padding: 8px 14px; font-size: 13.5px; }

/* ---------- Hero ---------- */
.hero {
  position: relative; color: #fff; overflow: hidden; background: var(--blue);
}
/* Foto di sfondo (impostata per pagina via --hero-img). Ancorata a destra. */
.hero .hero-media {
  position: absolute; inset: 0; z-index: 0;
  background-image: var(--hero-img); background-size: cover;
  background-position: right center; background-repeat: no-repeat;
}
/* Sfumatura blu: opaca a sinistra (testo leggibile) → trasparente a destra (foto). */
.hero::after {
  content: ""; position: absolute; inset: 0; z-index: 1;
  background: linear-gradient(90deg,
    var(--blue) 0%, var(--blue) 22%,
    rgba(13,92,143,.82) 44%, rgba(13,92,143,.45) 66%, rgba(13,92,143,.12) 100%);
}
.hero-inner { position: relative; z-index: 2; padding: 96px 0 100px; max-width: 680px; }
.hero h1 { font-size: clamp(34px, 5vw, 62px); line-height: 1.08; font-weight: 700; letter-spacing: -.5px; text-transform: uppercase; }
.hero p { margin: 22px 0 30px; font-size: 19px; opacity: .95; max-width: 540px; }
/* Variante compatta per le pagine interne (categorie, edizioni, lezioni…). */
.hero.hero--compact .hero-inner { padding: 52px 0 56px; max-width: 760px; }
.hero.hero--compact h1 { font-size: clamp(28px, 4vw, 46px); }
.hero .hero-kicker { display: inline-block; font-size: 13px; font-weight: 700; letter-spacing: 1.5px; text-transform: uppercase; color: var(--yellow); margin-bottom: 12px; }
/* Hero interni: immagini più sature ed evidenti (come l'hero della home). */
.hero.hero--compact .hero-media { filter: saturate(1.55) contrast(1.14) brightness(1.06); }
.hero.hero--compact::after {
  background: linear-gradient(90deg,
    var(--blue) 0%, rgba(13,92,143,.80) 30%,
    rgba(13,92,143,.34) 60%, rgba(13,92,143,.04) 100%);
}

/* ---------- Section ---------- */
.section { padding: 64px 0; }
.section.soft { background: var(--bg-soft); }
.section-head { text-align: center; margin-bottom: 34px; }
.section-head h2 { font-size: clamp(24px, 3vw, 34px); color: var(--blue-d); text-transform: uppercase; letter-spacing: -.5px; }
.section-head p { color: var(--muted); margin-top: 10px; max-width: 640px; margin-inline: auto; }
.filters { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-bottom: 30px; }
.filter {
  padding: 9px 18px; border-radius: 30px; border: 1px solid var(--line); background: #fff;
  color: var(--muted); font-weight: 600; font-size: 14px; cursor: pointer; font-family: inherit;
}
.filter:hover { border-color: var(--blue-l); color: var(--blue); }
.filter.active { background: var(--blue); color: #fff; border-color: var(--blue); }

/* ---------- Scelta edizione: Lezioni / Live Surgery ---------- */
.choose-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 24px; max-width: 860px; margin: 0 auto; }
.choose-card {
  position: relative; overflow: hidden; border-radius: var(--radius); min-height: 260px;
  display: flex; flex-direction: column; justify-content: flex-end; padding: 26px;
  color: #fff; border: 1px solid var(--line); background: var(--blue-d);
  transition: transform .14s, box-shadow .14s;
}
.choose-card:hover { transform: translateY(-4px); box-shadow: var(--shadow); text-decoration: none; }
.choose-card .choose-media { position: absolute; inset: 0; z-index: 0; background-size: cover; background-position: center; filter: saturate(1.5) contrast(1.12) brightness(1.05); }
.choose-card::after { content: ""; position: absolute; inset: 0; z-index: 1; background: linear-gradient(180deg, rgba(8,63,99,.15) 0%, rgba(8,63,99,.55) 55%, rgba(8,63,99,.9) 100%); }
.choose-card > * { position: relative; z-index: 2; }
.choose-card h3 { font-size: 24px; font-weight: 700; text-transform: uppercase; letter-spacing: -.3px; }
.choose-card p { font-size: 14px; opacity: .9; margin-top: 6px; }
.choose-card .choose-go { margin-top: 14px; font-weight: 700; font-size: 14px; color: var(--yellow); }

/* ---------- Video grid ---------- */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 22px; }
.card {
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden;
  display: flex; flex-direction: column; transition: transform .12s, box-shadow .12s;
}
.card:hover { transform: translateY(-3px); box-shadow: var(--shadow); }
.card .thumb {
  aspect-ratio: 16/9; background: linear-gradient(135deg, var(--blue) 0%, var(--blue-d) 100%);
  position: relative; display: flex; align-items: center; justify-content: center; overflow: hidden;
}
.card .thumb img { width: 100%; height: 100%; object-fit: cover; }
.card .thumb .play {
  position: absolute; width: 56px; height: 56px; border-radius: 50%;
  background: rgba(255,255,255,.92); color: var(--blue); display: flex; align-items: center; justify-content: center;
  font-size: 20px; padding-left: 4px;
}
.card .thumb .lock { position: absolute; top: 10px; right: 10px; background: rgba(0,0,0,.55); color: #fff; font-size: 11px; font-weight: 700; padding: 4px 9px; border-radius: 20px; letter-spacing: .3px; }
.card .body { padding: 16px 16px 18px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.card .cat { font-size: 12px; font-weight: 700; color: var(--blue-l); text-transform: uppercase; letter-spacing: .4px; }
.card .title { font-size: 17px; font-weight: 700; color: var(--ink); line-height: 1.25; }
.card .desc { font-size: 13.5px; color: var(--muted); flex: 1; }
.card .foot { display: flex; align-items: center; justify-content: space-between; margin-top: 6px; }
.card .dur { font-size: 12.5px; color: var(--muted); }
.badge-pro { background: #fef3d0; color: #8a6d00; font-size: 11px; font-weight: 700; padding: 3px 9px; border-radius: 20px; }
.empty { text-align: center; color: var(--muted); padding: 40px 0; grid-column: 1/-1; }

/* ---------- Carosello video (scroll orizzontale) ---------- */
.carousel { position: relative; }
.hrow {
  display: flex; gap: 22px; overflow-x: auto; scroll-behavior: smooth;
  padding: 6px 2px 20px; scroll-snap-type: x proximity;
  scrollbar-width: thin; scrollbar-color: var(--line) transparent;
}
.hrow::-webkit-scrollbar { height: 8px; }
.hrow::-webkit-scrollbar-thumb { background: var(--line); border-radius: 8px; }
.hrow > .card { flex: 0 0 300px; scroll-snap-align: start; }
.hrow > .empty { flex: 1 0 100%; }
.carousel-arrow {
  position: absolute; top: 42%; transform: translateY(-50%); z-index: 4;
  width: 46px; height: 46px; border-radius: 50%; border: 1px solid var(--line);
  background: #fff; color: var(--blue); font-size: 24px; line-height: 1; cursor: pointer;
  box-shadow: var(--shadow); display: flex; align-items: center; justify-content: center;
}
.carousel-arrow.left { left: -14px; }
.carousel-arrow.right { right: -14px; }
.carousel-arrow:hover { background: var(--bg-soft); }
.carousel-arrow:disabled { opacity: 0; pointer-events: none; }
.card .thumb .demo-badge { position: absolute; top: 10px; left: 10px; background: rgba(13,92,143,.9); color: #fff; font-size: 10.5px; font-weight: 700; padding: 3px 8px; border-radius: 20px; letter-spacing: .4px; text-transform: uppercase; }
@media (max-width: 860px) { .carousel-arrow { display: none; } }

/* ---------- Player page ---------- */
.player-wrap { max-width: 960px; margin: 0 auto; }
.player {
  aspect-ratio: 16/9; width: 100%; border-radius: var(--radius); overflow: hidden;
  background: #000; border: 1px solid var(--line);
}
.player iframe { width: 100%; height: 100%; border: 0; }
.locked-box {
  aspect-ratio: 16/9; border-radius: var(--radius); border: 1px dashed var(--blue-l);
  background: var(--bg-soft); display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center; gap: 14px; padding: 30px;
}
.locked-box .lk-ico { font-size: 40px; }
.breadcrumb { font-size: 13.5px; color: var(--muted); margin-bottom: 18px; }
.breadcrumb a { color: var(--muted); }

/* ---------- Forms / cards ---------- */
.panel { max-width: 440px; margin: 40px auto; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 30px; box-shadow: var(--shadow); }
.panel.wide { max-width: 760px; }
.panel h1 { font-size: 24px; color: var(--blue-d); margin-bottom: 6px; }
.panel .sub { color: var(--muted); font-size: 14px; margin-bottom: 20px; }
.field { margin-bottom: 15px; }
.field label { display: block; font-size: 13px; font-weight: 600; color: var(--muted); margin-bottom: 5px; }
.field input, .field textarea, .field select {
  width: 100%; padding: 11px 13px; border: 1px solid var(--line); border-radius: 9px; font-size: 15px; font-family: inherit;
}
.field input:focus, .field textarea:focus { outline: 2px solid var(--blue-l); border-color: var(--blue-l); }
.check { display: flex; gap: 10px; align-items: flex-start; font-size: 13.5px; color: var(--muted); }
.check input { width: 18px; height: 18px; margin-top: 2px; flex-shrink: 0; }
.tabs-auth { display: flex; gap: 6px; margin-bottom: 22px; background: var(--bg-soft); padding: 5px; border-radius: 10px; }
.tabs-auth button { flex: 1; padding: 9px; border: none; background: none; border-radius: 7px; font-weight: 700; font-size: 14px; cursor: pointer; color: var(--muted); font-family: inherit; }
.tabs-auth button.active { background: #fff; color: var(--blue); box-shadow: 0 1px 3px rgba(0,0,0,.08); }
.notice { padding: 12px 14px; border-radius: 9px; font-size: 14px; margin-bottom: 16px; }
.notice.err { background: #fdeceb; color: #b23b32; }
.notice.ok { background: #e7f5ec; color: #1f7a3d; }
.notice.info { background: #e9f2f9; color: var(--blue-d); }

/* ---------- Footer ---------- */
.site-footer { background: var(--blue-d); color: #cfe0ee; padding: 54px 0 26px; margin-top: 40px; }
.footer-grid { display: grid; grid-template-columns: 1.4fr 1fr 1fr; gap: 34px; }
.site-footer .mark { font-size: 26px; font-weight: 800; color: #fff; }
.site-footer .mark b { color: var(--yellow); }
.site-footer h4 { color: #fff; font-size: 14px; text-transform: uppercase; letter-spacing: .5px; margin-bottom: 14px; }
.site-footer a { color: #cfe0ee; }
.site-footer ul { list-style: none; display: flex; flex-direction: column; gap: 8px; font-size: 14px; }
.footer-contact { font-size: 14px; line-height: 1.8; }
.disclaimer { border-top: 1px solid rgba(255,255,255,.15); margin-top: 34px; padding-top: 20px; font-size: 12px; color: #9db8ce; }
.footer-bottom { margin-top: 14px; font-size: 12.5px; color: #9db8ce; }

/* ---------- Search overlay ---------- */
.search-overlay {
  position: fixed; inset: 0; background: rgba(8,63,99,.55); backdrop-filter: blur(3px);
  display: none; align-items: flex-start; justify-content: center; z-index: 200; padding-top: 12vh;
}
.search-overlay.open { display: flex; }
.search-box { background: #fff; width: min(600px, 92vw); border-radius: 14px; padding: 22px; box-shadow: var(--shadow); }
.search-box input { width: 100%; padding: 14px 16px; font-size: 18px; border: 1px solid var(--line); border-radius: 10px; font-family: inherit; }
.search-results { margin-top: 14px; max-height: 50vh; overflow: auto; }
.search-results a { display: block; padding: 11px 12px; border-radius: 8px; color: var(--ink); }
.search-results a:hover { background: var(--bg-soft); text-decoration: none; }
.search-results .sr-cat { font-size: 12px; color: var(--muted); }

/* ---------- Loading ---------- */
.skeleton { background: linear-gradient(90deg, #eef2f6 25%, #e2e8ef 37%, #eef2f6 63%); background-size: 400% 100%; animation: sk 1.3s ease infinite; border-radius: 8px; }
@keyframes sk { 0% { background-position: 100% 0; } 100% { background-position: -100% 0; } }

/* ---------- Responsive ---------- */
@media (max-width: 860px) {
  .nav-links, .nav .search-trigger { display: none; }
  .nav-links.open {
    display: flex; position: absolute; top: 76px; left: 0; right: 0; flex-direction: column;
    align-items: stretch; background: #fff; border-bottom: 1px solid var(--line); padding: 10px; gap: 2px;
  }
  .nav-links.open .dropdown { position: static; display: block; box-shadow: none; border: none; padding-left: 12px; }
  .nav-toggle { display: inline-flex; }
  .footer-grid { grid-template-columns: 1fr; gap: 26px; }
  .hero .hero-media { background-position: 72% center; opacity: .5; }
  .hero::after { background: linear-gradient(90deg, var(--blue) 0%, rgba(13,92,143,.75) 60%, rgba(13,92,143,.55) 100%); }
  .choose-grid { grid-template-columns: 1fr; }
}
