/* Manuel Marcos — portfolio */

@font-face {
  font-family: "Ogg";
  src: url("../assets/fonts/Ogg-Roman.otf") format("opentype");
  font-display: swap;
}

:root {
  --gutter: 2vw;
  --pp: 2vw;
  --maxw: 1305px;
  --white: #fff;
  --black: #000;
  --accent: #171717;
  --light: #f0f0f0;
  --dark: #38383b;
  --hdr-pad: 1.2vw;
  --hdr-h: calc(30px + 2 * var(--hdr-pad));
  --sans: "Helvetica Neue", Helvetica, Arial, sans-serif;

  /* escala tipográfica (fluida entre móvil y 1305px) */
  --fs-h1: min(calc(2.64vw + 1rem), 46.452px);
  --fs-h2: min(calc(1.92vw + 1rem), 37.056px);
  --fs-h3: min(calc(0.96vw + 1rem), 24.528px);
  --fs-h4: min(calc(0.24vw + 1rem), 15.132px);
  --fs-p: min(calc(0.12vw + 1rem), 13.566px);
  --fs-large: min(calc(0.24vw + 1rem), 15.132px);
  --fs-small: min(calc(-0.12vw + 1rem), 10.8px);
}

@media screen and (max-width: 767px) and (orientation: portrait) {
  :root {
    --u: min(100vh, 900px);
    --fs-h1: calc(0.0264 * var(--u) + 1rem);
    --fs-h2: calc(0.0192 * var(--u) + 1rem);
    --fs-h3: calc(0.0096 * var(--u) + 1rem);
    --fs-h4: calc(0.0024 * var(--u) + 1rem);
    --fs-p: calc(0.0012 * var(--u) + 1rem);
    --fs-large: calc(0.0024 * var(--u) + 1rem);
    --fs-small: calc(-0.0012 * var(--u) + 1rem);
  }
}

@media (max-width: 767px) {
  :root {
    --gutter: 6vw;
    --hdr-pad: 6vw;
    --hdr-h: calc(37px + 2 * var(--hdr-pad));
  }
}

html {
  font-size: 12px;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--white);
  color: var(--black);
  font-family: var(--sans);
  font-size: var(--fs-p);
  font-weight: 400;
  line-height: 1;
  overflow-wrap: break-word;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

img,
video {
  display: block;
  max-width: 100%;
}

a {
  color: inherit;
}

button {
  font: inherit;
  color: inherit;
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
}

figure {
  margin: 0;
}

.skip {
  position: absolute;
  left: -9999px;
}

.skip:focus {
  left: 1rem;
  top: 1rem;
  z-index: 100;
  background: #fff;
  color: #000;
  padding: 1rem;
}

/* ---------- cabecera ---------- */

.hdr {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  box-sizing: border-box;
  height: var(--hdr-h);
  padding: var(--hdr-pad) var(--gutter);
  background: var(--black);
  color: var(--white);
  transition: transform 0.3s ease;
}

.hdr.is-hidden {
  transform: translateY(-100%);
}

.hdr-logo {
  flex: none;
}

.hdr-logo img {
  height: 30px;
  width: auto;
}

.hdr-nav {
  display: flex;
  margin-left: 3.6vw;
}

.hdr-nav a {
  padding: 0.1em 0;
  margin-right: 1.63vw;
  text-decoration: none;
  line-height: 1;
  background: linear-gradient(currentColor, currentColor) no-repeat 0 100% / 0 1px;
}

.hdr-nav a.is-active,
.hdr-nav a:hover {
  background-size: 100% 1px;
}

.burger {
  display: none;
  position: relative;
  width: 35px;
  height: 35px;
  margin-left: auto;
}

.burger span {
  position: absolute;
  left: 0;
  width: 35px;
  height: 1px;
  background: currentColor;
  transition: transform 0.25s ease, top 0.25s ease;
}

.burger span:nth-child(1) {
  top: 12px;
}

.burger span:nth-child(2) {
  top: 23px;
}

.menu-open .burger span:nth-child(1) {
  top: 17px;
  transform: rotate(45deg);
}

.menu-open .burger span:nth-child(2) {
  top: 17px;
  transform: rotate(-45deg);
}

.menu {
  position: fixed;
  inset: 0;
  z-index: 15;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--hdr-h) var(--gutter) var(--gutter);
  background: var(--white);
  color: var(--black);
}

.menu-open .hdr {
  background: transparent;
  color: var(--black);
}

.menu-open .hdr-logo {
  visibility: hidden;
}

.menu[hidden] {
  display: none;
}

.menu nav {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.menu a {
  margin: 3vw 5vw;
  font-size: 8.5vmin;
  line-height: 1;
  text-decoration: none;
}

.menu-open {
  overflow: hidden;
}

@media (max-width: 767px) {
  .hdr-nav {
    display: none;
  }

  .hdr-logo img {
    height: 24px;
  }

  .burger {
    display: block;
    margin-right: 6px;
  }
}

/* ---------- secciones ---------- */

.t-white { --bg: var(--white); --fg: var(--black); --head: var(--black); --link: var(--accent); }
.t-white-bold { --bg: var(--white); --fg: var(--black); --head: var(--accent); --link: var(--accent); }
.t-light { --bg: var(--light); --fg: var(--black); --head: var(--black); --link: var(--accent); }
.t-light-bold { --bg: #e3e3e3; --fg: var(--black); --head: var(--accent); --link: var(--accent); }
.t-dark { --bg: var(--dark); --fg: var(--white); --head: var(--white); --link: var(--light); }
.t-dark-bold { --bg: var(--dark); --fg: var(--white); --head: var(--light); --link: var(--light); }
.t-black { --bg: var(--black); --fg: var(--white); --head: var(--white); --link: var(--light); }
.t-black-bold { --bg: var(--black); --fg: var(--white); --head: var(--light); --link: var(--light); }
.t-bright { --bg: var(--accent); --fg: var(--white); --head: var(--white); --link: var(--white); }
.t-bright-inverse { --bg: var(--white); --fg: var(--accent); --head: var(--accent); --link: var(--accent); }

.sec {
  position: relative;
  display: flex;
  align-items: center;
  box-sizing: border-box;
  min-height: var(--minh, 0);
  background: var(--bg);
  color: var(--fg);
}

.sec.al-top { align-items: flex-start; }
.sec.al-bottom { align-items: flex-end; }

main > .sec:first-child,
main > .ph:first-child {
  padding-top: var(--hdr-h);
}

.sec-wrap {
  position: relative;
  z-index: 1;
  display: flex;
  justify-content: center;
  box-sizing: content-box;
  width: 100%;
  max-width: var(--maxw);
  margin: 0 auto;
  padding: var(--pt, 0) var(--gutter) var(--pb, 0);
}

.sec.ha-left > .sec-wrap { justify-content: flex-start; }
.sec.ha-right > .sec-wrap { justify-content: flex-end; }

.sec-content {
  width: var(--cw, 100%);
  min-width: 0;
}

.sec--fluid > .sec-wrap,
.sec--gallery > .sec-wrap,
.sec--uil > .sec-wrap {
  max-width: none;
  padding-left: 0;
  padding-right: 0;
}

.sec--fluid .sec-content,
.sec--gallery .sec-content,
.sec--uil .sec-content {
  width: 100%;
}

.sec-bg {
  position: absolute;
  inset: 0;
  overflow: hidden;
}

.sec-bg img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.sec-ov {
  position: absolute;
  inset: 0;
  background: var(--bg);
}

@media (max-width: 767px) {
  .sec-content {
    width: 100%;
  }
}

/* ---------- rejilla clásica (12 columnas) ---------- */

.row {
  display: flex;
}

.grid12 > .row {
  margin: 0 -17px;
}

.col {
  flex: none;
  width: var(--w, 100%);
  min-width: 0;
  box-sizing: border-box;
}

.blk {
  box-sizing: border-box;
  min-width: 0;
}

.grid12 .blk {
  padding: 17px;
}

.grid12 .blk.pt0 { padding-top: 0; }
.grid12 .blk.pb0 { padding-bottom: 0; }

@media (max-width: 767px) {
  .row {
    flex-direction: column;
  }

  .col {
    width: 100%;
  }

  .grid12 .blk:first-child { padding-top: 17px; }
  .grid12 .blk:last-child { padding-bottom: 17px; }
  .grid12 .blk-spacer { display: none; }
}

/* ---------- rejilla fluida ---------- */

.fe {
  --sqs-site-gutter: var(--gutter);
  --sqs-mobile-site-gutter: 6vw;
  --sqs-site-max-width: var(--maxw);
}

.fe-block {
  position: relative;
  display: flex;
  min-width: 0;
}

.fe-block > .blk {
  display: flex;
  flex-direction: column;
  flex: 1;
  width: 100%;
}

.fe-block > .blk-img {
  position: relative;
}

.fe-block > .blk-img img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.fe-block > .blk-img--fit img {
  object-fit: contain;
}

/* ---------- texto ---------- */

.rte { display: flow-root; }
.rte > :first-child { margin-top: 0; }
.rte > :last-child { margin-bottom: 0; }

.rte p {
  margin: 1rem 0;
  white-space: pre-wrap;
}

h1, h2, h3, h4 {
  margin: 2rem 0;
  font-family: var(--sans);
  font-weight: 500;
  color: var(--head, inherit);
  white-space: pre-wrap;
}

h1 { font-family: "Ogg", var(--sans); font-size: var(--fs-h1); line-height: 0.6384; }
h2 { font-size: var(--fs-h2); line-height: 0.6552; }
h3 { font-size: var(--fs-h3); line-height: 0.6776; }
h4 { font-size: var(--fs-h4); line-height: 0.6944; }

.rte .blank::before { content: "\200b"; }

.rte .large { font-size: var(--fs-large); }
.rte .small { font-size: var(--fs-small); }

.rte a {
  color: var(--link, inherit);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.2em;
}

.rte strong { font-weight: 700; }
.rte .c-dark { color: var(--dark); }
.rte .c-white { color: var(--white); }
.rte .c-black { color: var(--black); }
.rte .c-accent { color: var(--accent); }
.rte .c-light { color: var(--light); }

.rte pre {
  margin: 1em 0;
  white-space: pre-wrap;
  font-family: monospace, serif;
  font-size: var(--fs-p);
  line-height: 1;
}

.rte code {
  font-family: var(--sans);
  font-size: var(--fs-small);
  line-height: 1.2;
}

/* ---------- imagen, vídeo, incrustados ---------- */

.blk-img figure {
  margin: 0 auto;
}

.blk-img img {
  width: 100%;
  height: auto;
}

.vid {
  position: relative;
  width: 100%;
  aspect-ratio: var(--ar, 1.7778);
  background: #000;
  overflow: hidden;
}

.vid video {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.vid-play {
  position: absolute;
  top: 50%;
  left: 50%;
  width: clamp(56px, 8.3vw, 120px);
  aspect-ratio: 1;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.55);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  transition: transform 0.2s ease, opacity 0.2s ease;
}

.vid-play:hover {
  transform: translate(-50%, -50%) scale(1.06);
}

.vid-play svg {
  width: 42%;
  margin: 0 auto;
  fill: #fff;
}

.vid.is-playing .vid-play {
  opacity: 0;
  pointer-events: none;
}

.embed {
  position: relative;
  width: 100%;
  height: 0;
  background: #000;
}

.embed iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

/* ---------- marquesina ---------- */

.blk-marquee {
  display: flex;
  align-items: center;
  height: 100%;
  background: var(--dark);
  color: var(--fg);
  mix-blend-mode: darken;
}

.fe-block > .blk-marquee {
  flex-direction: row;
  justify-content: flex-start !important;
}

.mq-view {
  display: flex;
  width: 100%;
  overflow: hidden;
  -webkit-mask-image: linear-gradient(to right, transparent 0%, #000 15%, #000 85%, transparent 100%);
  mask-image: linear-gradient(to right, transparent 0%, #000 15%, #000 85%, transparent 100%);
}

.mq-track {
  display: flex;
  flex: none;
  white-space: pre;
  font-size: min(calc((var(--mq-size) - 1) * 1.2vw + 1rem), calc((var(--mq-size) - 1) * 15.66px + 1rem));
  line-height: 1.4;
  will-change: transform;
}

.mq-item {
  flex: none;
  padding-right: var(--mq-gap);
}

/* ---------- galerías ---------- */

.gal {
  /* el espacio entre imágenes escala con el ancho, como en el original */
  --gw: min(100vw - 2 * var(--gutter), var(--maxw));
  --gap: calc(var(--gutn, 0) * var(--gw) / 1950);
}

.gal-w-full {
  --gw: calc(100vw - 2 * var(--gutter));
}

.gal-w-inset,
.gal-w-full {
  box-sizing: border-box;
  margin: 0 auto;
  padding: var(--gutter);
}

.gal-w-inset {
  max-width: calc(var(--maxw) + 2 * var(--gutter));
}

.gal img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* slideshow */
.gal-slideshow {
  display: flex;
  flex-direction: column;
  box-sizing: border-box;
  height: calc(100vh + 2 * var(--gutter));
  max-width: var(--maxw);
  margin: 0 auto;
  padding: var(--gutter) 0;
}

.ss-stage {
  position: relative;
  flex: 1;
  min-height: 0;
}

.ss-list {
  position: absolute;
  inset: 0 80px;
}

.ss-slide {
  position: absolute;
  inset: 0;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.6s ease, visibility 0.6s;
}

.ss-slide.is-active {
  opacity: 1;
  visibility: visible;
}

.ss-slide img {
  object-fit: contain;
}

.ss-btn,
.reel-btn,
.car-btn {
  position: absolute;
  top: 50%;
  z-index: 2;
  width: 40px;
  height: 40px;
  transform: translateY(-50%);
  opacity: 0.7;
  transition: opacity 0.2s ease;
}

.ss-btn:hover,
.reel-btn:hover,
.car-btn:hover {
  opacity: 1;
}

.ss-btn svg,
.reel-btn svg,
.car-btn svg {
  width: 9px;
  height: 16px;
  margin: 0 auto;
  stroke-width: 1px;
}

.ss-prev { left: 20px; }
.ss-next { right: 20px; }

.ss-thumbs {
  display: flex;
  justify-content: center;
  gap: 10px;
  padding-top: 20px;
}

.ss-thumb {
  width: 80px;
  height: 80px;
  opacity: 0.5;
  transition: opacity 0.2s ease;
}

.ss-thumb.is-active,
.ss-thumb:hover {
  opacity: 1;
}

/* reel */
.gal-reel {
  position: relative;
  height: var(--h);
}

.gal-reel.gal-w-full,
.gal-reel.gal-w-inset {
  padding: var(--gutter);
  max-width: none;
}

.reel-track {
  position: relative;
  display: flex;
  height: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
  cursor: grab;
  -webkit-overflow-scrolling: touch;
}

.reel-track.is-dragging {
  cursor: grabbing;
}

.reel-track::-webkit-scrollbar {
  display: none;
}

.reel-item {
  flex: none;
  height: 100%;
  aspect-ratio: var(--ar);
  scroll-snap-align: center;
  user-select: none;
}

.reel-item img {
  pointer-events: none;
}

.reel-btn {
  width: 44px;
  height: 44px;
  background: var(--white);
  color: var(--black);
  opacity: 1;
}

.reel-btn svg {
  width: 18px;
  height: 10px;
}

.reel-prev { left: 44px; }
.reel-next { right: 44px; }

/* masonry */
.gal-masonry {
  display: flex;
  align-items: flex-start;
  gap: var(--gap);
}

.ms-col {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: var(--gap);
  min-width: 0;
}

/* strips (filas justificadas; el JS fija el alto de cada fila) */
.gal-strips {
  display: flex;
  flex-wrap: wrap;
  gap: var(--gap);
}

.st-item {
  flex: none;
  height: var(--h, var(--rh));
  width: calc(var(--h, var(--rh)) * var(--ar));
  max-width: 100%;
}

/* grid */
.gal-grid {
  display: grid;
  grid-template-columns: repeat(var(--cols), minmax(0, 1fr));
  gap: var(--gap);
}

.gr-item {
  aspect-ratio: var(--ar);
  overflow: hidden;
}

@media (max-width: 767px) {
  .gal-grid {
    grid-template-columns: repeat(min(var(--cols), 2), minmax(0, 1fr));
  }

  .gal-slideshow {
    height: 100vw;
    padding: 0;
  }

  .ss-list {
    inset: 0 40px;
  }

  .ss-prev { left: 0; }
  .ss-next { right: 0; }

  .ss-thumb {
    width: 48px;
    height: 48px;
  }
}

/* carrusel */
.carousel {
  position: relative;
  padding: var(--pt) var(--gutter) var(--pb);
}

.car-track {
  display: flex;
  margin: 0;
  padding: 0;
  list-style: none;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
}

.car-track::-webkit-scrollbar {
  display: none;
}

.car-slide {
  flex: none;
  width: calc(100% / var(--cols));
  scroll-snap-align: start;
}

.car-media {
  width: var(--mw);
  margin: 0 auto 3%;
  aspect-ratio: var(--ar);
  overflow: hidden;
}

.car-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.car-title {
  width: var(--tw);
  max-width: 100%;
  margin: 0 auto;
  font-size: 1rem;
  line-height: 1.2;
}

.car-prev { left: 3vw; }
.car-next { right: 3vw; }

.car-btn[hidden] {
  display: none;
}

@media (max-width: 767px) {
  .carousel {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    padding-left: 0;
    padding-right: 0;
  }

  .car-track {
    order: -1;
    width: 100%;
  }

  .car-slide {
    width: 100%;
  }

  .car-btn {
    position: static;
    transform: none;
    margin-top: 6px;
  }
}

/* ---------- home: lista con fondos ---------- */

.ph {
  position: relative;
  display: flex;
  align-items: center;
  box-sizing: border-box;
  min-height: 100vh;
  padding: 0 2vw 2vw;
  background: var(--black);
  color: var(--white);
  overflow: hidden;
}

.ph-bgs,
.ph-bg,
.ph-ov,
.ph-video {
  position: absolute;
  inset: 0;
}

.ph-video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: brightness(0.469);
}

.ph-bg {
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.6s ease, visibility 0.6s;
}

.ph-bg.is-active {
  opacity: 1;
  visibility: visible;
}

.ph-bg img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.ph-ov {
  background: #000;
  opacity: 0.1;
  mix-blend-mode: hard-light;
  pointer-events: none;
}

.ph-list {
  position: relative;
  z-index: 1;
  margin: 0;
  padding: 5vw;
  list-style: none;
}

.ph-item {
  display: block;
  padding: 0.49rem 0;
  font-size: var(--fs-h1);
  font-weight: 500;
  line-height: 0.7;
  text-decoration: none;
  opacity: 0.85;
  transition: opacity 0.2s ease;
}

.ph-item span {
  margin-right: 3.63rem;
}

.ph-item:hover,
.ph-item.is-active {
  opacity: 1;
}

/* ---------- paginación de proyecto ---------- */

.pag {
  display: flex;
  justify-content: space-between;
  padding: 3vw var(--gutter);
  background: var(--bg);
  color: var(--fg);
}

.pag-link {
  display: flex;
  align-items: center;
  max-width: 50%;
  text-decoration: none;
}

.pag-next {
  margin-left: auto;
  text-align: right;
}

.pag-icon {
  flex: none;
  width: 18px;
  height: 32px;
}

.pag-icon svg {
  width: 100%;
  height: 100%;
  stroke-width: 1px;
}

.pag-prev .pag-icon { margin-right: 25px; }
.pag-next .pag-icon { margin-left: 25px; }

.pag-title {
  font-size: var(--fs-h3);
  font-weight: 500;
  line-height: 1;
}

/* ---------- pie ---------- */

.ftr .rte a {
  margin-left: 1.2em;
}

.ftr .rte a:first-child {
  margin-left: 0;
}

/* ---------- animación de entrada ---------- */

.js .anim {
  opacity: 0;
  transform: scale(0.97);
  transition: opacity 0.9s cubic-bezier(0.4, 0, 0.2, 1), transform 0.9s cubic-bezier(0.4, 0, 0.2, 1);
}

.js .anim.in {
  opacity: 1;
  transform: none;
}

@media (prefers-reduced-motion: reduce) {
  .js .anim,
  .ph-bg,
  .ss-slide,
  .hdr {
    transition: none;
  }

  .js .anim {
    opacity: 1;
    transform: none;
  }
}
