/* HEIC2JPG — converter widget + content polish.
   Theme colors come from site.config.json (--primary green / --accent amber).
   P015: elements that may carry [hidden] only get display via :not([hidden]). */

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

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

.h2j-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;
}
.h2j-drop strong {
  font-size: 1.1rem;
}
.h2j-drop span {
  font-size: 0.92rem;
  color: var(--text-dim);
}
.h2j-drop u {
  color: var(--primary);
  text-decoration: none;
  font-weight: 650;
}
.h2j-drop:hover,
.h2j-drop:focus-visible,
.h2j-drop-hot {
  border-color: var(--primary);
  background: color-mix(in srgb, var(--primary) 6%, var(--bg));
  outline: none;
}
.h2j-drop-hot {
  transform: scale(1.005);
}

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

.h2j-opts {
  display: flex;
  flex-wrap: wrap;
  gap: 0.9rem 1.5rem;
  align-items: end;
  margin: 1rem 0 0.5rem;
}
.h2j-opts label {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-dim);
}
.h2j-opts select,
.h2j-opts input[type='number'] {
  font: inherit;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 0.45rem;
  padding: 0.45rem 0.6rem;
}
.h2j-opts input[type='range'] {
  accent-color: var(--primary);
  width: 10rem;
}
.h2j-qnote:not([hidden]) {
  display: block;
  font-size: 0.8rem;
  font-style: normal;
  color: var(--accent);
  align-self: end;
  padding-bottom: 0.55rem;
}

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

.h2j-status {
  min-height: 1.4em;
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--primary);
  margin: 0.4rem 0 0.2rem;
}

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

.h2j-list {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  margin-top: 0.6rem;
}
.h2j-item {
  border: 1px solid var(--border);
  border-radius: 0.6rem;
  padding: 0.7rem 0.9rem;
  background: var(--bg);
}
.h2j-row {
  display: flex;
  align-items: center;
  gap: 0.9rem;
}
.h2j-thumb:not([hidden]) {
  display: block;
  width: 64px;
  height: 64px;
  object-fit: cover;
  border-radius: 0.45rem;
  border: 1px solid var(--border);
  flex: none;
}
.h2j-info {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}
.h2j-name {
  font-size: 0.95rem;
  word-break: break-all;
}
.h2j-sub {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 0.7rem;
  font-size: 0.8rem;
  color: var(--text-dim);
}
.h2j-sub i {
  font-style: normal;
}
.h2j-badge {
  background: color-mix(in srgb, var(--primary) 14%, transparent);
  color: var(--primary);
  font-weight: 700;
  font-size: 0.72rem;
  letter-spacing: 0.04em;
  border-radius: 0.3rem;
  padding: 0.08rem 0.4rem;
}
.h2j-stage {
  color: var(--accent);
  font-weight: 600;
}

/* indeterminate progress bar while working */
.h2j-bar:not([hidden]) {
  display: block;
  height: 4px;
  border-radius: 2px;
  background: color-mix(in srgb, var(--primary) 14%, var(--bg));
  overflow: hidden;
  position: relative;
}
.h2j-bar i {
  position: absolute;
  inset: 0 auto 0 0;
  width: 38%;
  border-radius: 2px;
  background: var(--primary);
  animation: h2j-slide 1.1s ease-in-out infinite;
}
@keyframes h2j-slide {
  0% { left: -38%; }
  100% { left: 102%; }
}

.h2j-out:not([hidden]) {
  display: flex;
  flex-direction: column;
  align-items: end;
  gap: 0.3rem;
  flex: none;
}
.h2j-meta {
  display: flex;
  flex-direction: column;
  align-items: end;
  gap: 0.1rem;
  font-size: 0.8rem;
  color: var(--text-dim);
}
.h2j-meta i {
  font-style: normal;
}
.h2j-note {
  color: var(--accent);
}
.h2j-dl {
  display: inline-block;
  background: var(--primary);
  color: #fff;
  font-weight: 650;
  font-size: 0.85rem;
  text-decoration: none;
  border-radius: 0.45rem;
  padding: 0.45rem 0.85rem;
}
.h2j-dl:hover {
  filter: brightness(1.08);
}
.h2j-err:not([hidden]) {
  display: block;
  margin: 0.2rem 0 0;
  font-size: 0.85rem;
  color: #b91c1c;
}
.h2j-item[data-state='error'] {
  border-color: #fca5a5;
  background: #fef2f2;
}
.h2j-item[data-state='done'] .h2j-badge {
  background: color-mix(in srgb, var(--primary) 18%, transparent);
}

/* ---- footer buttons ---- */

.h2j-foot:not([hidden]) {
  display: flex;
  gap: 0.7rem;
  margin-top: 0.9rem;
}
.h2j-foot button {
  font: inherit;
  font-weight: 650;
  border-radius: 0.45rem;
  padding: 0.55rem 1rem;
  cursor: pointer;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
}
.h2j-foot .h2j-all:not([hidden]) {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}
.h2j-foot button:hover {
  filter: brightness(0.97);
}

/* ---- mobile ---- */

@media (max-width: 560px) {
  .h2j {
    padding: 0.9rem;
  }
  .h2j-row {
    flex-wrap: wrap;
  }
  .h2j-out {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    width: 100%;
  }
  .h2j-meta {
    align-items: start;
  }
  .h2j-opts input[type='range'] {
    width: 8rem;
  }
}
