/* Load Poppins font from Google Fonts */
@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@200;400;500;700&display=swap');

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

:root {
    --main-white: #f0f0f0;
    --main-red: #be3144;
    --main-blue: #45567d;
    --main-gray: #303841;
    --main-black: #181719;
}

html {
    overflow-x: clip;
    overflow-anchor: none;
}

body {
    width: 100%;
    overflow-x: clip;
    overflow-anchor: none;
    margin: 0;
    background-color: var(--main-white);
    font-family: 'Poppins', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    color: var(--main-white);
}

/* Respect user's motion preferences — disable/reduce animations for those who prefer reduced motion */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

#navbar {
    display: flex;
    flex-direction: row-reverse;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap-reverse;
    position: fixed;
    z-index: 10;
    width: 100%;
    top: 0;
    left: 0;
    box-shadow: 0 2px 0 rgba(0, 0, 0, 0.4);
    background-color: var(--main-red);
    transition: background-color 0.3s ease;
}

#navbar ul {
    display: flex;
    flex-direction: row-reverse;
    flex-wrap: wrap;
    margin: 0;
    margin-right: 2rem;
    height: 100%;
    list-style: none;
}

#navbar li {
    display: flex;
    align-items: center;
    height: 100%;
    padding: 0;
}

.nav-link {
    font-size: 2rem;
    padding: 30px;
    transition: all 0.3s ease;
}

.logo {
    height: 100px;
    object-fit: cover;
    border-radius: 50%;
    margin-left: 10px;
}

/* Hover effect replaces infinite float animation */
#navbar li:hover .nav-link {
    transform: translateY(-4px);
    background-color: rgba(255, 255, 255, 0.1);
}

#navbar li:hover {
    background-color: var(--main-blue);
}

#welcome-section {
    position: relative;
    overflow: hidden;
    background-image: linear-gradient(62deg, var(--main-gray) 0%, var(--main-black) 100%);
    text-align: center;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    height: 100vh;
    font-size: 2rem;
}

/* Hero photo: circular portrait with a soft glowing ring */
.hero-photo-frame {
    width: 160px;
    height: 160px;
    border-radius: 50%;
    overflow: hidden;
    margin: 0 auto 2rem;
    padding: 4px;
    display: flex;
    justify-content: center;
    align-items: center;
    background: var(--main-black);
    box-shadow: 0 0 20px 4px rgba(190, 49, 68, 0.55), 0 0 0 2px rgba(240, 240, 240, 0.15);
    animation: photoGlow 3.5s ease-in-out infinite;
}

.hero-photo {
    width: 100%;
    height: 100%;
    max-width: 100%;
    border-radius: 50%;
    object-fit: cover;
    object-position: center 18%;
}

/* Hero name: animated gradient sweep is the site's single "big" motion moment */
.hero-name {
    background-image: linear-gradient(90deg, var(--main-white) 0%, var(--main-red) 50%, var(--main-white) 100%);
    background-size: 220% auto;
    background-clip: text;
    -webkit-background-clip: text;
    color: transparent;
    -webkit-text-fill-color: transparent;
    animation: heroGradientSweep 5s linear infinite;
}

.hero-role {
    padding: 20px;
}

/* Typewriter reveal for the subtitle, sized to its exact character count */
.hero-role .typewriter {
    display: inline-block;
    overflow: hidden;
    white-space: nowrap;
    vertical-align: bottom;
    width: 22ch;
    color: var(--main-red);
    font-weight: 200;
    font-style: italic;
    font-size: 3rem;
    border-right: 3px solid var(--main-red);
    animation:
        typewriterReveal 2s steps(22, end) 0.6s forwards,
        typewriterCursor 0.75s step-end infinite;
    width: 0;
}

.scroll-cue {
    position: absolute;
    bottom: 2.5rem;
    left: 50%;
    transform: translateX(-50%);
    font-size: 1.4rem;
    color: var(--main-white);
    opacity: 0.7;
    animation: scrollCueBounce 2s ease-in-out infinite;
}

.scroll-cue:hover {
    opacity: 1;
}

a {
    text-decoration: none;
    color: var(--main-white);
}

#about {
    background-image: linear-gradient(62deg, var(--main-gray), var(--main-blue));
    padding: 6rem 2rem;
}

.about-content {
    max-width: 900px;
    margin: 0 auto;
}

.about-title {
    font-size: 2.5rem;
    font-weight: 700;
    margin: 0 0 1.5rem;
    animation: titleFade 1s ease forwards;
}

.about-divider {
    width: 100%;
    height: 2px;
    background-color: var(--main-gray);
    border: none;
    margin: 0 0 2.5rem;
}

.about-text {
    font-size: 1.15rem;
    line-height: 1.7;
    margin: 0 0 1.4rem;
    animation: textSlideIn 1s ease forwards;
    animation-delay: 0.1s;
}

.about-project {
    font-size: 1.15rem;
    line-height: 1.7;
    margin: 0 0 2.5rem;
    animation: textSlideIn 1s ease forwards;
    animation-delay: 0.2s;
}

.about-project strong {
    color: var(--main-red);
}

.about-skills-title {
    font-size: 1.4rem;
    font-weight: 700;
    margin: 0 0 1.2rem;
    animation: titleFade 1s ease forwards;
    animation-delay: 0.3s;
}

.about-skills {
    list-style: none;
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    padding: 0;
    margin: 0;
}

/* Staggered entrance for skill tags — each animates in sequence */
.about-skills li {
    background-color: var(--main-blue);
    color: var(--main-white);
    padding: 0.55rem 1.1rem;
    border-radius: 4px;
    font-size: 1rem;
    opacity: 0;
    animation: skillBounceIn 0.6s ease forwards;
    transition: all 0.3s ease;
}

.about-skills li:nth-child(1) {
    animation-delay: 0.4s;
}

.about-skills li:nth-child(2) {
    animation-delay: 0.5s;
}

.about-skills li:nth-child(3) {
    animation-delay: 0.6s;
}

.about-skills li:nth-child(4) {
    animation-delay: 0.7s;
}

/* Hover lift effect on skill tags */
.about-skills li:hover {
    transform: translateY(-4px);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.2);
}

span {
    display: none;
}

img {
    max-width: 70%;
    object-fit: cover;
}

/* ---------- Shared building blocks for the Education / Learning / Skills /
   Languages sections ---------- */

.section-title {
    font-size: 2.5rem;
    font-weight: 700;
    margin: 0 0 1.5rem;
}

.section-divider {
    width: 100%;
    height: 2px;
    background-color: var(--main-red);
    border: none;
    margin: 0 0 2.5rem;
    opacity: 0.5;
}

.status-badge {
    display: inline-block;
    padding: 0.4rem 0.9rem;
    border-radius: 4px;
    font-size: 0.9rem;
    font-weight: 500;
    background-color: var(--main-blue);
}

.status-badge.completed {
    background-color: var(--main-gray);
}

/* Gentle pulse only on "in progress" items — motion with a purpose */
.status-badge.in-progress {
    background-color: var(--main-red);
    animation: badgePulse 2.2s ease-in-out infinite;
}

/* ---------- Education ---------- */

#education {
    background-color: var(--main-black);
    overflow: clip;
    padding: 6rem 2rem;
}

.education-content {
    max-width: 900px;
    margin: 0 auto;
}

.education-card {
    background-color: var(--main-blue);
    border-left: 6px solid var(--main-red);
    padding: 2rem;
    text-align: left;
    opacity: 0;
    transform: perspective(900px) rotateY(-85deg);
    transform-origin: left center;
}

.education-card h3 {
    font-size: 1.4rem;
    margin-bottom: 0.5rem;
}

.education-card p {
    margin-bottom: 1rem;
    opacity: 0.85;
}

#education.section-visible .education-card {
    animation: cardFlipIn 0.9s ease forwards;
}

/* ---------- Training & Learning ---------- */

#learning {
    background-image: linear-gradient(62deg, var(--main-blue), var(--main-gray));
    padding: 6rem 2rem;
}

.learning-content {
    max-width: 900px;
    margin: 0 auto;
}

.learning-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.5rem;
}

.learning-card {
    background-color: var(--main-black);
    padding: 1.75rem;
    text-align: left;
    opacity: 0;
    transform: translateY(50px);
}

.learning-card h3 {
    font-size: 1.25rem;
    margin-bottom: 0.6rem;
}

.learning-card p {
    line-height: 1.6;
    margin-bottom: 1rem;
    opacity: 0.85;
}

#learning.section-visible .learning-card:nth-child(1) {
    animation: learningRise 0.8s ease forwards;
}

#learning.section-visible .learning-card:nth-child(2) {
    animation: learningRise 0.8s ease forwards;
    animation-delay: 0.15s;
}

#learning.section-visible .learning-card:nth-child(3) {
    animation: learningRise 0.8s ease forwards;
    animation-delay: 0.3s;
}

/* ---------- Technical Skills ---------- */

#skills {
    background-color: var(--main-gray);
    padding: 6rem 2rem;
}

.skills-content {
    max-width: 1100px;
    margin: 0 auto;
}

.skills-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.5rem;
    text-align: left;
}

.skill-category {
    background-color: var(--main-blue);
    padding: 1.5rem;
    opacity: 0;
    transform: scale(0.85);
}

.skill-category h3 {
    font-size: 1.15rem;
    margin-bottom: 1rem;
}

#skills.section-visible .skill-category {
    animation: skillZoomIn 0.7s ease forwards;
}

#skills.section-visible .skill-category:nth-child(1) {
    animation-delay: 0s;
}

#skills.section-visible .skill-category:nth-child(2) {
    animation-delay: 0.1s;
}

#skills.section-visible .skill-category:nth-child(3) {
    animation-delay: 0.2s;
}

#skills.section-visible .skill-category:nth-child(4) {
    animation-delay: 0.3s;
}

#skills.section-visible .skill-category:nth-child(5) {
    animation-delay: 0.4s;
}

.skill-chips {
    list-style: none;
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
    padding: 0;
    margin: 0;
}

.skill-chips li {
    background-color: var(--main-gray);
    padding: 0.45rem 0.9rem;
    border-radius: 4px;
    font-size: 0.9rem;
    transition: transform 0.3s ease;
}

.skill-chips li:hover {
    transform: translateY(-3px);
}

/* ---------- Languages ---------- */

#languages {
    background-image: linear-gradient(62deg, var(--main-black), var(--main-blue));
    overflow: clip;
    padding: 6rem 2rem;
}

.languages-content {
    max-width: 900px;
    margin: 0 auto;
}

.languages-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.5rem;
}

.language-card {
    background-color: var(--main-gray);
    padding: 1.75rem;
    opacity: 0;
    transform: perspective(700px) rotateY(90deg);
}

.language-card h3 {
    font-size: 1.2rem;
    margin-bottom: 0.4rem;
}

.language-card p {
    opacity: 0.85;
}

#languages.section-visible .language-card:nth-child(1) {
    animation: langFlipIn 0.8s ease forwards;
}

#languages.section-visible .language-card:nth-child(2) {
    animation: langFlipIn 0.8s ease forwards;
    animation-delay: 0.15s;
}

#languages.section-visible .language-card:nth-child(3) {
    animation: langFlipIn 0.8s ease forwards;
    animation-delay: 0.3s;
}

#project-section {
    display: flex;
    flex-direction: column;
    justify-content: space-evenly;
    align-items: center;
    gap: 20px;
    background-color: var(--main-blue);
    text-align: center;
}

#project-section>h1 {
    font-size: 3rem;
    padding: 20px;
    width: fit-content;
    animation: titleFade 1s ease forwards;
}

.projects-grid {
    display: grid;
    grid-template-columns: 1fr;
    align-items: center;
    justify-content: center;
    text-align: center;
    gap: 30px;
    padding: 0 1rem;
}

.project {
    display: flex;
    flex-direction: column;
    align-items: center;
    opacity: 0;
    transform: translateY(30px) scale(0.98);
    transition: all 0.3s ease;
}

.project.in-view {
    animation: cardReveal 0.9s ease forwards;
}

.project.hidden {
    opacity: 0;
    transform: translateY(30px) scale(0.98);
}

/* Enhanced hover state — lift card and reveal brackets */
.project:hover {
    transform: translateY(-8px) scale(1.02);
}

.project>p {
    padding: 2rem;
    width: 62%;
    font-size: 2rem;
    background-color: var(--main-gray);
    justify-self: center;
    transition: all 0.3s ease;
    position: relative;
}

.project>p span {
    color: var(--main-red);
    font-weight: 500;
    opacity: 0;
    transition: opacity 0.4s ease;
    margin: 0 0.3rem;
}

/* Brackets slide in on hover */
.project:hover>p>span {
    opacity: 1;
}

.project>p:hover {
    background-color: var(--main-red);
    transform: scale(1.05);
}

#show-all-button {
    padding: 1.2rem;
    padding-inline: 2rem;
    background-color: var(--main-gray);
    justify-self: center;
    margin-bottom: 20px;
    transition: all 0.3s ease;
    cursor: pointer;
    font-weight: 500;
}

/* Remove infinite pulse; use hover only for visual feedback */
#show-all-button:hover {
    background-color: var(--main-red);
    transform: scale(1.05);
    box-shadow: 0 6px 15px rgba(190, 49, 68, 0.3);
}

#show-all-button>i {
    transition: transform 0.3s ease;
    display: inline-block;
    margin-left: 0.5rem;
}

#show-all-button:hover>i {
    animation: iconSlide 0.6s ease forwards;
}

footer {
    background-color: var(--main-gray);
}

#contact {
    height: 80vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 0 2rem;
    text-align: center;
    font-size: 2.3rem;
    animation: titleFade 1s ease forwards;
}

#contact h1 {
    animation: titleFade 1s ease forwards;
}

#contact p {
    animation: textSlideIn 1s ease forwards;
    animation-delay: 0.1s;
}

.contact-links {
    display: flex;
    justify-content: space-evenly;
    font-size: 1.5rem;
    max-width: 980px;
    margin-top: 4rem;
    gap: 20px;
    flex-wrap: wrap;
}

.contact-links a {
    opacity: 0;
    animation: iconBounce 1.4s ease forwards;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.3s ease;
    padding: 0.5rem 1rem;
    border-radius: 4px;
}

/* Staggered entrance for contact links */
.contact-links a:nth-child(1) {
    animation-delay: 0.1s;
}

.contact-links a:nth-child(2) {
    animation-delay: 0.2s;
}

.contact-links a:nth-child(3) {
    animation-delay: 0.3s;
}

.contact-links a:nth-child(4) {
    animation-delay: 0.4s;
}

.contact-links a:nth-child(5) {
    animation-delay: 0.5s;
}

.contact-links a:nth-child(6) {
    animation-delay: 0.6s;
}

/* Smooth hover effect — icon slides and link gets subtle background */
.contact-links a:hover {
    transform: translateY(-4px) scale(1.1);
    background-color: rgba(190, 49, 68, 0.15);
}

.contact-links i {
    display: inline-block;
    transition: transform 0.3s ease;
}

.contact-links a:hover i {
    animation: iconSlide 0.4s ease forwards;
}

.copywrites {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.copywrites p {
    padding-top: 30px;
    text-align: center;
}

.copywrites a:hover {
    color: var(--main-red);
}

.poem {
    margin: 1.5rem auto 0;
    padding: 0 1.5rem 2rem;
}

.poem h3 {
    font-weight: 400;
    font-size: 1.1rem;
    line-height: 2;
    text-align: center;
}

.right {
    transform: translateX(clamp(15px, 6vw, 60px));
}

.left {
    transform: translateX(clamp(-60px, -6vw, -15px));
}

@keyframes cardReveal {
    0% {
        opacity: 0;
        transform: translateY(35px) scale(0.96) rotate(1deg);
    }

    60% {
        opacity: 1;
    }

    100% {
        opacity: 1;
        transform: translateY(0) scale(1) rotate(0deg);
    }
}

@keyframes titleFade {
    0% {
        opacity: 0;
        transform: translateY(-30px);
    }

    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

/* New animation: smooth text entrance from left */
@keyframes textSlideIn {
    0% {
        opacity: 0;
        transform: translateX(-20px);
    }

    100% {
        opacity: 1;
        transform: translateX(0);
    }
}

/* New animation: bouncy entrance for skill tags and contact links */
@keyframes skillBounceIn {
    0% {
        opacity: 0;
        transform: translateY(15px) scale(0.85);
    }

    70% {
        opacity: 1;
        transform: translateY(-3px) scale(1.05);
    }

    100% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@keyframes iconSlide {
    0% {
        transform: translateX(0);
    }

    50% {
        transform: translateX(8px);
    }

    100% {
        transform: translateX(0);
    }
}

@keyframes iconBounce {
    0% {
        opacity: 0;
        transform: translateY(12px) scale(0.9);
    }

    50% {
        opacity: 1;
        transform: translateY(-8px) scale(1.1);
    }

    100% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Hero: gradient sweep across the name */
@keyframes heroGradientSweep {
    0% {
        background-position: 0% center;
    }

    100% {
        background-position: 220% center;
    }
}

/* Hero: pulsing glow around the profile photo */
@keyframes photoGlow {

    0%,
    100% {
        box-shadow: 0 0 20px 4px rgba(190, 49, 68, 0.55), 0 0 0 2px rgba(240, 240, 240, 0.15);
    }

    50% {
        box-shadow: 0 0 34px 10px rgba(190, 49, 68, 0.85), 0 0 0 2px rgba(240, 240, 240, 0.25);
    }
}

/* Hero: typewriter reveal of the subtitle */
@keyframes typewriterReveal {
    from {
        width: 0;
    }

    to {
        width: 22ch;
    }
}

@keyframes typewriterCursor {
    50% {
        border-color: transparent;
    }
}

/* Hero: bouncing scroll-down cue */
@keyframes scrollCueBounce {

    0%,
    100% {
        transform: translateX(-50%) translateY(0);
    }

    50% {
        transform: translateX(-50%) translateY(10px);
    }
}

/* Education: card flips open like a diploma */
@keyframes cardFlipIn {
    0% {
        opacity: 0;
        transform: perspective(900px) rotateY(-85deg);
    }

    60% {
        opacity: 1;
    }

    100% {
        opacity: 1;
        transform: perspective(900px) rotateY(0deg);
    }
}

/* Learning: cards rise into place */
@keyframes learningRise {
    0% {
        opacity: 0;
        transform: translateY(50px);
    }

    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Status badge: gentle pulse to signal "in progress" */
@keyframes badgePulse {

    0%,
    100% {
        transform: scale(1);
        opacity: 1;
    }

    50% {
        transform: scale(1.05);
        opacity: 0.85;
    }
}

/* Skills: category blocks zoom into place */
@keyframes skillZoomIn {
    0% {
        opacity: 0;
        transform: scale(0.85);
    }

    100% {
        opacity: 1;
        transform: scale(1);
    }
}

/* Languages: cards flip in around the Y axis */
@keyframes langFlipIn {
    0% {
        opacity: 0;
        transform: perspective(700px) rotateY(90deg);
    }

    100% {
        opacity: 1;
        transform: perspective(700px) rotateY(0deg);
    }
}

@media (prefers-color-scheme: light) {
    :root {
        --main-white: #181719;
        --main-red: #c3354d;
        --main-blue: #586d9d;
        --main-gray: #eef2f7;
        --main-black: #f8fafc;
    }

    body {
        background-color: #f8fafc;
    }
}

@media screen and (min-width: 1024px) {
    .projects-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        width: 100%;
        max-width: 1200px;
    }

    .project:nth-child(odd) {
        animation-delay: 0.1s;
    }

    .project:nth-child(even) {
        animation-delay: 0.2s;
    }

    .learning-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .skills-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .languages-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

/* Compact, single-row navbar + safe hero spacing on small/mid screens.
   The default nav-link size/padding and 100px logo only work on wide
   viewports; below 768px they wrap across two or three lines, and because
   #navbar is position:fixed, that taller navbar was covering the hero
   photo. This keeps the nav on one line and reserves clear space below it. */
@media (max-width: 768px) {
    #navbar {
        flex-wrap: nowrap;
    }

    #navbar ul {
        flex-wrap: nowrap;
        margin-right: 0.75rem;
    }

    .nav-link {
        font-size: 1.05rem;
        padding: 14px 10px;
    }

    .logo {
        height: 52px;
        margin-left: 6px;
    }

    #welcome-section {
        height: auto;
        min-height: 100vh;
        padding: 100px 1.5rem 3rem;
    }
}

@media (max-width: 600px) {
    #about {
        padding: 4rem 1.5rem;
    }

    .about-title {
        font-size: 2rem;
    }

    .hero-role .typewriter {
        font-size: 1.8rem;
    }

    .hero-photo-frame {
        width: 120px;
        height: 120px;
        margin-bottom: 1.5rem;
    }
}