:root {
    --page-padding: 22px;
    --text: #2D2D2A;
    --bg: #F9F7F4;
    --slider-aspect-ratio: calc(1500 / 1970);
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: -apple-system, BlinkMacSystemFont, "Helvetica Neue", Helvetica, Arial, sans-serif;
    overflow-x: hidden;
}

.arrow {
  border: solid rgb(68, 68, 68);
  border-width: 0 2.5px 2.5px 0;
  display: inline-block;
  padding: 2.5px;
}

.izq {
  transform: rotate(135deg);
  -webkit-transform: rotate(135deg);
}

/* --- ESTRUCTURA BASE (Móvil / iPhone) --- */
.project-layout {
    display: flex;
    flex-direction: column;
    padding: 18px var(--page-padding) 0px; 
    gap: 40px;
    min-height: 100dvh; 
    box-sizing: border-box;
}

.project-info { 
    order: 2; 
    font-size: 10.5px;
    line-height: 1.22;
    display: flex;
    flex-direction: column;
    flex-grow: 1; 
}

.gallery {
    order: 1;
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.gallery figure { 
    margin: 0; 
}

.gallery img {
    display: block;
    width: 100%;
    height: auto;
    filter: contrast(1.05) saturate(0.95);
    transition: opacity 0.3s ease;
}

.image-credit {
    display: flex;
    justify-content: space-between; 
    font-size: 11px; 
    color: var(--text);
    margin-top: 8px; 
    line-height: 1.2;
}

.image-credit .right,
.image-credit .left {
    opacity: 0.8;
}

.project-details p {
    margin: 0 0 20px 0;
    max-width: 240px;
    text-align: left; 
    text-wrap: pretty; 
}

.project-details nav a {
    text-decoration: none;
    color: var(--text);
    transition: opacity 0.3s ease;
    display: inline-block;
    margin-bottom: 5px;
    font-size: 13px; 
}

.project-details nav a:hover {
    opacity: 0.65;
}

#preview-img {
    opacity: 0;
    transition: opacity 0.4s ease;
    object-fit: cover; 
}

#preview-img.is-visible {
    opacity: 1;
}

h1, h2 {
    font-size: inherit;
    font-weight: inherit;
    font-style: inherit;
    margin: 0;
}

.project-navigation {
    padding-bottom: 20px;
    margin-top: auto; 
}

.project-navigation a {
    text-decoration: none;
    color: var(--text);
    font-size: 13px;
    display: block;
    margin-bottom: 10px;
    transition: opacity 0.3s ease; 
}

.footer {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 0 0 calc(var(--footer-bottom, 20px) + env(safe-area-inset-bottom)) 0;
}

.footer a {
    text-decoration: none;
    color: var(--text);
}

.footer .instagram {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-top: 2px;
}

.footer .instagram img {
    width: 9.5px !important;  
    height: 9.5px !important; 
    display: block;          
    object-fit: contain;     
}

.column {
  float: left;
  line-height: 0.075;
  width: 50%;
}

.row:after {
  content: "";
  display: table;
  clear: both;
  margin-top: 10px;
}

/* --- MEDIA QUERIES --- */

@media (max-width: 767px) {
    .project-layout {
        /* Reducimos el padding superior al mínimo para que suba más */
        padding-top: 0px; /* O puedes probar con 0px si necesitas que pegue todavía más arriba */
        gap: 25px;
    }

    .project-details p {
        margin-top: 0; /* Eliminamos cualquier margen superior que tenga el párrafo o contenedor */
        max-width: 100%;
    }

    .project-navigation a {
        /* Reducimos un 20% el tamaño de fuente base (asumiendo que 13px o el original escala a aprox 80%) */
        font-size: 12.5px; 
        /* 25% menos opaco (1 - 0.25 = 0.75) */
        opacity: 0.80; 
    }

    .column {
        text-align: right;
        width: 40%;
    }

    .row:after {
        margin-bottom: 25px;
    }

    #preview-img {
        display: none;
    }
    
    .footer {
        line-height: 0.05;
    }
    
    .footer a {
        line-height: 1.1;
    }
}

/* TABLET Y ESCRITORIO */
@media (min-width: 768px) {
    .project-layout {
        flex-direction: row;
        padding: 40px var(--page-padding);
        gap: 60px;
        align-items: flex-start;
        height: auto;
    }

    .project-info {
        flex-grow: 0; 
        font-size: 11px;
        line-height: 1.28;
        order: 1;
        position: sticky;
        top: 40px;
        width: 240px;
        /* CORRECCIÓN: Ampliamos el alto disponible para permitir que el footer baje por completo */
        height: calc(100vh - 50px);
        display: flex;
        flex-direction: column;
        justify-content: flex-start;
        bottom: 0;
    }

    .project-details nav a {
        font-size: 12.5px;
    }

    .project-navigation {
        font-size: 11px;
        margin-top: auto;      
        margin-bottom: 80px;   
    }

    .project-navigation a:hover {
        opacity: 0.65; 
    }

    .project-navigation a {
        font-size: 12.5px; 
        padding-bottom: 35px;
    }

    .gallery {
        order: 2;
        flex: 1;
        max-width: min(760px, calc((100dvh - 220px) * var(--slider-aspect-ratio)));
        margin: 0;
    }

    .footer {
        width: 760px;
        max-width: 100%;
        align-self: flex-start;
        position: absolute;
        bottom: 0;
        left: 0;
        /* CORRECCIÓN: Ajustamos el margen superior para que el footer descienda exactamente al nivel del Home */
        margin-top: 110px; 
    }

    .footer a {
        text-decoration: none;
        color: var(--text);
        transition: opacity 0.3s ease;
    }

    .instagram img {
        height: .84em;
        width: auto;
    }
}

@media (min-width: 1200px) {
    :root { --page-padding: 40px; }
    
    .gallery { 
        max-width: min(1080px, calc((100dvh - 220px) * var(--slider-aspect-ratio))); 
    }
    
    .project-info {
        font-size: 11px;
        line-height: 1.18;
    }    
    
    .footer {
        width: 1080px;
        max-width: 100%;
    }
    
    .footer a {
        transition: opacity 0.3s ease;
        font-size: 10.8px;
        line-height: 1.10;
    }
    
    .footer a:hover {
        opacity: 0.65;
    }
    
    .instagram img {
        height: .84em;
    }
}

@media (min-width: 2560px) {
    :root { --page-padding: 60px; }
    .gallery { 
        max-width: min(1800px, calc((100dvh - 220px) * var(--slider-aspect-ratio))); 
    }
}