@import url("https://fonts.googleapis.com/css2?family=Cormorant+Garamond:ital,wght@0,500;0,600;0,700;1,500&family=Fraunces:ital,wght@0,500;0,600;0,700;1,500&family=Source+Sans+3:ital,wght@0,400;0,500;0,600;0,700;1,400&display=swap");

:root{
  --brand:#800020;
  --brand-2:#5a0016;
  --font-brand:"Cormorant Garamond",ui-serif,Georgia,"Times New Roman",Times,serif;
  --font-logo:"Fraunces",ui-serif,Georgia,"Times New Roman",Times,serif;
  --font-body:"Source Sans 3",ui-sans-serif,system-ui,-apple-system,Segoe UI,Roboto,Ubuntu,Cantarell,"Noto Sans",Helvetica,Arial,sans-serif;
  --bg:#f1ebe4;
  --text:#161412;
  --muted:#5f5a55;
  --border:#dfd4c9;
  --card:#fdfaf6;
  --surface:#f7f1ea;
  --shadow:0 12px 36px rgba(45,35,28,.07);
  --shadow-hover:0 18px 48px rgba(128,0,32,.12);
  --radius:20px;
  --ease-smooth:cubic-bezier(0.22,1,0.36,1);
}
*{box-sizing:border-box}
html{
  scroll-behavior:smooth;
}
@media (prefers-reduced-motion:reduce){
  html{scroll-behavior:auto}
}
html,body{height:100%}
body{
  margin:0;
  font-family:var(--font-body);
  color:var(--text);
  background-color:var(--bg);
  background-image:
    radial-gradient(ellipse 110% 55% at 50% -18%, rgba(128,0,32,.09), transparent 50%),
    radial-gradient(ellipse 55% 40% at 100% 8%, rgba(120,90,70,.06), transparent 45%),
    linear-gradient(180deg,#f5efe7 0%,var(--bg) 42%,#ebe3d9 100%);
  background-attachment:fixed;
}

/* Sfondo raffinato: calle stilizzate molto leggere (solo profondità, non protagonista). */
body::before{
  content:"";
  position:fixed;
  inset:-12%;
  z-index:0;
  pointer-events:none;
  background-repeat:repeat;
  background-size:520px 520px;
  opacity:.35;
  mix-blend-mode:multiply;
  filter:blur(.15px);
  background-image:url("data:image/svg+xml,%3Csvg%20xmlns%3D%27http%3A//www.w3.org/2000/svg%27%20width%3D%27520%27%20height%3D%27520%27%20viewBox%3D%270%200%20520%20520%27%3E%3Crect%20width%3D%27520%27%20height%3D%27520%27%20fill%3D%27none%27/%3E%3Cg%20fill%3D%27none%27%20stroke%3D%27%23800020%27%20stroke-opacity%3D%270.18%27%20stroke-width%3D%272.2%27%20stroke-linecap%3D%27round%27%3E%3Cpath%20d%3D%27M120%20410%20c40-110%20120-150%20160-250%20c18-45%208-90-26-120%20c-34-30-86-10-112%2028%20c-22%2032-28%2076-14%20112%20c14%2036%2048%2058%2078%2070%27/%3E%3Cpath%20d%3D%27M170%20360%20c14-34%2042-70%2074-82%20c20-8%2040-6%2056%206%20c-20%2010-40%2030-52%2050%20c-10%2018-16%2038-14%2056%27%20stroke-opacity%3D%270.14%27/%3E%3Cpath%20d%3D%27M360%20460%20c-34-96-92-132-126-210%20c-20-48-20-98%2014-132%20c38-38%20102-24%20130%2032%20c22%2044%2014%2094-20%20126%20c-22%2020-54%2032-78%2036%27/%3E%3Cpath%20d%3D%27M330%20410%20c-10-30-30-60-54-72%20c-18-8-38-8-54%200%20c18%208%2034%2024%2044%2042%20c10%2016%2016%2034%2016%2050%27%20stroke-opacity%3D%270.14%27/%3E%3C/g%3E%3C/svg%3E");
}
/* Garantisce che i contenuti stiano sopra l'overlay. */
body > *{position:relative;z-index:1}
a{color:inherit;text-decoration:none}
.container{max-width:1100px;margin:0 auto;padding:24px}
.topbar{
  position:sticky;top:0;z-index:10;
  background:rgba(253,248,242,.86);
  backdrop-filter:saturate(160%) blur(14px);
  border-bottom:1px solid var(--border);
  box-shadow:0 1px 0 rgba(255,255,255,.45) inset;
}
.topbar-inner{display:flex;align-items:center;justify-content:space-between;gap:16px}
.brand{
  display:inline-flex;
  align-items:center;
  gap:12px;
  text-decoration:none;
}
.brand--admin{gap:14px}
.brand-logo-wrap{
  display:inline-flex;
  border-radius:999px;
  overflow:hidden;
  position:relative;
  vertical-align:middle;
  --shine-x:50%;
  --shine-y:36%;
}
.brand-logo{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  position:relative;
  z-index:1;
  padding:9px clamp(44px,8.8vw,72px) 10px;
  border-radius:999px;
  background:var(--brand);
  color:#fff;
  font-family:var(--font-logo);
  font-optical-sizing:auto;
  font-weight:650;
  font-size:clamp(16px,2.15vw,21px);
  letter-spacing:.08em;
  line-height:1.05;
  white-space:nowrap;
  overflow:hidden;
  border:2px solid rgba(255,255,255,.9);
  box-shadow:
    0 1px 0 rgba(255,255,255,.42) inset,
    0 0 0 1px rgba(0,0,0,.09),
    0 5px 18px rgba(45,12,20,.28),
    0 10px 28px rgba(45,12,20,.1);
  transition:transform .35s var(--ease-smooth),box-shadow .35s var(--ease-smooth);
}
.brand:hover .brand-logo{
  transform:translateY(-1px);
  box-shadow:
    0 2px 0 rgba(255,255,255,.42) inset,
    0 1px 0 rgba(0,0,0,.12) inset,
    0 10px 28px rgba(45,12,20,.34),
    0 0 0 1px rgba(0,0,0,.07);
}
.brand-logo::after{
  content:"";
  position:absolute;
  inset:0;
  border-radius:inherit;
  background:radial-gradient(
    ellipse 95% 78% at var(--shine-x) var(--shine-y),
    rgba(255,255,255,.52) 0%,
    rgba(255,255,255,.12) 38%,
    transparent 62%
  );
  pointer-events:none;
  mix-blend-mode:soft-light;
  z-index:2;
  transition:opacity .25s var(--ease-smooth);
}
.brand-admin{
  font-family:var(--font-body);
  font-size:14px;
  font-weight:700;
  color:var(--muted);
  letter-spacing:.04em;
  text-transform:uppercase;
}
.nec-page-head-logo.brand{gap:0}
.nav{display:flex;align-items:center;gap:14px;color:var(--muted);font-size:14px}
.nav a:hover{color:var(--text)}

/* Mobile/tablet: evita sovrapposizioni header/nav e migliora spazi */
@media (max-width:640px){
  .container{padding:16px}
  .topbar-inner{flex-wrap:wrap;justify-content:center}
  .nav{flex-wrap:wrap;justify-content:center;gap:10px;font-size:13px}
  .brand{justify-content:center}
}
.hero{padding:32px 0 18px}
.hero h1{
  margin:0;
  font-size:clamp(28px,4.6vw,40px);
  letter-spacing:-.2px;
  font-family:var(--font-brand);
  font-weight:700;
  line-height:1.08;
}
.hero p{margin:12px 0 0;color:var(--muted);max-width:62ch;line-height:1.62;font-size:15px}
.hero-actions{margin-top:14px;max-width:720px}
.search{
  display:flex;gap:10px;align-items:center;
  flex-wrap:wrap;
  padding:12px;
  border:1px solid rgba(128,0,32,.14);
  border-radius:18px;
  background:linear-gradient(180deg,#fffefb,#f4ebe2);
  box-shadow:var(--shadow),0 0 0 1px rgba(255,255,255,.55) inset;
}
.hero--center .search{justify-content:center}
.hero--center .search .input{flex:1;min-width:0}
.search .input{border-radius:14px}
.search .input{border-color:transparent}
.search .input:focus{border-color:transparent;box-shadow:none}
.search-actions{display:flex;gap:10px;flex:0 0 auto}
.btn-link{
  background:var(--card);color:#1c1917;
  border:1px solid var(--border);
  padding:10px 14px;border-radius:14px;
  font-weight:700;font-size:14px;
  transition:transform .28s var(--ease-smooth),background .28s var(--ease-smooth),border-color .28s var(--ease-smooth),box-shadow .28s var(--ease-smooth);
}
.btn-link:hover{
  background:var(--surface);
  transform:translateY(-1px);
  box-shadow:0 6px 16px rgba(45,35,28,.08);
}
.pill{
  display:inline-flex;align-items:center;gap:8px;
  padding:8px 12px;border:1px solid var(--border);
  border-radius:999px;color:var(--muted);font-size:13px;
}
.accent{color:var(--brand);font-weight:700}
.grid{
  display:grid;
  grid-template-columns:repeat(3,minmax(0,1fr));
  gap:18px;
  margin-top:22px;
}
@media (max-width:980px){.grid{grid-template-columns:repeat(2,minmax(0,1fr));}}
@media (max-width:640px){.grid{grid-template-columns:1fr;}}
.card{
  background:var(--card);
  border:1px solid var(--border);
  border-radius:var(--radius);
  box-shadow:var(--shadow);
  overflow:hidden;
  transition:transform .16s ease, border-color .16s ease, box-shadow .16s ease;
}
.card:hover{
  transform:translateY(-3px);
  border-color:rgba(128,0,32,.26);
  box-shadow:var(--shadow-hover);
}
.card-body{
  padding:14px 14px 17px;
  text-align:center;
}
.pdf-preview{
  position:relative;
  aspect-ratio:4/3;
  min-height:176px;
  max-height:240px;
  border-radius:16px;
  border:1px solid rgba(128,0,32,.1);
  background:linear-gradient(145deg,#fbfaf9,#f3f0ed);
  overflow:hidden;
}
.pdf-preview::after{
  content:"";
  position:absolute;inset:0;
  pointer-events:none;
  background:linear-gradient(180deg,rgba(255,255,255,.22),transparent 38%);
}
/* Anteprima PDF: canvas (PDF.js) su tutti i dispositivi; iframe spesso vuoto su desktop */
.pdf-preview .pdf-embed,
.pdf-preview embed{
  display:none;
}
.pdf-preview-canvas{
  display:grid;
  position:absolute;
  inset:0;
  z-index:1;
  place-items:center;
  background:#fff;
}
.pdf-preview-canvas canvas{display:block;max-width:100%;max-height:100%;width:100%;height:auto}
.pdf-mobile-hint{
  display:none;
  position:absolute;
  inset:auto 12px 12px 12px;
  z-index:2;
  padding:10px 12px;
  border-radius:14px;
  border:1px solid rgba(128,0,32,.22);
  background:rgba(253,250,246,.86);
  backdrop-filter:blur(10px) saturate(160%);
  -webkit-backdrop-filter:blur(10px) saturate(160%);
  color:var(--brand);
  font-weight:800;
  font-size:14px;
}

/* Fallback: browser senza supporto aspect-ratio (alcuni WebView/Safari vecchi) */
@supports not (aspect-ratio: 1 / 1){
  .pdf-preview{height:auto}
  .pdf-preview::before{
    content:"";
    display:block;
    padding-top:75%; /* 4/3 */
  }
  .pdf-preview .pdf-embed,
  .pdf-preview embed,
  .card-thumb-img{
    position:absolute;
    inset:0;
    width:100%;
    height:100%;
  }
  .card .pdf-preview::before{padding-top:141.4286%} /* 297/210 */
}
/* Nelle card, l’iframe/embed PDF non deve intercettare il click (deve vincere il link <a.card>) */
.card .pdf-preview .pdf-embed,
.card .pdf-preview embed{pointer-events:none}
.card-thumb-img{position:relative;z-index:1;width:100%;height:100%;object-fit:cover;display:block}
.pdf-fallback{
  position:relative;
  z-index:1;
  height:100%;
  display:grid;
  place-items:center;
  color:var(--muted);
  font-weight:800;
  letter-spacing:-.2px;
}
/* Landing: anteprima PDF epigrafe più alta, rapporto ~A4, pagina intera (view=Fit nell’URL) */
.card .pdf-preview{
  aspect-ratio:210/297;
  min-height:300px;
  max-height:min(75vh,620px);
  height:auto;
}
@media (max-width:639px){
  .card .pdf-preview{
    min-height:260px;
    max-height:min(68vh,520px);
  }
}
.card-name{
  margin-top:12px;
  font-weight:700;
  letter-spacing:.01em;
  font-size:clamp(18px,2.1vw,22px);
  font-family:var(--font-brand);
}
.card-funeral-line{
  margin-top:6px;
  font-family:var(--font-body);
  font-size:13px;
  font-weight:400;
  line-height:1.45;
  color:var(--muted);
  letter-spacing:.01em;
}
.card-funeral-label{
  font-weight:500;
  opacity:.92;
}
.card-funeral-date{
  font-weight:400;
  opacity:.95;
}
.card-actions{
  margin-top:12px;
  display:flex;
  justify-content:center;
}
.download-row{
  display:flex;
  flex-wrap:wrap;
  gap:10px;
  align-items:center;
}
.funeral-line{
  margin:0;
  color:var(--text);
  font-size:15px;
  line-height:1.65;
  font-family:ui-serif, Georgia, "Times New Roman", Times, serif;
}
.row{display:flex;gap:14px;align-items:center}
.avatar{
  width:58px;height:58px;border-radius:16px;
  background:#f3f4f6;flex:0 0 auto;
  display:grid;place-items:center;color:var(--muted);font-weight:700;
  overflow:hidden;border:1px solid var(--border);
}
.avatar img{width:100%;height:100%;object-fit:cover}
.title{font-weight:800;letter-spacing:-.2px}
.meta{margin-top:6px;color:var(--muted);font-size:13px;line-height:1.4}
.cta{
  display:inline-flex;align-items:center;justify-content:center;
  padding:10px 14px;border-radius:14px;
  border:1px solid rgba(128,0,32,.25);
  background:rgba(128,0,32,.06);
  color:var(--brand);
  font-weight:700;
  font-size:14px;
}
.cta:hover{background:rgba(128,0,32,.1);border-color:rgba(128,0,32,.32)}
.footer{
  margin-top:34px;padding:28px 0;color:var(--muted);
  border-top:1px solid var(--border);
  font-size:13px;
}
.topbar-inner--home{justify-content:center}
.hero--center{text-align:center}
.hero--center p{margin-left:auto;margin-right:auto}
.hero--center .hero-actions{
  margin-left:auto;margin-right:auto;
  width:100%;
  max-width:640px;
}
.footer--landing{
  margin-top:42px;
  padding:32px 0 36px;
  border-top:1px solid var(--border);
}
.footer-landing-inner{
  display:flex;
  flex-direction:column;
  align-items:center;
  gap:18px;
  text-align:center;
}
.footer-copy{margin:0;color:var(--muted);font-size:14px;line-height:1.45}
.footer-legal-plain{
  font-size:13px;
  line-height:1.45;
  color:#57534e;
}
.footer-legal-plain a{
  color:var(--brand);
  font-weight:650;
  text-decoration:underline;
  text-underline-offset:2px;
}
.footer-legal-plain a:hover{color:var(--brand-2)}
.footer-pill-btn{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  gap:8px;
  padding:11px 22px;
  border-radius:999px;
  border:1px solid rgba(128,0,32,.28);
  background:rgba(128,0,32,.07);
  color:var(--brand);
  font-weight:800;
  font-size:14px;
  text-decoration:none;
  transition:background .28s var(--ease-smooth),border-color .28s var(--ease-smooth),transform .28s var(--ease-smooth),box-shadow .28s var(--ease-smooth);
}
.footer-pill-btn:hover{
  background:rgba(128,0,32,.11);
  border-color:rgba(128,0,32,.38);
  color:var(--brand-2);
  transform:translateY(-1px);
  box-shadow:0 6px 18px rgba(128,0,32,.12);
}
.two-col{
  display:grid;
  grid-template-columns:1.4fr .9fr;
  gap:18px;
  margin-top:18px;
}
@media (max-width:900px){.two-col{grid-template-columns:1fr;}}
.panel{
  background:var(--card);
  border:1px solid var(--border);
  border-radius:var(--radius);
  box-shadow:var(--shadow);
  padding:18px;
}
.panel h2{margin:0 0 10px;font-size:18px}
.kvs{display:grid;gap:10px;margin-top:6px}
.kv{display:flex;justify-content:space-between;gap:10px;font-size:14px}
.kv .k{color:var(--muted)}
.divider{height:1px;background:var(--border);margin:14px 0}
.field{display:grid;gap:6px;margin:10px 0}
.field label{font-size:13px;color:var(--muted)}
.input,.textarea{
  width:100%;
  padding:10px 12px;
  border-radius:14px;
  border:1px solid var(--border);
  outline:none;
  font-size:14px;
}
.textarea{min-height:120px;resize:vertical}
.input:focus,.textarea:focus{border-color:rgba(128,0,32,.45);box-shadow:0 0 0 4px rgba(128,0,32,.08)}
.btn{
  display:inline-flex;align-items:center;justify-content:center;
  padding:10px 14px;border-radius:14px;
  border:1px solid var(--border);
  background:#111827;color:#fff;
  font-weight:700;font-size:14px;
  cursor:pointer;
  transition:transform .28s var(--ease-smooth),opacity .28s var(--ease-smooth),box-shadow .28s var(--ease-smooth),background .28s var(--ease-smooth);
}
.btn:hover{
  opacity:.96;
  transform:translateY(-1px);
  box-shadow:0 8px 22px rgba(17,24,39,.18);
}
.btn:active{transform:translateY(0)}
.btn:disabled,.btn[disabled]{
  opacity:.42;
  cursor:not-allowed;
  transform:none;
  box-shadow:none;
}
.btn:disabled:hover,.btn[disabled]:hover{
  opacity:.42;
  transform:none;
  box-shadow:none;
}
.btn-secondary{background:var(--card);color:#1c1917}
.btn-secondary:hover{background:var(--surface)}
.btn-danger{background:#7f1d1d;border-color:#7f1d1d}
.badge{
  display:inline-flex;align-items:center;
  padding:4px 10px;border-radius:999px;
  font-size:12px;font-weight:700;
  background:rgba(128,0,32,.08);
  color:var(--brand);
  border:1px solid rgba(128,0,32,.18);
}
.cookie{
  position:fixed;left:18px;right:18px;bottom:18px;
  max-width:980px;margin:0 auto;
  z-index:260;
  background:var(--card);border:1px solid var(--border);
  border-radius:18px;box-shadow:var(--shadow);
  padding:14px 14px;
  display:none;gap:12px;align-items:flex-start;
}
.cookie p{margin:0;color:var(--muted);font-size:13px;line-height:1.45}
.cookie-actions{display:flex;gap:10px;flex-wrap:wrap;justify-content:flex-end}
.cookie.show{display:flex}

/* «Contattaci»: pill flottante liquid glass (fisso in viewport, sopra il contenuto) */
.contact-fab{
  position:fixed;
  z-index:120;
  top:calc(24px + env(safe-area-inset-top,0px));
  right:max(24px,env(safe-area-inset-right,0px));
  display:inline-flex;
  align-items:center;
  justify-content:center;
  gap:10px;
  padding:12px 24px 13px;
  min-height:46px;
  box-sizing:border-box;
  border-radius:999px;
  text-decoration:none;
  isolation:isolate;
  overflow:hidden;
  color:var(--brand);
  font-family:var(--font-body);
  font-size:14px;
  font-weight:800;
  letter-spacing:.02em;
  text-transform:none;
  line-height:1.2;
  border:1px solid rgba(255,255,255,.62);
  background:
    linear-gradient(165deg,rgba(255,255,255,.52) 0%,rgba(255,252,248,.22) 42%,rgba(248,242,236,.18) 100%);
  backdrop-filter:blur(28px) saturate(190%);
  -webkit-backdrop-filter:blur(28px) saturate(190%);
  box-shadow:
    0 0 0 1px rgba(255,255,255,.35) inset,
    0 10px 36px rgba(35,24,18,.16),
    0 2px 12px rgba(128,0,32,.08),
    0 1px 0 rgba(255,255,255,.85) inset,
    0 -1px 0 rgba(128,0,32,.05) inset;
  transition:transform .35s var(--ease-smooth),box-shadow .35s var(--ease-smooth),background .35s var(--ease-smooth),border-color .35s var(--ease-smooth);
}

/* Mobile: sposta FAB in basso e riduci ingombro (evita overlap con header) */
@media (max-width:640px){
  .contact-fab{
    top:auto;
    bottom:calc(18px + env(safe-area-inset-bottom,0px));
    right:calc(14px + env(safe-area-inset-right,0px));
    padding:11px 16px 12px;
    gap:8px;
  }
  .contact-fab__label{display:none}
  .cookie{bottom:calc(18px + 56px + env(safe-area-inset-bottom,0px))}
}
.contact-fab__handset{
  flex-shrink:0;
  display:block;
  color:var(--brand);
  opacity:.9;
}
.contact-fab__glass{
  position:absolute;
  inset:0;
  border-radius:inherit;
  background:linear-gradient(
    155deg,
    rgba(255,255,255,.65) 0%,
    rgba(255,255,255,.12) 35%,
    rgba(255,255,255,0) 50%,
    rgba(255,255,255,.18) 100%
  );
  pointer-events:none;
  opacity:.88;
}
.contact-fab__sheen{
  position:absolute;
  inset:-45% -35%;
  background:radial-gradient(ellipse 75% 55% at 28% 0%,rgba(255,255,255,.5),transparent 58%);
  pointer-events:none;
  opacity:.5;
  mix-blend-mode:soft-light;
}
.contact-fab__rim{
  position:absolute;
  inset:0;
  border-radius:inherit;
  box-shadow:inset 0 0 0 1px rgba(255,255,255,.28);
  pointer-events:none;
}
.contact-fab__label{
  position:relative;
  z-index:1;
  font-weight:800;
}
.contact-fab:hover{
  transform:translateY(-2px) scale(1.03);
  border-color:rgba(255,255,255,.78);
  background:
    linear-gradient(165deg,rgba(255,255,255,.62) 0%,rgba(255,254,252,.38) 45%,rgba(252,248,244,.28) 100%);
  box-shadow:
    0 0 0 1px rgba(255,255,255,.45) inset,
    0 14px 44px rgba(35,24,18,.2),
    0 4px 16px rgba(128,0,32,.1),
    0 1px 0 rgba(255,255,255,.92) inset,
    0 -1px 0 rgba(128,0,32,.06) inset;
}
.contact-fab:active{
  transform:translateY(0) scale(.99);
}

/* Pagina necrologio (layout listing / epigrafe come riferimento) */
body.nec-layout{
  background:#e6dfd6;
  background-image:
    linear-gradient(180deg,#ebe4db 0%,#dfd6cb 55%,#d4cbc0 100%),
    radial-gradient(ellipse 80% 45% at 50% 0%, rgba(128,0,32,.06), transparent 55%);
  background-attachment:fixed;
}
.nec-page-head.topbar{
  z-index:30;
}
.nec-page-head-inner{
  display:block;
  width:100%;
}
.nec-page-head-top{
  display:grid;
  grid-template-columns:1fr auto 1fr;
  align-items:center;
  gap:16px;
  width:100%;
}
.nec-page-head-right{min-height:1px}
.nec-body-titles{
  margin:0 0 18px;
  padding:0 0 16px;
  border-bottom:1px solid #e8e1d8;
  min-width:0;
}
.nec-page-name{
  margin:0;
  font-family:var(--font-brand);
  font-size:clamp(26px,3.8vw,40px);
  font-weight:700;
  letter-spacing:.01em;
  line-height:1.08;
  color:#0f172a;
}
.nec-page-dates{
  margin:10px 0 0;
  font-size:15px;
  font-weight:500;
  color:#64748b;
  line-height:1.45;
}
.nec-back-pill{justify-self:start}
.nec-page-head-logo{
  justify-self:center;
  text-decoration:none;
}
@media (max-width:640px){
  .nec-page-head-top{
    display:flex;
    justify-content:center;
    position:relative;
    gap:0;
    /* spazio laterale per il tasto indietro, così il logo resta davvero centrato */
    padding-left:96px;
    padding-right:96px;
  }
  .nec-back-pill{
    position:absolute;
    left:0;
    top:50%;
    transform:translateY(-50%);
  }
  .nec-page-head-right{display:none}
}
.nec-detail-wrap{padding:18px 0 48px}
.nec-detail-container{max-width:1100px}
.nec-detail-layout{
  display:grid;
  grid-template-columns:1fr;
  gap:22px;
  align-items:start;
}
@media (min-width:900px){
  .nec-detail-layout{
    grid-template-columns:minmax(0,1.12fr) minmax(220px,300px);
    gap:28px 32px;
  }
}
.nec-detail-main{
  background:var(--card);
  border:1px solid #d2c8bd;
  border-radius:12px;
  padding:22px 22px 24px;
  box-shadow:0 12px 36px rgba(45,35,28,.08);
}
/* Contenitore ~A4 + FitH: riduce bande laterali del viewer PDF */
.nec-pdf-stage{
  width:100%;
  max-width:520px;
  margin:0 auto;
  aspect-ratio:210/297;
  position:relative;
  background:#fffcf8;
  border:1px solid #d8cfc4;
  border-radius:8px;
  overflow:hidden;
  box-shadow:inset 0 0 0 1px rgba(255,255,255,.7),0 4px 18px rgba(45,35,28,.05);
}

@supports not (aspect-ratio: 1 / 1){
  .nec-pdf-stage{height:auto}
  .nec-pdf-stage::before{content:"";display:block;padding-top:141.4286%}
  .nec-pdf-stage-frame{position:absolute;inset:0}
}
.nec-pdf-stage-frame{
  display:none;
}
.nec-pdf-stage-canvas{
  display:grid;
  position:absolute;
  inset:0;
  z-index:1;
  background:#fff;
  place-items:center;
}
.nec-pdf-stage-canvas canvas{display:block;max-width:100%;max-height:100%;width:100%;height:auto}
.nec-pdf-hint{margin:10px 0 0;text-align:center}

@media (max-width:700px){
  .nec-pdf-hint{display:none}
}

/* Mobile/tablet: stessa logica dimensioni della landing per anteprima A4 */
@media (max-width:700px){
  .nec-pdf-stage{
    max-width:100%;
    aspect-ratio:210/297;
    min-height:260px;
    max-height:min(68vh,520px);
    height:auto;
  }
}

/* Mobile: evita a-capo su "Torna alla lista" */
@media (max-width:640px){
  .nec-back-pill{
    white-space:nowrap;
    padding:10px 14px;
    font-size:13px;
  }
  .nec-back-pill-full{display:none}
  .nec-back-pill-short{display:inline}
}
@media (min-width:641px){
  .nec-back-pill-short{display:none}
}
.nec-pdf-missing{
  display:flex;
  flex-direction:column;
  align-items:center;
  justify-content:center;
  gap:8px;
  min-height:160px;
  padding:24px 16px;
  border-radius:10px;
  border:1px dashed #c4b8ab;
  background:var(--surface);
  color:var(--muted);
  text-align:center;
}
.nec-pdf-missing-label{font-size:12px;font-weight:850;letter-spacing:.08em;text-transform:uppercase}
.nec-pdf-missing-text{font-size:15px;line-height:1.45;max-width:42ch}
.nec-ann{
  margin-top:26px;
  padding-top:22px;
  border-top:1px solid #ebe8e4;
}
.nec-ann-lead{
  margin:0 0 12px;
  font-size:17px;
  font-weight:650;
  font-family:var(--font-brand);
  color:#1e293b;
  line-height:1.35;
}
.nec-ann-body{
  font-size:15px;
  line-height:1.68;
  color:#334155;
  max-width:48ch;
}
.nec-info{
  margin-top:26px;
  padding-top:22px;
  border-top:1px solid #ebe8e4;
}
.nec-detail-rail{min-width:0}
.nec-rail{
  display:flex;
  flex-direction:column;
  gap:12px;
}
.nec-rail-link{
  display:flex;
  align-items:center;
  gap:14px;
  padding:10px 16px 10px 12px;
  border-radius:999px;
  border:1px solid #c9bdb2;
  background:linear-gradient(180deg,#fffdf9,#f2ebe3);
  color:#1e293b;
  font-weight:650;
  font-size:14px;
  line-height:1.3;
  text-decoration:none;
  box-shadow:0 1px 2px rgba(45,35,28,.06);
  transition:transform .3s var(--ease-smooth),box-shadow .3s var(--ease-smooth),border-color .3s var(--ease-smooth),background .3s var(--ease-smooth),color .3s var(--ease-smooth);
}
.nec-rail-link:hover:not(.nec-rail-link--primary){
  transform:translateY(-1px);
  box-shadow:0 6px 18px rgba(45,35,28,.1);
  border-color:#b8a99b;
  background:linear-gradient(180deg,#ffffff,#f7efe6);
}
.nec-rail-link--primary{
  border-color:rgba(60,10,22,.4);
  background:linear-gradient(165deg,var(--brand),var(--brand-2));
  color:#fff;
  font-weight:800;
  box-shadow:0 6px 22px rgba(128,0,32,.3);
}
.nec-rail-link--primary:hover{
  transform:translateY(-1px);
  box-shadow:0 8px 28px rgba(128,0,32,.38);
  border-color:rgba(40,8,16,.55);
  background:linear-gradient(165deg,#941028,var(--brand));
  color:#fff;
}
.nec-rail-link--primary:hover .nec-rail-ico{
  background:rgba(255,255,255,.24);
  border-color:rgba(255,255,255,.48);
  color:#fff;
}
.nec-rail-link--disabled{
  opacity:.5;
  cursor:not-allowed;
  pointer-events:none;
  color:#64748b;
  transform:none;
  box-shadow:none;
}
.nec-rail-ico{
  flex:0 0 auto;
  width:42px;
  height:42px;
  border-radius:50%;
  display:grid;
  place-items:center;
  background:rgba(128,0,32,.07);
  border:1px solid rgba(128,0,32,.12);
  color:#3f3a36;
}
.nec-rail-ico svg{display:block;width:20px;height:20px}
.nec-rail-link--primary .nec-rail-ico{
  background:rgba(255,255,255,.18);
  border-color:rgba(255,255,255,.35);
  color:#fff;
}
.nec-rail-link:not(.nec-rail-link--primary) .nec-rail-ico--fb{
  color:#1877f2;
  background:rgba(24,119,242,.09);
  border-color:rgba(24,119,242,.22);
}
.nec-rail-link:not(.nec-rail-link--primary) .nec-rail-ico--wa{
  color:#128c7e;
  background:rgba(18,140,126,.09);
  border-color:rgba(18,140,126,.2);
}
.nec-rail-txt{min-width:0;flex:1;text-align:left}
.nec-recaptcha-mount{margin:6px 0 2px;min-height:78px}
@media (max-width:400px){
  .nec-recaptcha-field{overflow-x:auto;padding-bottom:4px}
}
.nec-condolences{
  scroll-margin-top:min(120px,22vh);
  margin-top:22px;
  border:1px solid #d2c8bd;
  border-radius:12px;
  box-shadow:0 8px 28px rgba(45,35,28,.07);
  padding:20px;
  background:var(--card);
}
.nec-h2{
  margin:0 0 14px;
  font-size:19px;
  font-family:var(--font-brand);
  font-weight:700;
  letter-spacing:.02em;
  padding-bottom:10px;
  border-bottom:1px solid var(--border);
}
.nec-kvgrid{display:grid;gap:12px}
.nec-kv{
  border:1px solid #ded3c8;
  border-radius:12px;
  padding:14px 14px 13px;
  background:var(--surface);
}
.nec-k{
  color:var(--muted);
  font-size:11px;
  font-weight:850;
  letter-spacing:.06em;
  text-transform:uppercase;
}
.nec-v{margin-top:8px;font-size:15px;line-height:1.45;font-weight:750;color:var(--text)}
.nec-inline-link{
  color:var(--brand);
  font-weight:800;
  text-decoration:underline;
  text-underline-offset:3px;
}
.nec-inline-link:hover{color:var(--brand-2)}
.nec-form .input,.nec-form .textarea{background:#fffefb;border-color:#d8cfc4}

/* Admin: riordino + switch pubblicazione */
.drag-handle{
  display:inline-grid;
  place-items:center;
  width:34px;height:34px;
  border-radius:12px;
  border:1px solid var(--border);
  background:#fff;
  color:var(--muted);
  font-weight:950;
  letter-spacing:.5px;
  cursor:grab;
  user-select:none;
  -webkit-user-select:none;
}
.drag-handle:active{cursor:grabbing}
tr.is-dragging{opacity:.55}
tr.is-drag-over{outline:2px dashed rgba(128,0,32,.35);outline-offset:-4px}

.admin-switch{
  display:inline-flex;
  align-items:center;
  gap:10px;
  cursor:pointer;
  user-select:none;
  -webkit-user-select:none;
}
.admin-switch input{
  position:absolute;
  opacity:0;
  width:1px;height:1px;
  margin:0;
  pointer-events:none;
}
.admin-switch-ui{
  width:44px;height:26px;
  border-radius:999px;
  border:1px solid var(--border);
  background:#f3f4f6;
  position:relative;
  flex:0 0 auto;
  transition:background .15s ease, border-color .15s ease;
}
.admin-switch-ui::after{
  content:"";
  position:absolute;top:50%;left:3px;
  width:20px;height:20px;border-radius:999px;
  background:#fff;
  border:1px solid rgba(17,24,39,.10);
  transform:translateY(-50%);
  transition:left .15s ease;
  box-shadow:0 10px 18px rgba(17,24,39,.10);
}
.admin-switch input:checked + .admin-switch-ui{
  background:rgba(128,0,32,.14);
  border-color:rgba(128,0,32,.28);
}
.admin-switch input:checked + .admin-switch-ui::after{left:21px}
.admin-switch input:focus-visible + .admin-switch-ui{
  box-shadow:0 0 0 4px rgba(128,0,32,.10);
}
.admin-switch input:disabled + .admin-switch-ui{opacity:.55}
.admin-switch-text{
  font-size:13px;
  font-weight:850;
  color:var(--muted);
  min-width:22px;
}
