/* ============================================
   CoLab — Home Page Styles (Functional Redesign)
   Function-first: thin top bar + course grid.
   No hero, no marketing copy. Visual language is
   still aligned with Lecture / Tutorial: glass nav,
   orange accent strip, layered fade-in, info-card
   pattern.
============================================ */

/* ============================================
   PAGE SHELL
============================================ */
.home-main {
    margin-top: 130px;
    padding: 0 64px 80px;
    max-width: 1680px;
    margin-left: auto;
    margin-right: auto;
}

/* ============================================
   THIN TOP BAR (semester · count · filters)
============================================ */
.home-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
    padding: 12px 20px;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    box-shadow: var(--shadow-sm);
    margin-bottom: 22px;
    position: relative;
    overflow: hidden;
    opacity: 0;
    transform: translateY(16px);
    animation: barFadeIn 0.5s cubic-bezier(0.4, 0, 0.2, 1) 0.05s forwards;
}

.home-bar::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    bottom: 0;
    width: 3px;
    background: linear-gradient(180deg, var(--primary-orange), var(--orange-light));
}

.home-bar-left {
    display: flex;
    align-items: baseline;
    gap: 14px;
    flex-wrap: wrap;
    padding-left: 8px;
}

.home-bar-title {
    font-family: 'Merriweather', serif;
    font-size: 17px;
    font-weight: 800;
    color: var(--text-primary);
    letter-spacing: -0.2px;
    line-height: 1;
}

.home-bar-meta {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
}

.home-bar-meta .dot {
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: var(--text-muted);
    display: inline-block;
}

.home-bar-right {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.bar-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 11px;
    background: var(--ultra-light);
    border: 1px solid var(--border-color);
    border-radius: 50px;
    font-size: 11px;
    font-weight: 600;
    color: var(--text-secondary);
    cursor: pointer;
    user-select: none;
    transition: var(--transition-smooth);
}

.bar-chip:hover {
    border-color: var(--primary-orange);
    color: var(--primary-orange);
}

.bar-chip.active {
    background: linear-gradient(135deg, var(--primary-orange), var(--orange-light));
    border-color: transparent;
    color: var(--pure-white);
    box-shadow: 0 4px 12px var(--orange-glow);
}

/* ============================================
   COURSE GRID
============================================ */
.card-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 24px;
}

.vcard {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 14px;
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    transition: var(--transition-smooth);
    display: grid;
    grid-template-columns: 240px 1fr;
    min-height: 220px;
    position: relative;
    opacity: 0;
    transform: translateY(24px);
    animation: cardFadeIn 0.5s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

.card-grid .vcard:nth-child(1) { animation-delay: 0.10s; }
.card-grid .vcard:nth-child(2) { animation-delay: 0.18s; }
.card-grid .vcard:nth-child(3) { animation-delay: 0.26s; }
.card-grid .vcard:nth-child(4) { animation-delay: 0.34s; }

.vcard::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--primary-orange), var(--orange-light));
    transform: scaleX(0);
    transform-origin: left center;
    transition: transform 0.45s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 2;
}

.vcard:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
    border-color: rgba(242, 107, 56, 0.25);
}

.vcard:hover::before {
    transform: scaleX(1);
}

/* Card image (left side) */
.vcard-img {
    position: relative;
    overflow: hidden;
    background: var(--page-bg);
}

.vcard-img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.vcard:hover .vcard-img img {
    transform: scale(1.06);
}

.vcard-img::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg,
        rgba(0, 0, 0, 0) 0%,
        rgba(0, 0, 0, 0) 65%,
        rgba(0, 0, 0, 0.18) 100%);
    pointer-events: none;
}

.vcard-code {
    position: absolute;
    top: 12px;
    left: 12px;
    padding: 4px 9px;
    background: rgba(10, 10, 10, 0.78);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    color: var(--pure-white);
    border-radius: 5px;
    font-family: 'Inter', sans-serif;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 1px;
    z-index: 1;
}

/* Card body (right side) */
.vcard-body {
    padding: 18px 20px 18px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.vcard-title {
    font-family: 'Merriweather', serif;
    font-size: 18px;
    font-weight: 800;
    line-height: 1.25;
    color: var(--text-primary);
    letter-spacing: -0.3px;
    margin: 0;
}

.vcard-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.tag {
    display: inline-block;
    padding: 3px 9px;
    background: var(--ultra-light);
    border: 1px solid var(--border-color);
    border-radius: 50px;
    font-size: 10px;
    font-weight: 600;
    color: var(--text-secondary);
    white-space: nowrap;
    transition: var(--transition-smooth);
}

.vcard:hover .tag {
    border-color: rgba(242, 107, 56, 0.20);
}

/* Card footer / actions */
.vcard-links {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: auto;
    padding-top: 12px;
    border-top: 1px solid var(--border-color);
}

.meta-badge {
    flex: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    padding: 6px 12px;
    background: var(--ultra-light);
    border-radius: 8px;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
    transition: var(--transition-smooth);
    text-decoration: none;
    cursor: pointer;
}

.meta-badge::before {
    content: '';
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: var(--text-muted);
    transition: var(--transition-smooth);
}

.meta-badge:hover {
    border-color: var(--primary-orange);
    color: var(--primary-orange);
    transform: translateY(-1px);
}

.meta-badge:hover::before {
    background: var(--primary-orange);
}

/* Primary action — compact, sits inline with quick links */
.vcard-primary {
    margin-left: auto;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: linear-gradient(135deg, var(--primary-orange), var(--orange-light));
    color: var(--pure-white);
    border-radius: 8px;
    font-size: 12px;
    font-weight: 700;
    text-decoration: none;
    box-shadow: 0 2px 8px var(--orange-glow);
    transition: var(--transition-smooth);
    position: relative;
    overflow: hidden;
    white-space: nowrap;
}

.vcard-primary::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.28), transparent);
    transition: left 0.6s ease;
}

.vcard-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(242, 107, 56, 0.4);
}

.vcard-primary:hover::before {
    left: 100%;
}

.vcard-primary .arrow {
    font-size: 13px;
    transition: transform 0.3s ease;
}

.vcard-primary:hover .arrow {
    transform: translateX(3px);
}

/* ============================================
   ANIMATIONS
============================================ */
@keyframes barFadeIn {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes cardFadeIn {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ============================================
   DARK THEME OVERRIDES
============================================ */
[data-theme="dark"] .meta-badge {
    background: var(--page-bg);
    color: var(--text-secondary);
}

[data-theme="dark"] .vcard-code {
    background: rgba(0, 0, 0, 0.85);
}

[data-theme="dark"] .bar-chip {
    background: var(--page-bg);
}

/* ============================================
   RESPONSIVE
============================================ */
@media (max-width: 1280px) {
    .home-main {
        padding: 0 40px 60px;
    }
    .vcard {
        grid-template-columns: 220px 1fr;
    }
}

@media (max-width: 1024px) {
    .home-main {
        margin-top: 110px;
    }
    .vcard {
        grid-template-columns: 200px 1fr;
        min-height: 200px;
    }
    .vcard-title {
        font-size: 17px;
    }
}

@media (max-width: 900px) {
    .card-grid {
        grid-template-columns: 1fr;
    }
    .vcard {
        grid-template-columns: 240px 1fr;
    }
}

@media (max-width: 767px) {
    .home-main {
        padding: 0 18px 60px;
        margin-top: 80px;
    }
    .home-bar {
        padding: 14px 18px;
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }
    .home-bar-title {
        font-size: 18px;
    }
    .vcard {
        grid-template-columns: 1fr;
        min-height: auto;
    }
    .vcard-img {
        height: 180px;
    }
    .vcard-body {
        padding: 18px 20px;
    }
    .vcard-title {
        font-size: 18px;
    }
}

@media (max-width: 480px) {
    .home-bar-right {
        width: 100%;
    }
    .bar-chip {
        flex: 1;
        justify-content: center;
    }
}

@media (prefers-reduced-motion: reduce) {
    .home-bar,
    .vcard {
        animation: none !important;
        opacity: 1 !important;
        transform: none !important;
    }
}
