/* =========================================================
   CODICE PENALE – VISTA PUBBLICA & ADMIN
   - cp-  = “Codice Penale” (vista, ricerca, categorie)
   - pcx- = “Penal Category eXtended” (scheda categoria/articoli)
   ========================================================= */

/* ---------- Layout generale ---------- */

.cp-main{
    min-width:0;
  }
  
  .cp-header{
    text-align:center;
    margin-bottom:16px;
  }
  
  .lp-hero__crest2{
    width:300px;
    height:300px;
    object-fit:contain;   
    display:block;
    margin-bottom:12px;
    margin-left: 815px;
    filter:drop-shadow(0 4px 8px rgba(0,0,0,.35));
  }

  .cp-title{
    margin:0 0 6px;
    font-family:"Roboto Condensed",sans-serif;
    font-weight:800;
    font-size:clamp(26px,4vw,38px);
    color:#0a1a2f;
  }
  
  .cp-subtitle{
    margin:0;
    color:#6b7280;
  }
  
  .cp-section{
    margin-bottom:22px;
  }
  
  .cp-section-head{
    display:flex;
    align-items:center;
    justify-content:space-between;
    gap:12px;
  }
  
  .cp-section-title{
    margin:0;
    font-size:20px;
    font-weight:800;
    color:#0a1a2f;
  }
  
  .cp-section-tools{
    display:flex;
    gap:8px;
    flex-wrap:wrap;
  }
  
  .cp-table td{
    vertical-align:top;
  }
  
  .cp-note{
    text-align:center;
    color:#9ca3af;
    margin:18px 0 0;
  }
  
  /* ---------- Barra di ricerca articoli ---------- */
  
  .cp-search-section{
    margin:22px auto 24px;
    max-width:900px;
    position:relative;
  }
  
  .cp-search-head{
    display:flex;
    flex-direction:column;
    gap:4px;
    margin-bottom:10px;
  }
  
  .cp-search-title{
    margin:0;
    font-size:16px;
    font-weight:700;
    color:#0a1a2f;
  }
  
  .cp-search-desc{
    margin:0;
    font-size:13px;
    color:#6b7280;
  }
  
  .cp-search-box{
    margin-top:6px;
  }
  
  .cp-search-input-wrap{
    position:relative;
  }
  
  .cp-search-input{
    width:100%;
    border-radius:999px;
    padding:10px 42px 10px 36px;
    border:1px solid #d1d5db;
    font:inherit;
    outline:none;
    background:#fff;
  }
  
  .cp-search-input::placeholder{
    color:#9ca3af;
  }
  
  .cp-search-input:focus{
    border-color:#c9a227;
    box-shadow:0 0 0 3px rgba(201,162,39,.2);
  }
  
  .cp-search-icon{
    position:absolute;
    left:10px;
    top:50%;
    transform:translateY(-50%);
    font-size:14px;
    color:#9ca3af;
  }
  
  .cp-search-clear{
    position:absolute;
    right:8px;
    top:50%;
    transform:translateY(-50%);
  }
  
  /* meta risultati */
  
  .cp-search-meta{
    display:flex;
    justify-content:space-between;
    align-items:center;
    margin-top:6px;
    font-size:12px;
    color:#6b7280;
  }
  
  .cp-search-count{
    font-weight:600;
  }
  
  /* ---------- Lista risultati ricerca ---------- */
  
  .cp-results{
    margin-top:14px;
    border-radius:14px;
    border:1px solid #e5e7eb;
    background:#fff;
    overflow:hidden;
  }
  
  .cp-results-head{
    padding:10px 12px;
    border-bottom:1px solid #e5e7eb;
    background:#f9fafb;
    display:flex;
    justify-content:space-between;
    align-items:center;
    gap:10px;
  }
  
  .cp-results-title{
    margin:0;
    font-weight:700;
    font-size:14px;
    color:#111827;
  }
  
  .cp-results-meta{
    font-size:12px;
    color:#6b7280;
  }
  
  .cp-hit{
    border-bottom:1px solid #e5e7eb;
  }
  
  .cp-hit:last-child{
    border-bottom:none;
  }
  
  .cp-hit a{
    display:block;
    padding:12px;
    text-decoration:none;
  }
  
  .cp-hit a:hover{
    background:#f9fafb;
  }
  
  .cp-hit-kicker{
    font-size:11px;
    letter-spacing:.02em;
    text-transform:uppercase;
    margin-bottom:2px;
    color:#6b7280;
  }
  
  .cp-hit-title{
    font-size:14px;
    font-weight:700;
    color:#0a1a2f;
  }
  
  .cp-hit-snippet{
    font-size:13px;
    color:#374151;
    margin-top:4px;
  }
  
  .cp-hit mark{
    background:#fff3b0;
    padding:0 2px;
    border-radius:2px;
  }
  
  /* ---------- Griglia categorie del Codice Penale ---------- */
  
  .cp-cat-grid{
    display:grid;
    grid-template-columns:repeat(auto-fit,minmax(240px,1fr));
    gap:16px;
    margin-top:18px;
  }
  
  .cp-cat{
    display:flex;
    flex-direction:column;
    padding:14px 14px 12px;
    border-radius:14px;
    border:1px solid #e5e7eb;
    background:#fff;
    box-shadow:0 8px 24px rgba(0,0,0,.04);
    transition:box-shadow .15s ease, transform .06s ease, border-color .15s ease;
    text-decoration:none;
    color:inherit;
  }
  
  .cp-cat:hover{
    border-color:#c9a227;
    box-shadow:0 10px 26px rgba(0,0,0,.08);
    transform:translateY(-1px);
  }
  
  .cp-cat-main{
    display:flex;
    flex-direction:column;
    gap:4px;
  }
  
  .cp-cat-title{
    margin:0;
    font-weight:800;
    font-size:18px;
    color:#0a1a2f;
  }
  
  .cp-cat-blurb{
    margin:0;
    font-size:14px;
    color:#6b7280;
    white-space:pre-line;
  }
  
  .cp-cat-actions{
    margin-top:auto;
    display:flex;
    justify-content:flex-end;
  }
  
  .cp-cat-badge{
    display:inline-flex;
    align-items:center;
    gap:6px;
    font-size:12px;
    padding:4px 8px;
    border-radius:999px;
    background:#f3f4ff;
    color:#1f2937;
  }
  
  /* =========================================================
     PCX – Vista estesa categoria/articoli
     ========================================================= */
  
  /* Head di pagina categoria */
  
  .pcx-head{
    margin-top:0;
    margin-bottom:14px;
  }
  
  .pcx-title{
    margin:0;
    font-family:"Roboto Condensed",sans-serif;
    font-weight:700;
    font-size:clamp(26px,4vw,34px);
    color:#0a1a2f;
  }
  
  .pcx-subtitle{
    margin:6px 0 0;
    color:#6b7280;
  }
  
  .pcx-tools{
    margin-top:10px;
  }
  
  /* Griglia articoli */
  
  .pcx-grid{
    display:grid;
    grid-template-columns:1fr;
    gap:16px;
  }
  
  @media (min-width:768px){
    .pcx-grid{
      grid-template-columns:repeat(2,minmax(0,1fr));
    }
  }
  
  @media (min-width:1200px){
    .pcx-grid{
      grid-template-columns:repeat(3,minmax(0,1fr));
    }
  }
  
  
  .pcx-item{
    border-radius:14px;
    border:1px solid #e5e7eb;
    background:#fff;
    padding:12px 14px;
    display:flex;
    flex-direction:column;
    gap:8px;
    box-shadow:0 8px 24px rgba(0,0,0,.04);
  }
  
  .pcx-item-head{
    display:flex;
    align-items:center;
    justify-content:flex-start; 
    gap:8px;
    margin-bottom:6px;
    flex-wrap:wrap;
  }
  
  .pcx-badge{
    display:inline-flex;
    align-items:center;
    justify-content:center;
    min-width:32px;
    padding:2px 10px;
    border-radius:999px;
    background:#fef3c7;
    border:1px solid #facc15;
    font-family:"Roboto Mono",monospace;
    font-size:.78rem;
    font-weight:700;
    color:#92400e;
    line-height:1;
    flex-shrink:0;
  }
  
  .pcx-item-title{
    margin:0;
    font-weight:700;
    color:#111827;
    font-size:1rem;
  }
  
  .pcx-meta{
    display:flex;
    flex-wrap:wrap;
    gap:8px;
    font-size:12px;
  }
  
  .pcx-meta-badges{
    display:flex;
    flex-wrap:wrap;
    gap:6px;
  }
  
  .pcx-chip{
    display:inline-flex;
    align-items:center;
    gap:4px;
    padding:2px 8px;
    border-radius:999px;
    border:1px solid #e5e7eb;
    background:#f9fafb;
    font-size:11px;
  }
  
  .pcx-chip-k{
    font-weight:600;
    color:#4b5563;
  }
  
  .pcx-chip-v{
    font-weight:600;
    color:#111827;
  }
  
  .pcx-footnote{
    margin-top:4px;
    font-size:11px;
    color:#6b7280;
  }
  
  /* Badge “Processo” */
  
  .pcx-tag-processo{
    display:inline-block;
    margin-right:6px;
    padding:3px 8px;
    font-size:11px;
    font-weight:700;
    border-radius:999px;
    border:1px solid #fecaca;
    background:#fee2e2;
    color:#991b1b;
  }
  
  /* descrizioni lunghe */
  
  .pcx-desc,
  .cp-art-desc,
  .cp-cat-blurb{
    white-space:pre-line;
    overflow-wrap:anywhere;
  }
  
  /* =========================================================
     DARK MODE – override specifici per cp-/pcx-
     ========================================================= */
  
  :root[data-theme="dark"] .cp-title{
    color:#e8edf5;
  }
  :root[data-theme="dark"] .cp-subtitle{
    color:#8aa0c5;
  }
  :root[data-theme="dark"] .cp-section-title{
    color:#e8edf5;
  }
  :root[data-theme="dark"] .cp-note{
    color:#7c8daf;
  }
  
  /* ricerca */
  
  :root[data-theme="dark"] .cp-search-input{
    background:#0b1730;
    border-color:#24324b;
    color:#e8edf5;
  }
  :root[data-theme="dark"] .cp-search-input::placeholder{
    color:#8aa0c5;
  }
  :root[data-theme="dark"] .cp-search-meta{
    color:#8aa0c5;
  }
  :root[data-theme="dark"] .cp-search-icon{
    color:#8aa0c5;
  }
  
  /* risultati */
  
  :root[data-theme="dark"] .cp-results{
    background:#0f1b2f;
    border-color:#1a2a45;
  }
  :root[data-theme="dark"] .cp-results-head{
    background:#111f39;
    border-bottom-color:#1a2a45;
  }
  :root[data-theme="dark"] .cp-results-title{
    color:#e8edf5;
  }
  :root[data-theme="dark"] .cp-results-meta{
    color:#a0b2d5;
  }
  
  :root[data-theme="dark"] .cp-hit{
    border-bottom-color:#1a2a45;
  }
  :root[data-theme="dark"] .cp-hit a{
    color:#e8edf5;
  }
  :root[data-theme="dark"] .cp-hit a:hover{
    background:rgba(255,255,255,.04);
  }
  :root[data-theme="dark"] .cp-hit-kicker{
    color:#8aa0c5;
  }
  :root[data-theme="dark"] .cp-hit-title{
    color:#e8edf5;
  }
  :root[data-theme="dark"] .cp-hit-snippet{
    color:#c6d1e8;
  }
  :root[data-theme="dark"] .cp-hit mark{
    background:#fff3b0;
    color:#0a1a2f;
  }
  
  /* categorie */
  
  :root[data-theme="dark"] .cp-cat{
    background:#0f1d34;
    border-color:#22304a;
    box-shadow:none;
  }
  :root[data-theme="dark"] .cp-cat:hover{
    box-shadow:0 8px 24px rgba(0,0,0,.45);
  }
  :root[data-theme="dark"] .cp-cat-title{
    color:#e8edf5;
  }
  :root[data-theme="dark"] .cp-cat-blurb{
    color:#a7b5cc;
  }
  :root[data-theme="dark"] .cp-cat-badge{
    background:#17233b;
    color:#e8edf5;
  }
  
  /* PCX dark */
  
  :root[data-theme="dark"] .pcx-title{
    color:#e8edf5;
  }
  :root[data-theme="dark"] .pcx-subtitle{
    color:#a7b5cc;
  }
  
  :root[data-theme="dark"] .pcx-item{
    background:#0f1d34;
    border-color:#22304a;
    box-shadow:none;
  }
  :root[data-theme="dark"] .pcx-item-title{
    color:#e8edf5;
  }
  
  :root[data-theme="dark"] .pcx-badge{
    background:#3b2a07;
    border-color:#facc15;
    color:#fef9c3;
  }

  :root[data-theme="dark"] .pcx-chip{
    background:#111f39;
    border-color:#24324b;
  }
  :root[data-theme="dark"] .pcx-chip-k{
    color:#a7b5cc;
  }
  :root[data-theme="dark"] .pcx-chip-v{
    color:#e8edf5;
  }
  :root[data-theme="dark"] .pcx-footnote{
    color:#97a8c6;
  }
  
  /* badge Processo dark */
  
  :root[data-theme="dark"] .pcx-tag-processo{
    border-color:#7f1d1d;
    background:#3f1f20;
    color:#fecaca;
  }
  