/* Card-Based Component System
 * Each card is a self-contained unit with its own coordinate system
 * Cards scale proportionally and maintain internal relationships
 */

/* Base Card Container */
.card {
    /* Cards are isolated positioning contexts */
    position: relative;
    width: 100%;
    height: 100%;
    
    /* Contain all children */
    overflow: hidden;
    
    /* Smooth transitions */
    transition: transform 0.3s ease;
}

/* Card with fixed aspect ratio */
.card--square {
    aspect-ratio: 1 / 1;
}

.card--portrait {
    aspect-ratio: 3 / 4;
}

.card--landscape {
    aspect-ratio: 16 / 9;
}

/* Card scaling container - maintains proportions */
.card-scaler {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    
    /* Default size - will scale based on viewport */
    width: min(90vw, 90vh);
    height: min(90vw, 90vh);
    
    /* For non-square cards */
    max-width: 600px;
    max-height: 600px;
}

/* Navigation Card - 4 domains around center */
.card--navigation {
    /* Internal coordinate system using percentages */
    --card-size: 100%;
    --center: 50%;
    --radius: 35%; /* 35% of card size */
    --item-size: 20%; /* Domain circles are 20% of card */
}

.card--navigation .card-center {
    position: absolute;
    top: var(--center);
    left: var(--center);
    width: 25%;
    height: 25%;
    transform: translate(-50%, -50%);
    
    /* Visual styling */
    border-radius: 50%;
    background: rgba(251, 191, 36, 0.1);
    border: 2px solid rgba(251, 191, 36, 0.4);
    
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.card--navigation .card-item {
    position: absolute;
    top: var(--center);
    left: var(--center);
    width: var(--item-size);
    height: var(--item-size);
    
    /* Center the item on its position */
    margin-left: calc(var(--item-size) / -2);
    margin-top: calc(var(--item-size) / -2);
    
    /* Position on circle using transform */
    transform: 
        rotate(var(--angle))
        translateY(calc(var(--radius) * -1))
        rotate(calc(0deg - var(--angle)));
    
    /* Visual styling */
    border-radius: 50%;
    border: 2px solid var(--color, #fff);
    background: rgba(255, 255, 255, 0.1);
    cursor: pointer;
    transition: all 0.3s ease;
    
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
}

/* Set angles for quadrant layout */
.card--navigation .card-item:nth-child(2) { --angle: 45deg; --color: #fbbf24; }  /* NE - Foundation */
.card--navigation .card-item:nth-child(3) { --angle: 135deg; --color: #60a5fa; } /* SE - Perception */
.card--navigation .card-item:nth-child(4) { --angle: 225deg; --color: #f87171; } /* SW - Emotional */
.card--navigation .card-item:nth-child(5) { --angle: 315deg; --color: #a78bfa; } /* NW - Integration */

/* Domain View Card */
.card--domain {
    --center: 50%;
    --main-size: 30%;
    --focus-radius: 30%;
    --focus-size: 18%;
}

.card--domain .domain-main {
    position: absolute;
    top: 20%;
    left: var(--center);
    width: var(--main-size);
    height: var(--main-size);
    transform: translateX(-50%);
    
    border-radius: 50%;
    border: 3px solid var(--domain-color);
    background: rgba(255, 255, 255, 0.1);
    
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2em;
    font-weight: bold;
}

.card--domain .focus-container {
    position: absolute;
    top: 60%;
    left: var(--center);
    width: calc(var(--focus-radius) * 2);
    height: calc(var(--focus-radius) * 2);
    transform: translate(-50%, -50%);
}

.card--domain .focus-item {
    position: absolute;
    top: 50%;
    left: 50%;
    width: var(--focus-size);
    height: var(--focus-size);
    margin-left: calc(var(--focus-size) / -2);
    margin-top: calc(var(--focus-size) / -2);
    
    transform: 
        rotate(var(--angle))
        translateY(calc(var(--focus-radius) * -1))
        rotate(calc(0deg - var(--angle)));
    
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.5);
    background: rgba(255, 255, 255, 0.1);
    
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
}

/* Triangle layout for 3 focuses */
.card--domain .focus-item:nth-child(1) { --angle: 0deg; }
.card--domain .focus-item:nth-child(2) { --angle: 120deg; }
.card--domain .focus-item:nth-child(3) { --angle: 240deg; }

/* FAST Methodology Card */
.card--fast {
    --center: 50%;
    --item-spacing: 25%;
}

.card--fast .fast-container {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 80%;
    height: 80%;
    transform: translate(-50%, -50%);
    
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-rows: 1fr 1fr;
    gap: 5%;
}

.card--fast .fast-item {
    position: relative;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.3);
    background: rgba(255, 255, 255, 0.05);
    
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
}

.card--fast .fast-item:hover {
    border-color: rgba(251, 191, 36, 0.6);
    background: rgba(251, 191, 36, 0.1);
    transform: scale(1.05);
}

.card--fast .fast-label {
    font-size: 1.5em;
    font-weight: bold;
    margin-bottom: 0.2em;
}

.card--fast .fast-text {
    font-size: 0.8em;
    opacity: 0.7;
    text-align: center;
    padding: 0 10%;
}

/* Responsive scaling for different viewports */
@media (max-width: 768px) {
    .card-scaler {
        width: min(95vw, 95vh);
        height: min(95vw, 95vh);
    }
    
    .card--navigation {
        --radius: 38%;
        --item-size: 22%;
    }
}

@media (min-width: 1024px) {
    .card-scaler {
        width: min(80vw, 80vh);
        height: min(80vw, 80vh);
        max-width: 800px;
        max-height: 800px;
    }
}

/* Card transitions */
.card-enter {
    opacity: 0;
    transform: scale(0.9);
}

.card-enter-active {
    opacity: 1;
    transform: scale(1);
    transition: all 0.3s ease;
}

.card-exit {
    opacity: 1;
    transform: scale(1);
}

.card-exit-active {
    opacity: 0;
    transform: scale(0.9);
    transition: all 0.3s ease;
}

/* Debug mode - visualize card boundaries */
.card--debug {
    border: 2px dashed rgba(255, 0, 0, 0.5);
}

.card--debug::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    height: 1px;
    background: rgba(255, 0, 0, 0.2);
}

.card--debug::after {
    content: '';
    position: absolute;
    left: 50%;
    top: 0;
    bottom: 0;
    width: 1px;
    background: rgba(255, 0, 0, 0.2);
}