Archibald Hunter, a young Englishman, is passing his leisure time near Cruden Bay in the small Scottish village of Whinnyfold when he has a vision of a couple walking past him, carrying a tiny coffin. Archibald also notices a strange old woman watching him. Later, he finds out that his vision has come true, and a child in town has died. Archibald encounters the bizarre old woman again on the seashore; this woman, who introduces herself as Gormala MacNeil, knows that Archibald saw something out of the ordinary. She proceeds to explain that she has "Second Sight"—a sort of psychic ability for premonition that comes and goes at random—and that she can tell that Archibald, too, is a Seer. Fluctuating between skepticism and uneasiness over his newfound abilities, Archibald listens to Gormala's insights and sees one of his visions fulfilled at Lammas-tide, when he and Gormala witness Lauchlane Macleod, a local fisherman, wreck his boat on a chain of sharp rocks known as the Skares. Archibald sees a procession of dead spirits emerge from the water near the Skares and make its way up the cliffs.
About a year later, Archibald has returned to Cruden Bay and is preparing a permanent residence there. He buys a trunk from an auctioneer on the street (where he again encounters Gormala) and finds that the trunk contains letters from the late 16th and early 17th centuries. While near the seashore, Archibald notices two ladies stranded on a rock out in the ocean. He helps them get back to shore, and learns that one of the ladies is an elderly woman named Mrs. Jack, and the other a young, beautiful woman named Marjory, an American who has a strong aversion to Spaniards. Archibald feels himself falling in love with Marjory instantly. Later, Marjory helps Archibald decode the letters that he found in the trunk, which are written in a complicated cipher (Bacon's cipher). Archibald soon proposes marriage to Marjory, but she declines with the excuse that she does not know him well enough.
Eventually, Archibald deciphers all of the documents in the trunk and finds that it is a narrative written by a Spaniard named Don Bernardino de Escoban. Don Bernardino was given a trust by Pope Sixtus V in the late sixteenth century, which included the charge of a substantial treasure to use against England after the defeat of the Spanish Armada. The duty to protect this treasure was to be passed down through generations of Don Bernardino's family, but Don Bernardino lost the treasure after hiding it in a seaside cave. Conveniently, Archibald realizes that, based on the documents, the most likely location of this cave is directly under the house he is currently building.
Later, when he is in Aberdeen, Archibald encounters a pair of diplomats, and they inform him that the woman he has been spending time with is really Marjory Drake, an heiress from Chicago who used her fortune to buy a battleship for the U.S. Navy to use against the Spanish during the Spanish–American War. There is a Spanish plot against Marjory's life, and the United States government has been trying to protect her, but she fled to Scotland to keep them from interfering with her liberty. Archibald also finds out from Marjory that she is a descendant of Sir Francis Drake, the pirate behind many Elizabethan schemes against the Spanish.
Archibald wants to help Marjory escape the threat of kidnapping, and the two eventually get married so as to avoid any legal trouble or scandal since Archibald has been coming and going from Castle Crom, Marjory's residence. Archibald soon succeeds in finding the entrance of the treasure cave, and suspects the presence of secret passages on the grounds of Castle Crom.
One afternoon, while Marjory and Archibald are at Castle Crom looking at the Spanish documents, the landlord of the castle arrives and interrupts them. This landlord is a Spaniard named Don Bernardino—the descendant of the man who wrote the documents. He is astounded that Archibald has possession of the documents and asks that Archibald return the documents to their proper place and not disturb them again. Archibald and Marjory nonetheless decide to continue looking for the treasure, which they find (with some danger) in the cave under Archibald's house. Don Bernardino and Archibald almost have a duel over this newfound treasure, but decide against it. Meanwhile, Marjory goes missing.
Archibald decides to ask Don Bernardino for help finding Marjory, and Don Bernardino sees the opportunity of helping to rescue the young woman as a chance to regain the honor he lost in failing to find the treasure. He reveals a secret passage in the castle, and the police determine that Marjory has been kidnapped. Fortunately, Marjory has left a cipher for Archibald, giving him instructions for how to find her. Archibald encounters Gormala during the search and enlists her help, despite the fact that she had previously led the band of kidnappers to Archibald's house, where they stole the treasure. Gormala falls on the cliff, and takes Archibald's hands as she is dying. Through Gormala's power of Second Sight, Archibald sees a vision of the ship and learns of Marjory's location.
While on the ship, Archibald murders two of the kidnappers and releases Marjory. A fight ensues, and Archibald, Marjory, and Don Bernardino are thrown into the water around the Skares. Archibald forces his way to shore, dragging Marjory along with him. Many of the bodies of the other men involved in the struggle are washed up on the shore. Don Bernardino is one of the dead. Marjory and Archibald ensure that his body is taken back to Spain and buried with his ancestors, and they install above his tomb the statue of San Cristobal that guarded over the treasure in the cave.

Question: How is Castle Crom connected to the hidden treasure?
Answer: There are underground passageways