/* =========================================================
   Portfolio Template — base styles (design preserved)
   ========================================================= */

:root {
    /* Reusable animation tokens. Overridden from script.js so the
       whole site can be tuned from one place. */
    --reveal-duration: 700ms;
    --reveal-ease: cubic-bezier(0.22, 1, 0.36, 1);
    --reveal-distance: 26px;
    --reveal-delay: 0ms;
    --accent: #3b82f6;
    --accent-soft: #60a5fa;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

html {
    scroll-behavior: smooth;
    scroll-padding-top: 84px;
}

body {
    background: #0b0f19;
    color: #e5e7eb;
    line-height: 1.6;
    padding-top: 64px;
    overflow-x: hidden;
}

body.is-locked {
    overflow: hidden;
}

a:focus-visible,
.hamburger:focus-visible {
    outline: 2px solid var(--accent-soft);
    outline-offset: 3px;
    border-radius: 4px;
}

/* =========================================================
   Loading screen
   ========================================================= */

#loading-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #0a0f1a;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    transition: opacity 0.6s ease;
    color: #cbd5e1;
}

#loading-screen.is-hidden {
    opacity: 0;
    pointer-events: none;
}

#user-name {
    font-size: 28px;
    font-weight: 600;
    margin-bottom: 15px;
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    overflow: hidden;
    white-space: nowrap;
    max-width: 92vw;
}

#user-name span {
    display: inline-block;
    transform: translateX(100px);
    opacity: 0;
    animation: slideInMiddle 0.6s forwards;
}

#user-name .space {
    width: 12px;
}

.status-text {
    margin-bottom: 15px;
    font-size: 16px;
    color: #94a3b8;
}

.loading-bar {
    width: 260px;
    height: 6px;
    border-radius: 10px;
    background: #25344d;
    overflow: hidden;
    margin-top: 10px;
    border: 1px solid #375d8c;
}

#bar-fill {
    height: 100%;
    width: 0%;
    background: #4da3ff;
    transition: width 0.05s linear;
}

@keyframes slideInMiddle {
    0% { transform: translateX(100px); opacity: 0; }
    60% { transform: translateX(-10px); opacity: 1; }
    100% { transform: translateX(0); opacity: 1; }
}

/* =========================================================
   Scroll progress indicator
   ========================================================= */

#scroll-progress {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 3px;
    z-index: 2000;
    pointer-events: none;
    background: transparent;
}

#scroll-progress-bar {
    display: block;
    height: 100%;
    width: 100%;
    background: linear-gradient(90deg, var(--accent), var(--accent-soft));
    transform: scaleX(0);
    transform-origin: 0 50%;
    transition: transform 0.1s linear;
}

/* =========================================================
   Navigation
   ========================================================= */

.nav-bar {
    position: fixed;
    top: 0;
    width: 100%;
    background: #0f1420;
    z-index: 1000;
    box-shadow: 0 1px 0 #1e293b;
}

.nav-bar nav ul {
    display: flex;
    justify-content: center;
    gap: 32px;
    list-style: none;
    padding: 18px 0;
}

.nav-bar nav ul li a {
    position: relative;
    text-decoration: none;
    color: #64748b;
    font-size: 0.9rem;
    font-weight: 500;
    letter-spacing: 0.5px;
    transition: color 0.2s ease;
    padding: 4px 0;
}

.nav-bar nav ul li a::after {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    bottom: -1px;
    height: 2px;
    border-radius: 2px;
    background: var(--accent);
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 0.25s var(--reveal-ease);
}

.nav-bar nav ul li a:hover {
    color: #f1f5f9;
}

.nav-bar nav ul li a.active {
    color: #f1f5f9;
}

.nav-bar nav ul li a:hover::after,
.nav-bar nav ul li a.active::after {
    transform: scaleX(1);
}

.hamburger {
    display: none;
    flex-direction: column;
    cursor: pointer;
    padding: 5px;
    z-index: 1001;
}

.hamburger span {
    width: 22px;
    height: 2px;
    background: #64748b;
    margin: 3px 0;
    transition: 0.3s;
    border-radius: 2px;
}

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

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

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

/* =========================================================
   Hero / header
   ========================================================= */

.header {
    position: relative;
    background: #0f1420;
    border-bottom: 1px solid #1e293b;
    padding: 60px 20px;
    overflow: hidden;
    isolation: isolate;
}

.hero-bg {
    position: absolute;
    inset: 0;
    overflow: hidden;
    pointer-events: none;
    z-index: 0;
}

.hero-glow {
    position: absolute;
    border-radius: 50%;
    filter: blur(90px);
    opacity: 0;
    transition: opacity 1.2s ease;
    will-change: transform;
}

body.loaded .hero-glow {
    opacity: 1;
}

.glow-a {
    width: 520px;
    height: 520px;
    top: -220px;
    right: -140px;
    background: radial-gradient(circle, rgba(59, 130, 246, 0.30), transparent 70%);
}

.glow-b {
    width: 460px;
    height: 460px;
    bottom: -240px;
    left: -160px;
    background: radial-gradient(circle, rgba(96, 165, 250, 0.20), transparent 70%);
}

.header-content {
    position: relative;
    z-index: 1;
    max-width: 800px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    gap: 40px;
}

.profile-img {
    width: 140px;
    height: 140px;
    border-radius: 50%;
    flex-shrink: 0;
}

.header-text {
    flex: 1;
}

#name {
    font-size: 2.2rem;
    font-weight: 700;
    color: #f1f5f9;
    margin-bottom: 8px;
    letter-spacing: -0.5px;
}

.typewriter {
    font-size: 1.2rem;
    font-weight: 400;
    color: #64748b;
    min-height: 1.6em;
}

.js .typewriter {
    opacity: 0;
    transform: translateY(10px);
    transition: opacity 0.6s var(--reveal-ease), transform 0.6s var(--reveal-ease);
}

.js body.loaded .typewriter {
    opacity: 1;
    transform: none;
    transition-delay: 0.45s;
}

/* =========================================================
   Sections
   ========================================================= */

.section {
    position: relative;
    padding: 72px 20px;
    scroll-margin-top: 84px;
}

/* Subtle, restrained transition between major sections. */
.section + .section::before {
    content: '';
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: min(1100px, 90%);
    height: 1px;
    background: linear-gradient(90deg, transparent, #1e293b 20%, #1e293b 80%, transparent);
    opacity: 0.7;
}

.section h2 {
    text-align: center;
    font-size: 1.8rem;
    font-weight: 600;
    margin-bottom: 48px;
    color: #f1f5f9;
    letter-spacing: -0.3px;
}

.section h2::after {
    content: '';
    display: block;
    width: 40px;
    height: 3px;
    background: var(--accent);
    margin: 14px auto 0;
    border-radius: 2px;
}

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

.about-cards {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.about-card {
    display: flex;
    align-items: flex-start;
    gap: 16px;
    padding: 24px;
    background: #111827;
    border: 1px solid #1e293b;
    border-radius: 8px;
    transition: border-color 0.25s ease, background 0.25s ease,
        transform 0.35s var(--reveal-ease), box-shadow 0.35s ease;
}

.about-card:hover {
    border-color: var(--accent);
    background: #182032;
    transform: translateY(-4px);
    box-shadow: 0 14px 30px -18px rgba(59, 130, 246, 0.5);
}

.about-icon {
    flex-shrink: 0;
    width: 40px;
    height: 40px;
    background: #1e293b;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.about-card p {
    color: #94a3b8;
    font-size: 0.95rem;
    line-height: 1.7;
}

.about-card p strong {
    color: #e2e8f0;
}

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

.education-row {
    display: flex;
    justify-content: center;
    gap: 24px;
    flex-wrap: wrap;
}

.education-box {
    display: flex;
    align-items: center;
    gap: 20px;
    background: #111827;
    padding: 24px;
    border-radius: 8px;
    width: 420px;
    border: 1px solid #1e293b;
    transition: border-color 0.25s ease, transform 0.35s var(--reveal-ease),
        box-shadow 0.35s ease;
}

.education-box:hover {
    border-color: var(--accent);
    transform: translateY(-4px);
    box-shadow: 0 14px 30px -18px rgba(59, 130, 246, 0.5);
}

.edu-content {
    flex: 1;
}

.edu-content h4 {
    font-size: 0.85rem;
    color: #64748b;
    font-weight: 500;
    margin-bottom: 6px;
}

.highlight-text {
    font-weight: 600;
    color: #f1f5f9;
    margin-bottom: 4px;
    font-size: 0.95rem;
}

.edu-content p:last-child {
    color: #64748b;
    font-size: 0.85rem;
}

.edu-logo {
    width: 60px;
    height: 60px;
    object-fit: contain;
    border-radius: 6px;
    flex-shrink: 0;
}

#tech-stack {
    max-width: 1100px;
    margin: 0 auto;
}

.tech-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
}

.tech-card {
    background: #111827;
    border: 1px solid #1e293b;
    border-radius: 8px;
    padding: 20px;
    transition: border-color 0.25s ease, transform 0.35s var(--reveal-ease),
        box-shadow 0.35s ease;
}

.tech-card:hover {
    border-color: var(--accent);
    transform: translateY(-4px);
    box-shadow: 0 14px 30px -18px rgba(59, 130, 246, 0.5);
}

.tech-icons {
    display: flex;
    gap: 8px;
    margin-bottom: 14px;
    flex-wrap: wrap;
}

.tech-icons img {
    width: 22px;
    height: 22px;
    opacity: 0.85;
    transition: opacity 0.2s ease, transform 0.3s var(--reveal-ease);
}

.tech-card:hover .tech-icons img {
    opacity: 1;
    transform: translateY(-2px);
}

.tech-card h3 {
    font-size: 0.8rem;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-weight: 600;
    margin-bottom: 8px;
}

.tech-card p {
    color: #94a3b8;
    font-size: 0.82rem;
    line-height: 1.6;
}

.tech-highlight {
    margin-top: 24px;
    padding: 24px;
    background: #111827;
    border: 1px solid #1e293b;
    border-radius: 8px;
    text-align: center;
}

.tech-highlight h4 {
    font-size: 0.85rem;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-weight: 600;
    margin-bottom: 16px;
}

.tech-highlight p {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    flex-wrap: wrap;
    color: #94a3b8;
    font-size: 0.9rem;
}

.tech-highlight p .sep {
    color: #334155;
    font-size: 0.8rem;
    margin: 0 2px;
}

.certificates-container {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 20px;
}

.certificate {
    background: #111827;
    padding: 16px;
    border-radius: 8px;
    text-align: center;
    border: 1px solid #1e293b;
    overflow: hidden;
    transition: border-color 0.25s ease, transform 0.35s var(--reveal-ease),
        box-shadow 0.35s ease;
}

.certificate:hover {
    border-color: var(--accent);
    transform: translateY(-4px);
    box-shadow: 0 14px 30px -18px rgba(59, 130, 246, 0.5);
}

.certificate img {
    width: 100%;
    height: auto;
    max-height: 260px;
    object-fit: contain;
    border-radius: 6px;
    margin-bottom: 10px;
    transition: transform 0.5s var(--reveal-ease);
}

.certificate:hover img {
    transform: scale(1.04);
}

.certificate p {
    padding: 6px;
}

.certificate p a {
    color: var(--accent-soft);
    text-decoration: none;
    font-size: 0.85rem;
    transition: color 0.2s ease;
}

.certificate p a:hover {
    color: #93c5fd;
}

.projects-container {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 20px;
}

.project-item {
    background: #111827;
    padding: 16px;
    border-radius: 8px;
    text-align: center;
    border: 1px solid #1e293b;
    overflow: hidden;
    transition: border-color 0.25s ease, transform 0.4s var(--reveal-ease),
        box-shadow 0.4s ease;
}

.project-item:hover {
    border-color: var(--accent);
    transform: translateY(-6px);
    box-shadow: 0 18px 36px -18px rgba(59, 130, 246, 0.55);
}

.project-item img {
    width: 100%;
    border-radius: 6px;
    height: 150px;
    object-fit: cover;
    transition: transform 0.5s var(--reveal-ease);
}

.project-item:hover img {
    transform: scale(1.06);
}

.project-item a {
    display: block;
    margin-top: 12px;
    font-size: 0.9rem;
    text-decoration: none;
    color: var(--accent-soft);
    font-weight: 600;
    transition: color 0.2s ease;
}

.project-item a:hover {
    color: #93c5fd;
}

.project-item p {
    color: #64748b;
    margin-top: 8px;
    font-size: 0.8rem;
    line-height: 1.5;
}

#contact {
    text-align: center;
    padding: 72px 20px;
}

#contact-title {
    margin-bottom: 32px;
    font-size: 1.8rem;
    font-weight: 600;
    color: #f1f5f9;
    letter-spacing: 3px;
}

.contact {
    list-style: none;
    display: flex;
    justify-content: center;
    gap: 24px;
    padding: 0;
    margin: 0;
}

.contact li img {
    width: 44px;
    height: 44px;
    object-fit: contain;
    border-radius: 8px;
    transition: opacity 0.2s ease, transform 0.3s var(--reveal-ease);
    opacity: 0.5;
}

.contact li img:hover {
    opacity: 1;
    transform: translateY(-4px);
}

.contact-fallback {
    margin-top: 28px;
    color: #64748b;
    font-size: 0.85rem;
    letter-spacing: 0.5px;
}

.footer {
    text-align: center;
    padding: 24px 20px;
    color: #334155;
    font-size: 0.8rem;
    border-top: 1px solid #1e293b;
}

/* =========================================================
   Scroll-reveal system
   Only active when JS is available (.js on <html>) so that
   content stays visible if scripting is disabled.
   ========================================================= */

.js [data-reveal] {
    opacity: 0;
    transform: translate3d(0, var(--reveal-distance), 0);
    transition:
        opacity var(--reveal-duration) var(--reveal-ease) var(--reveal-delay),
        transform var(--reveal-duration) var(--reveal-ease) var(--reveal-delay);
}

.js [data-reveal="left"] {
    transform: translate3d(calc(var(--reveal-distance) * -1), 0, 0);
}

.js [data-reveal="right"] {
    transform: translate3d(var(--reveal-distance), 0, 0);
}

.js [data-reveal="scale"] {
    transform: translate3d(0, calc(var(--reveal-distance) * 0.5), 0) scale(0.94);
}

.js [data-reveal="fade"] {
    transform: none;
}

.js [data-reveal].is-visible {
    opacity: 1;
    transform: translate3d(0, 0, 0) scale(1);
}

/* Word-by-word text reveal */
.js [data-text-reveal] .word {
    display: inline-block;
    overflow: hidden;
    vertical-align: bottom;
    padding-bottom: 0.14em;
    margin-bottom: -0.14em;
}

.js [data-text-reveal] .word-inner {
    display: inline-block;
    opacity: 0;
    transform: translate3d(0, 110%, 0);
    transition:
        transform var(--reveal-duration) var(--reveal-ease) var(--word-delay, 0ms),
        opacity calc(var(--reveal-duration) * 0.8) ease var(--word-delay, 0ms);
}

.js [data-text-reveal].is-visible .word-inner {
    opacity: 1;
    transform: translate3d(0, 0, 0);
}

/* =========================================================
   Responsive
   ========================================================= */

@media (max-width: 900px) {
    .tech-grid { grid-template-columns: repeat(2, 1fr); }
    .certificates-container { grid-template-columns: repeat(2, 1fr); }
    .projects-container { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 768px) {
    body { padding-top: 0; }

    html { scroll-padding-top: 20px; }

    .nav-bar {
        position: relative;
        display: flex;
        align-items: center;
        justify-content: flex-end;
        padding: 12px 20px;
    }

    .hamburger { display: flex; }

    .nav-bar nav ul {
        position: fixed;
        left: -100%;
        top: 0;
        flex-direction: column;
        background: #0f1420;
        width: 260px;
        height: 100vh;
        text-align: left;
        transition: left 0.3s ease;
        padding: 80px 30px 30px;
        gap: 4px;
        box-shadow: 4px 0 20px rgba(0, 0, 0, 0.4);
        z-index: 999;
    }

    .nav-bar nav ul.active { left: 0; }

    .nav-bar nav ul li a {
        display: block;
        padding: 14px 0;
        font-size: 1rem;
        border-bottom: 1px solid #1e293b;
    }

    .nav-bar nav ul li a::after { display: none; }

    .section { scroll-margin-top: 20px; }

    .header-content {
        flex-direction: column;
        text-align: center;
        gap: 24px;
    }

    .profile-img { width: 120px; height: 120px; }

    #name { font-size: 1.8rem; }

    .typewriter { font-size: 1rem; }

    .education-row { flex-direction: column; align-items: center; }
    .education-box { width: 100%; max-width: 400px; flex-direction: column; text-align: center; }
    .edu-content { text-align: center; }

    .projects-container { grid-template-columns: 1fr; max-width: 400px; }
    .contact { flex-wrap: wrap; gap: 16px; }
    .contact li img { width: 40px; height: 40px; }

    /* Hover lifts can feel jumpy on touch devices. */
    .about-card:hover,
    .education-box:hover,
    .tech-card:hover,
    .certificate:hover,
    .project-item:hover {
        transform: none;
    }
}

@media (max-width: 600px) {
    .tech-grid { grid-template-columns: 1fr; }
    .certificates-container { grid-template-columns: 1fr; }
    .projects-container { grid-template-columns: 1fr; }
}

@media (max-width: 480px) {
    .section { padding: 48px 16px; }
    .section h2 { font-size: 1.5rem; margin-bottom: 32px; }
    #name { font-size: 1.5rem; }
    .typewriter { font-size: 0.9rem; }
    .profile-img { width: 100px; height: 100px; }
    .about-card { padding: 16px; }
    .about-card p { font-size: 0.88rem; }
}

/* =========================================================
   Reduced motion — keep the site fully usable, remove motion
   ========================================================= */

@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }

    *,
    *::before,
    *::after {
        animation-duration: 0.001ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.001ms !important;
        transition-delay: 0ms !important;
        scroll-behavior: auto !important;
    }

    .js [data-reveal],
    .js [data-text-reveal] .word-inner {
        opacity: 1 !important;
        transform: none !important;
    }

    .js .typewriter,
    body.loaded .hero-glow {
        opacity: 1 !important;
        transform: none !important;
    }

    .hero-glow { will-change: auto; }
}
