/* static/styles/blocks.css */

/* --- Grid of blocks --- */
.blocks-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, 300px);
    gap: 40px;
    justify-content: center;
    width: 100%;
    margin: 0 0 20px 0;
}

/* Preview override to 400px cards */
[id$='blocks-preview-projects'] .blocks-container {
    grid-template-columns: repeat(auto-fit, 400px);
}

/* --- Block card --- */

/*
   FIX: Add this rule to reset browser default styles for the new <a> tag,
   ensuring it looks the same as the old <div>.
*/
a.block, a.block:visited {
    color: inherit; /* Use the parent's text color (white) */
    text-decoration: none; /* Remove the underline */
}

.block {
    position: relative;
    aspect-ratio: 1 / 1;
    background-size: cover;
    background-position: center;
    border-radius: 8px;
    cursor: pointer;
    overflow: hidden;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.block:hover {
    transform: scale(1.05);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.3);
    z-index: 1000;
}

.block-info {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    padding: 10px 15px 15px 15px;
    box-sizing: border-box;
    background: rgba(0, 0, 0, 0.8);
    color: white;
    text-align: center;
    transition: background 0.3s ease;
}

.block:hover .block-info {
    background: rgba(0, 0, 0, 0.95);
}

/* Necessary override for global h3, p styles */
.block-info h3,
.block-info p {
    margin: 0;
    padding: 0;
    text-align: center;
}

.block-info h3 {
    margin-bottom: 5px;
}

/* --- Filter Components --- */
#block-filter-container {
    display: flex;
    flex-direction: column;
    gap: 15px;
    justify-content: center;
}

#filter-container {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: center;
    transition: max-height 0.4s ease-in-out;
    overflow-y: auto;
    padding-right: 10px;
}

#filter-container.is-expanded {
    overflow: hidden;
    padding-right: 0;
}

/* --- Filter chip styles --- */
.filter {
    padding: 10px 20px;
    font-size: 16px;
    font-weight: bold;
    color: #333;
    background-color: #f0f0f0;
    border: 2px solid transparent;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.3s ease;
    user-select: none;
}

.filter:hover {
    background-color: #ddd;
}

.filter.active {
    background-color: #007AFF;
    color: #fff;
    border-color: #0040DD;
}

.filter-count {
    opacity: 0.85;
}

/* --- Buttons --- */
.button-group {
    display: flex;
    justify-content: center;
    gap: 10px;
}

/* This class now only modifies the global .button style */
.expand-button {
    border-radius: 20px; /* Makes it pill-shaped */
}

/* Keyboard focus for accessibility */
.filter:focus-visible,
.expand-button:focus-visible {
    outline: 3px solid #0040DD;
    outline-offset: 2px;
    border-radius: 22px;
}

/* --- Animations --- */
.fade-in {
    animation: fade-in 0.3s ease forwards;
}

@keyframes fade-in {
    from { opacity: 0; transform: translateY(-4px); }
    to { opacity: 1; transform: translateY(0); }
}

.thumbnail img {
    display: block;
    margin: 0 auto;
    max-height: 500px;
    max-width: 90%;
    width: auto;
    height: auto;
    border-radius: 10px;
    object-fit: contain;
}