/* Stop posters (layouts/poster): A4 portrait, one stop per page, laid out like a card on the map: a dark band
   saying what the site is for over a framed body with the QR code. Scoped to body.posters and a named page
   because the public layout loads every stylesheet. */
@page poster {
  size: A4 portrait;
  margin: 15mm;
}

/* The sign-off at the foot (SIL Open Font License, fonts/eb-garamond-OFL.txt). */
@font-face {
  font-family: "EB Garamond";
  src: url("/assets/eb-garamond-regular-05a51bf3.woff2") format("woff2");
}

@font-face {
  font-family: "EB Garamond";
  font-style: italic;
  src: url("/assets/eb-garamond-italic-dc3bfc2b.woff2") format("woff2");
}

.posters {
  /* The site's colours (application.css, map.css). */
  --blue: #0a58ca;
  --ink: #16202e;
  --ok: #18794e;
  --warn: #f5c400;
  --bad: #c4291c;

  page: poster;
  margin: 0;
  background: #ddd;
  color: var(--ink);
  font-family: system-ui, sans-serif;

  .posters-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem 1rem;
    align-items: center;
    padding: 0.75rem 1rem;

    button { font: inherit; font-size: 1.125rem; padding: 0.35rem 1rem; }
  }

  /* The sheet: the A4 page on screen, its printable area (inside the @page margin) in print. */
  .poster {
    box-sizing: border-box;
    width: 210mm;
    height: 297mm;
    margin: 0 auto 1rem;
    padding: 15mm;
    background: #fff;
    display: flex;
    flex-direction: column;
    text-align: center;
    break-after: page;
    print-color-adjust: exact;
    -webkit-print-color-adjust: exact;
  }

  .poster-head { display: flex; flex-direction: column; gap: 4.5mm; padding: 6mm 8mm; border-radius: 6.5mm 6.5mm 0 0; background: var(--ink); color: #fff; }
  .poster-brand { display: flex; align-items: center; justify-content: center; gap: 3.2mm; margin: 0; font-size: 16pt; font-weight: 600; }
  .poster-logo { display: flex; padding: 1.6mm; border-radius: 3.1mm; background: var(--blue); }
  .poster-logo svg { width: 8.5mm; height: 8.5mm; }
  .poster-headline { margin: 0; font-size: 28pt; line-height: 1.1; text-wrap: balance; }
  .poster-lead { margin: 0; font-size: 15pt; line-height: 1.25; text-wrap: balance; }

  /* Buses as the map draws them: green on time, yellow late, red very late. */
  .poster-pills { display: flex; justify-content: center; gap: 3.9mm; margin: 0; padding: 0; list-style: none; }
  .poster-pill { display: flex; align-items: center; gap: 2mm; padding: 1.7mm 4.5mm 1.7mm 3.2mm; border: 0.8mm solid #fff; border-radius: 7.8mm; font-size: 14pt; font-weight: 700; white-space: nowrap; }
  .poster-pill svg { width: 6.5mm; height: 6.5mm; }
  .poster-pill-on_time { background: var(--ok); }
  .poster-pill-late { background: var(--warn); color: var(--ink); }
  .poster-pill-very_late { background: var(--bad); }

  /* The body takes whatever height the rest leaves, and the QR code what is left of that, so long text shrinks
     the code instead of overflowing. */
  .poster-body { flex: 1 1 0; min-height: 0; display: flex; flex-direction: column; gap: 5mm; padding: 5mm 8mm 7mm; border: 0.8mm solid var(--ink); border-top: 0; border-radius: 0 0 6.5mm 6.5mm; }
  /* Small: the stop is only here so whoever hangs the poster knows which stop it belongs to. */
  .poster-stop { margin: 0; font-size: 10pt; overflow-wrap: anywhere; }
  .poster-code { flex: 1 1 0; min-height: 0; }
  .poster-qr { display: block; height: 100%; max-width: 100%; margin: 0 auto; aspect-ratio: 1; }
  .poster-url { margin: 0; font-size: 14pt; overflow-wrap: anywhere; }
  .poster-url strong { display: block; color: var(--blue); font-size: 18pt; }

  .poster-steps {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8mm;
    margin: 8mm 0 0;
    padding: 0;
    list-style: none;
    counter-reset: step;

    li { counter-increment: step; }
    li::before { content: counter(step) "."; display: block; font-size: 18pt; font-weight: 700; }
    svg { width: 13mm; height: 13mm; fill: none; stroke: currentColor; stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }
    p { margin: 2mm 0 0; font-size: 14pt; line-height: 1.25; text-wrap: balance; }
  }

  /* Signed like a letter: the sign-off, the name in small capitals, the foundation's logo. */
  .poster-footer { margin-top: 16mm; font-family: "EB Garamond", Georgia, serif; font-size: 14pt; line-height: 1.15; }
  .poster-footer p { margin: 0; }
  .poster-regards { font-style: italic; }
  .poster-name { font-variant-caps: small-caps; letter-spacing: 0.04em; }
  .poster-org { display: block; height: 10mm; margin: 3mm auto 0; }

  @media print {
    background: #fff;

    .posters-toolbar { display: none; }
    .poster { width: auto; height: 267mm; margin: 0; padding: 0; }
  }
}
