/* GENERAL */

@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600&amp;display=swap');

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

body {
    font-family: 'Poppins', sans-serif;
    margin: 0;
    padding: 0;
}

html {
    scroll-behavior: smooth;
}

p {
    color: #555;
}

/* TRANSITION */

a,
.btn {
    transition: color 0.3s ease, background-color 0.3s ease;
}

/* DESKTOP NAV */

.header {
    width: 100%;
    padding: 15px 0px;
    display: flex;
    justify-content: space-around;
    align-items: center;
}

nav {
    width: 100%;
    display: flex;
    align-items: center;
}

nav ul {
    list-style: none;
    display: flex;
    margin-right: 20px;
}

nav ul li {
    margin: 0 15px;
}

.nav-links {
    list-style: none;
    margin-top: 0;
    font-size: 1.3rem;
}

.logo img {
    max-width: 50px;
    height: auto;
}

a {
    color: black;
    text-decoration: none;
    text-decoration-color: white;
}

a:hover {
    color: rgb(122, 4, 5);
    text-decoration: underline;
    text-underline-offset: 1rem;
    text-decoration-color: rgb(122, 4, 5);
}

/* HAMBURGER MENU */

#hamburger-nav {
    display: none;
}

.hamburger-menu {
    position: relative;
    display: inline-block;
}

.hamburger-icon {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    height: 24px;
    width: 30px;
    cursor: pointer;
}

.hamburger-icon span {
    width: 100%;
    height: 2px;
    background-color: black;
    transition: all 0.3 ease-in-out;
}

.menu-links {
    position: absolute;
    top: 100%;
    right: 0%;
    background-color: white;
    width: fit-content;
    max-height: 0;
    overflow: hidden;
    transition: all 0.3s ease-in-out;
    z-index: 10000; /* Assicura che sia sopra tutto */
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    border-radius: 8px;
}

.menu-links a {
    display: block;
    padding: 10px;
    text-align: center;
    font-size: 1.2rem;
    color: black;
    text-decoration: none;
    transition: all 0.3 ease-in-out;
}

.menu-links a:hover {
    color: rgb(122, 4, 5);
}

.menu-links li {
    list-style: none;
}

.menu-links.open {
    max-height: 400px;
    z-index: 10000; /* Maggiore del chat widget (9999) */
}

.hamburger-icon.open span:nth-child(1) {
    transform: rotate(45deg) translate(10px, 5px);
}

.hamburger-icon.open span:nth-child(2) {
    opacity: 0;
}

.hamburger-icon.open span:nth-child(3) {
    transform: rotate(-45deg) translate(10px, -5px);
}

.hamburger-icon span:nth-child(1),
.hamburger-icon span:nth-child(2),
.hamburger-icon span:nth-child(3) {
    transform: none;
}

/* SECTIONS */

main {
    margin-top: 60px;
}

section {
    padding-top: 4vh;
    margin: 0 10rem;
    box-sizing: border-box;
    min-height: fit-content;
}

/* Animazioni fade-in solo per le sezioni principali del main */
main section {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.8s ease-out, transform 0.8s ease-out;
}

/* Transizioni più rapide su mobile per feedback immediato */
@media screen and (max-width: 768px) {
    main section {
        transition: opacity 0.6s ease-out, transform 0.6s ease-out;
        transform: translateY(20px); /* Movimento più sottile su mobile */
    }
    
    /* Centra il bottone della chat nella sezione proficiencies su mobile */
    #proficiencies .btn_container {
        display: flex;
        justify-content: center;
        align-items: center;
    }
}

/* Classe per attivare l'animazione */
main section.fade-in {
    opacity: 1;
    transform: translateY(0);
}

@keyframes fadeInUp {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.section-container {
    display: flex;
}

/* PROFILE SECTION */

#profile {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 5rem;
    height: 85vh;
}

.section_pic_container {
    display: flex;
    height: 475px;
    width: 475px;
    margin: auto 0;
}

.section_text {
    align-self: center;
    text-align: center;
}

.section_text p {
    font-weight: 600;
}

.section_text_p1 {
    text-align: center;
}

.section_text_p2 {
    font-size: 1.5rem;
    margin-bottom: 1rem;
}

.title_1 {
    font-size: 3rem;
    text-align: center;
    transition: transform 0.3s ease, text-shadow 0.3s ease;
    cursor: default;
}

.title_1:hover {
    transform: scale(1.02);
    text-shadow: 2px 2px 8px rgba(0, 0, 0, 0.3);
}

.btn_container {
    margin-top: 1.5rem;
    text-align: center;
}

.btn_color {
    background: linear-gradient(90deg, #7a0405, #450707);
    border: none;
    color: white;
    padding: 1rem 1rem;
    font-weight: 600;
    border-radius: 2rem;
    cursor: pointer;
    transition: background-color 0.3s ease, transform 0.2s ease;
}

.btn_color:hover {
    background-color: #7a0405;
    transform: scale(1.05);
}

/* ABOUT SECTION */

#about {
    padding: 4rem 0;
    text-align: center;
}

.title_2 {
    font-size: 2.5rem;
    position: relative;
    transition: transform 0.3s ease, color 0.3s ease;
    cursor: default;
}

.title_2:hover {
    transform: translateY(-3px);
    color: #7a0405;
}

.title_2::after {
    content: "";
    position: absolute;
    bottom: -10px;
    left: 50%;
    transform: translateX(-50%);
    width: 80px;
    height: 3.5px;
    background: linear-gradient(90deg, #7a0405, #450707);
    border-radius: 1px;
    transition: width 0.4s ease, background 0.3s ease;
}

.title_2:hover::after {
    width: 120px;
    background: linear-gradient(90deg, #450707, #7a0405, #450707);
}

.text_container {
    margin: 2rem auto;
}

.text_container p {
    color: #555;
    line-height: 1.6;
    text-align: left;
}

/* PROFICIENCIES SECTION */

#proficiencies {
    padding: 3rem 0;
    text-align: center;
}

.article_container {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-around;
    gap: 2.5rem;
}

article {
    display: flex;
    flex-direction: column;
    align-items: center;
    max-width: 320px;
    text-align: center;
    transition: transform 0.4s ease, box-shadow 0.4s ease, background 0.4s ease;
    border-radius: 16px;
    padding: 2rem 1.5rem;
    position: relative;
    overflow: hidden;
}

article::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(255,255,255,0.1), rgba(0,0,0,0.05));
    border-radius: 16px;
    opacity: 0;
    transition: opacity 0.4s ease;
    pointer-events: none;
}

article:hover {
    transform: translateY(-12px) rotateX(5deg);
    box-shadow: 
        0 20px 40px rgba(0, 0, 0, 0.15),
        0 10px 20px rgba(0, 0, 0, 0.1);
    background: rgba(255, 255, 255, 0.9);
}

article:hover::before {
    opacity: 1;
}

article .icon {
    cursor: pointer;
    height: 40px;
    margin-top: 2rem;
    margin-bottom: 2rem;
    transition: transform 0.3s ease, filter 0.3s ease, box-shadow 0.3s ease;
    animation: float 4s ease-in-out infinite;
}

article .icon:hover {
    transform: translateY(-8px) scale(1.15);
    filter: brightness(1.2) drop-shadow(0 8px 16px rgba(0, 0, 0, 0.3));
}

/* Aggiunto per supportare video come icone */
video.icon {
    width: auto;
    height: 40px;
    object-fit: contain;
    pointer-events: auto;
    background: transparent;
    margin-top: 2rem;
    margin-bottom: 2rem;
    transition: transform 0.3s ease, filter 0.3s ease, box-shadow 0.3s ease;
    animation: float 4s ease-in-out infinite;
    cursor: pointer;
}

video.icon:hover {
    transform: translateY(-8px) scale(1.15);
    filter: brightness(1.2) drop-shadow(0 8px 16px rgba(0, 0, 0, 0.3));
}

/* Animazione fluttuante */
@keyframes float {
    0%, 100% { 
        transform: translateY(0px); 
    }
    50% { 
        transform: translateY(-6px); 
    }
}

article h3 {
    font-size: 1.5rem;
    color: #333;
}

article p {
    color: #777;
    line-height: 1.5;
    text-align: justify;
}

/* PROJECTS SECTION */

#projects {
    padding: 4rem 0;
    text-align: center;
}

.details_container {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-around;
    gap: 3.5rem;
    margin-top: 2rem;
}

.subdetail_container {
    background-color: white;
    border: 1px solid #ddd;
    border-radius: 12px;
    padding: 1.5rem;
    max-width: 540px;
    text-align: left;
    box-shadow: 0px 8px 25px rgba(0, 0, 0, 0.1);
    transition: transform 0.4s ease, box-shadow 0.4s ease, background 0.3s ease;
    position: relative;
    overflow: hidden;
}

.subdetail_container:hover {
    transform: translateY(-8px) rotateY(2deg);
    box-shadow: 
        0px 16px 35px rgba(0, 0, 0, 0.15),
        0px 8px 15px rgba(0, 0, 0, 0.1);
    background: linear-gradient(135deg, #ffffff, #fafbfc);
}

.project_img {
    max-width: 100%;
    height: auto;
}

/* OTHER PLATFORMS SECTION */

#other-platforms {
    padding: 4rem 0;
    text-align: center;
}

.sub-detail_container {
    background-color: white;
    border: 1px solid #ddd;
    border-radius: 12px;
    padding: 1.5rem;
    max-width: 340px;
    text-align: center;
    box-shadow: 0px 8px 25px rgba(0, 0, 0, 0.1);
    transition: transform 0.4s ease, box-shadow 0.4s ease, background 0.3s ease;
    position: relative;
    overflow: hidden;
}

.sub-detail_container::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: radial-gradient(circle at center, rgba(0,0,0,0.05), transparent);
    opacity: 0;
    transition: opacity 0.4s ease;
    pointer-events: none;
}

.sub-detail_container:hover {
    transform: translateY(-10px) rotateZ(1deg);
    box-shadow: 
        0px 16px 35px rgba(0, 0, 0, 0.15),
        0px 8px 15px rgba(0, 0, 0, 0.1);
    background: linear-gradient(135deg, #ffffff, #fafbfc);
}

.sub-detail_container:hover::before {
    opacity: 1;
}

a.platform-link {
    color: black;
    text-decoration: none;
    text-decoration-color: none;
}

/* CONTACT SECTION */

#contact {
    padding: 4rem 0;
    text-align: center;
}

.contact-container {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-around;
    gap: 2rem;
    padding: 2rem;
}

.contact-card {
    flex: 1;
    text-align: left;
}

.contact-form {
    max-width: 400px;
    margin: 0 auto;
}

.form-group {
    margin-bottom: 1rem;
}

label {
    display: block;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.form-group input,
.form-group textarea {
    width: 100%;
    padding: 0.5rem;
    font-size: 1rem;
    border: 1px solid #ccc;
    border-radius: 5px;
}

textarea {
    resize: none;
}

.submit-button {
    background: linear-gradient(90deg, #7a0405, #450707);
    border: none;
    color: white;
    padding: 1rem 2rem;
    font-weight: 600;
    border-radius: 5px;
    cursor: pointer;
    transition: background-color 0.3s ease, transform 0.2s ease;
}

.submit-button:hover {
    background-color: #7a0405;
    transform: scale(1.05);
}

.contact-info {
    text-align: left;
    flex: 1;
    max-width: 400px;
}

.info-item {
    display: flex;
    align-items: center;
    margin-bottom: 0.3rem;
}

.contact-icon {
    width: 24px;
    height: 24px;
    margin-right: 1rem;
}

.contact-info h2 {
    font-size: 1.5rem;
}

.contact-info a {
    color: #555;
    text-decoration: none;
}

.contact-info a:hover {
    color: rgb(96, 145, 204);
}

/* FOOTER SECTION */

footer {
    padding: 2rem 0;
    text-align: center;
    background-color: #F9F9F7;
}

footer p {
    margin: 0;
}

footer p::before {
    font-size: 1.2rem;
    margin-right: 0.5rem;
}
/* ========== Chat Floating Widget (Light Mode) ========== */

/* Variabili Light Mode */
:root {
    --chat-bg: #ffffff; /* fondo principale pannello */
    --chat-surface: #f7f9fb; /* header / composer */
    --chat-border: #e2e8f0; /* bordi chiari */
    --chat-text: #1a1f24; /* testo principale */
    --chat-subtle: #64707d; /* testo attenuato */
    --chat-accent: #7a0405; /* colore brand */
    --chat-accent-text: #ffffff; /* testo su accent */
    --chat-shadow: 0 8px 28px rgba(0,0,0,.12); /* ombra più leggera */
}

/* Contenitore generale per stacking */
#chat-widget { position: fixed; right: 24px; bottom: 24px; z-index: 9999; }

/* Launcher (stato chiuso) - PILLOLA SFUMATA */
.chat-launcher {
    display: flex; align-items: center; gap: 12px; /* gap leggermente aumentato */
    padding: 12px 24px 12px 16px; /* padding asimmetrico: meno a sinistra, più a destra */
    background: linear-gradient(90deg, #7a0405, #450707); /* stesso gradiente dei bottoni */
    color: var(--chat-accent-text); /* testo bianco */
    border: none; /* rimuove il bordo per pulizia */
    border-radius: 9999px !important; /* pillola: metà dell'altezza (50px/2) */
    cursor: pointer; 
    box-shadow: 0 8px 24px rgba(122,4,5,.3), /* ombra coerente con i bottoni */
                0 0 0 1px rgba(122,4,5,.1); /* sottile bordo glow */
    outline: none; 
    transition: all .25s ease;
    font-family: inherit;
    position: relative;
    overflow: hidden;
    height: 50px; /* altezza aumentata per accomodare il padding maggiore */
    width: fit-content; /* larghezza adattiva */
}

/* Effetto glow sottile */
.chat-launcher::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(255,255,255,0.1), transparent);
    border-radius: 22px;
    opacity: 0;
    transition: opacity .25s ease;
}

.chat-launcher:hover::before {
    opacity: 1;
}

.chat-launcher:hover { 
    transform: translateY(-2px); 
    background: linear-gradient(90deg, #8a0506, #550808); /* gradiente leggermente più chiaro */
    box-shadow: 0 12px 32px rgba(122,4,5,.4),
                0 0 0 2px rgba(122,4,5,.2); /* glow più intenso */
}

.chat-launcher:active { 
    transform: translateY(-1px); 
    box-shadow: 0 8px 24px rgba(122,4,5,.3);
}

.chat-launcher:focus-visible { 
    box-shadow: 0 0 0 4px rgba(255,255,255,.4), 
                0 12px 32px rgba(122,4,5,.25); 
}

/* Icona circolare con sfondo rosso brand */
.launcher-icon { 
    width: 28px; /* icona più piccola per pillola compatta */
    height: 28px; 
    border-radius: 50%; /* forma perfettamente circolare */
    background: #7a0405; /* rosso brand puro per contrasto */
    display: flex; 
    align-items: center; 
    justify-content: center; 
    color: #ffffff; /* icona bianca */
    flex-shrink: 0;
    transition: all .25s ease;
    box-shadow: 0 2px 8px rgba(0,0,0,.2); /* ombra sottile per profondità */
}

.chat-launcher:hover .launcher-icon {
    background: #8a0506; /* rosso leggermente più chiaro */
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(0,0,0,.3);
}

/* Testo con migliore contrasto */
.launcher-text { 
    display: flex; 
    flex-direction: column; 
    line-height: 1.0; /* ultra compatto per pillola */
    text-align: left; 
}

.launcher-title { 
    font-size: 13px; /* compatto per pillola */
    font-weight: 600; 
    color: var(--chat-accent-text); /* testo bianco */
}

.launcher-subtitle { 
    font-size: 10px; /* ultra compatto per pillola */
    color: rgba(255,255,255,0.85); /* bianco con leggera trasparenza */
    margin-top: 1px; /* ultra compatto per pillola */
}

/* Nascondi launcher quando il pannello è aperto */
#chat-widget.open .chat-launcher { display:none; }

/* Pannello */
.chat-panel {
    width: 380px; height: 560px; border-radius: 16px;
    background: var(--chat-bg); color: var(--chat-text);
    border: 1px solid var(--chat-border);
    box-shadow: var(--chat-shadow);
    display: none; /* hidden by default */
    flex-direction: column; overflow: hidden;
    transform-origin: 100% 100%;
    /* Override global 'section' padding/margin */
    padding: 0; margin: 0;
}

/* Stato aperto */
.chat-panel.is-open { display: flex; animation: chatIn .22s cubic-bezier(.2,.8,.2,1); }
@keyframes chatIn {
  0% { opacity: 0; transform: translateY(12px) scale(.98); }
  100% { opacity: 1; transform: translateY(0) scale(1); }
}

/* Header */
.chat-header {
    /* Rimosso height fisso per permettere adattamento compatto */
    padding: 14px 14px 8px; display: flex; align-items: center; justify-content: space-between;
    border-bottom: 1px solid var(--chat-border); background: var(--chat-surface);
}
.chat-title h3 { margin: 0; font-size: 15px; line-height: 1.25; }
.chat-title .badge { margin-top: 2px; }
.chat-title {
  display: flex; flex-direction: column; gap: 2px;
}
.chat-title h3 { margin: 0; font-size: 16px; }
.chat-title .badge { font-size: 12px; color: var(--chat-subtle); border: 1px solid var(--chat-border); padding: 2px 8px; border-radius: 999px; }

.chat-close {
  width: 36px; height: 36px; border-radius: 8px;
  display: grid; place-items: center; background: transparent; color: var(--chat-text);
  border: 1px solid transparent; cursor: pointer;
}
.chat-close:hover { background: rgba(255,255,255,0.05); }
.chat-close:focus-visible { border-color: var(--chat-accent); }

/* Transcript */
.chat-transcript {
    padding: 12px; overflow-y: auto; flex: 1; background: var(--chat-bg);
    overscroll-behavior: contain; /* Impedisce lo scroll overflow sulla pagina */
}
.chat-hint { color: var(--chat-subtle); font-size: 14px; }

.chat-msg { display: flex; margin: 30px 0; }
.chat-msg.user { justify-content: flex-end; }
.chat-bubble {
    max-width: 78%; padding: 2px 12px; line-height: 1.5;
    border-radius: 12px; border: 1px solid #d8e0e8; background: #f1f5f9;
    font-size: 14px; white-space: pre-wrap; word-wrap: break-word; color: var(--chat-text);
}
.chat-msg.user .chat-bubble {
    background: var(--chat-accent); border-color: var(--chat-accent); color: var(--chat-accent-text);
}

/* Bot / risposta: nessun box (solo testo) */
.chat-msg:not(.user) .chat-bubble {
    background: transparent !important;
    border: none;
    padding: 0; /* rimuove il padding del box */
    max-width: 100%;
    border-radius: 0;
    box-shadow: none;
}

/* Colori coerenti nel transcript: p e li ereditano il colore del contenitore */
.chat-bubble { color: inherit; }
.chat-bubble p { color: inherit; margin: 0.5em 0; }
.chat-bubble li { color: inherit; }
.chat-bubble li::marker { color: inherit; }
.chat-bubble a { color: inherit; text-decoration-color: currentColor; text-underline-offset: 2px; text-decoration-thickness: 1px; }
.chat-bubble a:hover { text-decoration: underline; text-decoration-color: currentColor; text-underline-offset: 2px; }

/* Stili per i heading nelle chat bubbles */
.chat-bubble h1,
.chat-bubble h2,
.chat-bubble h3,
.chat-bubble h4,
.chat-bubble h5,
.chat-bubble h6 {
    color: inherit;
    margin: 1em 0 0.5em 0;
    line-height: 1.3;
    font-weight: 600;
}

.chat-bubble h1:first-child,
.chat-bubble h2:first-child,
.chat-bubble h3:first-child,
.chat-bubble h4:first-child,
.chat-bubble h5:first-child,
.chat-bubble h6:first-child {
    margin-top: 0;
}

.chat-bubble h1 { font-size: 1.4em; }
.chat-bubble h2 { font-size: 1.3em; }
.chat-bubble h3 { font-size: 1.2em; }
.chat-bubble h4 { font-size: 1.1em; }
.chat-bubble h5 { font-size: 1.05em; }
.chat-bubble h6 { font-size: 1em; }

/* Liste dentro le chat bubbles (ripristina padding rimosso dal reset globale) */
.chat-bubble ul,
.chat-bubble ol {
    padding-left: 1.5rem; /* indentazione più generosa */
    margin: 0.6em 0;
    list-style-position: outside; /* bullet fuori dal contenuto */
}

.chat-msg:not(.user) .chat-bubble ul,
.chat-msg:not(.user) .chat-bubble ol {
    /* quando la bolla assistente non ha padding, garantisci comunque indentazione */
    padding-left: 1.75rem;
}

.chat-bubble li { 
    margin: 0.3em 0; 
    padding-left: 0.25rem; 
    list-style: inherit; 
    line-height: 1.4;
}

.chat-bubble ul li {
    list-style-type: disc;
}

.chat-bubble ol { 
    counter-reset: list-counter; 
}

.chat-bubble ol > li { 
    list-style: decimal; 
}

/* Aggiungi un leggero padding sinistro alle risposte assistente per non far “uscire” i bullet dal bordo */
.chat-msg:not(.user) .chat-bubble { padding-left: 10px; color: var(--chat-text); }

/* Composer */
.chat-composer {
    border-top: 1px solid var(--chat-border); background: var(--chat-surface);
    padding: 10px; display: grid; grid-template-columns: 1fr auto; gap: 10px; align-items: end;
}
#chat-input {
    resize: none; max-height: 140px; min-height: 40px;
    padding: 10px 12px; font: inherit; color: var(--chat-text);
    border-radius: 10px; border: 1px solid var(--chat-border); background: #ffffff;
}
#chat-input:focus { outline: none; border-color: var(--chat-accent); box-shadow: 0 0 0 2px rgba(122,4,5,.25); }
#chat-input.invalid { border-color: #d93025; animation: shake 0.25s linear; }
@keyframes shake { 0%,100%{transform:translateX(0);} 25%{transform:translateX(-2px);} 50%{transform:translateX(2px);} 75%{transform:translateX(-2px);} }

.chat-actions { display: flex; align-items: center; gap: 8px; }
.chat-send {
    width: 46px; height: 46px; padding: 0; border-radius: 50%; border: none; cursor: pointer;
    background: var(--chat-accent); color: var(--chat-accent-text); display:flex; align-items:center; justify-content:center;
    box-shadow: 0 2px 4px rgba(0,0,0,.16);
    transition: background .25s, transform .18s, box-shadow .25s;
}
.chat-send:hover { filter: brightness(1.05); transform: translateY(-2px); }
.chat-send:active { transform: translateY(0); box-shadow: 0 1px 2px rgba(0,0,0,.2); }
.chat-send:focus-visible { outline: 2px solid var(--chat-accent); outline-offset: 2px; }
.chat-send:disabled { opacity: .6; cursor: not-allowed; }
.chat-clear {
    background: transparent; border: none; color: var(--chat-subtle); cursor: pointer; text-decoration: underline;
}

@media (max-width: 640px) {
  #chat-widget { right: 8px; bottom: 8px; }
    .chat-panel {
        position: fixed;
        bottom: 8px;
        left: 8px;
        right: 8px;
        top: auto;
        width: auto;
        height: calc(100vh - 120px); /* lascia spazio per notch / gesture bar */
        max-height: calc(100vh - 16px);
        min-height: 400px; /* Altezza minima per garantire visibilità header */
        margin: 0;
        box-sizing: border-box;
        border-radius: 16px;
    }
    
    /* Header chat più compatto su mobile per ottimizzare spazio */
    .chat-header {
        padding: 10px 12px 6px;
        min-height: 50px; /* Altezza minima garantita */
    }
}

/* Media query specifica per quando il tastierino è attivo (viewport molto ridotto) */
@media (max-width: 640px) and (max-height: 500px) {
    .chat-panel {
        height: calc(100vh - 60px) !important;
        max-height: calc(100vh - 60px) !important;
        min-height: 300px !important; /* Riduci ulteriormente ma mantieni usabilità */
    }
    
    .chat-header {
        padding: 8px 10px 4px;
        min-height: 45px;
    }
    
    /* Riduci ulteriormente lo spazio del composer quando tastierino attivo */
    .chat-composer {
        padding: 8px;
    }
}

/* Stili specifici per quando il tastierino è attivo (gestito da JS) */
.chat-panel.keyboard-active {
    border-radius: 16px 16px 0 0 !important; /* Rimuovi bordi arrotondati in basso */
    transition: height 0.3s ease, max-height 0.3s ease; /* Animazione fluida */
}

.chat-panel.keyboard-active .chat-header {
    padding: 8px 12px 6px;
    border-bottom: 2px solid var(--chat-border); /* Linea più evidente per separare header */
}

.chat-panel.keyboard-active .chat-composer {
    padding: 8px;
    border-top: 2px solid var(--chat-border);
}
    /* Launcher identico alla versione desktop */
    .chat-launcher { 
        padding: 12px 24px 12px 6px; /* stesso padding asimmetrico della versione desktop */
        width: auto; 
        height: 50px; /* stessa altezza della versione desktop */
        display: flex; 
        align-items: center; 
        justify-content: flex-start; 
        gap: 12px; /* stesso gap della versione desktop */
        border-radius: 25px; /* pillola anche su mobile (25px = 50px/2) */
    }
    /* Mantieni il testo visibile come nella versione desktop */
    .chat-launcher .launcher-text { display: flex; }
    .launcher-icon { width: 40px; height: 40px; }

/* Riduzione motion */
@media (prefers-reduced-motion: reduce) {
  .chat-panel.is-open { animation: none; }
  .chat-launcher, .chat-send { transition: none; }
}

/* ===== Resume Section ===== */
#resume { padding:4rem 0; text-align:center; }
#resume .cv-text { max-width:720px; margin:1.5rem auto 2rem; }
.resume-updated { font-size:0.8rem; color:#777; margin-top:0.5rem; }
.cv-buttons { display:flex; flex-wrap:wrap; justify-content:center; gap:1.2rem; }
.cv-btn { display:inline-flex; align-items:center; justify-content:center; min-width:190px; padding:0.95rem 1.6rem; font-weight:600; font-size:0.95rem; border-radius:2rem; background:linear-gradient(90deg,#7a0405,#450707); color:#fff; text-decoration:none; position:relative; transition:transform .18s ease, box-shadow .25s ease, filter .25s; box-shadow:0 4px 14px rgba(122,4,5,.25); }
.cv-btn:hover { transform:translateY(-3px); filter:brightness(1.05); color:#fff; text-decoration:none; }
.cv-btn:active { transform:translateY(0); box-shadow:0 2px 6px rgba(0,0,0,.25); }
.cv-btn:focus-visible { outline:3px solid rgba(122,4,5,.4); outline-offset:3px; }
.cv-btn.alt { background:#ffffff; color:#7a0405; border:2px solid #7a0405; box-shadow:0 4px 14px rgba(0,0,0,.08); text-decoration:none; }
.cv-btn.alt:hover { background:#7a0405; color:#fff; box-shadow:0 6px 18px rgba(122,4,5,.30); text-decoration:none; }
/* Prevent global a:hover underline/color override */
.cv-btn span { pointer-events:none; }
@media (max-width:640px){ #resume { padding:3rem 0; } .cv-btn { min-width:160px; } }

/* ===== ACCESSIBILITÀ ANIMAZIONI ===== */
/* Disabilita animazioni per utenti che preferiscono movimento ridotto */
@media (prefers-reduced-motion: reduce) {
    main section {
        opacity: 1 !important;
        transform: none !important;
        transition: none !important;
    }
    
    .icon {
        animation: none !important;
        transform: none !important;
    }
    
    article,
    .subdetail_container,
    .sub-detail_container {
        transform: none !important;
    }
    
    * {
        transition-duration: 0.01ms !important;
    }
}

/* ---- Periodic Nudge Animation - FREQUENZA AUMENTATA ---- */
@keyframes chatNudge {
    0% { transform: translateY(0) scale(1); box-shadow: 0 12px 32px rgba(122,4,5,.25); }
    30% { transform: translateY(-4px) scale(1.05); box-shadow: 0 20px 45px rgba(122,4,5,.4); }
    55% { transform: translateY(0) scale(1); box-shadow: 0 12px 32px rgba(122,4,5,.25); }
    100% { transform: translateY(0) scale(1); box-shadow: 0 12px 32px rgba(122,4,5,.25); }
}

.chat-launcher.nudge { animation: chatNudge 1.2s ease; }

@media (prefers-reduced-motion: reduce) { 
    .chat-launcher.nudge { animation: none; } 
}

/* ===== HOVER ELEGANTI PER SOTTOTITOLI PROGETTI ===== */
.projects_subtitle {
    transition: color 0.3s ease, transform 0.3s ease;
    cursor: default;
}

.projects_subtitle:hover {
    color: #7a0405;
    transform: translateX(5px);
}

/* ===== HOVER ELEGANTI PER HEADING ARTICOLI ===== */
article h3 {
    font-size: 1.5rem;
    color: #333;
    transition: color 0.3s ease, transform 0.3s ease;
    cursor: default;
}

article h3:hover {
    color: #7a0405;
    transform: translateY(-2px);
}

/* ===== EFFETTO HOVER AUTOMATICO SU MOBILE PER ARTICOLI PROFICIENCIES ===== */
@media screen and (max-width: 768px) {
    /* Disabilita i click/touch sui singoli articoli proficiencies su mobile */
    #proficiencies article {
        pointer-events: none;
        cursor: default;
    }
    
    #proficiencies article.mobile-highlighted {
        transform: translateY(-12px) rotateX(5deg) !important;
        box-shadow: 
            0 20px 40px rgba(0, 0, 0, 0.15),
            0 10px 20px rgba(0, 0, 0, 0.1) !important;
        background: rgba(255, 255, 255, 0.9) !important;
        transition: all 0.5s ease !important;
    }
    
    #proficiencies article.mobile-highlighted::before {
        opacity: 1 !important;
    }
}
