/**
 * Service Icons Component
 *
 * Uses global colors from foundations/colors.css
 * Uses global typography from foundations/typography.css
 *
 * @package Kurpfalz_Theme
 * @author Saad Badr
 * @copyright 2025 SawatzkiMühlenbruch GmbH
 */

/* Service Icons Wrapper */
.services-wrapper {
    width: 100%;
    padding: var(--spacing-lg) 0;
}

/* Service Icons Section Heading - Uses global widget-headings.css */
.services-heading {
    margin-left: var(--margin-horizontal);
    margin-right: var(--margin-horizontal);
}

/* Services Grid Container */
.services-list {
    display: flex;
    flex-wrap: wrap;
    gap: var(--spacing-xl);
    margin-left: var(--margin-horizontal);
    margin-right: var(--margin-horizontal);
    margin-top: 0;
    margin-bottom: 0;
    padding: 0;
    justify-content: flex-start;
}

/* Service Card - Always Square */
.service-item-outer {
    /* Flexbox item settings */
    flex: 0 0 auto;

    /* Fixed width, height auto-calculated by aspect-ratio */
    width: 200px;
    height: 200px; /* Explicit height for better browser support */

    /* Visual styling */
    background-color: var(--color-white);
    box-shadow: 4px 4px 10px var(--color-shadow);
    border-bottom-right-radius: var(--border-radius-md);
    transition: box-shadow var(--transition-fast);

    /* Layout: Grid with 2 rows */
    display: grid;
    grid-template-rows: 1fr auto; /* Icon takes available space, title takes what it needs */
    grid-template-columns: 1fr;

    /* Typography */
    text-decoration: none;
    color: var(--color-primary);

    /* Box model */
    overflow: hidden;
    box-sizing: border-box;
}

/* Icon Container - First Grid Row */
.service-item-outer .service-item-icon {
    /* Grid child */
    grid-row: 1;

    /* Full width */
    width: 100%;

    /* Padding for spacing */
    padding: var(--spacing-md);
    box-sizing: border-box;

    /* Center icon with flexbox */
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Icon Image */
.service-item-outer .service-item-icon img {
    /* Constrain to container */
    max-width: 100%;
    max-height: 100%;

    /* Maintain aspect ratio */
    width: auto;
    height: auto;
    object-fit: contain;

    /* Display */
    display: block;
}

/* Title Container - Second Grid Row */
.service-item-outer .service-item-title {
    /* Grid child */
    grid-row: 2;

    /* Padding */
    padding: var(--spacing-xs) var(--spacing-sm) var(--spacing-sm) var(--spacing-sm);

    /* Typography */
    text-align: center;
    font-size: 1.1rem;
    line-height: 1.3;

    /* Inherits font-weight, font-family, color from parent */
}

/* Hover Effect - Only for Links */
.service-item-link:hover {
    box-shadow: 4px 4px 10px rgba(0, 0, 0, 0.4);
}

/* ============================================
   RESPONSIVE BREAKPOINTS
   ============================================ */

/* Tablet: 4 Spalten, 180x180px Cards */
@media (max-width: 1200px) {
    .service-item-outer {
        width: 180px;
        height: 180px;
    }

    .service-item-outer .service-item-title {
        font-size: 1rem;
    }
}

/* Small Tablet: 3 Spalten, 160x160px Cards */
@media (max-width: 900px) {
    .service-item-outer {
        width: 160px;
        height: 160px;
    }

    .services-list {
        gap: var(--spacing-lg);
    }

    .service-item-outer .service-item-title {
        font-size: 0.95rem;
    }
}

/* Mobile: 3 Spalten, 120x120px Cards */
@media (max-width: 640px) {
    .service-item-outer {
        width: 120px;
        height: 120px;
    }

    .services-list {
        gap: var(--spacing-md);
    }

    .service-item-outer .service-item-icon {
        padding: var(--spacing-xs);
    }

    .service-item-outer .service-item-title {
        font-size: 0.85rem;
        padding: 0 var(--spacing-xs) var(--spacing-xs) var(--spacing-xs);
    }
}

/* Small Mobile: 3 Spalten, 100x100px Cards */
@media (max-width: 480px) {
    .service-item-outer {
        width: 100px;
        height: 100px;
    }

    .services-list {
        gap: var(--spacing-sm);
    }

    .service-item-outer .service-item-icon {
        padding: var(--spacing-xs) var(--spacing-xs) 0 var(--spacing-xs);
    }

    .service-item-outer .service-item-title {
        font-size: 0.7rem;
        padding: 0 2px var(--spacing-xs) 2px;
        line-height: 1.1;
    }
}

