/* Guía de cuadrícula técnica */
.grid-guia {
    position: fixed;
    /* Respetamos los márgenes del contenedor principal */
    top: var(--margin-v);
    bottom: var(--margin-v);
    left: var(--margin-h);
    right: var(--margin-h);
    
    /* Configuración de 5x5 */
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    grid-template-rows: repeat(5, 1fr);
    
    /* Separaciones solicitadas */
    column-gap: 0.69vw;
    row-gap: 0.98vh;
    
    /* Estética de la guía */
    pointer-events: none; /* Para que puedas hacer clic a través de ella */
    z-index: 9999;        /* Siempre por encima de todo */
}

/* Dibujamos los cuadros de la guía */
.grid-guia::before {
    content: "";
    grid-column: 1 / -1;
    grid-row: 1 / -1;
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    grid-template-rows: repeat(5, 1fr);
    column-gap: inherit;
    row-gap: inherit;
}

/* Generamos los 25 rectángulos rojos */
.grid-guia {
    background-image: 
        linear-gradient(to right, rgba(255, 0, 0, 0.1) 100%, transparent 0%),
        linear-gradient(to bottom, rgba(255, 0, 0, 0.1) 100%, transparent 0%);
}

/* Método más preciso usando hijos vacíos o backgrounds repetidos */
.grid-guia {
    --linea-roja: rgba(255, 0, 0, 0.1);
    background: 
        /* Líneas verticales */
        repeating-linear-gradient(to right, 
            var(--linea-roja), var(--linea-roja) calc((100% - (0.69vw * 4)) / 5), 
            transparent calc((100% - (0.69vw * 4)) / 5), transparent calc(((100% - (0.69vw * 4)) / 5) + 0.69vw)
        ),
        /* Líneas horizontales */
        repeating-linear-gradient(to bottom, 
            var(--linea-roja), var(--linea-roja) calc((100% - (0.98vh * 4)) / 5), 
            transparent calc((100% - (0.98vh * 4)) / 5), transparent calc(((100% - (0.98vh * 4)) / 5) + 0.98vh)
        );
}










@font-face {
    font-family: 'GuardiaFont';
    src: url('/fonts/Guardia-Regular.ttf') format('truetype');
    font-weight: normal;
    font-style: normal;
}

:root {
    --bg-color: #F7F6F6;
    --primary-color: #171C17;
    --margin-v: 4.88vh;
    --margin-h: 3.47vw;
    --radius: 0.4375rem;
    --gap-vectors: 4.44%;
    --transition-speed: 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    --font-size-small: 0.625rem;
    --font-size-normal: 0.875rem;
    --font-size-large: 1.4375rem;
}

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

/* ─── Custom asterisk cursor ───────────────────────────────────────── */
html, body, a, button, [role="button"], * {
    cursor: none !important;
}

/* Wrapper — mix-blend-mode: difference at the container level
   means all children invert against whatever is underneath.
   White content on white bg → black. White on dark → white. */
#custom-cursor {
    position: fixed;
    top: 0;
    left: 0;
    pointer-events: none;
    z-index: 99999;
    /* Single translate — always exactly centered on the pointer */
    transform: translate(-50%, -50%);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.18s ease;
    will-change: transform;
    mix-blend-mode: difference;
    /* Stack children on top of each other */
    width: 0;
    height: 0;
}

/* Focus ring — hollow asterisk outline, same font as the glyph.
   Sits behind the solid asterisk. Appears on any clickable hover. */
#custom-cursor .cursor-ring {
    position: absolute;
    font-family: 'GuardiaFont', sans-serif;
    font-size: 4rem;
    line-height: 1;
    /* Hollow: transparent fill, white stroke */
    color: transparent;
    -webkit-text-stroke: 3px white;
    font-weight: 2px white;
    /* Perfectly center the glyph over the pointer */
    display: flex;
    align-items: center;
    justify-content: center;
    width: 0;
    height: 0;
    white-space: nowrap;
    opacity: 0;
    transform: scale(0.55);
    transition: opacity 0.22s ease, transform 0.28s cubic-bezier(0.34, 1.56, 0.64, 1);
    /* Slight nudge to visually align * glyph center with pointer */
    margin-top: 0.05em;
}

/* Asterisk — white color, inverted by parent mix-blend-mode:
   on light bg (#F7F6F6) it appears near-black; on dark it appears white */
#custom-cursor .cursor-asterisk {
    font-family: 'GuardiaFont', sans-serif;
    font-size: 4rem;
    color: white;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 0;
    height: 0;
    white-space: nowrap;
    transition: opacity 0.15s ease, transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
    position: relative;
    z-index: 1;
    margin-top: 0.05em;
}

/* Project name label — sits outside the blend-mode wrapper context
   so it renders in true colours (black bg, light text) */
#custom-cursor .cursor-label {
    display: none;
    align-items: center;
    justify-content: center;
    /* Override parent blend so label is always legible */
    mix-blend-mode: normal;
    background: #111;
    color: #f5f5f5;
    font-family: 'Supreme Variable', sans-serif;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.13em;
    text-transform: uppercase;
    white-space: nowrap;
    padding: 0.6rem 1.1rem;
    border-radius: 2px;
    line-height: 1;
    opacity: 0;
    transition: opacity 0.18s ease;
    position: relative;
    z-index: 2;
}

/* ── On any clickable: ring expands, asterisk slightly grows ── */
body.cursor-on-link #custom-cursor .cursor-ring {
    opacity: 1;
    transform: scale(1);
}

body.cursor-on-link #custom-cursor .cursor-asterisk {
    transform: scale(1.12);
}

/* ── On project card: hide asterisk → show label, ring stays ── */
body.cursor-on-project #custom-cursor .cursor-asterisk {
    opacity: 0;
    transform: scale(0.4);
}

body.cursor-on-project #custom-cursor .cursor-label {
    display: flex;
    opacity: 1;
}

body.cursor-on-project #custom-cursor .cursor-ring {
    opacity: 0;
}

/* Remove difference blend in label mode so the pill renders in true colour */
body.cursor-on-project #custom-cursor {
    mix-blend-mode: normal;
}

html {
    scrollbar-gutter: stable;
}

body.modo-cat {
    --primary-color: #F9F9F9;
    --bg-color: #171C17;
}

body {
    background-color: var(--bg-color);
    color: var(--primary-color);
    transition: background-color var(--transition-speed), color var(--transition-speed);
    margin: 0;
    overflow-x: hidden;
    font-family: 'Supreme Variable', sans-serif; 
    font-size: var(--font-size-normal);
    min-height: 100vh;
}

a, span, svg, path, .frase-central, #asterisco-dinamico {
    transition: color var(--transition-speed), fill var(--transition-speed), font-weight 0.2s;
}

svg path {
    fill: currentColor;
}

.contenedor-principal {
    position: relative;
    padding: var(--margin-v) var(--margin-h);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: space-between; 
}

.fuente-propia { font-family: 'GuardiaFont', sans-serif; }

img, button, .rectangulo, .card {
    border-radius: var(--radius);
}

.btn-primario {
    background-color: var(--primary-color);
    color: var(--bg-color);
    padding: 10px 20px;
    border: none;
    cursor: pointer;
    border-radius: var(--radius);
}

.footer-vectors {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    gap: var(--gap-vectors);
    width: 100%;
    margin-top: auto;
}

.vector-item {
    position: relative;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    width: calc((100% - (var(--gap-vectors) * 2)) / 3); 
    flex-shrink: 0;
}

.vector-item svg {
    width: 100%;
    height: auto;
    display: block;
}

.u-vector {
    transform: scaleY(1.09); 
    transform-origin: bottom;
}

.asterisco-container {
    position: absolute;
    top: 48%;
    left: 50%;
    transform: translate(-50%, -50%);
    
    width: 20vw; 
    height: 20vw;
    
    display: flex;
    align-items: center;  
    justify-content: center; 
    overflow: visible;
    pointer-events: none;
    z-index: 10;
}

#asterisco-dinamico {
    font-size: 18vw; 
    line-height: 0; 
    display: block;
    margin: 0;
    padding: 0;
    text-align: center;
}

/*--- navbar ---*/
.navbar {
    z-index: 100;
    display: flex;
    flex-direction: column; 
    position: absolute;     
    top: var(--margin-v);   
    right: var(--margin-h);
    gap: 0.2rem;       
    z-index: 100;
}

.navbar a {
    font-size: var(--font-size-normal);   
    color: var(--primary-color);
    text-decoration: none;   
    font-family: 'Supreme Variable', sans-serif;
    line-height: 1.2;
    transition: opacity 0.2s;
    text-align: right;
    /* Larger hit area — invisible padding around the text */
    padding: 0.4rem 0.5rem;
    margin: -0.4rem -0.5rem;
    display: inline-block;
}

.navbar a:hover {
    opacity: 0.6;        
}

.lang-selector {
    font-size: var(--font-size-normal);   
    color: var(--primary-color);
    text-align: right;
}

.frase-central {
    position: absolute;
    top: var(--margin-v); 
    left: 50%;
    transform: translateX(-50%); 
    display: flex;
    gap: 3.687rem; 
    font-size: var(--font-size-large);   
    font-weight: bold;
    color: var(--primary-color);
    white-space: nowrap; 
    text-transform: uppercase;
    font-family: 'Supreme Variable', sans-serif; 
    white-space: nowrap;
    z-index: 50;
    width: auto;
}

.social-links {
    position: absolute;
    top: var(--margin-v);  
    left: var(--margin-h); 
    display: flex;
    flex-direction: column; 
    align-items: flex-start; 
    gap: 0.2rem;             
    z-index: 100;
}

.social-links a {
    font-size: var(--font-size-normal);   
    color: var(--primary-color);
    text-decoration: none;   
    font-family: 'Supreme Variable', sans-serif;
    line-height: 1.2;
    transition: opacity 0.2s;
    /* Larger hit area */
    padding: 0.4rem 0.5rem;
    margin: -0.4rem -0.5rem;
    display: inline-block;
}

.social-links a:hover {
    opacity: 0.6;           
}


.lang-selector span {
    cursor: pointer;
    font-size: var(--font-size-normal);   
    color: var(--primary-color);
    transition: font-weight 0.2s;
}

.lang-selector span.active {
    font-weight: bold;
}

.lang-selector span:not(.active) {
    font-weight: normal;
    opacity: 0.7;
}

.lang-selector span:hover {
    opacity: 1;
}

/* --- Estilos para la página About --- */

.page-about {
    background-color: var(--bg-color);
}

.navbar a.active-link {
    font-weight: bold;
}

.social-links.about-version a {
    font-size: var(--font-size-large);   
    font-weight: bold;
    letter-spacing: -0.02em; 
}

.logo-superior {
    position: absolute;
    top: var(--margin-v); 
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    z-index: 150;
        text-decoration: none;
    outline: none;
    cursor: pointer;
}

.logo-img {
    height: 1.25rem;
    width: auto;
    display: block;
    transition: filter var(--transition-speed);
    border-radius: 0;
}

body.modo-cat .logo-img {
    filter: invert(1);
}

.slideshow-container {
    position: absolute;
    top: 23%; 
    left: 50%;
    transform: translateX(-50%);
    
    width: 13vw; 
    height: 35.45vh;
    
    overflow: hidden;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10;
}

#slideshow-img {
    /* Images are stored in landscape EXIF orientation (rotated left).
       We correct by rotating 90deg clockwise. The container is portrait
       (13vw × 35.45vh). After rotation, we scale up so the image fills
       the container fully — the scale factor covers the aspect swap.  */
    position: absolute;
    top: 50%;
    left: 50%;
    width: 300%;
    height: 300%;
    object-fit: cover;
    border-radius: var(--radius);
    transform: translate(-50%, -50%) rotate(90deg);
    transform-origin: center center;
}

.footer-about {
    position: absolute;
    bottom: var(--margin-v); 
    left: var(--margin-h);  
    right: var(--margin-h);  
    display: flex;
    justify-content: space-between;
    align-items: flex-end;   
    z-index: 100;
}

.about-bio {
    width: 26rem;
    text-align: left;
    font-size: var(--font-size-normal);
    line-height: 1.4;
    text-wrap: balance;
}

.about-cv-wrapper {
    display: flex;
    align-items: flex-end;
    gap: 3vw; 
    width: auto;
}

.cv-column {
    text-align: left;
    font-size: var(--font-size-normal);
    line-height: 1.4;
}   

.cv-item {
    margin-bottom: 1.2rem;
}

.cv-item:last-child {
    margin-bottom: 0;
}

.about-bio p {
    text-wrap: pretty;
}

.cv-item p {
    text-wrap: balance;
}


/* --- Estilos para la página Work --- */
/* Container that fills the space between margins below the navbar area */
.hero-project {
    position: absolute;
    top: calc(var(--margin-v) * 3);
    bottom: calc(var(--margin-v) * 0.5);
    left: var(--margin-h);
    right: var(--margin-h);
    display: block;
    overflow: hidden;
    border-radius: var(--radius);
    text-decoration: none;
}

.hero-media-container {
    position: relative;
    width: 100%;
    height: 100%;
}

.hero-img, .hero-video {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: opacity var(--transition-speed);
}

.hero-project:hover .hero-img {
    opacity: 1; /* Was 0, change to 1 */
}

/* Ensure the video transition is smooth */
.hero-video {
    opacity: 0;
    z-index: 1;
    transition: opacity var(--transition-speed); /* Uses your 0.6s speed */
    pointer-events: none; /* Prevents video from interfering with link clicks */
}

.hero-project:hover .hero-video {
    opacity: 1;
}

/* Vertical Text at Bottom Left */
.hero-title {
    position: absolute;
    bottom: 1.5rem;
    left: 1rem;
    writing-mode: vertical-rl; /* Vertical text */
    transform: rotate(180deg); /* Flips it to read bottom-to-top */
    color: white; /* Or your primary color depending on the image */
    text-transform: uppercase;
    font-family: 'Supreme Variable', sans-serif;
    font-size: var(--font-size-large);
    margin: 0;
    z-index: 2;
    pointer-events: none;
}





/* --- CONFIGURACIÓN RESPONSIVE --- */
@media (max-width: 1100px) {
    .frase-central {
        position: relative;
        top: auto;
        left: auto;
        transform: none;
        
        width: 100%;
        margin: 1rem 0; 
        
        display: flex;
        justify-content: space-between; 
        gap: 0; 
        
        font-size: 5vw; 
        white-space: nowrap;
        margin: 2vh 0;
        order: 2;
    }
    .slideshow-container {
        width: 18vw; 
    }
    .about-bio {
        width: 41%;
    }
    .about-cv-wrapper {
        gap: 5vw; 
    }
}

/* ─────────────────────────────────────────────────────────────────────
   MOBILE  ≤ 700px
   ───────────────────────────────────────────────────────────────────── */
@media (max-width: 700px) {
  :root {
    --margin-v: 4vh;
    --margin-h: 5vw;
  }

  html, body {
    max-width: 100%;
    overflow-x: hidden;
  }

  /* ── Logo: left-align on mobile (avoid centering clash) ── */
  .logo-superior {
    top: var(--margin-v);
    left: var(--margin-h);
    transform: none;
  }

  /* ── WORK PAGE ── */
  /* Push hero image well below the three nav rows */
  .hero-project {
    top: calc(var(--margin-v) + 4.5rem) !important;
    left: var(--margin-h) !important;
    right: var(--margin-h) !important;
    bottom: calc(var(--margin-v) * 1.2) !important;
    border-radius: var(--radius);
  }

  /* social-links.work-version sits one row below the logo */
  .social-links.work-version {
    top: calc(var(--margin-v) + 1.4rem);
  }

  .hero-title {
    font-size: 0.875rem;
    bottom: 1rem;
    left: 0.75rem;
  }

  /* ── ABOUT PAGE ──
     Layout on mobile:
       [logo]            [navbar]
       [social – large]
       [slideshow – centered]
       [bio]
       [cv columns]
     Everything is in normal flow inside the container.
  ── */
  .page-about .contenedor-principal {
    /* override the default flex-column space-between so items
       stack top-to-bottom with explicit gaps instead */
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    gap: 0;
    padding-top: calc(var(--margin-v) + 1.4rem); /* clear logo row */
    padding-bottom: var(--margin-v);
    min-height: 100svh;
    box-sizing: border-box;
  }

  /* social-links (about-version) – goes back to normal flow */
  .social-links.about-version {
    position: static;
    top: auto;
    left: auto;
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    margin-top: 1rem; /* breathing room below navbar row */
  }

  .social-links.about-version a {
    font-size: 1.1rem;
    font-weight: bold;
  }

  /* slideshow – centred block, not absolutely positioned */
  .slideshow-container {
    position: relative !important;
    top: auto !important;
    left: auto !important;
    transform: none !important;
    width: 52vw !important;
    height: 30vh !important;
    margin: 1.5rem auto !important;
  }

  /* bio – normal flow */
  .about-bio {
    position: static !important;
    top: auto !important;
    width: auto !important;
    max-width: 100%;
    font-size: var(--font-size-normal);
    line-height: 1.5;
    text-wrap: balance;
    margin-top: 0.5rem;
  }

  /* footer-about: stack bio on top, cv below */
  .footer-about {
    position: static !important;
    bottom: auto !important;
    left: auto !important;
    right: auto !important;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 1.5rem;
    margin-top: 1.5rem;
    width: 100%;
  }

  .about-cv-wrapper {
    display: flex;
    width: 100%;
    justify-content: space-between;
    align-items: flex-start;
    gap: 0;
  }

  .cv-column {
    width: 47%;
    text-align: left;
  }

  .grid-guia {
    column-gap: 2vw;
    row-gap: 2vh;
  }
}

/* ─────────────────────────────────────────────────────────────────────
   HOVER DEVICES — custom cursor active, touch-only title hidden
   ───────────────────────────────────────────────────────────────────── */
@media (hover: hover) and (pointer: fine) {
  .hero-title.touch-only {
    display: none !important;
  }
}

/* Touch/coarse-pointer devices: show title, hide cursor */
@media (hover: none), (pointer: coarse) {
  .hero-title {
    display: block !important;
  }
  #custom-cursor {
    display: none !important;
  }
}

/* work-version social links — stay below logo on mid screens */
@media (max-width: 900px) {
  .social-links.work-version {
    top: calc(var(--margin-v) + 1.5rem);
  }
}
