* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

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

body {
    font-family: 'Inter', system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, sans-serif;
    line-height: 1.5;
    background: var(--bg);
    color: var(--text);
    transition: background 0.3s ease, color 0.3s ease;
}

body[data-theme="dark"] {
    --bg: #0a0f1c;
    --surface: #111827;
    --surface-2: #1f2937;
    --text: #f3f4f6;
    --muted: #9ca3af;
    --border: rgba(75, 85, 99, 0.5);
    --accent: #10b981;
    --accent-weak: rgba(16, 185, 129, 0.15);
    --accent-glow: rgba(16, 185, 129, 0.3);
    --shadow: 0 20px 35px -12px rgba(0, 0, 0, 0.4);
    --card-hover: rgba(31, 41, 55, 0.8);
}

body[data-theme="light"] {
    --bg: #f9fafb;
    --surface: #ffffff;
    --surface-2: #f3f4f6;
    --text: #111827;
    --muted: #6b7280;
    --border: rgba(209, 213, 219, 0.8);
    --accent: #059669;
    --accent-weak: rgba(5, 150, 105, 0.1);
    --accent-glow: rgba(5, 150, 105, 0.2);
    --shadow: 0 20px 35px -12px rgba(0, 0, 0, 0.1);
    --card-hover: rgba(243, 244, 246, 0.9);
}

a {
    color: inherit;
    text-decoration: none;
    transition: all 0.2s ease;
}

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

.skip-link {
    position: absolute;
    left: 12px;
    top: 12px;
    padding: 12px 16px;
    border-radius: 12px;
    background: var(--surface);
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
    transform: translateY(-140%);
    transition: transform 160ms ease;
    z-index: 100;
    font-weight: 500;
}

.skip-link:focus {
    transform: translateY(0);
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

.container {
    width: min(1200px, 100% - 48px);
    margin-inline: auto;
}

/* Header */
.site-header {
    position: sticky;
    top: 0;
    z-index: 50;
    border-bottom: 1px solid var(--border);
    background: color-mix(in srgb, var(--bg) 92%, transparent);
    backdrop-filter: blur(12px);
    transition: box-shadow 0.2s ease;
}

.site-header[data-elevated="true"] {
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15);
}

.site-header .container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    padding: 16px 0;
}

.brand {
    display: flex;
    align-items: center;
    gap: 14px;
}

.avatar {
    width: 48px;
    height: 48px;
    border-radius: 14px;
    display: grid;
    place-items: center;
    font-size: 22px;
    background: linear-gradient(135deg, var(--accent-weak), color-mix(in srgb, var(--surface) 80%, transparent));
    border: 1px solid var(--border);
    transition: transform 0.2s ease;
    overflow: hidden;
}

.logo {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
}

.avatar:hover {
    transform: scale(1.05);
}

.brand-name {
    font-weight: 700;
    font-size: 1.1rem;
}

.brand-role {
    font-size: 0.8rem;
    color: var(--muted);
}

.nav {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.nav-link {
    padding: 8px 14px;
    border-radius: 10px;
    color: var(--muted);
    white-space: nowrap;
    font-weight: 500;
    font-size: 0.9rem;
    transition: all 0.2s ease;
}

.nav-link i {
    margin-right: 6px;
    font-size: 0.85rem;
}

.nav-link:hover,
.nav-link:focus-visible {
    color: var(--text);
    background: var(--accent-weak);
    text-decoration: none;
    transform: translateY(-1px);
}

.icon-button {
    display: none;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text);
    border-radius: 12px;
    height: 44px;
    width: 48px;
    cursor: pointer;
    font-size: 1.2rem;
    transition: all 0.2s ease;
}

.icon-button:hover {
    background: var(--accent-weak);
    border-color: var(--accent);
}

/* Buttons */
.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    border-radius: 12px;
    border: 1px solid transparent;
    background: var(--accent);
    color: white;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 0.9rem;
}

.button:hover {
    transform: translateY(-2px);
    filter: brightness(1.05);
    box-shadow: 0 4px 12px var(--accent-glow);
}

.button-secondary {
    background: var(--surface);
    border-color: var(--border);
    color: var(--text);
}

.button-secondary:hover {
    background: var(--accent-weak);
    border-color: var(--accent);
    color: var(--text);
}

.button-ghost {
    background: transparent;
    border-color: var(--border);
    color: var(--muted);
}

.button-ghost:hover {
    border-color: var(--accent);
    color: var(--text);
    background: var(--accent-weak);
}

/* Hero Section */
.hero {
    padding: 64px 0 32px;
}

.hero-grid {
    display: grid;
    grid-template-columns: 1.3fr 0.9fr;
    gap: 32px;
    align-items: start;
}

.eyebrow {
    color: var(--accent);
    margin: 0 0 12px;
    font-weight: 500;
    font-size: 0.9rem;
    letter-spacing: 0.5px;
}

.headline {
    margin: 0;
    font-size: clamp(32px, 4vw, 52px);
    line-height: 1.2;
    letter-spacing: -0.02em;
    font-weight: 800;
}

.gradient-text {
    background: linear-gradient(135deg, var(--accent) 0%, #34d399 100%);
    background-clip: text;
    -webkit-background-clip: text;
    color: transparent;
}

.subhead {
    margin: 20px 0 24px;
    color: var(--muted);
    max-width: 56ch;
    font-size: 1.05rem;
    border-left: 3px solid var(--accent);
    padding-left: 18px;
}

.cta-row {
    display: flex;
    flex-wrap: wrap;
    gap: 14px;
    margin: 20px 0 28px;
}

.highlights {
    list-style: none;
    padding: 0;
    margin: 0;
    display: grid;
    gap: 12px;
}

.highlight {
    padding: 14px 18px;
    border: 1px solid var(--border);
    border-radius: 16px;
    background: color-mix(in srgb, var(--surface) 60%, transparent);
    transition: all 0.2s ease;
    font-weight: 500;
}

.highlight i {
    margin-right: 10px;
    color: var(--accent);
    width: 22px;
}

.highlight:hover {
    transform: translateX(6px);
    border-color: var(--accent);
    background: var(--accent-weak);
}

/* Hero Card */
.hero-card {
    border: 1px solid var(--border);
    border-radius: 24px;
    background: linear-gradient(135deg, var(--surface), color-mix(in srgb, var(--surface-2) 70%, transparent));
    box-shadow: var(--shadow);
    padding: 24px;
    transition: transform 0.3s ease;
}

.hero-card:hover {
    transform: translateY(-4px);
}

.profile-photo-wrap {
    border: 1px solid var(--border);
    border-radius: 20px;
    background: linear-gradient(145deg, var(--surface-2), var(--surface));
    padding: 12px;
    margin-bottom: 20px;
}

.profile-photo {
    width: 100%;
    height: auto;
    aspect-ratio: 1 / 1;
    object-fit: cover;
    border-radius: 16px;
    border: 1px solid var(--border);
    display: block;
    transition: transform 0.3s ease, filter 0.3s ease;
}

.profile-photo-wrap:hover .profile-photo {
    transform: scale(1.02);
    filter: brightness(1.02);
}

.profile-photo-hint {
    margin-top: 12px;
    color: var(--muted);
    font-size: 12px;
    display: none;
    text-align: center;
}

.profile-photo-wrap.no-photo .profile-photo-hint {
    display: block;
}

.hero-card-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
    margin-bottom: 14px;
}

.hero-card-row:last-child {
    margin-bottom: 0;
}

.stat {
    padding: 14px;
    border-radius: 16px;
    border: 1px solid var(--border);
    background: color-mix(in srgb, var(--surface) 85%, transparent);
    transition: all 0.2s ease;
}

.stat:hover {
    border-color: var(--accent);
    background: var(--accent-weak);
}

.stat-label {
    color: var(--muted);
    font-size: 0.75rem;
    margin-bottom: 6px;
    letter-spacing: 0.3px;
}

.stat-label i {
    margin-right: 4px;
    font-size: 0.7rem;
}

.stat-value {
    font-weight: 700;
    font-size: 0.95rem;
}

.status-dot {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--accent);
    margin-right: 8px;
    vertical-align: middle;
    box-shadow: 0 0 0 0 var(--accent-glow);
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { box-shadow: 0 0 0 0 var(--accent-glow); }
    50% { box-shadow: 0 0 0 6px transparent; }
}

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

.section-title {
    margin: 0 0 12px;
    font-size: 28px;
    font-weight: 700;
    letter-spacing: -0.01em;
    display: flex;
    align-items: center;
    gap: 12px;
}

.section-title i {
    color: var(--accent);
    font-size: 26px;
}

.section-lead {
    margin: 0;
    color: var(--muted);
    max-width: 72ch;
    font-size: 1.05rem;
}

.section-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 24px;
    flex-wrap: wrap;
}

.section-kicker {
    margin: 0;
    color: var(--muted);
    font-size: 0.9rem;
    font-weight: 500;
}

.prose {
    max-width: 80ch;
    color: var(--muted);
    font-size: 1rem;
}

.prose p {
    margin: 0 0 16px;
    line-height: 1.6;
}

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

/* Grid System */
.grid {
    margin-top: 20px;
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    gap: 20px;
}

.grid > .card {
    grid-column: span 6;
}

.grid > .card.card-wide {
    grid-column: span 12;
}

.grid.grid-projects > .card {
    grid-column: span 4;
}

/* Cards */
.card {
    border: 1px solid var(--border);
    border-radius: 20px;
    background: var(--surface);
    padding: 24px;
    transition: all 0.3s cubic-bezier(0.2, 0, 0, 1);
}

.card:hover {
    transform: translateY(-6px);
    box-shadow: var(--shadow);
    border-color: var(--accent);
}

.card-title {
    margin: 0 0 10px;
    font-size: 1.2rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.card-body {
    margin: 0;
    color: var(--muted);
    line-height: 1.5;
}

.card-project {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.card-top {
    display: grid;
    gap: 8px;
}

.muted {
    color: var(--muted);
    font-weight: 500;
    font-size: 0.85rem;
}

.timeline-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 14px;
    flex-wrap: wrap;
}

.pill {
    border: 1px solid var(--border);
    background: color-mix(in srgb, var(--surface-2) 70%, transparent);
    color: var(--text);
    border-radius: 40px;
    padding: 4px 12px;
    font-size: 0.75rem;
    white-space: nowrap;
    font-weight: 500;
    transition: all 0.2s ease;
}

.pill:hover {
    border-color: var(--accent);
    background: var(--accent-weak);
}

.list {
    margin: 0;
    padding-left: 20px;
    color: var(--muted);
    line-height: 1.6;
}

.list li {
    margin-bottom: 6px;
}

.tags {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 4px;
}

.tag {
    border: 1px solid var(--border);
    border-radius: 40px;
    padding: 4px 12px;
    font-size: 0.75rem;
    color: var(--text);
    background: color-mix(in srgb, var(--surface-2) 70%, transparent);
    transition: all 0.2s ease;
    font-weight: 500;
}

.tag i {
    margin-right: 4px;
    font-size: 0.7rem;
}

.tag:hover {
    border-color: var(--accent);
    background: var(--accent-weak);
    transform: translateY(-1px);
}

.card-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 12px;
}

/* Contact Section */
.contact-card {
    margin-top: 24px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    border: 1px solid var(--border);
    border-radius: 24px;
    padding: 28px;
    background: var(--surface);
    transition: all 0.3s ease;
}

.contact-card:hover {
    border-color: var(--accent);
    box-shadow: var(--shadow);
}

.contact-label {
    color: var(--muted);
    font-size: 0.75rem;
    margin-bottom: 8px;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    font-weight: 600;
}

.contact-label i {
    margin-right: 6px;
}

.contact-spacer {
    height: 20px;
}

.contact-value {
    font-weight: 700;
    font-size: 1rem;
    transition: color 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.contact-value:hover {
    color: var(--accent);
    text-decoration: none;
}

.contact-links {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.link {
    padding: 8px 16px;
    border-radius: 12px;
    border: 1px solid var(--border);
    background: color-mix(in srgb, var(--surface-2) 60%, transparent);
    transition: all 0.2s ease;
    font-weight: 500;
}

.link:hover {
    text-decoration: none;
    border-color: var(--accent);
    background: var(--accent-weak);
    transform: translateY(-2px);
}

/* Footer */
.footer {
    border-top: 1px solid var(--border);
    padding: 24px 0;
    color: var(--muted);
    margin-top: 20px;
}

.footer-row {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    align-items: center;
    justify-content: space-between;
}

.footer-note {
    font-size: 0.85rem;
}

/* Language Chart */
.lang-chart {
    margin-top: 20px;
    border: 1px solid var(--border);
    border-radius: 24px;
    background: var(--surface);
    padding: 24px;
    display: grid;
    gap: 20px;
}

.lang-row {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
}

.lang-meta {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
}

.lang-name {
    font-weight: 700;
    font-size: 1rem;
}

.lang-name i {
    margin-right: 8px;
    color: var(--accent);
}

.lang-level {
    color: var(--muted);
    font-size: 0.8rem;
    font-weight: 500;
}

.lang-bar {
    height: 10px;
    border-radius: 20px;
    border: 1px solid var(--border);
    background: color-mix(in srgb, var(--surface-2) 70%, transparent);
    overflow: hidden;
}

.lang-fill {
    display: block;
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, var(--accent), #34d399);
    transition: width 0.8s cubic-bezier(0.2, 0.9, 0.4, 1.1);
    border-radius: 20px;
}

/* Back to Top */
.back-to-top {
    position: fixed;
    right: 24px;
    bottom: 24px;
    width: 46px;
    height: 46px;
    border-radius: 16px;
    border: 1px solid var(--border);
    background: color-mix(in srgb, var(--surface) 88%, transparent);
    color: var(--text);
    box-shadow: var(--shadow);
    display: grid;
    place-items: center;
    cursor: pointer;
    opacity: 0;
    transform: translateY(12px);
    pointer-events: none;
    transition: opacity 0.18s ease, transform 0.18s ease, border-color 0.18s ease;
    z-index: 900;
    backdrop-filter: blur(10px);
}

.back-to-top i {
    font-size: 16px;
}

.back-to-top.is-visible {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}

.back-to-top:hover {
    border-color: color-mix(in srgb, var(--accent) 55%, var(--border));
}

.back-to-top:focus-visible {
    outline: 3px solid color-mix(in srgb, var(--accent) 35%, transparent);
    outline-offset: 3px;
}

/* Toast Message */
.toast-message {
    position: fixed;
    bottom: 28px;
    left: 50%;
    transform: translateX(-50%) translateY(120px);
    background: var(--surface);
    border: 1px solid var(--accent);
    color: var(--text);
    padding: 12px 24px;
    border-radius: 60px;
    font-size: 0.9rem;
    font-weight: 500;
    box-shadow: var(--shadow);
    z-index: 1000;
    opacity: 0;
    transition: transform 0.3s ease, opacity 0.3s ease;
    pointer-events: none;
    backdrop-filter: blur(12px);
    white-space: nowrap;
}

.toast-message.show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

/* Responsive */
@media (max-width: 900px) {
    .hero-grid {
        grid-template-columns: 1fr;
    }
    
    .grid.grid-projects > .card {
        grid-column: span 6;
    }
    
    .section {
        padding: 48px 0;
    }
}

@media (max-width: 720px) {
    .icon-button {
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }
    
    .nav {
        position: absolute;
        right: 20px;
        top: 70px;
        width: min(320px, calc(100% - 40px));
        display: none;
        flex-direction: column;
        align-items: stretch;
        gap: 6px;
        padding: 16px;
        border: 1px solid var(--border);
        border-radius: 20px;
        background: var(--surface);
        box-shadow: var(--shadow);
        backdrop-filter: blur(12px);
    }
    
    .nav.is-open {
        display: flex;
        animation: fadeSlideDown 0.2s ease;
    }
    
    @keyframes fadeSlideDown {
        from {
            opacity: 0;
            transform: translateY(-12px);
        }
        to {
            opacity: 1;
            transform: translateY(0);
        }
    }
    
    .nav-link {
        padding: 12px 16px;
    }
    
    .grid > .card,
    .grid.grid-projects > .card {
        grid-column: span 12;
    }
    
    .contact-card {
        grid-template-columns: 1fr;
    }
    
    .toast-message {
        white-space: normal;
        text-align: center;
        max-width: 90%;
        font-size: 0.85rem;
    }
    
    .section-title {
        font-size: 24px;
    }
    
    .hero {
        padding: 40px 0 20px;
    }
}

@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
    }
    
    *,
    *::before,
    *::after {
        transition-duration: 0.001ms !important;
        animation-duration: 0.001ms !important;
        scroll-behavior: auto !important;
    }
}