/* layout.css — one layout system for every page (Nov 2026)
   ------------------------------------------------------------------
   One 1200px container. Text, boxes, tables, tools, captions and the
   contact card all line up on its left and right edges; only hero
   images run edge to edge.
     --c-text  760px  paragraphs and the main column on long pages
     --c-side  400px  the right-hand column (key facts, "On this page")
   Text that has no companion beside it runs across the full container,
   in two columns when it is long. Boxes at the full container width
   set their text in two columns. Interactive tools sit at the container
   width and get a Full screen button.
   The behaviour is wired up per page by layout.js (Layout.* calls in a
   short block at the end of each page). Early Mormon Temples (nauvoo.html)
   carries its own copy of the same rules. */

:root{
  --c-max:1200px; --c-gut:24px; --c-text:760px; --c-gap:40px; --c-navh:84px;
}
@media(max-width:700px){ :root{ --c-gut:20px; } }

/* ---------- the container ---------- */
.lay-c{
  box-sizing:border-box !important;
  width:auto !important;
  max-width:calc(var(--c-max) + 2 * var(--c-gut)) !important;
  margin-left:auto !important; margin-right:auto !important;
  padding-left:var(--c-gut) !important; padding-right:var(--c-gut) !important;
}

/* ---------- text outside boxes ---------- */
/* no companion beside it: the full container width, two columns when long */
.lay-solo, .lay-solo p{ max-width:none !important; }
@media(min-width:1000px){
  .lay-cols2{ column-count:2; column-gap:var(--c-gap); }
  .lay-cols2 > *{ break-inside:avoid-column; }
  .lay-cols2 > :first-child{ margin-top:0; }
}

/* intro band: text on the left (760), a companion on the right (400) */
.lay-intro{ display:grid; grid-template-columns:minmax(0,1fr); gap:22px; margin:0 0 26px; }
.lay-intro > *{ max-width:none !important; margin-top:0 !important; margin-bottom:0 !important; }
.lay-intro-text > *{ max-width:none !important; }
.lay-intro-text > :first-child{ margin-top:0; }
.lay-intro-text > :last-child{ margin-bottom:0; }
@media(min-width:1000px){
  .lay-intro.has-side{ grid-template-columns:minmax(0,var(--c-text)) minmax(0,1fr); column-gap:var(--c-gap); align-items:start; }
}

/* ---------- boxes ---------- */
@media(min-width:1000px){
  .lay-box2{ column-count:2; column-gap:var(--c-gap); }
  .lay-box2 > .label, .lay-box2 > .k, .lay-box2 > h2, .lay-box2 > .contact-label{ column-span:all; }
  .lay-box2 p, .lay-box2 li, .lay-box2 ul, .lay-box2 ol{ break-inside:avoid-column; }
  .lay-box2 > p, .lay-box2 > ul, .lay-box2 > ol{ max-width:none !important; }
}

/* a run of boxes: one column, two across from 1000px */
.lay-grid{
  display:grid !important; grid-template-columns:minmax(0,1fr); gap:18px; align-items:start;
  width:auto !important; margin-left:0 !important; margin-right:0 !important;
}
.lay-grid > *{ margin:0 !important; }
@media(min-width:1000px){ .lay-grid{ grid-template-columns:repeat(2,minmax(0,1fr)); } }

/* short notes under a tool: side by side across the tool's width */
.lay-notes{ display:grid; grid-template-columns:minmax(0,1fr); gap:10px 32px; margin-top:14px; }
.lay-notes > p{ max-width:none !important; margin:0 !important; font-size:14.5px !important; line-height:1.55 !important; }
@media(min-width:1000px){ .lay-notes{ grid-template-columns:repeat(3,minmax(0,1fr)); } }

/* contact card (every page): the container width, heading left, text right */
.contact-card{
  box-sizing:border-box !important; width:auto !important; max-width:var(--c-max) !important;
  margin-left:max(var(--c-gut), calc((100% - var(--c-max)) / 2)) !important;
  margin-right:max(var(--c-gut), calc((100% - var(--c-max)) / 2)) !important;
}
@media(min-width:1000px){
  .contact-card{ display:grid; grid-template-columns:minmax(0,1fr) minmax(0,var(--c-text)); column-gap:var(--c-gap); grid-auto-flow:dense; align-items:start; }
  .contact-card > .contact-label, .contact-card > h2{ grid-column:1; }
  .contact-card > :not(.contact-label):not(h2){ grid-column:2; }
}
.disclaimer{ box-sizing:border-box; max-width:var(--c-max) !important; margin-left:auto; margin-right:auto; }

/* ---------- the right-hand column on long pages ---------- */
.lay-read{ position:relative; }
.lay-k{ font-family:var(--sans,'Source Sans 3',system-ui,sans-serif); font-weight:700; font-size:.7rem; letter-spacing:.12em; text-transform:uppercase; color:var(--brass-ink,var(--gold-ink,#6E5320)); margin:0 0 6px; }
.lay-rail{ margin:0 0 30px; }
.lay-rail-in{ display:block; border:1px solid var(--rule,#CBC3B2); border-radius:4px; background:var(--ivory,#FBF8F0); padding:14px 18px; }
.lay-rail-in a{ display:block; padding:8px 0 8px 12px; border-top:1px solid var(--rule,#CBC3B2); border-left:2px solid transparent; text-decoration:none; line-height:1.35; font-family:var(--sans,'Source Sans 3',system-ui,sans-serif); font-size:.92rem; }
.lay-rail-in .lay-k + a{ border-top:0; }
.lay-rail-in a.on{ border-left-color:var(--brass,#9A7328); color:var(--ink,#24231F); font-weight:600; }
.lay-rail-in a.lay-top{ border-left:0; padding-left:0; font-size:.85rem; color:var(--muted,var(--faded,#5b564c)); }
.lay-sec, .lay-read [id]{ scroll-margin-top:var(--c-navh); }
.lay-wide{ width:auto !important; max-width:none !important; margin-left:0 !important; margin-right:0 !important; position:relative; z-index:2; }
.lay-wide p.figcap{ max-width:none !important; }

@media(min-width:1000px){
  /* text keeps to the 760 column; wide figures take the whole container,
     and the right-hand column fades out while one passes under it */
  .lay-read .lay-sec > :not(.lay-wide), .lay-read.lay-flat > :not(.lay-wide):not(.lay-rail){ max-width:var(--c-text) !important; }
  .lay-rail{ position:absolute; top:0; right:0; bottom:0; width:calc(100% - var(--c-text) - var(--c-gap)); margin:0; pointer-events:none; z-index:1; }
  .lay-rail-in{ position:sticky; top:var(--c-navh); pointer-events:auto; max-height:calc(100vh - var(--c-navh) - 16px); overflow:auto; transition:opacity .2s, visibility .2s; }
  .lay-rail.is-hidden .lay-rail-in{ opacity:0; visibility:hidden; }
}

/* ---------- full screen for interactive tools ---------- */
.lay-fsbar{ display:flex; justify-content:flex-end; margin:0 0 8px; }
.lay-fs{ font-family:var(--sans,'Source Sans 3',system-ui,sans-serif); font-size:.8rem; font-weight:600; border:1px solid var(--teal,#477A78); color:var(--teal,#477A78); background:var(--ivory,#FBF8F0); border-radius:3px; padding:5px 11px; cursor:pointer; }
.lay-fs:hover, .lay-fs:focus-visible{ background:var(--teal,#477A78); color:var(--ivory,#FBF8F0); }
.lay-fs.is-on{ position:fixed; top:12px; right:16px; z-index:1001; }
.lay-full{
  position:fixed !important; inset:0 !important; z-index:1000 !important;
  margin:0 !important; width:auto !important; max-width:none !important; height:auto !important;
  border-radius:0 !important; overflow:auto !important; box-sizing:border-box !important;
  padding:56px 24px 20px !important; background:var(--paper,#F4F0E6) !important;
}
.lay-full-hide{ display:none !important; }
html.lay-noscroll{ overflow:hidden; }

/* ---------- one set of text sizes (Nov 2026) ----------
   reading text 17px, text inside boxes 16px, secondary notes 16px,
   captions and source lines 14.5px, section headings 32px, subheadings 22px,
   headings inside boxes 24px. Text inside the interactive tools is left alone. */

/* reading text outside boxes */
:is(.lay-c section, .lay-sec, .lay-read.lay-flat, .lay-c .prose, .lay-intro-text, .lay-c > header) > p:not(.part, .nv-part, .hint, .figcap, .crumb, .nv-srcs, .imgnote, .sub-note),
:is(.lay-c section, .lay-sec, .lay-c .prose) > :is(ul, ol) > li,
.lay-solo:not(.hint, .foot), .lay-solo > p, .lay-c > p:not(.imgnote, .crumb), body > p.lay-solo{
  font-size:17px !important; line-height:1.65 !important;
}
/* text inside boxes */
:is(.lay-box2, .note, .nv-against, .nv-flag, .nv-rec, .cvcard, .covcard, .up-entry, .card.lay-box2, .lay-intro-side) :is(p, li){
  font-size:16px !important; line-height:1.6 !important;
}
/* secondary explanatory notes */
:is(.lay-c section, .lay-read.lay-flat) > p.hint, .lay-solo.hint{
  font-size:16px !important; line-height:1.6 !important;
}
/* captions, image notes, source lines, notes under tools */
p.figcap, p.imgnote, p.nv-srcs, .lay-notes > p, .panel > p.foot, .lay-solo.foot{
  font-size:14.5px !important; line-height:1.55 !important;
}
/* headings */
:is(.lay-c section, .lay-sec, .lay-read.lay-flat, .lay-c) > h2{ font-size:32px !important; line-height:1.2 !important; }
:is(.lay-c section, .lay-sec, .lay-read.lay-flat) > h3{ font-size:22px !important; line-height:1.3 !important; }
:is(.lay-box2, .card, .note, .cvcard) > h2{ font-size:24px !important; line-height:1.25 !important; }
@media(max-width:700px){
  :is(.lay-c section, .lay-sec, .lay-read.lay-flat, .lay-c) > h2{ font-size:26px !important; }
  :is(.lay-box2, .card, .note, .cvcard) > h2{ font-size:21px !important; }
}
/* Early Mormon Temples has its own layout block; same sizes for its parts */
.nv-sec > h2{ font-size:32px !important; line-height:1.2 !important; }
.nv-sec > h3{ font-size:22px !important; line-height:1.3 !important; }
@media(max-width:700px){ .nv-sec > h2{ font-size:26px !important; } }
/* Polygamy: the explainer cards and the intro lines */
.lay-c .card:not(.detail) :is(p, li){ font-size:16px !important; line-height:1.6 !important; }
.lay-c p.sub{ font-size:17px !important; line-height:1.65 !important; }
