/* ================================================================
   CV TEMPLATE — screen + print
   A4: 210mm × 297mm = 794px × 1123px @ 96dpi
   ================================================================ */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

/* ── Custom properties (overridden inline from config/cv.php) ── */
:root {
    --cv-accent:      #00B4D8;
    --cv-accent-dark: #0090ae;
    --cv-sidebar-bg:  #0B1628;
    --cv-sidebar-w:   210px;
    --cv-text:        #1a1f2e;
    --cv-muted:       #5a6480;
    --cv-border:      #e8eaf0;
    --cv-font:        'Manrope', 'Segoe UI', Arial, sans-serif;
}

/* ── Body ────────────────────────────────────────────────────── */
body.cv-body {
    background: #c8cdd8;
    font-family: var(--cv-font);
    padding: 32px 16px 60px;
    min-height: 100vh;
}

/* ── Actions bar ─────────────────────────────────────────────── */
.cv-actions {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 12px;
    margin-bottom: 28px;
}

.cv-btn {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    border: none;
    border-radius: 10px;
    padding: 11px 22px;
    font-family: var(--cv-font);
    font-size: 0.85rem;
    font-weight: 700;
    cursor: pointer;
    text-decoration: none;
    transition: transform 0.15s, opacity 0.15s;
    line-height: 1;
}
.cv-btn:hover   { transform: translateY(-2px); }
.cv-btn:active  { transform: translateY(0); }
.cv-btn-primary { background: var(--cv-accent); color: #fff; }
.cv-btn-ghost   { background: rgba(255,255,255,0.25); color: #fff; }
.cv-btn svg     { width: 16px; height: 16px; fill: currentColor; }

/* ── A4 Page container ───────────────────────────────────────── */
.cv-page {
    width: 794px;
    min-height: 1123px;
    background: #fff;
    margin: 0 auto 32px;
    display: flex;
    box-shadow: 0 8px 48px rgba(0,0,0,0.28);
    position: relative;
    overflow: hidden;
    page-break-after: always;
}
.cv-page:last-child { page-break-after: avoid; margin-bottom: 0; }

/* ── Sidebar ─────────────────────────────────────────────────── */
.cv-sidebar {
    width: var(--cv-sidebar-w);
    flex-shrink: 0;
    background: var(--cv-sidebar-bg);
    color: rgba(255,255,255,0.88);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* Photo */
.cv-photo {
    width: 100%;
    aspect-ratio: 1 / 1;
    overflow: hidden;
    background: rgba(0,0,0,0.3);
    flex-shrink: 0;
}
.cv-photo img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center top;
    display: block;
    filter: grayscale(12%) contrast(1.05);
}

/* Sidebar section label */
.cv-s-label {
    background: var(--cv-accent);
    color: #fff;
    font-size: 0.62rem;
    font-weight: 800;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    padding: 5px 14px 4px;
    margin: 16px 0 10px;
    flex-shrink: 0;
}

/* Sidebar body padding */
.cv-s-body { padding: 0 14px; }

/* ── Education ───────────────────────────────────────────────── */
.cv-edu {
    margin-bottom: 11px;
}
.cv-edu-year {
    font-size: 0.62rem;
    color: var(--cv-accent);
    font-weight: 700;
    letter-spacing: 0.05em;
}
.cv-edu-school {
    font-size: 0.72rem;
    font-weight: 700;
    line-height: 1.25;
    color: #fff;
}
.cv-edu-diploma {
    font-size: 0.63rem;
    color: rgba(255,255,255,0.48);
    font-style: italic;
    line-height: 1.3;
}

/* ── Skills grid ─────────────────────────────────────────────── */
.cv-skills-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 5px;
    padding: 0 10px;
}
.cv-skill {
    aspect-ratio: 1;
    background: rgb(255 255 255 / 100%);
    border-radius: 6px;
    border: 1px solid var(--cv-accent);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 5px;
    title: attr(data-name);
}
.cv-skill img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}
/* Fallback: mostra iniziali se logo mancante */
.cv-skill-placeholder {
    font-size: 0.45rem;
    font-weight: 700;
    color: rgba(255,255,255,0.5);
    text-align: center;
    line-height: 1.2;
    word-break: break-word;
}

/* QR vCard nella sidebar */
.cv-qr {
    margin: 16px 14px 14px;
    padding: 8px;
    background: #fff;
    border-radius: 6px;
    text-align: center;
}
.cv-qr img {
    display: block;
    width: 100%;
    max-width: 160px;
    height: auto;
    margin: 0 auto;
}
.cv-qr-caption {
    display: block;
    margin: 6px 0 -2px;
    font-size: 0.55rem;
    color: rgba(11, 22, 40, 0.55);
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    line-height: 1.25;
}

/* ── Certifications ──────────────────────────────────────────── */
.cv-cert {
    margin-bottom: 11px;
}
.cv-cert-year  { font-size: 0.6rem; color: var(--cv-accent); font-weight: 700; }
.cv-cert-title { font-size: 0.74rem; font-weight: 700; color: #fff; line-height: 1.25; }
.cv-cert-org   { font-size: 0.62rem; color: rgba(255,255,255,0.48); font-style: italic; }

/* ── Expertise list ──────────────────────────────────────────── */
.cv-expertise {
    list-style: none;
    padding: 0 14px;
}
.cv-expertise li {
    font-size: 0.63rem;
    line-height: 1.45;
    color: rgba(255,255,255,0.7);
    padding: 3px 0 3px 11px;
    position: relative;
    border-bottom: 1px solid rgba(255,255,255,0.05);
}
.cv-expertise li:last-child { border-bottom: none; }
.cv-expertise li::before {
    content: '●';
    color: var(--cv-accent);
    position: absolute;
    left: 0;
    font-size: 0.35rem;
    top: 7px;
}

/* ── Social ──────────────────────────────────────────────────── */
.cv-social-link {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 0 14px;
    text-decoration: none;
    color: rgba(255,255,255,0.75);
    font-size: 0.63rem;
    font-weight: 600;
}
.cv-social-icon {
    width: 22px;
    height: 22px;
    background: var(--cv-accent);
    border-radius: 5px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.cv-social-icon svg { width: 12px; height: 12px; fill: #fff; }

/* ── Main column ─────────────────────────────────────────────── */
.cv-main {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    padding: 26px 26px 22px;
}

/* Header */
.cv-header { margin-bottom: 8px; }
.cv-name {
    font-size: 2rem;
    font-weight: 800;
    line-height: 1;
    letter-spacing: -0.03em;
    color: var(--cv-text);
}
.cv-name-accent { color: var(--cv-accent); }
.cv-title {
    font-size: 0.64rem;
    font-weight: 700;
    letter-spacing: 0.22em;
    color: var(--cv-muted);
    text-transform: uppercase;
    margin-top: 5px;
}

/* Divider */
.cv-rule {
    height: 2.5px;
    background: linear-gradient(90deg, var(--cv-accent) 0%, transparent 100%);
    border: none;
    margin: 9px 0 13px;
}

/* Section */
.cv-section { margin-bottom: 14px; }

.cv-sec-head {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 9px;
}
.cv-sec-icon {
    width: 26px;
    height: 26px;
    background: var(--cv-accent);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.cv-sec-icon svg { width: 13px; height: 13px; fill: #fff; }
.cv-sec-title {
    font-size: 0.95rem;
    font-weight: 800;
    color: var(--cv-text);
    letter-spacing: -0.01em;
}

/* Contact rows */
.cv-contact-row {
    display: flex;
    align-items: flex-start;
    gap: 7px;
    font-size: 0.7rem;
    color: #444;
    margin-bottom: 4px;
    line-height: 1.4;
}
.cv-contact-row svg { width: 11px; height: 11px; fill: var(--cv-accent); flex-shrink: 0; margin-top: 2px; }

/* Profile text */
.cv-profile-text {
    font-size: 0.7rem;
    color: #4a4a5a;
    line-height: 1.6;
}

/* Experience entry */
.cv-exp {
    margin-bottom: 10px;
    padding-bottom: 9px;
    border-bottom: 1px solid var(--cv-border);
}
.cv-exp:last-child { border-bottom: none; margin-bottom: 0; }

.cv-exp-period {
    font-size: 0.6rem;
    font-weight: 700;
    color: var(--cv-muted);
    letter-spacing: 0.05em;
    text-transform: uppercase;
    margin-bottom: 1px;
}
.cv-exp-company {
    font-size: 0.82rem;
    font-weight: 800;
    color: var(--cv-text);
}
.cv-exp-role {
    font-size: 0.74rem;
    font-weight: 700;
    color: var(--cv-accent);
    margin-bottom: 1px;
}
.cv-exp-sub {
    font-size: 0.63rem;
    color: var(--cv-muted);
    font-style: italic;
    margin-bottom: 3px;
}
.cv-exp-desc {
    font-size: 0.67rem;
    color: #555;
    line-height: 1.45;
    margin-bottom: 3px;
}
.cv-exp-bullets {
    list-style: none;
    padding: 0;
}
.cv-exp-bullets li {
    font-size: 0.65rem;
    color: #444;
    line-height: 1.5;
    padding-left: 11px;
    position: relative;
    margin-bottom: 1px;
}
.cv-exp-bullets li::before {
    content: '●';
    color: var(--cv-accent);
    position: absolute;
    left: 0;
    font-size: 0.35rem;
    top: 5px;
}

/* Hobbies */
.cv-hobbies {
    display: flex;
    gap: 18px;
    flex-wrap: wrap;
    align-items: flex-start;
}
.cv-hobby {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    min-width: 48px;
}
.cv-hobby-icon {
    width: 46px;
    height: 46px;
    background: var(--cv-text);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}
.cv-hobby-icon svg { width: 22px; height: 22px; fill: var(--cv-accent); }
.cv-hobby-label {
    font-size: 0.58rem;
    font-weight: 700;
    color: var(--cv-muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    text-align: center;
}

/* References */
.cv-refs {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px 16px;
}
.cv-ref-name {
    font-size: 0.75rem;
    font-weight: 800;
    color: var(--cv-text);
    margin-bottom: 1px;
}
.cv-ref-role {
    font-size: 0.61rem;
    font-weight: 700;
    color: var(--cv-accent);
    margin-bottom: 4px;
}
.cv-ref-detail {
    font-size: 0.6rem;
    color: #555;
    line-height: 1.55;
}
.cv-ref-detail strong { color: #333; }

/* GDPR */
.cv-gdpr {
    margin-top: auto;
    padding-top: 10px;
    border-top: 1px solid var(--cv-border);
    font-size: 0.58rem;
    color: #aaa;
    font-style: italic;
    line-height: 1.4;
    text-align: center;
}

/* ── Reference person icon ───────────────────────────────────── */
.cv-ref-icon {
    width: 28px;
    height: 28px;
    background: var(--cv-text);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 5px;
}
.cv-ref-icon svg { width: 14px; height: 14px; fill: var(--cv-accent); }

/* ================================================================
   PRINT / PDF
   ================================================================ */
/* ════════════════════════════════════════════════════════════════
   RESPONSIVE — solo screen, NON tocca @media print (qui sotto)
   ════════════════════════════════════════════════════════════════ */
@media screen and (max-width: 768px) {
    body.cv-body { padding: 0 !important; overflow-x: hidden; }

    .cv-actions {
        flex-wrap: wrap;
        gap: 6px !important;
        padding: 10px 8px;
        justify-content: center;
    }
    .cv-actions .cv-btn {
        font-size: 0.74rem;
        padding: 6px 10px;
    }
    .cv-actions .cv-btn svg { width: 13px; height: 13px; }

    .cv-page {
        width: 100%;
        min-height: auto;
        flex-direction: column;
        margin: 6px auto 14px;
        box-shadow: 0 4px 16px rgba(0,0,0,0.18);
        border-radius: 6px;
    }

    .cv-sidebar {
        width: 100%;
        padding-bottom: 18px;
    }

    .cv-photo {
        width: 55%;
        max-width: 240px;
        margin: 18px auto 8px;
        aspect-ratio: 1/1;
        border-radius: 50%;
    }

    .cv-s-label {
        margin-top: 18px;
        padding: 6px 16px;
    }

    .cv-s-body { padding: 0 16px; }

    .cv-skills-grid {
        grid-template-columns: repeat(6, 1fr);
        padding: 0 16px;
        gap: 6px;
    }

    .cv-expertise { padding: 0 16px; }
    .cv-social-link { margin: 0 16px; }

    .cv-qr {
        max-width: 180px;
        margin: 16px auto !important;
    }

    .cv-main {
        padding: 22px 18px;
    }

    .cv-name      { font-size: 1.75rem !important; line-height: 1.05; }
    .cv-title     { font-size: 0.92rem !important; }
    .cv-sec-title { font-size: 0.95rem !important; }

    /* Mini-header pagine continuation (se mai attivo) */
    .cv-mini-header {
        flex-wrap: wrap;
        padding: 14px 18px;
        gap: 10px;
    }
    .cv-mini-pageno { width: 100%; text-align: left; }
}

@media screen and (max-width: 480px) {
    .cv-skills-grid { grid-template-columns: repeat(5, 1fr); }
    .cv-name        { font-size: 1.55rem !important; }
    .cv-actions .cv-btn { font-size: 0.7rem; padding: 5px 9px; }
    .cv-main        { padding: 18px 14px; }
}

@media print {

    body.cv-body {
        background: transparent;
        padding: 0;
        margin: 0;
    }

    .cv-actions { display: none !important; }

    .cv-page {
        width: 210mm;
        height: 297mm;
        min-height: unset;
        margin: 0;
        box-shadow: none;
        page-break-after: always;
        overflow: hidden;
    }
    .cv-page:last-child { page-break-after: avoid; }

    @page {
        size: A4 portrait;
        margin: 0;
    }

    a { color: inherit; text-decoration: none; }
}
