/* =========================================================
   STORM — DOWNLOADS
   -----------------------------------------------------------
   Loads ON TOP of base-web-style.css.

   The page is base almost end to end:
     shell       .spi-section-padded / .spi-container
     intro       .spi-section-header.is-center / .spi-h1 /
                 .spi-body.spi-text-center.spi-body-width
     jump nav    .spi-subnav / .spi-subnav-inner
     category    .spi-section-header / .spi-h2 / .spi-eyebrow
     list        .ui-list  (row dividers + the accent bar bullet,
                 and `strong` already renders as --spi-black 700,
                 which is exactly what a resource title needs)
     file badge  .spi-tag
     width       .spi-body-width, retuned through its own
                 --spi-body-width knob

   The resources themselves live in downloads.json and are
   rendered by the small script at the foot of downloads.html,
   so publishing a new catalog is a data change, not a page
   change — the same pattern as Partners and Newsroom.

   No tokens are redefined and no colours are invented. The three
   hard-coded brand colours the legacy page painted onto the word
   "Download" (#D12030, #FFB71B, #191C1B) are gone — the brand is
   already in each title ("2021 Roto Grip Catalog"), so the colour
   carried no information the text did not.

   What is left below is the one thing base has no equivalent for:
   a list row that ends in an action.
   ========================================================= */

/* ---------------------------------------------------------
   1. LIST COLUMN (.dl-column)
   34 rows across a 1440px container puts the title at the far
   left and its Download at the far right, with a metre of empty
   carpet between them — the eye loses the pairing.

   This is base's .spi-body-width, which exists for exactly this
   and ships a --spi-body-width knob for the override. 720px is
   tuned for running prose; a row is title + badge + action, so
   it gets a wider setting rather than a new rule.
--------------------------------------------------------- */
.dl-column {
  --spi-body-width: 940px;
}

/* ---------------------------------------------------------
   2. CATEGORY GROUPS (.dl-group)
   The seven categories are separated INSIDE one padded section
   rather than each being its own .spi-section-padded. Seven
   sections would stack 72px of their own padding against the
   next one's — 144px of blank between every category, and four
   of these categories hold a single row.
--------------------------------------------------------- */
.dl-group + .dl-group {
  margin-top: 56px;
}

/* .spi-section-header stacks eyebrow ABOVE title by default; here
   the count is a trailing subtitle, so it needs the gap closed up
   under the heading rather than the header's default 8px. */
.dl-group .spi-eyebrow {
  margin: 4px 0 0;
}

/* The Drill Specs preamble. It is running prose inside a column
   already widened for rows, so it takes base's default measure
   back for itself. `p.` beats the store's `.std p { margin: 1em 0 }`. */
p.dl-group-intro {
  max-width: 720px;
  margin: 16px 0 0;
}

@media (max-width: 600px) {
  .dl-group + .dl-group {
    margin-top: 40px;
  }
}

/* ---------------------------------------------------------
   3. RESOURCE ROW (.dl-item)
   Base's .ui-list gives the dividers, the accent bar bullet and
   the type. What it has no notion of is a row that ENDS IN AN
   ACTION — title left, file badge and Download right.

   The whole row is one <a>, which does three things at once:
   the target is the full width of the list instead of the word
   "Download", the accessible name becomes "Resurfacing Guide,
   PDF · 753 KB, Download" instead of 34 links all reading
   "Download", and there is one focus stop per resource.
--------------------------------------------------------- */

/* The padding moves from the <li> onto the <a>, so the 50px of
   row height IS the touch target. Left on the <li> it padded the
   row while the link itself stayed ~22px tall — a legible row
   with a thin clickable strip through the middle of it. */
.dl-list > li {
  padding: 0;
}

/* `font: inherit` is load-bearing on the live site: the store theme sets
   `a { font-size: 16px; font-weight: 400 }` on every link, which overrode
   the list's 14px and made every row 16px — 79px tall instead of 50. */
.dl-item {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 14px;
  padding: 14px 12px 14px 18px;
  border-radius: var(--spi-radius-sm);
  font: inherit;
  color: inherit;
  text-decoration: none;
  transition: var(--spi-ease);
}

.dl-name {
  flex: 1 1 auto;
  min-width: 0;
  /* long filenames break instead of pushing the action off-screen */
  overflow-wrap: anywhere;
}

.dl-tag {
  flex: 0 0 auto;
  /* tabular so PDF · 12.2 MB and PDF · 753 KB read as a column */
  font-variant-numeric: tabular-nums;
}

.dl-action {
  flex: 0 0 auto;
  margin-left: auto;
  /* A fixed track so "Download", "View" and "Apply Now" all end at the
     same edge — otherwise the badge column jogs left on the three rows
     that are not downloads, and a column of file sizes is only scannable
     if it actually lines up. */
  min-width: 96px;
  text-align: right;
  font-family: var(--spi-font-body);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--spi-accent);
  white-space: nowrap;
}

/* The affordance is the row, not a hover effect — the arrow is drawn at
   rest so a touch device sees it too. Down for a file that lands in the
   downloads folder, out for the three rows that open something online
   (the two FlippingBook guides and the Typeform application). */
.dl-action::after {
  content: " \2193";
}

.dl-action.is-external::after {
  content: " \2197";
}

.dl-item:hover {
  background: var(--spi-gray-100);
}

.dl-item:hover .dl-action {
  text-decoration: underline;
}

.dl-item:focus-visible {
  outline: 2px solid var(--spi-accent);
  outline-offset: 2px;
}

/* Below 600px the badge and the action get their own line, so a
   title never has to compete with them for a 375px row. */
@media (max-width: 600px) {
  .dl-name {
    flex: 1 1 100%;
  }

  .dl-item {
    padding: 12px 8px 12px 18px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .dl-item {
    transition: none;
  }
}

/* ---------------------------------------------------------
   4. INTRO
   The jump nav sits directly under the intro, so the intro does
   not also need a full section's worth of space beneath it.
--------------------------------------------------------- */
.dl-intro {
  padding-bottom: 32px;
}

/* Base styles headings, body and buttons but has no inline-link
   rule; the phone number would otherwise fall back to whatever
   the CMS theme sets — 16px in a 15px paragraph on the live site. */
.dl-intro a {
  font: inherit;
  font-weight: 600;
  color: var(--spi-accent);
}

/* ---------------------------------------------------------
   5. LOADING / ERROR NOTICE (.dl-notice)
   The list is fetched, so there is a moment before it exists and
   a state where it never arrives. Base has no notice component
   and this does not warrant one — it is a paragraph that needs
   centring and room to breathe where the list will be.
   `p.` beats the store's `.std p { margin: 1em 0 }`.
--------------------------------------------------------- */
p.dl-notice {
  margin: 0;
  padding: 24px 0;
  text-align: center;
}
