/* ===========================================
   MECHANICAL ENGINEERING PORTFOLIO — dark mode
   =========================================== */

/* ---------- Custom Properties ---------- */
:root {
    --bg:             #0d1117;
    --bg-secondary:   #161b22;
    --sidebar-bg:     #161b22;
    --card-bg:        #1c2128;
    --text:           #c9d1d9;
    --text-secondary: #8b949e;
    --text-muted:     #6e7681;
    --accent:         #58a6ff;
    --accent-hover:   #79b8ff;
    --border:         #21262d;
    --card-shadow:    0 4px 24px rgba(0, 0, 0, 0.55);
    --font:           'Inter', system-ui, -apple-system, sans-serif;
    --radius:         10px;
    --transition:     0.2s ease;
    --sidebar-width:  292px;
    --mobile-header:  56px;
}

/* ---------- Reset ---------- */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    height: 100%;
    overflow: hidden;
}

body {
    font-family: var(--font);
    color: var(--text);
    background: var(--bg);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

img {
    max-width: 100%;
    display: block;
}

a {
    color: inherit;
    text-decoration: none;
}

/* ===========================================
   MOBILE HEADER
   =========================================== */
.mobile-header {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--mobile-header);
    background: var(--sidebar-bg);
    border-bottom: 1px solid var(--border);
    z-index: 200;
    align-items: center;
    padding: 0 20px;
    gap: 14px;
}

.mobile-name {
    font-size: 15px;
    font-weight: 600;
    letter-spacing: -0.02em;
    color: var(--text);
}

.mobile-toggle {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 6px;
    border-radius: 4px;
}

.mobile-toggle span {
    display: block;
    width: 20px;
    height: 1.5px;
    background: var(--text);
    transition: transform 0.3s, opacity 0.3s;
    transform-origin: center;
}

.mobile-toggle[aria-expanded="true"] span:nth-child(1) {
    transform: translateY(6.5px) rotate(45deg);
}

.mobile-toggle[aria-expanded="true"] span:nth-child(2) {
    opacity: 0;
    transform: scaleX(0);
}

.mobile-toggle[aria-expanded="true"] span:nth-child(3) {
    transform: translateY(-6.5px) rotate(-45deg);
}

/* ===========================================
   APP SHELL
   =========================================== */
.app-shell {
    display: flex;
    height: 100vh;
    overflow: hidden;
}

/* ===========================================
   SIDEBAR
   =========================================== */

/* Make the custom element transparent to the flex layout */
app-sidebar {
    display: contents;
}

.sidebar {
    width: var(--sidebar-width);
    flex-shrink: 0;
    height: 100vh;
    overflow-y: auto;
    background: var(--sidebar-bg);
    border-right: 1px solid var(--border);
    padding: 28px 20px 24px;
    display: flex;
    flex-direction: column;
    gap: 18px;
    scrollbar-width: thin;
    scrollbar-color: var(--border) transparent;
}

.sidebar::-webkit-scrollbar { width: 4px; }
.sidebar::-webkit-scrollbar-track { background: transparent; }
.sidebar::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 4px;
}

/* Sidebar overlay (mobile) */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.65);
    z-index: 99;
}

.sidebar-overlay.active {
    display: block;
}

/* ---------- Sidebar Profile ---------- */
.sidebar-profile {
    text-align: center;
    padding-bottom: 4px;
}

.sidebar-avatar {
    width: 108px;
    height: 108px;
    border-radius: 50%;
    object-fit: cover;
    object-position: center top;
    border: 2px solid var(--accent);
    box-shadow: 0 0 0 4px rgba(88, 166, 255, 0.15);
    margin: 0 auto 14px;
    background: var(--card-bg);
    transition: box-shadow 0.3s ease, border-color 0.3s ease;
    image-rendering: smooth;
}

.sidebar-avatar.avatar-breathing {
    animation: avatarBreath 1.6s ease-in-out infinite;
}

@keyframes avatarBreath {
    0%, 100% {
        box-shadow: 0 0 0 4px rgba(88, 166, 255, 0.18);
        border-color: var(--accent);
    }
    50% {
        box-shadow: 0 0 0 9px rgba(88, 166, 255, 0.32), 0 0 22px rgba(88, 166, 255, 0.18);
        border-color: var(--accent-hover);
    }
}

.sidebar-name {
    font-size: 17px;
    font-weight: 700;
    letter-spacing: -0.025em;
    color: var(--text);
    margin-bottom: 4px;
    line-height: 1.2;
}

.sidebar-role {
    font-size: 13px;
    color: var(--text-secondary);
    font-weight: 400;
    margin-bottom: 8px;
}

.sidebar-location {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 16px;
}

.sidebar-socials {
    display: flex;
    gap: 8px;
    justify-content: center;
    flex-wrap: wrap;
}

.social-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 13px;
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 12px;
    font-weight: 500;
    color: var(--text-secondary);
    transition: color var(--transition), border-color var(--transition), background var(--transition);
}

.social-btn:hover {
    color: var(--text);
    border-color: var(--accent);
    background: rgba(88, 166, 255, 0.08);
}

.social-icon {
    width: 14px;
    height: 14px;
    object-fit: contain;
    flex-shrink: 0;
}

/* ---------- Sidebar Cards ---------- */
.sidebar-card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px 18px;
}

.sidebar-label {
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--text-muted);
    margin-bottom: 12px;
}

/* ---------- Sidebar Navigation ---------- */
.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.nav-item {
    display: block;
    padding: 9px 12px;
    border-radius: 8px;
    font-size: 13.5px;
    font-weight: 400;
    color: var(--text-secondary);
    background: transparent;
    border: none;
    transition: color var(--transition), background var(--transition), transform var(--transition);
    letter-spacing: -0.01em;
    cursor: pointer;
}

.nav-item:hover {
    color: var(--text);
    background: rgba(255, 255, 255, 0.06);
    transform: translateX(3px);
}

.nav-item.active {
    color: var(--accent);
    font-weight: 600;
    animation: navActivePulse 2.8s ease-in-out infinite;
}

@keyframes navActivePulse {
    0%, 100% { background: rgba(88, 166, 255, 0.10); }
    50%       { background: rgba(88, 166, 255, 0.28); }
}

.nav-item-resume {
    color: var(--text-muted);
    font-size: 13px;
    margin-top: 2px;
}

.nav-item-resume:hover {
    color: var(--accent);
    background: rgba(88, 166, 255, 0.06);
}

/* ---------- Skills ---------- */
.skills-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.skills-list li {
    font-size: 12.5px;
    color: var(--text-secondary);
    padding: 5px 10px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 5px;
    transition: border-color var(--transition), color var(--transition);
}

.skills-list li:hover {
    border-color: rgba(88, 166, 255, 0.4);
    color: var(--text);
}

/* ---------- Education ---------- */
.edu-school {
    font-size: 13.5px;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 3px;
}

.edu-degree {
    font-size: 12.5px;
    color: var(--text-secondary);
    margin-bottom: 3px;
}

.edu-year {
    font-size: 11.5px;
    color: var(--text-muted);
}

.edu-header {
    display: flex;
    align-items: flex-start;
    gap: 10px;
}

.edu-logo {
    width: 30px;
    height: 30px;
    object-fit: contain;
    flex-shrink: 0;
    border-radius: 4px;
    margin-top: 1px;
}

/* ---------- Certifications ---------- */
.cert-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.cert-item {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    font-size: 13.5px;
    font-weight: 600;
    color: var(--text);
    padding: 6px 0;
    border-radius: 8px;
    border: none;
    background: transparent;
    cursor: pointer;
    transition: color var(--transition), transform var(--transition);
    line-height: 1.4;
}

.cert-icon {
    width: 30px;
    height: 30px;
    object-fit: contain;
    flex-shrink: 0;
    border-radius: 4px;
    margin-top: 1px;
}

.cert-item:hover {
    color: var(--accent);
    transform: translateX(3px);
}

/* ---------- Sidebar Footer ---------- */
.sidebar-footer {
    margin-top: auto;
    padding-top: 8px;
    font-size: 11px;
    color: var(--text-muted);
    text-align: center;
}

/* ===========================================
   MAIN CONTENT — page sections
   =========================================== */
.main-content {
    flex: 1;
    height: 100vh;
    overflow: hidden;
    position: relative;
    background: var(--bg);
}

.page-section {
    display: none;
    height: 100%;
    overflow-y: auto;
    padding: 52px 56px 56px;
    scrollbar-width: thin;
    scrollbar-color: var(--border) transparent;
}

.page-section::-webkit-scrollbar { width: 6px; }
.page-section::-webkit-scrollbar-track { background: transparent; }
.page-section::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 4px;
}

.page-section.active {
    display: block;
    animation: sectionIn 0.22s ease;
}

@keyframes sectionIn {
    from { opacity: 0; transform: translateY(10px); }
    to   { opacity: 1; transform: translateY(0);    }
}

.page-section h2 {
    font-size: 26px;
    font-weight: 700;
    letter-spacing: -0.025em;
    color: var(--text);
    margin-bottom: 28px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border);
    position: relative;
}

.page-section h2::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 0;
    width: 0;
    height: 2px;
    background: var(--accent);
}

.page-section.active h2::after {
    animation: accentSlide 0.5s 0.1s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

@keyframes accentSlide {
    from { width: 0; }
    to   { width: 40px; }
}

/* ===========================================
   ABOUT
   =========================================== */
.about-content {
    display: flex;
    gap: 36px;
    align-items: flex-start;
}

.about-image {
    width: 200px;
    height: 230px;
    object-fit: cover;
    border-radius: var(--radius);
    flex-shrink: 0;
    background: var(--card-bg);
    border: 1px solid var(--border);
    image-rendering: smooth;
}

.about-text p {
    font-size: 15px;
    color: var(--text-secondary);
    line-height: 1.85;
    margin-bottom: 16px;
}

.about-text p:last-child {
    margin-bottom: 0;
}

.about-text strong {
    color: var(--text);
    font-weight: 600;
}

.section-divider {
    height: 1px;
    background: var(--border);
    margin: 44px 0;
}

/* ===========================================
   PROJECTS
   =========================================== */
.projects-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
}

.project-card {
    display: block;
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    transition: transform var(--transition), box-shadow var(--transition), border-color var(--transition);
    cursor: pointer;
}

.project-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--card-shadow);
    border-color: rgba(88, 166, 255, 0.3);
}

.project-image-wrap {
    position: relative;
    height: 185px;
    overflow: hidden;
    background: var(--bg-secondary);
}

.project-image-wrap img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.35s ease;
}

.project-card:hover .project-image-wrap img {
    transform: scale(1.05);
}

.project-overlay {
    position: absolute;
    inset: 0;
    background: rgba(13, 17, 23, 0.72);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity var(--transition);
}

.project-card:hover .project-overlay {
    opacity: 1;
}

.project-overlay span {
    color: var(--text);
    font-size: 13px;
    font-weight: 500;
    letter-spacing: 0.06em;
    padding: 7px 16px;
    border: 1.5px solid rgba(200, 220, 255, 0.5);
    border-radius: 4px;
}

.project-info {
    padding: 16px 18px 18px;
}

.project-info h3 {
    font-size: 15px;
    font-weight: 600;
    letter-spacing: -0.01em;
    color: var(--text);
    margin-bottom: 5px;
}

.project-tags {
    font-size: 11px;
    font-weight: 500;
    color: var(--accent);
    letter-spacing: 0.02em;
    margin-bottom: 8px;
}

.project-desc {
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.65;
}

/* ===========================================
   BIO / TIMELINE
   =========================================== */
.timeline {
    position: relative;
    padding-left: 36px;
}

.timeline::before {
    content: '';
    position: absolute;
    left: 5px;
    top: 8px;
    bottom: 16px;
    width: 1.5px;
    background: var(--border);
}

.timeline-item {
    position: relative;
    padding-bottom: 40px;
}

.timeline-item:last-child {
    padding-bottom: 0;
}

.timeline-dot {
    position: absolute;
    left: -35px;
    top: 5px;
    width: 11px;
    height: 11px;
    border-radius: 50%;
    background: var(--accent);
    border: 2px solid var(--bg);
    box-shadow: 0 0 0 1.5px var(--accent);
    animation: timelinePulse 3.2s ease-in-out infinite;
}

.timeline-item:nth-child(1) .timeline-dot { animation-delay: 0s; }
.timeline-item:nth-child(2) .timeline-dot { animation-delay: 0.8s; }
.timeline-item:nth-child(3) .timeline-dot { animation-delay: 1.6s; }
.timeline-item:nth-child(4) .timeline-dot { animation-delay: 2.4s; }

@keyframes timelinePulse {
    0%, 100% { box-shadow: 0 0 0 1.5px var(--accent); }
    50%       { box-shadow: 0 0 0 1.5px var(--accent), 0 0 0 6px rgba(88, 166, 255, 0.12); }
}

.timeline-year {
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.09em;
    color: var(--accent);
    text-transform: uppercase;
    margin-bottom: 6px;
}

.timeline-content h3 {
    font-size: 16px;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 3px;
}

.timeline-role {
    font-size: 13px;
    color: var(--text-secondary);
    font-style: italic;
    margin-bottom: 8px;
}

.timeline-content p:not(.timeline-role) {
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.75;
}

/* ===========================================
   CONTACT
   =========================================== */
.contact-intro {
    font-size: 15px;
    color: var(--text-secondary);
    margin-bottom: 30px;
}

.contact-form {
    display: flex;
    flex-direction: column;
    gap: 18px;
    max-width: 100%;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 18px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.form-group label {
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.09em;
    text-transform: uppercase;
    color: var(--text-secondary);
}

.form-group input,
.form-group textarea {
    padding: 10px 13px;
    border: 1.5px solid var(--border);
    border-radius: 6px;
    font-family: var(--font);
    font-size: 14px;
    color: var(--text);
    background: var(--card-bg);
    outline: none;
    transition: border-color var(--transition), box-shadow var(--transition);
    resize: vertical;
}

.form-group input::placeholder,
.form-group textarea::placeholder {
    color: var(--text-muted);
}

.form-group input:focus,
.form-group textarea:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(88, 166, 255, 0.12);
}

.btn-submit {
    align-self: flex-start;
    padding: 11px 28px;
    background: var(--accent);
    color: #0d1117;
    border: none;
    border-radius: 6px;
    font-family: var(--font);
    font-size: 13.5px;
    font-weight: 600;
    letter-spacing: 0.03em;
    cursor: pointer;
    transition: background var(--transition), transform 0.1s;
}

.btn-submit:hover {
    background: var(--accent-hover);
    transform: translateY(-1px);
}

.btn-submit:active {
    transform: translateY(0);
}

.form-notice {
    font-size: 13px;
    color: #3fb950;
    min-height: 1em;
}

.form-notice.error {
    color: #f85149;
}

/* ===========================================
   PROJECT DETAIL PAGE
   =========================================== */
.back-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 28px;
    transition: color var(--transition);
}

.back-link:hover {
    color: var(--accent);
}

.project-detail-image {
    width: 100%;
    max-height: 380px;
    object-fit: cover;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    margin-bottom: 32px;
    background: var(--card-bg);
}

.project-meta {
    display: flex;
    gap: 28px;
    margin-bottom: 32px;
    flex-wrap: wrap;
    padding: 18px 20px;
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

.project-meta-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.project-meta-label {
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--text-muted);
}

.project-meta-value {
    font-size: 13.5px;
    color: var(--text);
    font-weight: 500;
}

.project-body {
    max-width: 700px;
}

.project-body h3 {
    font-size: 17px;
    font-weight: 600;
    color: var(--text);
    margin: 30px 0 12px;
}

.project-body h3:first-child {
    margin-top: 0;
}

.project-body p {
    font-size: 14.5px;
    color: var(--text-secondary);
    line-height: 1.8;
    margin-bottom: 14px;
}

.project-body ul {
    padding-left: 20px;
    margin-bottom: 16px;
}

.project-body ul li {
    font-size: 14.5px;
    color: var(--text-secondary);
    line-height: 1.75;
    margin-bottom: 6px;
}

/* ===========================================
   SKILL TAGS (project detail pages)
   =========================================== */
.skill-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 32px;
}

.skill-tag {
    padding: 5px 13px;
    background: rgba(88, 166, 255, 0.1);
    border: 1px solid rgba(88, 166, 255, 0.3);
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
    color: var(--accent);
    letter-spacing: 0.02em;
    white-space: nowrap;
}

/* ===========================================
   PDF MODAL
   =========================================== */
.pdf-modal {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.78);
    z-index: 500;
    align-items: center;
    justify-content: center;
    padding: 28px 24px;
}

.pdf-modal.active {
    display: flex;
    animation: modalFadeIn 0.18s ease;
}

.pdf-modal.closing {
    display: flex;
    animation: modalFadeOut 0.18s ease forwards;
    pointer-events: none;
}

@keyframes modalFadeIn {
    from { opacity: 0; transform: scale(0.97); }
    to   { opacity: 1; transform: scale(1);    }
}

@keyframes modalFadeOut {
    from { opacity: 1; transform: scale(1);    }
    to   { opacity: 0; transform: scale(0.97); }
}

.pdf-modal-inner {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 12px;
    width: 100%;
    max-width: 820px;
    max-height: 88vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 28px 64px rgba(0, 0, 0, 0.65);
}

.pdf-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 20px;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}

.pdf-modal-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
}

.pdf-modal-close {
    background: none;
    border: 1px solid var(--border);
    color: var(--text-muted);
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
    padding: 4px 9px;
    border-radius: 5px;
    transition: color var(--transition), background var(--transition), border-color var(--transition);
}

.pdf-modal-close:hover {
    color: var(--text);
    background: rgba(255, 255, 255, 0.07);
    border-color: rgba(255, 255, 255, 0.2);
}

.pdf-modal-body {
    overflow-y: auto;
    padding: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.cert-img {
    max-width: 100%;
    max-height: 72vh;
    object-fit: contain;
    display: block;
    border-radius: 6px;
}

/* ===========================================
   FADE-IN (sidebar cards on load)
   =========================================== */
.fade-in {
    opacity: 0;
    transform: translateY(14px);
    transition: opacity 0.4s ease, transform 0.4s ease;
}

.fade-in.visible {
    opacity: 1;
    transform: translateY(0);
}

/* ===========================================
   RESPONSIVE — mobile
   =========================================== */
@media (max-width: 768px) {
    html, body {
        overflow: auto;
    }

    .mobile-header {
        display: flex;
    }

    .app-shell {
        height: calc(100vh - var(--mobile-header));
        margin-top: var(--mobile-header);
    }

    .sidebar {
        position: fixed;
        left: 0;
        top: var(--mobile-header);
        bottom: 0;
        height: calc(100vh - var(--mobile-header));
        z-index: 100;
        transform: translateX(-100%);
        transition: transform 0.3s ease;
        width: min(var(--sidebar-width), 85vw);
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .main-content {
        width: 100%;
        height: 100%;
    }

    .page-section {
        padding: 32px 24px 48px;
    }

    .about-content {
        flex-direction: column;
    }

    .about-image {
        width: 100%;
        height: 200px;
    }

    .projects-grid {
        grid-template-columns: 1fr;
    }

    .form-row {
        grid-template-columns: 1fr;
    }

    .project-meta {
        gap: 18px;
    }
}
