/* Photos-to-PDF tool. Every rule is scoped to .pv-image-pdf and reads the site theme tokens
   (light palette from the original styles, dark values from site.css on html[data-theme] or
   prefers-color-scheme), so theme switches need no script; fallbacks only apply outside the site.
   One column first; from 60rem the photo list, order and settings (with create, cancel, reset,
   progress and errors) sit in the left column and the PDF result and download in the right one
   (TOOL_UI_DENSITY_SPEC §3.6); DOM order is unchanged.
   Controls are at least 44 × 44 CSS px, focus is a 3px ring with a page-coloured halo, and
   disabled controls use the readable disabled tokens instead of fading. */

.pv-image-pdf { color: var(--text, #1b1f24); }
.pv-image-pdf [hidden] { display: none !important; }

.pv-image-pdf__heading { margin: 0 0 0.25rem; color: var(--muted, #5b6472); font-size: 1.0625rem; line-height: 1.35; }
.pv-image-pdf__intro { max-width: 48rem; margin: 0 0 0.5rem; }
.pv-image-pdf__notes {
  max-width: 60rem;
  margin: 0 0 1.25rem;
  padding-left: 1.25rem;
  color: var(--muted, #5b6472);
  font-size: 0.9375rem;
}
.pv-image-pdf__notes li { margin: 0 0 0.25rem; }

.pv-image-pdf__layout { display: grid; gap: 1rem; }
.pv-image-pdf__panel {
  min-width: 0;
  padding: 1rem;
  border: 1px solid var(--line, #d5dae0);
  border-radius: 0.75rem;
  background: var(--panel, #ffffff);
}
.pv-image-pdf__panel--result { border-color: var(--pv-result-line, #9db6df); }
.pv-image-pdf__panel-heading { margin: 0 0 0.75rem; font-size: 1.125rem; line-height: 1.35; word-break: keep-all; }

.pv-image-pdf__help { max-width: 48rem; margin: 0.5rem 0; color: var(--muted, #5b6472); font-size: 0.9375rem; }
.pv-image-pdf__actions { display: flex; flex-wrap: wrap; gap: 0.5rem; margin: 0.75rem 0; }

.pv-image-pdf__button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2.75rem;
  min-width: 2.75rem;
  margin: 0;
  padding: 0.5rem 1.125rem;
  border: 1px solid var(--accent, #1f5fbf);
  border-radius: 0.5rem;
  background: var(--panel, #ffffff);
  color: var(--accent-dark, #174a96);
  font: inherit;
  font-weight: 600;
  line-height: 1.3;
  text-align: center;
  word-break: keep-all;
  cursor: pointer;
  touch-action: manipulation;
}
.pv-image-pdf__button:hover { border-color: var(--accent-dark, #174a96); background: var(--pv-soft, #eaf1fb); }
.pv-image-pdf__button--primary { background: var(--accent, #1f5fbf); color: var(--pv-on-primary, #ffffff); }
.pv-image-pdf__button--primary:hover { background: var(--accent-dark, #174a96); color: var(--pv-on-primary, #ffffff); }
.pv-image-pdf__button--small { padding: 0.375rem 0.75rem; font-size: 0.9375rem; }
.pv-image-pdf__button:disabled,
.pv-image-pdf__button:disabled:hover {
  border-color: var(--pv-disabled-line, #c9d0d9);
  background: var(--pv-disabled-bg, #e9edf2);
  color: var(--pv-disabled-text, #5b6472);
  cursor: not-allowed;
}

.pv-image-pdf button:focus-visible,
.pv-image-pdf input:focus-visible {
  outline: 3px solid var(--pv-focus, #1b1f24);
  outline-offset: 2px;
  box-shadow: 0 0 0 5px var(--pv-halo, #ffffff);
}

/* Photo list: a numbered text list only (no thumbnails). */
.pv-image-pdf__empty {
  margin: 0.75rem 0 0;
  padding: 0.75rem;
  border: 1px dashed var(--line, #d5dae0);
  border-radius: 0.5rem;
  background: var(--pv-sunken, #f6f8fa);
  color: var(--muted, #5b6472);
}
.pv-image-pdf__list { display: grid; gap: 0.5rem; margin: 0.75rem 0 0; padding: 0; list-style: none; }
.pv-image-pdf__row {
  display: grid;
  gap: 0.25rem 0.75rem;
  padding: 0.625rem 0.75rem;
  border: 1px solid var(--line, #d5dae0);
  border-radius: 0.5rem;
  background: var(--pv-sunken, #f6f8fa);
}
.pv-image-pdf__row[data-status="invalid"],
.pv-image-pdf__row[data-failed="true"] {
  border: 2px solid var(--danger, #b42318);
  background: var(--pv-error-bg, #fdf1f0);
}
.pv-image-pdf__row-main { display: flex; gap: 0.5rem; min-width: 0; font-weight: 600; }
.pv-image-pdf__row-number { flex: 0 0 auto; }
.pv-image-pdf__row-name { min-width: 0; overflow-wrap: anywhere; }
.pv-image-pdf__row-meta { display: flex; flex-wrap: wrap; gap: 0 1rem; color: var(--muted, #5b6472); font-size: 0.9375rem; }
.pv-image-pdf__row[data-status="invalid"] .pv-image-pdf__row-status { color: var(--danger, #b42318); font-weight: 600; }
.pv-image-pdf__row-actions { display: flex; flex-wrap: wrap; gap: 0.375rem; }

/* Orientation: native radios, the whole label row is a 44px target. */
.pv-image-pdf__orientation { margin: 0; padding: 0; border: 0; }
.pv-image-pdf__orientation legend { margin-bottom: 0.5rem; padding: 0; font-weight: 600; }
.pv-image-pdf__choice { display: inline-flex; align-items: center; gap: 0.5rem; min-height: 2.75rem; margin-right: 1.25rem; }
.pv-image-pdf__choice input { width: 1.25rem; height: 1.25rem; margin: 0; accent-color: var(--accent, #1f5fbf); }
.pv-image-pdf__choice label { padding: 0.5rem 0; cursor: pointer; }

/* Status, alerts and the result summary. */
.pv-image-pdf__status:empty,
.pv-image-pdf__alert:empty { margin: 0; }
.pv-image-pdf__status:not(:empty) {
  margin: 0.75rem 0 0;
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--pv-info-line, #c6d7f0);
  border-radius: 0.5rem;
  background: var(--pv-info-bg, #eef4fc);
}
.pv-image-pdf__alert:not(:empty) {
  margin: 0.75rem 0 0;
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--danger, #b42318);
  border-radius: 0.5rem;
  background: var(--pv-error-bg, #fdf1f0);
  color: var(--danger, #b42318);
  font-weight: 600;
}
.pv-image-pdf__alert p { margin: 0; }
.pv-image-pdf__alert p + p { margin-top: 0.25rem; }
.pv-image-pdf__summary { margin: 0 0 0.5rem; font-weight: 600; overflow-wrap: anywhere; }

/* Order announcements are for screen readers; the list itself shows the change. */
.pv-image-pdf__announce {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

@media (min-width: 40rem) {
  .pv-image-pdf__row { grid-template-columns: minmax(0, 1fr) auto; align-items: center; }
  .pv-image-pdf__row-actions { grid-column: 2; grid-row: 1 / span 2; }
}

@media (min-width: 48rem) {
  .pv-image-pdf__panel { padding: 1.25rem; }
  .pv-image-pdf__layout { gap: 1.5rem; }
}

@media (min-width: 60rem) {
  .pv-image-pdf__layout {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    grid-template-rows: auto 1fr;
    grid-template-areas:
      "photos result"
      "settings result";
    align-items: start;
  }
  .pv-image-pdf__panel--photos { grid-area: photos; }
  .pv-image-pdf__panel--settings { grid-area: settings; }
  .pv-image-pdf__panel--result { grid-area: result; }
}
