/* ═══════════════════════════════════════════════════════════════
   ANTIGRAVITY — Card Component
   Source: card_flip.html (CSS verbatim) + PRD §9
   Used in: Home hero (scroll-driven), Projects (hover), Experience (hover)
═══════════════════════════════════════════════════════════════ */

/* ── 1. Container — 3D Perspective ───────────────────────────── */
.card-container {
    position: relative;
    perspective: 2000px;
    /* Identical to card_flip.html source */
}

/* ── 2. The Rotating Card ────────────────────────────────────── */
.card {
    width: 100%;
    height: 100%;
    position: relative;
    transform-style: preserve-3d;
    transition: transform var(--duration-flip) ease;
    /* --duration-flip: 700ms — locked value from card_flip.html: 0.7s */
    will-change: transform;
}

/* ── 3. Hover-Triggered Flip (timeline cards only) ───────────── */
/* PRD §9.2 — hover flip applies to project & experience cards,
   NOT the home hero card (which is scroll-driven) */
.card-container:hover .card {
    transform: rotateY(180deg);
}

/* Disable hover flip AND CSS transition on home hero card —
   scroll-anim.js controls it entirely via rAF lerp */
#homeCardContainer .card {
    transition: none;
}

#homeCardContainer:hover .card {
    transform: unset;
}

/* ── 4. Card Faces — Front & Back ────────────────────────────── */
.card-face {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    /* Identical to card_flip.html source */
    -webkit-backface-visibility: hidden;
    /* Safari */
    border-radius: var(--radius-xl);
    /* 28px */
    overflow: hidden;
    box-shadow: var(--shadow-card);
    box-sizing: border-box;
}

/* ── 5. Front Face ───────────────────────────────────────────── */
.card-front {
    transform: rotateY(0deg);
    display: flex;
    flex-direction: column;
    background: linear-gradient(180deg,
            var(--color-bg) 0%,
            var(--color-bg-card) 100%);
}

/* Front face content overlay (name, designation at bottom) */
.card-front-content {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: var(--space-6);
    padding-top: 2.5rem;
    background: linear-gradient(to top,
            rgba(74, 0, 106, 0.85) 0%,
            transparent 100%);
}

.card-front-content .card-title {
    color: #FFFFFF;
}

.card-front-content .card-subtitle {
    color: rgba(255, 255, 255, 0.75);
}

/* Front face image (owner photo) */
.card-front .card-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* ── 6. Back Face ────────────────────────────────────────────── */
.card-back {
    transform: rotateY(180deg);
    /* Pre-flipped — identical to source */
    background: var(--color-bg-card);
    padding: var(--space-6);
    display: flex;
    flex-direction: column;
}

/* ── 7. Card Content Elements ────────────────────────────────── */
.card-number, .project-number {
    font-family: var(--font-mono);
    font-weight: 500;
    font-size: var(--text-xs);
    color: var(--color-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.12em;
    margin-bottom: 0.5rem !important;
}

.card-title {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: var(--text-xl);
    color: var(--color-text);
    line-height: 1.2;
    margin: 0 0 var(--space-2) 0;
}

.card-subtitle {
    font-family: var(--font-body);
    font-size: var(--text-sm);
    color: var(--color-text-muted);
    margin: 0;
    line-height: 1.5;
}

.card-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: var(--space-3);
}

.card-summary {
    font-family: var(--font-body);
    font-size: var(--text-sm);
    color: var(--color-text);
    line-height: 1.65;
    margin-top: var(--space-3);
    flex: 1;
}

/* "View Details →" link at bottom of back face */
.card-detail-link {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    font-family: var(--font-body);
    font-weight: 600;
    font-size: var(--text-sm);
    color: var(--color-accent);
    margin-top: auto;
    padding-top: var(--space-4);
    text-decoration: none;
    transition: gap var(--duration-fast) ease;
}

.card-detail-link:hover {
    gap: var(--space-3);
    /* Arrow moves right on hover */
}

/* ── 8. Pulse Animation — Home Card Front ────────────────────── */
/* Adapted from card_flip.html — 5 concentric rings, rose gold recolor */
.pulse-container {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.pulse-ring {
    position: absolute;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: rgba(232, 115, 90, 0.08);
    /* Rose gold, low opacity */
    animation: pulseGlow 3s linear infinite;
    opacity: 0;
}

/* Stagger delays — identical pattern to card_flip.html source */
.pulse-ring:nth-child(1) {
    animation-delay: 0s;
}

.pulse-ring:nth-child(2) {
    animation-delay: 0.3s;
}

.pulse-ring:nth-child(3) {
    animation-delay: 0.6s;
}

.pulse-ring:nth-child(4) {
    animation-delay: 0.9s;
}

.pulse-ring:nth-child(5) {
    animation-delay: 1.2s;
}

/* ── 9. Touch Device Support — PRD §11.5 ─────────────────────── */
/* Flip via tap/click on touch devices (class toggled by JS) */
.card-container.is-flipped .card {
    transform: rotateY(180deg);
}

/* ── 10. Timeline Card Sizing ────────────────────────────────── */
/* Standard card size for project/experience timelines */
.timeline-card .card-container {
    width: 100%;
    height: 380px;
}

/* ── 11. Home Hero Card Sizing ───────────────────────────────── */
#homeCardContainer {
    position: absolute;
    top: 50%;
    left: 50%;
    /* Starts center — JS moves it */
    transform: translate(-50%, -50%);
    width: 320px;
    height: 460px;
    z-index: 10;
}

/* ═══════════════════════════════════════════════════════════════
   RESPONSIVE — Design Doc §13.1
═══════════════════════════════════════════════════════════════ */

@media (max-width: 1023px) {
    #homeCardContainer {
        width: 280px;
        height: 400px;
    }
}

@media (max-width: 639px) {

    /* On mobile, home card is fixed center, no scroll movement */
    #homeCardContainer {
        position: relative;
        top: auto;
        left: auto;
        transform: none;
        margin: 0 auto var(--space-8);
        width: 260px;
        height: 370px;
    }

    .timeline-card .card-container {
        height: 340px;
    }
}