:root {
    /* Premium Architectural Palette */
    --surface: #ffffff;
    --background: #faf8f6; /* Warm off-white, editorial feel */
    --text-main: #0a0a0a;   /* Rich black */
    --text-muted: #4b5563;
    --accent: #000000;
    
    /* Brand Accents (Desaturated for subtlety) */
    --color-wiosna: #94c11f;
    --color-pelitech: #2563eb;
    --color-roket: #e11d48;
    --color-jotinvest: #fbbf24;
    --color-panarent: #d97706;
    --color-grupa: #009fe3;
    
    /* Typography - UPPED FOR IMPACT */
    --font-display: 'Manrope', sans-serif;
    --font-ui: 'Inter', sans-serif;

    /* Shadows: Complex 4-Layer Depth */
    --shadow-premium: 
        0 1px 3px rgba(0,0,0,0.02),
        0 10px 20px rgba(0,0,0,0.03),
        0 20px 40px rgba(0,0,0,0.04),
        0 40px 80px -20px rgba(0,0,0,0.08);
    
    --shadow-hover: 
        0 2px 5px rgba(0,0,0,0.05),
        0 15px 35px rgba(0,0,0,0.08),
        0 30px 60px rgba(0,0,0,0.1),
        0 60px 120px -30px rgba(0,0,0,0.15);

    /* Transitions: Heavy & Physics-based */
    --transition-slow: 0.8s cubic-bezier(0.2, 0.8, 0.2, 1);
    --transition-fast: 0.4s cubic-bezier(0.2, 0.8, 0.2, 1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-font-smoothing: antialiased;
}

body {
    background-color: var(--background);
    color: var(--text-main);
    font-family: var(--font-ui);
    min-height: 100vh;
    overflow-x: hidden;
}

/* ================================
   1. HEADER (EDITORIAL BILLBOARD)
=================================== */

.header {
    width: 100%;
    padding: 120px 0 100px 0;
    display: flex;
    justify-content: center;
    position: relative;
    text-align: center;
}

.header-container {
    max-width: 1400px;
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 0 60px;
}

.top-logo {
    width: 380px; 
    height: auto;
    aspect-ratio: 486 / 195;
    margin-bottom: 1.5rem; /* Reduced distance */
    filter: drop-shadow(0 4px 20px rgba(0,0,0,0.05));
    transition: transform var(--transition-slow);
}

.brand-description-header {
    font-family: var(--font-display);
    font-size: 1.1rem;
    line-height: 1.2;
    color: var(--text-muted);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    opacity: 0.6;
    margin-bottom: 1.25rem;
}

.sector-line-plain {
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    align-items: center;
    justify-content: center;
    gap: 1.5rem;
    margin-bottom: 3rem;
    white-space: nowrap;
}

.sector-item {
    font-size: 1.4rem;
    font-weight: 500;
    color: var(--text-main);
}

.sector-bullet {
    width: 4px;
    height: 4px;
    background: rgba(0,0,0,0.15);
    border-radius: 50%;
}

.header-instruction {
    font-family: var(--font-display);
    font-size: 0.95rem;
    font-weight: 800;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.3em;
    opacity: 0.4;
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.header-instruction::before,
.header-instruction::after {
    content: '';
    width: 60px;
    height: 1px;
    background: rgba(0,0,0,0.1);
}

/* ================================
   2. GRID SECTION
=================================== */

.brand-grid {
    max-width: 2500px;
    margin: 0 auto;
    padding: 0 60px 180px 60px;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    grid-auto-rows: 1fr; /* ENSURE GRID ROWS ARE EQUAL */
    gap: 4rem; 
}

/* ================================
   3. BRAND CARD (WIDE BANNER)
=================================== */

.brand-card {
    background: var(--surface);
    display: flex;
    flex-direction: row;
    padding: 0; 
    border-radius: 32px; 
    text-decoration: none;
    color: inherit;
    transition: transform var(--transition-slow), 
                box-shadow var(--transition-slow),
                background-color var(--transition-slow);
    box-shadow: var(--shadow-premium);
    position: relative;
    overflow: hidden;
    opacity: 0;
    transform: translateY(30px);
    animation: entrance 1s cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
    animation-delay: calc(var(--i) * 0.1s);
    border: 1px solid rgba(0,0,0,0.03);
    height: 100%; 
    min-height: 480px; /* ENFORCED MINIMUM HEIGHT FOR ALL TILES */
}

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

.brand-card:hover {
    transform: translateY(-16px) scale(1.02);
    box-shadow: var(--shadow-hover);
    background-color: var(--hover-tint, #fff);
}

/* Left side: Image */
.card-media {
    width: 42%;
    flex-shrink: 0; 
    position: relative;
    background: #f1f5f9;
    overflow: hidden;
    border-right: 1px solid rgba(0,0,0,0.02);
    height: auto; /* ALLOW PARENT TO DEFINE HEIGHT */
    min-height: 100%;
    aspect-ratio: 3 / 2;
}

.card-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 1.5s cubic-bezier(0.2, 0.8, 0.2, 1);
    filter: contrast(1.05) saturate(1.1);
    position: absolute;
    top: 0; left: 0;
}

.brand-card:hover .card-image {
    transform: scale(1.15);
}

/* Right side: Content */
.card-body {
    width: 58%;
    padding: 3.5rem; 
    display: flex;
    flex-direction: column;
    justify-content: flex-start; 
    position: relative;
    height: 100%;
}

.card-category {
    font-size: 0.85rem; 
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    color: var(--text-muted);
    margin-bottom: 2rem; 
    display: flex;
    align-items: center;
    gap: 0.75rem;
    height: 1.2rem; 
}

/* Brand Indicator Marker */
.card-category::before {
    content: '';
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--accent-color, var(--text-muted));
    box-shadow: 0 0 10px var(--accent-color);
    opacity: 0.8;
}

/* NEW: Horizontal Logo + Title Anchor */
.brand-anchor {
    display: flex;
    align-items: center;
    gap: 1.25rem;
    margin-bottom: 1.5rem;
    height: 45px; /* Locked row height */
}

.company-logo {
    display: block;
    height: 38px; /* Slightly scaled for side-by-side */
    width: auto;
    max-width: 120px;
    object-fit: contain;
    object-position: left;
    transition: transform var(--transition-fast);
}

.brand-card:hover .company-logo {
    transform: scale(1.08);
}

.brand-title {
    font-family: var(--font-display);
    font-size: 1.7rem; 
    font-weight: 800;
    color: var(--text-main);
    letter-spacing: -0.04em;
    line-height: 1.0; 
    margin: 0;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.brand-description {
    font-size: 1.05rem;
    color: var(--text-muted);
    line-height: 1.6;
    margin-bottom: 2.5rem;
    opacity: 0.8; 
    min-height: 3.2em; /* RESERVE SPACE FOR AT LEAST 2 LINES */
    overflow: visible; /* ALLOW WRAPPING */
}

/* CTA: Animated underline and arrow */
.card-footer {
    margin-top: auto; /* PUSH TO BOTTOM */
}

.btn-explore {
    display: inline-flex;
    align-items: center;
    gap: 1.2rem;
    font-weight: 900;
    font-size: 0.9rem; 
    color: var(--text-main);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    position: relative;
    padding-bottom: 6px;
}

.btn-explore::after {
    content: '';
    position: absolute;
    bottom: 0; left: 0;
    width: 30px;
    height: 3px; 
    background: var(--accent-color, var(--text-main));
    transition: width var(--transition-fast);
}

.brand-card:hover .btn-explore::after {
    width: 100%;
}

.arrow {
    width: 24px; 
    height: 2px;
    background: var(--accent-color, var(--text-main));
    position: relative;
    display: inline-block;
    transition: transform var(--transition-fast);
}

.arrow::after {
    content: '';
    position: absolute;
    right: 0; top: -5px;
    width: 10px; height: 10px;
    border-top: 2.5px solid var(--accent-color, var(--text-main));
    border-right: 2.5px solid var(--accent-color, var(--text-main));
    transform: rotate(45deg);
}

.brand-card:hover .arrow {
    transform: translateX(8px);
}

/* Brand Tints & Hovers */
.card-wiosna { 
    --accent-color: var(--color-wiosna); 
    --hover-tint: rgba(148, 193, 31, 0.03); 
}
.card-pelitech { 
    --accent-color: var(--color-pelitech); 
    --hover-tint: rgba(37, 99, 235, 0.03); 
}
.card-roket { 
    --accent-color: var(--color-roket); 
    --hover-tint: rgba(225, 29, 72, 0.03); 
}
.card-jotinvest { 
    --accent-color: var(--color-jotinvest); 
    --hover-tint: rgba(251, 191, 36, 0.03); 
}
.card-panarent { 
    --accent-color: var(--color-panarent); 
    --hover-tint: rgba(217, 119, 6, 0.03); 
}
.card-grupa { 
    --accent-color: var(--color-grupa); 
    --hover-tint: rgba(0, 159, 227, 0.03); 
}

/* ================================
   4. FOOTER
=================================== */

.footer {
    padding: 120px 0;
    background: #fff;
    border-top: 1px solid rgba(0,0,0,0.05);
}

.footer-content {
    max-width: 2500px;
    margin: 0 auto;
    padding: 0 60px;
    display: flex;
    justify-content: center;
}

.copyright {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-muted);
}

/* ================================
   5. RESPONSIVE OPTIMIZATIONS
=================================== */

/* ULTRA-WIDE & LARGE DESKTOP (Up to 2500px) */
@media (max-width: 2500px) {
    .brand-grid { max-width: 2100px; }
}

/* STANDARD DESKTOP -> LAPTOP (Transition to 2 Columns) */
@media (max-width: 1800px) {
    .brand-grid { 
        grid-template-columns: repeat(2, 1fr); 
        padding: 0 40px 140px 40px;
        gap: 3rem;
    }
    .card-body { padding: 3rem; }
    .brand-title { font-size: 1.6rem; }
}

/* TABLET (Transition to 1 Column / Header Wrapping) */
@media (max-width: 1200px) {
    .header { padding: 80px 0 60px 0; }
    .header-container { padding: 0 40px; }
    .top-logo { width: 320px; margin-bottom: 2rem; }
    
    .sector-line-plain { 
        flex-wrap: wrap; 
        gap: 1.25rem 2rem; 
        white-space: normal; 
        max-width: 800px;
    }
    
    .brand-grid { 
        grid-template-columns: 1fr; 
        gap: 4rem; 
        max-width: 900px; 
    }
    
    .brand-card { flex-direction: row; }
}

/* MOBILE LANDSCAPE & PHONES: LUXURY MINIMALIST */
@media (max-width: 768px) {
    .header { padding: 40px 0 20px 0; } /* Maximum breathing room */
    .header-container { padding: 0 24px; }
    .top-logo { width: 220px; margin-bottom: 2rem; }
    
    /* SLIM LUXURY MISSION STATEMENT */
    .brand-description-header { 
        font-size: 0.72rem; 
        margin-bottom: 1.5rem; 
        letter-spacing: 0.15em; 
        opacity: 0.5;
        line-height: 1.5;
        max-width: 280px; /* ENFORCE WRAP IN THE CENTER */
        display: block;
        margin-left: auto;
        margin-right: auto;
    }
    
    /* SECTOR LIST WRAPPING */
    .sector-line-plain { 
        flex-wrap: wrap; 
        gap: 0.5rem 0.75rem; 
        justify-content: center;
        overflow-x: visible;
        padding: 0;
        width: 100%;
    }
    .sector-line-plain::-webkit-scrollbar { display: none; } /* Kept for safety */
    
    .sector-item { font-size: 0.85rem; font-weight: 600; flex-shrink: 0; }
    .sector-bullet { width: 3px; height: 3px; opacity: 0.1; } /* Thinner bullets */
    
    /* HIDE DECORATIVE INSTRUCTION ON MOBILE FOR CLEANER ENTRY */
    .header-instruction { display: none; }

    .brand-grid { 
        grid-template-columns: 1fr; 
        gap: 1.5rem; 
        padding: 0 16px 80px 16px; 
    }
    
    /* COMPACT HORIZONTAL BANNERS ON MOBILE */
    .brand-card { 
        flex-direction: row; 
        min-height: auto; 
        border-radius: 20px; 
    }
    
    .card-media { 
        width: 35%; /* SHORTER IMAGE ON MOBILE */
        aspect-ratio: auto; 
        height: auto;
        min-height: 100%;
        border-right: 1px solid rgba(0,0,0,0.02);
        border-bottom: none;
    }
    
    .card-body { 
        width: 65%; 
        padding: 1.25rem; 
        gap: 0.25rem;
    }
    
    .card-category { font-size: 0.6rem; margin-bottom: 0.5rem; }

    .brand-anchor { 
        flex-direction: row; 
        align-items: center; 
        gap: 0.5rem; 
        margin-bottom: 0.5rem;
        height: auto;
    }
    
    .company-logo { height: 24px; }
    .brand-title { font-size: 1.1rem; }
    
    .brand-description { 
        font-size: 0.85rem; 
        line-height: 1.4; 
        margin-bottom: 1.2rem; 
        height: auto; 
        display: -webkit-box;
        -webkit-line-clamp: 3;
        line-clamp: 3;
        -webkit-box-orient: vertical;
        overflow: hidden;
    }

    .btn-explore { font-size: 0.75rem; gap: 0.4rem; }
    .arrow { width: 14px; }
}

/* ULTRA-SMALL DEVICES (Below 360px) */
@media (max-width: 360px) {
    .header { padding: 30px 0 15px 0; }
    .top-logo { width: 180px; }
    
    .sector-line-plain { gap: 1.2rem; padding: 0 20px 10px 20px; }
    .sector-item { font-size: 0.85rem; }

    .brand-grid { gap: 1rem; padding: 0 12px 60px 12px; }
    
    .card-media { width: 30%; }
    .card-body { width: 70%; padding: 1rem; }
    
    .brand-title { font-size: 1.0rem; }
    .brand-description { font-size: 0.8rem; }
}
