/* ============ Portfolio Angelo Decataldo — tema scuro ============ */
:root {
    --bg: #0a0f1e;
    --bg-2: #0d1426;
    --card: rgba(255, 255, 255, .045);
    --border: rgba(255, 255, 255, .09);
    --text: #e8ecf8;
    --muted: #9aa5c4;
    --acc-1: #6366f1;
    --acc-2: #22d3ee;
    --grad: linear-gradient(135deg, #6366f1, #22d3ee);
    --radius: 16px;
    --font-display: 'Sora', 'Segoe UI', sans-serif;
    --font-body: 'Inter', 'Segoe UI', sans-serif;
}

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

/* l'attributo hidden deve vincere sempre sui display delle classi (es. #ia-panel, #ia-chips) */
[hidden] { display: none !important; }

html { scroll-behavior: smooth; }

body {
    background: var(--bg);
    color: var(--text);
    font-family: var(--font-body);
    line-height: 1.65;
    -webkit-font-smoothing: antialiased;
    background-image:
        radial-gradient(900px 500px at 85% -10%, rgba(99, 102, 241, .16), transparent 60%),
        radial-gradient(700px 450px at -10% 30%, rgba(34, 211, 238, .10), transparent 60%);
    background-attachment: fixed;
}

.container { max-width: 1080px; margin: 0 auto; padding: 0 24px; }

a { color: var(--acc-2); text-decoration: none; }

/* ---------- navbar ---------- */
.nav {
    position: fixed;
    inset: 0 0 auto 0;
    z-index: 50;
    backdrop-filter: blur(14px);
    background: rgba(10, 15, 30, .6);
    border-bottom: 1px solid transparent;
    transition: border-color .25s, background .25s;
}

.nav.scrolled { border-bottom-color: var(--border); background: rgba(10, 15, 30, .85); }

.nav-inner { display: flex; align-items: center; justify-content: space-between; height: 64px; }

.nav-logo { display: flex; align-items: center; gap: 10px; color: var(--text); font-weight: 600; }

.nav-mark {
    width: 34px; height: 34px;
    display: grid; place-items: center;
    background: var(--grad);
    color: #0a0f1e;
    font-weight: 800; font-size: .8rem;
    border-radius: 10px;
    font-family: var(--font-display);
}

.nav-links { display: flex; gap: 22px; }

.nav-links a { color: var(--muted); font-size: .92rem; font-weight: 500; transition: color .2s; }
.nav-links a:hover { color: var(--text); }

/* ---------- hero ---------- */
.hero { min-height: 92vh; display: flex; align-items: center; padding: 120px 0 60px; }

.hero-inner { display: grid; grid-template-columns: 1.4fr 1fr; gap: 48px; align-items: center; }

.hero-eyebrow { color: var(--acc-2); font-weight: 600; letter-spacing: .08em; text-transform: uppercase; font-size: .85rem; }

.hero-name {
    font-family: var(--font-display);
    font-size: clamp(2.6rem, 6vw, 4.2rem);
    line-height: 1.08;
    margin: 8px 0 4px;
    background: linear-gradient(135deg, #fff 30%, #a5b4fc);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.hero-role {
    font-family: var(--font-display);
    font-size: clamp(1.2rem, 2.6vw, 1.6rem);
    font-weight: 700;
    background: var(--grad);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.hero-tagline { color: var(--muted); margin-top: 16px; max-width: 540px; font-size: 1.05rem; }

.hero-location { display: flex; align-items: center; gap: 6px; color: var(--muted); margin-top: 12px; font-size: .92rem; }
.hero-location svg { width: 16px; height: 16px; }

.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 28px; }

.btn {
    display: inline-flex; align-items: center; gap: 8px;
    padding: 12px 22px;
    border-radius: 999px;
    font-weight: 600; font-size: .95rem;
    border: 1px solid transparent;
    cursor: pointer;
    transition: transform .15s, box-shadow .15s, border-color .15s, background .15s;
    font-family: var(--font-body);
}

.btn-primary { background: var(--grad); color: #0a0f1e; box-shadow: 0 8px 24px rgba(99, 102, 241, .35); }
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 12px 30px rgba(99, 102, 241, .45); }

.btn-ghost { background: var(--card); color: var(--text); border-color: var(--border); }
.btn-ghost:hover { transform: translateY(-2px); border-color: rgba(255, 255, 255, .25); }

.btn-spark { color: var(--acc-2); }

.hero-social { display: flex; gap: 14px; margin-top: 28px; }
.hero-social a {
    width: 42px; height: 42px;
    display: grid; place-items: center;
    border-radius: 12px;
    background: var(--card);
    border: 1px solid var(--border);
    color: var(--muted);
    transition: color .2s, transform .15s, border-color .2s;
}
.hero-social a:hover { color: var(--text); transform: translateY(-2px); border-color: rgba(255, 255, 255, .25); }
.hero-social svg { width: 20px; height: 20px; }

.hero-visual { display: grid; place-items: center; }

.hero-monogram {
    width: min(260px, 60vw); aspect-ratio: 1;
    display: grid; place-items: center;
    border-radius: 36% 64% 60% 40% / 42% 38% 62% 58%;
    background: var(--grad);
    color: #0a0f1e;
    font-family: var(--font-display);
    font-size: clamp(3.5rem, 9vw, 5.5rem);
    font-weight: 800;
    box-shadow: 0 24px 80px rgba(99, 102, 241, .4);
    animation: blob 12s ease-in-out infinite;
}

.hero-photo {
    width: min(280px, 64vw); aspect-ratio: 1;
    object-fit: cover;
    border-radius: 36% 64% 60% 40% / 42% 38% 62% 58%;
    box-shadow: 0 24px 80px rgba(99, 102, 241, .4);
    animation: blob 12s ease-in-out infinite;
}

@keyframes blob {
    0%, 100% { border-radius: 36% 64% 60% 40% / 42% 38% 62% 58%; }
    50% { border-radius: 58% 42% 40% 60% / 52% 60% 40% 48%; }
}

/* ---------- sezioni ---------- */
.section { padding: 88px 0; }

.section-head { margin-bottom: 40px; }

.eyebrow { color: var(--acc-2); font-weight: 600; letter-spacing: .08em; text-transform: uppercase; font-size: .8rem; }

.section-head h2 { font-family: var(--font-display); font-size: clamp(1.7rem, 3.5vw, 2.3rem); margin-top: 6px; }

.bio p { color: var(--muted); max-width: 760px; font-size: 1.06rem; }
.bio p + p { margin-top: 14px; }

/* competenze */
.skills-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 20px; }

.skill-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
    transition: transform .2s, border-color .2s;
}
.skill-card:hover { transform: translateY(-3px); border-color: rgba(99, 102, 241, .5); }
.skill-card h3 { font-family: var(--font-display); font-size: 1.05rem; margin-bottom: 14px; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
    padding: 6px 13px;
    background: rgba(99, 102, 241, .12);
    border: 1px solid rgba(99, 102, 241, .3);
    border-radius: 999px;
    font-size: .85rem;
    color: #c7d2fe;
}
.chips-sm .chip { padding: 4px 10px; font-size: .78rem; }

/* esperienza */
.timeline { position: relative; padding-left: 28px; max-width: 760px; }
.timeline::before {
    content: '';
    position: absolute; left: 5px; top: 6px; bottom: 6px;
    width: 2px;
    background: linear-gradient(to bottom, var(--acc-1), var(--acc-2));
    opacity: .4;
}

.xp { position: relative; padding-bottom: 36px; }
.xp:last-child { padding-bottom: 0; }

.xp-dot {
    position: absolute; left: -28px; top: 7px;
    width: 12px; height: 12px;
    border-radius: 50%;
    background: var(--grad);
    box-shadow: 0 0 0 4px rgba(99, 102, 241, .2);
}

.xp-period { color: var(--acc-2); font-size: .85rem; font-weight: 600; }
.xp h3 { font-family: var(--font-display); font-size: 1.15rem; margin-top: 4px; }
.xp-company { color: var(--muted); font-weight: 500; font-size: .95rem; }
.xp-desc { color: var(--muted); margin-top: 8px; font-size: .97rem; }

/* progetti */
.proj-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 20px; }

.proj-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 26px;
    display: flex; flex-direction: column; gap: 14px;
    transition: transform .2s, border-color .2s;
}
.proj-card:hover { transform: translateY(-3px); border-color: rgba(34, 211, 238, .5); }
.proj-card h3 { font-family: var(--font-display); font-size: 1.12rem; }
.proj-card p { color: var(--muted); font-size: .96rem; flex: 1; }
.proj-link { font-weight: 600; font-size: .92rem; }

/* formazione */
.edu-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 20px; }

.edu-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
}
.edu-period { color: var(--acc-2); font-size: .82rem; font-weight: 600; }
.edu-card h3 { font-family: var(--font-display); font-size: 1.05rem; margin: 4px 0; }
.edu-school { color: var(--muted); font-size: .92rem; }
.edu-desc { color: var(--muted); font-size: .92rem; margin-top: 8px; }

.plain-list { list-style: none; margin-top: 10px; display: grid; gap: 8px; color: var(--muted); }

/* contatti */
.section-contact { padding-bottom: 110px; }

.contact-card {
    background: linear-gradient(135deg, rgba(99, 102, 241, .15), rgba(34, 211, 238, .08));
    border: 1px solid rgba(99, 102, 241, .35);
    border-radius: 24px;
    padding: clamp(32px, 6vw, 64px);
    text-align: center;
}
.contact-card h2 { font-family: var(--font-display); font-size: clamp(1.6rem, 3.5vw, 2.2rem); }
.contact-card p { color: var(--muted); margin-top: 12px; max-width: 560px; margin-inline: auto; }
.contact-card .hero-actions { justify-content: center; }

/* footer */
.footer { border-top: 1px solid var(--border); padding: 28px 0; }
.footer-inner { display: flex; flex-wrap: wrap; gap: 10px; justify-content: space-between; color: var(--muted); font-size: .88rem; }
.footer-tech strong { background: var(--grad); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; }

/* reveal */
.reveal { opacity: 0; transform: translateY(18px); transition: opacity .6s ease, transform .6s ease; }
.reveal.in { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
    .reveal { opacity: 1; transform: none; transition: none; }
    .hero-monogram, .hero-photo { animation: none; }
}

/* ============ iAngelo — widget chat ============ */
#ia-fab {
    position: fixed; right: 22px; bottom: 22px; z-index: 90;
    width: 60px; height: 60px;
    border: none; border-radius: 50%;
    background: var(--grad);
    color: #0a0f1e;
    display: grid; place-items: center;
    cursor: pointer;
    box-shadow: 0 10px 30px rgba(99, 102, 241, .5);
    transition: transform .2s, box-shadow .2s;
}
#ia-fab:hover { transform: scale(1.07); box-shadow: 0 14px 36px rgba(99, 102, 241, .6); }
#ia-fab svg { width: 28px; height: 28px; }

#ia-tip {
    position: fixed; right: 92px; bottom: 34px; z-index: 90;
    background: var(--bg-2);
    border: 1px solid var(--border);
    color: var(--text);
    padding: 9px 14px;
    border-radius: 12px 12px 4px 12px;
    font-size: .88rem;
    box-shadow: 0 8px 24px rgba(0, 0, 0, .4);
    animation: tipIn .3s ease;
}
#ia-tip strong { background: var(--grad); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; }

@keyframes tipIn { from { opacity: 0; transform: translateY(6px); } }

#ia-panel {
    position: fixed; right: 22px; bottom: 96px; z-index: 95;
    width: 384px; max-width: calc(100vw - 32px);
    height: 560px; max-height: calc(100dvh - 130px);
    display: flex; flex-direction: column;
    background: var(--bg-2);
    border: 1px solid var(--border);
    border-radius: 20px;
    box-shadow: 0 24px 70px rgba(0, 0, 0, .55);
    overflow: hidden;
    opacity: 0; transform: translateY(14px) scale(.97);
    transform-origin: bottom right;
    transition: opacity .18s ease, transform .18s ease;
}
#ia-panel.open { opacity: 1; transform: none; }

.ia-head {
    display: flex; align-items: center; gap: 12px;
    padding: 14px 16px;
    background: linear-gradient(135deg, rgba(99, 102, 241, .25), rgba(34, 211, 238, .15));
    border-bottom: 1px solid var(--border);
}

.ia-avatar {
    width: 38px; height: 38px;
    border-radius: 12px;
    background: var(--grad);
    color: #0a0f1e;
    display: grid; place-items: center;
    font-weight: 800; font-size: .85rem;
    font-family: var(--font-display);
    flex-shrink: 0;
}

.ia-head-txt { display: flex; flex-direction: column; line-height: 1.3; flex: 1; min-width: 0; }
.ia-head-txt strong { font-family: var(--font-display); }
.ia-head-txt span { color: var(--muted); font-size: .78rem; display: flex; align-items: center; gap: 5px; }

.ia-dot { width: 7px; height: 7px; border-radius: 50%; background: #34d399; box-shadow: 0 0 8px #34d399; display: inline-block; }

#ia-close, #ia-reset {
    background: none; border: none;
    color: var(--muted);
    cursor: pointer;
    width: 32px; height: 32px;
    display: grid; place-items: center;
    border-radius: 8px;
    transition: color .2s, background .2s;
}
#ia-close:hover, #ia-reset:hover { color: var(--text); background: rgba(255, 255, 255, .08); }
#ia-close svg, #ia-reset svg { width: 17px; height: 17px; }

#ia-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex; flex-direction: column; gap: 10px;
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,.15) transparent;
}

.ia-msg {
    max-width: 85%;
    padding: 10px 14px;
    border-radius: 16px;
    font-size: .92rem;
    line-height: 1.55;
    word-wrap: break-word;
    overflow-wrap: break-word;
}
.ia-msg p + p, .ia-msg p + ul, .ia-msg ul + p { margin-top: 8px; }
.ia-msg ul { padding-left: 18px; }
.ia-msg code { background: rgba(255, 255, 255, .1); padding: 1px 5px; border-radius: 5px; font-size: .85em; }

.ia-msg.bot {
    align-self: flex-start;
    background: var(--card);
    border: 1px solid var(--border);
    border-bottom-left-radius: 6px;
}

.ia-msg.user {
    align-self: flex-end;
    background: var(--grad);
    color: #0a0f1e;
    font-weight: 500;
    border-bottom-right-radius: 6px;
}

.ia-msg.err { border-color: rgba(248, 113, 113, .4); background: rgba(248, 113, 113, .08); }

.ia-typing { display: inline-flex; gap: 4px; padding: 4px 2px; }
.ia-typing span {
    width: 7px; height: 7px;
    border-radius: 50%;
    background: var(--muted);
    animation: bounce 1.2s infinite;
}
.ia-typing span:nth-child(2) { animation-delay: .15s; }
.ia-typing span:nth-child(3) { animation-delay: .3s; }

@keyframes bounce { 0%, 60%, 100% { transform: none; opacity: .5; } 30% { transform: translateY(-5px); opacity: 1; } }

#ia-chips { display: flex; flex-wrap: wrap; gap: 8px; padding: 0 16px 12px; }

.ia-chip {
    padding: 7px 13px;
    background: rgba(99, 102, 241, .12);
    border: 1px solid rgba(99, 102, 241, .35);
    border-radius: 999px;
    color: #c7d2fe;
    font-size: .8rem;
    cursor: pointer;
    transition: background .2s, border-color .2s;
    font-family: var(--font-body);
}
.ia-chip:hover { background: rgba(99, 102, 241, .25); border-color: rgba(99, 102, 241, .6); }

#ia-form {
    display: flex; gap: 8px;
    padding: 12px 14px;
    border-top: 1px solid var(--border);
}

#ia-input {
    flex: 1;
    background: rgba(255, 255, 255, .06);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 11px 14px;
    color: var(--text);
    font-size: .92rem;
    font-family: var(--font-body);
    outline: none;
    transition: border-color .2s;
}
#ia-input:focus { border-color: var(--acc-1); }
#ia-input:disabled { opacity: .6; }

#ia-send {
    width: 44px; height: 44px;
    border: none; border-radius: 12px;
    background: var(--grad);
    color: #0a0f1e;
    display: grid; place-items: center;
    cursor: pointer;
    transition: transform .15s, opacity .2s;
    flex-shrink: 0;
}
#ia-send:hover { transform: scale(1.05); }
#ia-send:disabled { opacity: .5; cursor: default; transform: none; }
#ia-send svg { width: 20px; height: 20px; }

.ia-foot { text-align: center; color: var(--muted); font-size: .68rem; padding: 0 14px 10px; }

/* ---------- responsive ---------- */
@media (max-width: 860px) {
    .hero-inner { grid-template-columns: 1fr; text-align: center; }
    .hero-visual { order: -1; }
    .hero-actions, .hero-social, .hero-location { justify-content: center; }
    .hero-tagline { margin-inline: auto; }
    .nav-links { display: none; }
}

@media (max-width: 480px) {
    #ia-panel {
        right: 0; bottom: 0;
        width: 100vw; max-width: 100vw;
        height: 100dvh; max-height: 100dvh;
        border-radius: 0;
        border: none;
    }
    #ia-fab { right: 16px; bottom: 16px; }
    #ia-tip { right: 86px; bottom: 28px; }
}
