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

html,
body{
    scroll-behavior: smooth;
    width:100%;
    height:100%;
    overflow:hidden;
    background:white;
    color:black;
    font-family:Helvetica,Arial,sans-serif;
    -webkit-font-smoothing:antialiased;
}

::selection {
  background-color: #222222;
  color: #fff;
}

header{
    position:fixed;
    top:0;
    left:0;
    width:100%;
    display:flex;
    justify-content:space-between;
    align-items:center;
    padding:18px 50px;
    z-index:20;
    font-size:18px;
    letter-spacing:.02em;
}

.logo{
  text-transform:uppercase;
  font-size:30px;
  font-weight:500;
}

nav{
    display:flex;
    opacity:.5;
    gap:30px;
}

nav a{
    color:black;
    text-decoration:none;
    font-size:16px;
}

main{
    height:100%;
    width:100%;
    display:flex;
    align-items:center;
}

.carousel{
    position:absolute;
    bottom:20px;
    width:100%;
    overflow-x:auto;
    overflow-y:hidden;
    scrollbar-width:none;
    padding-top:140px;
}

.carousel::-webkit-scrollbar{
    display:none;
}

.track{
    display:flex;
    align-items:flex-start;
    gap:30px;
    padding-left:70px;
    padding-bottom:10px;
    padding-right:0;
}

.project{
    flex:none;
    text-decoration:none;
    color:black;
}

.project-preview-media {
    position: relative;
    width:100%;
    height:70vh;
    aspect-ratio:16/9;
    border-radius: 8px;
    overflow: hidden;
    background:#f2f2f2;
}

.project video,
.project-preview-thumbnail{
    width:100%;
    height:100%;
    display:block;
    object-fit:cover;
}

.project video{
    will-change: transform;
}

.project-preview-thumbnail{
    position:absolute;
    inset:0;
    z-index:1;
    opacity:1;
    pointer-events:none;
    transition:opacity 120ms ease;
}

.project-preview-media.is-playing .project-preview-thumbnail{
    opacity:0;
}

.project > img{
    width:100%;
    height:70vh;
    display:block;
    border-radius: 8px;
    aspect-ratio:16/9;
    object-fit:cover;
}

.project-header {
  padding: 0 50px;
  margin-bottom: 20px;
  width: 100%;
  flex: 1;
}

.project-title {
  font-size: 18px;
  font-weight: 500;
  margin-bottom: 8px;
}

.project-brand {
  font-size: 14px;
  opacity: 0.6;
}

.project-info {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 0 50px;
  margin-bottom: 10px;
  width: 100%;
  gap: 60px;
}

.info{
    margin-top:10px;
    display:flex;
    justify-content:space-between;
    text-transform:uppercase;
    font-size:14px;
}

.title{
    font-weight:500;
}

.year{
    opacity:.5;
}

/* --- CAROUSEL DESKTOP --- */
@media(max-width:900px){
    .player-container{
        padding:0px 10px!important;
    }
    .player{
        width:100%!important;
    }
    .track{
        padding-left:25px;
        padding-right:25px;
        gap:25px;
    }
    .project{
        width:70vw;
    }
}

/* --- CAROUSEL MOBILE --- */
@media(max-width:699px){
    .player-container{
        padding:0px 10px!important;
        margin-top:100px!important;
    }
    .player{
        width:100%!important;
    }
    .track{
        padding-left:25px;
        padding-right:25px;
        padding-bottom:1px!important;
        gap:25px;
    }
    .project{
        width:70vw;
    }
    .filter-row {
        padding-left: 10px!important;
        font-size: 9px!important;
    }
    .about-popup {
        z-index: 5000;
    }
    .about-content {
        flex-direction: column;
        gap: 30px;
        padding-top: 20px;
    }
    .about-links {
        align-items: flex-start;
        position: fixed;
        left: 0;
        right: 0;
        bottom: 0;
        padding: 60px 50px 40px 50px;
        z-index: 15;
    }
    .about-text {
        font-size: 16px;
        max-width: 100%;
    }
    .project-info {
        flex-direction: row;
        gap: 20px;
        align-items: flex-start;
        padding: 0 20px;
    }
    .project-title {
        font-size: 16px;
    }
    .project-brand {
        font-size: 12px;
    }
    .credits {
        flex-direction: column;
        align-items: flex-start;
        gap: 20px;
        justify-content: flex-start;
        padding: 0!important;
    }
    .credits-left {
        display: flex;
        flex-direction: row;
        gap: 30px;
        width: 100%;
    }
    .credits-right {
        display: flex;
        flex-direction: column;
        gap: 15px;
        padding: 0!important;
        width: 100%;
        align-items: flex-start;
    }
    .credit-item {
        width: 100%;
    }
    header {
        padding: 15px 20px;
    }
    .player-container {
        padding: 0 20px;
        margin-top: 200px;
    }
    .stills-section {
        padding: 0 20px;
    }
    .about-popup {
        padding: 40px 20px 30px 20px;
    }
}

/* --- PROYECTO (Project Page) --- */
body { 
    overflow: auto; 
}

body main { 
    flex-direction: column; 
    align-items: flex-start; 
    justify-content: flex-start;
    height: auto;
}

.player-container { 
    width: 100%; 
    padding: 0 50px; 
    margin-bottom: 60px; 
    margin-top: 250px; 
    align-items: center; 
    display: flex; 
    justify-content: center; 
}

.player { 
    width: 80%; 
    aspect-ratio: 16/9; 
    border-radius: 8px; 
    background: #000; 
    position: relative; 
}

.credits { 
    display: flex; 
    justify-content: flex-end; 
    padding: 0 50px; 
    margin-bottom: 40px; 
    font-size: 14px; 
}

.credits-left, .credits-right {
    display: flex;
    gap: 30px;
}

.credits-right {
    display: flex;
    flex-direction: row;
    gap: 30px;
}

.credit-item {
    display: flex;
    flex-direction: column;
    opacity: 0.5; 
    margin-bottom: 4px; 
}

.credit-label { 
    opacity: 0.5; 
    margin-bottom: 4px; 
}

.credit-value { 
    font-weight: 500; 
}

.stills-section { 
    width: 100%; 
    padding: 0 50px;
    margin-bottom: 60px; 
    overflow: hidden;
}

.stills-title { 
    font-size: 12px; 
    margin-bottom: 20px; 
    opacity: 0.5; 
}

.stills-carousel { 
    display: flex; 
    gap: 10px; 
    overflow: hidden; 
    scrollbar-width: none; 
    width: max-content;
    animation: scroll-continuous 60s linear infinite;
}

.stills-carousel::-webkit-scrollbar { 
    display: none; 
}

.still { 
    width: auto; 
    height: 200px; 
    flex-shrink: 0; 
    border-radius: 4px; 
    object-fit: cover; 
}

@keyframes scroll-continuous {
    0% { transform: translateX(0); }
    100% { transform: translateX(calc(-50%)); }
}

/* --- POPUP --- */
.about-popup {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    padding: 60px 50px 40px 50px;  
    z-index: 15;
    animation: opacity 0.3s ease-out;
    background: rgba(255, 255, 255, 0.85);
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
    opacity: 1;
    transition: opacity 1s ease-in-out;
    pointer-events: auto;
}

.about-popup.hidden {
    opacity: 0;
    pointer-events: none;
}

.about-content {
    display: flex;
    gap: 60px;
    max-width: 100%;
    justify-content: space-between;
}

.about-text {
    flex: 1;
    line-height: 1.6;
    font-size: 18px;
    text-align: left;
    max-width: 800px;
}

.about-links {
    display: flex;
    flex-direction: column;
    gap: 0px;
    align-items: flex-end;
}

.about-links a {
    color: black;
    text-decoration: none;
    padding: 5px 10px;
    transition: opacity 0.2s;
    font-size: 14px;
    opacity: 0.7;
    cursor: pointer;
    border-radius: 4px;
}

.about-links a:hover {
    opacity: 1;
}

@keyframes fadeOut {
    0% { opacity: 0; }
    60% { opacity: 1; }
    100% { opacity: 1; }
}

@keyframes fadeIn {
    0% { opacity: 1; }
    40% { opacity: 1; }
    100% { opacity: 0; }
}

.page-transition {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: white;
    z-index: 10;
    pointer-events: none;
}

.page-transition.fade-out {
    animation: fadeIn 1s ease-in-out forwards;
}

.page-transition.fade-in {
    animation: fadeOut 1s ease-in-out forwards;
}

.preload {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: white;
    z-index: 2000;
    animation: preloadFade 2s ease-out forwards;
    pointer-events: none;
}

body.popup-open .preload {
    z-index: 3000;
}

@keyframes preloadFade {
    0% { opacity: 1; }
    100% { opacity: 0; }
}

/* --- FILTER BUTTONS --- */
.filter-row {
    position: sticky;
    display: flex;
    padding-left: 70px;
    height: 70px;
    align-items: center;
    z-index: 12;
}

.filter-container {
    position: absolute;
    display: flex;
    gap: 12px;
    align-items: center;
}

.filter-view-btn, 
.filter-view-btn:visited {
    text-decoration: none;
    display: flex;
    align-items: center;
    color: black;
}

.filter-btn {
    padding: 8px 16px;
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: 20px;
    background: transparent;
    cursor: pointer;
    font-size: 12px;
    transition: all 0.7s;
    opacity: 0.6;
    color: black;
}

.work-btn {
    display: none;
}

.filter-btn.active,
.filter-btn:hover {
    opacity: 1;
    border-color: rgba(0, 0, 0, 0);
    background: rgba(0, 0, 0, 0.05);
}

/* --- PROJECTS TABLE VIEW --- */
body.projects-table-view {
    overflow: hidden;
    background: transparent;
}

main.projects-table-main {
    height: 100%;
    width: 100%;
    display: grid;
    grid-template-columns: 1fr;
    grid-template-rows: 1fr auto;
    gap: 0;
}

.projects-table-video-container {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 70%;
    aspect-ratio: 16/9;
    border-radius: 8px;
    background: #f2f2f2;
    overflow: hidden;
    z-index: -1;
    pointer-events: none;
    opacity: 0.1;
    filter: contrast(1.2) blur(12px);
    mix-blend-mode: grayscale;
}

.projects-table-video,
.projects-table-thumbnail {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: cover;
}

.projects-table-thumbnail {
    position: absolute;
    inset: 0;
    z-index: 1;
    opacity: 1;
    pointer-events: none;
    transition: opacity 120ms ease;
}

.projects-table-video-container.is-playing .projects-table-thumbnail {
    opacity: 0;
}

.projects-table-scroll {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 80%;
    max-height: 60%;
    overflow-y: auto;
    background: transparent;
    text-decoration: none;
    border-radius: 0;
    color: white;
    mix-blend-mode: difference;
}

.projects-table-scroll::-webkit-scrollbar {
    width: 4px;
}

.projects-table-scroll::-webkit-scrollbar-track {
    background: transparent;
}

.projects-table-scroll::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.2);
}

.projects-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 17px;
    text-transform: Capitalize;
}

.project-row {
    height: 10px;
    cursor: pointer;
    transition: all 0.2s ease;
    opacity: 0.3;
}

.project-row a{
    text-decoration: none;
    color: inherit;
}

.project-row:hover {
    opacity: 0.6;
}

.project-row.active {
    opacity: 1;
}

.project-number {
    width: 50px;
    padding: 0 20px;
    text-align: right;
    font-weight: 500;
    text-transform: uppercase;
}

.project-row.active .project-number {
    opacity: 1;
}

.project-title-cell,
.project-brand-cell,
.project-location-cell,
.project-year-cell {
    padding: 0 20px;
    text-align: left;
    vertical-align: middle;
}

.project-title-cell {
    font-weight: 500;
    width: 30%;
}

.project-brand-cell {
    width: 25%;
    opacity: 0.7;
}

.project-location-cell {
    width: 25%;
}

.project-year-cell {
    width: 15%;
}

@media(max-width: 900px) {
    .projects-table-video-container {
        width: 70%;
    }
    .projects-table-scroll {
        width: 90%;
        left: 50%;
        transform: translate(-50%, -50%);
    }
    .project-title-cell {
        width: 50%;
    }
    .project-year-cell {
        width: 30%;
    }
    .project-brand-cell {
        width: 20%;
    }
    .project-location-cell {
        display: none;
    }
}

@media(max-width: 699px) {
    .project-title-cell {
        width: 80%;
    }
    .project-year-cell {
        width: 20%;
    }
    .project-brand-cell {
        display: none;
    }
    .project-location-cell {
        display: none;
    }
    .filter-btn[data-filter="Campaign"],
    .filter-btn[data-filter="Music video"] {
        display: none;
    }
    .work-btn {
        display: block;
    }

    .filter-row {
        position: fixed;
        top: 80px;        /* Lo clava en la parte superior del móvil */
        left: 0;
        width: 100%;
        height: 60px;
        padding-left: 20px !important; /* Evita que se coma margen a la izquierda */
        display: flex;
        align-items: center;
        z-index: 100;     /* Asegura que quede por encima de los proyectos al pasar */
        transform: none !important; /* Garantiza que JS no meta mano */
    }

    .filter-container {
        position: relative;
        display: flex;
        gap: 10px;
        align-items: center;
        overflow-x: auto; /* Si los botones de filtro no caben a lo ancho, permite scroll horizontal interno */
        scrollbar-width: none;
        max-width: 100%;
        padding-right: 20px;
    }

    .filter-container::-webkit-scrollbar {
        display: none; /* Esconde la barra de scroll de los botones en iOS/Android */
    }
}

/* Ocultar cursor al pasar por un proyecto */
.project { cursor: none !important; }

/* Estilo de la etiqueta que sigue al ratón */
#custom-cursor {
    position: fixed;
    pointer-events: none;
    background: transparent;
    color: white;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 18px;
    font-family: space-mono, monospace, sans-serif;
    font-weight: 600;
    z-index: 1000;
    display: none;
    white-space: nowrap;
    mix-blend-mode: difference;
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
    animation: pulse 1.5s infinite ease-in-out;
}

@keyframes pulse {
    0% {
        opacity: 1;
    }
    50% {
        opacity: 0.4;
    }
    100% {
        opacity: 1;
    }
}