.pdf-workspace {
  height: 520px;
  min-height: 520px;
  grid-template-columns: minmax(0, 680px) minmax(420px, 1fr);
}

.pdf-workspace .tool-workspace__preview,
.pdf-workspace .tool-workspace__upload {
  height: 100%;
  min-height: 0;
}

.pdf-workspace__preview {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: var(--space-lg);
  padding: var(--space-xl);
  background:
    radial-gradient(circle at 12% 10%, var(--brand-pixpix-surface-subtle), transparent 42%),
    var(--surface-muted);
}

.pdf-preview-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-md);
}

.pdf-preview-head > div {
  min-width: 0;
}

.pdf-preview-head span {
  display: block;
  margin-bottom: var(--space-4xs);
  color: var(--text-tertiary);
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-medium);
  line-height: var(--line-height-4);
}

.pdf-preview-head h2 {
  max-width: 480px;
  margin: 0;
  overflow: hidden;
  color: var(--text-primary);
  font-size: var(--font-size-xl);
  font-weight: var(--font-weight-medium);
  line-height: var(--line-height-7);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pdf-preview-head strong {
  flex: 0 0 auto;
  padding: var(--space-3xs) var(--space-sm);
  border: 1px solid var(--brand-pixpix-border-subtle);
  border-radius: var(--radius-full);
  color: var(--brand-pixpix-text);
  background: var(--brand-pixpix-surface-subtle);
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-medium);
  line-height: var(--line-height-4);
}

:root[data-theme="dark"] .pdf-preview-head strong {
  color: var(--brand-pixpix-primary);
  border-color: var(--feedback-info-border-subtle);
  background: var(--feedback-info-surface-subtle);
}

:root[data-theme="dark"] .pdf-workspace__preview {
  background:
    radial-gradient(circle at 12% 10%, rgb(134 98 255 / 12%), transparent 42%),
    var(--surface-muted);
}

.pdf-page-stream {
  display: grid;
  min-height: 0;
  flex: 1 1 auto;
  grid-template-columns: repeat(4, minmax(118px, 1fr));
  gap: var(--space-sm);
  padding: var(--space-md);
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
  border: 1px solid var(--border-default-muted);
  border-radius: var(--radius-4xl);
  align-content: start;
  background: var(--surface-card);
}

.pdf-page-stream.is-loading-preview {
  grid-template-columns: 1fr;
  grid-template-rows: 1fr;
  align-content: stretch;
  overflow: hidden;
}

.pdf-preview-loading-placeholder {
  display: grid;
  width: 100%;
  min-width: 0;
  min-height: 0;
  place-items: center;
}

.pdf-preview-loading-placeholder img {
  width: 48px;
  height: 48px;
  object-fit: contain;
  opacity: 0.46;
}

:root[data-theme="dark"] .pdf-preview-loading-placeholder img {
  opacity: 0.72;
}

.pdf-page-card {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: var(--space-2xs);
}

.pdf-page-card__sheet {
  position: relative;
  display: grid;
  min-height: 214px;
  overflow: hidden;
  border: 1px solid var(--border-default);
  border-radius: var(--radius-xl);
  place-items: center;
  color: var(--text-tertiary);
  background:
    linear-gradient(180deg, transparent 0 26%, var(--border-default-muted) 26% 27%, transparent 27% 43%, var(--border-default-muted) 43% 44%, transparent 44%),
    var(--surface-container);
  font-size: var(--font-size-3xl);
  font-weight: var(--font-weight-medium);
}

.pdf-page-card__sheet canvas {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #fff;
}

.pdf-page-stream.is-single-page {
  display: flex;
  align-items: flex-start;
  justify-content: center;
}

.pdf-page-stream.is-single-page .pdf-page-card {
  width: 100%;
  max-width: 100%;
  flex: 0 0 auto;
}

.pdf-page-stream.is-single-page .pdf-page-card__sheet {
  width: 100%;
  min-height: 0;
  overflow: hidden;
  border-radius: var(--radius-xl);
}

.pdf-page-stream.is-single-page .pdf-page-card__sheet canvas {
  width: 100%;
  height: auto;
  object-fit: initial;
}

.pdf-page-card p,
.pdf-page-card em {
  margin: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pdf-page-card p {
  color: var(--text-primary);
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-medium);
  line-height: var(--line-height-4);
}

.pdf-page-card em {
  color: var(--text-tertiary);
  font-size: 11px;
  font-style: normal;
  line-height: var(--line-height-4);
}

.pdf-page-card.is-processing .pdf-page-card__sheet {
  border-color: var(--brand-pixpix-border-subtle);
  box-shadow: 0 0 0 2px var(--brand-pixpix-surface-subtle);
}

.pdf-page-card.is-done em {
  color: var(--brand-pixpix-text);
}

:root[data-theme="dark"] .pdf-page-card.is-done em {
  color: var(--brand-pixpix-primary);
}

.pdf-preview-note {
  margin: 0;
  color: var(--text-tertiary);
  font-size: var(--font-size-xs);
  line-height: var(--line-height-4);
}

.pdf-workspace__controls {
  border-style: solid;
  border-color: var(--border-default-muted);
  background: var(--surface-card);
}

.pdf-workspace__controls::before {
  display: none;
}

:root[data-theme="dark"] .pdf-workspace__controls {
  background: var(--surface-card);
}

.pdf-to-images-app,
.pdf-to-images-app .drop,
.pdf-processing,
.pdf-control-panel {
  height: 100%;
  min-height: 0;
}

.pdf-to-images-app .drop .big {
  width: 92px;
  height: 92px;
  color: var(--brand-pixpix-primary);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-4xl);
  background: var(--surface-muted);
}

.pdf-to-images-app .drop p {
  max-width: 320px;
}

.pdf-to-images-app .drop .big img {
  width: 44px;
  height: 44px;
  object-fit: contain;
  opacity: 1;
}

.pdf-to-images-app .drop:focus-within .big,
.pdf-to-images-app .drop:hover .big,
.pdf-to-images-app .drop.over .big {
  transform: translateY(-4px);
}

.pdf-processing {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-md);
  padding: var(--space-xl);
  color: var(--text-secondary);
  text-align: center;
}

.pdf-processing[hidden],
.pdf-control-panel[hidden],
.pdf-to-images-app .drop[hidden] {
  display: none !important;
}

.pdf-processing strong,
.pdf-processing span {
  max-width: 320px;
}

.pdf-processing__cancel,
.pdf-replace-button,
.pdf-control-actions .btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-full);
  cursor: pointer;
  font-weight: var(--font-weight-medium);
}

.pdf-processing__cancel {
  min-width: 96px;
  min-height: 40px;
  margin-top: var(--space-sm);
  padding-inline: var(--space-lg);
  border: 1px solid var(--border-default);
  color: var(--text-primary);
  background: var(--surface-card);
  font-size: var(--font-size-sm);
  line-height: var(--line-height-5);
}

.pdf-processing__cancel:hover {
  background: var(--component-translucent-subtle);
}

.pdf-processing__spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--border-default);
  border-top-color: var(--brand-pixpix-primary);
  border-radius: var(--radius-full);
  animation: pdf-spin 0.8s linear infinite;
}

@keyframes pdf-spin {
  to { transform: rotate(1turn); }
}

.pdf-control-panel {
  display: flex;
  flex-direction: column;
  gap: var(--space-lg);
  padding: var(--space-xl);
}

.pdf-control-panel__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-md);
}

.pdf-control-panel__head h3,
.pdf-control-panel__head p {
  margin: 0;
}

.pdf-control-panel__head h3 {
  color: var(--text-primary);
  font-size: var(--font-size-2xl);
  font-weight: var(--font-weight-medium);
  line-height: var(--line-height-8);
}

.pdf-control-panel__head p {
  margin-top: var(--space-3xs);
  color: var(--text-tertiary);
  font-size: var(--font-size-sm);
  line-height: var(--line-height-5);
}

.pdf-replace-button {
  min-height: 36px;
  flex: 0 0 auto;
  padding-inline: var(--space-md);
  border: 1px solid var(--border-default);
  color: var(--text-primary);
  background: var(--surface-card);
  font-size: var(--font-size-xs);
  line-height: var(--line-height-4);
}

.pdf-replace-button:hover {
  background: var(--component-translucent-subtle);
}

.pdf-summary {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-sm);
}

.pdf-summary > div {
  display: flex;
  min-width: 0;
  min-height: 64px;
  flex-direction: column;
  justify-content: space-between;
  gap: var(--space-3xs);
  padding: var(--space-sm) var(--space-md);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-2xl);
  background: var(--surface-muted);
}

.pdf-summary span {
  color: var(--text-tertiary);
  font-size: var(--font-size-xs);
  line-height: var(--line-height-4);
}

.pdf-summary strong {
  overflow: hidden;
  color: var(--text-primary);
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-medium);
  line-height: var(--line-height-5);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pdf-form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-md);
}

.pdf-field {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: var(--space-sm);
}

.pdf-field > label {
  color: var(--text-primary);
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-medium);
  line-height: var(--line-height-5);
}

.pdf-format-segment {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-2xs);
}

.pdf-format-segment button,
.pdf-field select {
  min-height: 42px;
  border: 1px solid var(--border-default);
  border-radius: var(--radius-full);
  color: var(--text-secondary);
  background: var(--surface-card);
  font-size: var(--font-size-sm);
}

.pdf-format-segment button {
  cursor: pointer;
}

.pdf-format-segment button:hover,
.pdf-format-segment button.on {
  color: var(--brand-default-on-primary);
  border-color: var(--brand-default-primary);
  background: var(--brand-default-primary);
}

.pdf-field select {
  width: 100%;
}

.pdf-field .pdf-resolution-select {
  width: 100%;
  min-width: 0;
  height: 42px;
}

.pdf-field .pdf-resolution-select .ui-select__native {
  height: 42px;
  min-height: 42px;
  padding: 0 42px 0 var(--space-md);
  border-radius: var(--radius-full);
}

.pdf-field .pdf-resolution-select .ui-select__icon {
  right: var(--space-md);
  width: var(--space-md);
  height: var(--space-md);
}

.pdf-progress {
  display: flex;
  flex-direction: column;
  gap: var(--space-2xs);
}

.pdf-progress[hidden] {
  display: none !important;
}

.pdf-progress__track {
  height: 7px;
  overflow: hidden;
  border-radius: var(--radius-full);
  background: var(--component-translucent-subtle);
}

.pdf-progress__bar {
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--brand-pixpix-primary), var(--brand-default-primary));
  transition: width 180ms ease;
}

.pdf-progress p,
.pdf-privacy-note,
.pdf-error-note {
  margin: 0;
  color: var(--text-tertiary);
  font-size: var(--font-size-xs);
  line-height: var(--line-height-4);
}

.pdf-privacy-note,
.pdf-error-note {
  padding: var(--space-md);
  border-radius: var(--radius-2xl);
  color: var(--text-secondary);
  background: var(--feedback-info-surface-subtle);
}

.pdf-error-note {
  color: #b42318;
  background: #fff1f1;
}

:root[data-theme="dark"] .pdf-error-note {
  color: #ffb4b4;
  background: #3c1513;
}

.pdf-control-actions {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: var(--space-sm);
  margin-top: auto;
}

.pdf-control-actions .btn {
  min-height: 48px;
  padding-inline: var(--space-lg);
  border: 1px solid var(--brand-default-primary);
  color: var(--brand-default-on-primary);
  background: var(--brand-default-primary);
  font-size: var(--font-size-sm);
  line-height: var(--line-height-5);
}

.pdf-control-actions .btn:hover {
  background: var(--brand-default-primary-hover);
}

.pdf-control-actions .btn.sec {
  color: var(--text-primary);
  border-color: var(--border-default);
  background: var(--surface-card);
}

.pdf-control-actions .btn:disabled {
  cursor: not-allowed;
  opacity: 0.48;
}

.pdf-replace-button:focus-visible,
.pdf-processing__cancel:focus-visible,
.pdf-format-segment button:focus-visible,
.pdf-field select:focus-visible,
.pdf-control-actions .btn:focus-visible {
  outline: 3px solid var(--border-default-accent);
  outline-offset: 2px;
}

.tool-effect {
  background: var(--surface-container);
}

.tool-effect__grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-xl);
}

.tool-effect-card {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: var(--space-lg);
}

.tool-effect-card__media {
  width: 100%;
  height: 320px;
  border-radius: var(--radius-4xl);
}

.tool-effect-card__copy h3,
.tool-effect-card__copy p {
  margin: 0;
}

.tool-effect-card__copy h3 {
  color: var(--text-primary);
  font-size: var(--font-size-xl);
  font-weight: var(--font-weight-medium);
  line-height: var(--line-height-7);
}

.tool-effect-card__copy p {
  margin-top: var(--space-2xs);
  color: var(--text-secondary);
  font-size: var(--font-size-sm);
  line-height: var(--line-height-5);
}

@media (max-width: 1439px) {
  .pdf-workspace {
    grid-template-columns: minmax(0, 1.28fr) minmax(420px, 1fr);
  }

  .pdf-page-stream {
    grid-template-columns: repeat(3, minmax(118px, 1fr));
  }
}

@media (max-width: 1023px) {
  .pdf-workspace {
    height: auto;
    grid-template-columns: 1fr;
  }

  .pdf-workspace .tool-workspace__preview,
  .pdf-workspace .tool-workspace__upload {
    height: 520px;
    min-height: 520px;
  }

  .pdf-page-stream {
    grid-template-columns: repeat(4, minmax(118px, 1fr));
  }
}

@media (max-width: 767px) {
  .pdf-workspace .tool-workspace__preview,
  .pdf-workspace .tool-workspace__upload,
  .pdf-to-images-app,
  .pdf-to-images-app .drop,
  .pdf-processing,
  .pdf-control-panel {
    height: auto;
    min-height: 440px;
  }

  .pdf-workspace__preview {
    padding: var(--space-md);
  }

  .pdf-page-stream {
    display: flex;
    min-height: 330px;
    overflow-x: auto;
    overflow-y: hidden;
    scroll-snap-type: x mandatory;
  }

  .pdf-page-stream.is-loading-preview {
    align-items: center;
    justify-content: center;
    overflow: hidden;
    scroll-snap-type: none;
  }

  .pdf-page-stream.is-single-page {
    overflow-x: hidden;
    overflow-y: auto;
    scroll-snap-type: none;
  }

  .pdf-page-stream.is-single-page .pdf-page-card {
    min-width: 100%;
  }

  .pdf-page-card {
    min-width: 150px;
    scroll-snap-align: start;
  }

  .pdf-page-card__sheet {
    min-height: 224px;
  }

  .pdf-control-panel {
    padding: var(--space-lg);
  }

  .pdf-control-panel__head {
    flex-direction: column;
  }

  .tool-effect__grid {
    grid-template-columns: 1fr;
  }

  .tool-effect-card__media {
    height: 240px;
  }
}

@media (max-width: 479px) {
  .pdf-form-grid,
  .pdf-summary,
  .pdf-control-actions {
    grid-template-columns: 1fr;
  }

  .pdf-control-actions .btn {
    width: 100%;
  }
}

@media (prefers-reduced-motion: reduce) {
  .pdf-processing__spinner {
    animation-duration: 0.01ms;
  }

  .pdf-progress__bar {
    transition: none;
  }
}

/* Generated v2 artwork owns the whole demo slot rather than one thumbnail
   column from the live, multi-page PDF grid. */
.pdf-workspace[data-state="demo"] .pdf-page-stream--asset {
  display: block;
  padding: 0;
  overflow: hidden;
}

.pdf-workspace[data-state="demo"] .pdf-page-stream--asset > .tool-hero-preview-asset {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Follow the authored artwork ratios so object-fit: contain does not add
   accidental bands around the core-capability and suitability images. */
.tool-features .tool-feature-row__media {
  height: auto;
  aspect-ratio: 16 / 9;
}

.tool-suitability .tool-suitability-card {
  min-height: 0;
}

.tool-suitability .tool-suitability-card__media {
  height: auto;
  flex-basis: auto;
  aspect-ratio: 147 / 70;
}

.tool-effect .tool-effect-card__media {
  height: auto;
  overflow: hidden;
  aspect-ratio: 147 / 80;
}
