/* ============================================================================
   PAPER & MEDIA — the orientation layer.  2026-08-21.

   Loaded on /plotter-paper/ (the canonical landing page, which rides the Sheet
   Set via page-template-page-silo) and on the Paper & Media product archive,
   where the same tiles appear as a compact band above the grid.

   Nothing here restyles existing components. It adds three objects:
     .pp-mtiles / .pp-mtile   the five category tiles, each with a DRAWN figure
     .pp-msizes / .pp-msize   the size entry points
     .pp-mband                the compact band injected above the archive grid

   Ground, rules, mono micro-labels and the 2px radius all follow sheet-set.css
   so a tile reads as another object on the same drawing, not a widget.
   ========================================================================== */

.pp-mtiles,
.pp-msizes,
.pp-mband {
  --ml-film: var(--ss-film, #EDF0F4);
  --ml-sheet: var(--ss-sheet, #FFFFFF);
  --ml-ink: var(--ss-ink, #0E1622);
  --ml-ink-soft: var(--ss-ink-soft, #3E4A5C);
  --ml-muted: var(--ss-muted, #778394);
  --ml-rule: var(--ss-rule, #C3CEDC);
  --ml-rule-soft: var(--ss-rule-soft, #DFE6EF);
  --ml-accent: var(--ss-accent, #1B3A8C);
  --ml-mono: var(--wp--preset--font-family--mono, ui-monospace, monospace);
}

/* --- category tiles ------------------------------------------------------ */

.pp-mtiles {
  display: grid;
  gap: 1px;                       /* hairline gutters: the grid IS the ruling */
  background: var(--ml-rule-soft);
  border: 1px solid var(--ml-rule-soft);
  /* Five families, and five is a bad number for auto-fit: at the ~992px a Sheet
     Set band actually offers it resolves to four columns and orphans Canvas on
     a row of its own. The breakpoints are explicit so the row is always full. */
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin: 0 0 1.6rem;
}

@media (min-width: 700px)  { .pp-mtiles { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (min-width: 960px)  { .pp-mtiles { grid-template-columns: repeat(5, minmax(0, 1fr)); } }

/* A 3-up row leaves two tiles on the second row; let them share it evenly
   instead of hanging left. */
@media (min-width: 700px) and (max-width: 959px) {
  .pp-mtiles > .pp-mtile:nth-child(4) { grid-column: 1 / span 2; }
  .pp-mtiles > .pp-mtile:nth-child(5) { grid-column: 3; }
}

.pp-mtile {
  display: flex;
  flex-direction: column;
  gap: 0;
  padding: 0 0 1.15rem;
  background: var(--ml-sheet);
  color: var(--ml-ink);
  text-decoration: none;
  border-top: 3px solid var(--mt-accent, var(--ml-accent));
  transition: background .15s ease, box-shadow .15s ease;
}

.pp-mtile:hover,
.pp-mtile:focus-visible {
  background: var(--ml-sheet);
  box-shadow: inset 0 0 0 1px var(--mt-accent, var(--ml-accent));
  text-decoration: none;
}

.pp-mtile:focus-visible { outline: 2px solid var(--mt-accent, var(--ml-accent)); outline-offset: -2px; }

/* The figure sits on film so the drawing reads as a drawing on a sheet. */
.pp-mtile-fig {
  display: block;
  background: var(--ml-film);
  border-bottom: 1px solid var(--ml-rule-soft);
  color: var(--mt-accent, var(--ml-accent));
  padding: .5rem .35rem;
}

.pp-mtile-svg {
  display: block;
  width: 100%;
  height: auto;
  /* the one tinted fill every figure shares, keyed to the tile's own accent */
  --mt-fill: color-mix(in srgb, var(--mt-accent, #1B3A8C) 9%, transparent);
}

/* color-mix is well supported, but a tile must never render as a black block
   if it is not: fall back to a neutral wash. */
@supports not (color: color-mix(in srgb, red 9%, transparent)) {
  .pp-mtile-svg { --mt-fill: rgba(27, 58, 140, .09); }
}

.pp-mtile-body {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;            /* blurbs differ in length; the CTA still lines up */
  padding: 1rem 1.15rem 0;
}

.pp-mtile-h {
  display: block;
  font-family: var(--wp--preset--font-family--display, inherit);
  font-size: 1.12rem;
  font-weight: 600;
  line-height: 1.2;
  color: var(--ml-ink);
}

.pp-mtile-n {
  display: block;
  margin-top: .3rem;
  font-family: var(--ml-mono);
  font-size: .68rem;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--ml-muted);
  font-variant-numeric: tabular-nums;
}

.pp-mtile-p {
  display: block;
  margin-top: .7rem;
  font-size: .875rem;
  line-height: 1.55;
  color: var(--ml-ink-soft);
}

.pp-mtile-go {
  display: block;
  margin-top: auto;
  padding-top: .85rem;
  font-size: .82rem;
  font-weight: 600;
  color: var(--mt-accent, var(--ml-accent));
}

.pp-mtiles--compact .pp-mtile-body { padding-bottom: .2rem; }
.pp-mtiles--compact .pp-mtile-go { margin-top: .5rem; }

/* --- size entry points --------------------------------------------------- */

.pp-msizes {
  display: grid;
  gap: .6rem;
  grid-template-columns: repeat(auto-fit, minmax(11.5rem, 1fr));
  margin: 0 0 1.2rem;
  padding: 0;
  list-style: none;
}

.pp-msize {
  display: flex;
  flex-direction: column;
  gap: .12rem;
  padding: .8rem .95rem;
  background: var(--ml-sheet);
  border: 1px solid var(--ml-rule);
  border-radius: 2px;
  text-decoration: none;
  color: var(--ml-ink);
}

.pp-msize:hover,
.pp-msize:focus-visible { border-color: var(--ml-accent); text-decoration: none; }

.pp-msize-w {
  font-family: var(--ml-mono);
  font-size: 1.28rem;
  font-weight: 600;
  line-height: 1;
  color: var(--ml-accent);
  font-variant-numeric: tabular-nums;
}

.pp-msize-l { font-size: .82rem; line-height: 1.35; color: var(--ml-ink-soft); }

.pp-msize-n {
  font-family: var(--ml-mono);
  font-size: .64rem;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--ml-muted);
  font-variant-numeric: tabular-nums;
}

/* --- the archive band ---------------------------------------------------- */

.pp-mband {
  margin: 0 0 2rem;
  padding: 1.5rem clamp(1rem, 3vw, 1.9rem) 1.35rem;
  background: var(--ml-film);
  border: 1px solid var(--ml-rule-soft);
  border-top: 2px solid var(--ml-ink);
}

.pp-mband-head { margin-bottom: 1.15rem; }

.pp-mband-kicker {
  margin: 0 0 .35rem;
  font-family: var(--ml-mono);
  font-size: .66rem;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--ml-muted);
}

.pp-mband-h {
  margin: 0 0 .4rem;
  font-family: var(--wp--preset--font-family--display, inherit);
  font-size: clamp(1.25rem, 1rem + 1vw, 1.6rem);
  font-weight: 500;
  line-height: 1.15;
  text-transform: uppercase;
  letter-spacing: .005em;
  color: var(--ml-ink);
}

.pp-mband-sub {
  margin: 0;
  max-width: 60ch;
  font-size: .93rem;
  line-height: 1.55;
  color: var(--ml-ink-soft);
}

.pp-mband-foot { margin: .3rem 0 0; }

.pp-mband-cta {
  font-size: .9rem;
  font-weight: 600;
  color: var(--ml-accent);
}

/* --- on the landing page ------------------------------------------------- */
/* A Sheet Set band becomes a two-column grid (text + companion rail) as soon as
   anything injects a rail into it, and other systems on this site DO inject one.
   Auto-placement then drops the tiles into whichever 38rem or 20rem column is
   free, which is how they first shipped as a squeezed two-up with an orphan.
   Both objects are full-width by nature, so they claim the whole sheet
   explicitly and stop depending on what else happens to be in the band. */
.page-template-page-silo .pp-sb-in > .pp-mtiles,
.page-template-page-silo .pp-sb-in > .pp-msizes {
  grid-column: 1 / -1;
  max-width: none;
}

/* The supplies finder was designed for the homepage band. On a sheet it needs a
   ground and a rule so it reads as part of the drawing, not a floating widget. */
.page-template-page-silo .pp-mfinder {
  background: var(--ss-sheet, #fff);
  border: 1px solid var(--ss-rule-soft, #DFE6EF);
  border-top: 3px solid var(--ss-accent, #1B3A8C);
  padding: clamp(1.1rem, 3vw, 1.8rem);
}

.page-template-page-silo .pp-mfinder .pp-sfinder-box { max-width: 42rem; }
.page-template-page-silo .pp-mfinder .pp-sfinder-head { margin-bottom: .5rem; }

/* --- mobile -------------------------------------------------------------- */

@media (max-width: 460px) {
  .pp-mtiles { grid-template-columns: 1fr; }
}

@media (max-width: 640px) {
  .pp-msizes { grid-template-columns: repeat(auto-fit, minmax(9rem, 1fr)); }
  .pp-mband { padding-inline: 1rem; }
  /* Never let a wide drawing push the page sideways. */
  .pp-mtile-svg { max-width: 100%; }
}

/* Everything in here is a grid or a flex column; nothing may overflow the
   viewport horizontally on a 390px phone. */
.pp-mtiles,
.pp-msizes,
.pp-mband,
.pp-mtile,
.pp-msize { min-width: 0; max-width: 100%; box-sizing: border-box; }
