/* --- ID COMPONENTS GLOBAL HUB STYLES --- */

:root {
    --brand-purple: #5E548E;
    --charcoal: #2b2b2b;
    --light-gray: #f8f9fa;
    --border-color: rgba(0, 0, 0, 0.06);
    --pure-white: #ffffff;
    --dark-gray: #555555;
}

body {
    background-color: #f4f5f7; /* Gives a slightly darker page contrast so white cards pop beautifully */
    margin: 0;
    padding: 0;
}

/* Hero Section Branding */
.components-hero {
    text-align: center;
    padding: 80px 4% 50px 4%;
    background-color: var(--pure-white);
    border-bottom: 1px solid var(--border-color);
}

.components-hero h1 {
    font-family: var(--font-heading), sans-serif;
    font-size: 2.2rem;
    color: var(--charcoal);
    margin-bottom: 12px;
}

.hero-subtitle {
    font-family: var(--font-body), sans-serif;
    font-size: 1.1rem;
    color: #666666;
    max-width: 700px;
    margin: 0 auto;
    line-height: 1.6;
}

/* Cards Wrapper Main Box Container */
.components-container {
    max-width: 1100px;
    margin: 50px auto 100px auto;
    padding: 0 20px;
    display: flex;
    flex-direction: column;
    gap: 40px; /* Space between each project block */
}

/* The Premium Component Card Structure Layout */
.component-card {
    background: var(--pure-white);
    border-radius: 12px;
    border: 1px solid var(--border-color);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.02);
    overflow: hidden;
    scroll-margin-top: 100px; /* Crucial: Leaves perfect padding at top when anchor scrolling from case study! */
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.component-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 30px rgba(94, 84, 142, 0.08);
}

/* --- FULL-WIDTH STACKED LAYOUT GRID --- */
.component-grid {
    display: flex;
    flex-direction: column; /* Forces everything to stack cleanly: Player on top, text details on bottom */
    width: 100%;
}

/* Expanded Image Preview Block Frame */
.component-preview {
    background-color: var(--light-gray);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 30px; /* Generous padding framing your blueprint */
    border-bottom: 1px solid var(--border-color); /* Separates the image from text underneath */
    overflow: hidden;
}

.preview-img {
    width: 100%;
    max-width: 900px; /* Prevents the image from stretching too wide on massive desktop screens */
    height: auto;
    border-radius: 8px;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.08);
    transition: transform 0.3s ease;
}

.component-card:hover .preview-img {
    transform: scale(1.015); /* Subtle hover lift */
}

/* Text Detail Workspace Section Adjustment */
.component-details {
    padding: 40px;
    display: flex;
    flex-direction: column;
    box-sizing: border-box;
    width: 100%;
}

.project-tag {
    font-family: var(--font-body), sans-serif;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: var(--brand-purple);
    font-weight: bold;
    margin-bottom: 8px;
}

.component-details h2 {
    font-family: var(--font-heading), sans-serif;
    font-size: 1.5rem;
    color: var(--charcoal);
    margin: 0 0 16px 0;
}

.component-description {
    font-family: var(--font-body), sans-serif;
    font-size: 0.98rem;
    color: var(--dark-gray);
    line-height: 1.6;
    margin: 0;
}

/* --- PROBLEM / SOLUTION 2-COLUMN DISPLAY ENGINE --- */
.case-meta-row {
    margin: 24px 0 30px 0;
    display: flex;
    flex-direction: column; /* Stacked by default on smaller mobile screens */
    gap: 20px;
    width: 100%;
}

.meta-col {
    flex: 1;
}

.meta-label {
    font-size: 0.95rem;
    line-height: 1.6;
    color: var(--dark-gray);
    margin: 0;
}

.meta-label strong {
    color: var(--brand-purple);
    font-weight: 700;
    display: block; /* Places the labels cleanly on their own line above the descriptions */
    margin-bottom: 6px;
}

/* Desktop Transformation: Splits Problem & Solution into 2 Columns */
@media (min-width: 768px) {
    .case-meta-row {
        flex-direction: row; /* Triggers the clean side-by-side split on desktop layouts */
        gap: 40px; /* Gives beautiful breathing space between columns */
    }
}

/* --- THE DUAL ACTION CONTROLS BUTTON SYSTEM --- */
.component-actions {
    display: inline-flex;
    align-items: center;
    justify-content: flex-start; /* Keeps buttons left-justified underneath your text columns */
    gap: 16px;
    margin-top: auto;
    width: 100%;
}

/* High-Contrast Accent Primary Call to Action Button */
.btn-primary {
    background-color: var(--brand-purple);
    color: var(--pure-white) !important;
    font-family: var(--font-body), sans-serif;
    font-size: 0.95rem;
    font-weight: 600;
    text-decoration: none;
    padding: 12px 24px;
    border-radius: 6px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    box-shadow: 0 4px 12px rgba(94, 84, 142, 0.15);
    transition: all 0.2s ease;
}

.btn-primary:hover {
    background-color: #4a4173; /* Darkens slightly for accessible hover change state */
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(94, 84, 142, 0.25);
}

.btn-icon {
    font-size: 0.85rem;
    transition: transform 0.2s ease;
}

.btn-primary:hover .btn-icon {
    transform: translate(2px, -2px);
}

/* Subtle Structural Secondary Navigation Context Link */
.btn-secondary {
    color: #666666 !important;
    font-family: var(--font-body), sans-serif;
    font-size: 0.95rem;
    font-weight: 500;
    text-decoration: none;
    padding: 12px 20px;
    border-radius: 6px;
    border: 1px solid rgba(0,0,0,0.15);
    transition: all 0.2s ease;
}

.btn-secondary:hover {
    color: var(--charcoal) !important;
    background-color: var(--light-gray);
    border-color: rgba(0,0,0,0.3);
}

/* Responsive Media Controls Layout for Tablets/Mobile */
@media (max-width: 850px) {
    .component-actions {
        flex-direction: column;
        align-items: stretch; /* Forces buttons to span full width layout on small phone boundaries */
        gap: 12px;
    }
    .btn-primary, .btn-secondary {
        text-align: center;
        justify-content: center;
    }
}

/* --- INLINE CARD CAROUSEL ARCHITECTURE (NO OVERHANG FIX) --- */

.component-preview-carousel {
    background-color: var(--light-gray);
    position: relative;
    padding: 30px 0; /* Clear out horizontal padding to let the track manage the width cleanly */
    border-bottom: 1px solid var(--border-color);
    overflow: hidden; /* This acts as the structural scissors, cutting off any overhang */
    width: 100%;
    box-sizing: border-box;
}

/* Slide track setup based on 3 panels (300% total width) */
.card-carousel-slides {
    display: flex;
    width: 300%;
    transition: transform 0.45s cubic-bezier(0.4, 0, 0.2, 1);
}

.card-carousel-slide {
    width: 33.3333%;
    display: flex;
    justify-content: center;
    align-items: center;
    box-sizing: border-box;
    padding: 0 60px; /* Gives your document breathing room away from the side arrow buttons */
}

/* Keep the image bounded perfectly within the single slide frame */
.card-carousel-slide .preview-img {
    max-width: 100%;
    height: auto;
    display: block;
    border-radius: 8px;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.08);
}

/* Slide Translation Mechanics */
#comm-p1:checked ~ .comm-slide-track { transform: translateX(0%); }
#comm-p2:checked ~ .comm-slide-track { transform: translateX(-33.3333%); }
#comm-p3:checked ~ .comm-slide-track { transform: translateX(-66.6666%); }

#onboard-p1:checked ~ .onboard-slide-track { transform: translateX(0%); }
#onboard-p2:checked ~ .onboard-slide-track { transform: translateX(-33.3333%); }
#onboard-p3:checked ~ .onboard-slide-track { transform: translateX(-66.6666%); }

/* --- MASTER CSS ARROWS CONTROLLER ENGINE --- */
.carousel-arrows {
    position: absolute;
    top: 50%;
    left: 15px;
    right: 15px;
    transform: translateY(-50%);
    display: none; /* Hide all arrow layouts by default */
    justify-content: space-between;
    pointer-events: none;
    z-index: 4;
}

/* Force Slide 1 and Slide 3 layout panels to push single buttons to their respective correct side edges */
.carousel-arrows[class*="-arrows-1"] { justify-content: flex-end; }
.carousel-arrows[class*="-arrows-3"] { justify-content: flex-start; }

/* Visibility Rules: Only display the arrow container matching the active radio option */
#comm-p1:checked ~ .comm-arrows-1,
#comm-p2:checked ~ .comm-arrows-2,
#comm-p3:checked ~ .comm-arrows-3 { display: flex; }

#onboard-p1:checked ~ .onboard-arrows-1,
#onboard-p2:checked ~ .onboard-arrows-2,
#onboard-p3:checked ~ .onboard-arrows-3 { display: flex; }

/* Arrow Button Graphics */
.arrow {
    background-color: rgba(255, 255, 255, 0.95);
    color: var(--brand-purple);
    width: 38px;
    height: 38px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.95rem;
    font-weight: bold;
    cursor: pointer;
    box-shadow: 0 3px 10px rgba(0,0,0,0.12);
    transition: all 0.2s ease;
    pointer-events: auto;
    user-select: none;
}

.arrow:hover {
    background-color: var(--brand-purple);
    color: var(--pure-white);
    transform: scale(1.08);
}

/* Carousel Navigation Indicator Dots Setup */
.card-carousel-dots {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-top: 20px;
    position: relative;
    z-index: 5;
}

.c-dot {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background-color: rgba(94, 84, 142, 0.2);
    cursor: pointer;
    transition: background-color 0.2s ease, transform 0.2s ease;
}

.c-dot:hover {
    background-color: rgba(94, 84, 142, 0.4);
}

/* Active Dot States Matrix for Card 1 */
#comm-p1:checked ~ .card-carousel-dots .comm-dot-1,
#comm-p2:checked ~ .card-carousel-dots .comm-dot-2,
#comm-p3:checked ~ .card-carousel-dots .comm-dot-3 {
    background-color: var(--brand-purple);
    transform: scale(1.2);
}

/* Active Dot States Matrix for Card 2 */
#onboard-p1:checked ~ .card-carousel-dots .onboard-dot-1,
#onboard-p2:checked ~ .card-carousel-dots .onboard-dot-2,
#onboard-p3:checked ~ .card-carousel-dots .onboard-dot-3 {
    background-color: var(--brand-purple);
    transform: scale(1.2);
}

/* --- LIVE IFRAME VIEWPORT BUILD ARCHITECTURE --- */

.component-iframe-wrapper {
    position: relative;
    width: 100%;
    padding-top: 56.25%; /* Perfect 16:9 widescreen layout lock across all devices */
    background-color: var(--light-gray);
    border-bottom: 1px solid var(--border-color);
    overflow: hidden;
}

/* Fallback/Loading background indicator rules for frames */
#build-onboarding .component-iframe-wrapper { background: #f4f4f6 url('../assets/preview-build-onboarding.png') center/cover no-repeat; }
#build-communication .component-iframe-wrapper { background: #f4f4f6 url('../assets/preview-build-communication.png') center/cover no-repeat; }
#challenge-dropdown .component-iframe-wrapper { background: #f4f4f6 url('../assets/preview-build-dropdown.png') center/cover no-repeat; }
#challenge-scoring .component-iframe-wrapper { background: #f4f4f6 url('../assets/preview-build-scoring.png') center/cover no-repeat; }
#challenge-accordion .component-iframe-wrapper { background: #f4f4f6 url('../assets/preview-build-accordion.png') center/cover no-repeat; }

.component-iframe-wrapper iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: none;
    z-index: 2;
}