/* ============================
   Base Styles
============================ */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

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

body {
    font-family: 'Inter', sans-serif;
    background-color: #f9fafb;
    color: #111827;
    line-height: 1.6;
    font-size: 0.95rem;
    /* slightly larger for readability */
    transition: background-color 0.3s ease, color 0.3s ease;
}

a {
    text-decoration: none;
    color: #3b82f6;
}

h1,
h2,
h3,
h4 {
    color: #111827;
    font-weight: 600;
}

/* ============================
   Header
============================ */
header {
    background-color: #ffffff;
    padding: 1.2rem 2.5rem;
    /* slightly larger padding */
    border-bottom: 1px solid #e5e7eb;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: background-color 0.3s ease, border-color 0.3s ease;
}

header h1 {
    font-size: 1.8rem;
    /* 30% bigger */
    font-weight: 700;
}

header nav a {
    margin-left: 1.2rem;
    font-weight: 500;
    transition: color 0.2s ease;
}

header nav a:hover {
    color: #2563eb;
}

/* Dark Mode Toggle Button in Header Nav */
.dark-mode-toggle {
    margin-left: 1.2rem;
    background-color: #3b82f6;
    color: white;
    border: none;
    padding: 0.5rem 0.9rem;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 500;
    font-size: 0.9rem;
    transition: background-color 0.2s ease, color 0.2s ease;
    user-select: none;
}

.dark-mode-toggle:hover {
    background-color: #2563eb;
}

/* ============================
   Footer
============================ */
footer {
    text-align: center;
    padding: 1.8rem 0;
    font-size: 0.9rem;
    /* slightly larger */
    color: #6b7280;
    border-top: 1px solid #e5e7eb;
    margin-top: 3.5rem;
    transition: border-color 0.3s ease, color 0.3s ease;
}

/* ============================
   Main Content
============================ */
main {
    max-width: 1560px;
    /* 1200px × 1.3 = 1560px for 30% wider */
    margin: 0 auto;
    padding: 2.5rem;
}

/* ============================
   Tools Grid - FIXED COLUMN WIDTHS
============================ */
.tools-grid {
    display: grid;
    /* Increase minimum width for better column size */
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 2rem;
    margin-top: 2.5rem;
}

/* ============================
   Tool Cards
============================ */
.tool-card {
    background-color: #ffffff;
    padding: 1.6rem;
    /* larger padding for spacious feel */
    border-radius: 14px;
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.08);
    /* slightly deeper shadow */
    text-align: center;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    width: 100%;
    /* fill the grid column */
}

.tool-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.12);
}

.tool-card svg {
    width: clamp(36px, 5vw, 52px);
    height: clamp(50px, 7vw, 73px);
    margin-bottom: 1rem;
    fill: #3b82f6;
}

.tool-card h3 {
    font-size: 1.3rem;
    /* bigger for clarity */
    margin-bottom: 0.6rem;
}

.tool-card p {
    font-size: 0.95rem;
    color: #6b7280;
}

/* ============================
   Textareas & Inputs
============================ */
textarea,
input {
    width: 100%;
    padding: 0.85rem 1rem;
    /* bigger padding */
    margin-top: 0.6rem;
    margin-bottom: 1.2rem;
    border: 1px solid #d1d5db;
    border-radius: 10px;
    font-family: 'Inter', monospace;
    font-size: 0.9rem;
    resize: vertical;
}

input:focus,
textarea:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.25);
}

/* ============================
   Buttons
============================ */
button {
    background-color: #3b82f6;
    color: #ffffff;
    border: none;
    padding: 0.75rem 1.2rem;
    /* slightly larger */
    border-radius: 10px;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.2s ease, transform 0.1s ease;
}

button:hover {
    background-color: #2563eb;
    transform: translateY(-1.5px);
}

button:active {
    transform: translateY(0);
}

/* Back button for tools */
.back-btn {
    background-color: transparent;
    color: #3b82f6;
    border: none;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    margin-bottom: 1.2rem;
    padding: 0;
}

.back-btn:hover {
    text-decoration: underline;
}

/* ============================
   Sections & Cards
============================ */
section {
    margin-bottom: 2.5rem;
}

pre {
    background-color: #f1f5f9;
    padding: 1.2rem;
    border-radius: 10px;
    overflow-x: auto;
    font-size: 0.85rem;
}

/* Regex highlights */
.highlight {
    background-color: #fde68a;
    padding: 0 3px;
    border-radius: 3px;
}

/* Muted text */
.muted {
    color: #6b7280;
    font-size: 0.85rem;
}

/* ============================
   Responsive
============================ */
@media (max-width: 1024px) {
    main {
        max-width: 90%;
        /* maintain padding on smaller screens */
    }

    .tool-card svg {
        width: clamp(36px, 5vw, 52px);
        height: clamp(50px, 7vw, 73px);
    }

    .tool-card h3 {
        font-size: 1.1rem;
    }
}

@media (max-width: 768px) {
    header h1 {
        font-size: 1.5rem;
    }

    .tool-card svg {
        width: clamp(36px, 5vw, 52px);
        height: clamp(36px, 5vw, 52px);
    }

    .tool-card h3 {
        font-size: 1rem;
    }
}

@media (max-width: 480px) {
    main {
        padding: 1.2rem;
    }

    header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }
}

/* ============================
   Dark Mode Styles
============================ */

body.dark {
    background-color: #121212;
    color: #e4e4e7;
}

body.dark header {
    background-color: #1f2937;
    border-bottom: 1px solid #374151;
}

body.dark header h1,
body.dark header nav a {
    color: #e4e4e7;
}

body.dark header nav a:hover {
    color: #60a5fa;
    /* lighter blue */
}

body.dark .dark-mode-toggle {
    background-color: #2563eb;
    color: #f3f4f6;
}

body.dark .dark-mode-toggle:hover {
    background-color: #3b82f6;
}

body.dark footer {
    border-top-color: #374151;
    color: #9ca3af;
}

body.dark .tool-card {
    background-color: #1e293b;
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.6);
    color: #d1d5db;
}

body.dark .tool-card p {
    color: #a1a9c0;
}

body.dark pre {
    background-color: #334155;
    color: #cbd5e1;
}

body.dark h2 {
    color: #e4e4e7;
    /* light color for title */
}

body.dark .subtitle {
    color: #e4e4e7;
    /* lighter secondary text color */
}