/* ImgSquash — compressor widget + content polish.
   Theme colors come from site.config.json (--primary violet / --accent teal). */

.sq {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 1.25rem;
  margin: 1.4rem 0 2rem;
}

/* ---- dropzone ---- */

.sq-drop {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  text-align: center;
  padding: 2rem 1.25rem;
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, transform 0.1s;
}
.sq-drop strong {
  font-size: 1.1rem;
}
.sq-drop span {
  font-size: 0.92rem;
  color: var(--text-dim);
}
.sq-drop u {
  color: var(--primary);
  text-decoration: none;
  font-weight: 650;
}
.sq-drop:hover,
.sq-drop:focus-visible,
.sq-drop-hot {
  border-color: var(--primary);
  background: color-mix(in srgb, var(--primary) 6%, var(--bg));
  outline: none;
}
.sq-drop-hot {
  transform: scale(1.005);
}

/* ---- options ---- */

.sq-opts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(10.5rem, 1fr));
  gap: 0.7rem;
  margin-top: 1rem;
}
.sq-opts label {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  font-size: 0.82rem;
  font-weight: 650;
  color: var(--text-dim);
}
.sq-opts select,
.sq-opts input[type="number"],
.sq-opts input[type="text"] {
  font: inherit;
  font-size: 0.98rem;
  font-weight: 600;
  color: var(--text);
  background: var(--bg);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.45rem 0.6rem;
  width: 100%;
}
.sq-opts input[type="range"] {
  width: 100%;
  accent-color: var(--primary);
  margin-top: 0.55rem;
}
.sq-opts select:focus,
.sq-opts input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 20%, transparent);
}

/* ---- status line ---- */

.sq-status {
  margin-top: 0.9rem;
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--accent);
  min-height: 1.2em;
}

/* ---- result rows ---- */

.sq-list {
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
  margin-top: 0.6rem;
}

.sq-item {
  display: flex;
  align-items: center;
  gap: 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  padding: 0.8rem 1rem;
}
.sq-item-ok {
  border-left: 4px solid var(--accent);
}
.sq-item-warn {
  border-left: 4px solid #d97706;
}
.sq-item[data-state="error"] {
  border-left: 4px solid #dc2626;
}

.sq-thumbs {
  display: flex;
  gap: 0.5rem;
  flex-shrink: 0;
}
.sq-thumbs figure {
  margin: 0;
  text-align: center;
}
.sq-thumbs figcaption {
  font-size: 0.68rem;
  color: var(--text-dim);
  margin-top: 0.15rem;
}
.sq-thumb {
  width: 84px;
  height: 84px;
  object-fit: cover;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface-2);
  display: block;
}

.sq-info {
  flex: 1;
  min-width: 0;
}
.sq-name {
  font-weight: 700;
  font-size: 0.95rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.sq-line {
  font-size: 0.95rem;
  margin-top: 0.15rem;
}
.sq-after {
  color: var(--primary);
}
.sq-saved {
  color: var(--accent);
  font-weight: 700;
}
.sq-dims {
  font-family: var(--mono);
  font-size: 0.78rem;
  color: var(--text-dim);
  margin-top: 0.1rem;
}
.sq-note {
  font-size: 0.82rem;
  color: var(--text-dim);
  margin-top: 0.25rem;
}
.sq-item-warn .sq-note {
  color: #b45309;
}
.sq-item[data-state="error"] .sq-note {
  color: #dc2626;
}

.sq-actions {
  flex-shrink: 0;
}
.sq-dl {
  display: inline-block;
  font-weight: 700;
  font-size: 0.88rem;
  color: #fff;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  border-radius: var(--radius-sm);
  padding: 0.55rem 0.9rem;
  text-decoration: none;
  white-space: nowrap;
}
.sq-dl:hover {
  filter: brightness(1.08);
}
.sq-dl:not([href]) {
  opacity: 0.45;
  pointer-events: none;
}

/* ---- small content helpers ---- */

.formula {
  display: block;
  font-family: var(--mono);
  font-size: 1rem;
  background: var(--surface-2);
  border-left: 3px solid var(--primary);
  padding: 0.7rem 1rem;
  border-radius: 0 8px 8px 0;
  margin: 0.9rem 0;
  overflow-x: auto;
  white-space: nowrap;
}

.privnote {
  border: 1px solid color-mix(in srgb, var(--accent) 45%, var(--border));
  background: color-mix(in srgb, var(--accent) 8%, var(--bg));
  border-radius: var(--radius-sm);
  padding: 0.7rem 1rem;
  font-size: 0.92rem;
}

.prose table.fmt td:first-child,
.prose table.fmt th:first-child {
  min-width: 6rem;
}

@media (max-width: 560px) {
  .sq {
    padding: 0.9rem;
  }
  .sq-item {
    flex-wrap: wrap;
    gap: 0.7rem;
  }
  .sq-thumb {
    width: 64px;
    height: 64px;
  }
  .sq-actions {
    width: 100%;
  }
  .sq-dl {
    display: block;
    text-align: center;
  }
}
