/* The template page.

   This file holds only what the homepage stylesheet does not already provide.
   The page is built from the site's own parts — the opening spread, the tab rail,
   the tear, the document sheet, the envelope close — so the layout, rhythm and
   responsive behaviour all come from styles.css. Anything here that duplicates a
   rule over there is a bug. */

/* ---------- the opening ---------- */
/* The homepage's spread fills the first viewport because its sheet carries a whole
   write-up. This page's sheet carries a form, which is shorter — at 100svh the
   template floated in the top half of an empty sheet. Content height instead, so
   the spread ends where the document does and the tear follows it. */
.opening--short{min-height:0}
/* The height lives on the sheet, not the spread — neutralising .opening alone does
   nothing. Both are needed. */
.opening--short .sheet-hero{min-height:0}
/* A wide <pre> inside a grid item forces the track open: grid items default to
   min-width:auto, so the template's longest line set the column at 394px on a 375px
   phone and .opening's overflow:clip quietly cut 19px off the right edge. min-width:0
   lets the pre scroll inside its own box instead of widening the page. */
.opening--short .sheet-hero{min-width:0}
.opening--short .flap{min-width:0}

/* ---------- the template itself, set as the hero sheet ---------- */

/* Typed, because it is the document. Sized in the document range (0.84rem) so it
   reads as the artefact rather than as code pasted into a landing page. */
.tpl-pre{
  margin:0;
  flex:1 1 auto;
  overflow-x:auto;
  font-family:var(--typed);
  font-size:.84rem;
  line-height:1.62;
  color:var(--ink);
}

/* A bracketed line is the only thing to change, so it is the one thing set
   differently — italic, in soft ink, the way a pencilled instruction sits on a
   typed form. Graphite stays out of it: that ink belongs to the drawn marks. */
.tpl-pre b{
  font-weight:400;
  font-style:italic;
  color:var(--ink-soft);
}

/* ---------- the five rules ---------- */
/* Printed instruction on the left, typed note on the right — the same seam the
   rest of the site uses between Archivo and Courier. */
.rules{
  list-style:none; margin:clamp(24px,3.4vw,40px) 0 0; padding:0;
  border-top:1px solid var(--rule-strong);
}
.rules li{
  display:grid;
  grid-template-columns:minmax(0,.62fr) minmax(0,1.5fr);
  gap:6px clamp(18px,3vw,40px);
  padding:clamp(16px,2vw,20px) 0;
  border-bottom:1px solid var(--rule-soft);
}
.rules b{
  font-family:var(--archivo); font-weight:800;
  font-size:1.02rem; line-height:1.3; letter-spacing:-.01em;
  text-wrap:balance;
}
.rules span{
  font-size:.96rem; line-height:1.56; color:var(--ink-soft); max-width:60ch;
}

/* ---------- the document sheet ---------- */
/* One document is not a pair. Capped near the width of the homepage's hero sheet
   so the facts grid and the requirement rows keep their proportion, and aligned to
   the shell's left edge so it shares a margin with the heading above it rather
   than floating in the middle of the manila. */
.doc-wrap{max-width:980px}

@media (max-width:900px){
  .rules li{grid-template-columns:minmax(0,1fr); gap:6px}
}

@media (max-width:760px){
  /* DESIGN.md's floor is 0.78rem for functional text, so the template steps down to
     the floor and no further. Below that width it wraps instead of scrolling: at
     this size only the two long instruction lines exceed the measure, so the field
     lines keep their column alignment and nothing hides behind a 28px scroll. */
  .tpl-pre{font-size:.78rem; white-space:pre-wrap; overflow-wrap:break-word}
}
