/* ============================================================
   layout.css — NewConnections
   Asymmetric grid with marginalia gutter on the left.
   ============================================================ */

/* ----- 1. Layout tokens ------------------------------------ */

:root {
  /* The page's structural columns */
  --gutter-width: 12rem;
  --body-width: 30rem;
  --page-padding-x: 2rem;
  --page-padding-y: 5rem;

  /* Total page width: gutter + body + their internal padding.
     Used as max-width on the page container. */
  --page-width: calc(var(--gutter-width) + var(--body-width) + 4rem);
}

/* ----- 2. The page grid ------------------------------------ */
/*
   .page is the outermost layout container, used by every layout
   that has a marginalia gutter (middle and depth layers).
   Surface-layer pages use .page-centered instead — see below.
*/

.page {
  display: grid;
  grid-template-columns: var(--gutter-width) var(--body-width);
  grid-template-areas: "gutter body";
  column-gap: 2rem;
  max-width: var(--page-width);
  margin: 0 auto;
  padding: var(--page-padding-y) var(--page-padding-x);
}

/* Per-layer page padding: each layer feels more "entered" than
   the one above it. The reader senses the room they've stepped
   into, not just the page they've opened. */
body.layer-surface .page,
body.layer-surface .page-centered { --page-padding-y: 4rem; }
body.layer-middle .page,
body.layer-middle .page-centered { --page-padding-y: 5rem; }
body.layer-depth .page,
body.layer-depth .page-centered { --page-padding-y: 7rem; }

/* The role label sits in the gutter aligned to the FIRST PARAGRAPH
   of body prose, not to the page heading. This is the older
   typographic convention for marginalia (annotates prose, not
   headings) and is robust to titles of any length. */
.page > .gutter {
  grid-area: gutter;
  padding-top: 8.5rem;
}

body.layer-depth .page > .gutter {
  padding-top: 10rem;
}
.page > .body {
  grid-area: body;
}

/* ----- 3. The role label in the gutter --------------------- */

.role-label {
  font-size: 0.75rem;
  color: var(--color-text-soft);
  text-align: right;
  margin: 0;
  letter-spacing: 0.02em;
}

/* ----- 4. Surface-layer centered layout -------------------- */
/*
   Surface pages (home, topic pages) don't have a marginalia
   gutter. They sit in a centered column of the same body width.
*/

.page-centered {
  max-width: var(--body-width);
  margin: 0 auto;
  padding: var(--page-padding-y) var(--page-padding-x);
}

/* ----- 5. Responsive collapse ------------------------------ */
/*
   Below the page's natural minimum width, the gutter collapses
   above the body rather than disappearing. The role label sits
   above the heading at small viewports.
*/

/* Per-layer body column width. Depth narrows slightly to slow
   reading — the exhibition room is for lingering, not scanning. */
/* Per-layer body column width — a pyramid descending into depth.
   The surface (foyer) is widest; the middle (hall) is reading-
   width; the depth (exhibition) is narrowest, slowest to read. */
body.layer-surface .page {
  --body-width: 32rem;
  grid-template-columns: var(--gutter-width) 32rem;
}
body.layer-surface .page-centered {
  --body-width: 32rem;
  max-width: 32rem;
}

body.layer-depth .page {
  --body-width: 28rem;
  grid-template-columns: var(--gutter-width) 28rem;
}
body.layer-depth .page-centered {
  --body-width: 28rem;
  max-width: 28rem;
}


@media (max-width: 48rem) {
  /* On mobile the marginalia gutter has nowhere to go, so it and
     its role label are hidden entirely. The label is a desktop
     affordance. Body content flows in a single full-width column. */
  .page {
    grid-template-columns: 1fr;
    grid-template-areas: "body";
    column-gap: 0;
    padding: 2rem 1.5rem;
  }

  .page > .gutter {
    display: none;
  }

  .page-centered {
    padding: 2rem 1.5rem;
  }

  body.layer-depth .page {
    grid-template-columns: 1fr;
    padding-top: 2.5rem;
  }

  body.layer-depth .page-centered {
    max-width: none;
    padding-top: 2.5rem;
  }
}

/* Front-page cornice — three stepped courses, surface façade.
   Thin dark lip at top, deepening downward into a thicker base.
   Home page only; full-bleed across the viewport; scrolls away with the page. */
.is-home {
  position: relative;
}
.is-home::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 60px;
  z-index: 10;
  background: linear-gradient(to bottom,
    #D8CCB0 0%,    #D8CCB0 17%,    /* top lip — thin, darkest */
    #E6DCC6 17%,   #E6DCC6 45%,    /* middle course */
    #F2ECDD 45%,   #F2ECDD 100%);  /* base — thickest, lightest */
}