/* ========= Google Fonts Import ========= */
@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@400;700&family=Lato:wght@400;700&display=swap');

/* ========= CSS Layers Setup ========= */
@layer reset, global, components, utilities;

/* ========= Reset/Normalization Layer ========= */
@layer reset {
    *,
    *::before,
    *::after {
        box-sizing: border-box;
        margin: 0;
        padding: 0;
    }

    body {
        min-height: 100vh;
        font-smooth: antialiased;
        -webkit-font-smoothing: antialiased;
        -moz-osx-font-smoothing: grayscale;
    }

    img, picture, video, canvas, svg {
        display: block;
        max-width: 100%;
    }

    input, button, textarea, select {
        font: inherit;
    }

    h1, h2, h3, h4, h5, h6 {
        text-wrap: balance;
        font-family: var(--font-headings);
    }

    p, li, blockquote {
        max-width: 70ch; /* Increased for better line length */
        text-wrap: pretty;
    }
}

/* ========= Global Styles Layer ========= */
@layer global {
    :root {
        /* Colors */
        --color-background: oklch(15.65% 0.024 243.53);
        --color-surface: oklch(20% 0.024 243.53);
        --color-text: oklch(95% 0 0);
        --color-accent: oklch(65% 0.15 180);
        --color-accent-glow: oklch(75% 0.2 180);

        /* Typography */
        --font-headings: 'Poppins', sans-serif;
        --font-body: 'Lato', sans-serif;

        /* Shadows */
        --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
        --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
        --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.2), 0 4px 6px -4px rgb(0 0 0 / 0.2);
        --shadow-deep: 0 25px 50px -12px rgb(0 0 0 / 0.4);

        /* Noise Texture */
        --noise-svg: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.65' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)'/%3E%3C/svg%3E");
    }

    body {
        font-family: var(--font-body);
        color: var(--color-text);
        background-color: var(--color-background);
        background-image: var(--noise-svg);
        background-blend-mode: overlay;
        opacity: 0.8;
    }

    main {
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 5rem;
        padding: 2rem;
    }

    section {
        width: 100%;
        max-width: 1200px;
        display: flex;
        flex-direction: column;
        align-items: center;
        text-align: center;
    }

    h1 {
        font-size: clamp(2.5rem, 5vw + 1rem, 4rem);
        font-weight: 700;
    }

    h2 {
        font-size: clamp(2rem, 4vw + 1rem, 3rem);
        margin-bottom: 2rem;
    }

    /* Form Styles */
    form {
        display: flex;
        flex-direction: column;
        gap: 1rem;
        width: 100%;
        max-width: 500px;
    }

    input, textarea {
        padding: 0.8rem 1rem;
        border: 1px solid var(--color-surface);
        background-color: var(--color-surface);
        color: var(--color-text);
        border-radius: 8px;
        box-shadow: var(--shadow-sm);
    }

    textarea {
        min-height: 150px;
    }

    button[type="submit"] {
        padding: 1rem;
        background-color: var(--color-accent);
        color: var(--color-background);
        border: none;
        border-radius: 8px;
        font-weight: 700;
        cursor: pointer;
        transition: all 0.3s ease;
        box-shadow: var(--shadow-lg);
    }

    button[type="submit"]:hover {
        background-color: var(--color-accent-glow);
        box-shadow: 0 0 20px var(--color-accent-glow);
    }
    
    footer {
    width: 100%;
    max-width: 1200px;
    padding: 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-top: 1px solid var(--color-surface);
    margin: 0 auto;
    flex-wrap: wrap; /* Allow wrapping on smaller screens */
    gap: 1rem; /* Add gap for wrapped items */
    }
}

/* ========= Components Layer ========= */
@layer components {
    #servicios {
        container-type: inline-size;
    }

    .service-grid {
        display: grid;
        grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
        gap: 2rem;
        width: 100%;
    }
    
    #sobre-nosotros .about-us-content {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 4rem; /* Increased gap */
        align-items: center;
        text-align: left;
        width: 100%;
    }

    #sobre-nosotros .about-us-content p {
        font-size: 1.1rem;
        line-height: 1.8; /* Increased line height */
        margin-bottom: 1.5rem; /* Space between paragraphs */
    }

    #sobre-nosotros .about-us-content p:last-child {
        margin-bottom: 0;
    }

    .about-us-content img {
        width: 100%;
        height: auto;
        border-radius: 12px;
        box-shadow: var(--shadow-deep);
    }

    .social-links {
        display: flex;
        gap: 1.5rem;
    }

    .social-links a {
        color: var(--color-text);
        transition: color 0.3s ease;
    }

    .social-links a:hover {
        color: var(--color-accent);
    }

    .social-links svg {
        width: 24px;
        height: 24px;
    }
    
    .powered-by {
        font-size: 0.8rem; /* Smaller font size */
        opacity: 0.7; /* Slightly transparent */
        text-align: center;
        width: 100%; /* Take full width on a new line if it wraps */
        order: 3; /* Ensure it appears after copyright and social links */
    }

    @media (min-width: 768px) {
        .powered-by {
            width: auto; /* Auto width on larger screens */
            order: 0; /* Let flexbox order it */
            text-align: right; /* Align to the right */
        }
    }

    @media (max-width: 768px) {
        #sobre-nosotros .about-us-content {
            grid-template-columns: 1fr;
        }
        
        footer {
            flex-direction: column; /* Stack items vertically */
        }
    }

    #form-status {
        margin-top: 1rem;
        padding: 0.75rem;
        border-radius: 8px;
        text-align: center;
        font-weight: 500;
        opacity: 0;
        transition: opacity 0.3s ease-in-out;
        display: none; /* Hidden by default */
    }

    #form-status.success {
        background-color: oklch(50% 0.15 140 / 0.2);
        color: oklch(85% 0.15 140);
        display: block;
        opacity: 1;
    }

    #form-status.error {
        background-color: oklch(50% 0.18 25 / 0.2);
        color: oklch(85% 0.18 25);
        display: block;
        opacity: 1;
    }
}

/* ========= Utilities Layer ========= */
@layer utilities {
    .animated-item {
        opacity: 0;
        transform: translateY(20px);
        transition: opacity 0.6s ease-out, transform 0.6s ease-out;
    }

    .animated-item.is-visible {
        opacity: 1;
        transform: translateY(0);
    }
}
