/* Shared parts, built once on the tokens and used on both sides: the sheet frame, buttons, menu rows,
   fields, the two-way switch, tables, number tiles, notices and empty states. A side changes how they
   look through its token values (tokens.css), not by restyling them. */

/* The sheet frame: every page that's a sheet of paper on the desk (Ready to send, Share, Team…) opens
   under a slim bar with the way back (the script's title, or All screenplays) and the menu, then the
   small line above the heading, the heading, a lede and the content. Two widths: narrow for forms,
   wide for tables. */
.sheet-bar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: var(--space-2) var(--space-4);
  padding: 0.45rem 16px;
  background: linear-gradient(var(--mahogany), var(--mahogany-deep));
  border-bottom: 2px solid #120a06;
  box-shadow: inset 0 -1px 0 var(--brass-line);
}
.producer .sheet-bar { background: var(--desk-light); border-bottom: 1px solid var(--producer-line); box-shadow: none; }
.sheet-bar__brand { color: var(--brass); font: 800 1.3rem/1 var(--font-ui); letter-spacing: -0.02em; text-decoration: none; }
.sheet-bar__back {
  display: inline-flex;
  align-items: center;
  gap: 0.4em;
  min-width: 0;
  margin-right: auto;
  padding: 0.35em 0.6em;
  border-radius: var(--radius-control);
  color: var(--chrome-muted);
  font-size: var(--text-md);
  text-decoration: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sheet-bar__back::before { content: "←"; }
.sheet-bar__back:hover { background: var(--desk-light); color: var(--chrome); }
.sheet-bar .bar-menu__button--more { display: inline-flex; padding: 0.4em; background: transparent; }
.sheet-bar .bar-menu__button--more:hover, .sheet-bar .bar-menu__button--more:has(+ :popover-open) { background: var(--desk-light); }
.sheet-bar .bar-menu[popover]:not(:popover-open) { display: none; }
/* Hangs from the ☰ button at the right. Needs [popover] to outrank the toolbar's inset reset. */
.sheet-bar .bar-menu[popover]:popover-open { top: 3rem; right: 16px; left: auto; min-width: 17rem; }

.sheet__eyebrow { margin: 0; color: var(--sheet-muted); font-size: var(--text-xs); font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; }
.sheet__eyebrow + .title-page__heading { margin-top: 0.15rem; }
.sheet__lede { margin: 0 0 var(--space-2); color: var(--sheet-soft); font-size: var(--text-base); line-height: 1.55; }
.title-page--wide { width: min(var(--sheet-wide), 100%); }

/* Buttons: primary, quiet, danger, in two sizes. On paper the primary is the side's ink. */
.button--small { padding: 0.25em 0.65em; font-size: var(--text-sm); }

/* Menu rows: one line in a menu, however it's built. */
.menu-row {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 0.5em;
  width: 100%;
  padding: 0.45em 0.75em;
  border: 0;
  border-radius: 5px;
  background: none;
  color: var(--chrome);
  font: inherit;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
}
.menu-row:is(:hover, :active) { background: var(--desk); }
/* What's inside a row whose name doesn't say, small at its far end. */
.menu-row__hint { margin-left: auto; padding-left: 1em; color: var(--chrome-muted); font-size: var(--text-xs); white-space: nowrap; }

/* Notices on paper: "look here" in amber, "all good" in green. */
.notice { margin: 0; padding: 0.75rem 1rem; border-radius: var(--radius-control); background: var(--notice); color: var(--notice-ink); }
.notice--ok { background: var(--ok); color: var(--ok-ink); }

/* Number tiles: a big number over its label. */
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(8rem, 1fr)); gap: var(--space-3); margin: var(--space-4) 0 0; }
.tile { display: flex; flex-direction: column-reverse; gap: 0.15rem; margin: 0; padding: 0.85rem 1rem; border: 1px solid var(--sheet-rule); border-radius: var(--radius-control); background: var(--field); }
.tile dt { color: var(--sheet-muted); font-size: var(--text-xs); font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; }
.tile dd { margin: 0; font: 800 var(--text-xl)/1.1 var(--font-ui); }

/* Tables on paper. */
.sheet-table { width: 100%; border-collapse: collapse; font-size: var(--text-md); }
.sheet-table :is(th, td) { padding: 0.45rem 0.5rem 0.45rem 0; border-bottom: 1px solid var(--sheet-rule); text-align: left; vertical-align: top; }
.sheet-table thead th { color: var(--sheet-muted); font-size: var(--text-xs); font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; }

/* Empty states: a readable line, then the next thing to do. */
.empty { display: grid; justify-items: center; gap: var(--space-3); max-width: 32rem; margin: var(--space-7) auto; text-align: center; }
.empty__line { margin: 0; color: var(--chrome); font: var(--text-lg)/1.5 var(--font-ui); }
.title-page .empty__line { color: var(--sheet-soft); }

/* Fingers need room: on touch screens every control and menu row is at least 44px tall. */
@media (pointer: coarse) {
  .button, .menu-row, .bar-menu:popover-open :is(a, .button, summary), .switch__option, .toolbar__tab, .sheet-bar__back { min-height: 44px; }
}
.sheet-bar .toolbar__home { display: flex; }
.sheet-bar .bar-menu__button--more { margin-left: auto; }

/* A sheet with room: on a laptop it opens out to the contest pages' width with its parts side by side; on a
   phone or a narrow window the parts stack as one sheet. Each page names its parts' places in its own CSS. */
.sheet-parts, .sheet-part { display: grid; gap: 0.6rem; align-content: start; }
@media (min-width: 64rem) {
  .title-page.title-page--roomy { width: min(76rem, 100%); padding-inline: 3rem; }
  .sheet-parts { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 1.75rem 3rem; align-items: start; }
  .sheet-parts > .sheet-part > :first-child { margin-top: 0; }
  .sheet-parts > .sheet-part--whole { grid-column: 1 / -1; }
}
