/* ==========================================================================
   CSS Variables & Reset (Mobile First Architecture)
   ========================================================================== */
:root {
    --bg-color: #0b1121;
    /* Dark blue/black, elegant */
    --card-bg: rgba(15, 23, 42, 0.6);
    --text-main: #f1f5f9;
    --text-muted: #94a3b8;
    --accent: #38bdf8;
    /* Cyan accent */
    --accent-glow: rgba(56, 189, 248, 0.4);
    --border-color: rgba(51, 65, 85, 0.5);

    --timeline-line: rgba(51, 65, 85, 0.8);
    --tooltip-bg: #1e293b;

    --font-heading: 'Inter', sans-serif;
    --font-body: 'Inter', sans-serif;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    scroll-padding-top: 80px;
}

body {
    background-color: var(--bg-color);
    color: var(--text-main);
    font-family: var(--font-body);
    line-height: 1.6;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

/* Dynamic Background Canvas */
#bg-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: -1;
    pointer-events: none;
    opacity: 1;
}

h1,
h2,
h3,
h4 {
    font-weight: 600;
    font-family: var(--font-heading);
    color: var(--text-main);
    letter-spacing: -0.02em;
}

a {
    color: var(--accent);
    text-decoration: none;
    transition: color 0.3s ease;
}

a:hover,
a:focus {
    color: #7dd3fc;
    outline: none;
}

/* Accessibility Focus States */
a:focus-visible,
button:focus-visible {
    outline: 2px dashed var(--accent);
    outline-offset: 4px;
}

/* ==========================================================================
   Header & Navigation
   ========================================================================== */
.header {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.5rem;
    background: rgba(11, 17, 33, 0.95);
    backdrop-filter: blur(12px);
    z-index: 1000;
    border-bottom: 1px solid var(--border-color);
}

.logo {
    font-size: 1.1rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    letter-spacing: 0.05em;
    color: var(--text-main);
}

.nav {
    display: none;
    flex-direction: column;
    position: absolute;
    top: 100%;
    left: 0;
    width: 100%;
    background: rgba(11, 17, 33, 0.98);
    padding: 1.5rem;
    border-bottom: 1px solid var(--border-color);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.5);
}

.nav.show {
    display: flex;
}

#nav-list {
    display: flex;
    flex-direction: column;
    list-style: none;
    gap: 1.5rem;
    align-items: center;
    margin-bottom: 1.5rem;
}

.nav-link {
    font-size: 1rem;
    font-weight: 500;
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.3s ease;
    background: none;
    border: none;
    padding: 0.5rem;
}

.nav-link:hover,
.nav-link:focus,
.nav-link.active {
    color: var(--text-main);
}

.btn {
    font-size: 1rem;
    font-weight: 600;
    padding: 0.6rem 1.2rem;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background: transparent;
    color: var(--text-main);
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: center;
    display: block;
}

.cv-btn {
    border-color: var(--accent);
    color: var(--accent);
}

.cv-btn:hover,
.cv-btn:focus {
    background: var(--accent-glow);
    color: #fff;
    border-color: #fff;
}

#mobile-menu-btn {
    display: block;
    background: none;
    border: none;
    color: var(--text-main);
    cursor: pointer;
    padding: 0.5rem;
}

/* ==========================================================================
   Layout & Sections
   ========================================================================== */
.main-content {
    /* Critical centering logic */
    width: 100%;
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 1.5rem;
    position: relative;
    box-sizing: border-box;
}

.section {
    min-height: auto;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 6rem 0;
}

.section-header {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    margin-bottom: 2.5rem;
}

.section-icon {
    color: var(--accent);
    display: flex;
    align-items: center;
    justify-content: center;
}

.section-title {
    font-size: 2rem;
    color: var(--text-main);
}

/* ==========================================================================
   Tooltips (A11y adapted)
   ========================================================================== */
.tooltip-trigger {
    color: var(--accent);
    position: relative;
    cursor: help;
    border-bottom: 1px dashed var(--accent);
    transition: all 0.2s ease;
}

.tooltip-trigger:hover,
.tooltip-trigger:focus {
    color: #7dd3fc;
    border-bottom-color: #7dd3fc;
}

.tooltip-box {
    position: absolute;
    bottom: 150%;
    left: 50%;
    transform: translateX(-50%) translateY(10px);
    background: var(--tooltip-bg);
    color: var(--text-main);
    padding: 0.8rem 1.2rem;
    border-radius: 8px;
    font-size: 0.9rem;
    line-height: 1.5;
    width: max-content;
    max-width: 250px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
    border: 1px solid var(--border-color);
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    z-index: 100;
    text-align: left;
    white-space: normal;
}

.tooltip-box::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    margin-left: -6px;
    border-width: 6px;
    border-style: solid;
    border-color: var(--tooltip-bg) transparent transparent transparent;
}

.tooltip-trigger:hover .tooltip-box,
.tooltip-trigger:focus-within .tooltip-box {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0);
}

@media (max-width: 768px) {
    .tooltip-box {
        left: 0;
        transform: translateX(0) translateY(10px);
    }

    .tooltip-box::after {
        left: 10%;
    }

    .tooltip-trigger:hover .tooltip-box,
    .tooltip-trigger:focus-within .tooltip-box {
        transform: translateX(-10%) translateY(0);
    }
}

/* ==========================================================================
   Home / Hero
   ========================================================================== */
#home {
    min-height: 100vh;
    display: flex;
    /* Ensures perfect vertical/horizontal alignment */
    flex-direction: column;
    align-items: center;
    justify-content: center;
    /* Absolutely centered visually */
    text-align: center;
    position: relative;
    padding-top: 0;
    /* Remove top padding for strict center */
}

.home-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 2;
    width: 100%;
    margin-top: -5vh;
    /* Very slight optical compensator for fixed header */
}

.greeting {
    font-size: 2.8rem;
    margin-bottom: 1rem;
    line-height: 1.2;
    color: #fff;
    letter-spacing: -0.03em;
}

.greeting-role {
    font-size: 1.3rem;
    color: var(--text-muted);
    font-weight: 500;
    line-height: 1.4;
    margin-bottom: 2rem;
    max-width: 100%;
}

.scroll-indicator {
    position: absolute;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    opacity: 0.7;
    transition: opacity 0.3s ease;
    cursor: pointer;
    text-decoration: none;
    background: none;
    border: none;
    outline: none;
}

.scroll-indicator:hover,
.scroll-indicator:focus {
    opacity: 1;
}

.scroll-text {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 600;
}

.scroll-mouse {
    width: 24px;
    height: 38px;
    border: 2px solid var(--text-muted);
    border-radius: 12px;
    position: relative;
}

.scroll-wheel {
    width: 4px;
    height: 8px;
    background-color: var(--accent);
    border-radius: 2px;
    position: absolute;
    top: 6px;
    left: 50%;
    transform: translateX(-50%);
    animation: scrollWheel 2s infinite;
}

@keyframes scrollWheel {
    0% {
        top: 6px;
        opacity: 1;
    }

    30% {
        top: 18px;
        opacity: 0;
    }

    100% {
        top: 6px;
        opacity: 0;
    }
}

/* ==========================================================================
   About
   ========================================================================== */
.about-text {
    font-size: 1.05rem;
    color: var(--text-muted);
    display: flex;
    flex-direction: column;
    gap: 1.2rem;
}

/* ==========================================================================
   Timeline / Experiences
   ========================================================================== */
.timeline-container {
    display: flex;
    flex-direction: column;
    gap: 3.5rem;
}

.timeline-group-title {
    font-size: 1.4rem;
    margin-bottom: 1.8rem;
    color: var(--text-main);
    font-weight: 600;
}

.timeline {
    position: relative;
    padding-left: 1.5rem;
}

.timeline::before {
    content: '';
    position: absolute;
    top: 0;
    left: 6px;
    width: 2px;
    height: 100%;
    background: var(--timeline-line);
}

.timeline-item {
    position: relative;
    padding-bottom: 2.8rem;
    padding-left: 1.2rem;
}

.timeline-item:last-child {
    padding-bottom: 0;
}

.timeline-dot {
    position: absolute;
    left: -5.5px;
    top: 8px;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--bg-color);
    border: 3px solid var(--accent);
    box-shadow: 0 0 10px var(--accent-glow);
    z-index: 2;
}

.timeline-header {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 1rem;
    margin-bottom: 0.8rem;
}

.timeline-title-wrap {
    display: flex;
    flex-direction: row;
    align-items: flex-start;
    gap: 1.5rem;
    /* Increased spacing between logo and text */
}

.timeline-logo {
    width: 50px;
    height: 50px;
    background: #fff;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--border-color);
    overflow: hidden;
    flex-shrink: 0;
}

.timeline-logo img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    padding: 4px;
}

.timeline-logo-fallback {
    width: 100%;
    height: 100%;
    background: rgba(56, 189, 248, 0.15);
    color: var(--accent);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1.1rem;
    text-transform: uppercase;
    font-family: var(--font-heading);
    letter-spacing: 0.05em;
    border-radius: inherit;
}

.timeline-role {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-main);
    display: flex;
    align-items: center;
    gap: 0.6rem;
    flex-wrap: wrap;
    line-height: 1.3;
}

.timeline-badge {
    font-size: 0.75rem;
    font-weight: 700;
    padding: 0.2rem 0.5rem;
    background: rgba(56, 189, 248, 0.1);
    color: var(--accent);
    border-radius: 12px;
    letter-spacing: 0.05em;
    white-space: nowrap;
}

.timeline-company {
    font-size: 1.05rem;
    color: var(--accent);
    font-weight: 500;
    margin-top: 0.2rem;
}

.timeline-period {
    font-size: 1.05rem;
    color: var(--text-muted);
    font-weight: 700;
    background: rgba(15, 23, 42, 0.8);
    padding: 0.3rem 0.6rem;
    border-radius: 6px;
    border: 1px solid var(--border-color);
    display: inline-block;
    /* Move the date further down/away from the title text */
    margin-top: 0.6rem;
}

.timeline-details {
    margin-top: 1.2rem;
    font-size: 1.05rem;
    color: var(--text-muted);
    line-height: 1.6;
}

/* ==========================================================================
   Skills
   ========================================================================== */
.skills-wrapper {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.skills-title {
    font-size: 1.2rem;
    margin-bottom: 1rem;
    color: var(--text-main);
    font-weight: 500;
}

.tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
}

.tag {
    padding: 0.5rem 0.9rem;
    border-radius: 6px;
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.3s ease;
}

.tag-acquired {
    background: rgba(56, 189, 248, 0.1);
    color: var(--accent);
    border: 1px solid rgba(56, 189, 248, 0.3);
}

.tag-learning {
    background: rgba(148, 163, 184, 0.1);
    color: var(--text-muted);
    border: 1px solid rgba(148, 163, 184, 0.3);
}

/* ==========================================================================
   Projects
   ========================================================================== */
.project-card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-top: 4px solid var(--accent);
    border-radius: 12px;
    padding: 1.8rem;
    backdrop-filter: blur(8px);
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.2);
    display: flex;
    flex-direction: column;
}

.project-layout {
    display: grid;
    grid-template-columns: 1fr;
    gap: 2.5rem;
}

.project-icon-top {
    color: var(--accent);
    margin-bottom: 1rem;
}

.project-info {
    display: flex;
    flex-direction: column;
}

.project-info h3 {
    margin-bottom: 1rem;
    font-size: 1.5rem;
    line-height: 1.2;
}

.project-info p {
    color: var(--text-muted);
    margin-bottom: 1.5rem;
    font-size: 1.05rem;
    line-height: 1.6;
}

.service-list {
    list-style: none;
    margin-bottom: 1.5rem;
    flex-grow: 1;
}

.service-list li {
    font-size: 0.95rem;
    color: var(--text-muted);
    margin-bottom: 0.6rem;
    padding-left: 1.2rem;
    position: relative;
}

.service-list li::before {
    content: "▹";
    color: var(--accent);
    position: absolute;
    left: 0;
    top: 0;
    font-size: 1rem;
    line-height: 1.2;
}

.project-tags {
    margin-top: auto;
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
}

.project-tags .tag {
    font-size: 0.8rem;
    padding: 0.3rem 0.6rem;
}

.project-visual {
    position: relative;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    background: rgba(0, 0, 0, 0.4);
    min-height: 350px;
    cursor: grab;
    overflow: hidden;
}

#canvas-container {
    width: 100%;
    height: 100%;
    position: absolute;
    top: 0;
    left: 0;
}

.diagram-overlay {
    position: absolute;
    bottom: 10px;
    left: 10px;
    font-size: 0.75rem;
    color: #4ade80;
    padding: 8px 12px;
    border-radius: 4px;
    background: rgba(15, 23, 42, 0.9);
    border: 1px solid rgba(74, 222, 128, 0.3);
}

.diagram-overlay span {
    display: block;
    margin-top: 3px;
    color: var(--text-main);
}

/* ==========================================================================
   Contact & Footer
   ========================================================================== */
.contact-container {
    text-align: center;
    padding: 4rem 1.5rem;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    backdrop-filter: blur(8px);
}

.contact-container p {
    font-size: 1.05rem;
    margin-bottom: 2.5rem;
    color: var(--text-muted);
}

.mail-btn {
    display: inline-block;
    padding: 1rem 2.5rem;
    font-size: 1.05rem;
    font-weight: 600;
    background: rgba(56, 189, 248, 0.1);
    color: var(--accent);
    border: 1px solid var(--accent);
    border-radius: 8px;
    transition: all 0.3s ease;
}

.mail-btn:hover,
.mail-btn:focus {
    background: var(--accent);
    color: var(--bg-color);
    box-shadow: 0 0 20px var(--accent-glow);
}

.site-footer {
    text-align: center;
    padding: 2.5rem;
    color: var(--text-muted);
    font-size: 0.9rem;
    border-top: 1px solid var(--border-color);
}

/* ==========================================================================
   Desktop / Larger Screens Media Query (min-width: 850px)
   ========================================================================== */
@media (min-width: 850px) {

    .header {
        padding: 1.2rem 3rem;
    }

    .logo {
        font-size: 1.25rem;
    }

    #mobile-menu-btn {
        display: none;
    }

    .nav {
        display: flex;
        flex-direction: row;
        position: static;
        background: transparent;
        padding: 0;
        border: none;
        box-shadow: none;
        width: auto;
    }

    #nav-list {
        flex-direction: row;
        margin-bottom: 0;
        gap: 1.8rem;
    }

    .btn {
        display: inline-block;
        padding: 0.6rem 1.2rem;
    }

    .section {
        padding: 9rem 0;
    }

    .section-title {
        font-size: 2.2rem;
    }

    .greeting {
        font-size: 5rem;
    }

    .greeting-role {
        font-size: 2rem;
    }

    .about-text {
        font-size: 1.15rem;
    }

    .timeline {
        padding-left: 2rem;
    }

    .timeline-item {
        padding-left: 2.5rem;
    }

    .timeline-header {
        flex-direction: row;
        justify-content: space-between;
        align-items: flex-start;
        /* Keeps text aligned at top */
    }

    .timeline-title-wrap {
        gap: 1.5rem;
    }

    .timeline-logo {
        width: 60px;
        height: 60px;
    }

    .timeline-role {
        font-size: 1.4rem;
    }

    .timeline-period {
        font-size: 1.1rem;
        padding: 0.3rem 0.8rem;
        /* Desktop pushing logic */
        margin-left: 1rem;
        margin-top: 0;
    }

    .project-card {
        padding: 3rem;
    }

    .project-layout {
        grid-template-columns: 1fr 1fr;
        gap: 4rem;
    }

    .project-info h3 {
        font-size: 2rem;
    }

    .project-info p {
        font-size: 1.1rem;
    }

    .project-visual {
        min-height: 450px;
    }

    .contact-container {
        padding: 6rem 3rem;
    }

    .contact-container p {
        font-size: 1.2rem;
    }
}