/* Trueread portal: page-specific rules for the forecast, the roster and kitchen prep. Trueread Noir.
   Shared pieces live in app.css; the contract is docs/portal-classes.md.
   The three pages mark themselves with page-forecast, page-roster or page-prep on <main class="content">. */

/* ---------------------------------------------------------------- shared by the three pages */

/* A wide table keeps its first column in view while the rest scrolls sideways inside its panel.
   Once the region is narrow enough to scroll, the pinned cells take the panel's colour as a solid, with a hairline
   at the edge the other columns slide under. */
.pin-first :is(th, td):first-child { position: sticky; left: 0; z-index: 1; }
:is(.page-forecast, .page-prep) .scroll { container-type: inline-size; }
@container (max-width: 1080px) {
  table.forecast :is(th, td):first-child { background-color: var(--pin); box-shadow: 1px 0 0 var(--line); }
  table.forecast tbody tr:hover > :first-child { background-image: linear-gradient(var(--hover), var(--hover)); }
}
@container (max-width: 720px) {
  table.prep :is(th, td):first-child { background-color: var(--pin); box-shadow: 1px 0 0 var(--line); }
  table.prep tbody tr:hover > :first-child { background-image: linear-gradient(var(--hover), var(--hover)); }
}

/* Words kept for screen readers (sr-only) are positioned, so the scrolling region has to hold them:
   without this, one in a far column would stretch the page itself sideways on a phone. */
:is(.page-forecast, .page-roster, .page-prep) .scroll { position: relative; }

/* On a phone the note beside a section heading drops under it and starts at the left. */
@media (max-width: 520px) {
  :is(.page-forecast, .page-roster, .page-prep) .section-head .aside { margin-left: 0; }
}

/* ---------------------------------------------------------------- forecast */

/* Summary figures on a phone: one line each, the label at the left and the number at the right. */
@media (max-width: 520px) {
  .figures.week .figure { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: baseline; column-gap: 12px; }
  .figures.week .figure-value { margin-top: 0; font-size: 20px; line-height: 28px; font-weight: 400; font-stretch: 100%; letter-spacing: 0; text-align: right; }   /* light weights only from 32px */
  .figures.week .figure-sub { grid-column: 1 / -1; margin-top: 2px; }
}

/* Days to act on: a short list with a hairline between the days. Stacked on a phone, two lines on a tablet,
   one line on a wide screen. */
.acton { list-style: none; margin: 0; padding: 4px 0 8px; font-variant-numeric: tabular-nums; }
.acton > li { display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "day change" "what what" "why why" "moves moves";
  gap: 4px 16px; align-items: center; padding: 12px var(--pad); }
.acton > li + li { border-top: 1px solid var(--line); }
.acton-day { grid-area: day; color: var(--text); font-weight: 500; white-space: nowrap; }
.acton-change { grid-area: change; font-family: var(--mono); font-weight: 500; text-align: right; }   /* a figure in a row: Red Hat Mono */
.acton-what { grid-area: what; }
.acton-why { grid-area: why; display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; color: var(--muted); }
.acton-why svg.i { color: var(--text); }
.acton-moves { grid-area: moves; display: flex; flex-wrap: wrap; gap: 0 16px; font-weight: 500; white-space: nowrap; }
@media (min-width: 700px) {
  .acton > li { grid-template-columns: 96px 56px minmax(0, 1fr) minmax(0, 1fr); grid-template-areas: "day change what what" ". . why moves"; column-gap: 16px; }
}
@media (min-width: 1400px) {
  .acton > li { grid-template-columns: 96px 56px minmax(0, 1.5fr) minmax(0, 1.2fr) minmax(0, 1.1fr); grid-template-areas: "day change what why moves"; }
}

/* The 14-day table. Ten columns: the gutters tighten so the whole table stays on one screen for as long as it can. */
table.forecast :is(th, td) { padding-left: 8px; padding-right: 8px; }
table.forecast :is(th, td):first-child { padding-left: var(--pad); }
table.forecast :is(th, td):last-child { padding-right: var(--pad); }
.forecast .wx { min-width: 152px; }
/* The change in staff-hours sits in its own slot after the figure, so the figures still line up down the column. */
.forecast .vs { display: inline-block; min-width: 4ch; margin-left: 8px; font-family: var(--mono); font-size: 12px; line-height: 16px; text-align: right; }
/* Phones: the weather wraps into a narrow column, so the day, its weather and its forecast show before any scrolling. */
@media (max-width: 520px) {
  .forecast .wide { display: none; }
  .forecast .wx { min-width: 104px; }
}

/* ---------------------------------------------------------------- roster */
/* The lead-in: what the page is, and a pill for each day. */
.roster-intro { display: grid; gap: 16px; padding: 24px var(--pad); }
/* One panel holds the whole fortnight; each day is a ruled tile inside it. */
.roster-days { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; padding: 12px; }
.roster-day { overflow: hidden; scroll-margin-top: 80px; }   /* a jump link lands below the top bar, not under it */
.roster-day .section-head { padding-top: 16px; }
.roster-day > .empty { padding: 16px var(--pad); }
.roster-day details.more { border-top: 1px solid var(--line); }
/* Under each day, behind "Shift times": the same shifts as words, for a phone where a short bar has no room for its time. */
.shift-times { list-style: none; margin: 0; padding: 4px var(--pad) 16px; display: grid; gap: 4px; font-variant-numeric: tabular-nums; }
.shift-times li { display: grid; grid-template-columns: 112px minmax(0, 1fr); align-items: baseline; }
/* Where the browser can, the rows share one label column as wide as the longest label (up to half the width), so a
   long name ("Margherita pizza" on a day's prep list) wraps inside its column instead of running into the figure. */
@supports (grid-template-columns: subgrid) {
  .shift-times { grid-template-columns: fit-content(50%) minmax(0, 1fr); column-gap: 16px; }
  .shift-times li { grid-column: 1 / -1; grid-template-columns: subgrid; }
  .shift-times li > :first-child { min-width: 96px; }
}
.hourly { max-width: 720px; padding-bottom: 8px; }   /* eight short columns read better kept together than spread across the page */
@media (max-width: 860px) {
  .roster-intro { padding-top: 16px; padding-bottom: 16px; }
  .roster-days { padding: 8px; gap: 8px; }
  .roster-day { scroll-margin-top: 128px; --pad: 12px; }
}
@media (max-width: 520px) {
  .page-roster .tl-role .muted { display: none; }   /* phones: the hours per role are in the strip under the bars */
  .shift-times li { grid-template-columns: 64px minmax(0, 1fr); }
  @supports (grid-template-columns: subgrid) {
    .shift-times li { grid-template-columns: subgrid; }
    .shift-times li > :first-child { min-width: 64px; }
  }
}

/* ---------------------------------------------------------------- kitchen prep */
/* Day headings on two lines, the weekday over the date, so seven days take less room across. */
table.prep thead .date { display: block; }
/* Ingredients: a list that runs in as many columns as fit, name at the left and quantity at the right. */
.ledger { list-style: none; margin: 0; padding: 8px var(--pad) 16px; column-width: 280px; column-gap: 40px; font-variant-numeric: tabular-nums; }
.ledger li { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 12px 0;
  border-bottom: 1px solid var(--line); break-inside: avoid; }

/* Days link to their own page: plain text until hovered, so the tables stay calm. */
a.day-link, a.acton-day { color: inherit; text-decoration: none; }
a.day-link:hover, a.acton-day:hover, a.day-link:focus-visible, a.acton-day:focus-visible { text-decoration: underline; text-underline-offset: 3px; }

/* Days to act on: who to add or take off, one role per line. Sentences, so they may wrap. */
ul.acton-staff { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; white-space: normal; font-weight: 400; }
ul.acton-staff b { font-weight: 600; }

/* One day's page */
.day-intro { padding: 12px; }
.jump a[aria-current="page"] { background: var(--selected); border-color: var(--text); color: var(--text); }   /* the day you are on: a White rim */
.figure-value.figure-wx { display: flex; align-items: center; gap: 8px; font-size: 18px; line-height: 24px; font-weight: 400; font-stretch: 100%; letter-spacing: 0; }
.staff-moves { list-style: none; margin: 0 0 12px; padding: 0; display: grid; gap: 8px; }
.staff-moves > li { display: grid; grid-template-columns: minmax(0, 1fr); gap: 2px; }
.staff-role { color: var(--text); font-weight: 500; }
.staff-list { display: flex; flex-wrap: wrap; gap: 2px 16px; }
.staff-list .change { white-space: normal; }
.staff-same { margin-bottom: 12px; }
@media (min-width: 700px) {
  .staff-moves > li { grid-template-columns: 120px minmax(0, 1fr); gap: 16px; }
}

/* Today's update on the Forecast page: today and tomorrow side by side, then what moved since yesterday. */
.today-update .note { margin-bottom: 12px; }
.update-days { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; }
.update-day { padding: 12px var(--pad); }
.update-when { display: flex; justify-content: space-between; gap: 12px; color: var(--text); font-weight: 500; }
.update-sentence { margin-top: 4px; }
.update-staff { margin: 8px 0 0; padding-left: 18px; }
.update-sub { margin: 16px 0 4px; font-size: 14px; line-height: 20px; font-weight: 500; }
.update-list { margin: 0; padding-left: 18px; }
@media (min-width: 900px) { .update-days { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
