html {
    scroll-behavior: smooth;
    height: 100%;
}

html[data-i18n-loading="true"] body {
    visibility: hidden;
}

body {
    margin: 0;
    overflow-x: hidden;
    font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
    color: #1f1f1f;
    background: #f5f3ff;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

body.modal-open,
html.modal-open {
    overflow: hidden !important;
}

.top-nav {
    min-height: 60px;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    padding: 0 10px;
}

.top-nav .w3-bar-item,
.lang-toggle button {
    color: #ffffff;
    font-weight: 600;
}

.top-nav .w3-bar-item {
    white-space: nowrap;
}

.top-nav .w3-bar-item.active-page,
.top-nav .w3-bar-item.active-page:hover {
    background: transparent !important;
    color: #ffeb3b !important;
    border-bottom: 2px solid #ffeb3b;
}

.lang-toggle {
    display: flex;
    align-items: center;
    margin-left: auto;
}

.lang-toggle .separator {
    color: #ffffff;
    opacity: 0.7;
}

.lang-toggle .active {
    color: #ffeb3b;
}

/* Hamburger Menu Styles */
.hamburger-menu {
    display: none;
    flex-direction: column;
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px 12px;
    gap: 6px;
    margin-right: 12px;
}

.hamburger-menu span {
    width: 24px;
    height: 3px;
    background: #ffffff;
    border-radius: 2px;
    transition: all 0.3s ease;
}

.hamburger-menu[aria-expanded="true"] span:nth-child(1) {
    transform: rotate(45deg) translate(8px, 8px);
}

.hamburger-menu[aria-expanded="true"] span:nth-child(2) {
    opacity: 0;
}

.hamburger-menu[aria-expanded="true"] span:nth-child(3) {
    transform: rotate(-45deg) translate(8px, -8px);
}

/* Mobile Menu Styles */
.mobile-menu {
    display: none;
    flex-direction: column;
    background: #3d1f66;
    border-top: 1px solid rgba(255, 255, 255, 0.2);
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
}

.mobile-menu.active {
    max-height: 300px;
}

.mobile-menu-link {
    color: #ffffff;
    text-decoration: none;
    padding: 14px 16px;
    border: none;
    background: none;
    text-align: left;
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.2s ease;
    display: block;
    white-space: nowrap;
}

.mobile-menu-link:hover {
    background: rgba(255, 235, 59, 0.1);
    padding-left: 24px;
}

.mobile-menu-link.active-page {
    color: #ffeb3b;
    background: rgba(255, 235, 59, 0.1);
}

/* Responsive Design */
@media (max-width: 768px) {
    .hamburger-menu {
        display: flex;
    }
    
    .top-nav .nav-link {
        display: none;
    }
    
    .top-nav {
        min-height: 50px;
    }
    
    .mobile-menu {
        display: flex;
        order: 10;
        width: 100%;
    }
}

.hero {
    margin-top: 60px;
    padding: 72px 20px 40px;
    background: linear-gradient(135deg, #4a148c, #7e57c2);
    color: #ffffff;
}

.hero .subtitle {
    font-size: 1.35rem;
    margin-top: 8px;
}

.hero .summary {
    max-width: 760px;
    margin: 14px auto 0;
    font-size: 1.05rem;
}

.hero-actions {
    margin-top: 28px;
    display: flex;
    justify-content: center;
    gap: 14px;
    flex-wrap: wrap;
}

.hero-actions .w3-button {
    padding: 10px 18px;
    font-weight: 600;
}

.content {
    max-width: 1000px;
    margin: 0 auto;
    padding: 26px 16px 40px;
    flex: 1;
}

.panel {
    background: #ffffff;
    padding: 20px;
    margin-top: 18px;
    border-radius: 12px;
}

.panel h2 {
    margin-top: 0;
    color: #4527a0;
}

.project-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 14px;
}

.project-card {
    border: 1px solid #ece7ff;
    border-radius: 10px;
    padding: 14px;
    background: #faf9ff;
    transition: all 0.3s ease;
    cursor: pointer;
}

.project-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 16px rgba(84, 39, 160, 0.12);
    border-color: #d9cff3;
}

.project-card h3 {
    margin-top: 0;
    color: #5e35b1;
}

.writeup-link {
    display: inline-block;
    margin-top: 10px;
    color: #4a2ea3;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.25s ease;
}

.writeup-link:hover {
    text-decoration: underline;
    transform: translateX(2px);
}

.writeups-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 14px;
}

.writeup-card {
    background: #faf9ff;
    border: 1px solid #ece7ff;
    border-radius: 10px;
    padding: 14px;
    transition: all 0.3s ease;
    cursor: pointer;
    text-decoration: none;
    color: inherit;
    display: block;
    position: relative;
}

.writeup-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 16px rgba(84, 39, 160, 0.12);
    border-color: #d9cff3;
}

.writeup-card h3 {
    margin: 0 0 8px;
    color: #5e35b1;
}

.writeup-card p {
    margin: 0;
}

.writeup-card.future {
    background: #fffff9;
    border: #b1a935 1px dashed;
    cursor: default;
}

.writeup-card.future:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 16px rgba(84, 39, 160, 0.12);
    border-color: #eff3cf;
}

.writeup-card.future h3 {
    margin: 0 0 8px;
    color: #b1a935;
}

.writeup-card.expanded {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    cursor: default;
    width: 90%;
    max-width: 700px;
    height: 80vh;
    overflow-y: auto;
    overflow-x: hidden;
    z-index: 1000;
    padding: 28px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    scrollbar-gutter: stable;
    scrollbar-width: auto;
    scrollbar-color: #c0afe9 transparent;
    box-sizing: border-box;
}

.writeup-card.expanded:hover {
    transform: translate(-50%, -50%);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.writeup-card.expanded::-webkit-scrollbar {
    width: 10px;
}

.writeup-card.expanded::-webkit-scrollbar-track {
    background: transparent;
}

.writeup-card.expanded::-webkit-scrollbar-thumb {
    background: #c0afe9;
    border-radius: 5px;
}

.writeup-card.expanded::-webkit-scrollbar-thumb:hover {
    background: #ac98df;
}

.writeup-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 999;
    display: none;
}

.writeup-modal-overlay.active {
    display: block;
}

.writeup-close-btn {
    display: none;
    position: absolute;
    top: 12px;
    right: 12px;
    background: none;
    border: none;
    font-size: 1.8rem;
    color: #4a2ea3;
    cursor: pointer;
    padding: 4px 8px;
    transition: all 0.2s ease;
}

.writeup-card.expanded .writeup-close-btn {
    display: block;
}

.writeup-close-btn:hover {
    transform: scale(1.2);
}

.writeup-expanded {
    margin-top: 16px;
}

.writeup-expanded h4 {
    margin: 16px 0 8px;
    color: #5e35b1;
}

.writeup-expanded h4:first-child {
    margin-top: 0;
}

.writeup-expanded p {
    margin: 0 0 12px;
    line-height: 1.6;
}

.writeup-expanded ul {
    margin: 0 0 12px 20px;
    line-height: 1.6;
}

.writeup-expanded li {
    margin-bottom: 6px;
}

.writeup-meta {
    display: inline-block;
    margin-bottom: 8px;
    padding: 3px 8px;
    border: 1px solid #ddd4f3;
    border-radius: 4px;
    background: #f8f6ff;
    color: #4a2ea3;
    font-size: 0.82rem;
    font-weight: 600;
}

.writeup-meta.future {
    background: #fffff9;
    border: #b1a935 1px dashed;
    color: #b1a935;
}

.project-detail {
    background: #ffffff;
    border-radius: 12px;
    padding: 28px;
    margin-top: 18px;
}

.project-detail h2 {
    margin-top: 0;
    color: #4527a0;
    font-size: 1.8rem;
}

.project-detail h3 {
    margin-top: 20px;
    color: #5e35b1;
    font-size: 1.2rem;
}

.project-detail h3:first-of-type {
    margin-top: 0;
}

.project-detail p {
    line-height: 1.6;
    color: #444;
}

.project-detail ul,
.project-detail ol {
    line-height: 1.8;
    color: #444;
}

.project-detail li {
    margin-bottom: 8px;
}

.project-back-link {
    display: inline-flex;
    align-items: center;
    margin-bottom: 16px;
    color: #4a2ea3;
    text-decoration: none;
    font-weight: 600;
    transition: all 0.25s ease;
}

.project-back-link:hover {
    transform: translateX(-2px);
}

.project-back-link::before {
    content: "← ";
    margin-right: 4px;
}

.contact-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 14px;
}

.contact-card {
    background: #faf9ff;
    border: 1px solid #ece7ff;
    border-radius: 10px;
    padding: 14px;
    transition: all 0.3s ease;
}

.contact-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 16px rgba(84, 39, 160, 0.12);
    border-color: #d9cff3;
}

.contact-card h3 {
    margin: 0 0 8px;
    color: #5e35b1;
}

.contact-link {
    color: #4a2ea3;
    text-decoration: none;
    font-weight: 600;
    transition: all 0.25s ease;
}

.contact-link:hover {
    text-decoration: underline;
    transform: translateX(2px);
}

.skills-categories {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 14px;
}

.skills-category h3 {
    margin: 0 0 10px;
    color: #5e35b1;
    font-size: 1rem;
}

.skills-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.skill-tag {
    display: inline-flex;
    align-items: center;
    padding: 5px 9px;
    border-radius: 4px;
    font-size: 0.9rem;
    font-weight: 500;
    line-height: 1.2;
    background: #f8f6ff;
    color: #4a2ea3;
    border: 1px solid #ddd4f3;
    transition: all 0.25s ease;
    cursor: default;
}

.skill-tag:hover {
    transform: scale(1.08);
    background: #ede7f6;
    border-color: #c9bce8;
    box-shadow: 0 4px 12px rgba(84, 39, 160, 0.1);
}

.journey-timeline {
    position: relative;
    margin-top: 8px;
    padding-left: 22px;
}

.journey-timeline::before {
    content: "";
    position: absolute;
    top: 0;
    bottom: 0;
    left: 7px;
    width: 2px;
    background: #d9cff3;
}

.journey-item {
    position: relative;
    margin-bottom: 16px;
    padding-left: 18px;
}

.journey-item:last-child {
    margin-bottom: 0;
}

.journey-item::before {
    content: "";
    position: absolute;
    left: -4px;
    top: 8px;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #6b42c5;
    border: 2px solid #ffffff;
    box-shadow: 0 0 0 2px #d9cff3;
}

.journey-date {
    display: inline-block;
    margin-bottom: 8px;
    padding: 3px 8px;
    border-radius: 4px;
    background: #f3efff;
    border: 1px solid #ddd4f3;
    color: #4a2ea3;
    font-size: 0.82rem;
    font-weight: 700;
}

.journey-content {
    background: #faf9ff;
    border: 1px solid #ece7ff;
    border-radius: 8px;
    margin-bottom: 6px;
    padding: 10px 12px;
    transition: all 0.3s ease;
}

.journey-content:hover {
    background: #f3efff;
    border-color: #d9cff3;
    box-shadow: 0 4px 12px rgba(84, 39, 160, 0.1);
}

.journey-content h3 {
    margin: 0 0 4px;
    color: #5e35b1;
    font-size: 1rem;
}

.journey-content p {
    margin: 0;
}

.journey-content ul {
    margin: 0 0 0 20px;
    padding: 0;
}

.journey-next-content {
    background: #fffff9;
    border: 1px dashed #b1a935;
    border-radius: 8px;
    margin-bottom: 10px;
    padding: 10px 12px;
    transition: all 0.3s ease;
}

.journey-next-content:hover {
    background: #ffffef;
    border-color: #cac13d;
    box-shadow: 0 4px 12px rgba(84, 39, 160, 0.1);
}

.journey-next-content h3 {
    margin: 0 0 4px;
    color: #b1a935;
    font-size: 1rem;
}

.journey-next-content h4 {
    margin: 0 0 4px;
    color: #b1aa51;
    font-size: 1rem;
    font-style: italic;
}

.journey-next-content p {
    margin: 0;
}

.journey-next-content ul {
    margin: 0 0 0 20px;
    padding: 0;
}

.footer {
    padding: 24px 12px;
    color: #ffffff;
    background: #1d1d1d;
    margin-top: auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    flex-wrap: wrap;
}

.footer p {
    margin: 0;
}

.footer .w3-left,
.footer .w3-right {
    float: none !important;
}

.footer br {
    display: none;
}

@media (max-width: 768px) {
    .top-nav {
        flex-direction: column;
        padding: 8px;
        min-height: auto;
    }

    .top-nav .w3-bar-item {
        padding: 10px 8px;
        font-size: 0.95rem;
        flex: 1;
        text-align: center;
        white-space: normal;
    }

    .top-nav .lang-toggle {
        width: 100%;
        justify-content: center;
        margin-left: 0;
        margin-top: 8px;
        padding-top: 8px;
        border-top: 1px solid rgba(255, 255, 255, 0.2);
    }

    .hero {
        padding-top: 88px;
    }
}

@media (max-width: 480px) {
    .top-nav .w3-bar-item {
        padding: 12px 4px;
        font-size: 0.85rem;
    }

    .hero .subtitle {
        font-size: 1.1rem;
    }

    .hero .summary {
        font-size: 0.95rem;
    }

    .hero-actions {
        gap: 8px;
    }

    .hero-actions .w3-button {
        padding: 8px 12px;
        font-size: 0.9rem;
    }

    .journey-timeline {
        padding-left: 18px;
    }

    .journey-item {
        padding-left: 14px;
    }

    .writeup-card.expanded {
        width: 95%;
        height: 90vh;
        padding: 20px;
        max-width: none;
        scrollbar-width: thin;
    }
    
    .writeup-card.expanded::-webkit-scrollbar {
        width: 8px;
    }

    .footer {
        justify-content: center;
        text-align: center;
        gap: 6px;
    }

    .footer .w3-left,
    .footer .w3-right {
        width: 100%;
        text-align: center;
    }
}

@media (max-width: 1024px) {
    .hero {
        padding: 68px 18px 36px;
    }

    .hero .summary {
        max-width: 90%;
    }

    .content {
        padding: 22px 14px 34px;
    }
}

@media (max-width: 600px) {
    .top-nav {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .top-nav .w3-bar-item {
        text-align: center;
        padding: 10px 6px;
        font-size: 0.95rem;
    }

    .hero {
        padding-top: 112px;
    }

    .hero .w3-jumbo {
        font-size: 2.2rem !important;
    }

    .hero .subtitle {
        font-size: 1.05rem;
    }

    .hero .summary {
        font-size: 0.98rem;
    }

    .panel {
        padding: 16px;
    }

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

@media (max-width: 420px) {
    .top-nav {
        grid-template-columns: 1fr;
    }

    .top-nav .lang-toggle {
        margin-top: 2px;
    }

    .hero {
        padding-top: 220px;
    }

    .hero-actions .w3-button {
        width: 100%;
    }
}