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

/* ===== Theme Variables ===== */
:root {
    --bg: #0a0a0a;
    --bg-alt: #111111;
    --text: #e0e0e0;
    --text-muted: #888888;
    --accent: #00d4aa;
    --accent-hover: #00f0c0;
    --card-bg: #161616;
    --border: #222222;
    --nav-bg: rgba(10, 10, 10, 0.9);
    --mobile-bg: rgba(10, 10, 10, 0.97);
    --nav-height: 64px;
    --shadow: 0 2px 12px rgba(0, 0, 0, 0.3);
}

[data-theme="light"] {
    --bg: #f8f9fa;
    --bg-alt: #ffffff;
    --text: #1a1a2e;
    --text-muted: #5a5a7a;
    --accent: #009b7d;
    --accent-hover: #00b894;
    --card-bg: #ffffff;
    --border: #e0e0e8;
    --nav-bg: rgba(248, 249, 250, 0.92);
    --mobile-bg: rgba(248, 249, 250, 0.97);
    --shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
}

html {
    scroll-behavior: smooth;
    scroll-padding-top: var(--nav-height);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    transition: background 0.3s ease, color 0.3s ease;
}

a {
    color: var(--accent);
    text-decoration: none;
    transition: color 0.2s;
}

a:hover {
    color: var(--accent-hover);
}

.container {
    max-width: 900px;
    margin: 0 auto;
    padding: 0 24px;
}

/* ===== Nav ===== */
#nav {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--nav-height);
    background: var(--nav-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
    z-index: 100;
    transition: background 0.3s ease, border-color 0.3s ease;
}

.nav-inner {
    max-width: 900px;
    margin: 0 auto;
    padding: 0 24px;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.nav-logo {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text);
    letter-spacing: -0.02em;
}

.nav-logo:hover {
    color: var(--accent);
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 28px;
}

.nav-links a {
    color: var(--text-muted);
    font-size: 0.875rem;
    transition: color 0.2s;
}

.nav-links a:hover,
.nav-links a.active {
    color: var(--text);
}

.nav-controls {
    display: flex;
    align-items: center;
    gap: 8px;
}

.lang-switch {
    display: flex;
    align-items: center;
    gap: 0;
    border: 1px solid var(--border);
    border-radius: 4px;
    overflow: hidden;
    font-family: inherit;
}

.lang-option {
    background: transparent;
    border: none;
    color: var(--text-muted);
    padding: 4px 10px;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    font-family: inherit;
}

.lang-option.active {
    background: var(--accent);
    color: #fff;
}

.lang-option:hover:not(.active) {
    color: var(--text);
}

.lang-separator {
    color: var(--border);
    font-size: 0.75rem;
    user-select: none;
}

/* Theme toggle button */
.theme-btn {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-muted);
    width: 36px;
    height: 36px;
    border-radius: 4px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    font-size: 1rem;
    line-height: 1;
}

.theme-btn:hover {
    border-color: var(--accent);
    color: var(--accent);
}

.theme-btn .icon-sun,
.theme-btn .icon-moon {
    display: none;
}

[data-theme="light"] .theme-btn .icon-moon {
    display: block;
}

[data-theme="light"] .theme-btn .icon-sun {
    display: none;
}

:root .theme-btn .icon-sun {
    display: block;
}

:root .theme-btn .icon-moon {
    display: none;
}

[data-theme="light"] .theme-btn .icon-sun {
    display: none;
}

[data-theme="light"] .theme-btn .icon-moon {
    display: block;
}

/* Mobile menu button */
.menu-btn {
    display: none;
    flex-direction: column;
    gap: 5px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
}

.menu-btn span {
    display: block;
    width: 24px;
    height: 2px;
    background: var(--text);
    transition: all 0.3s;
}

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

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

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

/* Mobile menu */
.mobile-menu {
    display: none;
    position: fixed;
    top: var(--nav-height);
    left: 0;
    right: 0;
    background: var(--mobile-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    padding: 24px;
    flex-direction: column;
    gap: 20px;
    z-index: 99;
    border-bottom: 1px solid var(--border);
    transition: background 0.3s ease;
}

.mobile-menu.active {
    display: flex;
}

.mobile-menu a {
    color: var(--text-muted);
    font-size: 1.1rem;
}

.mobile-menu a.active {
    color: var(--text);
}

.mobile-controls {
    display: flex;
    align-items: center;
    gap: 12px;
    padding-top: 8px;
    border-top: 1px solid var(--border);
}

/* ===== Hero ===== */
.hero {
    min-height: 100vh;
    display: flex;
    align-items: center;
    padding-top: var(--nav-height);
}

.hero-greeting {
    color: var(--accent);
    font-size: 1rem;
    margin-bottom: 12px;
}

.hero-name {
    font-size: clamp(2.5rem, 7vw, 4.5rem);
    font-weight: 800;
    letter-spacing: -0.03em;
    line-height: 1.1;
    margin-bottom: 8px;
}

.hero-title {
    font-size: clamp(1.1rem, 3vw, 1.5rem);
    font-weight: 400;
    color: var(--text-muted);
    margin-bottom: 24px;
}

.hero-sub {
    font-size: 1.05rem;
    color: var(--text-muted);
    max-width: 520px;
    margin-bottom: 40px;
    line-height: 1.7;
}

.hero-cta {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
}

/* ===== Buttons ===== */
.btn {
    display: inline-block;
    padding: 12px 28px;
    border-radius: 6px;
    font-size: 0.95rem;
    font-weight: 600;
    transition: all 0.2s;
    cursor: pointer;
}

.btn-primary {
    background: var(--accent);
    color: #fff;
}

[data-theme="light"] .btn-primary {
    color: #fff;
}

.btn-primary:hover {
    background: var(--accent-hover);
    color: #fff;
}

.btn-secondary {
    border: 1px solid var(--border);
    color: var(--text);
}

.btn-secondary:hover {
    border-color: var(--accent);
    color: var(--accent);
}

/* ===== Sections ===== */
.section {
    padding: 100px 0;
}

.section-alt {
    background: var(--bg-alt);
    transition: background 0.3s ease;
}

.section-title {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 48px;
    letter-spacing: -0.02em;
}

.section-title::after {
    content: "";
    display: block;
    width: 48px;
    height: 3px;
    background: var(--accent);
    margin-top: 12px;
    border-radius: 2px;
}

/* ===== About ===== */
.about-content p {
    color: var(--text-muted);
    font-size: 1.05rem;
    line-height: 1.8;
    margin-bottom: 16px;
    max-width: 640px;
}

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

.skill-card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 28px;
    transition: border-color 0.3s, background 0.3s, box-shadow 0.3s;
}

.skill-card:hover {
    border-color: var(--accent);
}

[data-theme="light"] .skill-card {
    box-shadow: var(--shadow);
}

.skill-card h3 {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 8px;
}

.skill-card p {
    color: var(--text-muted);
    font-size: 0.9rem;
    line-height: 1.6;
}

/* ===== Timeline ===== */
.timeline {
    position: relative;
    padding-left: 32px;
}

.timeline::before {
    content: "";
    position: absolute;
    left: 0;
    top: 8px;
    bottom: 8px;
    width: 2px;
    background: var(--border);
}

.timeline-item {
    position: relative;
    margin-bottom: 48px;
}

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

.timeline-item::before {
    content: "";
    position: absolute;
    left: -36px;
    top: 8px;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--accent);
    border: 2px solid var(--bg);
}

.timeline-date {
    font-size: 0.85rem;
    color: var(--accent);
    font-weight: 600;
    margin-bottom: 8px;
}

.timeline-content h3 {
    font-size: 1.2rem;
    font-weight: 700;
    margin-bottom: 4px;
}

.timeline-tag {
    font-size: 0.7rem;
    background: var(--accent);
    color: #fff;
    padding: 2px 8px;
    border-radius: 3px;
    font-weight: 600;
    vertical-align: middle;
}

.timeline-role {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-bottom: 8px;
}

.timeline-content > p:last-of-type {
    color: var(--text-muted);
    font-size: 0.9rem;
    line-height: 1.7;
    margin-bottom: 12px;
}

.timeline-stack {
    font-size: 0.8rem;
    color: var(--accent);
    font-weight: 500;
}

/* ===== Contact ===== */
.contact-content {
    text-align: center;
}

.contact-content > p {
    color: var(--text-muted);
    font-size: 1.1rem;
    margin-bottom: 32px;
}

.contact-links {
    display: flex;
    justify-content: center;
    gap: 16px;
    flex-wrap: wrap;
}

/* ===== Footer ===== */
.footer {
    padding: 32px 0;
    border-top: 1px solid var(--border);
    text-align: center;
    transition: border-color 0.3s ease;
}

.footer p {
    color: var(--text-muted);
    font-size: 0.85rem;
}

.footer-links {
    display: flex;
    justify-content: center;
    gap: 24px;
    margin-top: 12px;
}

.footer-links a {
    color: var(--text-muted);
    font-size: 0.85rem;
}

.footer-links a:hover {
    color: var(--accent);
}

/* ===== Animations ===== */
.fade-in {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.6s ease, transform 0.6s ease;
}

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

/* ===== Services Overview Page ===== */
.page-hero {
    padding-top: calc(var(--nav-height) + 60px);
    padding-bottom: 60px;
}

.page-hero h1 {
    font-size: clamp(2rem, 5vw, 3rem);
    font-weight: 800;
    letter-spacing: -0.03em;
    line-height: 1.1;
    margin-bottom: 16px;
}

.page-hero p {
    font-size: 1.1rem;
    color: var(--text-muted);
    max-width: 600px;
    line-height: 1.7;
}

/* Services Grid */
.services-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 24px;
}

.service-card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 32px;
    transition: border-color 0.3s, transform 0.2s, box-shadow 0.3s;
    display: flex;
    flex-direction: column;
}

.service-card:hover {
    border-color: var(--accent);
    transform: translateY(-2px);
}

[data-theme="light"] .service-card {
    box-shadow: var(--shadow);
}

[data-theme="light"] .service-card:hover {
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.12);
}

.service-card-icon {
    font-size: 1.5rem;
    margin-bottom: 16px;
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    transition: background 0.3s, border-color 0.3s;
    color: var(--accent);
}

[data-theme="light"] .service-card-icon {
    background: var(--bg-alt);
}

.service-card h3 {
    font-size: 1.15rem;
    font-weight: 700;
    margin-bottom: 8px;
}

.service-card p {
    color: var(--text-muted);
    font-size: 0.9rem;
    line-height: 1.6;
    margin-bottom: 16px;
    flex-grow: 1;
}

.service-card .card-link {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--accent);
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.service-card .card-link::after {
    content: "\2192";
    transition: transform 0.2s;
}

.service-card:hover .card-link::after {
    transform: translateX(4px);
}

/* ===== Service Detail Pages ===== */
.service-detail {
    padding-top: calc(var(--nav-height) + 60px);
    padding-bottom: 60px;
}

.service-detail .breadcrumb {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 32px;
}

.service-detail .breadcrumb a {
    color: var(--text-muted);
}

.service-detail .breadcrumb a:hover {
    color: var(--accent);
}

.service-detail .breadcrumb .separator {
    margin: 0 8px;
    color: var(--border);
}

.service-detail h1 {
    font-size: clamp(2rem, 5vw, 2.8rem);
    font-weight: 800;
    letter-spacing: -0.03em;
    line-height: 1.15;
    margin-bottom: 16px;
}

.service-detail .service-intro {
    font-size: 1.1rem;
    color: var(--text-muted);
    max-width: 640px;
    line-height: 1.7;
    margin-bottom: 48px;
}

/* Tech badges */
.tech-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 48px;
}

.tech-badge {
    display: inline-block;
    padding: 6px 14px;
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text);
    transition: border-color 0.2s, background 0.3s;
}

.tech-badge:hover {
    border-color: var(--accent);
}

/* Content blocks for service details */
.content-block {
    margin-bottom: 48px;
}

.content-block h2 {
    font-size: 1.4rem;
    font-weight: 700;
    margin-bottom: 20px;
    letter-spacing: -0.01em;
}

.content-block h2::after {
    content: "";
    display: block;
    width: 32px;
    height: 2px;
    background: var(--accent);
    margin-top: 8px;
    border-radius: 2px;
}

.content-block p {
    color: var(--text-muted);
    font-size: 0.95rem;
    line-height: 1.8;
    margin-bottom: 12px;
    max-width: 640px;
}

.content-block ul {
    list-style: none;
    padding: 0;
}

.content-block ul li {
    position: relative;
    padding-left: 20px;
    margin-bottom: 10px;
    color: var(--text-muted);
    font-size: 0.95rem;
    line-height: 1.6;
}

.content-block ul li::before {
    content: "";
    position: absolute;
    left: 0;
    top: 10px;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--accent);
}

/* Timeline block for service pages */
.project-timeline {
    display: grid;
    grid-template-columns: 1fr;
    gap: 16px;
}

.timeline-phase {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 20px 24px;
    display: flex;
    align-items: flex-start;
    gap: 16px;
    transition: border-color 0.3s, background 0.3s;
}

[data-theme="light"] .timeline-phase {
    box-shadow: var(--shadow);
}

.timeline-phase:hover {
    border-color: var(--accent);
}

.phase-number {
    flex-shrink: 0;
    width: 32px;
    height: 32px;
    background: var(--accent);
    color: #fff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    font-weight: 700;
}

.phase-content h4 {
    font-size: 0.95rem;
    font-weight: 600;
    margin-bottom: 4px;
}

.phase-content p {
    color: var(--text-muted);
    font-size: 0.85rem;
    line-height: 1.5;
    margin-bottom: 0;
}

.phase-duration {
    font-size: 0.75rem;
    color: var(--accent);
    font-weight: 600;
    margin-top: 4px;
}

/* Experience reference card */
.experience-ref {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 24px;
    transition: border-color 0.3s, background 0.3s;
}

[data-theme="light"] .experience-ref {
    box-shadow: var(--shadow);
}

.experience-ref h4 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 6px;
}

.experience-ref p {
    color: var(--text-muted);
    font-size: 0.9rem;
    line-height: 1.6;
    margin-bottom: 0;
}

.experience-ref + .experience-ref {
    margin-top: 12px;
}

/* CTA block */
.cta-block {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 40px;
    text-align: center;
    margin-top: 64px;
    transition: background 0.3s, border-color 0.3s;
}

[data-theme="light"] .cta-block {
    box-shadow: var(--shadow);
}

.cta-block h3 {
    font-size: 1.3rem;
    font-weight: 700;
    margin-bottom: 12px;
}

.cta-block p {
    color: var(--text-muted);
    font-size: 0.95rem;
    margin-bottom: 24px;
    max-width: 480px;
    margin-left: auto;
    margin-right: auto;
}

.cta-block .cta-buttons {
    display: flex;
    gap: 12px;
    justify-content: center;
    flex-wrap: wrap;
}

/* ===== Responsive ===== */
@media (max-width: 768px) {
    .nav-links {
        display: none;
    }

    .menu-btn {
        display: flex;
    }

    .skills-grid,
    .services-grid {
        grid-template-columns: 1fr;
    }

    .section {
        padding: 72px 0;
    }

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

    .page-hero {
        padding-top: calc(var(--nav-height) + 40px);
        padding-bottom: 40px;
    }

    .service-detail {
        padding-top: calc(var(--nav-height) + 40px);
    }
}

@media (max-width: 480px) {
    .hero-cta {
        flex-direction: column;
    }

    .hero-cta .btn {
        text-align: center;
    }

    .contact-links {
        flex-direction: column;
        align-items: center;
    }

    .cta-block .cta-buttons {
        flex-direction: column;
        align-items: center;
    }

    .timeline-phase {
        flex-direction: column;
        gap: 8px;
    }
}
