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

:root {
    --primary-color: #6366f1; /* Indigo 500 */
    --primary-hover: #4f46e5; /* Indigo 600 */
    --secondary-color: #10b981; /* Emerald 500 */
    --secondary-hover: #059669; /* Emerald 600 */
    --background: #f8fafc; /* Slate 50 */
    --surface: #ffffff;
    --text-primary: #1e293b; /* Slate 900 */
    --text-secondary: #64748b; /* Slate 500 */
    --border: #e2e8f0; /* Slate 200 */
    --shadow-light: rgba(0, 0, 0, 0.05);
    --shadow-medium: rgba(0, 0, 0, 0.1);
    --gradient-start: #6366f1; /* Indigo 500 */
    --gradient-end: #8b5cf6; /* Violet 500 */

    /* New Blog specific colors from image */
    --blog-bg: #8B4513; /* SaddleBrown, main background */
    --blog-card-bg: #A0522D; /* Sienna, for blog cards */
    --blog-text-light: #F5DEB3; /* Wheat, for light text */
    --blog-text-dark: #5A2D00; /* Dark brown, for dark text */
    --blog-header-bg: #8B4513; /* Same as blog-bg for consistency */
    --blog-header-text: #F5DEB3;
    --blog-search-bg: #A0522D;
    --blog-search-text: #F5DEB3;
    --blog-button-bg: #6B8E23; /* OliveDrab */
    --blog-button-hover: #556B2F; /* DarkOliveGreen */
    --blog-button-active: #D2B48C; /* Tan */
    --blog-pagination-text: #F5DEB3;
    --blog-pagination-active-bg: #F5DEB3;
    --blog-pagination-active-text: #8B4513;
}

body {
    font-family: 'Georgia', serif; /* Changed font to a serif font for blog */
    background-color: var(--blog-bg);
    color: var(--blog-text-light);
    line-height: 1.6;
    margin: 0;
    padding: 0;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.container {
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 24px;
}

header {
    background-color: var(--blog-header-bg);
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

header .logo {
    color: var(--blog-header-text);
    font-size: 1.8rem;
    font-weight: bold;
    text-decoration: none;
}

header nav ul {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    gap: 1.5rem;
}

header nav a {
    color: var(--blog-header-text);
    text-decoration: none;
    font-weight: 500;
    font-size: 1.1rem;
    transition: opacity 0.2s ease;
}

header nav a:hover {
    opacity: 0.8;
}

/* Hero Section */
.hero-section {
    background-color: var(--blog-bg);
    color: var(--blog-text-light);
    padding: 4rem 0 2rem 0; /* Adjusted padding */
    text-align: center;
    border-radius: 0; /* Removed border-radius */
    margin-bottom: 2rem;
    box-shadow: none; /* Removed shadow */
}

.hero-section h1 {
    font-size: 4rem; /* Larger font size */
    margin-bottom: 1rem;
    font-weight: 700; /* Adjusted font weight */
    letter-spacing: -0.05em;
    line-height: 1.1;
    color: var(--blog-text-light); /* Ensure color is light */
}

.hero-section .tagline {
    font-size: 1.2rem; /* Slightly smaller tagline */
    max-width: 700px; /* Adjusted max-width */
    margin: 0 auto 2rem auto; /* Adjusted margin */
    opacity: 0.9;
    line-height: 1.4;
}

.filter-buttons {
    display: flex;
    justify-content: center;
    gap: 1rem;
    margin-top: 1.5rem;
}

.filter-button {
    background-color: var(--blog-button-bg);
    color: var(--blog-text-light);
    padding: 0.6rem 1.5rem;
    border-radius: 20px;
    text-decoration: none;
    font-size: 1rem;
    font-weight: 500;
    transition: background-color 0.2s ease, color 0.2s ease;
    border: none;
    cursor: pointer;
}

.filter-button:hover {
    background-color: var(--blog-button-hover);
}

.filter-button.active {
    background-color: var(--blog-button-active);
    color: var(--blog-text-dark);
}

/* Blog Posts Grid */
.blog-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr); /* Two columns by default */
    gap: 2rem;
    padding: 2rem;
    max-width: 1200px; /* Max width for the grid */
    margin: 0 auto; /* Center the grid */
}

.blog-card {
    background-color: var(--blog-card-bg);
    border-radius: 12px;
    padding: 2rem;
    color: var(--blog-text-light);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
    transition: transform 0.2s ease;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.blog-card:hover {
    transform: translateY(-5px);
}

.blog-card h2 {
    font-size: 1.8rem;
    margin-bottom: 0.75rem;
    font-weight: 600;
    line-height: 1.3;
    color: var(--blog-text-light);
}

.blog-card h2 a {
    color: inherit;
    text-decoration: none;
}

.blog-card h2 a:hover {
    text-decoration: underline;
}

.blog-card p {
    font-size: 1rem;
    line-height: 1.6;
    margin-bottom: 1rem;
    opacity: 0.9;
}

.blog-meta {
    font-size: 0.9rem;
    opacity: 0.7;
}

.blog-meta span {
    margin-right: 1rem;
}

/* Featured Blog Card (spanning two columns) */
.blog-card.featured {
    grid-column: span 2;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    padding: 3rem;
}

.blog-card.featured h2 {
    font-size: 3rem;
    margin-bottom: 1rem;
}

.blog-card.featured p {
    font-size: 1.2rem;
    max-width: 800px;
    margin: 0 auto 1.5rem auto;
}

/* Pagination */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.5rem;
    margin-top: 3rem;
    padding-bottom: 3rem;
}

.pagination-link {
    background-color: transparent;
    color: var(--blog-pagination-text);
    padding: 0.7rem 1rem;
    border-radius: 8px;
    text-decoration: none;
    font-weight: 500;
    transition: background-color 0.2s ease, color 0.2s ease;
}

.pagination-link:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

.pagination-link.active {
    background-color: var(--blog-pagination-active-bg);
    color: var(--blog-pagination-active-text);
}

.pagination-link.disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Responsive adjustments for blog pages */
@media (max-width: 1024px) {
    .blog-grid {
        grid-template-columns: 1fr; /* Single column on smaller screens */
        padding: 1rem;
    }

    .blog-card.featured {
        grid-column: span 1; /* Featured card also becomes single column */
        padding: 2rem;
    }

    .blog-card.featured h2 {
        font-size: 2.2rem;
    }

    .blog-card.featured p {
        font-size: 1rem;
    }

    header {
        flex-direction: column;
        gap: 1rem;
        padding: 1rem;
    }

    header nav ul {
        flex-wrap: wrap;
        justify-content: center;
    }

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

    .search-bar input {
        width: 100%;
    }

    .hero-section h1 {
        font-size: 3rem;
    }

    .hero-section .tagline {
        font-size: 1rem;
    }

    .filter-buttons {
        flex-wrap: wrap;
    }
}

@media (max-width: 768px) {
    .hero-section h1 {
        font-size: 2.5rem;
    }

    .blog-card h2 {
        font-size: 1.5rem;
    }

    .blog-card.featured h2 {
        font-size: 1.8rem;
    }
}

/* Tool Showcase */
.tool-showcase {
    padding: 3rem 0;
}

.tool-showcase h2 {
    font-size: 2.5rem;
    text-align: center;
    margin-bottom: 3rem;
    color: var(--text-primary);
    font-weight: 700;
    letter-spacing: -0.025em;
}

.tool-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
}

.tool-card {
    background-color: var(--surface);
    border-radius: 12px;
    padding: 2rem;
    text-align: center;
    text-decoration: none;
    color: var(--text-primary);
    box-shadow: 0 2px 8px var(--shadow-light);
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.tool-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 6px 20px var(--shadow-medium);
    border-color: var(--primary-color);
}

.tool-card .icon {
    font-size: 3rem;
    margin-bottom: 1rem;
    color: var(--primary-color);
}

.tool-card h3 {
    font-size: 1.5rem;
    margin-bottom: 0.75rem;
    font-weight: 600;
}

.tool-card p {
    font-size: 1rem;
    color: var(--text-secondary);
    line-height: 1.5;
}

/* General Button Styles (updated) */
.primary-btn, .download-btn {
    padding: 0.85rem 2rem;
    border: none;
    border-radius: 8px;
    font-size: 1.05rem;
    cursor: pointer;
    transition: all 0.2s ease;
    font-weight: 600;
    text-decoration: none; /* Ensure buttons don't have underlines */
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.primary-btn {
    background-color: var(--primary-color);
    color: white;
}

.primary-btn:hover {
    background-color: var(--primary-hover);
    transform: translateY(-1px);
}

.download-btn {
    background-color: var(--secondary-color);
    color: white;
    margin-top: 1.5rem;
}

.download-btn:hover {
    background-color: var(--secondary-hover);
    transform: translateY(-1px);
}

/* Existing tool-specific styles - ensure compatibility */
.size-controls, .social-controls, .format-controls, .crop-controls,
.bg-controls, .filter-controls, .watermark-controls, .collage-controls {
    margin-top: 2rem; /* Increased margin for better spacing */
}

.control-group {
    margin-bottom: 1.25rem; /* Increased margin */
    display: flex;
    align-items: center;
    gap: 1.25rem; /* Increased gap */
}

.control-group label {
    min-width: 90px; /* Slightly wider label */
    font-weight: 600;
    color: var(--text-primary);
}

input[type="range"] {
    height: 8px; /* Thicker slider */
    border-radius: 4px;
    background: var(--border);
    outline: none;
    -webkit-appearance: none; /* Remove default styling for Chrome/Safari */
    appearance: none;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px; /* Larger thumb */
    height: 20px;
    border-radius: 50%;
    background: var(--primary-color);
    cursor: grab;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
    transition: background-color 0.2s ease, box-shadow 0.2s ease;
}

input[type="range"]::-webkit-slider-thumb:active {
    cursor: grabbing;
    background-color: var(--primary-hover);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.result-area {
    margin-top: 3rem; /* More space */
    text-align: center;
}

.result-area img {
    max-width: 100%;
    max-height: 500px; /* Slightly larger max height */
    border-radius: 12px; /* More rounded corners */
    box-shadow: 0 4px 15px var(--shadow-medium);
    border: 1px solid var(--border);
}

.size-info {
    margin-top: 1.5rem;
    padding: 1.25rem;
    background-color: var(--surface);
    border-radius: 8px;
    display: flex;
    justify-content: space-around;
    box-shadow: 0 1px 5px var(--shadow-light);
}

.history-controls {
    display: flex;
    gap: 15px;
    margin-top: 1.5rem;
    justify-content: center;
}

/* Social Media Styles */
.text-controls {
    margin-bottom: 1.5rem;
}

#social-text {
    width: 100%;
    min-height: 100px; /* Taller textarea */
    padding: 0.85rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 1.05rem;
    resize: vertical;
    background-color: var(--background);
    color: var(--text-primary);
}

.text-style-controls {
    display: flex;
    gap: 0.75rem;
    margin-top: 0.75rem;
    flex-wrap: wrap;
}

.text-style-controls select,
.text-style-controls input[type="number"],
.text-position-controls select,
.text-position-controls input[type="number"] {
    padding: 0.6rem;
    border: 1px solid var(--border);
    border-radius: 6px;
    background-color: var(--surface);
    color: var(--text-primary);
}

#add-shadow, #add-text-btn {
    padding: 0.6rem 1.2rem;
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

#add-shadow:hover, #add-text-btn:hover {
    background-color: var(--primary-hover);
}

.text-position-controls {
    display: flex;
    gap: 0.75rem;
    margin-top: 0.75rem;
    flex-wrap: wrap;
    align-items: center;
}

.text-position-controls label {
    font-weight: 600;
    color: var(--text-primary);
}

#social-canvas, #filter-canvas, #watermark-canvas, #collage-canvas, #crop-canvas, #bg-canvas {
    max-width: 100%;
    border: 1px solid var(--border);
    border-radius: 12px;
    margin: 1.5rem 0;
    box-shadow: 0 2px 10px var(--shadow-light);
}

/* Format Converter Styles */
.format-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}

.format-btn {
    padding: 1.25rem;
    border: 2px solid var(--border);
    background-color: var(--surface);
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.2s ease;
    color: var(--text-primary);
}

.format-btn:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
    background-color: var(--background);
}

/* Cropper Styles */
.aspect-ratios {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.aspect-btn {
    padding: 0.6rem 1.2rem;
    border: 1px solid var(--border);
    background-color: var(--surface);
    border-radius: 6px;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.2s ease;
    color: var(--text-secondary);
}

.aspect-btn.active {
    background-color: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.aspect-btn:hover:not(.active) {
    background-color: var(--background);
    color: var(--primary-color);
    border-color: var(--primary-color);
}

.crop-container {
    position: relative;
    display: inline-block;
    box-shadow: 0 2px 10px var(--shadow-light);
    border-radius: 12px;
    overflow: hidden; /* Ensures crop box stays within bounds */
}

.crop-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    pointer-events: none;
}

.crop-box {
    position: absolute;
    border: 2px solid var(--primary-color);
    background-color: rgba(79, 70, 229, 0.2); /* Slightly more opaque */
    cursor: move;
    pointer-events: all;
    box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.5); /* Darkens outside crop area */
}

.crop-box::after {
    content: '';
    position: absolute;
    bottom: -8px; /* Larger handle */
    right: -8px;
    width: 18px;
    height: 18px;
    background-color: var(--primary-color);
    border-radius: 50%;
    cursor: nw-resize;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.3);
}

/* Filter Styles */
.filter-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}

.filter-btn {
    padding: 1rem;
    border: 1px solid var(--border);
    background-color: var(--surface);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-weight: 500;
    color: var(--text-primary);
}

.filter-btn:hover {
    background-color: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

/* Watermark Styles */
.watermark-type {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}

.type-btn {
    flex: 1;
    padding: 0.85rem;
    border: 1px solid var(--border);
    background-color: var(--surface);
    border-radius: 8px;
    cursor: pointer;
    font-weight: 500;
    color: var(--text-secondary);
    transition: all 0.2s ease;
}

.type-btn.active {
    background-color: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.type-btn:hover:not(.active) {
    background-color: var(--background);
    color: var(--primary-color);
    border-color: var(--primary-color);
}

.text-watermark-controls, .image-watermark-controls {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
    align-items: center;
    flex-wrap: wrap;
}

#watermark-text {
    flex: 1;
    padding: 0.6rem;
    border: 1px solid var(--border);
    border-radius: 6px;
    background-color: var(--background);
    color: var(--text-primary);
}

.secondary-upload {
    padding: 0.6rem 1.2rem;
    background-color: var(--background);
    border: 1px solid var(--border);
    border-radius: 6px;
    cursor: pointer;
    font-weight: 500;
    color: var(--text-primary);
    transition: all 0.2s ease;
}

.secondary-upload:hover {
    background-color: var(--border);
}

.position-grid {
    display: grid;
    grid-template-columns: repeat(3, 45px); /* Slightly larger buttons */
    gap: 6px;
    margin: 1.5rem auto;
    width: fit-content;
    border: 1px solid var(--border);
    border-radius: 8px;
    overflow: hidden;
}

.pos-btn {
    padding: 0.6rem;
    border: none; /* Remove individual borders */
    background-color: var(--surface);
    cursor: pointer;
    font-size: 1.3rem;
    color: var(--text-secondary);
    transition: all 0.2s ease;
}

.pos-btn:hover {
    background-color: var(--primary-color);
    color: white;
}

.pos-btn.active {
    background-color: var(--primary-color);
    color: white;
}

/* Collage Styles */
.layout-options {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.layout-btn {
    flex: 1;
    padding: 0.85rem;
    border: 1px solid var(--border);
    background-color: var(--surface);
    border-radius: 8px;
    cursor: pointer;
    font-weight: 500;
    color: var(--text-secondary);
    transition: all 0.2s ease;
}

.layout-btn.active {
    background-color: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.layout-btn:hover:not(.active) {
    background-color: var(--background);
    color: var(--primary-color);
    border-color: var(--primary-color);
}

.image-previews {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
    margin-top: 1.5rem;
}

.image-previews img {
    width: 90px; /* Slightly larger previews */
    height: 90px;
    object-fit: cover;
    border-radius: 6px;
    border: 2px solid var(--border);
    box-shadow: 0 1px 5px var(--shadow-light);
}

/* ASCII Art Styles */
.ascii-controls {
    margin-top: 2rem;
}

#ascii-output {
    font-family: 'Fira Code', 'monospace', 'Courier New', Courier, monospace; /* Use Fira Code if available */
    white-space: pre;
    word-wrap: break-word;
    background-color: #1a202c; /* Darker background */
    color: #a7f3d0; /* Lighter green text */
    padding: 1.5rem;
    border-radius: 12px;
    overflow-x: auto;
    margin-top: 1.5rem;
    font-size: 0.6rem; /* Slightly larger font for readability */
    line-height: 0.9; /* Adjust line height to pack characters closer */
    box-shadow: inset 0 1px 5px rgba(0, 0, 0, 0.2);
}

/* Footer */
footer {
    background-color: var(--surface);
    border-top: 1px solid var(--border);
    padding: 2.5rem 0;
    text-align: center;
    color: var(--text-secondary);
    margin-top: 3rem;
    box-shadow: 0 -1px 3px var(--shadow-light);
}

.author-credit {
    margin-top: 0.75rem;
    font-size: 0.95rem;
}

.author-credit a {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 600;
}

.author-credit a:hover { text-decoration: underline; }

/* Why Choose Us Section */
.why-choose-us {
    padding: 4rem 0;
    background-color: var(--surface);
}

.why-choose-us h2 {
    font-size: 2.5rem;
    text-align: center;
    margin-bottom: 3rem;
    color: var(--text-primary);
    font-weight: 700;
    letter-spacing: -0.025em;
}

.features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 2rem;
}

.feature-item {
    text-align: center;
    padding: 1.5rem;
}

.feature-item h3 {
    font-size: 1.5rem;
    margin-bottom: 1rem;
    color: var(--text-primary);
    font-weight: 600;
}

.feature-item p {
    color: var(--text-secondary);
    line-height: 1.6;
}

/* FAQ Section */
.faq-section {
    padding: 4rem 0;
    background-color: var(--background);
}

.faq-section h2 {
    font-size: 2.5rem;
    text-align: center;
    margin-bottom: 3rem;
    color: var(--text-primary);
    font-weight: 700;
    letter-spacing: -0.025em;
}

.faq-item {
    max-width: 800px;
    margin: 0 auto 1.5rem auto;
    border-bottom: 1px solid var(--border);
    padding-bottom: 1.5rem;
}

.faq-item:last-child {
    border-bottom: none;
}

.faq-item h3 {
    font-size: 1.25rem;
    margin-bottom: 0.75rem;
    color: var(--text-primary);
    font-weight: 600;
}

.faq-item p {
    color: var(--text-secondary);
    line-height: 1.6;
}

/* How-to Section */
.how-to-section {
    padding: 4rem 0;
    background-color: var(--surface);
}

.how-to-section h2 {
    font-size: 2.5rem;
    text-align: center;
    margin-bottom: 3rem;
    color: var(--text-primary);
    font-weight: 700;
    letter-spacing: -0.025em;
}

.how-to-section ol {
    max-width: 800px;
    margin: 0 auto;
    padding-left: 2rem;
}

.how-to-section li {
    margin-bottom: 1.5rem;
    font-size: 1.1rem;
    color: var(--text-secondary);
}

.how-to-section li strong {
    color: var(--text-primary);
    font-weight: 600;
}

/* Responsive */
@media (max-width: 768px) {
    .container {
        padding: 0 16px;
    }

    header .container {
        flex-direction: column;
        gap: 1rem;
    }

    header h1 {
        font-size: 1.8rem;
    }

    .main-nav ul {
        gap: 1rem;
    }

    .hero-section {
        padding: 4rem 0;
    }

    .hero-section h1 {
        font-size: 2.5rem;
    }

    .hero-section .tagline {
        font-size: 1.2rem;
        margin-bottom: 2rem;
    }

    .hero-cta {
        padding: 0.8rem 2rem;
        font-size: 1.1rem;
    }

    .tool-showcase h2 {
        font-size: 2rem;
        margin-bottom: 2rem;
    }

    .tool-grid {
        grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
        gap: 1rem;
    }

    .tool-card {
        padding: 1.5rem;
    }

    .tool-card .icon {
        font-size: 2.5rem;
    }

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

    .control-group {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }

    .control-group label {
        min-width: auto;
    }

    .size-info {
        flex-direction: column;
        gap: 0.75rem;
    }

    .format-grid, .filter-grid {
        grid-template-columns: repeat(auto-fit, minmax(90px, 1fr));
    }

    .position-grid {
        grid-template-columns: repeat(3, 35px);
    }
}
