@media (max-width: 1024px) {
    .header {
        max-width: 100vw;
        align-items: center;
    }
    .hero-content {
        max-width: 90vw;
    }
    .nav {
        gap: 1.2rem;
    }
    .hero-title {
        font-size: 2rem;
    }

}

@media (max-width: 980px) {
    .about-grid {
        grid-template-columns: 320px 1fr;
    }
    .about-portrait {
        height: 360px;
    }
    .my-profile { flex-direction: column; align-items: stretch; }
    .my-profile .profile-card { width: 100%; padding: 6px; }

    /* Timeline sizing synced with connectors */
    .timeline { --t-gap: 0.8rem; padding: 0.4rem 0.25rem 0.6rem; }
    .timeline-item { min-width: 200px; max-width: 240px; min-height: 110px; }
    .timeline-desc { font-size: 0.95rem; }

    .projects-container {
        padding: 2rem 1rem;
    }
    .project-upper,
    .project-card {
        flex-direction: column;
        gap: 1rem;
        align-items: stretch;
        padding: 1rem;
    }
    .project-card--reverse { flex-direction: column; }
    .project-card__img {
        flex: 0 0 auto;
        max-width: 100%;
        width: 100%;
    }
    .project-image {
        width: 100%;
        height: auto;
        border-radius: 10px;
        display: block;
    }
    .project-card__body {
        flex: 1 1 auto;
        padding: 0;
    }
    .ptitle {
        display: flex;
        justify-content: center;
    }
    .project-lower {
        flex-direction: column;
    }
    .updates {
        flex-direction: row;
        width: 100%;
    }

    .preventer {
        width: 100%;
    }
    .updates-item {
        border-left: none;
        padding: 1rem 0 0 0;
    }
    .updates-item:before {
        transform: translate(-100%, -50%);
    }
}


@media (max-width: 950px) {
    .childhood-inner {
        display: grid;
        grid-template-columns: 1fr 1fr;
        grid-template-rows: auto auto;
        gap: 1rem;
        align-items: start;
    }
    .child-left {
        grid-column: 1 / 2;
        grid-row: 1 / 2;
    }
    .child-right {
        grid-column: 2 / 3;
        grid-row: 1 / 2;
    }
    .child-middle {
        grid-column: 1 / -1;
        grid-row: 2 / 3;
        padding: 0;
        text-align: left;
    }
    .school-inner {
        flex-direction: column;
        .school-right {
            max-width: none;
            width: 100%;
        }
    }
    .desktop-inner {
        flex-direction: column;
        .desktop-right {
            max-width: none;
            width: 100%;
        }
    }
}

@media (min-width: 980px) {
    .updates-item {
        border-top: none;
    }
}

@media (max-width: 768px) {

    .about-hero-section {
        min-height: 50vh;
        height: 60vh;
    }

    .about-hero-bg {

        background-position: center top;
        background-size: cover;
    }

    .about-hero-overlay {
        padding: 1rem 1rem;
        max-width: 92vw;
    }

    .about-hero-title {
        font-size: clamp(1.3rem, 4.5vw, 1.8rem);
        margin-bottom: 0.25rem;
    }

    .about-hero-desc {
        font-size: 0.98rem;
    }

    .header {
        align-items: center;
    }

    .nav {
        display: flex;
        position: absolute;
        top: 70px;
        right: 5vw;

        background: rgba(255,255,255,0.06);
        -webkit-backdrop-filter: blur(10px) saturate(120%);
        backdrop-filter: blur(10px) saturate(120%);
        flex-direction: column;
        gap: 1rem;
        padding: 1rem 1.2rem;
        border-radius: 12px;
        box-shadow: 0 12px 40px rgba(0,0,0,0.45);
        z-index: 100;
        min-width: 200px;


        opacity: 0;
        transform: translateY(-8px) scale(0.995);
        pointer-events: none;
        max-height: 0;
        overflow: hidden;
        transition: opacity 240ms cubic-bezier(.2,.9,.3,1), transform 240ms cubic-bezier(.2,.9,.3,1), max-height 280ms ease;
    }

    .nav.open {
        opacity: 1;
        transform: translateY(0) scale(1);
        pointer-events: auto;
        max-height: 420px;
        backdrop-filter: blur(20px);
    }

    .hamburger {
        display: flex;
    }

    .hero-title {
        font-size: 1.5rem;
    }
}


@media (max-width: 720px) {
    .about-card {
        padding: 1rem;
    }
    .about-grid {
        display: flex;
        flex-direction: column;
    }
    .about-portrait {
        max-width: 280px;
        height: 320px;
        margin-bottom: 1rem;
    }

    .portrait-panel {
        left: 50%;
        right: auto;
        transform: translate(-50%, 8px);
        width: min(88%, 360px);
    }
    .about-left.active .portrait-panel { transform: translate(-50%, 0); }

    .typewriter { max-width: 16ch; border-right-width: 1.5px; }

    .profile-card .profile-inner {
        flex-direction: column;
        gap: 0.9rem;
        align-items: center;
        text-align: center;
    }
    .profile-card .profile-left {
        width: 100%;
        max-width: 80%;
        flex-basis: auto;
    }
    .profile-card .profile-right {
        width: 100%;
    }

    .profile-card {
        width: 100%;
        max-width: 100%;
        margin: 1rem auto;
        padding-left: 1rem;
        padding-right: 1rem;
        box-sizing: border-box;
    }

    .profile-card .profile-photo {
        width: 100%;
        height: auto;
        display: block;
    }

    .childhood-inner {
        display: flex !important;
        flex-direction: column;
        gap: 0.8rem;
        align-items: center;
        text-align: center;
    }
    .child-left,
    .child-right {
        width: min(92%, 360px);
        max-width: 360px;
        flex: none;
    }
    .child-photo {
        height: auto;
        width: 100%;
        max-height: none;
        object-fit: cover;
    }
    .child-middle {
        width: 100%;
        padding: 0 0.6rem;
        text-align: center;
        grid-column: auto;
        grid-row: auto;
    }

    .about-bottom-hero {
        min-height: 30vh;
        padding: 1.1rem 0;
    }
    .about-bottom-hero-bg::before { height: 14%; }
    .about-bottom-hero-bg::after { height: 42%; }
    .about-bottom-hero-title { font-size: 1.05rem; }
    .about-bottom-hero-sub { font-size: 0.95rem; }

    .footer-inner {
        flex-direction: column;
        gap: 0.6rem;
        align-items: center;
        text-align: center;
    }
    .footer-nav {
        gap: 0.5rem;
        flex-wrap: wrap;
        justify-content: center;
        display: flex;
        width: 100%;
    }
    .footer-list {
        display: flex;
        justify-content: center;
        align-items: center;
        gap: 0.5rem;
        width: 100%;
        padding: 0;
        margin: 0;
    }
    .footer-nav a { padding: 0.4rem 0.6rem; }
    .footer-legal { order: 3; }
    .footer-brand { order: 1; }

    .profile-right cite{
        justify-content: center;
    }
}

/* Small phones */
@media (max-width: 480px) {
    .header {
        align-items: center;
    }
    .hero-title {
        font-size: 1.05rem;
        line-height: 1.08;
        padding: 0 0.6rem;
    }
    .hero-subtitle {
        font-size: 0.85rem;
    }
    .btn {
        font-size: 0.95rem;
        padding: 0.6em 1.2em;
    }
    .typewriter { border-right-width: 1.2px; }

    .about-section {
        padding: 1rem 1.5rem;
    }

    .about-hero-section {
        min-height: 45vh;
        height: 52vh;
    }

    .about-hero-overlay {
        padding: 0.85rem 0.9rem;
        border-radius: 10px;
        margin: 0 0.75rem;
    }

    .about-hero-title {
        font-size: 1.35rem;
    }

    .about-hero-desc {
        font-size: 0.9rem;
    }

    .history-heading,
    .about-bottom-hero-title {
        font-size: 0.98rem;
        padding: 0 0.6rem;
    }

    .projects-inner { padding: 0 0.75rem; }
    .project-card { gap: 0.8rem; padding: 0.85rem; }
    .project-card__body h3 { font-size: 1.02rem; margin-bottom: 0.4rem; }
    .project-card__body p { font-size: 0.95rem; line-height: 1.45; }
    .project-stores { gap: 0.6rem; }

    .history-description-head {
        flex-direction: column;
    }
}


@media (min-width: 721px) and (max-width: 1200px) {
    .school-card {
        width: calc(100% - 3rem);
        max-width: 880px;
    }

    .school-right {
        flex: 0 0 260px;
        max-width: 260px;
    }

    .school-photo {
        height: 160px;
        max-height: 180px;
        object-fit: cover;
    }

    .my-profile {
        flex-direction: column;
    }

    .profile-card {
        width: calc(100% - 3rem);
        max-width: 920px;
        margin-left: auto;
        margin-right: auto;
        padding-left: 1rem;
        padding-right: 1rem;
    }

    .about-grid {
        grid-template-columns: 320px 1fr;
        gap: 1.25rem;
        align-items: start;
    }

    .about-portrait {
        max-width: 320px;
        height: auto;
    }

    .hero-content {
        max-width: 720px;
        padding-left: 1rem;
        padding-right: 1rem;
    }

    .nav {
        gap: 1rem;
    }
    .nav-link {
        padding: 0.35rem 0.65rem;
        font-size: 1rem;
    }

    .graph-container {
        max-width: 980px;
        padding: 1.5rem 1rem;
    }

    .hero-section {
        min-height: 56vh;
        max-height: 760px;
    }

    /* Ensure centered main line position remains accurate */
    .graph-main-line, .graph-svg {
        left: 50%;
        transform: translateX(-50%);
    }

    .about-bottom-hero { min-height: 36vh; padding: 1.6rem 0; }
    .about-bottom-hero-title { font-size: 1.4rem; }

    .child-left, .child-right {
        /* Removed flex-basis and max-width to allow grid to control size */
    }
    .child-photo {
        height: 240px;
        max-height: 420px;
        object-fit: cover;
    }

    .u-maxwidth { max-width: 920px; width: calc(100% - 3rem); }
    .profile-card .profile-left { flex: 0 0 300px; max-width: 300px; }
}


@media (min-width: 1201px) {
    .child-left, .child-right {
        flex: 0 0 320px;
        max-width: 320px;
    }
    .child-photo {
        height: 240px;
        max-height: 640px;
        object-fit: cover;
    }
}

@media (max-width: 1200px) {
    .about-hero-qt {
        top: 70%;
        width: 50%;
        left: 16%;
    }
}

@media (min-width: 981px) {
    .project-card__img {
        flex: 0 0 320px;
        max-width: 320px;
    }
    .project-card__body { padding-left: 0.5rem; padding-right: 0.5rem; }
}

@media (max-width: 600px) {
    .cv-container {
        grid-template-columns: 1fr;
        gap: 1.5rem;
        padding: 1rem 0.5rem;
    }
    .cv-left, .cv-right {
        align-items: center !important;
        text-align: center;
    }
    .cv-section {
        align-items: center !important;
        text-align: center;
    }
    .cv-section h2 {
        width: auto;
        margin-left: auto;
        margin-right: auto;
    }
    .cv-cert-list,
    .cv-contact-list {
        align-items: center !important;
        text-align: left;
        display: flex;
        flex-direction: column;
    }
    .cv-photo { width: 90px; height: 90px; }
}
.cv-left {
    display: flex;
    flex-direction: column;
    align-items: center;
}
.cv-photo {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid var(--accent);
    box-shadow: 0 4px 18px rgba(0,0,0,0.25);
    margin-bottom: 1.2rem;
    display: block;
    margin-left: auto;
    margin-right: auto;
}
.cv-title {
    font-size: 2.4rem;
    font-weight: 800;
    color: var(--accent);
    margin: 0 0 0.5rem 0;
    text-align: center;
}
.cv-section {
    width: 100%;
    margin-bottom: 2rem;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
}

.cv-cert-list,
.cv-contact-list {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
}
.cv-section h2 {
    color: var(--accent);
    font-size: 1.5rem;
    margin-bottom: 0.7rem;
    border-left: 4px solid var(--accent);
    padding-left: 0.7rem;
}
.cv-list, .cv-cert-list {
    list-style: none;
    padding: 0;
    margin: 0;
    width: 100%;
}
.cv-list li, .cv-cert-list li {
    margin-bottom: 0.5rem;
}
.cv-cert-list li {
    display: flex;
    align-items: center;
    gap: 0.7rem;
}
.cv-contact-list {
    list-style: none;
    padding: 0;
    margin: 0;
    width: 100%;
}
.cv-contact-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--accent);
    font-size: 1rem;
    margin-bottom: 0.5rem;
}
.cv-contact-item a {
    color: var(--accent);
    text-decoration: underline;
}
.cv-right {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
}
.cv-right .cv-section {
    margin-bottom: 2.2rem;
    width: 100%;
    align-items: flex-start;
}
.cv-role {
    font-size: 1.1rem;
    color: var(--accent);
    margin: 0.2rem 0 0.7rem 0;
    text-align: center;
}
@media (max-width: 600px) {
    .cv-container { padding: 1rem 0.5rem; }
    .cv-photo { width: 90px; height: 90px; }
}

@media (max-width: 430px) {
    .footer-brand {
        flex-direction: column;
        align-items: center;
    }
    .about-hero-qt {
        top: 70%;
        width: 70%;
        left: 16%;
    }
    .projects-inner {
        padding: 0;
    }

}

@media (max-width: 360px) {
    .about-section {
        padding: 0;
    }

}