/* The home page (templates/pages/home.html). Only what site.css and search-box.css don't have.
   Below 520 px it follows the phone artboard, OpenPhoneHome. */

/* Hero: a column, not the usual row */
.hero .home-top { flex-direction: column; flex-wrap: nowrap; align-items: stretch; gap: 20px; padding-top: 48px; padding-bottom: 0; }
.home-top .title { max-width: 900px; }
.home-top .lede { max-width: 720px; }

/* The lineup of drawings along the bottom of the hero */
.hero .lineup { padding-top: 28px; padding-bottom: 28px; display: flex; flex-wrap: wrap; align-items: flex-end; gap: 8px 28px; }
.lineup > a { flex: 1 1 240px; display: flex; flex-direction: column; gap: 8px; text-decoration: none; color: var(--paper); }
.lineup-name { display: flex; align-items: baseline; gap: 8px; }
.lineup-name .d { font-size: 24px; text-transform: uppercase; }
.lineup-name .who { font-size: 14px; font-weight: 800; color: var(--muted-ink); }

/* Counts */
.counts { padding-top: 24px; padding-bottom: 24px; display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 16px; }
.counts > div { display: flex; flex-direction: column; }
.counts .n { font-size: 32px; font-weight: 900; line-height: 1.1; }
.counts .what { font-size: 15px; font-weight: 800; color: var(--muted); }

/* Freight yesterday and Changes */
.home-split { padding-top: 36px; padding-bottom: 36px; }
.freight .table td { padding-top: 12px; padding-bottom: 12px; }
.freight .code-cell { white-space: nowrap; }
.freight .code { font-size: 18px; text-decoration: none; }
.freight .time { font-size: 14px; color: var(--muted); }
.freight .table td.route { font-weight: 800; color: var(--ink); }
.freight .table td.loco { color: var(--ink); }
.legend { display: flex; flex-wrap: wrap; gap: 8px 20px; font-size: 14px; font-weight: 700; color: var(--body-2); }
.legend > span { display: inline-flex; align-items: center; gap: 8px; }

.latest { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 10px; }
.latest li { background: var(--ink); color: var(--paper); border-radius: 16px; padding: 14px 16px; box-shadow: 0 4px 0 var(--ink-deep); display: flex; flex-direction: column; gap: 4px; }
.latest .when { font-size: 13px; font-weight: 900; color: var(--muted-ink); }
.latest .what { font-size: 15px; font-weight: 800; line-height: 1.4; }

/* Promises */
.promises { padding-top: 36px; padding-bottom: 36px; display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; }
.promises > div { display: flex; flex-direction: column; gap: 6px; }
.promises p { margin: 0; font-size: 16px; font-weight: 700; line-height: 1.5; color: var(--body-2); }

/* Phone: OpenPhoneHome */
@media (max-width: 520px) {
  .hero .home-top { padding-top: 28px; gap: 14px; }
  .home-top .lede { font-size: 16px; }
  .search-box { flex-direction: column; }
  .search-box .input { flex: none; width: 100%; height: 52px; padding: 0 16px; font-size: 16px; }
  .search-box .btn--primary { height: 52px; }
  .search-box label.visually-hidden { position: static; width: auto; height: auto; overflow: visible; clip: auto; white-space: normal; }

  .hero .lineup { flex-direction: column; align-items: stretch; gap: 12px; padding-top: 22px; padding-bottom: 24px; }
  .lineup > a { flex: none; gap: 6px; }
  .lineup > a:nth-child(even) { display: none; }   /* two drawings, not four */
  .lineup-name .d { font-size: 22px; }

  .counts { padding-top: 20px; padding-bottom: 20px; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 16px; }
  .counts .n { font-size: 28px; }
  .wide-only, .counts > .wide-only { display: none; }

  .home-split { padding-top: 28px; padding-bottom: 28px; }
  .freight .heading-row { flex-direction: column; gap: 2px; }

  /* The table becomes a stack of cards */
  .freight-panel { background: none; border: 0; border-radius: 0; box-shadow: none; overflow: visible; }
  .freight .table, .freight .table tbody { display: block; }
  .freight .table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .freight .table tbody tr { display: grid; grid-template-columns: auto minmax(0, 1fr); grid-template-areas: "code cargo" "route route" "loco loco"; gap: 6px 10px; align-items: baseline; background: var(--panel); border: 2px solid var(--ink); border-radius: 16px; box-shadow: 0 4px 0 var(--ink); padding: 12px 14px; }
  .freight .table tbody tr + tr { margin-top: 10px; }
  .freight .table td, .freight .table td:first-child, .freight .table td:last-child { padding: 0; }
  .freight .code-cell { grid-area: code; display: flex; align-items: baseline; gap: 10px; }
  .freight .code { font-size: 20px; }
  .freight .table td.cargo { grid-area: cargo; text-align: right; font-size: 14px; }
  .freight .table td.route { grid-area: route; font-size: 16px; }
  .freight .table td.loco { grid-area: loco; font-size: 15px; }
  .legend { flex-direction: column; gap: 8px; }

  .latest li { padding: 12px 14px; }
  .promises { grid-template-columns: 1fr; gap: 18px; padding-top: 28px; padding-bottom: 28px; }
  .promises > div { gap: 4px; }
  .promises p { font-size: 15px; }
}
