/*
  Image Tools. Loaded after the PDF tools' stylesheet (../pdf_tools/app.css),
  whose workspace, tiles, crop box and cards these pages share; this adds
  only what's particular to images. Plain CSS, not built by Tailwind.
*/

/* A checkerboard behind anything that may be transparent. */
.imgt-checker {
  --imgt-check: color-mix(in oklab, var(--color-base-content) 8%, var(--color-base-100));
  background-color: var(--color-base-100);
  background-image: conic-gradient(var(--imgt-check) 25%, transparent 0 50%, var(--imgt-check) 0 75%, transparent 0);
  background-size: 16px 16px;
}

.imgt .pdft-tile-thumb img { background: transparent; }
/* A colour picker: the chosen colour inside a rainbow ring, so it doesn't read as another swatch. */
.imgt-color {
  width: 1.75rem;
  height: 1.75rem;
  padding: 3px;
  border: 0;
  border-radius: 50%;
  background: conic-gradient(#f43f5e, #f59e0b, #84cc16, #06b6d4, #6366f1, #d946ef, #f43f5e);
  cursor: pointer;
}
.imgt-color::-webkit-color-swatch-wrapper { padding: 0; }
.imgt-color::-webkit-color-swatch { border: 0; border-radius: 50%; }
.imgt-color::-moz-color-swatch { border: 0; border-radius: 50%; }
.imgt-color[hidden] { display: none; }
.imgt-sub { margin-left: 1.5rem; }
.imgt-num { width: 7rem; }
.imgt-sub.is-disabled { opacity: 0.5; cursor: default; }

/* Width × height inputs */
.imgt-dims {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: end;
  gap: 0.5rem;
}
.imgt-dims[hidden] { display: none; }
.imgt-dims label { display: flex; flex-direction: column; gap: 0.25rem; font-size: 0.8125rem; color: var(--muted); }
.imgt-times { padding-bottom: 0.4rem; color: var(--muted); }
.imgt-sizes { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.4rem 0.75rem; }

/* Results */
.imgt-results {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  max-height: 16rem;
  overflow-y: auto;
  padding-top: 0.25rem;
  font-size: 0.8125rem;
}
.imgt-results li { display: flex; flex-direction: column; gap: 0.05rem; }
.imgt-results a {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-weight: 600;
  overflow-wrap: anywhere;
}
.imgt-results a:hover span { text-decoration: underline; text-underline-offset: 2px; }
.imgt-results .pdft-icon { width: 0.95rem; height: 0.95rem; }
.imgt-results-size, .imgt-results-note { padding-left: 1.3rem; color: var(--muted); }

.imgt-summary { font-size: 0.9375rem; font-weight: 600; }
.imgt-summary.is-warning { color: color-mix(in oklab, var(--color-warning) 70%, var(--color-base-content)); }

/* Crop */
.imgt-crop-tools { justify-content: center; }
.imgt-crop-canvas { width: 100%; height: 100%; }
.pdft-crop-box.is-circle { border-radius: 50%; }
.imgt-thirds {
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.15s;
  background:
    linear-gradient(to right, transparent calc(33.33% - 0.5px), rgb(255 255 255 / 0.7) 0 calc(33.33% + 0.5px), transparent 0 calc(66.67% - 0.5px), rgb(255 255 255 / 0.7) 0 calc(66.67% + 0.5px), transparent 0),
    linear-gradient(to bottom, transparent calc(33.33% - 0.5px), rgb(255 255 255 / 0.7) 0 calc(33.33% + 0.5px), transparent 0 calc(66.67% - 0.5px), rgb(255 255 255 / 0.7) 0 calc(66.67% + 0.5px), transparent 0);
}
.pdft-crop-frame.is-dragging .imgt-thirds { opacity: 1; }
.pdft-crop-box.is-circle .imgt-thirds { border-radius: 50%; }

/* EXIF viewer */
.imgt-viewer { display: grid; gap: 1.25rem; align-items: start; }
@media (min-width: 48rem) { .imgt-viewer { grid-template-columns: minmax(0, 18rem) minmax(0, 1fr); } }
.imgt-viewer-image {
  display: grid;
  place-items: center;
  padding: 0.5rem;
  border-radius: 0.75rem;
}
.imgt-viewer-image img { max-width: 100%; max-height: 24rem; border-radius: 0.375rem; }
.imgt-viewer-data { display: flex; flex-direction: column; gap: 1rem; min-width: 0; }
.imgt-alert {
  display: flex;
  gap: 0.75rem;
  padding: 0.85rem 1rem;
  border: 1px solid color-mix(in oklab, var(--color-warning) 55%, var(--pdft-line));
  border-radius: 0.75rem;
  background: color-mix(in oklab, var(--color-warning) 12%, var(--color-base-100));
  font-size: 0.9375rem;
  line-height: 1.45;
}
.imgt-alert .pdft-icon { margin-top: 0.1rem; color: color-mix(in oklab, var(--color-warning) 70%, var(--color-base-content)); }
.imgt-alert a { text-decoration: underline; text-underline-offset: 2px; }
.imgt-alert.is-ok { border-color: color-mix(in oklab, var(--color-success) 50%, var(--pdft-line)); background: color-mix(in oklab, var(--color-success) 8%, var(--color-base-100)); }
.imgt-alert.is-ok .pdft-icon { color: var(--color-success); }
.imgt-meta {
  padding: 0.85rem 1rem;
  border: 1px solid var(--pdft-line);
  border-radius: 0.75rem;
  background: var(--color-base-100);
}
.imgt-meta h3 { font-weight: 700; font-size: 0.9375rem; }
.imgt-meta dl {
  display: grid;
  grid-template-columns: minmax(7rem, auto) minmax(0, 1fr);
  gap: 0.35rem 1rem;
  margin-top: 0.5rem;
  font-size: 0.875rem;
}
.imgt-meta dt { color: var(--muted); }
.imgt-meta dd { overflow-wrap: anywhere; }

/* Favicon generator */
.imgt-favicon { display: flex; flex-direction: column; gap: 1.25rem; }
.imgt-tabs { display: grid; gap: 0.5rem; }
@media (min-width: 40rem) { .imgt-tabs { grid-template-columns: 1fr 1fr; } }
.imgt-tab {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.55rem 0.75rem;
  border-radius: 0.6rem 0.6rem 0 0;
  background: #f1f3f4;
  color: #202124;
  font: 0.8125rem/1.2 system-ui, sans-serif;
  box-shadow: inset 0 -1px 0 rgb(0 0 0 / 0.08);
}
.imgt-tab.is-dark { background: #35363a; color: #e8eaed; }
.imgt-tab > span:nth-child(2) { flex: 1; min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.imgt-tab-icon { width: 16px; height: 16px; flex: none; }
.imgt-tab-close { opacity: 0.6; }
.imgt-icons { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 1rem; }
.imgt-icon-cell { display: flex; flex-direction: column; align-items: center; gap: 0.4rem; font-size: 0.75rem; color: var(--muted); }
.imgt-icon-cell > div { display: grid; place-items: center; padding: 0.5rem; border-radius: 0.5rem; }
.imgt-icon { display: block; }
.imgt-snippet { display: flex; flex-direction: column; gap: 0.5rem; margin-top: 1.25rem; }
.imgt-snippet pre {
  overflow-x: auto;
  padding: 0.85rem 1rem;
  border: 1px solid var(--pdft-line);
  border-radius: 0.6rem;
  background: var(--color-base-100);
  font: 0.8125rem/1.55 ui-monospace, SFMono-Regular, Consolas, monospace;
}

/* Base64 */
.imgt-base64 { display: grid; gap: 1rem; }
@media (min-width: 48rem) { .imgt-base64 { grid-template-columns: 12rem minmax(0, 1fr); } }
.imgt-base64-preview { display: grid; place-items: center; padding: 0.5rem; border-radius: 0.75rem; align-self: start; }
.imgt-base64-preview img { max-width: 100%; max-height: 12rem; }
.imgt-code {
  display: block;
  width: 100%;
  min-height: 14rem;
  padding: 0.85rem 1rem;
  border: 1px solid var(--pdft-line);
  border-radius: 0.6rem;
  background: var(--color-base-100);
  color: var(--color-base-content);
  font: 0.75rem/1.5 ui-monospace, SFMono-Regular, Consolas, monospace;
  word-break: break-all;
  resize: vertical;
}
