/* Google Fonts import */
@import url('https://fonts.googleapis.com/css2?family=Cormorant+Garamond:ital,wght@0,400;0,600;0,700;1,400&family=Montserrat:wght@300;400;500;600;700&family=Outfit:wght@300;400;500;600;700&display=swap');

:root {
    --primary-color: #0f172a;       /* slate-900 */
    --secondary-color: #f8fafc;     /* slate-50 */
    --accent-color: #0284c7;        /* sky-600 */
    --accent-hover: #0369a1;        /* sky-700 */
    --text-color: #334155;          /* slate-700 */
    --text-light: #64748b;          /* slate-500 */
    --bg-color: #ffffff;
    --border-color: #e2e8f0;        /* slate-200 */
    --card-shadow: 0 10px 30px -10px rgba(0, 0, 0, 0.08);
    --hover-shadow: 0 20px 40px -15px rgba(2, 132, 199, 0.15);
}

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

body, html {
    font-family: 'Montserrat', sans-serif;
    color: var(--text-color);
    background-color: var(--bg-color);
    scroll-behavior: smooth;
    overflow-x: hidden;
    line-height: 1.6;
}

/* Header & Navigation */
header {
    background-color: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    padding: 18px 0;
    position: fixed;
    width: 100%;
    top: 0;
    z-index: 1000;
    transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    border-bottom: 1px solid rgba(226, 232, 240, 0.5);
}

header.scrolled {
    background-color: rgba(255, 255, 255, 0.95);
    padding: 12px 0;
    box-shadow: 0 4px 20px -5px rgba(0, 0, 0, 0.05);
    border-bottom: 1px solid rgba(226, 232, 240, 0.8);
}

nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 24px;
}

.logo {
    font-family: 'Cormorant Garamond', serif;
    font-size: 28px;
    font-weight: 700;
    color: var(--primary-color);
    text-decoration: none;
    letter-spacing: 2px;
    transition: color 0.3s ease;
}

.logo span {
    font-weight: 300;
    color: var(--accent-color);
}

.nav-links {
    list-style: none;
    display: flex;
    align-items: center;
}

.nav-links li {
    margin-left: 32px;
    display: flex;
    align-items: center;
}

.nav-links a {
    text-decoration: none;
    color: var(--text-color);
    font-weight: 500;
    transition: all 0.3s ease;
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    position: relative;
    padding: 4px 0;
}

.nav-links a::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 0;
    height: 2px;
    background-color: var(--accent-color);
    transition: width 0.3s ease;
}

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

.nav-links a:hover::after {
    width: 100%;
}

.nav-links li.active a {
    color: var(--accent-color);
}

.nav-links li.active a::after {
    width: 100%;
}

/* Language Selector */
.language-selector {
    display: flex;
    align-items: center;
    position: relative;
    font-family: 'Montserrat', sans-serif;
    font-size: 13px;
    margin-left: 32px;
    border: 1px solid var(--border-color);
    border-radius: 20px;
    padding: 4px 12px;
    background-color: rgba(255, 255, 255, 0.5);
    transition: all 0.3s ease;
}

.language-selector:hover {
    border-color: var(--accent-color);
}

.language-selector select {
    appearance: none;
    -webkit-appearance: none;
    background-color: transparent;
    border: none;
    padding: 2px 20px 2px 5px;
    font-family: 'Montserrat', sans-serif;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-color);
    cursor: pointer;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    outline: none;
}

.language-selector::after {
    content: '\25BC';
    position: absolute;
    top: 50%;
    right: 12px;
    transform: translateY(-50%);
    pointer-events: none;
    font-size: 8px;
    color: var(--text-light);
}

.menu-toggle {
    display: none;
    font-size: 24px;
    cursor: pointer;
    color: var(--primary-color);
}

/* Section styling */
.section-header {
    text-align: center;
    margin-bottom: 60px;
}

.section-header h2 {
    font-family: 'Cormorant Garamond', serif;
    font-size: 42px;
    color: var(--primary-color);
    font-weight: 700;
    position: relative;
    padding-bottom: 16px;
    margin-bottom: 12px;
}

.section-header h2::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 60px;
    height: 3px;
    background-color: var(--accent-color);
    border-radius: 2px;
}

.section-header p {
    font-size: 15px;
    color: var(--text-light);
    letter-spacing: 1px;
    text-transform: uppercase;
}

/* Gallery / Portfolio Section */
.gallery {
    position: relative;
    padding: 100px 24px;
    background-color: var(--secondary-color);
    background-image: radial-gradient(circle at 10% 20%, rgba(240, 249, 255, 0.6) 0%, rgba(255, 255, 255, 0.4) 90%), url('img/hero_bg2.jpg');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    border-top: 1px solid var(--border-color);
    overflow: hidden;
}

.gallery::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.3) 0%, rgba(248, 250, 252, 0.15) 100%);
    z-index: 1;
}

.gallery-container {
    position: relative;
    z-index: 2;
    max-width: 1200px;
    margin: 0 auto;
}

.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 30px;
    justify-content: center;
}

.gallery-item {
    background-color: var(--bg-color);
    border-radius: 20px;
    overflow: hidden;
    position: relative;
    aspect-ratio: 1;
    box-shadow: var(--card-shadow);
    opacity: 0;
    transform: translateY(40px);
    transition: all 0.5s cubic-bezier(0.16, 1, 0.3, 1), transform 0.5s cubic-bezier(0.16, 1, 0.3, 1);
    cursor: pointer;
}

.gallery-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.7s cubic-bezier(0.16, 1, 0.3, 1);
}

.gallery-item:hover img {
    transform: scale(1.08);
}

.gallery-item::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(to top, rgba(15, 23, 42, 0.8) 0%, rgba(15, 23, 42, 0.2) 70%, rgba(15, 23, 42, 0.05) 100%);
    opacity: 0.6;
    transition: opacity 0.4s ease;
    z-index: 1;
}

.gallery-item:hover::after {
    opacity: 0.85;
}

.gallery-info {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 30px;
    color: white;
    z-index: 2;
    transform: translateY(10px);
    transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.gallery-item:hover .gallery-info {
    transform: translateY(0);
}

.gallery-info h3 {
    font-size: 20px;
    margin-bottom: 8px;
    font-weight: 600;
    font-family: 'Montserrat', sans-serif;
    color: #ffffff;
    white-space: pre-line;
}

.gallery-subtitle {
    display: block;
    font-size: 14px;
    font-weight: 400;
    color: rgba(255, 255, 255, 0.9);
    margin-top: 4px;
    white-space: pre-line;
}

.gallery-info p {
    font-size: 13px;
    color: rgba(255, 255, 255, 0.8);
    opacity: 0;
    transform: translateY(10px);
    transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1) 0.1s;
    line-height: 1.5;
}

.gallery-item:hover .gallery-info p {
    opacity: 1;
    transform: translateY(0);
}

/* Contact Section */
.contact {
    padding: 100px 24px;
    background-color: var(--bg-color);
}

.contact-container {
    max-width: 800px;
    margin: 0 auto;
    text-align: center;
}

.contact-links {
    display: flex;
    justify-content: center;
    gap: 30px;
    margin-top: 40px;
}

.contact-btn {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 14px 28px;
    background-color: var(--secondary-color);
    color: var(--text-color);
    text-decoration: none;
    border-radius: 12px;
    font-weight: 600;
    font-size: 15px;
    border: 1px solid var(--border-color);
    transition: all 0.3s ease;
}

.contact-btn i {
    font-size: 18px;
    color: var(--accent-color);
}

.contact-btn:hover {
    background-color: white;
    border-color: var(--accent-color);
    color: var(--accent-color);
    transform: translateY(-3px);
    box-shadow: var(--card-shadow);
}

/* Footer */
footer {
    background-color: var(--primary-color);
    color: rgba(255, 255, 255, 0.6);
    text-align: center;
    padding: 40px 24px;
    font-size: 14px;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
}

footer p {
    margin-bottom: 16px;
}

footer .social-icons {
    display: flex;
    justify-content: center;
    gap: 20px;
}

footer .social-icons a {
    color: rgba(255, 255, 255, 0.4);
    font-size: 20px;
    transition: color 0.3s ease;
}

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

/* Responsive Media Queries */
@media (max-width: 768px) {
    header {
        padding: 15px 0;
    }
    
    header.scrolled {
        padding: 10px 0;
    }
    
    .nav-links {
        display: none;
        flex-direction: column;
        position: absolute;
        top: 100%;
        left: 0;
        width: 100%;
        background-color: rgba(255, 255, 255, 0.98);
        backdrop-filter: blur(20px);
        -webkit-backdrop-filter: blur(20px);
        padding: 30px 24px;
        box-shadow: 0 10px 30px rgba(0, 0, 0, 0.05);
        border-bottom: 1px solid var(--border-color);
    }
    
    .nav-links.active {
        display: flex;
    }
    
    .nav-links li {
        margin: 14px 0;
        margin-left: 0;
    }
    
    .language-selector {
        margin-left: 0;
        margin-top: 10px;
        width: fit-content;
    }
    
    .menu-toggle {
        display: block;
    }
}

@media (max-width: 480px) {
    .section-header h2 {
        font-size: 32px;
    }
}

/* Project Detail Pages (restaurant-helper, turtle-soup) */
.project-detail-bg {
    background-repeat: no-repeat;
    background-position: center;
    background-attachment: fixed;
    background-size: auto 100vh;
}

.projects-page {
    padding: 100px 24px 80px;
    max-width: 900px;
    margin: 0 auto;
    min-height: 80vh;
}

.projects-page .section-header {
    margin-bottom: 30px;
}

.projects-page .section-header p {
    font-size: 24px;
    color: var(--primary-color);
    font-weight: 700;
    text-shadow: 0 1px 4px rgba(255, 255, 255, 0.85);
}

.projects-page .back-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--primary-color);
    text-decoration: none;
    font-size: 14px;
    font-weight: 700;
    margin-bottom: 16px;
    transition: color 0.3s ease;
    text-shadow: 0 1px 4px rgba(255, 255, 255, 0.85);
}

.projects-page .back-link:hover {
    color: var(--accent-color);
}

.projects-page .action-buttons {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 16px;
    width: fit-content;
    margin: 0 auto 50px;
}

.projects-page .action-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    min-height: 92px;
    padding: 0 48px;
    border-radius: 16px;
    font-size: 28px;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.2s ease;
    box-sizing: border-box;
}

.projects-page .action-btn.repo-btn {
    background-color: #f1f5f9;
    color: #334155;
    border: 1px solid #cbd5e1;
}

.projects-page .action-btn.repo-btn:hover {
    background-color: #e2e8f0;
    color: #0f172a;
    border-color: #94a3b8;
}

.projects-page .action-btn.demo-btn {
    background-color: var(--accent-color);
    color: white;
    border: 1px solid var(--accent-color);
    box-shadow: 0 2px 6px rgba(2, 132, 199, 0.2);
}

.projects-page .action-btn.demo-btn:hover {
    background-color: var(--accent-hover);
    border-color: var(--accent-hover);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(2, 132, 199, 0.3);
}

.projects-page .project-description p {
    font-size: 16px;
    color: var(--primary-color);
    font-weight: 500;
    line-height: 1.9;
    margin-bottom: 24px;
    text-align: left;
    text-shadow: 0 1px 4px rgba(255, 255, 255, 0.85);
}

html[lang="zh-TW"] .projects-page .project-description p {
    text-align: justify;
}

@media (max-width: 768px) {
    .project-detail-bg {
        background-size: cover;
    }
}

@media (max-width: 480px) {
    .projects-page .action-btn {
        min-height: 76px;
        padding: 0 28px;
    }

    html:not([lang="zh-TW"]) .projects-page .action-btn.demo-btn {
        font-size: 22px;
    }
}

/* Feature Grid (sub-cards on project hub pages, e.g. restaurant-profit) */
.feature-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 24px;
    margin-top: 10px;
}

.feature-card {
    display: block;
    position: relative;
    border-radius: 16px;
    overflow: hidden;
    aspect-ratio: 1;
    box-shadow: var(--card-shadow);
    text-decoration: none;
}

.feature-card img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.4s ease;
}

.feature-card:hover img {
    transform: scale(1.05);
}

.feature-card::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(to top, rgba(15, 23, 42, 0.75) 0%, rgba(15, 23, 42, 0.1) 60%);
}

.feature-card h3 {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 20px;
    margin: 0;
    color: #ffffff;
    font-size: 18px;
    font-weight: 600;
    font-family: 'Montserrat', sans-serif;
    z-index: 1;
}
