:root {
    --portfolio-header-height: 6rem;
    --portfolio-dock-height: 4.5rem;
    --portfolio-content-width: 72rem;
    --portfolio-gutter: clamp(1rem, 4vw, 2.5rem);
    --portfolio-card-radius: 0.875rem;
    --portfolio-card-border: rgba(148, 163, 184, 0.2);
}

html {
    scroll-behavior: smooth;
    scroll-snap-type: y proximity;
    scroll-padding-top: var(--portfolio-header-height);
}

#main-content > section:is(#hero, #skills, #experience, #projects) {
    box-sizing: border-box;
    min-height: 100svh;
    scroll-snap-align: start;
    scroll-snap-stop: normal;
    padding-top: var(--portfolio-header-height);
    padding-bottom: calc(var(--portfolio-dock-height) + 1.5rem);
    position: relative;
    isolation: isolate;
}

/* Balanced desktop hero: fluid type and portrait, with header/dock included. */
@media (min-width: 1024px) {
    #hero {
        display: flex !important;
        flex-direction: column;
        align-items: stretch !important;
        min-height: 100svh !important;
        padding-top: calc(var(--portfolio-header-height) + 1rem) !important;
        padding-bottom: calc(var(--portfolio-dock-height) + 1rem) !important;
    }
    #hero > .max-w-7xl {
        flex: 1 1 auto;
        display: grid;
        align-items: center;
    }
    #hero > .portfolio-contact-dock {
        flex: 0 0 auto;
        order: 2;
        margin-top: 1rem;
    }
    #hero > .max-w-7xl {
        width: min(100%, 80rem);
        max-width: 80rem !important;
        padding-inline: clamp(2rem, 4vw, 4rem) !important;
    }
    #hero > .max-w-7xl > .grid {
        grid-template-columns: minmax(0, 1.08fr) minmax(20rem, 0.92fr);
        gap: clamp(2.5rem, 5vw, 5rem) !important;
        padding-inline: 0 !important;
    }
    #hero > .max-w-7xl > .grid > div { min-width: 0; }
    #hero h1 {
        max-width: 12ch;
        margin-bottom: clamp(1.25rem, 2.5vh, 2rem) !important;
        font-size: clamp(3.25rem, 5vw, 5.5rem) !important;
        line-height: 0.98 !important;
        text-wrap: balance;
    }
    #hero h1 br { display: none !important; }
    #hero-title {
        min-height: 2.5rem;
        font-size: clamp(1.25rem, 1.8vw, 1.75rem) !important;
        line-height: 1.25;
    }
    #hero .hero-portrait-card {
        width: clamp(20rem, 29vw, 25rem) !important;
        height: auto !important;
        aspect-ratio: 4 / 5;
    }
    #hero .hero-metric:first-of-type { left: -1.5rem !important; }
    #hero .hero-metric:nth-of-type(3) { right: -1.5rem !important; }
}

@media (min-width: 1440px) {
    #hero > .max-w-7xl { width: min(100%, 88rem); max-width: 88rem !important; }
    #hero > .max-w-7xl > .grid { grid-template-columns: minmax(0, 1.05fr) minmax(24rem, 0.95fr); }
    #hero .hero-portrait-card { width: clamp(24rem, 28vw, 29rem) !important; }
}

@media (min-width: 1024px) and (max-height: 820px) {
    #hero {
        padding-top: calc(var(--portfolio-header-height) + 0.5rem) !important;
        padding-bottom: calc(var(--portfolio-dock-height) + 0.5rem) !important;
    }
    #hero .inline-flex { margin-bottom: 1rem !important; }
    #hero h1 { font-size: clamp(3rem, 4.5vw, 4.5rem) !important; margin-bottom: 1rem !important; }
    #hero .relative.mb-10 { margin-bottom: 1.5rem !important; font-size: 1rem !important; line-height: 1.6; }
    #hero .hero-portrait-card { width: clamp(18rem, 25vw, 22rem) !important; }
}

#main-content > section:is(#skills, #experience, #projects) > div:not(.portfolio-contact-dock) {
    box-sizing: border-box;
    width: min(100%, var(--portfolio-content-width));
    margin-inline: auto;
    padding-inline: var(--portfolio-gutter);
}

#skills .filter-btn-skill,
#projects .filter-btn {
    min-height: 44px;
}

#skills .text-center.mb-16,
#projects .text-center.mb-16 {
    max-width: 42rem;
    margin-inline: auto;
    margin-bottom: clamp(2rem, 5vw, 3.5rem) !important;
}

#skills .text-center.mb-16 h2,
#projects .text-center.mb-16 h2,
.experience-heading h2 {
    text-wrap: balance;
    line-height: 1.05;
}

#skills .text-center.mb-16 p,
#projects .text-center.mb-16 p,
.experience-heading p {
    max-width: 38rem;
    margin-inline: auto;
    text-wrap: pretty;
}

#skills-grid,
#projects .project-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 17rem), 1fr));
    gap: clamp(0.875rem, 2vw, 1.25rem) !important;
    align-items: stretch;
}
[data-grid-desktop="1"]{grid-template-columns:repeat(1,minmax(0,1fr))!important}[data-grid-desktop="2"]{grid-template-columns:repeat(2,minmax(0,1fr))!important}[data-grid-desktop="3"]{grid-template-columns:repeat(3,minmax(0,1fr))!important}[data-grid-desktop="4"]{grid-template-columns:repeat(4,minmax(0,1fr))!important}
[data-desktop-span="2"]{grid-column:span 2}[data-desktop-span="3"]{grid-column:span 3}[data-desktop-span="4"]{grid-column:span 4}[data-alignment="center"]{align-self:center}[data-alignment="stretch"]{align-self:stretch}
@media(max-width:1023px){[data-grid-tablet="1"]{grid-template-columns:repeat(1,minmax(0,1fr))!important}[data-grid-tablet="2"]{grid-template-columns:repeat(2,minmax(0,1fr))!important}[data-grid-tablet="3"]{grid-template-columns:repeat(3,minmax(0,1fr))!important}[data-tablet-span]{grid-column:span 1}[data-tablet-span="2"]{grid-column:span 2}[data-tablet-span="3"]{grid-column:span 3}}
@media(max-width:640px){[data-grid-mobile="1"]{grid-template-columns:repeat(1,minmax(0,1fr))!important}[data-grid-mobile="2"]{grid-template-columns:repeat(2,minmax(0,1fr))!important}[data-mobile-span]{grid-column:span 1}[data-mobile-span="2"]{grid-column:span 2}}

#skills-grid > *,
#projects .project-grid > * {
    min-width: 0;
    height: 100%;
}

#skills-grid .skill-card,
#projects .project-card,
.experience-timeline .experience-card {
    border-radius: var(--portfolio-card-radius) !important;
    border-color: var(--portfolio-card-border) !important;
}

#skills-grid .skill-card,
#projects .project-card {
    display: flex;
    flex-direction: column;
}

#skills-grid .skill-card p,
#projects .project-card p,
.experience-timeline .experience-card p {
    line-height: 1.65;
    text-wrap: pretty;
}

#projects .project-card .project-tags,
#skills-grid .skill-card .skill-tags {
    margin-top: auto;
    padding-top: 1rem;
}

#projects .project-card a.text-link,
#skills-grid .skill-card a.text-link,
.experience-timeline .experience-card a.text-link {
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    width: fit-content;
    margin-top: 0.5rem;
}

@media (min-width: 1024px) {
    #projects .project-grid > .project-spotlight:first-child {
        grid-column: span 2;
    }
}

#contact {
    display: none;
}

/* One global assistant preserves the conversation while the visitor changes panels. */
#floating-robot,
#chatbot-container {
    position: fixed;
}

#floating-robot {
    z-index: 70;
    bottom: calc(var(--portfolio-dock-height) + 1.25rem);
}

.skill-tags,.project-tags{display:flex;flex-wrap:wrap;gap:.45rem;margin:1rem 0}.skill-tags span,.project-tags span{padding:.28rem .6rem;border:1px solid rgba(125,211,252,.24);border-radius:999px;color:#bae6fd;font-size:.75rem}.experience-highlights{margin:1rem 0;padding-left:1.15rem;color:#cbd5e1}.experience-highlights li+li{margin-top:.45rem}.experience-metrics{display:grid;grid-template-columns:repeat(auto-fit,minmax(7rem,1fr));gap:.65rem;margin:1rem 0}.experience-metrics div{padding:.75rem;border:1px solid rgba(125,211,252,.18);border-radius:.65rem}.experience-metrics strong,.experience-metrics span{display:block}.experience-metrics span{color:#94a3b8;font-size:.78rem}.portfolio-empty-state{grid-column:1/-1;padding:2rem;text-align:center;color:#94a3b8;border:1px dashed rgba(148,163,184,.35);border-radius:1rem}

html[data-theme="light"] .skill-tags span,html[data-theme="light"] .project-tags span{border-color:rgba(180,83,9,.25);color:#9a3412}html[data-theme="light"] .experience-highlights,html[data-theme="light"] .experience-metrics span,html[data-theme="light"] .portfolio-empty-state{color:#7c6045}

#chatbot-container {
    z-index: 80;
    bottom: calc(var(--portfolio-dock-height) + 8.5rem);
}

.portfolio-contact-dock {
    position: sticky;
    z-index: 35;
    bottom: 0.75rem;
    width: min(100% - 2rem, 72rem);
    min-height: var(--portfolio-dock-height);
    margin: 1.5rem auto 0;
    padding: 0.75rem 1rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    color: #e5edf8;
    background: rgba(8, 15, 29, 0.9);
    border: 1px solid rgba(148, 163, 184, 0.28);
    border-radius: 0.875rem;
    box-shadow: 0 1rem 3rem rgba(2, 6, 23, 0.3);
    backdrop-filter: blur(16px);
}

.portfolio-contact-dock__label {
    display: grid;
    gap: 0.125rem;
    min-width: max-content;
}

.portfolio-contact-dock__label strong { font-size: 0.875rem; }
.portfolio-contact-dock__label span { color: #94a3b8; font-size: 0.75rem; }

.portfolio-contact-dock__links {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.portfolio-contact-dock__links a {
    min-height: 44px;
    padding: 0.55rem 0.8rem;
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    color: inherit;
    border: 1px solid rgba(148, 163, 184, 0.25);
    border-radius: 0.625rem;
    font-size: 0.8rem;
    font-weight: 600;
    text-decoration: none;
    transition: border-color 160ms ease, background-color 160ms ease, transform 160ms ease;
}

.portfolio-contact-dock__links a:hover {
    background: rgba(56, 189, 248, 0.1);
    border-color: rgba(56, 189, 248, 0.65);
    transform: translateY(-2px);
}

.portfolio-contact-dock__links a:focus-visible {
    outline: 3px solid #38bdf8;
    outline-offset: 3px;
}

html[data-theme="light"] .portfolio-contact-dock {
    color: #48200d;
    background: rgba(255, 250, 240, 0.94);
    border-color: rgba(180, 83, 9, 0.34);
    box-shadow: 0 1rem 3rem rgba(124, 45, 18, 0.14);
}

html[data-theme="light"] .portfolio-contact-dock__label span { color: #7c6045; }

html[data-theme="light"] .portfolio-contact-dock__links a {
    color: #6b2f12;
    background: #fff7e8;
    border-color: rgba(180, 83, 9, 0.32);
}

html[data-theme="light"] .portfolio-contact-dock__links a:hover {
    color: #fffaf0;
    background: #9a3412;
    border-color: #9a3412;
}

@media (max-width: 640px) {
    :root { --portfolio-header-height: 5rem; --portfolio-dock-height: 4rem; }
    .portfolio-contact-dock { width: calc(100% - 1rem); padding: 0.65rem; }
    .portfolio-contact-dock__label span { display: none; }
    .portfolio-contact-dock__links { flex-wrap: nowrap; }
    .portfolio-contact-dock__links a { width: 2.65rem; padding: 0; justify-content: center; }
    .portfolio-contact-dock__links a span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0, 0, 0, 0); }
}

@media (max-width: 480px) {
    html { scroll-snap-type: none; }
    #main-content > section:is(#hero, #skills, #experience, #projects) {
        padding-inline: 0;
        padding-bottom: calc(var(--portfolio-dock-height) + 1rem);
    }
    .portfolio-contact-dock {
        gap: 0.5rem;
        border-radius: 0.75rem;
    }
    .portfolio-contact-dock__label { display: none; }
    .portfolio-contact-dock__links {
        width: 100%;
        justify-content: space-between;
        gap: 0.375rem;
    }
    .portfolio-contact-dock__links a {
        flex: 1 1 0;
        width: auto;
        min-width: 44px;
    }
    #chatbot-container {
        right: 0.5rem;
        width: calc(100vw - 1rem);
        max-width: 24rem;
    }
}

@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    .portfolio-contact-dock__links a { transition: none; }
}
.visual-selected{outline:3px solid #38bdf8!important;outline-offset:3px}.visual-editable{cursor:text}.visual-draggable{cursor:grab}
#projects .project-grid>[data-desktop-span="1"]{grid-column:span 1}#projects .project-grid>[data-desktop-span="2"]{grid-column:span 2}#projects .project-grid>[data-desktop-span="3"]{grid-column:span 3}#projects .project-grid>[data-desktop-span="4"]{grid-column:span 4}
