/* CSS Grid Layout for Andy Yu's Portfolio (Exercise 4) */

:root {
    --bg-color: #f0f2f5;
    --nav-bg: #343a40;
    --nav-text: #ffffff;
    --accent-color: #007bff;
    --secondary-color: #6c757d;
    --hover-color: #ffc107;
    --active-color: #00d4ff;
    --text-main: #212529;
    --text-muted: #495057;
    --white: #ffffff;
}

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

body {
    font-family: 'Inter', -apple-system, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-main);
    line-height: 1.6;
    display: grid;
    grid-template-columns: 1fr; /* Default mobile view */
}

/* --- GRID STRUCTURE --- */
.site-container {
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    gap: 20px;
    width: 100%;
}

/* Full width elements */
.full-width {
    grid-column: 1 / -1;
}

/* --- BANNER --- */
.bg-banner {
    grid-column: 1 / -1;
    height: 250px;
    background: linear-gradient(135deg, #1a1a1a 0%, #343a40 100%);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    color: var(--white);
    text-align: center;
    position: relative;
    overflow: hidden;
}

.bg-banner::after {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url('https://images.unsplash.com/photo-1614850523296-d8c1af93d400?ixlib=rb-1.2.1&auto=format&fit=crop&w=1350&q=80') center/cover;
    opacity: 0.2;
    z-index: 0;
}

.bg-banner h1 {
    font-size: 3rem;
    z-index: 1;
    letter-spacing: 5px;
    text-transform: uppercase;
}

/* --- NAVIGATION --- */
header {
    grid-column: 1 / -1;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 5%;
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(10px);
    position: sticky;
    top: 0;
    z-index: 100;
}

.logo svg {
    transition: transform 0.3s ease;
}

.logo:hover svg {
    transform: rotate(5deg) scale(1.1);
}

nav {
    background-color: var(--nav-bg);
    padding: 8px 25px;
    border-radius: 30px;
}

nav ul {
    list-style: none;
    display: flex;
    gap: 20px;
}

nav ul li a {
    color: var(--nav-text);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.3s ease;
    padding: 5px 10px;
    border-radius: 4px;
}

nav ul li a:hover {
    color: var(--hover-color);
}

nav ul li a.active {
    color: var(--active-color);
    border-bottom: 2px solid var(--active-color);
}

/* --- MAIN CONTENT GRID --- */
main {
    grid-column: 2 / 12; /* Centered content */
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    gap: 40px;
    padding: 60px 0;
}

/* --- HOME PAGE SPECIFIC --- */
.hero-image {
    grid-column: 1 / 5;
    position: relative;
}

.hero-image img {
    width: 100%;
    height: auto;
    border-radius: 12px;
    box-shadow: 0 20px 40px rgba(0,0,0,0.1);
    transition: transform 0.5s ease;
}

.hero-image:hover img {
    transform: translateY(-10px);
}

.hero-text {
    grid-column: 8 / 13;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.stair-line {
    margin: 20px 0;
}

.intro-section {
    grid-column: 1 / 13;
    text-align: center;
    padding: 40px 10%;
}

.intro-section p {
    font-size: 1.2rem;
    color: var(--text-muted);
}

/* --- SUB PAGES GRID --- */
.content-card {
    grid-column: span 4; /* 3 columns on desktop */
    background: var(--white);
    padding: 30px;
    border-radius: 15px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.05);
    transition: transform 0.3s ease;
}

.content-card:hover {
    transform: translateY(-5px);
}

.full-card {
    grid-column: 1 / 13;
    background: var(--white);
    padding: 40px;
    border-radius: 15px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
    align-items: center;
}

.video-placeholder {
    width: 100%;
    aspect-ratio: 16 / 9;
    background: #000;
    border-radius: 10px;
    display: flex;
    justify-content: center;
    align-items: center;
    color: white;
}

/* --- GEOMETRIC SHAPES --- */
.shapes-container {
    grid-column: 1 / 13;
    display: flex;
    justify-content: space-around;
    align-items: center;
    padding: 60px 0;
    gap: 40px;
}

.shape {
    display: flex;
    justify-content: center;
    align-items: center;
    animation: float 3s ease-in-out infinite;
}

.shape:nth-child(1) {
    animation-delay: 0s;
}

.shape:nth-child(2) {
    animation-delay: 0.5s;
}

.shape:nth-child(3) {
    animation-delay: 1s;
}

@keyframes float {
    0%, 100% {
        transform: translateY(0px);
    }
    50% {
        transform: translateY(-20px);
    }
}

/* Inverted Triangle Container */
.triangle-down {
    width: 200px;
    height: 250px;
    clip-path: polygon(50% 100%, 0% 0%, 100% 0%);
    overflow: hidden;
}

.triangle-down img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Circle Container */
.circle {
    width: 200px;
    height: 200px;
    border-radius: 50%;
    overflow: hidden;
}

.circle img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Triangle Container */
.triangle-up {
    width: 240px;
    height: 280px;
    clip-path: polygon(50% 0%, 100% 100%, 0% 100%);
    overflow: hidden;
}

.triangle-up img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Content Box */
.content-box {
    grid-column: 1 / 13;
    background: #e8eaed;
    border-radius: 30px;
    padding: 50px 60px;
    text-align: center;
    margin-top: 40px;
}

.content-box h2 {
    font-size: 2rem;
    margin-bottom: 20px;
    color: var(--text-main);
}

.content-box p {
    font-size: 1.1rem;
    color: var(--text-muted);
    line-height: 1.8;
}

/* --- FOOTER --- */
footer {
    grid-column: 1 / -1;
    padding: 40px 5%;
    background: #fff;
    display: grid;
    grid-template-columns: 1fr 1fr;
    border-top: 1px solid #eee;
}

.footer-right {
    text-align: right;
}

/* --- RESPONSIVE SCALING --- */
img, video, iframe {
    max-width: 100%;
    height: auto;
}

@media (max-width: 992px) {
    main {
        grid-column: 1 / 13;
        padding: 40px 20px;
    }
    .hero-image, .hero-text {
        grid-column: 1 / 13;
    }
    .content-card {
        grid-column: span 6;
    }
    .full-card {
        grid-template-columns: 1fr;
    }
    .shapes-container {
        flex-direction: column;
        gap: 30px;
    }
    .triangle-down, .triangle-up {
        transform: scale(0.7);
    }
    .circle {
        width: 120px;
        height: 120px;
    }
}

@media (max-width: 600px) {
    .content-card {
        grid-column: 1 / 13;
    }
    header {
        flex-direction: column;
        gap: 20px;
    }
}

.video-link {
    display: block;
}

.video-wrapper {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 9; /* 你可以改 */
    overflow: hidden;
    cursor: pointer;
}

.hover-video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    pointer-events: none; /* 防止 video 吃掉点击 */
}
