/* Cropper tool — sits on marketing tokens from style.css */

.nav-desktop a[aria-current="page"] {
  color: var(--text);
  background: var(--bg-card);
}

.cropper-page {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  padding-top: calc(1.25rem + 64px + 1rem);
}

.cropper-shell {
  flex: 1;
  width: min(100% - 2rem, var(--container));
  margin-inline: auto;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  padding-bottom: 2rem;
}

.cropper-banner {
  padding: 1rem 1.25rem;
  background: var(--surface);
  border: var(--border-w) solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  font-size: 0.9rem;
  line-height: 1.5;
}

.cropper-banner p + p { margin-top: 0.35rem; }

.cropper-banner-app { color: var(--text-muted); font-size: 0.85rem; }

.cropper-banner a {
  color: var(--pink);
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.cropper-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 1rem;
  align-items: start;
}

.cropper-main-bezel,
.cropper-side-bezel { min-width: 0; }

.cropper-main {
  min-height: 520px;
  display: flex;
  flex-direction: column;
  background: var(--surface);
}

.cropper-tabs {
  display: flex;
  gap: 0.35rem;
  padding: 0.75rem 0.75rem 0;
  border-bottom: var(--border-w) solid var(--border);
}

.cropper-tab {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 0.9rem;
  padding: 0.65rem 1rem;
  border-radius: 14px 14px 0 0;
  color: var(--text-muted);
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.cropper-tab.is-active {
  color: var(--text);
  background: var(--bg-card);
  box-shadow: inset 0 -3px 0 var(--teal);
}

.cropper-count {
  font-size: 0.72rem;
  background: var(--bg);
  border: 2px solid var(--border);
  border-radius: 999px;
  padding: 0.05rem 0.45rem;
}

.cropper-panel {
  flex: 1;
  padding: 1rem;
}

.cropper-dropzone {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.65rem;
  min-height: 240px;
  padding: 1.75rem 1.5rem;
  text-align: center;
  border: 3px dashed var(--border);
  border-radius: var(--radius-lg);
  background: var(--bg-card);
  cursor: pointer;
  transition: background 0.2s var(--ease), transform 0.2s var(--ease);
}

.cropper-dropzone strong {
  font-family: var(--font-display);
  font-size: 1.15rem;
}

.cropper-dropzone span { color: var(--text-muted); font-size: 0.88rem; max-width: 28rem; }

.cropper-dropzone.is-hover,
.cropper-dropzone:hover { background: var(--accent-dim); }

.cropper-dropzone.has-files {
  min-height: 0;
  padding: 0.85rem;
  margin-bottom: 1rem;
  flex-direction: row;
  justify-content: flex-start;
  gap: 0.75rem;
  text-align: left;
}

.cropper-dropzone.has-files svg { width: 24px; height: 24px; }
.cropper-dropzone.has-files span { display: none; }

.cropper-empty {
  color: var(--text-muted);
  font-size: 0.9rem;
  padding: 1rem 0.25rem;
}

.cropper-grid {
  list-style: none;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 0.75rem;
}

.cropper-card {
  position: relative;
  border: var(--border-w) solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-card);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  cursor: pointer;
  min-height: 44px;
  transition: transform 0.2s var(--ease);
}

.cropper-card:hover { transform: translate(-1px, -1px); }
.cropper-card:focus-visible { outline: var(--border-w) solid var(--pink); outline-offset: 2px; }

.cropper-thumb {
  aspect-ratio: 1;
  background: #111;
  display: grid;
  place-items: center;
  overflow: hidden;
}

.cropper-thumb img,
.cropper-thumb video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.cropper-thumb-fallback {
  color: var(--text-muted);
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.5rem;
  text-align: center;
}

.cropper-card-meta {
  padding: 0.5rem 0.6rem 0.65rem;
}

.cropper-card-name {
  font-size: 0.78rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cropper-card-sub {
  font-size: 0.7rem;
  color: var(--text-muted);
  margin-top: 0.15rem;
}

.cropper-status {
  display: inline-block;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 0.1rem 0.4rem;
  border-radius: 6px;
  border: 2px solid var(--border);
  margin-top: 0.35rem;
}

.cropper-status.is-error { color: var(--danger); }
.cropper-status.is-done { color: var(--teal); }

.cropper-remove {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 32px;
  height: 32px;
  border-radius: 10px;
  border: 2px solid var(--border);
  background: var(--surface);
  display: grid;
  place-items: center;
  z-index: 2;
}

.cropper-remove:hover { background: var(--pink-dim); }

.cropper-sidebar {
  padding: 1.15rem;
  display: flex;
  flex-direction: column;
  gap: 1.1rem;
  background: var(--surface);
}

.cropper-sidebar h2 {
  font-size: 1.05rem;
  margin: 0;
}

.cropper-field { display: flex; flex-direction: column; gap: 0.4rem; }

.cropper-field-row {
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.cropper-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  font-size: 0.85rem;
  font-weight: 600;
}

.cropper-badge {
  font-family: var(--font-display);
  font-weight: 800;
  color: var(--purple);
  background: color-mix(in srgb, var(--purple) 15%, transparent);
  padding: 0 8px;
  border-radius: 6px;
  border: 2px solid var(--border);
}

.cropper-help { font-size: 0.75rem; color: var(--text-muted); line-height: 1.45; }

.cropper-select {
  width: 100%;
  min-height: 44px;
  padding: 0.55rem 0.75rem;
  border: var(--border-w) solid var(--border);
  border-radius: 12px;
  background: var(--bg);
  color: var(--text);
  font: inherit;
  box-shadow: var(--shadow-sm);
}

.cropper-switch {
  width: 52px;
  height: 32px;
  flex-shrink: 0;
  border-radius: 999px;
  border: var(--border-w) solid var(--border);
  background: var(--bg-card);
  position: relative;
  box-shadow: var(--shadow-sm);
}

.cropper-switch-knob {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--text-muted);
  transition: transform 0.2s var(--ease), background 0.2s var(--ease);
}

.cropper-switch[aria-checked="true"] { background: var(--teal); }
.cropper-switch[aria-checked="true"] .cropper-switch-knob {
  transform: translateX(20px);
  background: #fff;
}

.cropper-process { width: 100%; min-height: 48px; }

.cropper-progress-track {
  height: 8px;
  border: 2px solid var(--border);
  border-radius: 99px;
  background: var(--bg-card);
  overflow: hidden;
}

.cropper-progress-fill {
  height: 100%;
  width: 0%;
  background: var(--teal);
  transition: width 0.2s var(--ease);
}

.cropper-progress-msg { font-size: 0.78rem; color: var(--text-muted); margin-top: 0.4rem; }

.cropper-results-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.cropper-results-bar p { font-size: 0.85rem; color: var(--text-muted); }

.cropper-results { list-style: none; display: flex; flex-direction: column; gap: 0.65rem; }

.cropper-result {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  border: var(--border-w) solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-card);
  min-height: 52px;
}

.cropper-result-name { font-weight: 600; font-size: 0.88rem; word-break: break-all; }

.cropper-dialog {
  width: min(960px, calc(100% - 2rem));
  max-height: calc(100dvh - 2rem);
  padding: 0;
  border: var(--border-w) solid var(--border);
  border-radius: var(--radius-xl);
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-lg);
}

.cropper-dialog::backdrop { background: color-mix(in srgb, #000 70%, transparent); }

.cropper-dialog-bar {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  padding: 1rem 1.1rem;
  border-bottom: var(--border-w) solid var(--border);
}

.cropper-dialog-bar h2 {
  font-size: 1rem;
  margin: 0;
  max-width: 36rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.preview-stage {
  padding: 1rem;
  display: grid;
  place-items: center;
  background: var(--bg);
  min-height: 240px;
}

.preview-media-wrap {
  position: relative;
  display: inline-flex;
  max-width: 100%;
}

.preview-media-wrap img,
.preview-media-wrap video {
  max-width: 100%;
  max-height: min(70vh, 640px);
  height: auto;
  width: auto;
  display: block;
}

.preview-overlay {
  position: absolute;
  border: 2px solid var(--teal);
  box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.55);
  pointer-events: none;
  z-index: 2;
}

.preview-overlay .crop-handle {
  position: absolute;
  width: 12px;
  height: 12px;
  border: 2px solid var(--teal);
}

.preview-overlay .crop-handle.tl { top: -2px; left: -2px; border-right: 0; border-bottom: 0; }
.preview-overlay .crop-handle.tr { top: -2px; right: -2px; border-left: 0; border-bottom: 0; }
.preview-overlay .crop-handle.bl { bottom: -2px; left: -2px; border-right: 0; border-top: 0; }
.preview-overlay .crop-handle.br { bottom: -2px; right: -2px; border-left: 0; border-top: 0; }

.preview-loading {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  background: color-mix(in srgb, var(--bg) 70%, transparent);
  z-index: 3;
  font-size: 0.88rem;
}

.preview-spinner {
  width: 28px;
  height: 28px;
  border: 3px solid var(--border);
  border-top-color: var(--teal);
  border-radius: 50%;
  animation: cropper-spin 0.7s linear infinite;
}

@keyframes cropper-spin { to { transform: rotate(360deg); } }

.cropper-toasts {
  position: fixed;
  bottom: 1.25rem;
  right: 1.25rem;
  z-index: 1100;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  max-width: min(360px, calc(100% - 2rem));
  pointer-events: none;
}

.cropper-toast {
  pointer-events: auto;
  padding: 0.75rem 1rem;
  background: var(--surface);
  border: var(--border-w) solid var(--border);
  border-radius: 14px;
  box-shadow: var(--shadow);
  font-size: 0.85rem;
}

.cropper-toast.is-error { border-color: var(--danger); }

.cropper-footer { margin-top: auto; padding: 1.25rem 0; }

.cropper-footer .footer-bottom { border-top: none; padding-top: 0; gap: 0.75rem; }

.cropper-footer a.footer-badge { color: var(--pink); }

@media (prefers-reduced-motion: reduce) {
  .preview-spinner { animation: none; }
  .cropper-card { transition: none; }
}

@media (max-width: 900px) {
  .cropper-layout { grid-template-columns: 1fr; }
  .cropper-main { min-height: 0; }
  .cropper-sidebar { position: static; }
}

@media (max-width: 768px) {
  .cropper-page {
    padding-top: calc(max(0.75rem, env(safe-area-inset-top)) + 64px + 0.75rem);
  }

  .cropper-results-bar { flex-direction: column; align-items: stretch; }
  .cropper-dialog-bar h2 { white-space: normal; }
}
