/* Publish page (public/store-publish/). Built on the shared theme tokens in
   styles.css so light and dark themes both work without overrides here. */

/* Readiness */
/* Readiness: one row of compact tiles, wrapping on narrow screens. */
.pub-ready-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 8px;
}
.pub-ready-tile {
  min-width: 0;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--panel-2);
}
.pub-ready-tile.is-bad { border-color: var(--danger-border); }
.pub-ready-dot {
  flex-shrink: 0;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--ok);
}
.pub-ready-dot.bad { background: var(--danger); }
.pub-ready-head { display: flex; gap: 8px; align-items: center; }
.pub-ready-name { font-size: 14px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pub-ready-detail {
  margin-top: 2px;
  padding-left: 16px;
  color: var(--muted);
  font-size: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.pub-ready-state { margin-left: auto; flex-shrink: 0; font-size: 12px; font-weight: 600; }
.pub-ready-state.ok { color: var(--ok-fg); }
.pub-ready-state.bad { color: var(--danger-fg); }
.pub-problems { margin: 6px 0 0; padding-left: 30px; color: var(--danger-fg); font-size: 12px; overflow-wrap: anywhere; }

/* Settings form: one row per group, the group's name and purpose on the left
   and its fields on the right. Rows stack once the section is too narrow for
   the two columns; container queries track the section, not the window, since
   the sidebar takes a variable share of the width. */
.pub-form { display: flex; flex-direction: column; gap: 16px; container-type: inline-size; }
.pub-rows {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--panel-2);
}
.pub-row {
  display: grid;
  grid-template-columns: minmax(0, 220px) minmax(0, 1fr);
  gap: 16px 32px;
  padding: 20px;
}
.pub-row + .pub-row { border-top: 1px solid var(--border); }
.pub-row-head { display: flex; flex-direction: column; gap: 6px; }
.pub-row-head .hint { margin: 0; line-height: 1.5; }
.pub-row-title { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; }
.pub-row-title h3 { margin: 0; font-size: 15px; font-weight: 600; }
.pub-row-fields { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; align-content: start; }
.pub-fields-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.pub-subhead {
  grid-column: 1 / -1;
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin: 4px 0 -6px;
  padding-top: 14px;
  border-top: 1px dashed var(--border);
  font-size: 13px;
  font-weight: 600;
}
.pub-subhead .hint { font-weight: 400; }
/* A list of like fields reads faster with the labels in their own column. */
.pub-fields-inline { gap: 10px; }
.pub-fields-inline .pub-field {
  display: grid;
  grid-template-columns: 140px minmax(0, 1fr);
  align-items: center;
  gap: 6px 12px;
}
@container (max-width: 720px) {
  .pub-row { grid-template-columns: minmax(0, 1fr); }
}
@container (max-width: 480px) {
  .pub-fields-2 { grid-template-columns: minmax(0, 1fr); }
  .pub-fields-inline .pub-field { grid-template-columns: minmax(0, 1fr); }
}
/* Fields sit on the rows' --panel-2, so they take --panel to stay distinct.
   background-color only: select's chevron is a background-image. */
.pub-rows .input { background-color: var(--panel); }
.pub-field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
/* Inputs don't inherit the page font by default while selects do; one font
   keeps the text inputs and the track dropdown the same size. */
.pub-field .input { min-width: 0; flex: none; width: 100%; font: inherit; font-size: 14px; }
.pub-label { font-size: 13px; font-weight: 600; color: var(--text); }
.pub-fieldset { border: 0; margin: 0; padding: 0; min-width: 0; }
.pub-fieldset:disabled { opacity: 0.6; }
.pub-form-error {
  margin: 0;
  padding: 8px 12px;
  border-radius: 8px;
  background: var(--danger-bg);
  border: 1px solid var(--danger-border);
  color: var(--danger-fg);
  font-size: 13px;
}
.pub-save-bar {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 16px;
}
.pub-save-bar .hint.is-dirty { color: var(--warn-fg); font-weight: 600; }

/* Upload: options on the left, a summary with the checks and the upload button
   on the right, so the result of every choice is visible beside it. Stacks
   when the section is narrow. */
.pub-upload-layout {
  container-type: inline-size;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 24px;
  align-items: start;
}
@container (max-width: 860px) {
  .pub-upload-layout > * { grid-column: 1 / -1; }
}
/* Each choice is a whole-card checkbox, so the hit area is the card (well over
   44px) rather than the 18px box. */
.pub-upload-form { display: flex; flex-direction: column; gap: 24px; min-width: 0; }
.pub-legend {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0;
  margin-bottom: 10px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}
.pub-legend-row > span:first-child { display: inline-flex; align-items: center; gap: 8px; }
.pub-legend-note { color: var(--muted); font-size: 12px; font-weight: 500; }
.pub-step-num {
  display: inline-grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: color-mix(in srgb, var(--accent) 14%, var(--panel));
  color: var(--accent);
  font-size: 12px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.pub-legend-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
}
.pub-select-all {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 32px;
  padding: 0 4px;
  font-weight: 500;
  cursor: pointer;
}
.pub-option-grid {
  container-type: inline-size;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}
@container (max-width: 520px) {
  .pub-option-grid > * { grid-column: 1 / -1; }
}
.pub-option {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  min-height: 56px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--panel-2);
  cursor: pointer;
  transition: border-color var(--dur) var(--ease), background var(--dur) var(--ease);
}
.pub-option .checkbox { margin-top: 2px; }
.pub-option:hover { border-color: var(--border-hover); background: var(--panel-hover); }
.pub-option:has(.checkbox:checked) {
  border-color: color-mix(in srgb, var(--accent) 60%, var(--border));
  background: color-mix(in srgb, var(--accent) 8%, var(--panel-2));
}
.pub-option:has(.checkbox:disabled) { cursor: not-allowed; opacity: 0.55; }
.pub-option:has(.checkbox:disabled):hover { border-color: var(--border); background: var(--panel-2); }
/* The card already dims; dimming the box again would fade it out entirely. */
.pub-option .checkbox:disabled { opacity: 1; }
.pub-option-body { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.pub-option-title { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; font-size: 14px; font-weight: 600; }
.pub-option-desc { color: var(--muted); font-size: 13px; overflow-wrap: anywhere; }
.pub-tag {
  padding: 1px 8px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--panel);
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
}
.pub-fieldset-note { margin: 8px 0 0; }
@media (prefers-reduced-motion: reduce) {
  .pub-option { transition: none; }
}

/* Sticky so the checks and the button stay in view while scrolling the
   options; capped to the viewport so a long issue list stays reachable. */
.pub-summary {
  position: sticky;
  top: 16px;
  max-height: calc(100dvh - 32px);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-width: 0;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--panel-2);
}
.pub-summary-title { margin: 0; font-size: 15px; font-weight: 600; }
.pub-recap { margin: 0; display: flex; flex-direction: column; gap: 8px; }
.pub-recap-row {
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr);
  gap: 8px;
  font-size: 13px;
}
.pub-recap dt { color: var(--muted); }
.pub-recap dd { margin: 0; font-weight: 500; overflow-wrap: anywhere; }
.pub-summary-checks {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}
.pub-summary-checks:empty { display: none; }
.pub-summary-checks > p { margin: 0; }
.pub-start { width: 100%; min-height: 44px; }
@container (max-width: 860px) {
  .pub-start { align-self: flex-end; width: auto; min-width: 200px; }
}

.pub-callout {
  padding: 10px 12px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  font-size: 13px;
  line-height: 1.45;
}
.pub-callout strong { display: block; margin-bottom: 6px; }
.pub-callout-bad { background: var(--danger-bg); border-color: var(--danger-border); color: var(--danger-fg); }
.pub-callout-warn { background: var(--warn-bg); border-color: var(--warn-border); color: var(--warn-fg); }
.pub-issues { margin: 0; padding-left: 18px; display: flex; flex-direction: column; gap: 4px; overflow-wrap: anywhere; }
.pub-ready-note {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border: 1px solid var(--ok-border);
  border-radius: var(--radius);
  background: var(--ok-bg);
  color: var(--ok-fg);
  font-weight: 600;
  font-size: 13px;
}
.pub-ready-note svg { flex-shrink: 0; }

/* Status badges always carry a text label; colour only reinforces it. */
.pub-status {
  display: inline-block;
  padding: 2px 9px;
  border-radius: 999px;
  border: 1px solid var(--border);
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  vertical-align: middle;
  color: var(--muted);
  background: var(--panel-2);
}
.pub-status-info { color: var(--accent); border-color: color-mix(in srgb, var(--accent) 45%, transparent); }
.pub-status-ok { color: var(--ok-fg); background: var(--ok-bg); border-color: var(--ok-border); }
.pub-status-warn { color: var(--warn-fg); background: var(--warn-bg); border-color: var(--warn-border); }
.pub-status-bad { color: var(--danger-fg); background: var(--danger-bg); border-color: var(--danger-border); }

/* Progress */
.pub-steps { list-style: none; margin: 0 0 12px; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.pub-step { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; font-size: 14px; }
.pub-step-name { font-weight: 600; min-width: 96px; }
.pub-step-error { flex-basis: 100%; margin: 0; color: var(--danger-fg); font-size: 13px; overflow-wrap: anywhere; }
.pub-log {
  margin: 0;
  max-height: 360px;
  overflow: auto;
  padding: 12px 14px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  font: 12px/1.55 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.pub-log:empty::before { content: 'Waiting for output…'; color: var(--muted); }
.pub-log:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.pub-log-tail { max-height: 240px; margin-top: 8px; }

/* History */
.pub-history { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.pub-history-item {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--panel-2);
}
.pub-history-item summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 6px 12px;
  padding: 10px 14px;
  cursor: pointer;
  list-style: none;
  border-radius: var(--radius);
}
.pub-history-item summary::-webkit-details-marker { display: none; }
.pub-history-item summary:hover { background: var(--panel-hover); }
.pub-history-item summary:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.pub-history-main { display: inline-flex; align-items: center; flex-wrap: wrap; gap: 8px 10px; }
.pub-history-body { padding: 0 14px 14px; display: flex; flex-direction: column; gap: 12px; }
.pub-history-result { padding-top: 10px; border-top: 1px solid var(--border); }
