/* Reset and base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* Chaos mode: overlapping absolute-positioned images inside fixed viewport */
.cat-gallery.chaos {
    display: block;
    position: absolute;
    inset: 0;
    overflow: hidden;
    max-width: none;
    width: 100%;
    padding: 0;
}

.cat-gallery.chaos .cat-only-image {
    object-fit: cover;
    border-radius: 8px;
}

/* Prevent horizontal scroll globally */
html, body {
    overflow-x: hidden;
}

:root {
    --primary-color: #6b8bb6; /* softer blue */
    --secondary-color: #415b76; /* muted slate */
    --accent-color: #e98b7a; /* mellow coral */
    --light-color: #f2f5f8;
    --dark-color: #34495e;
    --text-color: #3a3a3a;
    --container-width: 1200px;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: var(--text-color);
    background-color: #f6f8fa;
}

.container {
    width: 100%;
    max-width: var(--container-width);
    margin: 0 auto;
    padding: 0 20px;
}

/* Header styles */
header {
    background-color: white;
    box-shadow: 0 6px 24px rgba(0, 0, 0, 0.05);
    position: fixed;
    width: 100%;
    top: 0;
    z-index: 1000;
}

header .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 20px;
}

header h1 {
    color: var(--primary-color);
    font-size: 1.8rem;
}

nav ul {
    display: flex;
    list-style: none;
}

nav ul li {
    margin-left: 2rem;
}

nav ul li a {
    text-decoration: none;
    color: var(--dark-color);
    font-weight: 500;
    transition: color 0.3s ease;
}

nav ul li a:hover,
nav ul li a.active {
    color: var(--accent-color);
}

/* Main content */
main {
    margin-top: 80px;
    padding: 2rem 20px;
}

/* Search Container */
.search-container {
    max-width: 1200px;
    margin: 0 auto 1.25rem;
    padding: 1rem;
    background: #ffffff;
    border-radius: 14px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.06);
    border: 1px solid rgba(0,0,0,0.05);
}

.search-controls {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
}

.search-controls input {
    padding: 0.7rem 1rem;
    border: 2px solid #e0e0e0;
    border-radius: 25px;
    font-size: 1rem;
    min-width: 250px;
    transition: border-color 0.3s;
}

.search-controls input:focus {
    outline: none;
    border-color: var(--primary-color);
}

.btn {
    padding: 0.65rem 1.25rem;
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    font-weight: 600;
    transition: background-color 0.25s ease, transform 0.15s ease, box-shadow 0.25s ease;
    text-transform: capitalize;
}

.btn:hover {
    background-color: var(--secondary-color);
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.08);
}

/* Cat Gallery */
.cat-gallery {
    max-width: 1200px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 2rem;
    padding: 0 1rem;
    /* Clip the chaos to the visible area */
    overflow: hidden;
    height: 100%;
    position: relative;
}

.cat-card {
    background: white;
    border-radius: 14px;
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.06);
    transition: transform 0.25s ease, box-shadow 0.25s ease;
    display: flex;
    flex-direction: column;
}

.cat-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 14px 40px rgba(0, 0, 0, 0.08);
}

.cat-card img {
    width: 100%;
    height: 220px;
    object-fit: cover;
    display: block;
}

.cat-info {
    padding: 1.2rem;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

.cat-info h3 {
    margin: 0 0 0.5rem 0;
    color: var(--secondary-color);
    font-size: 1.2rem;
}

.cat-info p {
    margin: 0;
    color: #666;
    font-size: 0.95rem;
    line-height: 1.5;
    flex-grow: 1;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .search-controls {
        flex-direction: column;
        align-items: stretch;
    }
    
    .search-controls input,
    .search-controls .btn {
        width: 100%;
    }
    
    .cat-gallery {
        grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    }
}

@media (max-width: 480px) {
    .cat-gallery {
        grid-template-columns: 1fr;
    }
}

/* Hero section */
.hero {
    text-align: center;
    padding: 3.5rem 0;
    background: linear-gradient(135deg, #f6f8fb 0%, #d9e2ef 100%);
    border-radius: 16px;
    margin-bottom: 2rem;
}

.hero h2 {
    font-size: 2.5rem;
    margin-bottom: 1rem;
    color: var(--secondary-color);
}

.hero p {
    font-size: 1.2rem;
    margin-bottom: 2rem;
    color: #666;
}

/* Button styles */
button, .btn {
    background-color: var(--primary-color);
    color: white;
    border: none;
    padding: 0.8rem 2rem;
    border-radius: 5px;
    cursor: pointer;
    font-size: 1rem;
    transition: background-color 0.3s ease, transform 0.2s ease;
}

button:hover, .btn:hover {
    background-color: var(--secondary-color);
    transform: translateY(-2px);
}

/* Features section */
.features {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
    margin-top: 2rem;
}

.feature-card {
    background: white;
    padding: 2rem;
    border-radius: 8px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.feature-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.15);
}

.feature-card h3 {
    color: var(--primary-color);
    margin-bottom: 1rem;
    font-size: 1.4rem;
}

/* Footer styles */
footer {
    background-color: var(--secondary-color);
    color: white;
    text-align: center;
    padding: 1.25rem 0;
    margin-top: 2.5rem;
}

/* Two-panel layout */
.layout-two-panel {
    display: grid;
    grid-template-columns: 300px 1fr;
    gap: 2rem;
    align-items: start;
}

.sidebar {
    position: sticky;
    top: 96px;
    height: fit-content;
}

.panel {
    background: #ffffff;
    border: 1px solid rgba(0,0,0,0.06);
    border-radius: 16px;
    padding: 1rem;
    box-shadow: 0 8px 28px rgba(0,0,0,0.05);
    margin-bottom: 1rem;
}

.panel-title {
    font-size: 1rem;
    color: var(--secondary-color);
    margin: 0 0 0.5rem 0;
    letter-spacing: 0.3px;
}

.content {
    position: relative;
    height: calc(100vh - 140px);
    min-height: 400px;
    /* Prevent viewing off-screen overflowed images */
    overflow: hidden;
}

@media (max-width: 980px) {
    .layout-two-panel {
        grid-template-columns: 1fr;
    }
    .sidebar {
        position: static;
        top: auto;
    }
}

/* Responsive design */
@media (max-width: 768px) {
    header .container {
        flex-direction: column;
        text-align: center;
    }
    
    nav ul {
        margin-top: 1rem;
    }
    
    nav ul li {
        margin: 0 0.5rem;
    }
    
    .hero h2 {
        font-size: 2rem;
    }
    
    .features {
        grid-template-columns: 1fr;
    }
}
