/* =====================================================================
   REDDITI — pagine deputati/senatori (index, emiciclo, scheda)
   Estende il design system «Registro» (static/style.css v20).
   ===================================================================== */

/* ---- Hero: emiciclo nella viz card ---- */
.ph-viz--hemicycle { padding: 0; display: block; }
.ph-hemi-wrap { position: relative; padding: 1rem 1.25rem 0.25rem; background: var(--surface); }
.ph-hemi-svg { width: 100%; height: auto; display: block; cursor: pointer; }
.ph-hemi-svg .hemi-base { stroke: var(--line-2); }
.ph-hemi-svg .hemi-desk { fill: var(--ink); }
.ph-hemi-svg .hemi-label { fill: var(--muted); }

/* ---- Ricerca dedicata ---- */
.dep-search { position: relative; max-width: 640px; margin: -1.6rem auto 0; z-index: 3; }
.dep-search input[type="text"] {
    width: 100%; min-height: 54px; padding: 0.9rem 1.2rem 0.9rem 3rem;
    border: 1px solid var(--line-2); border-radius: var(--r); background: var(--surface);
    font-size: var(--fs-base); box-shadow: var(--shadow-md);
}
.dep-search::before {
    content: ''; position: absolute; left: 1.1rem; top: 19px; width: 17px; height: 17px; z-index: 1; pointer-events: none;
    background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%236d675e' stroke-width='2.2' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cline x1='21' y1='21' x2='16.5' y2='16.5'/%3E%3C/svg%3E") no-repeat center / contain;
}
.dep-search-results {
    display: none; position: absolute; top: calc(100% + 6px); left: 0; right: 0; z-index: 200;
    background: var(--surface); border: 1px solid var(--line); border-radius: var(--r);
    box-shadow: var(--shadow-md); overflow: hidden; max-height: 340px; overflow-y: auto;
}
.dep-search-results.active { display: block; }
.dep-search-results a { display: block; padding: 0.7rem 1rem; font-size: var(--fs-sm); font-weight: 500; color: var(--ink); border-bottom: 1px solid var(--line); }
.dep-search-results a:last-child { border-bottom: 0; }
.dep-search-results a:hover { background: var(--paper); color: var(--accent-deep); }

/* ---- Griglia schede ---- */
.dep-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 1rem; }
.dep-card {
    position: relative; display: flex; flex-direction: column; align-items: center; text-align: center;
    padding: 1.5rem 1rem 1.25rem; color: var(--ink);
    background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow-xs);
    transition: transform var(--dur-base) var(--ease-out), box-shadow var(--dur-base), border-color var(--dur-fast);
}
a.dep-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); border-color: var(--line-2); }
.dep-photo-wrap {
    position: relative; width: 92px; height: 92px; flex-shrink: 0; border-radius: 50%; overflow: visible;
    margin-bottom: 0.85rem; background: var(--paper-2);
}
.dep-photo-wrap img, .dep-photo-wrap .dep-photo-placeholder {
    width: 100%; height: 100%; border-radius: 50%; object-fit: cover; object-position: center top;
    display: flex; align-items: center; justify-content: center; border: 3px solid var(--surface); box-shadow: 0 0 0 1px var(--line);
}
.dep-photo-placeholder { font-family: var(--display); font-weight: 600; font-size: 1.6rem; color: var(--muted-2); background: var(--paper-2); }
.dep-party-dot {
    position: absolute; bottom: 3px; right: 3px; width: 18px; height: 18px; border-radius: 50%;
    border: 2.5px solid var(--surface); box-shadow: 0 1px 2px rgba(0,0,0,0.2); z-index: 1;
}
.dep-name { font-family: var(--display); font-weight: 600; font-size: 1.05rem; line-height: 1.2; letter-spacing: -0.01em; min-height: 2.4em; display: flex; align-items: center; justify-content: center; margin-bottom: 0.35rem; }
.dep-meta { display: inline-flex; align-items: center; gap: 0.35rem; font-size: 0.66rem; font-weight: 700 !important; letter-spacing: 0.1em; text-transform: uppercase; }
.dep-reddito { margin-top: 0.55rem; font-family: var(--mono); font-weight: 600; font-size: 0.86rem; color: var(--green); font-variant-numeric: tabular-nums; }
.dep-rank {
    position: absolute; top: 0.7rem; left: 0.7rem; width: 26px; height: 26px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-family: var(--mono); font-weight: 600; font-size: 0.72rem; background: var(--paper-2); color: var(--ink-3);
}
.dep-rank.gold { background: var(--ink); color: #fff; }
.dep-rank.silver { background: var(--navy-soft); color: var(--navy); }
.dep-rank.bronze { background: var(--gold-soft); color: var(--gold); }
.pw-gate .dep-grid { padding: 1rem 0; }

/* ---- Year chips (anche controlli emiciclo) ---- */
.year-chips { display: flex; flex-wrap: wrap; gap: 0.45rem; margin-bottom: 1.25rem; }
.year-chip {
    display: inline-flex; align-items: center; gap: 0.4rem; min-height: 38px; padding: 0.45rem 1rem;
    border-radius: var(--r-pill); border: 1px solid var(--line-2); background: var(--surface);
    font-family: var(--font); font-size: 0.84rem; font-weight: 600; color: var(--ink-3); cursor: pointer;
    transition: background var(--dur-fast), color var(--dur-fast), border-color var(--dur-fast);
}
.year-chip:hover { border-color: var(--ink); color: var(--ink); }
.year-chip.is-active { background: var(--ink); color: #fff; border-color: var(--ink); }

.dep-results-count { color: var(--muted); font-size: var(--fs-sm); margin-bottom: 1.25rem; }
.dep-reset { color: var(--accent-deep); font-weight: 600; font-size: var(--fs-sm); }
.dep-fonte { border-top: 1px solid var(--line); padding-top: 1.5rem; margin-top: 1rem; }

/* ---- Emiciclo pagina dedicata ---- */
.hemi-page-head { max-width: 760px; }
.hemicycle-wrap {
    background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg);
    box-shadow: var(--shadow-md); padding: 1.5rem clamp(1rem, 3vw, 2.5rem) 1.25rem; margin-top: 1.5rem;
}
.hemicycle-svg { width: 100%; max-width: 860px; height: auto; display: block; margin: 0 auto; }
.hemicycle-svg .hemi-base { stroke: var(--line-2); }
.hemicycle-svg .hemi-desk { fill: var(--ink); }
.hemicycle-svg .hemi-label { fill: var(--muted); }
.hemicycle-seat { cursor: pointer; transition: r 120ms linear, stroke-width 120ms linear; }
.hemicycle-modes { display: flex; gap: 0.45rem; justify-content: center; margin-top: 1.25rem; padding-top: 1.25rem; border-top: 1px solid var(--line); flex-wrap: wrap; }
.hemicycle-modes .year-chip { min-height: 36px; font-size: 0.8rem; }
.hemicycle-legend { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.hemicycle-legend a {
    display: inline-flex; align-items: center; gap: 0.5rem; padding: 0.45rem 0.85rem 0.45rem 0.6rem;
    border-radius: var(--r-pill); background: var(--surface); border: 1px solid var(--line);
    font-size: 0.82rem; font-weight: 600; color: var(--ink-2); transition: border-color var(--dur-fast), background var(--dur-fast);
}
.hemicycle-legend a:hover { border-color: var(--ink); }
.hemicycle-legend .swatch { width: 12px; height: 12px; border-radius: 50%; flex-shrink: 0; box-shadow: 0 0 0 1px rgba(0,0,0,0.08) inset; }
.hemicycle-legend .count { font-family: var(--mono); font-size: 0.7rem; font-weight: 600; color: var(--muted); background: var(--paper-2); padding: 0.1rem 0.45rem; border-radius: var(--r-pill); }

/* ---- Tooltip ---- */
.hemicycle-tooltip {
    display: none; position: fixed; z-index: 500; width: 250px; pointer-events: none;
    background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow-lg); overflow: hidden;
}
.hemicycle-tooltip.active { display: block; }
.hemi-tt-top { display: flex; align-items: center; gap: 0.7rem; padding: 0.85rem 0.9rem; }
.hemi-tt-photo, .hemi-tt-photo-ph { width: 44px; height: 44px; border-radius: 50%; object-fit: cover; object-position: center top; flex-shrink: 0; background: var(--paper-2); }
.hemi-tt-photo-ph { display: flex; align-items: center; justify-content: center; font-family: var(--display); font-weight: 600; color: var(--muted-2); }
.hemi-tt-info { min-width: 0; flex: 1; }
.hemi-tt-name { font-family: var(--display); font-weight: 600; font-size: 0.95rem; line-height: 1.15; margin-bottom: 0.3rem; }
.hemi-tt-group { display: inline-block; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding: 0.15rem 0.5rem; border-radius: var(--r-pill); font-size: 0.6rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: #fff; }
.hemi-tt-reddito { display: flex; justify-content: space-between; align-items: baseline; gap: 0.5rem; padding: 0.6rem 0.9rem; border-top: 1px solid var(--line); background: var(--paper); }
.hemi-tt-reddito-label { font-size: 0.64rem; font-weight: 600; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); }
.hemi-tt-reddito-value { font-family: var(--mono); font-weight: 600; color: var(--green); font-size: 0.9rem; }
.hemi-tt-reddito-value.na { color: var(--muted-2); font-size: 0.75rem; }
.hemi-tt-cta { display: flex; justify-content: space-between; padding: 0.5rem 0.9rem; background: var(--ink); color: #fff; font-size: 0.7rem; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; }
.hemi-tt-cta span:last-child { color: #f0cd7a; }

/* ---- Scheda deputato ---- */
.dep-hero {
    display: grid; grid-template-columns: 148px minmax(0, 1fr); gap: 2rem; align-items: center;
    padding: 2rem; margin-top: 1rem; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow-sm);
}
.dep-hero-photo { width: 148px; height: 148px; border-radius: 50%; overflow: hidden; background: var(--paper-2); box-shadow: 0 0 0 4px var(--surface), 0 0 0 5px var(--line); }
.dep-hero-photo img, .dep-hero-photo .dep-photo-placeholder { width: 100%; height: 100%; object-fit: cover; object-position: center top; display: flex; align-items: center; justify-content: center; font-size: 2.6rem; }
.dep-hero h1 { font-size: clamp(1.9rem, 3.4vw, 2.8rem); margin-bottom: 0.4rem; }
.dep-hero-eyebrow { display: inline-flex; align-items: center; gap: 0.5rem; font-size: 0.68rem; font-weight: 700; letter-spacing: 0.14em; text-transform: uppercase; color: var(--accent-deep); margin-bottom: 0.7rem; }
.dep-hero-eyebrow::before { content: ''; width: 20px; height: 2px; background: currentColor; }
.dep-hero-meta { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; margin-top: 0.6rem; }
.dep-group-pill { display: inline-flex; align-items: center; gap: 0.45rem; padding: 0.3rem 0.75rem 0.3rem 0.5rem; border-radius: var(--r-pill); border: 1px solid var(--line); background: var(--paper); font-size: 0.78rem; font-weight: 600; color: var(--ink-2); }
.dep-group-pill .dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.dep-hero-links { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 1.1rem; }
.dep-hero-links .badge { padding: 0.45rem 0.8rem; font-family: var(--font); font-size: 0.78rem; background: var(--surface); border: 1px solid var(--line-2); color: var(--ink); transition: border-color var(--dur-fast); }
.dep-hero-links .badge:hover { border-color: var(--ink); }
.dep-fact-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 0.75rem; margin-top: 1rem; }
.dep-fact { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 0.9rem 1.1rem; }
.dep-fact-label { font-size: 0.66rem; font-weight: 600; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); margin-bottom: 0.3rem; }
.dep-fact-value { font-weight: 600; font-size: var(--fs-sm); color: var(--ink); }
.dep-profession-box { margin-top: 0.75rem; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 1rem 1.25rem; }
.dep-profession-list { list-style: none; display: flex; flex-wrap: wrap; gap: 0.4rem; }
.dep-profession-list li { padding: 0.3rem 0.7rem; border-radius: var(--r-pill); background: var(--paper-2); font-size: 0.8rem; color: var(--ink-2); }
.dep-kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1rem; margin-top: 1.5rem; }
.dep-kpi { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 1.1rem 1.25rem; box-shadow: var(--shadow-xs); }
.dep-kpi .kpi-value { font-size: 1.6rem; }

.dep-year-row { display: grid; grid-template-columns: 76px minmax(0, 1fr) auto; align-items: center; gap: 1.25rem; padding: 0.95rem 1.5rem; border-bottom: 1px solid var(--line); }
.dep-year-row:last-child { border-bottom: 0; }
.dep-year-row .yr { font-family: var(--display); font-weight: 600; font-size: 1.35rem; color: var(--ink); letter-spacing: -0.01em; }
.dep-year-row .lbl { font-size: 0.66rem; font-weight: 600; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); }
.dep-year-row .pdf { display: inline-block; margin-top: 0.15rem; font-size: 0.78rem; font-weight: 600; color: var(--navy); }
.dep-year-row .pdf:hover { color: var(--accent-deep); }
.dep-year-row .amt { font-family: var(--mono); font-weight: 600; font-size: 1.05rem; color: var(--green); text-align: right; font-variant-numeric: tabular-nums; }
.dep-year-row .amt.missing { color: var(--muted-2); font-size: 0.82rem; font-family: var(--font); font-weight: 500; }
.dep-year-list .pw-gate { margin-top: 1rem; }

.dep-details { margin-bottom: 0.9rem; }
.dep-details summary { list-style: none; cursor: pointer; display: flex; justify-content: space-between; align-items: center; gap: 1rem; padding: 1rem 1.5rem; font-weight: 600; }
.dep-details summary::-webkit-details-marker { display: none; }
.dep-details summary .yr { font-family: var(--display); font-size: 1.15rem; margin-right: 0.5rem; }
.dep-details summary .chev { width: 26px; height: 26px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; background: var(--paper-2); color: var(--ink-3); transition: transform var(--dur-base); }
.dep-details[open] summary .chev { transform: rotate(180deg); }
.dep-details .card-body { border-top: 1px solid var(--line); }
.dep-kv { width: 100%; }
.dep-kv td { padding: 0.45rem 0; border-bottom: 1px dashed var(--line); font-size: var(--fs-sm); }
.dep-kv tr:last-child td { border-bottom: 0; }
.dep-kv td:first-child { color: var(--muted); }
.dep-kv td:last-child { text-align: right; font-family: var(--mono); font-weight: 600; color: var(--ink); }
.dep-kv tr:hover td { background: transparent; }
.dep-patrimonio { white-space: pre-wrap; font-size: var(--fs-sm); line-height: 1.6; color: var(--ink-2); background: var(--paper); border: 1px solid var(--line); border-radius: var(--r-sm); padding: 0.9rem 1rem; }
.dep-sub-label { font-size: 0.66rem; font-weight: 600; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); margin-bottom: 0.45rem; }

@media (max-width: 900px) {
    .dep-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .dep-hero { grid-template-columns: 1fr; text-align: center; justify-items: center; padding: 1.5rem; }
    .dep-hero-meta, .dep-hero-links { justify-content: center; }
    .dep-search { margin-top: 1.25rem; }
}
@media (max-width: 640px) {
    .dep-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.6rem; }
    .dep-card { padding: 1.1rem 0.6rem 1rem; }
    .dep-photo-wrap { width: 72px; height: 72px; }
    .dep-name { font-size: 0.9rem; }
    .dep-hero-photo { width: 120px; height: 120px; }
    .dep-year-row { grid-template-columns: 56px 1fr; padding: 0.9rem 1rem; gap: 0.75rem; }
    .dep-year-row .amt { grid-column: 2; text-align: left; }
    .dep-kpis { grid-template-columns: 1fr 1fr; gap: 0.6rem; }
    .dep-kpi .kpi-value { font-size: 1.3rem; }
    .hemicycle-wrap { padding: 1rem 0.75rem; }
}

/* Paywall dopo il teaser annuale: il contenuto sfocato è corto, garantisce spazio alla card */
.dep-year-list ~ .pw-gate .pw-gate-content { min-height: 400px; }
.dep-year-list ~ .pw-gate .pw-gate-content .card { min-height: 400px; }
@media (max-width: 640px) { .dep-year-list ~ .pw-gate .pw-gate-content, .dep-year-list ~ .pw-gate .pw-gate-content .card { min-height: 460px; } }
