/* Pressday editor — layout on top of Modest UI 2. Modest UI lives in the
   `mdst-ui` cascade layer and this file is unlayered, so it always wins. */

:root {
  --mdst-color-fg: #161616;
  --mdst-color-bg: #f7f7f6;
  --mdst-color-border: #c9c9c4;
  --mdst-color-muted: #5f5f5a;
  --mdst-color-subtle: #ececea;
  --mdst-color-focus: #1d4ed8;
  --mdst-radius: 6px;
  /* Larger than usual: the editor is used by people who'd rather not squint. */
  font-size: 112.5%;
  --panel: 22rem;
}

body {
  margin: 0;
  background: var(--mdst-color-bg);
}

/* The Pressday nameplate, as on pressday.app: Literata, bold, over a thick rule. */
@font-face { font-family: "Literata"; src: url("../fonts/Literata-Bold.ttf"); font-weight: 700; font-display: swap; }

.nameplate {
  font-family: "Literata", Georgia, serif;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: -0.03em;
  line-height: 1;
  margin: 0;
}

/* The press block: a black square with a white P, as in the favicon. */
.press-block {
  display: inline-grid;
  place-items: center;
  width: 1.6em;
  height: 1.6em;
  background: var(--mdst-color-fg);
  color: var(--mdst-color-bg);
  font-family: "Literata", Georgia, serif;
  font-weight: 700;
  line-height: 1;
  flex: none;
}

/* ------------------------------------------------------------ Issue list -- */

.home {
  max-width: 48rem;
  margin: 0 auto;
  padding: 2.5rem 1.5rem;
}

.home .nameplate {
  font-size: clamp(2.5rem, 9vw, 4.5rem);
  padding-block-end: 0.5rem;
  border-block-end: 4px solid var(--mdst-color-fg);
  margin-block-end: 1rem;
}

.home h2 {
  font-size: 1.35rem;
  margin: 2rem 0 0.75rem;
}

.home-note {
  margin-block-end: 0.75rem;
}

.issue-list {
  list-style: none;
  padding: 0;
  display: grid;
  gap: 0.75rem;
}

.issue-list li {
  position: relative;
}

/* On the card's top right; the card itself opens the issue. */
.card-actions {
  position: absolute;
  top: 0.6rem;
  right: 0.6rem;
  z-index: 1;
  display: flex;
  gap: 0.4rem;
}

/* A phone: the buttons go under the card, not over its title. */
@media (max-width: 600px) {
  .issue-list li {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
  }

  .card-actions {
    position: static;
    order: 1;
    flex-wrap: wrap;
  }

  .issue-list .duplicate {
    order: 2;
  }
}

.copy-note {
  font-size: 0.85rem;
  color: var(--mdst-color-muted);
  margin-block-start: 0.2rem;
}

.copy-note--due {
  color: var(--mdst-color-warning);
}

.duplicate {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 0.75rem;
  align-items: end;
  padding: 0.75rem 0 0.25rem;
}

.issue-list a {
  display: block;
  color: inherit;
  text-decoration: none;
}

.issue-list .mdst-card__body {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: baseline;
}

/* The other ways to start; the zip's file picker looks like the button it is. */
.import {
  display: grid;
  justify-items: start;
  gap: 0.5rem;
  margin-block-end: 1.25rem;
}

.import-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.new-issue {
  display: grid;
  gap: 0.75rem;
  max-width: 28rem;
}

.field {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 0.25rem;
}

.field-label {
  font-weight: 600;
}

.hint {
  color: var(--mdst-color-muted);
}

/* ---------------------------------------------------------------- Editor -- */

/* The editor fills the window and never scrolls itself: only its panels and the
   page do, like an app's. Fixed to the window, so a tablet's toolbars can't shift it. */
.editor {
  position: fixed;
  inset: 0;
  display: grid;
  grid-template-rows: auto 1fr;
  overflow: hidden;
}

.topbar {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.6rem 1rem;
  border-block-end: 1px solid var(--mdst-color-border);
  background: #fff;
}

.topbar .back {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  color: inherit;
  text-decoration: none;
  font-weight: 600;
}

.topbar .back:hover .back-label,
.topbar .back:focus-visible .back-label {
  text-decoration: underline;
}

.topbar h1 {
  font-size: 1.15rem;
  margin: 0;
  flex: 1;
}

.history {
  display: flex;
  gap: 0.15rem;
}

.history .icon-button:disabled {
  opacity: 0.35;
}

.save-status {
  color: var(--mdst-color-muted);
  font-size: 0.9rem;
}

.save-status[data-state="error"] {
  color: var(--mdst-color-danger);
  font-weight: 600;
}

/* Pages | the page | editing panel. Either side can be tucked away. */
.workspace {
  --pages-width: 16rem;
  --panel-width: var(--panel);
  display: grid;
  grid-template-columns: var(--pages-width) minmax(0, 1fr) var(--panel-width);
  grid-template-areas: "pages centre panel";
  min-height: 0;
  position: relative;
}

.workspace[data-pages="closed"] { --pages-width: 0px; }
.workspace[data-panel="closed"] { --panel-width: 0px; }
.workspace[data-pages="closed"] > .sidebar,
.workspace[data-panel="closed"] > .panel { visibility: hidden; }

.workspace > .sidebar { grid-area: pages; }
.workspace > .centre { grid-area: centre; }
.workspace > .panel { grid-area: panel; }

.workspace > * {
  min-height: 0;
  overflow: auto;
}

.scrim { display: none; }

/* The sidebar toggles, at either end of the bar above the page. */
.toggle {
  display: inline-grid;
  place-items: center;
  color: var(--mdst-color-muted);
}

.toggle[aria-expanded="true"] {
  color: var(--mdst-color-fg);
}

.preview-tools > .toggle-pages { margin-inline-end: auto; }
.preview-tools > .toggle-panel { margin-inline-start: auto; }

/* A tablet or a phone: the sidebars are drawers over the page (the width is
   DRAWERS in ui/sidebars.ts: keep the two in step). */
@media (max-width: 1100px) {
  .workspace {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas: "centre";
  }

  .workspace > .sidebar,
  .workspace > .panel {
    position: absolute;
    inset-block: 0;
    z-index: 5;
    visibility: visible;
    box-shadow: 0 0 24px rgb(0 0 0 / 0.2);
    transition: transform 0.2s ease;
  }

  .workspace > .sidebar {
    inset-inline-start: 0;
    width: min(18rem, 85vw);
    transform: translateX(-105%);
  }

  .workspace > .panel {
    inset-inline-end: 0;
    width: min(26rem, 100vw);
    transform: translateX(105%);
  }

  .workspace[data-pages="open"] > .sidebar,
  .workspace[data-panel="open"] > .panel {
    transform: none;
  }

  .workspace[data-pages="open"] > .scrim,
  .workspace[data-panel="open"] > .scrim {
    display: block;
    position: absolute;
    inset: 0;
    z-index: 4;
    background: rgb(0 0 0 / 0.15);
  }
}

@media (max-width: 640px) {
  .workspace > .sidebar,
  .workspace > .panel {
    width: 100vw;
  }

  .topbar {
    gap: 0.4rem;
    padding: 0.4rem 0.5rem;
    flex-wrap: wrap;
  }

  /* On a phone, the press block alone leads back to the issues. */
  .topbar .back-label,
  .save-status:not([data-state="error"]) {
    display: none;
  }

  .topbar h1 {
    font-size: 1rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 0;
  }
}


.sidebar,
.panel {
  padding: 1rem;
  background: #fff;
}

.sidebar {
  border-inline-end: 1px solid var(--mdst-color-border);
}

.panel {
  border-inline-start: 1px solid var(--mdst-color-border);
}

.sidebar h2,
.panel h2 {
  font-size: 1rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin: 0 0 0.6rem;
}

/* Headings after other content get room above them. */
.sidebar * + h2,
.panel * + h2 {
  margin-block-start: 1.5rem;
}

.centre {
  display: grid;
  grid-template-rows: auto 1fr;
  min-height: 0;
}

.preview-tools {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.25rem;
  padding: 0.25rem;
  border-block-end: 1px solid var(--mdst-color-border);
  background: #fff;
}

/* Icon buttons in the bar above the page: dim when off. */
.guides-toggle,
.greyscale-toggle {
  display: inline-grid;
  place-items: center;
  color: var(--mdst-color-muted);
}

.guides-toggle[aria-pressed="true"],
.greyscale-toggle[aria-pressed="true"] {
  background: var(--mdst-color-subtle);
  color: var(--mdst-color-fg);
}

.zoom-label {
  min-width: 6.5rem;
  text-align: center;
  font-variant-numeric: tabular-nums;
  color: var(--mdst-color-muted);
}

.preview-wrap {
  position: relative;
  overflow: hidden;
}

.preview {
  position: absolute;
  inset: 0;
  border: 0;
  width: 100%;
  height: 100%;
}

/* The preview being prepared keeps its size (it measures itself) but stays out of
   sight, underneath and transparent. Not visibility: hidden, because Chrome throttles
   hidden frames and the update would lag. */
.preview[data-state="shown"] {
  z-index: 1;
}

.preview[data-state="hidden"] {
  z-index: 0;
  opacity: 0;
  pointer-events: none;
}

/* Page list */

.pages {
  list-style: none;
  padding: 0;
  margin: 0 0 1rem;
  display: grid;
  gap: 0.35rem;
}

.pages li {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 0.25rem;
  border: 1px solid var(--mdst-color-border);
  border-radius: var(--mdst-radius);
  background: #fff;
}

/* The page you're on: a thick black border, always, so it's plain in the list. */
.pages li[aria-current="true"] {
  border-color: var(--mdst-color-fg);
  box-shadow: 0 0 0 2px var(--mdst-color-fg);
}

/* The page's layout in miniature, then its number, layout, and what's on it. */
.page-pick {
  all: unset;
  cursor: pointer;
  padding: 0.45rem 0.6rem;
  display: grid;
  grid-template-columns: 1.7rem minmax(0, 1fr);
  column-gap: 0.6rem;
  row-gap: 0.1rem;
  align-items: center;
  min-width: 0;
}

.page-pick .diagram {
  grid-row: span 2;
  width: 1.7rem;
  height: auto;
}

.page-pick strong,
.page-pick span {
  grid-column: 2;
}

.page-pick:focus-visible {
  outline: 2px solid var(--mdst-color-focus);
  outline-offset: -2px;
}

.page-pick strong {
  font-size: 0.95rem;
}

.page-pick span {
  font-size: 0.8rem;
  color: var(--mdst-color-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.page-moves {
  display: flex;
  flex-direction: column;
  padding-inline-end: 0.25rem;
}

.page-moves button {
  padding: 0 0.4rem;
  line-height: 1.3;
}

/* Checks */

.checks {
  list-style: none;
  padding: 0;
  display: grid;
  gap: 0.4rem;
  font-size: 0.9rem;
}

.checks button {
  all: unset;
  cursor: pointer;
  display: block;
  padding: 0.4rem 0.5rem;
  border-inline-start: 4px solid var(--mdst-color-border);
  background: var(--mdst-color-subtle);
}

.checks [data-level="problem"] button {
  border-color: var(--mdst-color-danger);
}

.checks [data-level="warning"] button {
  border-color: var(--mdst-color-warning);
}

.checks button:focus-visible {
  outline: 2px solid var(--mdst-color-focus);
}

/* Panel */

.panel form,
.panel section {
  display: grid;
  /* minmax(0, …): let long rows shrink to the panel instead of widening it. */
  grid-template-columns: minmax(0, 1fr);
  gap: 0.8rem;
}

.panel textarea {
  min-height: 7rem;
  resize: vertical;
}

.block {
  border: 1px solid var(--mdst-color-border);
  border-radius: var(--mdst-radius);
  padding: 0.6rem;
  display: grid;
  gap: 0.4rem;
}

.block-tools {
  display: flex;
  gap: 0.3rem;
  align-items: center;
}

.block-tools select {
  flex: 1;
  min-width: 7.5rem;
}

.block-tools .mdst-button--sm {
  padding-inline: 0.45rem;
}

.row {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  align-items: center;
}

.count {
  font-weight: 600;
}

.count[data-state="over"] {
  color: var(--mdst-color-danger);
}

.gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(5.5rem, 1fr));
  gap: 0.5rem;
}

.gallery label {
  display: grid;
  gap: 0.2rem;
  font-size: 0.8rem;
  cursor: pointer;
}

.gallery img {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border: 2px solid transparent;
  border-radius: 4px;
  background: var(--mdst-color-subtle);
}

.gallery input:checked + img {
  border-color: var(--mdst-color-focus);
}

.gallery input {
  position: absolute;
  opacity: 0;
}

.gallery label:has(input:focus-visible) img {
  outline: 2px solid var(--mdst-color-focus);
  outline-offset: 2px;
}

.exports {
  display: grid;
  gap: 0.5rem;
}

.export-button {
  display: grid;
  justify-items: start;
  justify-content: stretch;
  gap: 0.15rem;
  width: 100%;
  text-align: start;
}

.empty-note {
  color: var(--mdst-color-muted);
}

/* ------------------------------------------------------------- Shared -- */

.spaced {
  margin-block-start: 1.5rem;
}

.panel h3 {
  font-size: 1rem;
  margin: 0.5rem 0 0;
}

.check {
  display: flex;
  gap: 0.5rem;
  align-items: flex-start;
  font-weight: 400;
}

.check input {
  margin-block-start: 0.3rem;
  flex: none;
}

/* A note under something, such as a photo's permission. */
.check--small {
  gap: 0.45rem;
  font-size: 0.85rem;
  line-height: 1.3;
}

.check--small input {
  margin-block-start: 0.15em;
}

.more {
  display: grid;
  gap: 0.8rem;
  padding-block-start: 0.6rem;
}

/* Straight under its summary: the general space between blocks doesn't apply. */
details > .more {
  margin-block-start: 0;
}

.word-count {
  margin: 0;
}

/* Drag to reorder: a handle, and a line where the item will land. */

.grip {
  cursor: grab;
  color: var(--mdst-color-muted);
  padding-inline: 0.35rem;
  user-select: none;
  letter-spacing: -0.2em;
}

[draggable="true"].dragging {
  opacity: 0.4;
}

.drop-before {
  box-shadow: 0 -3px 0 var(--mdst-color-focus) !important;
}

.drop-after {
  box-shadow: 0 3px 0 var(--mdst-color-focus) !important;
}

/* ---------------------------------------------------------- Page panel -- */

.slot-buttons {
  display: grid;
  gap: 0.4rem;
  margin-block-end: 0.5rem;
}

.held {
  margin-block: 0.75rem;
  font-size: 0.9rem;
}

.add-page {
  width: 100%;
  margin-block-end: 1.5rem;
}

.slot-button {
  justify-content: flex-start;
  width: 100%;
}

.layouts {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.5rem;
}

.layout {
  position: relative;
  display: grid;
  justify-items: center;
  gap: 0.3rem;
  padding: 0.4rem;
  border: 1px solid var(--mdst-color-border);
  border-radius: var(--mdst-radius);
  background: #fff;
  font-size: 0.8rem;
  font-weight: 400;
  line-height: 1.2;
  text-align: center;
  cursor: pointer;
}

.layout input {
  position: absolute;
  opacity: 0;
}

.layout:has(input:checked) {
  border-color: var(--mdst-color-focus);
  box-shadow: 0 0 0 2px var(--mdst-color-focus);
}

.layout:has(input:focus-visible) {
  outline: 2px solid var(--mdst-color-focus);
  outline-offset: 2px;
}

.diagram {
  width: 100%;
  max-width: 4.5rem;
  height: auto;
}

.diagram .sheet {
  fill: #fff;
  stroke: #9a9a95;
}

.diagram .ink {
  fill: #2b2b2b;
}

.diagram .line {
  fill: #b9b9b4;
}

.diagram .picture {
  fill: #c9d3dd;
}

.diagram .advert {
  fill: #fff;
  stroke: #6f6f6a;
  stroke-width: 0.6;
}

/* ------------------------------------------------------------- Stories -- */

.blocks {
  list-style: none;
  padding: 0;
  margin: 0.5rem 0;
  display: grid;
  gap: 0.5rem;
}

/* ------------------------------------------------------------ Pictures -- */

/* One card per photo: a preview the shape of its space, and how it sits. */
.photo-cards {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 0.75rem;
}

.photo-card {
  display: grid;
  grid-template-columns: minmax(0, 9rem) minmax(0, 1fr);
  gap: 0.75rem;
  align-items: start;
  padding: 0.5rem;
  border: 1px solid var(--mdst-color-border);
  border-radius: 6px;
  background: var(--mdst-color-surface, #fff);
}

.photo-card.drop-before { box-shadow: 0 -3px 0 var(--mdst-color-focus); }
.photo-card.drop-after { box-shadow: 0 3px 0 var(--mdst-color-focus); }

/* Paper behind the picture, so "show it whole" looks as it will print. */
.crop-preview {
  background: #fff;
  outline: 1px solid var(--mdst-color-border);
  overflow: hidden;
}

.crop-preview img {
  display: block;
  width: 100%;
  height: 100%;
  cursor: grab;
  touch-action: none;
}

.crop-preview img:active { cursor: grabbing; }
.crop-preview img:focus-visible { outline: 2px solid var(--mdst-color-focus); outline-offset: 2px; }

.photo-controls {
  display: grid;
  gap: 0.4rem;
  justify-items: start;
}

/* <pd-choice> as a joined row of small buttons, the chosen one pressed. */
.segmented {
  display: inline-flex;
  flex-wrap: wrap;
}

.segmented button {
  font-size: 0.8rem;
  padding: 0.15rem 0.6rem;
  min-height: 0;
  border-radius: 0;
}

.segmented button:first-child { border-radius: 4px 0 0 4px; }
.segmented button:last-child { border-radius: 0 4px 4px 0; margin-inline-start: -1px; }

.segmented button[aria-pressed="true"] {
  background: var(--mdst-color-focus);
  border-color: var(--mdst-color-focus);
  color: #fff;
}

.photo-order {
  display: flex;
  gap: 0.25rem;
}

.upload {
  display: grid;
  gap: 0.6rem;
  padding-block-start: 0.6rem;
}

/* ------------------------------------------------------------- Adverts -- */

.advert-list {
  list-style: none;
  padding: 0;
  margin: 0.4rem 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 0.3rem;
}

/* Adverts to add can be many: they scroll in a box of their own. */
.advert-list--choices {
  max-height: 22rem;
  overflow: auto;
}

.advert-list li {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.35rem 0.5rem;
  border: 1px solid var(--mdst-color-border);
  border-radius: var(--mdst-radius);
  background: #fff;
}

.advert-list .name {
  flex: 1;
  min-width: 0;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* The advertiser's name opens its details, under it. */
.advert-list li { flex-wrap: wrap; }

.advert-list button.name {
  display: block;
  padding: 0;
  border: 0;
  background: none;
  font: inherit;
  font-weight: 600;
  color: inherit;
  text-align: start;
  cursor: pointer;
}

.advert-list button.name:hover {
  text-decoration: underline;
}

.advert-editor {
  flex-basis: 100%;
  display: grid;
  gap: 0.6rem;
  padding: 0.5rem 0 0.25rem;
}

.advert-editor textarea {
  width: 100%;
  resize: vertical;
}

.advert-artwork {
  display: grid;
  gap: 0.5rem;
}

.advert-artwork img {
  max-width: 100%;
  max-height: 8rem;
  object-fit: contain;
  justify-self: start;
  border: 1px solid var(--mdst-color-border);
}

.upload-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  align-items: center;
}

.new-advert {
  margin-block-start: 0.5rem;
}

.advert-list .size {
  font-size: 0.75rem;
  color: var(--mdst-color-muted);
  border: 1px solid var(--mdst-color-border);
  border-radius: 999px;
  padding: 0 0.45rem;
}

.advert-list .where {
  font-size: 0.75rem;
  color: var(--mdst-color-muted);
  white-space: nowrap;
}

.advert-list li[hidden] {
  display: none;
}

/* Space + drag: covers the preview while Space is held (focus outside the preview). */
.pan-layer {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: none;
  cursor: grab;
}

.pan-layer[data-state="on"],
.pan-layer[data-state="grabbing"] {
  display: block;
}

.pan-layer[data-state="grabbing"] {
  cursor: grabbing;
}

/* Pictures to put in the text: click for the cursor's place, or drag to a spot. */

.picture-strip {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(4.5rem, 1fr));
  gap: 0.4rem;
}

.picture-strip img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: 4px;
  cursor: grab;
  outline: 1px solid var(--mdst-color-border, #ccc);
  /* Held on a touch screen to drag: no "save image" menu, no text selection. */
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
}

.picture-strip img:hover,
.picture-strip img:focus-visible {
  outline: 2px solid var(--mdst-color-accent, #1d4ed8);
}

.drag-ghost {
  position: fixed;
  top: 0;
  left: 0;
  width: 5rem;
  height: 5rem;
  object-fit: cover;
  border-radius: 4px;
  opacity: 0.85;
  pointer-events: none;
  z-index: 100;
  box-shadow: 0 4px 14px rgb(0 0 0 / 0.25);
}

.drag-shield {
  position: fixed;
  inset: 0;
  z-index: 99;
  cursor: grabbing;
}

/* Out of sight, but still there for keyboards and screen readers. */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

/* <pd-file-picker>: the label is the button; its file input is hidden inside. */
pd-file-picker label {
  position: relative;
  cursor: pointer;
}

pd-file-picker label:has(input:focus-visible) {
  outline: 2px solid var(--mdst-color-focus);
  outline-offset: 2px;
}

/* An advert the page has no room for. */
.advert-list li[data-state="over"] {
  border-color: var(--mdst-color-danger, #b42318);
}

.size.over {
  background: var(--mdst-color-danger, #b42318);
  border-color: var(--mdst-color-danger, #b42318);
  color: #fff;
}

/* Write a new piece, or pick one that isn't on a page yet. */
.piece-picker {
  display: grid;
  gap: 1rem;
  justify-items: start;
}

.piece-picker h3 {
  font-size: 0.9rem;
  margin: 0 0 0.4rem;
}

.piece-choices {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

/* Making a layout: the page as areas to click, and what to do with the one chosen. */
.maker {
  display: grid;
  gap: 0.75rem;
}

/* The page on top, the tools for the chosen area underneath, full width. */
.maker-body {
  display: grid;
  gap: 0.9rem;
}

.maker-page {
  position: relative;
  width: min(100%, 13rem);
  justify-self: center;
  background: #fff;
  outline: 1px solid var(--mdst-color-border);
}

.maker-area {
  all: unset;
  position: absolute;
  box-sizing: border-box;
  display: grid;
  place-items: center;
  border: 1px dashed #2563eb;
  background: rgb(37 99 235 / 0.06);
  font-size: 0.65rem;
  text-align: center;
  color: #1d4ed8;
  cursor: pointer;
  overflow: hidden;
}

.maker-area[aria-pressed="true"] {
  border: 2px solid #1d4ed8;
  background: rgb(37 99 235 / 0.18);
  font-weight: 600;
}

.maker-tools {
  display: grid;
  gap: 0.6rem;
}

.maker-splits,
.maker-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  align-items: center;
}

.layouts .new-layout {
  display: grid;
  place-items: center;
  align-content: center;
  gap: 0.25rem;
  cursor: pointer;
  border: 1px dashed var(--mdst-color-border);
  background: none;
  font: inherit;
}

.new-layout .plus {
  font-size: 1.6rem;
  line-height: 1;
}

.maker-tools > .mdst-button--danger {
  justify-self: start;
}

/* Every piece in the issue: open it, see where it is, or delete it. */
.pieces-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 0.15rem;
}

.pieces-list li {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-areas: "name bin" "where bin";
  align-items: center;
  padding: 0.35rem 0;
  border-block-end: 1px solid var(--mdst-color-subtle);
}

.pieces-list .name { grid-area: name; justify-self: start; text-align: start; }
.pieces-list .where { grid-area: where; font-size: 0.8rem; color: var(--mdst-color-muted); }
.pieces-list .icon-button { grid-area: bin; color: var(--mdst-color-danger); }

.icon-button {
  display: inline-grid;
  place-items: center;
}

/* A button that reads as a name: opens what it names. */
button.link {
  all: unset;
  cursor: pointer;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 100%;
}

button.link:hover { text-decoration: underline; }
button.link:focus-visible { outline: 2px solid var(--mdst-color-focus); outline-offset: 2px; }
button.link:disabled { cursor: default; font-weight: 400; color: var(--mdst-color-muted); text-decoration: none; }

/* <pd-choice> as a list of larger options (typefaces, each shown in itself). */
.choice-list {
  display: grid;
  gap: 0.3rem;
}

.choice-item {
  all: unset;
  cursor: pointer;
  padding: 0.45rem 0.7rem;
  border: 1px solid var(--mdst-color-border);
  border-radius: 6px;
  font-size: 1.05rem;
}

.choice-item:hover { background: var(--mdst-color-subtle); }
.choice-item:focus-visible { outline: 2px solid var(--mdst-color-focus); outline-offset: 2px; }
.choice-item[aria-pressed="true"] { border: 2px solid var(--mdst-color-fg); padding: calc(0.45rem - 1px) calc(0.7rem - 1px); }

/* Page and print setup (in the issue panel) */

.setup {
  margin-block-start: 1rem;
}

.setup-grid,
.setup-pair {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.6rem 0.75rem;
  align-items: end;
}

/* Four across where there's room; two rows of two on a phone. */
.setup-grid--four {
  grid-template-columns: repeat(auto-fit, minmax(4.5rem, 1fr));
}

.setup h3 {
  font-size: 0.95rem;
  margin: 1rem 0 0.4rem;
}

.setup input[type="number"] {
  width: 100%;
  min-width: 0;
}

.setup input[type="color"] {
  width: 3rem;
  height: 2rem;
  padding: 0;
}

.rate-card {
  list-style: none;
  padding: 0;
  margin: 0.4rem 0;
  display: grid;
  gap: 0.35rem;
}

.rate-card li {
  display: grid;
  grid-template-columns: minmax(3rem, 1fr) auto auto 2rem;
  gap: 0.5rem;
  align-items: center;
  font-size: 0.9rem;
}

.rate-span {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.rate-card input[type="number"] {
  width: 3rem;
  padding-inline: 0.3rem;
}

.add-size {
  display: flex;
  gap: 0.4rem;
}

.rate-card .hint {
  white-space: nowrap;
}

/* What to tell the printer, under the exports. */
.printer-note {
  margin-block-start: 1rem;
  padding: 0.75rem;
  border: 1px solid var(--mdst-color-border);
  font-size: 0.9rem;
}

.printer-note h3 {
  margin: 0 0 0.4rem;
  font-size: 0.95rem;
}

.printer-note ul {
  margin: 0 0 0.6rem;
  padding-inline-start: 1.1rem;
}
