:root {
    --clr-bg: #f9f9f9;
    --clr-card: #fff;
    --clr-text: #333;
    --clr-secondary: rgb(197, 200, 211);
    --clr-shadow: rgba(0, 0, 0, 0.06);
    --clr-shadow-hover: rgba(0, 0, 0, 0.1);
}

body.dark {
    --clr-bg: #1f1f1f;
    --clr-card: #2c2c2c;
    --clr-text: #e1e1e1;
    --clr-secondary: rgb(152, 161, 188);
    --clr-shadow: rgba(0, 0, 0, 0.4);
    --clr-shadow-hover: rgba(0, 0, 0, 0.6);
}

/* Base Reset */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* Body */
body {
    font-family: "Segoe UI", sans-serif;
    background: var(--clr-bg);
    color: var(--clr-text);
    padding: 2rem;
    transition: background 0.3s, color 0.3s;
    max-width: 100vw;
    overflow-x: hidden;
}

/* Header */
header {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    align-items: center;
    text-align: center;
    margin-bottom: 3rem;
}

.header-main {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

/* Theme Toggle */
#theme-toggle {
    margin-top: 1rem;
    background: transparent;
    border: 2px solid var(--clr-text);
    padding: 0.5rem 1rem;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1rem;
    color: var(--clr-text);
    transition: background 0.3s, color 0.3s;
}

#theme-toggle:hover {
    background: var(--clr-text);
    color: var(--clr-bg);
}

/* Grid Layout */
.tool-grid {
    display: grid;
    gap: 1.5rem;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    align-items: stretch;
}

/* Tool Card */
.tool-card {
    background: var(--clr-card);
    color: inherit;
    text-decoration: none;
    padding: 1.5rem;
    border-radius: 12px;
    box-shadow: 0 4px 10px var(--clr-shadow);
    transition: transform 0.2s, box-shadow 0.2s, background 0.3s;

    display: flex;
    flex-direction: column;
    justify-content: space-between;
    min-height: 360px;
    height: 100%;
}

.tool-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 20px var(--clr-shadow-hover);
}

/* Image Preview */
.tool-preview-wrapper {
    width: 100%;
    height: 180px;
    max-width: 100%;
    border-radius: 10px;
    overflow: hidden;
    flex-shrink: 0;
}

.tool-preview {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 10px;
    transition: transform 0.4s ease;
    display: block;
}

.tool-card:hover .tool-preview {
    transform: scale(1.05);
}

/* Overlay Content */
.tool-card .overlay {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    padding: 1rem;
    border-radius: 10px;
    background-color: rgba(255, 255, 255, 0.7);
    -webkit-backdrop-filter: blur(4px);
    backdrop-filter: blur(4px);
    z-index: 1;
    position: relative;
}

body.dark .tool-card .overlay {
    background-color: rgba(20, 20, 20, 0.6);
}

/* Tool Header + Label */
.tool-header {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    flex-wrap: wrap;
    justify-content: center;
}

.tool-card h2 {
    font-size: 1.2rem;
    margin: 0;
    color: var(--clr-primary);
}

.tool-label {
    font-size: 0.75rem;
    text-transform: uppercase;
    font-weight: bold;
    padding: 0.2rem 0.6rem;
    border-radius: 6px;
    white-space: nowrap;
    background-color: var(--clr-secondary);
    color: var(--clr-text);
}

body.dark .tool-label {
    background-color: var(--clr-text);
    color: #1f1f1f;
}

/* Responsive Padding */
@media (max-width: 600px) {
    body {
        padding: 1rem 0.75rem;
    }
}


@media (min-width: 768px) {
    .tool-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (min-width: 1024px) {
    .tool-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (min-width: 1440px) {
    .tool-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}