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

body {
    font-family: 'Inter', 'SF Pro Display', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    line-height: 1.6;
    color: #f5f5f5;
    background: #1a1a1a;
}

/* Skip link for accessibility */
.skip-link {
    position: absolute;
    left: -999px;
    top: auto;
    width: 1px;
    height: 1px;
    overflow: hidden;
    z-index: -1;
    background: #c9a96e;
    color: #1a1a1a;
    padding: 0.8rem 1.2rem;
    border-radius: 4px;
    font-weight: 500;
}
.skip-link:focus {
    left: 1rem;
    top: 1rem;
    width: auto;
    height: auto;
    z-index: 3000;
    outline: 2px solid #fff;
}

/* Lazy loading images */
img.lazy-image {
    opacity: 0;
    transition: opacity 0.6s ease;
    background: #2a2a2a; /* placeholder */
    filter: blur(4px);
}
img.lazy-image.lazy-loaded {
    opacity: 1;
    filter: blur(0);
}

/* Image error fallback styling */
img.image-error {
    object-fit: contain !important;
    background: #222222;
    border: 1px solid #444;
    color: #bbb;
}

/* Navigation */
.nav-container {
    position: fixed;
    top: 0;
    width: 100%;
    background: rgba(26, 26, 26, 0.95);
    backdrop-filter: blur(10px);
    z-index: 1000;
    border-bottom: 1px solid #404040;
}

nav {
    max-width: 1200px;
    margin: 0 auto;
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    min-height: 80px;
    position: relative;
}

.logo {
    height: 90px;
    cursor: pointer;
    background: transparent;
    border-radius: 5px;
    padding: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #d4d4d4;
    font-style: italic;
    transition: opacity 0.3s ease;
    margin-top: -5px;
}

.logo img {
    height: 100%;
    width: auto;
    max-width: 216px;
    object-fit: contain;
}

.logo:hover {
    background: transparent;
    transform: none;
    opacity: 0.7;
}

.nav-links {
    display: flex;
    list-style: none;
    gap: 2rem;
    margin-top: 8px;
}

.nav-links a {
    text-decoration: none;
    color: #f5f5f5;
    font-weight: 400;
    font-size: 0.9rem;
    transition: color 0.3s ease;
    cursor: pointer;
}

.nav-links a:hover,
.nav-links a.active {
    color: #c9a96e;
}

/* Main Content */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
    padding-top: 100px;
}

/* Header Section */
.header-section {
    text-align: center;
    padding: 0;
    background: transparent;
    margin-bottom: 2rem;
}

.header-image {
    width: 100%;
    height: 280px;
    border-radius: 8px;
    margin-bottom: 2rem;
    margin-top: 2rem;
    cursor: default;
    transition: none;
    overflow: hidden;
}

.header-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 8px;
}

.header-image:hover {
    transform: none;
    box-shadow: none;
}

.main-title {
    font-size: 2.8rem;
    color: #d4d4d4;
    margin-bottom: 0.5rem;
    font-weight: 300;
    text-align: center;
}

.main-subtitle {
    font-size: 1.1rem;
    color: #b4b4b4;
    margin-bottom: 2rem;
    text-align: center;
}

/* Biography Section */
.biography-section {
    background: #1a1a1a;
    padding: 2rem;
    border-radius: 8px;
    margin-bottom: 2rem;
    display: grid;
    grid-template-columns: 300px 1fr;
    gap: 2rem;
    align-items: start;
}

.portrait-container {
    text-align: center;
}

.portrait-image {
    width: 100%;
    height: 400px;
    border-radius: 8px;
    cursor: default;
    transition: none;
    overflow: hidden;
}

.portrait-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 8px;
}

.portrait-image:hover {
    transform: none;
    box-shadow: none;
}

.biography-content {
    flex: 1;
}

.biography-text {
    font-size: 1rem;
    line-height: 1.7;
    text-align: left;
    color: #e5e5e5;
}

.biography-text p {
    margin-bottom: 1rem;
}

.biography-expanded {
    display: none;
}

.biography-expanded.show {
    display: block;
}

.expand-button {
    background: #c9a96e;
    color: #1a1a1a;
    border: none;
    padding: 0.8rem 1.5rem;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 400;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-top: 0.7rem;
}

.expand-button:hover {
    background: #b8956a;
    transform: translateY(-2px);
}

/* Núcleos Section */
.nucleos-section {
    margin-top: 2rem;
}

.section-title {
    font-size: 2.4rem;
    color: #c9a96e;
    text-align: left;
    margin-bottom: 2rem;
    font-weight: 300;
    padding: 0 2rem;
}

.gallery-introduction {
    font-size: 1rem;
    color: #c4c4c4;
    line-height: 1.7;
    text-align: left;
    margin-bottom: 3rem;
    padding: 0 2rem;
}

.nucleo {
    background: #1a1a1a;
    margin-bottom: 3rem;
    border-radius: 8px;
    overflow: hidden;
}

.nucleo-header {
    background: #1a1a1a;
    color: #f5f5f5;
    padding: 1.5rem 0;
    text-align: left;
}

.nucleo-title {
    font-size: 2.2rem;
    margin-bottom: 0.5rem;
    font-weight: 300;
    color: #c9a96e;
    text-align: left;
    padding-left: 2rem;
}

.nucleo-description {
    font-size: 1rem;
    opacity: 0.85;
    line-height: 1.6;
    text-align: left;
    columns: 2;
    column-gap: 2rem;
    padding: 0 2rem;
}

.nucleo-content {
    padding: 2rem;
}

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

.obra-card {
    background: #1a1a1a;
    border-radius: 8px;
    overflow: hidden;
    transition: transform 0.3s ease;
}

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

.obra-image {
    width: 100%;
    height: 250px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    overflow: hidden;
}

.obra-image:focus {
    outline: 3px solid #c9a96e;
    outline-offset: 3px;
}

.obra-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 8px;
}

.obra-image:hover {
    transform: scale(1.02);
}

.obra-info {
    padding: 1rem;
}

.obra-title {
    font-size: 1.1rem;
    font-weight: 400;
    color: #c4c4c4;
    margin-bottom: 0.3rem;
}

.obra-details {
    color: #c4c4c4;
    font-size: 0.85rem;
    line-height: 1.4;
}

.obra-collection {
    color: #999;
    font-size: 0.8rem;
    font-style: italic;
    margin-top: 0.3rem;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.9);
    animation: fadeIn 0.3s ease;
}

.modal:focus { outline: none; }

.modal-content {
    position: relative;
    margin: auto;
    padding: 20px;
    width: 90%;
    max-width: 1000px;
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
}

.modal-image {
    max-width: 100%;
    max-height: 80vh;
    border-radius: 8px;
    margin-bottom: 1.5rem;
    overflow: hidden;
}

.modal-image img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    border-radius: 8px;
    cursor: pointer;
    transition: opacity 0.3s ease;
}

.modal-image img:hover {
    opacity: 0.9;
}

.modal-info {
    text-align: center;
    color: white;
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 20px 40px;
}

.modal-text {
    flex: 1;
    margin: 0 20px;
}

.nav-button {
    background: none;
    border: none;
    color: #f5f5f5;
    font-size: 24px;
    cursor: pointer;
    padding: 10px;
    transition: all 0.3s ease;
    outline: none;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
}

.nav-button:hover {
    background: rgba(255, 255, 255, 0.2);
}

.nav-button:active {
    transform: scale(0.95);
}

.arrow {
    display: block;
    line-height: 1;
}

.close {
    position: absolute;
    top: 20px;
    right: 40px;
    color: #ffffff;
    font-size: 38px;
    font-weight: 300;
    cursor: pointer;
    transition: color 0.25s ease, transform 0.25s ease;
    background: transparent;
    border: none;
    line-height: 1;
    padding: 0;
}

.close:hover, .close:focus {
    color: #c9a96e;
    outline: none;
}

.close:focus-visible {
    outline: 2px solid #c9a96e;
    outline-offset: 4px;
}

/* Contact Section */
.contact-section {
    text-align: center;
    padding: 2rem;
    background: #c9a96e;
    border-radius: 8px;
    margin-top: 3rem;
}

.contact-title {
    font-size: 1.6rem;
    color: #1a1a1a;
    margin-bottom: 1.5rem;
    font-weight: 300;
}

.contact-info {
    font-size: 1rem;
    color: #1a1a1a;
}

.contact-email {
    color: #1a1a1a;
    text-decoration: none;
    font-weight: 400;
}

.contact-email:hover {
    text-decoration: underline;
}

/* Footer */
.site-footer {
    max-width: 1200px;
    margin: 3rem auto 2rem;
    padding: 1.5rem 2rem;
    text-align: center;
    font-size: 0.8rem;
    color: #999;
    opacity: 0.9;
}

/* Subtitle for sections */
.section-subtitle {
    color: #c4c4c4;
    font-size: 1.1rem;
    margin: 1.5rem 0 0.7rem;
    font-weight: 400;
}

/* Intro paragraphs for Bocetos y Caricaturas */
.bocetos-intro, .caricaturas-intro {
    color: #d4d4d4;
    margin-bottom: 2rem;
    font-size: 0.95rem;
    line-height: 1.6;
}

.caricaturas-intro {
    margin-top: 2rem;
}

/* Hamburger Menu */
.hamburger {
    display: none;
    flex-direction: column;
    cursor: pointer;
    padding: 0;
    z-index: 1001;
    background: transparent !important;
    border: none;
    width: 44px; /* área táctil recomendada */
    height: 44px;
    align-items: center;
    justify-content: center;
    -webkit-appearance: none;
    appearance: none;
}

.hamburger span {
    width: 26px;
    height: 2.5px;
    background: #ffffff;
    margin: 4px 0;
    transition: 0.3s;
    border-radius: 2px;
}

.hamburger:focus,
.hamburger:hover,
.hamburger:active {
    outline: none !important;
    box-shadow: none !important;
    background: transparent !important;
}

.hamburger.active span:nth-child(1) {
    transform: rotate(-45deg) translate(-5px, 6px);
}

.hamburger.active span:nth-child(2) {
    opacity: 0;
}

.hamburger.active span:nth-child(3) {
    transform: rotate(45deg) translate(-5px, -6px);
}

/* Responsive */
@media (max-width: 768px) {
    .main-title {
        font-size: 2rem;
    }
    
    .hamburger {
        display: flex;
    }
    
    .nav-links {
        position: fixed;
        top: 80px;
        left: 0;
        width: 100%;
        height: calc(100vh - 160px);
        background: rgba(26, 26, 26, 0.98);
        backdrop-filter: blur(10px);
        flex-direction: column;
        justify-content: center;
        padding: 1.5rem 0;
        box-shadow: 0 5px 20px rgba(0,0,0,0.3);
        transform: translateX(-100%);
        transition: transform 0.3s ease;
        z-index: 1000;
        overflow-y: auto;
    }
    
    .nav-links.active {
        transform: translateX(0);
    }
    
    /* Reordenar elementos en móvil */
    .mobile-first {
        order: -1;
    }
    
    .nav-links li {
        margin: 0;
        text-align: center;
        display: flex;
        align-items: center;
        justify-content: center;
    }
    
    .nav-links a {
        display: flex;
        align-items: center;
        justify-content: center;
        width: 100%;
        padding: 0.5rem 1rem;
        font-size: 0.95rem;
        border-bottom: 1px solid #333;
        transition: background-color 0.3s ease;
        min-height: 35px;
    }
    
    .nav-links a:hover {
        background-color: rgba(201, 169, 110, 0.1);
    }
    
    /* Asegurar que todos los enlaces tengan línea inferior excepto el último visualmente */
    .desktop-order:last-of-type a {
        border-bottom: none;
    }

    .obras-grid {
        grid-template-columns: 1fr;
    }

    .container {
        padding: 1rem;
        padding-top: 100px;
    }

    .nucleo-content {
        padding: 1.5rem;
    }

    .modal-content {
        padding: 10px;
    }

    .close {
        top: 10px;
        right: 20px;
        font-size: 30px;
    }

    .biography-section {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }

    .portrait-image {
        height: 300px;
    }

    .header-image {
        height: 200px;
        margin-top: 1.5rem;
    }

    .nucleo-description {
        columns: 1;
    }
}

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.nucleo {
    animation: fadeInUp 0.6s ease forwards;
}

.nucleo:nth-child(2) { animation-delay: 0.1s; }
.nucleo:nth-child(3) { animation-delay: 0.2s; }
.nucleo:nth-child(4) { animation-delay: 0.3s; }

/* Reduced Motion Preference -------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation: none !important;
        transition: none !important;
        scroll-behavior: auto !important;
    }
    .modal { animation: none !important; }
    .nucleo { animation: none !important; }
    img.lazy-image { filter: none !important; }
    .nav-links { transition: none !important; }
}