/* ============================================================
   home.css — NBA Shot Chart Explorer Home Page

   3x3 grid of feature cards on a dark background.
   Active cards glow and are clickable; WIP cards are muted.
   ============================================================ */

/* --- RESET & BASE --- */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background-color: #1a1a2e;
    color: #e0e0e0;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* --- HEADER --- */
.home-header {
    text-align: center;
    padding: 48px 24px 32px;
}

.home-title {
    font-size: 36px;
    font-weight: 700;
    color: #ffffff;
    letter-spacing: 1px;
}

.home-subtitle {
    font-size: 16px;
    color: #8892a8;
    margin-top: 8px;
}

/* --- MAIN CONTENT --- */
.home-main {
    flex: 1;
    display: flex;
    justify-content: center;
    padding: 0 24px 48px;
}

/* --- FEATURE GRID (3x3) --- */
.feature-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    max-width: 900px;
    width: 100%;
}

/* --- FEATURE CARD (base) --- */
.feature-card {
    background-color: #16213e;
    border: 1px solid #2a2a4a;
    border-radius: 12px;
    padding: 28px 24px;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    position: relative;
    transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
    text-decoration: none;
    color: inherit;
    aspect-ratio: 1 / 1;
    justify-content: center;
}

/* --- ACTIVE CARD --- */
.feature-card.active {
    border-color: #e94560;
    cursor: pointer;
}

.feature-card.active:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 32px rgba(233, 69, 96, 0.25);
    border-color: #e94560;
}

.feature-card.active .card-icon {
    color: #e94560;
}

.feature-card.active .card-title {
    color: #ffffff;
}

.feature-card.active .card-desc {
    color: #a0a8b8;
}

/* Subtle glow pulse on active card */
.feature-card.active::before {
    content: "";
    position: absolute;
    inset: -1px;
    border-radius: 12px;
    background: linear-gradient(135deg, rgba(233, 69, 96, 0.1), rgba(78, 204, 163, 0.05));
    z-index: -1;
}

/* --- WIP CARD --- */
.feature-card.wip {
    cursor: default;
    opacity: 0.45;
}

.feature-card.wip .card-icon {
    color: #5a6a8a;
}

.feature-card.wip .card-title {
    color: #6a7a9a;
}

.feature-card.wip .card-desc {
    color: #4a5a7a;
}

/* --- WIP BADGE --- */
.wip-badge {
    position: absolute;
    top: 12px;
    right: 12px;
    background-color: #2a2a4a;
    color: #5a6a8a;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    padding: 3px 8px;
    border-radius: 4px;
}

/* --- CARD ICON --- */
.card-icon {
    width: 56px;
    height: 56px;
    margin-bottom: 16px;
}

.card-icon svg {
    width: 100%;
    height: 100%;
}

/* --- CARD TITLE --- */
.card-title {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 8px;
    line-height: 1.3;
}

/* --- CARD DESCRIPTION --- */
.card-desc {
    font-size: 13px;
    line-height: 1.5;
}

/* --- FOOTER --- */
.home-footer {
    text-align: center;
    padding: 20px 24px;
    border-top: 1px solid #2a2a4a;
    font-size: 12px;
    color: #5a6a8a;
}

/* --- CARD-SPECIFIC HOVER ANIMATIONS --- */

/* Card 1: Player Shooting Comparison — Dots animate across court */
.feature-card.active:nth-child(1):hover .card-icon svg circle:nth-of-type(1) {
    animation: dotMove1 1s ease-in-out infinite;
}

.feature-card.active:nth-child(1):hover .card-icon svg circle:nth-of-type(2) {
    animation: dotMove2 1s ease-in-out infinite;
}

.feature-card.active:nth-child(1):hover .card-icon svg circle:nth-of-type(3) {
    animation: dotMove3 1s ease-in-out infinite 0.2s;
}

.feature-card.active:nth-child(1):hover .card-icon svg circle:nth-of-type(4) {
    animation: dotMove4 1s ease-in-out infinite 0.2s;
}

@keyframes dotMove1 {
    0%, 100% { cx: 14; cy: 22; }
    50% { cx: 20; cy: 26; }
}

@keyframes dotMove2 {
    0%, 100% { cx: 14; cy: 30; }
    50% { cx: 10; cy: 32; }
}

@keyframes dotMove3 {
    0%, 100% { cx: 34; cy: 18; }
    50% { cx: 28; cy: 20; }
}

@keyframes dotMove4 {
    0%, 100% { cx: 34; cy: 28; }
    50% { cx: 30; cy: 26; }
}

/* Card 2: Team Shot Analysis — Bars grow/shrink */
.feature-card.active:nth-child(2):hover .card-icon svg rect:nth-of-type(1) {
    animation: barGrow 0.8s ease-in-out infinite;
}

.feature-card.active:nth-child(2):hover .card-icon svg rect:nth-of-type(2) {
    animation: barGrow 0.8s ease-in-out infinite 0.15s;
}

.feature-card.active:nth-child(2):hover .card-icon svg rect:nth-of-type(3) {
    animation: barGrow 0.8s ease-in-out infinite 0.3s;
}

@keyframes barGrow {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* Card 3: Fantasy Player Tool — Clipboard icon writes */
.feature-card.active:nth-child(3):hover .card-icon {
    animation: clipboardGlow 1.2s ease-in-out infinite;
}

.feature-card.active:nth-child(3):hover .card-icon svg {
    filter: drop-shadow(0 0 6px rgba(78, 204, 163, 0.4));
}

/* Add writing animation to the text elements in the icon */
.feature-card.active:nth-child(3):hover .card-icon svg text:nth-of-type(1) {
    animation: textWrite 1.2s ease-in-out infinite;
    transform-origin: center;
}

.feature-card.active:nth-child(3):hover .card-icon svg text:nth-of-type(2) {
    animation: textWrite 1.2s ease-in-out infinite 0.3s;
}

.feature-card.active:nth-child(3):hover .card-icon svg text:nth-of-type(3) {
    animation: textWrite 1.2s ease-in-out infinite 0.6s;
}

@keyframes clipboardGlow {
    0%, 100% { filter: drop-shadow(0 0 2px rgba(78, 204, 163, 0.2)); }
    50% { filter: drop-shadow(0 0 8px rgba(78, 204, 163, 0.6)); }
}

@keyframes textWrite {
    0% { opacity: 0; }
    30% { opacity: 0; }
    50% { opacity: 1; }
    100% { opacity: 1; }
}

/* Card 4: Heat Map Explorer — Color pulse through circles */
.feature-card.active:nth-child(4):hover .card-icon svg circle:nth-of-type(1) {
    animation: heatPulse 1s ease-in-out infinite;
}

.feature-card.active:nth-child(4):hover .card-icon svg circle:nth-of-type(2) {
    animation: heatPulse 1s ease-in-out infinite 0.2s;
}

.feature-card.active:nth-child(4):hover .card-icon svg circle:nth-of-type(3) {
    animation: heatPulse 1s ease-in-out infinite 0.4s;
}

@keyframes heatPulse {
    0%, 100% { stroke: #4ecca3; opacity: 0.6; }
    50% { stroke: #e94560; opacity: 1; }
}

/* Card 5: Data Sources — Cells highlight in sequence */
.feature-card.active:nth-child(5):hover .card-icon svg circle:nth-of-type(1) {
    animation: cellFlash 1s ease-in-out infinite;
}

.feature-card.active:nth-child(5):hover .card-icon svg circle:nth-of-type(2) {
    animation: cellFlash 1s ease-in-out infinite 0.3s;
}

@keyframes cellFlash {
    0%, 100% { fill: #4ecca3; opacity: 0.4; }
    50% { fill: #ffc107; opacity: 0.8; }
}

/* --- MOTION ACCESSIBILITY --- */
@media (prefers-reduced-motion: reduce) {
    .feature-card.active:hover {
        animation: none !important;
    }

    .feature-card.active:hover .card-icon svg * {
        animation: none !important;
    }
}

/* --- RESPONSIVE --- */
@media (max-width: 768px) {
    .feature-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 16px;
    }

    .home-title {
        font-size: 28px;
    }

    .feature-card {
        padding: 20px 16px;
        aspect-ratio: auto;
        min-height: 180px;
    }
}

@media (max-width: 480px) {
    .feature-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .feature-card {
        aspect-ratio: auto;
        min-height: 160px;
    }
}
