/* ==========================================================================
   10-responsive.css — THE SCREEN IS A SHAPE, NOT A WIDTH

   Loaded last, so it is the last word on any rule it touches.

   WHAT WAS WRONG

   The application had twenty breakpoints, added one at a time over the
   releases, and every single one of them asked how WIDE the window was.
   Not one asked how TALL it was.

   A phone on its side is 844 by 390. That is wider than plenty of laptop
   windows, so every one of those twenty rules treated it as a desktop: the
   full masthead, the desktop type, the desktop spacing — on a screen half
   the height of a laptop. The avatar, CURATOR, the strapline and the
   company line filled the entire first screen. You scrolled before you saw
   anything you came for. A smaller phone at 740 by 360 fell the other way
   into the mobile header, which is 266 pixels tall — three quarters of the
   screen.

   WHAT IS HERE

     1. A SHORT SCREEN IS A PHONE ON ITS SIDE, whatever its width. The
        masthead folds into one line, the chrome thins, and the content gets
        the room back.

     2. TABLES STOP BEING TABLES when there is no room for them. Every table
        on the production note was 572 to 608 pixels wide inside a 334 pixel
        window, with the buttons at the right-hand end — so reaching a
        button meant scrolling sideways through the row. Below the
        threshold each row becomes a block: the labels above their values,
        the buttons full width underneath, and nothing off to the right.

     3. THE COLUMNS FOLLOW THE WINDOW rather than sitting at fixed widths.
        The Curate page, the production note, the calendar and every dialog
        are asked for a minimum and given whatever is going.

   The type is not here. Sizes in this application are written inline in 525
   places, which no stylesheet can beat without flattening the page — that
   is handled by the one pass in js/49-fontfloor.js, which holds everything
   on a phone between 9 and 14 point.
   ========================================================================== */


/* ==========================================================================
   1 · A SHORT SCREEN
   ==========================================================================
   500px is the line. A phone on its side is 375 to 430 tall; the shortest
   laptop worth naming is 600. Nothing sits between them, which is what makes
   it a safe place to put the line. */

@media (max-height: 500px) {

  /* THE MASTHEAD, FOLDED.
     On a screen this short the logo, the name, the strapline and the
     company line are four stacked blocks that add up to the whole viewport.
     They become one line: mark, name, strapline, side by side. */
  .landing-hdr {
    margin: 10px 0 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 10px 14px;
    text-align: left;
  }
  .landing-hdr .landing-logo,
  .landing-hdr .tb-logo-letter {
    width: 34px; height: 34px; margin: 0; flex: 0 0 auto;
  }
  .landing-hdr .circ { width: 34px; height: 34px; margin: 0; flex: 0 0 auto; }
  .landing-hdr h1, .landing-hdr .lh-name { margin: 0; }
  .landing-hdr .lh-accent { display: inline; }
  /* The company line is the one thing here nobody needs at 390 pixels tall.
     It is on the title bar, two inches away, at all times. */
  .landing-hdr .landing-sub { display: none; }

  /* THE MASTHEAD AND THE BUTTONS SHARE ONE LINE.

     .landing-top is `position: absolute; top: 24px; right: 40px` — it is
     lifted out of the flow and pinned to the corner, and below 768px it
     goes back into the flow. A phone on its side is 844 wide, so it stayed
     pinned, and the folded masthead was laid out underneath it: CURATOR
     printed straight through EDIT MODE and HELP.

     On a short screen both go into one grid row — the name on the left, the
     buttons on the right — which is also the only arrangement that fits
     them both in the height available. */
  #landing-screen {
    display: grid;
    grid-template-columns: auto 1fr;
    align-content: start;
    align-items: center;
    justify-content: stretch;
    min-height: 0;
    padding: 8px 14px 20px;
    gap: 0 12px;
  }
  #landing-screen > * { grid-column: 1 / -1; }
  #landing-screen > .landing-hdr {
    grid-column: 1; grid-row: 1;
    margin: 0; justify-content: flex-start;
  }
  #landing-screen > .landing-top {
    position: static !important;
    grid-column: 2; grid-row: 1;
    margin: 0; justify-content: flex-end; flex-wrap: wrap;
    top: auto; right: auto;
  }

  /* The four big buttons: shorter, and four across rather than two. */
  .landing-grid { gap: 10px; margin-bottom: 16px; }
  .landing-grid > * { padding: 10px 12px !important; }

  /* Chrome thins out. Every pixel of header on a 390px screen is a pixel of
     work you cannot see. */
  .toolbar, .tb-row { padding-top: 4px !important; padding-bottom: 4px !important; }
  .modal-header { padding-top: 8px !important; padding-bottom: 8px !important; }
  .modal-box { max-height: 96vh; }
  .modal-body { max-height: calc(96vh - 108px); }

  /* A dialog on a short screen is nearly all of it, and its footer has to
     stay reachable without scrolling the whole page. */
  .modal-footer, #mf { position: sticky; bottom: 0; z-index: 2; }
}


/* ==========================================================================
   2 · TABLES THAT STOP BEING TABLES
   ==========================================================================
   The production note's four tables are 572 to 608 pixels of content. Below
   about 720 there is no honest way to show that as a table, and a sideways
   scrollbar with the buttons past the right edge is the least honest of all.

   Each row becomes a block. Every cell carries its column's name in a
   data-label attribute — added by js/57-tablestack.js, because the labels
   live in the <th> and CSS cannot read across the table to find them. */

/* WHY A CONTAINER QUERY AND NOT A MEDIA QUERY.

   A media query asks how wide the WINDOW is. The tables on the production
   note do not live in the window, they live in one of three columns — so on
   a 1440px laptop the note's middle column is 415px and its table is 572px,
   and every media query in the world says "you have 1440 pixels, you are
   fine". It is the column that is narrow, not the screen.

   A container query asks how wide the thing's OWN BOX is, which is the
   question that was always being asked. One rule now covers the phone, the
   tablet, the laptop with a narrow column and the monitor with a dialog
   open on it. */
.xp-tbl-container,
.pp-scroll, .aa-table-wrap, .crew-tbl-wrap, .tbl-wrap, .hub-table-wrap {
  container-type: inline-size;
}

/* ONLY ON A PHONE.

   The first draft of this applied to any narrow BOX, which sounded right and
   was not. The production note's columns have always been narrower than the
   tables in them — that is the shipped design, and on a laptop those tables
   have always been read by scrolling the column. Turning them into stacked
   blocks there traded a screenful of rows for one row, and fixed nothing
   anybody had complained about.

   The complaint was about a phone. So all of this sits inside a phone test
   as well as a container test: a laptop, a monitor and a tablet are left
   exactly as they shipped, and only a screen that really is small gets the
   new behaviour. */
@media (max-width: 760px), (max-height: 500px) {
@container (max-width: 380px) {
  table.xp-stacked,
  .xp-stacked thead,
  .xp-stacked tbody,
  .xp-stacked th,
  .xp-stacked td,
  .xp-stacked tr { display: block; width: auto !important; }

  .xp-stacked thead tr {
    position: absolute; width: 1px; height: 1px;
    overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap;
  }
  .xp-stacked tr {
    margin: 0 0 10px; border: 1px solid var(--c-border); border-radius: 8px;
    background: rgba(255, 255, 255, .02); padding: 4px 2px;
  }
  .xp-stacked td {
    border: none !important; padding: 5px 7px !important;
    /* minmax(0, 1fr), not 1fr. A grid track written as `1fr` will not go
       below the widest unbreakable thing in it, so one long word in a value
       quietly widens the whole row and there is no single element you can
       point at that is too big — the row simply refuses to be narrower.
       Writing the floor as 0 lets the track shrink and the word wrap. */
    display: grid; grid-template-columns: minmax(58px, 30%) minmax(0, 1fr);
    gap: 8px; align-items: start; text-align: left !important;
    min-width: 0;
  }
  /* The value side may break a long word rather than push the block wider
     than the screen. A speaker's name is worth breaking; a block you have to
     drag is not. */
  .xp-stacked td > *, .xp-stacked td::after { min-width: 0; overflow-wrap: anywhere; }

  /* ONCE THE ROW IS A BLOCK, THE CELLS MAY WRAP.

     In a table a cell is held on one line on purpose — a call sheet where
     "McCullough" breaks in two is harder to read at a glance. That reasoning
     is about a table. Once the row is a block there is no column to keep
     tidy, and a line that cannot wrap is the only thing still holding the
     block wider than the screen. (This was written into the fit rules below
     and left out of these, which is why the crew roster stacked and then
     stuck out by thirteen pixels anyway.) */
  .xp-stacked th,
  .xp-stacked td,
  .xp-stacked td * {
    white-space: normal !important;
    overflow: visible !important;
    text-overflow: clip !important;
    overflow-wrap: break-word;
  }
  /* A time, a date and a countdown figure are single values and stay whole.
     The countdown BLOCK around them is not, and wraps — see section 11. */
  .xp-stacked .ros-tf > time,
  .xp-stacked .cd-fig,
  .xp-stacked .nowrap { white-space: nowrap !important; }
  .xp-stacked tr { padding: 3px 1px; }
  .xp-stacked td::before {
    content: attr(data-label);
    font-size: 9px; font-weight: 800; letter-spacing: .6px;
    text-transform: uppercase; color: var(--muted); padding-top: 2px;
  }
  .xp-stacked td[data-label=""]::before,
  .xp-stacked td:not([data-label])::before { content: none; }
  .xp-stacked td[data-label=""],
  .xp-stacked td:not([data-label]) { display: block; }
  .xp-stacked td.xp-cell-actions {
    display: flex; flex-wrap: wrap; gap: 8px; padding-top: 2px !important;
  }
  .xp-stacked td.xp-cell-actions > * { flex: 1 1 auto; min-height: 38px; }
  .xp-stacked td input,
  .xp-stacked td select,
  .xp-stacked td textarea { width: 100% !important; min-width: 0 !important; }

  /* THE CELLS MAY WRAP AGAIN.

     In a table a cell is held on one line on purpose — a call sheet where
     "McCullough" breaks across two lines is harder to read at a glance than
     the same name a shade smaller on one. That reasoning is about a table.
     Once the row is a block there is no column to keep tidy, and a line that
     cannot wrap is the whole reason the block is still wider than the
     screen. */
  .xp-stacked th,
  .xp-stacked td,
  .xp-stacked td * {
    white-space: normal !important;
    overflow: visible !important;
    text-overflow: clip !important;
    overflow-wrap: anywhere;
    word-break: break-word;
  }
  table.xp-stacked {
    table-layout: auto !important;
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
  }

  /* SOME VALUES ARE ONE THING AND MUST NOT BREAK.

     A time-frame reading "9:00 AM – 10:30 AM" split across two lines is not
     a time-frame any more, and the same goes for a date or a countdown.
     They are single values, not sentences, and they are narrow enough to fit
     whatever happens. Everything else above may wrap; these may not. */
  .xp-stacked .ros-tf,
  .xp-stacked .ros-tf *,
  .xp-stacked .nowrap,
  .xp-stacked td[data-label="Time-Frame"] > *,
  .xp-stacked .cd-fig,
  .xp-stacked time { white-space: nowrap !important; }
}

/* Once a table has stacked, its wrapper has nothing left to scroll. */
@container (max-width: 380px) {
  .xp-tbl-container,
  .pp-scroll, .aa-table-wrap, .crew-tbl-wrap, .tbl-wrap, .hub-table-wrap {
    overflow-x: visible;
  }
}

/* ---- BETWEEN THE TWO: A TABLE THAT FITS ---------------------------------
   Stacking is right on a phone and wrong on a laptop. The production note's
   middle column is 415px on a 1440px screen — narrower than the table it
   holds, which is why it used to scroll sideways there, but nowhere near
   narrow enough to justify turning four tidy columns into four stacked
   blocks. Turning the Run of Show into blocks on a laptop trades a screenful
   of rows for one row, to solve a problem that has a better answer.

   So between about 420 and 760 the table stays a table and is made to FIT:
   the fixed column widths give way, the cells may wrap, and the buttons wrap
   inside their own cell rather than pushing the row wider. Density kept,
   sideways drag gone. */
/* Up to 1000, not 760: a phone on its side is 844 wide, so a full-width
   pane on it is 806 — wider than any threshold drawn for portrait. This
   whole block is already inside the phone test above, so a laptop never
   reaches it however wide its panes are. */
@container (min-width: 381px) and (max-width: 1000px) {
  .xp-stacked,
  table.xp-stacked {
    table-layout: auto !important;
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
  }
  /* `white-space: normal` is the whole fix: it lets the browser work out a
     narrower layout for the same table. NOT `overflow-wrap: anywhere` — that
     says a word may break between any two letters, which makes the smallest
     possible column one character wide, and the browser duly rendered
     SEGMENT as seven stacked letters. A word breaks only when it genuinely
     cannot fit on its own. */
  .xp-stacked th,
  .xp-stacked td {
    white-space: normal !important;
    overflow-wrap: break-word;
    padding-left: 5px !important;
    padding-right: 5px !important;
  }
  /* A heading is two or three words and must stay readable across. */
  .xp-stacked th { overflow-wrap: normal; }
  /* A time-frame, a date and a countdown are single values and stay whole. */
  .xp-stacked .ros-tf, .xp-stacked .ros-tf *,
  .xp-stacked .cd-fig, .xp-stacked time,
  .xp-stacked .nowrap { white-space: nowrap !important; }

  /* The buttons stop being the reason a row is too wide. */
  .xp-stacked td.xp-cell-actions {
    white-space: normal !important;
  }
  .xp-stacked td.xp-cell-actions > * {
    display: inline-flex;
    margin: 1px 2px 1px 0;
  }
  .xp-tbl-container,
  .pp-scroll, .aa-table-wrap, .crew-tbl-wrap, .tbl-wrap, .hub-table-wrap {
    overflow-x: visible;
  }
}
}   /* end: only on a phone */

/* Nothing inside the workspace may be wider than the workspace. A single
   card, header or table that overruns turns the whole page into a sheet you
   have to drag. */
.main-wrap > *, .app-grid > *, .c-hdr, .card { max-width: 100%; min-width: 0; }
.app-grid { min-width: 0; }

/* An earlier draft repeated all of the stacking rules here as a plain
   `max-width: 720px` media query. It was written before the container
   queries above existed and it did the same job less well — it asked about
   the window rather than the table's own box, so it stacked a table in a
   roomy pane on a small screen and left one in a narrow pane on a big
   screen alone. The container rules cover every case it covered. */


/* ==========================================================================
   3 · COLUMNS THAT FOLLOW THE WINDOW
   ==========================================================================
   Fixed column widths are a promise about a screen size nobody made. These
   ask for a minimum and take what is going, at every size and either way up. */

/* The Curate page and the production note. */
@media (max-width: 1100px) {
  .app-grid {
    grid-template-columns: repeat(auto-fit, minmax(min(300px, 100%), 1fr)) !important;
    grid-template-areas: none !important;
  }
  .app-grid > * { grid-column: auto !important; grid-area: auto !important; }
}

/* The calendar. A month grid has to stay seven columns wide — a week is
   seven days and no window size changes that — so what gives is the height
   of a day and the size of what is in it, not the number of columns. */
.cal-grid, #cal-grid { width: 100%; }

/* THESE RULES NEVER FIRED, AND THAT IS WHY THE CALENDAR WAS UNUSABLE SMALL.

   They were written for `.cal-day`, `.cal-cell`, `.cal-body` and
   `.cal-scroll`. None of those classes exists anywhere in the app -- the
   cells are `.cal-day-cell` and the body is `.cal-modal-body`. So every
   rule below the first one was addressed to nothing, and a phone got the
   full-size month grid: a day cell carries an inline min-height of 92px
   (js/17-calendar-view.js), six rows of that is 560px of cells on a 404px
   screen, and the dialog became a long scroll of mostly empty boxes.

   Addressed to the real class names, and with !important, because the 92px
   is an INLINE style -- a plain stylesheet rule loses to it however
   specific. See the same reason beside the button widths in css/02-layout.css.

   A week is seven days, so the columns never change. What gives is the
   height of a day and the size of what sits in it. */
@media (max-width: 900px) {
  #cal-grid { gap: 2px !important; }
  .cal-day-cell {
    min-height: 62px !important;
    padding: 5px !important;
  }
  .cal-event-pill { padding: 3px 4px !important; line-height: 1.2 !important; }
}

/* A phone. Six rows at 44px is 264px of grid, which fits a portrait screen
   with the month controls above it and no scrolling at all. */
@media (max-width: 560px) {
  .cal-day-cell {
    min-height: 44px !important;
    padding: 4px !important;
    font-size: 10px;
  }
  .cal-event-pill { font-size: 9px !important; padding: 2px 3px !important; }
}

/* THE THREE CONTROL BARS ABOVE THE MONTH.

   The grid is only part of the height. Above it sit a title bar with six
   buttons, a layout-and-time-zone bar, and a filter bar — 581px of them on
   a 404px screen, measured, against 381px for the month itself. So shrinking
   the cells alone could never make the calendar fit a phone: the controls
   were four fifths of the problem.

   Nothing is taken away. The type comes down, the padding comes in, the
   long instruction line goes (it says to double-click and to drag, neither
   of which a phone does), and the buttons get small enough that five fit on
   a row instead of two. Every control is still there and still works.

   Addressed with :nth-child because the three bars are the first three
   children of the calendar's own column and carry no classes of their own;
   !important throughout because every one of those paddings is an inline
   style in default.php. */
@media (max-width: 760px) {
  #calendar-overlay #cal-my { font-size: 15px !important; }
  #calendar-overlay #cal-sub-desc { display: none; }
  #calendar-overlay .cal-modal-body > div > div:nth-child(-n+3) {
    padding: 6px 8px !important;
    margin-bottom: 8px !important;
    gap: 6px !important;
  }
  #calendar-overlay .btn,
  #calendar-overlay .btn-cal-view {
    font-size: 10px !important;
    padding: 4px 8px !important;
  }
  #calendar-overlay select,
  #calendar-overlay input[type="text"] {
    font-size: 10px !important;
    padding: 3px 6px !important;
    min-width: 0 !important;
  }
  /* The 28px calendar glyph beside a heading that already says Event
     Calendar, next to a dialog header that says it a third time. */
  #calendar-overlay .cal-modal-body > div > div:first-child span[style*="font-size:28px"] {
    display: none;
  }

  /* THE WORDS IN FRONT OF THE CONTROLS.

     "LAYOUT VIEW:", "🌐 TIME ZONE:" and "🔍 FILTERS:" each take a whole
     flex slot, and on a 404px screen a slot is most of a row -- so three
     labels cost three rows, about a hundred pixels, to name controls that
     are a month/week/day switch, a list of time zones and three dropdowns
     above a search box. They are self-evident at this size; on anything
     wider they stay. */
  #calendar-overlay .cal-modal-body > div > div:nth-child(2) > div > span,
  #calendar-overlay .cal-modal-body > div > div:nth-child(3) > span:first-child,
  #calendar-overlay #cal-filter-count-badge {
    display: none;
  }

  /* The second ✕ Close. The dialog header carries one two inches above it,
     and on a phone it was taking a row of its own. */
  #calendar-overlay .cal-modal-body > div > div:first-child > div:last-child > button:last-child {
    display: none;
  }
}

@media (max-height: 500px) {
  /* A phone on its side. The grid is taller than the screen however small
     the cells are, so the calendar body scrolls on its own and the month
     controls above it stay put. */
  #calendar-overlay .cal-modal-body {
    max-height: calc(100vh - 96px);
    overflow-y: auto;
  }
  .cal-day-cell { min-height: 38px !important; }
}

/* Every dialog. They were a fixed width with a fixed maximum height, which
   on a phone meant a dialog wider than the screen and taller than it too. */
/* ONLY A CEILING, NEVER A WIDTH.

   The first draft of this said `width: min(100%, 980px)`, which does cap a
   dialog on a phone — and also makes every ordinary dialog on a desktop
   980px wide, when they ship at 850. A rule meant to stop something being
   too big had quietly made everything bigger. This one sets no width at
   all: each dialog keeps the width it was given and simply may not exceed
   the window. */
.modal-box { max-width: calc(100vw - 16px); }
@media (max-width: 760px) {
  .modal-overlay { padding: 8px !important; align-items: flex-start !important; }
  .modal-box { max-width: 100% !important; width: 100% !important; margin: 0 !important; }
  .modal-footer, #mf { flex-wrap: wrap; gap: 8px; }
  .modal-footer > *, #mf > * { flex: 1 1 auto; min-height: 40px; }
}

/* Nothing, anywhere, is allowed to push the page sideways. A single element
   wider than the window turns the whole app into a scrolling sheet. */
@media (max-width: 900px) {
  .app-grid, .card, .modal-box, .tbl, table { max-width: 100%; }
  img, video, iframe { max-width: 100%; height: auto; }
}


/* ==========================================================================
   4 · THE LIST DOWN THE SIDE, ON A NARROW SCREEN
   ==========================================================================
   Below 900px the Help and Analytics lists became one horizontal strip with
   its own sideways scrollbar. On a phone that is 3,152 pixels of content in
   a 342 pixel window — nine screenfuls of dragging to reach the last
   walkthrough, and no way to tell there is anything past the edge.

   They wrap instead. Everything is visible, nothing is dragged, and if the
   block gets tall it scrolls DOWNWARDS, which is the direction a phone
   already scrolls. */
@media (max-width: 900px) {
  .xp-help-nav, .hub-nav {
    flex-wrap: wrap !important;
    overflow-x: visible !important;
    overflow-y: auto !important;
    max-height: 34vh !important;
    justify-content: flex-start;
  }
  .xp-help-nav-item, .hub-nav-item {
    flex: 1 1 auto !important;
    min-width: 45% !important;
    justify-content: flex-start;
  }
}
@media (max-height: 500px) {
  /* On a phone on its side there is no room for a third of the screen of
     list, so it is shallower and the pane beside it keeps the space. */
  .xp-help-nav, .hub-nav { max-height: 30vh !important; }
}


/* ==========================================================================
   5 · THE EDGE TABS DO NOT SIT ON TOP OF A DIALOG
   ==========================================================================
   The Options tab — and the Roster tab inside the workspace — are fixed to
   the side of the window at all times. A dialog's close button is in its top
   right corner, and on a narrow screen those are the same few pixels: the
   tab sits over the ✕, so the thing you press to get out is behind the thing
   you were not reaching for.

   While a dialog is open the tabs stand down. They are for moving around the
   app, and a dialog is not somewhere you move around from. */
body:has(.modal-overlay.show) #options-dock-btn,
body:has(.modal-overlay.show) #roster-dock-btn { display: none !important; }


/* ==========================================================================
   6 · TWO THINGS THAT REFUSED TO GIVE
   ==========================================================================
   Found by measuring rather than by looking: on a 360px phone the workspace
   was 391px wide, and on a 1440px laptop it was 1462px. Both were one
   element that had been told never to shrink. */

/* The credit line under the workspace. `white-space: nowrap` is right on a
   laptop — a company name broken across two lines looks like a mistake — and
   impossible on a 360px screen, where the line is 360px on its own and
   starts 31px in. It wraps when it has to. */
@media (max-width: 620px) {
  .ws-credit { white-space: normal; text-align: center; line-height: 1.5; }
}

/* The Tech Note's control cluster is `flex: 0 0 auto`, which means "never
   give up a pixel" — so in a row that ran out of room it went straight
   through the right-hand edge, taking the Edit button with it. It may wrap
   now; the row above it already does. */
.tn-bar-ctl { flex-wrap: wrap; min-width: 0; }
@media (max-width: 1500px) {
  .tn-bar-ctl { flex: 0 1 auto; }
}


/* ==========================================================================
   7 · THE CREW ROSTER, ON THE NARROWEST SCREEN
   ==========================================================================
   The crew roster is five short columns — #, last name, first name, role,
   status — and it is deliberately held on one line each with an ellipsis,
   because a call sheet where "McCullough" breaks in two is harder to read at
   a glance. That reasoning holds all the way down to about 340 pixels, and
   below it the table is a few pixels wider than the column it sits in, which
   buys a sideways drag for nothing.

   So on the narrowest screens the ROLE column wraps. The file that set the
   rule says role "is the column that gives, because it is the longest and
   the most guessable from context" — this is that same judgement, at the
   size where something has to. */
/* The crew roster used to have a rule of its own here, letting its cells
   wrap at the narrowest sizes. The stacking rule above now reaches this far
   and does the same job better, and the two were fighting: this one said
   `width: 100%` and stacking said `width: auto`, both with !important, so
   the table stayed a table with stacked cells inside it — 15 pixels wider
   than the screen. One rule is better than two that disagree. */


/* ==========================================================================
   8 · THE EDGE TABS, ON A NARROW SCREEN
   ==========================================================================
   ROSTER and OPTIONS are fixed to the left and right edges, halfway down,
   turned on their side. On a laptop they sit in the margin. On a 390px phone
   there is no margin: they sit ON the cards, over whatever is underneath,
   and the thing underneath is usually a button.

   They get smaller and they get out of the way — pulled mostly off the edge
   so only a thumb-sized sliver shows, which is how a drawer handle should
   behave on a phone anyway. Pressing one still opens its panel. */
@media (max-width: 760px) {
  #roster-dock-btn, #options-dock-btn {
    padding: 10px 3px;
    font-size: 9px;
    letter-spacing: 1px;
    opacity: .85;
    max-height: 40vh;
  }
  #roster-dock-btn  { transform: translateY(-50%) translateX(-42%); }
  #options-dock-btn { transform: translateY(-50%) translateX(42%); }
  #roster-dock-btn:hover  { transform: translateY(-50%) translateX(0); }
  #options-dock-btn:hover { transform: translateY(-50%) translateX(0); }
  /* And the workspace keeps clear of the sliver that is left. */
  .main-wrap { padding-left: 14px !important; padding-right: 14px !important; }
}


/* ==========================================================================
   9 · A WIDE BADGE INSIDE A STACKED ROW
   ==========================================================================
   The Run of Show's status pill — "Speaking Engagement Fulfilled" — is a
   fixed-width badge about 340px across. Inside a stacked block on a 360px
   phone it is the one thing still pushing the row past the edge, so the
   table's box reported 346px of content in a 308px window even though the
   table itself fitted. It wraps like everything else here. */
@media (max-width: 760px), (max-height: 500px) {
  .xp-stacked .ros-seg-pill,
  .xp-stacked [class*="-pill"],
  .xp-stacked .badge,
  .xp-stacked .tag {
    max-width: 100%;
    white-space: normal !important;
    overflow-wrap: anywhere;
    text-align: left;
  }
}


/* ==========================================================================
   10 · THE `1fr` FLOOR, EVERYWHERE ELSE ON A SMALL SCREEN
   ==========================================================================
   The same trap as the stacked cells above, in every other grid and flex row
   in the application: a track or an item will not shrink below its own
   min-content width unless it is told it may. That is why a dialog could
   report 365 pixels of content in a 344 pixel box with nothing inside it
   measurably too wide — no one element was too big, the layout just would
   not be smaller. */
@media (max-width: 760px), (max-height: 500px) {
  .modal-body > *, .modal-body,
  .app-grid > *, .card > *,
  .cal-body > *, .main-wrap > * { min-width: 0; }
}


/* ==========================================================================
   11 · THE COUNTDOWN INSIDE THE TIME-FRAME
   ==========================================================================
   The Time-Frame cell is exempt from wrapping above, and rightly: "9:55 AM"
   split over two lines is not a time. But the cell also holds the countdown
   block beside it — "3d 5h REMAINING" and its bar — which is a flex row
   three hundred pixels wide, and the exemption was covering that too. So a
   rule meant to protect seven characters was holding a whole row open.

   The time stays whole. Everything else in the cell may wrap. */
@media (max-width: 760px), (max-height: 500px) {
  .xp-stacked .cd-wrap,
  .xp-stacked .cd-wrap * {
    white-space: normal !important;
    min-width: 0 !important;
    max-width: 100%;
    flex-wrap: wrap;
  }
  .xp-stacked .cd-wrap { display: flex; row-gap: 3px; }
  /* and the bar inside it stops asking for a fixed length */
  .xp-stacked .cd-bar, .xp-stacked .cd-fill { max-width: 100%; min-width: 0 !important; }
}


/* ==========================================================================
   12 · THE LAST FEW PIXELS, ON THE NARROWEST PHONE
   ==========================================================================
   The crew roster writes `white-space: nowrap` onto its cells from the
   markup (js/09b-crew.js), which is why the rules above could not reach some
   of them, and "Executive Production Manager" is wider than a 308px block on
   its own. The calendar's dialog body has the same shape.

   At this size a broken word beats a sideways drag. Above this size neither
   of these applies and both keep their single lines. */
@media (max-width: 420px) {
  .crew-tbl td, .crew-tbl th,
  .crew-grid td, .crew-grid th,
  .crew-tbl td *, .crew-grid td * {
    white-space: normal !important;
    overflow-wrap: anywhere !important;
    overflow: visible !important;
    text-overflow: clip !important;
  }
  /* `table-layout: fixed` with per-column percentages cannot give a
     column back, so the table stays its shipped width whatever the cells do.
     At this size it sizes to its contents instead. */
  .crew-tbl, .crew-grid table { table-layout: auto !important; width: 100% !important; }
  /* overflow-y: auto forces overflow-x to compute as auto too — one axis
     cannot be visible while the other scrolls — so BOTH are named here. */
  .crew-tbl-wrap, .crew-grid {
    max-width: 100%; min-width: 0;
    overflow-x: hidden; overflow-y: auto;
  }

  .cal-modal-body, .modal-body {
    min-width: 0;
    overflow-x: visible;
  }
  .cal-modal-body *, .modal-body > * { min-width: 0; max-width: 100%; }
}


/* ==========================================================================
   13 · ON PRODUCTION DAY, THE WORK COMES FIRST
   ==========================================================================
   The note has three columns. On a wide screen they sit side by side and the
   order down the page does not matter, because all three are in front of
   you. On a phone they stack, and then the order is the only thing that
   matters — it is the order you scroll through.

   Column one is the crew: six department tables, Directors through Video.
   Column two is the work: the Schedule, the Equipment, the Run of Show, the
   Admin block, Supplemental, Training, Post-Production, Streams and Call.
   Column three is the cover and the notes, and on a service day it is hidden
   altogether.

   So on production day, on a phone, somebody scrolled through six crew
   tables to reach the Run of Show — on the one day they are standing in a
   control room needing it. The two columns swap: the work first, the crew
   under it. Nothing moves on a wide screen, where both are already visible,
   and nothing moves on any other day. */
@media (max-width: 760px), (max-height: 500px) {
  /* .document-grid, not .app-grid: the note's three columns live in the
     first and the Curate screen's cards in the second, and they are easy to
     mistake for each other. */
  /* `order` is ignored by an item placed into a NAMED GRID AREA — explicit
     placement always beats it. The note's grid places its three columns by
     name, so the names have to go before the order can mean anything. Only
     on a production day, and only on a small screen. */
  body.event-day-lean .document-grid {
    grid-template-areas: none !important;
    grid-template-columns: minmax(0, 1fr) !important;
  }
  body.event-day-lean .document-grid > * { grid-area: auto !important; order: 3; }
  body.event-day-lean .document-grid > .col2 { order: 1; }
  body.event-day-lean .document-grid > .col1 { order: 2; }
}


/* ==========================================================================
   14 · SERMON APPEARANCES LEADS THE DASHBOARD
   ==========================================================================
   The page was an even two columns of sections, which gave the busiest
   section on it exactly as much room as the quietest. Sermon Appearances
   now takes a wide block down the left — two cards across — and every other
   section stacks in a narrower column beside it.

   NOTHING GOES UNDER IT WHILE IT IS LONG. `grid-row: 1 / -1` is what does
   that: the block reaches from the first row to the last, so there is no row
   left for anything to start in beneath it. Once Sermon is down to four
   cards — one row of two, readable at a glance — js/46-dashsections.js says
   so with `lead-short`, the span comes off, and the other sections flow on
   underneath it as they would in any ordinary grid.

   On a phone none of this applies: there is one column, and the order down
   the page is the order in the markup, which already puts Sermon where it
   belongs. */
@media (min-width: 1000px) {
  /* BACK INTO A GRID FOR THIS ONE CASE, DELIBERATELY.

     The ordinary two-column dashboard is multi-column now, so the sections
     pack instead of sitting in rows (see css/04-components.css). This layout
     cannot be: it is a 1.85-to-1 split with ONE section spanning the whole
     height on the left, which is a grid's job and nothing a column count can
     express. So has-lead steps out of multi-column and back into the grid it
     was always written for, and the rule down the middle goes back to being
     drawn by hand at the split. */
  .dash-sections.has-lead {
    display: grid;
    column-count: auto;
    column-rule: none;
    grid-template-columns: minmax(0, 1.85fr) minmax(0, 1fr);
    gap: 18px 26px;
    align-items: start;
    position: relative;
  }
  .dash-sections.has-lead > .dash-sec { margin: 0; break-inside: auto; }
  .dash-sections.has-lead::before {
    content: "";
    position: absolute;
    left: calc(64.9% - 13px);
    top: 0; bottom: 0;
    width: 1px;
    background: var(--cyan);
    opacity: .45;
    pointer-events: none;
  }
  .dash-sections.has-lead > .dash-sec.is-lead { padding-right: 24px; }

  .dash-sections.has-lead > .is-lead {
    grid-column: 1;
    grid-row: 1 / -1;          /* the whole height: nothing fits beneath */
  }
  .dash-sections.has-lead > .dash-sec:not(.is-lead) { grid-column: 2; }
  /* Two cards across in the wide block, one in the narrow column. */
  .dash-sections.has-lead > .is-lead .dash-sec-body {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .dash-sections.has-lead > .dash-sec:not(.is-lead) .dash-sec-body {
    grid-template-columns: minmax(0, 1fr);
  }

  /* SHORT ENOUGH TO READ AT A GLANCE: the others come underneath. */
  .dash-sections.has-lead.lead-short > .is-lead { grid-row: auto; }
  .dash-sections.has-lead.lead-short > .dash-sec:not(.is-lead) { grid-column: auto; }
  .dash-sections.has-lead.lead-short > .dash-sec:not(.is-lead) .dash-sec-body {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}


/* ==========================================================================
   14b · THE LEAD BLOCK AND THE RAIL BESIDE IT
   ==========================================================================
   "The sections are too far apart and it is highly imperative to be aligned
    proportionately and brought together for better readability."

   Three separate faults were doing that, and they had to be fixed together
   because each one hid the next.

   1. THE RIVER. The gap a reader saw between the two blocks was fifty
      pixels: a 26px grid gap plus a 24px padding-right on the lead block,
      which existed only to hold the content off a dividing rule that was
      positioned by hand at `64.9%`. Fifty pixels is four times the gap
      between two cards, so the page read as two documents side by side
      rather than one. It is --dash-gutter now: half that, with the rule
      drawn down the centre of it from the right-hand edge, so moving the
      gutter moves the rule and neither can be left behind.

   2. THE CARDS WERE DIFFERENT SIZES. The split was 1.85fr to 1fr, which is
      not the ratio that makes two cards in the left block the same width as
      one card in the right. It made the cards in the narrow column about an
      eighth WIDER than the cards in the wide one -- the subordinate column
      with the bigger cards on it. The arithmetic is done properly below:
      take the card gap and the gutter out of the width, and the rail is
      exactly one third of what is left. Every card on the page is then the
      same width, which is what "aligned proportionately" asks for.

   3. THE HOLES DOWN THE RIGHT. Explained where it was caused, in
      js/46-dashsections.js: `grid-row: 1 / -1` quietly meant `span 1`, so
      each section beside the lead got a row of its own sized against the
      lead's full height. The sections are one rail in one cell now, packed
      by their own gap.

   Everything here is for the long lead only. When the lead is short enough
   to read at a glance there is no rail, the page falls back to the ordinary
   grid above, and none of this applies. */
@media (min-width: 1000px) {
  .dash-sections.has-rail {
    /* The rail is ONE CARD WIDE, exactly.

       Let T be this container, G the gutter and C the card gap. Two cards
       and one gap fill the lead block, one card fills the rail, so
       3·card = T − G − C and the rail is a third of what is left. The lead
       block takes the rest through 1fr, so the two always add up however
       wide the window is. */
    grid-template-columns:
      minmax(0, 1fr)
      minmax(0, calc((100% - var(--dash-gutter) - var(--dash-card-gap)) / 3));
    column-gap: var(--dash-gutter);
    row-gap: 0;
  }

  /* No padding holding the content off the rule any more -- the gutter is
     the space, and the rule is drawn inside it. */
  .dash-sections.has-rail > .dash-sec.is-lead {
    grid-column: 1;
    grid-row: auto;
    padding-right: 0;
    margin-bottom: 0;
  }

  .dash-sections.has-rail > .dash-rail {
    grid-column: 2;
    grid-row: 1;
    display: flex;
    flex-direction: column;
    gap: 20px;
    min-width: 0;
  }
  .dash-sections.has-rail > .dash-rail > .dash-sec { margin-bottom: 0; }

  /* Two cards across in the lead block, one in the rail. */
  .dash-sections.has-rail > .is-lead .dash-sec-body {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .dash-sections.has-rail .dash-rail .dash-sec-body {
    grid-template-columns: minmax(0, 1fr);
  }

  /* THE RULE, MEASURED FROM THE EDGE IT BELONGS TO.

     It used to be `left: 64.9%` minus a hand-picked 13 pixels, which is a
     number that has to be re-guessed every time anything else on this line
     changes. Measured from the right instead: back off the rail's own
     width, then half the gutter, and it lands in the middle of the gap
     wherever the gap happens to be. */
  .dash-sections.has-rail::before {
    left: auto;
    right: calc((100% - var(--dash-gutter) - var(--dash-card-gap)) / 3
                + (var(--dash-gutter) / 2));
  }
}

/* ==========================================================================
   ON A PHONE: THE WORK FIRST, THEN THE CREW, THEN THE REST

   WHAT WAS ASKED FOR. "The Second Column comes first then crew positions
   then the rest when resized to a small window size or the smallest window
   possible."

   WHY. Once the note's columns stack, column one comes first -- and column
   one opens with six crew departments. On a phone that is a screenful of
   names before you reach the schedule and the run of show, which is what
   anybody actually opens the note on a phone to see.

   This already existed, but only on a production day: the rule a few hundred
   lines above swaps columns one and two under `body.event-day-lean`, and its
   comment describes exactly this complaint. It is now every day, and it goes
   one step further -- the crew is lifted OUT of column one to sit between
   the work and everything else, rather than the whole column moving as a
   lump.

   TWO MECHANICS THAT MATTER.

   1. ORDER IS IGNORED BY AN ITEM IN A NAMED GRID AREA. The note places its
      columns by name, so the names have to be cleared before `order` means
      anything at all. That is why the first attempt at this only worked
      inside column one: the column itself could not be moved.

   2. `display: contents` ON COLUMN ONE makes its children take part in the
      grid directly, so the crew block can be ordered independently of the
      rest of its own column. Safe here because .col1 carries no background,
      border or padding of its own -- it is a track, not a surface.

   Screens only. The note is printed and exported to PDF, and a narrow print
   box must never reorder a document somebody is filing.
   ========================================================================== */
.pp-crew-head-m { display: none; }

@media screen and (max-width: 640px) {
  /* Clear the named areas, or nothing below has any effect. */
  .document-grid {
    grid-template-areas: none !important;
    grid-template-columns: minmax(0, 1fr) !important;
  }
  .document-grid > * { grid-area: auto !important; }

  /* Column one stops being a box and becomes its contents, so the crew can
     be lifted out from between its neighbours. */
  .document-grid > .col1 { display: contents; }

  /* 1. the work */
  .document-grid > .col2 { order: 1; }
  /* 2. the crew, with its heading travelling alongside it */
  .col1 > .pp-crew-head-m,
  .col1 > .crew-part { order: 2; }
  /* 3. the rest of column one */
  .col1 > * { order: 3; }
  /* 4. the tech notes and the cover */
  .document-grid > .col3 { order: 4; }

  /* The heading belongs to the block it heads, not to the card at the top. */
  .pp-head-card .pp-head-crew { display: none; }
  .pp-crew-head-m { display: block; margin-top: 18px; }
}


/* ==========================================================================
   ON A PHONE, THE PAGE SCROLLS -- NOT A BOX INSIDE IT

   "Fix the scroll of the Pre Production Notes page. it is wonky."

   WHAT WAS MEASURED, BEFORE ANYTHING WAS CHANGED

   On a 390x844 phone, with the note open:

       the page scrolled                          0px
       a box called .main-wrap scrolled       8,940px
       boxes inside THAT which also scrolled        7

   That is the whole of the wonkiness, and it is two problems stacked.

   ONE: THE PAGE NEVER SCROLLED AT ALL. #editor-screen is pinned to exactly
   100vh with overflow:hidden, .split-view inside it is overflow:hidden too,
   and .main-wrap inside THAT is the one thing with a scrollbar. That is the
   ordinary way to build a desktop app -- a fixed frame with a scrolling
   panel in it -- and on a desktop it is right. On a phone it is three
   separate wrongs:

     * 100vh on a phone means the viewport with the address bar HIDDEN. The
       address bar only hides when the PAGE scrolls, and the page never
       scrolls, so the bar never goes away and the bottom hundred pixels of
       every screen sit underneath it, permanently.
     * A panel scrolled with a finger has no rubber band at the ends and no
       hand-off to the page, because there is no page scroll to hand off to.
       It simply stops dead, which is what "wonky" feels like.
     * The dashboard does NOT do this -- #landing-screen is min-height and
       scrolls like a normal page. So the two halves of the app scrolled
       differently from each other on the same phone.

   TWO: SEVEN MORE SCROLLING BOXES INSIDE IT. Each crew department is a
   .crew-tbl-wrap capped at 260-320px, and the Run of Show and the schedule
   are .pp-scroll capped at 70vh. In a column on a desktop those caps are
   right: they stop one long section from burying the five under it. On a
   390px phone the visible panel was 547px tall and one of those caps was
   591px -- a scrolling box TALLER than the thing it was scrolling inside.
   A finger landing on a crew table scrolled the table, and the page under
   it did not move until that table had run out of rows. Seven of those on
   one note is a page that moves when it feels like it.

   WHAT IT DOES NOW. On a phone the frame stops being a frame: the editor
   grows to the height of its contents, the panel stops scrolling, the caps
   come off the tables, and the DOCUMENT scrolls -- one scrollbar, the
   address bar retracts the way it does on every other page, and a swipe
   anywhere on the note moves the note.

   min-width:0 on .main-wrap is not decoration. The moment .split-view stops
   clipping, .main-wrap is a flex item with the default min-width:auto and
   it refuses to go narrower than its contents -- which put it 28px wider
   than a 360px phone and clipped the right-hand edge off every card. 0 lets
   it shrink to the screen, which is what it did before by being clipped.

   NOTHING CHANGES ABOVE THIS WIDTH. The desktop keeps the frame, the panel
   and the caps exactly as they shipped. Print and the PDF export are
   untouched: both have always flattened these boxes themselves.
   ========================================================================== */
/* ==========================================================================
   THE DOCUMENT'S OWN TITLE BAR, ON A PHONE

   PRE-PRODUCTION DOCUMENT came out at 16 point on a phone while every other
   heading on the same note was inside the app's 10-to-14 point phone band.
   The regression suite had been reporting it as "1 outside" for a while and
   it had been read as a rounding complaint. It was not.

   WHY IT ESCAPED. The bar takes its size from --pp-title, the note's own
   title scale, through a rule in css/02-layout.css. The phone band is not a
   stylesheet -- it cannot be, for the reasons set out at the top of
   js/49-fontfloor.js -- it is a pass that measures the page, and it runs at
   start-up and then watches for elements being ADDED. This bar is neither.
   It is part of default.php from the start, so it is never "added"; and
   when the pass runs at start-up, before the note has ever been opened, it
   genuinely measures inside the band and is correctly left alone. It only
   grows once the note is opened and the head card's styling reaches it, and
   by then nothing is measuring.

   WHY THIS IS A RULE AND NOT ANOTHER PASS. Re-running the measuring pass
   after the note draws was tried first and it is the wrong answer: the pass
   clears every correction it has made before re-measuring, and in landscape
   three small buttons came back at their raw size and never got raised
   again. One fault became three. The pass is right; it simply has to be
   told the truth about this bar at the start. Capping the bar here means it
   measures inside the band at start-up AND stays there, so the pass has
   nothing to correct and nothing to undo.

   11pt is .section-bar-light's own declared size, and lands beside the
   crew headings on the same screen rather than above them.
   ========================================================================== */
@media screen and (max-width: 760px),
       screen and (max-height: 500px) and (max-width: 1000px) {
  /* Three classes, to beat `.document-grid .section-bar-light` (two) which
     carries !important of its own. This file is read after the one that
     holds that rule, so equal weight would have been enough -- but the
     extra class says plainly that this is the narrower case winning. */
  .document-grid .pp-head-card .ws-doc-badge { font-size: 11pt !important; }
}

@media screen and (max-width: 760px),
       screen and (max-height: 500px) and (max-width: 1000px) {

  #editor-screen {
    height: auto;
    min-height: 100vh;
    overflow: visible;
  }
  .split-view { overflow: visible; }
  .main-wrap {
    overflow: visible;
    min-width: 0;              /* see the note above -- this one matters */
  }

  /* The caps come off, on the note only. A table elsewhere in the app that
     scrolls inside a dialog is a different question and is left alone. */
  #ws-prepro .crew-tbl-wrap,
  #ws-prepro .pp-scroll,
  #ws-prepro .xp-tbl-container {
    max-height: none;
    overflow-y: visible;
  }
}


/* ==========================================================================
   AND THE TOP BAR FOLDS AWAY BEHIND ☰

   "When on a smartphone especially one that is less than 7 inches tall;
    collapse the top menu into a togglable / expandable hamburger button."

   The bar is not hidden and rebuilt somewhere else: the buttons that are
   already on it are hidden, and the ☰ shows them again. One New Speaker
   button in the document, keeping its own handler, at every width.

   THE SAME PHONE TEST as the block above, and the one the note's tables and
   the phone ordering already use. It is written out in js/81-tbmenu.js as
   well, in XP_TB_PHONE, because the script has to know when the ☰ is on
   screen; the two have to be changed together.

   WHAT STAYS VISIBLE. The wordmark, the mode badge beside it -- which is
   the one thing on this bar you need to be able to read without pressing
   anything -- and the ☰. Everything else waits.

   The who-is-signed-in chip is not in these rules because it is already
   gone: a rule in css/07-modes.css has hidden .xp-who below 900px since
   long before this. Hiding it again here would have read as this block's
   doing, and somebody looking for why it was missing would have found the
   wrong answer.
   ========================================================================== */
@media screen and (max-width: 760px),
       screen and (max-height: 500px) and (max-width: 1000px) {

  /* The button is in the page at every width; this is where it appears.

     Every selector here is `.toolbar .tb-burger` rather than `.tb-burger`,
     for the same reason as the note at the foot of this file:
     css/03-chrome.css styles the buttons on this bar as `.toolbar-left
     .btn`, two classes, and the first draft of this block was one. The ☰
     came out 104px wide with a 50%-of-the-row flex basis, which is right
     for Save and wrong for a menu button. */
  .toolbar .tb-burger {
    display: flex !important;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    flex: 0 0 auto;
    width: auto;
    min-width: 56px;
    min-height: 46px;          /* a thumb, not a cursor */
    padding: 6px 10px;
    font-size: 17px;
    line-height: 1.05;
  }
  .toolbar .tb-burger .tb-burger-lbl {
    font-size: 9.5px;
    font-weight: 700;
    letter-spacing: .2px;
  }

  /* THE ☰ SITS BESIDE THE WORDMARK, NOT UNDER IT.

     .toolbar-left wraps on a phone, which is what lets the buttons stack
     when the menu is open. Folded, that same wrapping put the ☰ on a line
     of its own under CURATOR -- two rows to show one button, which saves
     nothing and looks like a mistake. Folded there is only one row to make,
     so it is told not to wrap, and the wordmark is allowed to shrink (a
     flex item will not go below its content width without this) so the ☰
     has somewhere to be. */
  body:not(.tb-menu-open) .toolbar-left { flex-wrap: nowrap; }
  .toolbar-left .toolbar-title-box { flex: 1 1 auto !important; min-width: 0; }

  /* FOLDED. The right-hand block of buttons and the left-hand ones both
     wait behind the ☰. */
  body:not(.tb-menu-open) .toolbar-right,
  body:not(.tb-menu-open) .toolbar-left .tb-btn {
    display: none !important;
  }

  /* THE WORDS COME BACK, IN LANDSCAPE TOO.

     css/03-chrome.css brings every label back below 768px, and says plainly
     why: there is no tooltip on a touch screen, so an icon with its word
     taken away is an icon nobody can identify without pressing it to find
     out. A phone on its side is 844 wide and never reached that block, so
     the menu opened on six unlabelled glyphs -- which is the same mistake
     in the one place it had not been noticed. Same treatment, same reason.
     Folded, these buttons are hidden anyway by the !important above. */
  .toolbar-right .tb-lbl,
  .toolbar-left .tb-lbl,
  .toolbar-right .btn-add-speaker .tb-lbl {
    display: block;
    font-size: 9.5px;
    font-weight: 700;
    line-height: 1.15;
    letter-spacing: .2px;
    white-space: normal;
    text-align: center;
  }
  .toolbar-right .tb-btn,
  .toolbar-left .tb-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    padding: 7px 6px;
    min-height: 46px;
    font-size: 15px;
    line-height: 1.1;
    border-radius: 7px;
  }

  /* OPEN. The bar drops down underneath the wordmark in the rows it already
     knows how to make -- nothing here re-styles the buttons, it only lets
     them through. */
  body.tb-menu-open .toolbar-left { flex-wrap: wrap; row-gap: 8px; }
  body.tb-menu-open .tb-burger {
    border-color: var(--brand);
    color: var(--brand);
  }
}

/* No ☰ on paper, and none in the PDF export: the bar is not printed at all,
   and a menu button in a filed document would be a button nobody can press. */
@media print { .tb-burger { display: none !important; } }
.pdf-exp .tb-burger { display: none !important; }

/* Off a phone it is not there at all.

   Written as `.toolbar .tb-burger` and not `.tb-burger`, which is what it
   said first and which did not work on an iPad. css/03-chrome.css turns
   every button on this bar into an icon-over-a-word block below 768px with
   `.toolbar .btn { display: flex }` -- two classes, where a bare
   `.tb-burger` is one -- so the plain version lost the argument and an iPad
   held upright got a menu button it has no use for. Two classes to two
   classes, and this file is read last, so this one wins. The phone block
   above carries !important and is unaffected either way. */
.toolbar .tb-burger { display: none; }
