
/* 1. Registramos la fuente en el navegador */
@font-face {
    font-family: 'Counthills';
    src: url('../fonts/Counthills.otf') format('opentype');
    font-weight: normal;
    font-style: normal;
    font-display: swap; /* Hace que el texto sea visible mientras carga la fuente */
}

/* 2. Así la aplicas a los elementos que tú quieras (por ejemplo, los títulos) */
h1, h2{
            font-family: 'Counthills', sans-serif;
            text-align: center;
            color: white;
            font-size: 70px;
            padding: 5% 0;
        }

 /* ===== RESET Y BASE ===== */
        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
            user-select: none;
        }
        html, body {
            max-width: 100%;
            overflow-x: hidden;
            background: blueviolet;
        }
        body {
            font-family: 'Inter', sans-serif;
            color: #2c241a;
            width: 100%;
        }
        
        p{
            font-family: 'Counthills', sans-serif;
            text-align:center; 
            opacity:0.8; 
            margin-top:-10px; 
            color: white; 
        }
        
        .portfolio {
            font-family: 'Counthills';
        }
        /* ===== PARALLAX ===== */
        .parallax {
            position: relative;
            width: 100%;
            height: 100vh;
            min-height: 600px;
            overflow: hidden;
            background: blueviolet;
            touch-action: pan-y;
        }
        .parallax:active {
            cursor: grabbing;
        }
        .layer {
            position: absolute;
            pointer-events: none;
            will-change: transform;
        }
        .planoa {
            bottom: -20%;
            left: 0;
            width: 100%;
            z-index: 3;
        }
        .planob {
            bottom: 40%;
            left: 0;
            width: 100%;
            z-index: 2;
        }
        .sol {
            width: 110px;
            z-index: 1;
            top: 8%;
            right: 5%;
            animation: floatSun 8s ease-in-out infinite;
        }
        .globo {
            top: 20%;
            left: 8%;
            width: 70px;
            z-index: 4;
            animation: floatGlobe 10s ease-in-out infinite;
        }
        .titulo {
            position: absolute;
            bottom: 28%;
            left: 50%;
            transform: translateX(-50%);
            text-align: center;
            z-index: 10;
            font-size: clamp(2rem, 6vw, 4.2rem);
            font-weight: 800;
            background: linear-gradient(135deg, #3a2c1f, #996b3e);
            background-clip: text;
            -webkit-background-clip: text;
            color: transparent;
            white-space: nowrap;
            pointer-events: none;
        }

        /* FIX PÁJAROS: contenedor fijo para evitar que expandan el body */
        #birds-container {
            position: fixed;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            pointer-events: none;
            z-index: 15;
            overflow: hidden;
            /* Desvanecimiento suave al salir del hero */
            transition: opacity 0.4s ease;
        }
        .bird {
            position: absolute;
            cursor: grab;
            transition: transform 0.2s;
            pointer-events: all;
            touch-action: pan-y;
        }
        .bird:active {
            cursor: grabbing;
        }
        .bird.clicked {
            transform: scale(1.2);
            filter: drop-shadow(0 0 6px gold);
        }

        /* ANIMACIONES */
        @keyframes floatSun {
            0% { transform: translateY(0) rotate(0deg); }
            50% { transform: translateY(15px) rotate(5deg); }
            100% { transform: translateY(0) rotate(0deg); }
        }
        @keyframes floatGlobe {
            0% { transform: translateY(0) translateX(0); }
            50% { transform: translateY(-12px) translateX(8px); }
            100% { transform: translateY(0) translateX(0); }
        }

        /* FLECHA */
        .scroll-arrow {
            position: absolute;
            bottom: 35px;
            left: 50%;
            transform: translateX(-50%);
            z-index: 20;
            cursor: pointer;
            animation: bounceArrow 1.8s infinite ease;
            background: rgba(0,0,0,0.35);
            backdrop-filter: blur(4px);
            width: 48px;
            height: 48px;
            border-radius: 60px;
            display: flex;
            align-items: center;
            justify-content: center;
        }
        .scroll-arrow i {
            font-size: 28px;
            color: white;
        }
        @keyframes bounceArrow {
            0%,100% { transform: translateX(-50%) translateY(0); opacity: 0.8; }
            50% { transform: translateX(-50%) translateY(12px); opacity: 1; }
        }

        /* CONTENIDO PRINCIPAL */
        .design-content {
            max-width: 1300px;
            margin: 0 auto;
            padding: 70px 30px 100px;
            background: #4C4F7A;
        }
        .intro-text {
            text-align: center;
            margin-bottom: 70px;
        }
        .intro-text h2 {
            font-size: 2.8rem;
            font-weight: 700;
            background: linear-gradient(125deg, #f5e6d3, #ffefdb);
            background-clip: text;
            -webkit-background-clip: text;
            color: transparent;
            margin-bottom: 20px;
        }
        .intro-text p {
            font-size: 1.2rem;
            max-width: 700px;
            margin: 0 auto;
            color: #f0e2d0;
            line-height: 1.5;
        }
        .services-grid {
            display: grid;
            grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
            gap: 40px;
            margin-bottom: 90px;
        }
        .service-card {
            background: rgba(255,248,235,0.9);
            backdrop-filter: blur(2px);
            border-radius: 32px;
            padding: 32px 24px;
            text-align: center;
            transition: all 0.3s ease;
            border: 1px solid rgba(255,255,200,0.3);
            box-shadow: 0 15px 30px -12px rgba(0,0,0,0.2);
        }
        .service-card:hover {
            transform: translateY(-8px);
            background: white;
        }
        .service-icon {
            font-size: 3rem;
            margin-bottom: 20px;
            background: #d9c8b5;
            width: 80px;
            height: 80px;
            line-height: 80px;
            border-radius: 60px;
            color: #a5662c;
            display: inline-block;
        }
        .service-card h3 {
            font-size: 1.6rem;
            margin-bottom: 12px;
            color: #2c241a;
        }
        .service-card p {
            color: #5e4b38;
        }
        .showcase {
            text-align: center;
            background: #2c241a;
            border-radius: 48px;
            padding: 50px 30px;
            margin-top: 20px;
        }
        .showcase h3 {
            font-size: 2rem;
            margin-bottom: 30px;
            color: #ffefdb;
        }
        .cta-button {
            display: inline-block;
            background: #9b4dff;
            color: white;
            padding: 14px 38px;
            border-radius: 40px;
            text-decoration: none;
            font-weight: 600;
            transition: all 0.25s;
            border: none;
        }
        .cta-button:hover {
            background: #b46eff;
            transform: scale(1.02);
        }
        footer {
            text-align: center;
            padding: 30px;
            font-size: 0.8rem;
            color: #e2d4c6;
            background: #2c241a;
        }

        /* ===== CHAT WIDGET ===== */
        .chat-widget {
            position: fixed;
            bottom: 25px;
            right: 25px;
            z-index: 9000;
            /* FIX: aseguramos que el widget no quede oculto */
            display: block;
        }
        .chat-button {
            width: 60px;
            height: 60px;
            border-radius: 50%;
            background-color: #9b4dff;
            border: none;
            cursor: pointer;
            display: flex;
            align-items: center;
            justify-content: center;
            box-shadow: 0 4px 15px rgba(0,0,0,0.3);
            color: white;
            font-size: 28px;
            transition: transform 0.2s;
            position: relative;
            z-index: 9001;
        }
        .chat-button:hover {
            transform: scale(1.08);
        }
        .chat-container {
            /* FIX: usar visibility+opacity en lugar de display:none para evitar 
               problemas de layout. Se activa con la clase .open */
            position: absolute;
            bottom: 80px;
            right: 0;
            width: 350px;
            height: 500px;
            background: white;
            border-radius: 24px;
            box-shadow: 0 10px 30px rgba(0,0,0,0.25);
            overflow: hidden;
            flex-direction: column;
            /* Estado cerrado */
            display: none;
            opacity: 0;
            pointer-events: none;
            transform: translateY(10px);
            transition: opacity 0.2s, transform 0.2s;
        }
        .chat-container.open {
            display: flex;
            opacity: 1;
            pointer-events: all;
            transform: translateY(0);
        }
        .chat-header {
            background: #2c241a;
            color: white;
            padding: 15px;
            display: flex;
            justify-content: space-between;
            align-items: center;
            font-weight: bold;
        }
        .close-chat {
            background: none;
            border: none;
            color: white;
            font-size: 24px;
            cursor: pointer;
        }
        .messages {
            flex: 1;
            overflow-y: auto;
            padding: 15px;
            display: flex;
            flex-direction: column;
            gap: 12px;
        }
        .message {
            max-width: 80%;
            padding: 10px 14px;
            border-radius: 22px;
            font-size: 0.9rem;
        }
        .user-message {
            align-self: flex-end;
            background-color: #9b4dff;
            color: white;
            border-bottom-right-radius: 4px;
        }
        .bot-message {
            align-self: flex-start;
            background-color: #f1ede8;
            color: #2e2c2a;
            border-bottom-left-radius: 4px;
            display: flex;
            gap: 8px;
            align-items: center;
        }
        .bot-avatar {
            width: 30px;
            height: 30px;
            border-radius: 50%;
            object-fit: cover;
        }
        .input-area {
            display: flex;
            border-top: 1px solid #ddd;
            padding: 12px;
            gap: 10px;
        }
        #message-input {
            flex: 1;
            border: 1px solid #ddd;
            border-radius: 40px;
            padding: 10px 16px;
            outline: none;
        }
        #send-button {
            background-color: #9b4dff;
            color: white;
            border: none;
            border-radius: 50%;
            width: 42px;
            height: 42px;
            cursor: pointer;
        }
        #send-button:disabled {
            background-color: #bbb;
            cursor: default;
        }

        /* PORTFOLIO (galería) */
        .container {
            max-width: 1400px;
            margin: 0 auto;
            padding: 40px 30px;
            background: blueviolet;
            overflow-x: hidden;
        }
        h2 {
            text-align: center;
            margin-bottom: 40px;
            font-size: 2.5rem;
            background: linear-gradient(135deg, #ffefdb, #d9c8b5);
            background-clip: text;
            -webkit-background-clip: text;
            color: transparent;
        }
        .category-selector {
            display: flex;
            justify-content: center;
            gap: 40px;
            flex-wrap: wrap;
            margin-bottom: 60px;
        }
        .category-card {
            background: rgba(255,248,235,0.1);
            backdrop-filter: blur(8px);
            border-radius: 32px;
            overflow: hidden;
            width: 320px;
            cursor: pointer;
            transition: all 0.3s ease;
            border: 1px solid rgba(255,255,200,0.3);
            box-shadow: 0 15px 25px -10px rgba(0,0,0,0.3);
            z-index: 50;
            position: relative;
        }
        .category-card:hover {
            transform: translateY(-10px);
            background: rgba(255,248,235,0.2);
            border-color: #ffd966;
        }
        .category-card img {
            width: 100%;
            height: 300px;
            object-fit: cover;
            display: block;
            pointer-events: none;
        }
        .content-container {
            background: rgba(0,0,0,0.3);
            border-radius: 48px;
            padding: 40px 30px;
            min-height: 500px;
            transition: all 0.3s;
        }
        .item-card {
            background: rgba(255,255,255,0.1);
            backdrop-filter: blur(4px);
            border-radius: 24px;
            overflow: hidden;
            transition: transform 0.2s;
            border: 1px solid rgba(255,255,200,0.2);
            display: flex;
            flex-direction: column;
        }
        .item-card img,
        .item-card video {
            width: 100%;
            aspect-ratio: 1 / 1;
            object-fit: contain;
            background-color: #2c241a;
            display: block;
            pointer-events: auto;
            cursor: pointer;
        }
        .items-grid {
            display: grid;
            grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
            gap: 30px;
        }
        .item-card:hover {
            transform: scale(1.02);
            border-color: #ffd966;
        }
        .item-info {
            padding: 15px;
        }
        .item-info h4 {
            font-size: 1.2rem;
            margin-bottom: 8px;
            color: #ffefdb;
        }
        .item-info p {
            font-size: 0.85rem;
            color: #ddd;
        }
        .loading {
            text-align: center;
            font-size: 1.5rem;
            padding: 50px;
            color: #ffefdb;
        }

        /* ===== MODAL ===== */
        #custom-media-modal {
            position: fixed;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background: rgba(0,0,0,0.95);
            backdrop-filter: blur(10px);
            /* FIX: usar display:none por defecto y display:flex cuando está abierto */
            display: none;
            justify-content: center;
            align-items: center;
            z-index: 99999;
            cursor: pointer;
            overscroll-behavior: contain;
        }
        #custom-media-modal.is-open {
            display: flex;
        }
        #modal-content-inner {
            max-width: 90vw;
            max-height: 90vh;
            display: flex;
            justify-content: center;
            align-items: center;
            cursor: default;
            border-radius: 12px;
            overflow: hidden;
        }
        #modal-content-inner img,
        #modal-content-inner video {
            max-width: 90vw;
            max-height: 90vh;
            width: auto;
            height: auto;
            object-fit: contain;
            border-radius: 12px;
            box-shadow: 0 10px 30px rgba(0,0,0,0.5);
            display: block;
        }
        #modal-close-btn {
            position: fixed;
            top: 20px;
            right: 30px;
            color: white;
            font-size: 36px;
            font-weight: bold;
            cursor: pointer;
            z-index: 100000;
            font-family: monospace;
            background: rgba(0,0,0,0.6);
            width: 50px;
            height: 50px;
            display: flex;
            align-items: center;
            justify-content: center;
            border-radius: 50%;
            border: none;
            transition: background 0.2s;
            line-height: 1;
        }
        #modal-close-btn:hover {
            background: rgba(255,255,255,0.3);
        }

        /* CONTACTO */
        .contact-section {
            max-width: 800px;
            margin: 0 auto;
            padding: 60px 20px;
        }
        .contact-card {
            background: rgba(255,255,255,0.1);
            backdrop-filter: blur(10px);
            border-radius: 32px;
            padding: 40px;
            text-align: center;
            border: 1px solid rgba(255,255,200,0.3);
        }
        .contact-card h2 {
            font-size: 2rem;
            margin-bottom: 20px;
            color: #ffefdb;
        }
        .contact-card p {
            margin-bottom: 30px;
            color: #f0e2d0;
        }

        /* ===== RESPONSIVE ===== */
        @media (max-width: 768px) {
            body {
                overflow-x: hidden;
            }
            .planoa, .planob {
                width: 100% !important;
                left: 0 !important;
                bottom: auto;
            }
            .planoa {
                bottom: 10%;
            }
            .planob {
                bottom: 50%;
            }
            .sol {
                width: 70px;
                right: 35%;
                top: 20%;
            }
            .globo {
                width: 45px;
                left: 5%;
                top: 15%;
            }
            .titulo {
                font-size: 1.8rem;
                white-space: normal;
                width: 90%;
                bottom: 25%;
            }
            .design-content {
                padding: 40px 20px;
            }
            .intro-text h2 {
                font-size: 2rem;
            }
            .container {
                padding: 30px 20px;
            }
            .category-card {
                width: 260px;
            }
            .items-grid {
                grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
                gap: 20px;
            }
            .contact-card {
                padding: 30px 20px;
            }
            .contact-section {
                padding: 40px 20px;
            }
            h1 {
                font-size: 40px;
            }
            /* Chat más pequeño en móvil */
            .chat-container {
                width: 300px;
                height: 450px;
                right: 0;
                bottom: 75px;
            }
        }

        @media (max-width: 480px) {
            .planoa, .planob {
                width: 100% !important;
                left: 0 !important;
            }
            .items-grid {
                grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
            }
            .category-card {
                width: 220px;
            }
            .category-card img {
                height: 220px;
            }
            /* En pantallas muy pequeñas el chat ocupa casi todo el ancho */
            .chat-container {
                width: calc(100vw - 20px);
                right: 0;
            }
        }