/* RZ-LABEL hall-grid-20261124-CT
 * Shared Hall of Raziel™ / Sanctuary / Library page grid.
 * Root cause: --rz-page-width is 90vw (viewport units) and was applied
 * to inner shells (main.hl, lineage, tables) that already sit inside a
 * page grid. From 960px up those inners are as wide as the whole shell
 * and paint under reserved side columns (.ab-side, and any overflow of
 * the canon rail). The marble columns (z-index 8) sit on the 90vw edge
 * and clip rail text. Mid-width .lore-col (2 columns from 1100px) parks
 * tall cards in the right half and leaves a blank left column.
 * Undo: restore this file, site-head.html, site-footer.html, and the
 * sibling asset baks from /home/ruezal/rz-bak/hall-grid-fix-golive-*-CT.
 */

/* ---- 1. Inner grid children shrink to their track, not the viewport ---- */
.ab-layout > main.ab,
.ab-layout > main.hl,
.ab-layout > main {
  width: auto;
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
}
.rz-rest,
.rz-front .wrap,
.card.lz,
.lz-tree,
.lz-compact,
.lz-step,
.lz-node,
.ab-layout table,
main.ab table,
main.hl table {
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
}

/* Content paints above the marble gutters so rail/side text is never cut. */
.rz-front,
.ab-layout,
.rz-rest,
.rz-rail,
.ab-side {
  position: relative;
  z-index: 3;
}
.rz-col {
  z-index: 1;
}

/* ---- 2. Canon rail: own column only at 1280+. At 900-1279 it sits
      below the main column (same idea as the existing <1000px block).
      Phones (and all max-width: 999px rules in hall-front.css) stay. ---- */
@media (min-width: 1000px) and (max-width: 1279px) {
  .rz-front {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas: none;
    column-gap: 0;
  }
  .rz-hero,
  .rz-shelf,
  .rz-front .hall-find,
  .rz-rail,
  .rz-rest {
    grid-area: auto;
  }
  .rz-rail {
    margin: 0 0 1.25rem;
    max-width: 100%;
  }
  .rz-rail-in {
    position: static;
    transform: none !important;
  }
  /* Do not let hanging cherubs cover the cards at mid width. */
  .rz-cherub--rail {
    display: none;
  }
}

@media (min-width: 1280px) {
  .rz-front {
    grid-template-columns: minmax(0, 1fr) minmax(15.5rem, 17.5rem);
    column-gap: 1.75rem;
    grid-template-areas: "hero shelf" "find rail" "rest rail";
  }
  .rz-hero { grid-area: hero; }
  .rz-shelf { grid-area: shelf; }
  .rz-front .hall-find { grid-area: find; }
  .rz-rail {
    grid-area: rail;
    margin-top: 1.25rem;
    min-width: 0;
    max-width: 100%;
  }
  .rz-rest { grid-area: rest; min-width: 0; }
  .rz-rail-in {
    position: sticky;
    top: 4.25rem;
    box-sizing: border-box;
    overflow: visible;
  }
  /* Cherubs sit in the 5vw marble gutter, never over rail labels or cards. */
  .rz-rail { overflow: visible; }
  .rz-cherub--rail {
    display: block;
    left: auto;
    right: -3.55rem;
    top: 0.15rem;
    width: 3.1rem;
    z-index: 5;
    pointer-events: none;
  }
}

/* ---- 3. Sanctuary sticky side (ON THIS PAGE + In the Sanctuary):
      own column at 1280+; disclosure drawer at 900-1279; phones unchanged. ---- */
.ab-side-toggle {
  display: none;
  font-family: var(--sans, Inter, system-ui, sans-serif);
  font-size: 15px;
  font-weight: 600;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: #7a5a18;
  background: #fffaf0;
  border: 1px solid #997838;
  border-radius: 8px;
  min-height: 44px;
  padding: .45rem 1rem;
  margin: .25rem 0 .6rem;
  cursor: pointer;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
  width: 100%;
  box-sizing: border-box;
}
.ab-side-toggle::after {
  content: "+";
  font-size: 1.25rem;
  line-height: 1;
  color: #997838;
}
.ab-layout.is-side-open .ab-side-toggle::after {
  content: "\2212";
}
.ab-side-toggle:hover,
.ab-side-toggle:focus-visible {
  background: #f4e7c6;
  outline: 2px solid #c9a04a;
  outline-offset: 2px;
}

@media (min-width: 900px) and (max-width: 1279px) {
  .ab-layout {
    display: flex;
    flex-direction: column;
    width: var(--rz-page-width, min(95vw, calc(100% - 1.5rem)));
    max-width: none;
    gap: 0;
  }
  .ab-side-toggle {
    display: flex;
    order: 1;
  }
  .ab-layout:not(.is-side-open) > .ab-side {
    display: none;
  }
  .ab-layout.is-side-open > .ab-side {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    position: static;
    max-height: none;
    overflow: visible;
    width: 100%;
    order: 1;
    grid-column: auto;
    grid-row: auto;
    padding: 0 0 12px;
  }
  .ab-layout.is-side-open > .ab-side .ab-box {
    flex: 1 1 260px;
  }
  .ab-layout > main.ab,
  .ab-layout > main.hl {
    order: 2;
    width: auto;
    max-width: 100%;
    min-width: 0;
    grid-column: auto;
    grid-row: auto;
  }
}

@media (min-width: 1280px) {
  .ab-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) clamp(220px, 22vw, 270px);
    gap: 0 22px;
    width: var(--rz-page-width, 90vw);
    max-width: none;
    align-items: start;
    box-sizing: border-box;
  }
  .ab-layout > main.ab,
  .ab-layout > main.hl {
    grid-column: 1;
    grid-row: 1;
    width: auto;
    max-width: 100%;
    min-width: 0;
  }
  .ab-side {
    grid-column: 2;
    grid-row: 1;
    position: sticky;
    top: calc(var(--ab-navh, 3.5rem) + 12px);
    max-height: calc(100vh - var(--ab-navh, 3.5rem) - 24px);
    overflow: auto;
  }
  .ab-side-toggle {
    display: none !important;
  }
}

@media (max-width: 899px) {
  /* Keep the existing phone stack; never inject a mid-width drawer look. */
  .ab-side-toggle {
    display: none !important;
  }
  /* RZ-LABEL sanctuary-mobile-side-overlap-20261126-CT
   * Rue 7:53 PM CT: on phones the gold kicker overlapped the On this page box.
   * Root: this file sets .ab-side { position: relative } at all widths, which
   * overrides angels.css mobile position:static and reactivates the leftover
   * top: calc(var(--ab-navh) + 12px) (125px once --ab-navh is 113px).
   * position:relative + top shifts the side down over main. Phones are a
   * stack, so static + top:auto. 1280+ sticky and 900-1279 drawer unchanged.
   * Undo: restore this file from
   * /home/ruezal/rz-bak/sanctuary-mobile-side-overlap-20261126-*-CT/
   * /RZ-LABEL */
  .ab-side {
    position: static;
    top: auto;
  }
}

/* ---- 4. Who-he-is lore column: tall cards use the full main column.
      House-ad gap slot sits left of the sources / passages card on
      desktop. Hidden on phones and below 1100px (no blank column there). ---- */
@media (min-width: 1100px) {
  .rz-front .lore-col {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .rz-front .lore-col > .card.lz,
  .rz-front .lore-col > .card:first-child,
  .rz-front .lore-col > #helps {
    grid-column: 1 / -1;
  }
  /* Let the quote sit beside "How he is called Archangel" instead of
     spanning and leaving a hole. */
  .rz-front .lore-col > .quote,
  .rz-front .lore-col > figure.quote {
    grid-column: auto;
  }
  .rz-front .lore-col > .ha-gap-slot {
    grid-column: 1;
    position: sticky;
    top: calc(var(--ab-navh, 3.5rem) + 12px);
    align-self: start;
    min-width: 0;
    z-index: 2;
  }
  .rz-front .lore-col > #passages {
    grid-column: 2;
    min-width: 0;
  }
}

@media (max-width: 1099px) {
  .ha-gap-slot {
    display: none;
  }
}

/* Gap unit uses the existing Hall parchment house-ad look. */
.ha-gap-slot .ha-spot,
.ha-gap-slot .ha-spot-mid {
  width: 100%;
  max-width: 100%;
  margin: 0;
  box-sizing: border-box;
}
.ha-gap-slot .ha-spot-in {
  flex-direction: column;
  align-items: flex-start;
}
.ha-gap-slot .ha-spot-art {
  width: 96px;
  height: 96px;
  max-width: 96px;
  max-height: 96px;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  object-position: left center;
}

/* Lineage rows must stay inside the main column (Sanctuary and Hall). */
.ab-layout .card.lz,
.ab-layout .lz-tree,
.rz-rest .card.lz {
  width: auto;
  max-width: 100%;
}
