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

:root {
    --primary-color: #0ea5e9;
    --accent-color: #06b6d4;
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-tertiary: #94a3b8;
    --bg-primary: #f8fafc;
    --bg-secondary: #ffffff;
    --bg-tertiary: #f1f5f9;
    --border-color: #e2e8f0;
    --border-light: #f1f5f9;
    --font-sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}

@media (prefers-color-scheme: dark) {
    :root {
        --text-primary: #f1f5f9;
        --text-secondary: #cbd5e1;
        --text-tertiary: #94a3b8;
        --bg-primary: #0f172a;
        --bg-secondary: #1e293b;
        --bg-tertiary: #334155;
        --border-color: #334155;
        --border-light: #1e293b;
    }
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-sans);
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
}

.wrapper {
    max-width: 820px;
    margin: 0 auto;
    padding: 3rem 1.5rem;
}

@media (min-width: 768px) {
    .wrapper {
        padding: 5rem 2rem;
    }
}

.header {
    text-align: center;
    margin-bottom: 2.5rem;
}

@media (min-width: 768px) {
    .header {
        margin-bottom: 3rem;
    }
}

h1 {
    font-size: 1.75rem;
    font-weight: 700;
    letter-spacing: -1px;
    margin-bottom: 0.5rem;
    line-height: 1.2;
    font-family: var(--font-sans);
}

@media (min-width: 768px) {
    h1 {
        font-size: 2.5rem;
    }
}

.subtitle {
    font-size: 0.95rem;
    color: var(--text-secondary);
    font-weight: 400;
    letter-spacing: 0.8px;
    text-transform: uppercase;
    margin-bottom: 1rem;
}

.location {
    font-size: 0.9rem;
    color: var(--text-tertiary);
}

.section {
    margin-bottom: 3.5rem;
}

@media (min-width: 768px) {
    .section {
        margin-bottom: 5rem;
    }
}

.section-title {
    font-size: 1rem;
    font-weight: 700;
    letter-spacing: 1px;
    text-transform: uppercase;
    color: var(--text-primary);
    margin-bottom: 1.5rem;
    padding-bottom: 0.75rem;
    border-bottom: 2px solid var(--primary-color);
    font-family: var(--font-sans);
}

@media (min-width: 768px) {
    .section-title {
        font-size: 1.1rem;
        margin-bottom: 2rem;
    }
}

.paragraph {
    font-size: 0.95rem;
    line-height: 1.8;
    margin-bottom: 1rem;
    color: var(--text-primary);
    text-align: left;
}

@media (min-width: 768px) {
    .paragraph {
        font-size: 1rem;
        margin-bottom: 1.2rem;
    }
}

.paragraph-light {
    color: var(--text-secondary);
    margin-bottom: 0.8rem;
}

.interests-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.5rem;
    margin: 1.5rem 0;
}

@media (min-width: 640px) {
    .interests-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 2rem;
    }
}

@media (min-width: 768px) {
    .interests-grid {
        gap: 2.5rem;
        margin: 2rem 0;
    }
}

.interest {
    padding-bottom: 1rem;
}

@media (min-width: 768px) {
    .interest {
        padding-bottom: 1.5rem;
    }
}

.interest-title {
    font-size: 0.9rem;
    font-weight: 500;
    margin-bottom: 0.4rem;
    color: var(--text-primary);
}

@media (min-width: 768px) {
    .interest-title {
        font-size: 0.95rem;
        margin-bottom: 0.5rem;
    }
}

.interest-desc {
    font-size: 0.85rem;
    color: var(--text-secondary);
    line-height: 1.6;
}

@media (min-width: 768px) {
    .interest-desc {
        font-size: 0.9rem;
    }
}

.projects-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.5rem;
    margin: 1.5rem 0;
}

@media (min-width: 640px) {
    .projects-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 1.5rem;
    }
}

@media (min-width: 768px) {
    .projects-grid {
        gap: 2rem;
        margin: 2rem 0;
    }
}

.project {
    padding: 1.25rem;
    background: var(--bg-secondary);
    border-radius: 8px;
    border: 1px solid var(--border-light);
    transition: border-color 0.3s ease;
}

@media (min-width: 768px) {
    .project {
        padding: 1.5rem;
        border-radius: 12px;
    }
}

.project:hover {
    border-color: var(--primary-color);
    background: linear-gradient(135deg, rgba(14, 165, 233, 0.03), rgba(6, 182, 212, 0.03));
}

.project-title {
    font-size: 0.9rem;
    font-weight: 500;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

@media (min-width: 768px) {
    .project-title {
        font-size: 0.95rem;
    }
}

.project-desc {
    font-size: 0.8rem;
    color: var(--text-secondary);
    line-height: 1.6;
}

@media (min-width: 768px) {
    .project-desc {
        font-size: 0.85rem;
    }
}

.stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
    margin: 1.5rem 0;
}

@media (min-width: 768px) {
    .stats {
        gap: 2rem;
        margin: 2rem 0;
    }
}

.stat-item {
    padding: 1.25rem;
    background: var(--bg-secondary);
    border-radius: 8px;
    border: 1px solid var(--border-light);
    text-align: center;
}

@media (min-width: 768px) {
    .stat-item {
        padding: 1.5rem;
        border-radius: 12px;
    }
}

.stat-number {
    font-size: 1.5rem;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 0.3rem;
}

@media (min-width: 768px) {
    .stat-number {
        font-size: 1.8rem;
        margin-bottom: 0.5rem;
    }
}

.stat-label {
    font-size: 0.75rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

@media (min-width: 768px) {
    .stat-label {
        font-size: 0.85rem;
    }
}

.highlight-box {
    padding: 1.5rem;
    background: linear-gradient(135deg, rgba(14, 165, 233, 0.05), rgba(6, 182, 212, 0.05));
    border-radius: 8px;
    border-left: 3px solid var(--primary-color);
    margin: 1.5rem 0;
}

@media (min-width: 768px) {
    .highlight-box {
        padding: 2rem;
        border-radius: 12px;
        margin: 2rem 0;
    }
}

.highlight-text {
    font-size: 0.9rem;
    line-height: 1.8;
    color: var(--text-primary);
    font-style: italic;
}

@media (min-width: 768px) {
    .highlight-text {
        font-size: 0.95rem;
    }
}

.tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin: 1.5rem 0;
}

@media (min-width: 768px) {
    .tags {
        gap: 0.75rem;
        margin: 1.5rem 0;
    }
}

.tag {
    display: inline-block;
    padding: 0.35rem 0.75rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border-light);
    border-radius: 3px;
    font-size: 0.75rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

@media (min-width: 768px) {
    .tag {
        padding: 0.4rem 0.9rem;
        font-size: 0.8rem;
    }
}

.contact-links {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
    margin: 1.5rem 0;
}

@media (min-width: 640px) {
    .contact-links {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (min-width: 768px) {
    .contact-links {
        grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
        gap: 1rem;
        margin: 2rem 0;
    }
}

.contact-link {
    padding: 0.9rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border-light);
    border-radius: 8px;
    text-decoration: none;
    color: var(--text-primary);
    text-align: center;
    font-size: 0.85rem;
    font-weight: 500;
    transition: all 0.3s ease;
}

@media (min-width: 768px) {
    .contact-link {
        padding: 1rem;
        border-radius: 12px;
        font-size: 0.9rem;
    }
}

.contact-link:hover,
.contact-link:focus {
    border-color: var(--primary-color);
    color: var(--primary-color);
    background: linear-gradient(135deg, rgba(14, 165, 233, 0.05), rgba(6, 182, 212, 0.05));
    outline: none;
}

.contact-link:active {
    transform: scale(0.98);
}

.footer {
    text-align: center;
    margin-top: 3rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border-color);
    font-size: 0.8rem;
    color: var(--text-tertiary);
}

@media (min-width: 768px) {
    .footer {
        margin-top: 4rem;
        padding-top: 2rem;
        font-size: 0.85rem;
    }
}

.footer p {
    margin-bottom: 0.3rem;
}

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

.gallery-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 2rem;
    margin: 2rem 0;
}

@media (min-width: 640px) {
    .gallery-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 1.5rem;
    }
}

@media (min-width: 1024px) {
    .gallery-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 2rem;
    }
}

.gallery-item {
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid var(--border-color);
    transition: all 0.3s ease;
    background: var(--bg-secondary);
}

.gallery-item:hover {
    border-color: var(--primary-color);
    box-shadow: 0 10px 30px rgba(14, 165, 233, 0.15);
    transform: translateY(-2px);
}

.gallery-item iframe {
    display: block;
    width: 100% !important;
}

/* YouTube Section */
.youtube-container {
    margin: 2rem 0;
}

.youtube-link {
    display: flex;
    align-items: center;
    gap: 2rem;
    padding: 2rem;
    background: linear-gradient(135deg, rgba(229, 45, 41, 0.05), rgba(255, 0, 0, 0.05));
    border: 1px solid var(--border-color);
    border-radius: 12px;
    text-decoration: none;
    color: inherit;
    transition: all 0.3s ease;
}

.youtube-link:hover {
    border-color: #e52d29;
    box-shadow: 0 10px 30px rgba(229, 45, 41, 0.15);
    transform: translateY(-2px);
}

.youtube-icon {
    width: 80px;
    height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #e52d29;
    border-radius: 12px;
    color: white;
    flex-shrink: 0;
}

.youtube-icon svg {
    width: 45px;
    height: 45px;
}

.youtube-info {
    flex: 1;
}

.youtube-title {
    font-size: 1.1rem;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.youtube-desc {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

@media (max-width: 640px) {
    .youtube-link {
        flex-direction: column;
        text-align: center;
        gap: 1.5rem;
        padding: 1.5rem;
    }

    .youtube-icon {
        width: 60px;
        height: 60px;
    }

    .youtube-icon svg {
        width: 35px;
        height: 35px;
    }

    .youtube-title {
        font-size: 1rem;
    }

    .youtube-desc {
        font-size: 0.85rem;
    }
}

/* Social Media Links */
.social-links {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    margin: 2rem 0;
}

.social-button {
    display: inline-flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1.25rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    text-decoration: none;
    color: var(--text-primary);
    font-weight: 500;
    font-size: 0.95rem;
    transition: all 0.3s ease;
}

.social-button svg {
    width: 20px;
    height: 20px;
    display: block;
}

.social-button:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(14, 165, 233, 0.2);
}

@media (max-width: 640px) {
    .social-links {
        justify-content: center;
    }

    .social-button {
        flex-direction: column;
        padding: 0.75rem 1rem;
        font-size: 0.85rem;
    }
}

/* Contact CTA Button */
.contact-cta {
    text-align: center;
    margin: 2rem 0;
}

.contact-cta-button {
    display: inline-flex;
    align-items: center;
    gap: 1rem;
    padding: 1.25rem 2.5rem;
    background: linear-gradient(135deg, rgba(14, 165, 233, 0.1), rgba(6, 182, 212, 0.1));
    border: 2px solid var(--primary-color);
    border-radius: 12px;
    text-decoration: none;
    color: var(--primary-color);
    font-weight: 600;
    font-size: 1rem;
    transition: all 0.3s ease;
}

.contact-cta-button svg {
    width: 24px;
    height: 24px;
    stroke: var(--primary-color);
}

.contact-cta-button:hover {
    background: linear-gradient(135deg, rgba(14, 165, 233, 0.15), rgba(6, 182, 212, 0.15));
    border-color: var(--primary-color);
    transform: translateY(-3px);
    box-shadow: 0 10px 30px rgba(14, 165, 233, 0.25);
}

@media (max-width: 640px) {
    .contact-cta-button {
        padding: 1rem 2rem;
        font-size: 0.95rem;
    }
}

/* Accessibility */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Print styles */
@media print {
    body {
        background: white;
    }
    .contact-links,
    .contact-cta,
    .footer {
        display: none;
    }
}

/* Focus styles for keyboard navigation */
a:focus,
button:focus {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

/* GDPR Cookie Banner */
.gdpr-banner {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--bg-secondary);
    border-top: 1px solid var(--border-color);
    padding: 1.5rem 2rem;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
    z-index: 9999;
    max-height: 200px;
    overflow-y: auto;
    display: none;
}

.gdpr-banner.show {
    display: block;
    animation: slideUp 0.3s ease-out;
}

@keyframes slideUp {
    from {
        transform: translateY(100%);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.gdpr-content {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

@media (min-width: 768px) {
    .gdpr-content {
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
        gap: 2rem;
    }
}

.gdpr-text {
    flex: 1;
    font-size: 0.9rem;
    line-height: 1.6;
    color: var(--text-secondary);
}

.gdpr-text a {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 500;
}

.gdpr-text a:hover {
    text-decoration: underline;
}

.gdpr-buttons {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

@media (min-width: 768px) {
    .gdpr-buttons {
        flex-wrap: nowrap;
        margin-left: auto;
        flex-shrink: 0;
    }
}

.gdpr-btn {
    padding: 0.75rem 1.5rem;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    background: var(--bg-secondary);
    color: var(--text-primary);
    white-space: nowrap;
}

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

.gdpr-btn.accept {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.gdpr-btn.accept:hover {
    opacity: 0.9;
    border-color: var(--primary-color);
}

body.gdpr-accepted {
    margin-bottom: 0;
}

/* Improve readability */
h1, h2, h3 {
    word-break: break-word;
    overflow-wrap: break-word;
}

/* ---- Language switcher ---- */
.lang-switch {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 0.25rem;
    margin-bottom: 1.75rem;
    font-family: var(--font-sans);
    font-size: 0.8rem;
    letter-spacing: 0.5px;
}

.lang-switch a {
    color: var(--text-tertiary);
    text-decoration: none;
    padding: 0.25rem 0.7rem;
    border: 1px solid transparent;
    border-radius: 999px;
    transition: color 0.15s, border-color 0.15s;
}

.lang-switch a:hover {
    color: var(--primary-color);
}

.lang-switch a[aria-current="true"] {
    color: var(--primary-color);
    border-color: var(--primary-color);
    font-weight: 600;
}

/* ---- Simplified Chinese: explicit CJK font stack ---- */
html[lang="zh-Hans"] body,
html[lang="zh-Hans"] h1,
html[lang="zh-Hans"] .section-title,
html[lang="zh-Hans"] .lang-switch {
    font-family: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans CJK SC", "Source Han Sans SC", sans-serif;
}

/* ---- Inline links in paragraphs ---- */
.paragraph a {
    color: var(--primary-color);
    text-decoration: none;
    border-bottom: 1px solid rgba(14, 165, 233, 0.35);
    transition: border-color 0.2s ease;
}

.paragraph a:hover {
    border-bottom-color: var(--primary-color);
}

/* ---- Website cards (reuse .project look, but clickable) ---- */
a.project.site {
    display: block;
    text-decoration: none;
    color: inherit;
}

.site-url {
    margin-top: 0.75rem;
    font-size: 0.78rem;
    font-weight: 500;
    letter-spacing: 0.2px;
    color: var(--primary-color);
}

a.project.site:hover .site-url {
    text-decoration: underline;
}

/* An odd number of site cards: let the last one span the full row */
.projects-grid > a.project.site:last-child:nth-child(odd) {
    grid-column: 1 / -1;
}
