/* Common styles for all pages */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* Skip link for accessibility - visible only when focused */
.skip-link {
    position: absolute;
    top: -100%;
    left: 50%;
    transform: translateX(-50%);
    padding: 12px 24px;
    background: var(--accent-primary);
    color: white;
    text-decoration: none;
    font-weight: 600;
    border-radius: 0 0 8px 8px;
    z-index: 10000;
    transition: top 0.2s ease;
}

.skip-link:focus {
    top: 0;
    outline: 2px solid white;
    outline-offset: 2px;
}

:root {
    /* Fluid typography scale using clamp() */
    --font-size-xs: clamp(0.75rem, 0.7rem + 0.25vw, 0.875rem);
    --font-size-sm: clamp(0.875rem, 0.8rem + 0.35vw, 1rem);
    --font-size-base: clamp(1rem, 0.9rem + 0.5vw, 1.125rem);
    --font-size-lg: clamp(1.125rem, 1rem + 0.6vw, 1.25rem);
    --font-size-xl: clamp(1.25rem, 1.1rem + 0.75vw, 1.5rem);
    --font-size-2xl: clamp(1.5rem, 1.25rem + 1.25vw, 2rem);
    --font-size-3xl: clamp(2rem, 1.5rem + 2.5vw, 3rem);

    /* Fluid spacing scale */
    --space-xs: clamp(0.25rem, 0.2rem + 0.25vw, 0.5rem);
    --space-sm: clamp(0.5rem, 0.4rem + 0.5vw, 0.75rem);
    --space-md: clamp(1rem, 0.8rem + 1vw, 1.5rem);
    --space-lg: clamp(1.5rem, 1.2rem + 1.5vw, 2.5rem);
    --space-xl: clamp(2rem, 1.5rem + 2.5vw, 4rem);

    /* Light mode colors */
    --accent-primary: #5a3f9b;
    --accent-secondary: #844b9b;
    --accent-primary-on-dark: #7e4bff;
    --accent-secondary-on-dark: #d964ff;

    --bg-color-1: #f5f5f1;
    --bg-color-2: #2b1c4d;
    --bg-color-3: #4c3d6899;
    --bg-gradient-start: #333355;
    --bg-gradient-end: #666677;
    --bg-secondary: #f1f1f1;

    --nav-bg: rgba(255, 255, 255, 0.75);
    --nav-shadow: rgba(0, 0, 0, 0.1);
    --nav-link-color: #333;
    --nav-link-hover: #119d8e;

    --container-bg: #fff;
    --text-primary: #333;
    --text-primary-on-dark: #f5f5f1;
    --text-secondary: #666;
    --text-tertiary: #999;

    --card-bg: white;
    --card-bg-transparent: #f5f5f188;
    --card-border-transparent: #33333388;
    --card-shadow: rgba(0, 0, 0, 0.1);
    --card-hover-shadow: rgba(102, 126, 234, 0.3);

    --border-color: rgba(0, 0, 0, 0.1);
    --input-bg: #f0f0f0;
    --hover-bg: #f8f9ff;
    --hover-bg-alt: #eef1ff;

    --footer-bg-start: #111;
    --footer-bg-end: #333;
    --footer-text: white;
    --footer-overlay: rgba(255, 255, 255, 0.1);

    --error-bg: #ff4444;
    --loading-text: white;

    --badge-make-bg: #e8f0fe;
    --badge-make-text: #1a73e8;
    --badge-type-bg: #fef7e0;
    --badge-type-text: #f57c00;

    --comparison-above-bg: #d4edda;
    --comparison-above-text: #155724;
    --comparison-below-bg: #f8d7da;
    --comparison-below-text: #721c24;
    --comparison-equal-bg: #fff3cd;
    --comparison-equal-text: #856404;
}

@media (prefers-color-scheme: dark) {
    :root {
        /* Dark mode colors */
        --accent-primary: #7e4bff;
        --accent-secondary: #d964ff;
        
        --bg-color-1: #1a1a2e;
        --bg-color-2: #0f0f1e;
        --bg-color-3: #16213e99;
        --bg-gradient-start: #1a1a2e;
        --bg-gradient-end: #2d2d44;
        --bg-secondary: #2b2b2b;

        --nav-bg: rgba(30, 30, 45, 0.75);
        --nav-shadow: rgba(0, 0, 0, 0.5);
        --nav-link-color: #e0e0e0;
        --nav-link-hover: #00dac2;

        --container-bg: #1e1e2e;
        --text-primary: #e0e0e0;
        --text-secondary: #b0b0b0;
        --text-tertiary: #808080;

        --card-bg: #252535;
        --card-bg-transparent: #33333388;
        --card-border-transparent: #f5f5f188;
        --card-shadow: rgba(0, 0, 0, 0.3);
        --card-hover-shadow: rgba(139, 159, 255, 0.3);

        --border-color: rgba(255, 255, 255, 0.1);
        --input-bg: #2a2a3a;
        --hover-bg: #2d2d44;
        --hover-bg-alt: #353550;

        --footer-bg-start: #0a0a0a;
        --footer-bg-end: #1a1a1a;
        --footer-text: #e0e0e0;
        --footer-overlay: rgba(255, 255, 255, 0.05);

        --error-bg: #cc3333;
        --loading-text: #e0e0e0;

        --badge-make-bg: #1a2d4a;
        --badge-make-text: #6b9bdb;
        --badge-type-bg: #3a2e1a;
        --badge-type-text: #e89b5a;

        --comparison-above-bg: #1a3a24;
        --comparison-above-text: #6abd7a;
        --comparison-below-bg: #3a1a1a;
        --comparison-below-text: #d17a7a;
        --comparison-equal-bg: #3a3420;
        --comparison-equal-text: #c9b36e;
    }
}

body {
    font-family: 'Ubuntu', 'Segoe UI', Roboto, Oxygen, Cantarell, sans-serif;
    font-size: var(--font-size-base);
    min-height: 100vh;
    color: var(--text-primary);
    background-color: var(--bg-color-1);
}

h1, h2, h3, h4, h5, h6, .nav-links {
    font-family: 'Jost', 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    font-style: italic;
}

.label {
    font-family: "Oxanium";
}

.number {
    font-family: 'Inconsolata';
}

body.pattern {
    background: linear-gradient(135deg, var(--bg-gradient-start) 0%, var(--bg-gradient-end) 100%);
    background-color: var(--bg-color-1);
    background-image: linear-gradient(30deg, var(--bg-color-2) 12%, transparent 12.5%, transparent 87%, var(--bg-color-2) 87.5%, var(--bg-color-2)), linear-gradient(150deg, var(--bg-color-2) 12%, transparent 12.5%, transparent 87%, var(--bg-color-2) 87.5%, var(--bg-color-2)), linear-gradient(30deg, var(--bg-color-2) 12%, transparent 12.5%, transparent 87%, var(--bg-color-2) 87.5%, var(--bg-color-2)), linear-gradient(150deg, var(--bg-color-2) 12%, transparent 12.5%, transparent 87%, var(--bg-color-2) 87.5%, var(--bg-color-2)), linear-gradient(60deg, var(--bg-color-3) 25%, transparent 25.5%, transparent 75%, var(--bg-color-3) 75%, var(--bg-color-3)), linear-gradient(60deg, var(--bg-color-3) 25%, transparent 25.5%, transparent 75%, var(--bg-color-3) 75%, var(--bg-color-3));
    background-size: 20px 35px;
    background-position: 0 0, 0 0, 10px 18px, 10px 18px, 0 0, 10px 18px;
}

/* Common container */
.container {
    max-inline-size: 1400px;
    margin-inline: auto;
    padding: var(--space-md);
}

.container > section {
    /* background: var(--container-bg); */
    /* background-color: var(--card-bg); */
    /* box-shadow: 0 4px 15px var(--card-shadow); */

    border-radius: 16px;
    padding: 0;
    margin: 0 0 40px 0;
    color: var(--text-primary);
}

.container>section h2 {
    font-size: var(--font-size-2xl);
    margin-block-end: var(--space-md);
    color: var(--text-primary);
}

.container>section .section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.container>section .section-header h2 {
    margin-bottom: 0;
}

/* Loading spinner */
.loading {
    text-align: center;
    padding: 40px;
    color: var(--loading-text);
}

.spinner {
    border: 4px solid var(--border-color);
    border-top: 4px solid var(--loading-text);
    border-radius: 50%;
    width: 50px;
    height: 50px;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Error message */
.error-message {
    background: var(--error-bg);
    color: white;
    padding: 15px;
    border-radius: 8px;
    margin: 20px 0;
    text-align: center;
}

/* Shared paint card styles */
.paints-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: var(--space-lg);
    align-items: stretch;
    container-type: inline-size;
    container-name: paints-grid;
}

.paint-card {
    display: flex;
    flex-direction: column;
    background: var(--card-bg);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 12px var(--card-shadow);
    color: inherit;
    height: 100%;
}

.paint-image-link {
    display: block;
    text-decoration: none;
    overflow: hidden;
}

.paint-image-link:hover .paint-image img {
    transform: scale(1.05);
}

.paint-figure {
    margin: 0;
}

.paint-image {
    position: relative;
    width: 100%;
    aspect-ratio: 100 / 59;
    overflow: hidden;
    background: var(--input-bg);
}

.paint-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.paint-type-badge {
    position: absolute;
    top: 10px;
    right: 10px;
    background: var(--accent-primary);
    color: white;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 0.85em;
    font-weight: 600;
    opacity: 0.9;
}

.paint-info {
    padding: var(--space-md);
    display: flex;
    flex-direction: column;
    flex: 1;
}

.paint-title {
    font-size: var(--font-size-lg);
    margin-block-end: var(--space-sm);
    color: var(--text-primary);
    font-weight: 600;
    min-height: 3.6em; /* Reserve space for 3 lines */
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.paint-meta {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 12px;
}

.meta-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.9em;
    color: var(--text-secondary);
}

.meta-item .icon {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

.meta-item .user-link {
    color: var(--accent-primary);
    text-decoration: none;
    transition: color 0.3s ease;
}

.meta-item .user-link:hover {
    color: var(--accent-secondary);
    text-decoration: underline;
}

.paint-user {
    margin-bottom: 5px;
}

.paint-user .user-link {
    color: var(--accent-primary);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.3s ease;
}

.paint-user .user-link:hover {
    color: var(--accent-secondary);
    text-decoration: underline;
}

.paint-car {
    color: var(--accent-primary);
    font-weight: 500;
    margin-bottom: 5px;
}

.paint-date {
    color: var(--text-tertiary);
    font-size: 0.9em;
    margin-bottom: 10px;
}

.paint-car-info {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
    flex-wrap: wrap;
}

.car-make {
    background: var(--badge-make-bg);
    color: var(--badge-make-text);
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 0.85em;
    font-weight: 600;
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.car-type {
    background: var(--badge-type-bg);
    color: var(--badge-type-text);
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 0.85em;
    font-weight: 600;
}

.paint-stats {
    display: flex;
    gap: 15px;
    font-size: 0.95em;
    color: var(--text-secondary);
}

.paint-stats span,
.paint-stats .stat {
    display: flex;
    align-items: center;
    gap: 6px;
}

.paint-stats .stat .number {
    font-size: 1.2em;
}

.paint-stats .stat {
    font-weight: 600;
}

.paint-stats .icon {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

/* Container queries for responsive paint cards */
@container paints-grid (max-width: 600px) {
    .paint-card {
        /* Single column: slightly smaller padding */
    }
    .paint-info {
        padding: var(--space-sm);
    }
    .paint-title {
        font-size: var(--font-size-base);
        min-height: 3em;
    }
}

@container paints-grid (min-width: 900px) {
    .paint-card {
        /* Wide container: can show more detail */
    }
    .paint-stats {
        gap: var(--space-md);
    }
}

.logo-checkered-background {
    --color-1: #c5c5c5;
    --color-2: #d9d9d9;
    background-image:
        linear-gradient(45deg, var(--color-1) 26%, transparent 26%),
        linear-gradient(135deg, var(--color-1) 26%, transparent 26%),
        linear-gradient(45deg, transparent 75%, var(--color-1) 75%),
        linear-gradient(135deg, transparent 75%, var(--color-1) 75%);
    background-size: 20px 20px;
    background-color: var(--color-2);
}

.icon {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    /* Filter to color the icon to match text color */
    filter: brightness(0) saturate(100%) invert(20%) sepia(0%) saturate(0%) hue-rotate(0deg);
}

@media (prefers-color-scheme: dark) {
    .icon {
        /* Filter to make icons lighter in dark mode */
        filter: brightness(0) saturate(100%) invert(88%) sepia(0%) saturate(0%) hue-rotate(0deg);
    }
}

/* Footer */
.site-footer {
    background: linear-gradient(135deg, var(--footer-bg-start) 0%, var(--footer-bg-end) 100%);
    color: var(--footer-text);
    margin-block-start: var(--space-xl);
    padding-block: var(--space-lg) var(--space-md);
    padding-inline: var(--space-md);
}

.footer-content {
    max-inline-size: 1400px;
    margin-inline: auto;
}

.footer-disclaimer {
    background: var(--footer-overlay);
    border-radius: 12px;
    padding: 25px;
    margin-bottom: 30px;
}

.footer-disclaimer h3 {
    font-size: 1.5em;
    margin-bottom: 15px;
    color: var(--footer-text);
}

.footer-disclaimer p {
    font-size: 0.95em;
    line-height: 1.8;
    color: var(--footer-text);
    opacity: 0.95;
}

.footer-disclaimer a {
    color: var(--footer-text);
    font-weight: 600;
    text-decoration: underline;
    transition: opacity 0.3s ease;
}

.footer-disclaimer a:hover {
    opacity: 0.8;
}

.footer-copyright {
    text-align: center;
    padding-top: 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.2);
}

.footer-copyright p {
    font-size: 0.9em;
    opacity: 0.9;
}

.footer-copyright a {
    color: var(--footer-text);
    font-weight: 600;
    text-decoration: underline;
    transition: opacity 0.3s ease;
}

.footer-copyright a:hover {
    opacity: 0.8;
}

/* Responsive design */
@media (max-width: 768px) {
    .site-footer {
        margin-top: 40px;
        padding: 30px 15px 15px;
    }

    .footer-disclaimer {
        padding: 20px;
    }

    .footer-disclaimer h3 {
        font-size: 1.3em;
    }

    .footer-disclaimer p {
        font-size: 0.9em;
    }
}
