/* ============================
   CSS Variables & Reset
   ============================ */
:root {
    --bg-color: #0d0d0f;
    --card-bg-color: #16161a;
    --card-bg-hover: #1c1c22;
    --primary-color: #e8861a;
    --primary-glow: rgba(232, 134, 26, 0.25);
    --primary-subtle: rgba(232, 134, 26, 0.08);
    --text-color: #f0efe8;
    --secondary-text-color: #8a8880;
    --border-color: rgba(255,255,255,0.07);
    --border-hover: rgba(232, 134, 26, 0.35);
    --surface-1: rgba(22, 22, 26, 0.85);
}

*, *::before, *::after { box-sizing: border-box; }

html {
    scrollbar-width: thin;
    scrollbar-color: var(--primary-color) #1a1a1a;
    scroll-behavior: smooth;
}
::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: #0d0d0f; }
::-webkit-scrollbar-thumb { background: var(--primary-color); border-radius: 99px; border: 2px solid #0d0d0f; }
::-webkit-scrollbar-thumb:hover { background: #f0993a; }

body {
    background-color: var(--bg-color);
    color: var(--text-color);
    font-family: 'Noto Sans TC', sans-serif;
    margin: 0;
    line-height: 1.6;
    overflow-x: hidden;
}

/* Hero */
.hero {
    position: relative;
    text-align: center;
    padding: 7rem 1rem 5rem;
    overflow: hidden;
    border-bottom: 1px solid var(--border-color);
}
.hero::before {
    content: '';
    position: absolute;
    inset: 0;
    background:
        radial-gradient(ellipse 80% 60% at 50% 0%, rgba(232,134,26,0.12) 0%, transparent 70%),
        radial-gradient(ellipse 50% 40% at 20% 80%, rgba(180,80,10,0.07) 0%, transparent 60%);
    z-index: 0;
}
.hero::after {
    content: '';
    position: absolute;
    inset: 0;
    background-image:
        linear-gradient(rgba(255,255,255,0.025) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255,255,255,0.025) 1px, transparent 1px);
    background-size: 60px 60px;
    mask-image: radial-gradient(ellipse 90% 80% at 50% 0%, black 40%, transparent 100%);
    -webkit-mask-image: radial-gradient(ellipse 90% 80% at 50% 0%, black 40%, transparent 100%);
    z-index: 0;
}
#hero-canvas {
    position: absolute;
    inset: 0;
    z-index: 1;
    opacity: 0.45;
    pointer-events: none;
}
.hero-content { position: relative; z-index: 2; }
.hero h1 {
    margin: 0 0 0.75rem;
    font-size: clamp(1.8rem, 5vw, 3rem);
    font-weight: 700;
    color: #fff;
    letter-spacing: -0.02em;
    line-height: 1.2;
}
.hero p {
    color: var(--secondary-text-color);
    font-size: 1.1rem;
    margin-top: 0.5rem;
    min-height: 1.8rem;
}
.typewriter-text::after {
    content: '|';
    animation: blink 0.8s step-end infinite;
    color: var(--primary-color);
    margin-left: 2px;
}
@keyframes blink { 0%,100%{opacity:1} 50%{opacity:0} }

/* Intro */
.page-intro {
    padding: 3.5rem 0;
    border-bottom: 1px solid var(--border-color);
}
.intro-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 2rem;
    text-align: center;
}
.intro-content h2 {
    margin-top: 0;
    margin-bottom: 1rem;
    font-size: 1.6rem;
    color: #fff;
    font-weight: 700;
    letter-spacing: -0.01em;
}
.intro-content p {
    max-width: 75ch;
    margin-left: auto;
    margin-right: auto;
    color: var(--secondary-text-color);
    font-size: 1.05rem;
    line-height: 1.8;
    margin-bottom: 0.8rem;
}

/* Grid & Cards */
.project-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.5rem;
    padding: 2rem;
    max-width: 1200px;
    margin: 0 auto;
}
.project-card {
    background-color: var(--card-bg-color);
    border: 1px solid var(--border-color);
    border-radius: 14px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transition:
        transform 0.35s cubic-bezier(0.23,1,0.32,1),
        box-shadow 0.35s cubic-bezier(0.23,1,0.32,1),
        border-color 0.35s ease,
        background-color 0.35s ease;
    will-change: transform;
}
.project-card:hover {
    transform: translateY(-6px) scale(1.01);
    box-shadow: 0 20px 40px rgba(0,0,0,0.4), 0 0 0 1px var(--border-hover), 0 0 30px var(--primary-glow);
    border-color: var(--border-hover);
    background-color: var(--card-bg-hover);
}
.card-image-wrap { position: relative; overflow: hidden; }
.project-card img {
    width: 100%;
    height: auto;
    aspect-ratio: 16/9;
    object-fit: cover;
    display: block;
    transition: transform 0.5s cubic-bezier(0.23,1,0.32,1);
}
.project-card:hover img { transform: scale(1.04); }
.card-image-wrap::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, transparent 40%, rgba(232,134,26,0.06) 100%);
    opacity: 0;
    transition: opacity 0.35s ease;
}
.project-card:hover .card-image-wrap::after { opacity: 1; }

.card-content {
    padding: 1.25rem 1.5rem 1.5rem;
    display: flex;
    flex-direction: column;
    flex-grow: 1;
}
.card-title-container {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 0.5rem;
    margin-bottom: 0.35rem;
}
.card-title-container h3 {
    margin: 0;
    color: #fff;
    font-size: 1.05rem;
    font-weight: 700;
    letter-spacing: -0.01em;
    line-height: 1.3;
}
.steam-link {
    font-size: 1.3rem;
    color: var(--secondary-text-color);
    text-decoration: none;
    transition: color 0.2s, transform 0.2s;
    flex-shrink: 0;
    margin-top: 2px;
}
.steam-link:hover { color: var(--primary-color); transform: scale(1.15); }
.card-content .last-updated {
    font-size: 0.8rem;
    color: var(--secondary-text-color);
    margin-bottom: 0.85rem;
    opacity: 0.7;
}
.card-content .description {
    color: var(--secondary-text-color);
    font-size: 0.92rem;
    line-height: 1.7;
    flex-grow: 1;
}
.card-buttons {
    margin-top: 1.25rem;
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

/* Buttons */
.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    background-color: var(--primary-color);
    color: #fff;
    padding: 0.55rem 1.1rem;
    text-decoration: none;
    border-radius: 8px;
    font-size: 0.88rem;
    font-weight: 600;
    text-align: center;
    transition: all 0.25s cubic-bezier(0.23,1,0.32,1);
    white-space: nowrap;
}
.button:hover {
    background-color: #f0993a;
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(232,134,26,0.4);
}
.button:active { transform: translateY(0); }
.button.secondary {
    background-color: transparent;
    border: 1px solid rgba(232,134,26,0.4);
    color: var(--primary-color);
}
.button.secondary:hover {
    background-color: var(--primary-subtle);
    border-color: var(--primary-color);
    box-shadow: 0 4px 16px var(--primary-glow);
}

/* Util section */
.util-section { padding: 3.5rem 0; }
.section-title {
    text-align: center;
    color: var(--primary-color);
    font-size: 1.6rem;
    font-weight: 700;
    margin-bottom: 2rem;
    letter-spacing: -0.01em;
}

/* Archived */
.archived-section {
    padding: 2.5rem 0;
    margin-top: 2rem;
    border-top: 1px solid var(--border-color);
}
.archived-section-title {
    text-align: center;
    margin-top: 0;
    margin-bottom: 2rem;
    font-size: 1.4rem;
    color: var(--text-color);
    line-height: 1.6;
}
.warning-badge {
    background-color: #e8861a;
    color: #000;
    padding: 0.2rem 0.9rem;
    border-radius: 99px;
    font-size: 0.9rem;
    font-weight: 700;
    display: inline-block;
    margin-bottom: 0.5rem;
    letter-spacing: 0.02em;
}
.archived-subtitle {
    font-size: 1rem;
    color: var(--secondary-text-color);
    font-weight: normal;
    display: block;
}

/* Legal */
.legal-notice {
    padding: 3rem 1rem;
    background-color: rgba(0,0,0,0.2);
    border-top: 1px solid var(--border-color);
    text-align: center;
}
.legal-notice .intro-content {
    border-top: 1px solid var(--border-color);
    padding-top: 2rem;
}
.legal-notice h3 {
    color: #fff;
    margin-bottom: 1.5rem;
    font-size: 1.15rem;
    font-weight: 700;
}
.legal-notice ul {
    list-style: none;
    padding: 0;
    text-align: left;
    max-width: 700px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}
.legal-notice li {
    color: var(--secondary-text-color);
    font-size: 0.92rem;
    line-height: 1.7;
    padding-left: 1.4rem;
    position: relative;
}
.legal-notice li::before {
    content: '▸';
    position: absolute;
    left: 0;
    color: var(--primary-color);
    font-size: 0.75rem;
    top: 4px;
}

/* Support */
.support-section {
    text-align: center;
    padding: 3rem 1rem;
    border-top: 1px solid var(--border-color);
    background: var(--surface-1);
}
.support-section p {
    margin-top: 0;
    margin-bottom: 1.5rem;
    font-size: 1rem;
    color: var(--secondary-text-color);
}
.support-buttons {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}
.support-buttons span { color: var(--secondary-text-color); font-size: 0.85rem; }
.button-coffee {
    display: inline-flex;
    align-items: center;
    background-color: #1a1a1a;
    color: #fff;
    padding: 10px 20px;
    border-radius: 10px;
    text-decoration: none;
    font-family: 'Noto Sans TC', sans-serif;
    font-size: 0.9rem;
    font-weight: 700;
    border: 1px solid rgba(255,255,255,0.1);
    transition: all 0.25s ease;
}
.button-coffee i { margin-right: 8px; color: var(--primary-color); }
.button-coffee:hover { background-color: #2a2a2a; transform: translateY(-2px); box-shadow: 0 8px 24px rgba(0,0,0,0.4); }

/* Footer */
footer {
    text-align: center;
    padding: 2rem 1rem;
    color: var(--secondary-text-color);
    border-top: 1px solid var(--border-color);
    background-color: rgba(0,0,0,0.3);
    font-size: 0.9rem;
}
footer a { color: var(--primary-color); text-decoration: none; }
footer a:hover { color: #f0993a; }

/* Reveal */
.reveal {
    opacity: 0;
    transform: translateY(28px);
    transition: opacity 0.7s cubic-bezier(0.23,1,0.32,1), transform 0.7s cubic-bezier(0.23,1,0.32,1);
}
.reveal.active { opacity: 1; transform: translateY(0); }
.project-grid .project-card.reveal:nth-child(2) { transition-delay: 0.07s; }
.project-grid .project-card.reveal:nth-child(3) { transition-delay: 0.14s; }
.project-grid .project-card.reveal:nth-child(4) { transition-delay: 0.21s; }
.project-grid .project-card.reveal:nth-child(5) { transition-delay: 0.28s; }

/* Back to top */
#backToTop {
    display: none;
    position: fixed;
    bottom: 28px;
    right: 28px;
    z-index: 99;
    font-size: 1rem;
    border: 1px solid rgba(232,134,26,0.4);
    outline: none;
    background-color: rgba(13,13,15,0.85);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    color: var(--primary-color);
    cursor: pointer;
    padding: 13px 15px;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.4);
    transition: all 0.25s cubic-bezier(0.23,1,0.32,1);
}
#backToTop:hover {
    background-color: var(--primary-color);
    color: #fff;
    transform: translateY(-3px);
    box-shadow: 0 8px 28px var(--primary-glow);
}

/* Mobile */
@media (max-width: 768px) {
    .hero { padding: 5rem 1.25rem 4rem; }
    .intro-content { padding: 0 1.25rem; }
    .project-grid { grid-template-columns: 1fr; padding: 1.25rem; gap: 1.25rem; }
    .project-grid .project-card.reveal:nth-child(n) { transition-delay: 0s; }
    .project-card:hover { transform: translateY(-3px); }
    .card-buttons { flex-direction: column; }
    .button { width: 100%; justify-content: center; padding: 0.7rem 1rem; font-size: 0.92rem; }
    .support-buttons { flex-direction: column; }
    #backToTop { bottom: 20px; right: 20px; padding: 11px 13px; }
}
@media (max-width: 480px) {
    .hero h1 { font-size: 1.6rem; }
    .card-content { padding: 1rem 1.1rem 1.1rem; }
}
