@font-face {
  font-family: 'Schengen';
  src: url('./FONTS/schengen.otf') format('opentype');
  font-weight: normal;
  font-style: normal;
}

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

@media (pointer: fine) {
  *, *::before, *::after { cursor: none !important; }
  img, video { cursor: none !important; }
}

:root {
  --max-width: 1920px;
  --margin: 20px;
  --gutter: 25px;
  --font-size: 8pt;
  --line-height-bio: 10pt;
  --line-height-rest: 12pt;
  --color-text: #000000;
  --color-bg: #ffffff;
  --opacity-rest: 0.3;
  --opacity-hover: 0.7;
  --carousel-gap: 15px;
}

html, body {
  background-color: var(--color-bg);
  color: var(--color-text);
  font-family: 'Schengen', sans-serif;
  font-size: var(--font-size);
  width: 100%;
  min-height: 100vh;
  overflow-x: hidden;
}

/* ===================== DESKTOP ===================== */
.page {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: var(--margin);
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 0 var(--gutter);
  min-height: 100vh;
  align-content: start;
}

.name {
  position: fixed;
  top: var(--margin);
  left: var(--margin);
  opacity: var(--opacity-rest);
  line-height: var(--line-height-rest);
  transition: opacity 0.3s ease;
  width: fit-content;
  z-index: 10;
}

.bio-trigger {
  grid-column: 4 / 5;
  grid-row: 1;
  line-height: var(--line-height-bio);
  opacity: var(--opacity-rest);
  cursor: default;
  transition: opacity 0.3s ease;
  position: relative;
}

.bio-trigger:hover { opacity: var(--opacity-hover); }
.bio-expanded { display: none; }
.bio-trigger:hover .bio-expanded,
.bio-trigger.active .bio-expanded { display: inline; }

.bio-photo {
  display: none;
  position: fixed;
  top: var(--margin);
  opacity: 1;
}
.bio-photo img { width: 100%; display: block; }

.nav-info, .nav-educacion, .nav-experiencia {
  position: fixed;
  top: calc(var(--margin) + var(--line-height-rest) + 50px);
  opacity: var(--opacity-rest);
  line-height: var(--line-height-rest);
  cursor: default;
  transition: opacity 0.3s ease;
}
.nav-info:hover, .nav-educacion:hover, .nav-experiencia:hover { opacity: var(--opacity-hover); }

.panel-row {
  position: fixed;
  top: calc(var(--margin) + var(--line-height-rest) + 150px);
  left: var(--margin);
  right: var(--margin);
  display: none;
  grid-template-columns: repeat(5, 1fr);
  gap: 0 var(--gutter);
}
.panel-row.visible { display: grid; }

.panel-col-1 { grid-column: 1 / 2; line-height: var(--line-height-rest); opacity: var(--opacity-hover); white-space: nowrap; }
.panel-col-3 { grid-column: 3 / 4; line-height: var(--line-height-rest); opacity: var(--opacity-hover); white-space: nowrap; }
.panel-col-5 { grid-column: 5 / 6; line-height: var(--line-height-rest); opacity: var(--opacity-hover); text-align: right; white-space: nowrap; }

.projects {
  position: fixed;
  top: 400px;
  left: var(--margin);
  right: var(--margin);
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 0 var(--gutter);
  z-index: 100;
  mix-blend-mode: difference;
  color: #ffffff;
}

.project-item {
  grid-column: 1 / -1;
  position: relative;
  opacity: var(--opacity-rest);
  line-height: var(--line-height-rest);
  transition: opacity 0.2s ease;
  cursor: pointer;
  height: var(--line-height-rest);
}
.project-item.active { opacity: var(--opacity-hover); }

.project-name, .project-type, .project-year {
  position: absolute;
  display: inline;
  white-space: nowrap;
}

.project-carousel {
  display: none;
  position: fixed;
  top: var(--margin);
  bottom: 0;
  overflow: hidden;
  user-select: none;
  mix-blend-mode: normal;
  transition: opacity 0.3s ease;
}
.project-carousel.active { display: block; }

.carousel-track {
  display: flex;
  flex-direction: column;
  gap: var(--carousel-gap);
  will-change: transform;
}

.carousel-project-separator { width: 100%; height: 0; flex-shrink: 0; }

.carousel-track img, .carousel-track video {
  width: 100%;
  display: block;
  flex-shrink: 0;
}

.project-text {
  display: none;
  position: fixed;
  line-height: var(--line-height-bio);
  opacity: var(--opacity-hover);
}
.project-text.active { display: block; }
.project-text-title { margin-bottom: 8px; }
.project-text a { color: inherit; text-decoration: none; }
.project-text a:hover { opacity: 0.3; }

.panel-col-3 a { color: inherit; text-decoration: none; }
a { color: inherit; text-decoration: none; transition: opacity 0.2s ease; }
a:hover { opacity: 0.3; }

.cursor-line {
  position: fixed; left: 0; right: 0; height: 1px;
  background: #000; opacity: 0.1; pointer-events: none;
  z-index: 9999; transform: translateY(-50%);
}
.cursor-line-v {
  position: fixed; top: 0; bottom: 0; width: 1px;
  background: #000; opacity: 0.1; pointer-events: none;
  z-index: 9999; transform: translateX(-50%);
}
.image-counter {
  display: none; position: fixed; bottom: var(--margin);
  font-family: 'Schengen', sans-serif; font-size: var(--font-size);
  line-height: var(--line-height-rest); opacity: 0.3; pointer-events: none;
}
.image-counter.active { display: block; }

.cursor-coords {
  position: fixed; bottom: var(--margin); right: var(--margin);
  font-family: 'Schengen', sans-serif; font-size: var(--font-size);
  line-height: var(--line-height-rest); opacity: 0.3;
  pointer-events: none; z-index: 9999;
}

.disclaimer {
  position: fixed; bottom: var(--margin);
  font-family: 'Schengen', sans-serif; font-size: var(--font-size);
  line-height: var(--line-height-rest); opacity: 0.3;
  pointer-events: none; text-transform: uppercase;
  z-index: 100; mix-blend-mode: difference; color: #ffffff;
}

.lightbox {
  position: fixed; inset: 0; z-index: 9998;
  display: flex; align-items: center; justify-content: center;
  padding: var(--margin); opacity: 0; pointer-events: none;
  transition: opacity 0.4s ease;
}
.lightbox.active { opacity: 1; pointer-events: all; }
.lightbox img {
  width: 100%; max-height: 100vh; object-fit: contain;
  transform: scale(0.92);
  transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.lightbox.active img { transform: scale(1); }

/* ===================== MOBILE ===================== */
@media (pointer: coarse) {
  .page, .name, .bio-trigger, .bio-photo,
  .nav-info, .nav-educacion, .nav-experiencia,
  .panel-row, .projects, .project-carousel,
  .project-text, .cursor-line, .cursor-line-v,
  .image-counter, .cursor-coords, .disclaimer, .lightbox {
    display: none !important;
  }

  .m-frame {
    display: none;
    position: fixed;
    inset: 0;
    background: var(--color-bg);
    overflow-y: auto;
    overflow-x: hidden;
    padding: 20px;
    padding-bottom: 50px;
    font-family: 'Schengen', sans-serif;
    font-size: 8pt;
    line-height: 10pt;
    color: #000;
  }
  .m-frame.active { display: block; }
  #m-home.active {
    display: flex;
    flex-direction: column;
  }
  #m-home .m-project-list {
    flex: 0 0 auto;
  }
  #m-home .m-carousel-wrap {
    flex: 0 0 auto;
    margin-top: auto;
  }

  .m-disclaimer-global {
    position: fixed;
    bottom: 20px;
    left: 20px;
    opacity: 0.3 !important;
    text-transform: uppercase;
    font-size: 8pt;
    pointer-events: none;
    z-index: 99999;
    color: #000;
    isolation: isolate;
  }

  .m-nav {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0 10px;
    margin-bottom: 60px;
    position: sticky;
    top: 0;
    background: var(--color-bg);
    z-index: 10;
    padding-top: 0;
  }
  .m-nav-btn {
    opacity: 0.3;
    line-height: 10pt;
    cursor: pointer;
    transition: opacity 0.2s ease;
  }
  .m-nav-btn.active-btn { opacity: 0.7; }
  .m-nav-btn:last-child { text-align: right; }

  .m-project-list {
    display: grid;
    grid-template-columns: max-content 1fr auto;
    gap: 0 20px;
    margin-bottom: 40px;
  }
  .m-project-row {
    display: contents;
    cursor: pointer;
  }
  .m-project-row-name,
  .m-project-row-type,
  .m-project-row-year {
    margin-bottom: 3pt;
    opacity: 0.3;
    transition: opacity 0.2s ease;
    white-space: nowrap;
    cursor: pointer;
  }
  .m-project-row-type { text-align: left; }
  .m-project-row-year { text-align: right; }
  .m-project-row.carousel-active .m-project-row-name,
  .m-project-row.carousel-active .m-project-row-type,
  .m-project-row.carousel-active .m-project-row-year { opacity: 0.7; }

  .m-carousel-wrap {
    overflow: hidden;
    width: calc(100% + 40px);
    margin-left: -20px;
    margin-right: -20px;
    margin-bottom: 60px;
    flex-shrink: 0;
  }
  #m-home { overflow-x: clip; overflow-y: auto; }
  .m-carousel-h {
    display: flex;
    gap: 10px;
    will-change: transform;
    transition: none;
  }
  .m-carousel-h-item {
    flex-shrink: 0;
    cursor: pointer;
  }
  .m-carousel-h-item img {
    height: 75vw;
    width: auto;
    display: block;
  }

  .m-about-bio {
    opacity: 0.7;
    line-height: 10pt;
    margin-bottom: 40px;
  }
  .m-about-section {
    margin-bottom: 24px;
  }
  .m-about-label {
    opacity: 0.3;
    margin-bottom: 8px;
  }
  .m-about-row {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0 10px;
    opacity: 0.7;
    margin-bottom: 4px;
    line-height: 10pt;
  }
  .m-about-row a { color: inherit; text-decoration: none; }

  .m-project-inicio {
    position: fixed;
    top: 20px;
    left: 20px;
    opacity: 0.3;
    cursor: pointer;
    z-index: 20;
    transition: opacity 0.2s ease;
    mix-blend-mode: difference;
    color: #fff;
    font-family: 'Schengen', sans-serif;
    font-size: 8pt;
  }
  .m-project-inicio.scrolled { opacity: 0.7; }
  .m-project-meta {
    opacity: 0.7;
    margin-bottom: 20px;
    color: #000;
    mix-blend-mode: difference;
    color: #fff;
    transition: opacity 0.3s ease;
  }
  .m-project-body {
    padding-top: 10px;
  }
  .m-project-desc {
    opacity: 0.7;
    line-height: 10pt;
    margin-bottom: 30px;
    transition: opacity 0.3s ease;
  }
  .m-project-desc a { color: inherit; text-decoration: none; }
  .m-project-images {
    display: flex;
    flex-direction: column;
    gap: 10px;
  }
  .m-project-images img,
  .m-project-images video {
    width: 100%;
    display: block;
  }

  .m-next-project {
    position: fixed;
    bottom: 20px;
    left: 0;
    right: 0;
    text-align: center;
    opacity: 0.3;
    cursor: pointer;
    font-size: 8pt;
    transition: opacity 0.2s ease;
    z-index: 15;
    pointer-events: all;
    display: none;
    mix-blend-mode: difference;
    color: #fff;
  }

  .m-zoom-overlay {
    position: fixed;
    z-index: 9995;
    pointer-events: none;
    overflow: hidden;
    border-radius: 0;
    transition: none;
    left: -9999px;
    opacity: 0;
  }
  .m-zoom-overlay img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
  }
}

/* Ocultar elementos móviles en escritorio */
@media (pointer: fine) {
  .m-disclaimer-global,
  .m-frame,
  .m-project-inicio,
  #m-next-project,
  .m-zoom-overlay { display: none !important; }
}