/* ==========================================================================
   PNG To DDS — tool.css
   The converter workspace that sits inside the hero: shell, upload area,
   options, file queue and the action footer.
   ========================================================================== */

/* ---------- Shell ---------- */
.converter {
  position: relative;
  max-width: 940px;
  margin-inline: auto;
  text-align: left;
  background: var(--white);
  color: var(--text-body);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow:
    0 40px 80px -20px rgba(0, 0, 0, 0.55),
    0 0 0 1px rgba(255, 255, 255, 0.08);
}

/* Title bar */
.converter__bar {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.7rem 1.1rem;
  background: var(--slate-900);
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
}
.converter__dots { display: inline-flex; gap: 6px; flex: none; }
.converter__dots i { width: 10px; height: 10px; border-radius: 50%; background: rgba(255, 255, 255, 0.16); }
.converter__dots i:first-child { background: var(--red); }
.converter__bar-title {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--slate-400);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.converter__shield {
  margin-left: auto;
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.3rem 0.65rem;
  border-radius: var(--radius-pill);
  font-family: var(--font-mono);
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  color: #6FE0B4;
  background: rgba(0, 182, 122, 0.12);
  border: 1px solid rgba(0, 182, 122, 0.28);
}
.converter__shield svg { width: 13px; height: 13px; }

/* The card is a light surface inside the dark hero, so undo the white
   headings `.section--dark` hands down. */
.section--dark .converter :is(h1, h2, h3, h4) { color: var(--text-heading); }

.converter__body {
  display: flex;
  flex-direction: column;
  gap: var(--space-5);
  padding: var(--space-5);
}

/* Upload on the left, the export settings alongside it on the right. */
.converter__workspace {
  display: grid;
  grid-template-columns: minmax(0, 1.08fr) minmax(0, 1fr);
  gap: var(--space-5);
  align-items: stretch;
}

/* ---------- Upload area ---------- */
.dropzone {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 0.5rem;
  padding: var(--space-6) var(--space-5);
  border: 2px dashed var(--slate-200);
  border-radius: var(--radius-md);
  background-color: var(--white);
  background-image:
    radial-gradient(120% 90% at 50% 0%, rgba(255, 67, 53, 0.05), transparent 62%),
    radial-gradient(var(--slate-200) 1px, transparent 1px);
  background-size: auto, 18px 18px;
  background-position: 0 0, 9px 9px;
  cursor: pointer;
  transition: border-color var(--dur) var(--ease), background-color var(--dur) var(--ease),
              box-shadow var(--dur) var(--ease);
}
.dropzone:hover { border-color: var(--red); }
.dropzone:focus-within { border-color: var(--red); box-shadow: 0 0 0 4px var(--red-soft); }

.dropzone__icon {
  width: 62px; height: 62px;
  display: inline-flex; align-items: center; justify-content: center;
  margin-bottom: 0.35rem;
  border-radius: 18px;
  color: #fff;
  background: linear-gradient(150deg, var(--red), var(--red-deep));
  box-shadow: 0 12px 26px rgba(255, 67, 53, 0.32);
  transition: transform var(--dur) var(--ease);
}
.dropzone__icon svg { width: 28px; height: 28px; }
.dropzone:hover .dropzone__icon { transform: translateY(-3px); }

.dropzone__title {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.2rem;
  color: var(--text-heading);
}
.dropzone__hint {
  font-size: var(--fs-small);
  color: var(--text-muted);
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  flex-wrap: wrap;
  justify-content: center;
}
.dropzone__hint kbd {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  padding: 0.12rem 0.4rem;
  border-radius: 5px;
  background: var(--slate-100);
  border: 1px solid var(--slate-200);
  border-bottom-width: 2px;
  color: var(--text-heading);
}
.dropzone__btn { margin-top: var(--space-4); }

.dropzone__chips {
  list-style: none;
  padding: 0;
  margin-top: var(--space-4);
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.4rem;
}
.dropzone__chips li {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  color: var(--slate-500);
  background: var(--slate-100);
  border: 1px solid var(--slate-200);
  padding: 0.24rem 0.55rem;
  border-radius: var(--radius-pill);
}
.dropzone__chips .is-out {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  color: var(--red-deep);
  background: var(--red-soft);
  border-color: rgba(255, 67, 53, 0.25);
}
.dropzone__chips .is-out svg { width: 13px; height: 13px; }

.dropzone__drophint {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.15rem;
  color: var(--red-deep);
  background: var(--red-soft);
  border-radius: calc(var(--radius-md) - 2px);
  opacity: 0;
  visibility: hidden;
  transition: opacity var(--dur) var(--ease), visibility var(--dur) var(--ease);
}
.dropzone.is-drag { border-color: var(--red); background-color: var(--red-soft); }
.dropzone.is-drag .dropzone__drophint { opacity: 1; visibility: visible; }

/* ---------- Options ---------- */
.converter__options {
  display: flex;
  flex-direction: column;
  gap: var(--space-5);
  padding: var(--space-5);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--slate-100);
}
.field { display: flex; flex-direction: column; gap: 0.5rem; min-width: 0; }
.field--flip { flex: 1; }
.field__label {
  display: inline-flex; align-items: center; gap: 0.45rem;
  font-family: var(--font-display); font-weight: 600; font-size: 0.9rem;
  color: var(--text-heading);
}
.field__label svg { width: 18px; height: 18px; color: var(--red-deep); flex: none; }
.field__hint { font-size: 0.8rem; color: var(--text-muted); line-height: 1.5; }

.select-wrap { position: relative; }
.select-wrap select {
  appearance: none;
  -webkit-appearance: none;
  width: 100%;
  padding: 0.75rem 2.4rem 0.75rem 0.85rem;
  border: 1.5px solid var(--slate-200);
  border-radius: var(--radius-sm);
  background: var(--white);
  font-size: 0.92rem;
  color: var(--text-heading);
  cursor: pointer;
  transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}
.select-wrap select:hover { border-color: var(--slate-400); }
.select-wrap select:focus { outline: none; border-color: var(--red); box-shadow: 0 0 0 3px var(--red-soft); }
.select-wrap__arrow {
  position: absolute; right: 0.85rem; top: 50%;
  transform: translateY(-50%);
  width: 18px; height: 18px;
  color: var(--slate-500);
  pointer-events: none;
}

/* Orientation — one control holding both flip axes */
.flipset {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  padding: 0.4rem;
  background: var(--white);
  border: 1.5px solid var(--slate-200);
  border-radius: var(--radius-md);
}
.flipbtn {
  position: relative;
  display: flex;
  align-items: center;
  gap: 0.65rem;
  width: 100%;
  text-align: left;
  padding: 0.55rem 0.6rem;
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  transition: background var(--dur) var(--ease), border-color var(--dur) var(--ease);
}
.flipbtn:hover { background: var(--slate-100); }
.flipbtn[aria-pressed="true"] { background: var(--red-soft); border-color: rgba(255, 67, 53, 0.28); }

.flipbtn__icon {
  width: 34px; height: 34px; flex: none;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 10px;
  background: var(--slate-100);
  color: var(--slate-500);
  transition: background var(--dur) var(--ease), color var(--dur) var(--ease), transform 320ms var(--ease);
}
.flipbtn__icon svg { width: 19px; height: 19px; }
.flipbtn[aria-pressed="true"] .flipbtn__icon { background: var(--red); color: #fff; }
#opt-flip[aria-pressed="true"] .flipbtn__icon { transform: rotateX(180deg); }
#opt-flip-h[aria-pressed="true"] .flipbtn__icon { transform: rotateY(180deg); }

.flipbtn__label {
  display: flex; flex-direction: column; line-height: 1.3; min-width: 0; flex: 1;
  font-family: var(--font-display); font-weight: 600; font-size: 0.9rem;
  color: var(--text-heading);
}
.flipbtn__label small {
  font-family: var(--font-body); font-weight: 400;
  font-size: 0.74rem; color: var(--text-muted);
}
.flipbtn[aria-pressed="true"] .flipbtn__label { color: var(--red-deep); }

.flipbtn__state {
  flex: none;
  font-family: var(--font-mono); font-size: 0.64rem; font-weight: 600;
  letter-spacing: 0.08em; text-transform: uppercase;
  padding: 0.2rem 0.5rem;
  border-radius: var(--radius-pill);
  background: var(--slate-100);
  color: var(--slate-500);
  transition: background var(--dur) var(--ease), color var(--dur) var(--ease);
}
.flipbtn[aria-pressed="true"] .flipbtn__state { background: var(--red); color: #fff; }

/* ---------- Queue ---------- */
.queue-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 0.75rem; margin-bottom: var(--space-4);
}
.converter .queue-head__title {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-muted);
  font-weight: 600;
}
.queue-head__count {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--red-deep);
  background: var(--red-soft);
  padding: 0.2rem 0.6rem;
  border-radius: var(--radius-pill);
}

.queue-empty {
  text-align: center; color: var(--text-muted);
  padding: var(--space-6) var(--space-4);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--slate-100);
  display: flex; flex-direction: column; align-items: center; gap: 0.6rem;
}
.queue-empty svg { width: 38px; height: 38px; color: var(--slate-400); }
.queue-empty p { font-size: 0.9rem; max-width: 42ch; }

.queue-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 0.75rem; }

.qitem {
  display: grid;
  grid-template-columns: 72px 1fr auto;
  gap: var(--space-4);
  align-items: center;
  padding: 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--white);
  transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}
.qitem:hover { border-color: var(--slate-400); box-shadow: var(--shadow-sm); }

.qitem__thumb {
  width: 72px; height: 72px; flex: none;
  border-radius: var(--radius-sm);
  overflow: hidden;
  display: grid; place-items: center;
  /* checkerboard reveals PNG transparency */
  background-image:
    linear-gradient(45deg, var(--slate-200) 25%, transparent 0),
    linear-gradient(-45deg, var(--slate-200) 25%, transparent 0),
    linear-gradient(45deg, transparent 75%, var(--slate-200) 0),
    linear-gradient(-45deg, transparent 75%, var(--slate-200) 0);
  background-size: 14px 14px;
  background-position: 0 0, 0 7px, 7px -7px, -7px 0;
}
.qitem__thumb img {
  width: 100%; height: 100%; object-fit: contain;
  transition: transform 320ms var(--ease);
}
/* live preview of the flip options */
.queue-list.is-flip-y .qitem__thumb img { transform: scaleY(-1); }
.queue-list.is-flip-x .qitem__thumb img { transform: scaleX(-1); }
.queue-list.is-flip-x.is-flip-y .qitem__thumb img { transform: scale(-1, -1); }

.qitem__main { min-width: 0; display: flex; flex-direction: column; gap: 0.2rem; }
.qitem__head { display: flex; align-items: center; gap: 0.5rem; min-width: 0; }
.qitem__name {
  font-weight: 600; color: var(--text-heading); font-size: 0.95rem;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.qitem__tag {
  flex: none;
  font-family: var(--font-mono); font-size: 0.64rem; font-weight: 600;
  letter-spacing: 0.06em;
  color: var(--slate-500); background: var(--slate-100);
  border: 1px solid var(--slate-200);
  padding: 0.1rem 0.4rem; border-radius: 5px;
}
.qitem__meta { font-size: 0.8rem; color: var(--text-muted); font-family: var(--font-mono); }
.qitem__status {
  display: inline-flex; align-items: center; gap: 0.35rem;
  font-size: 0.79rem; font-weight: 500; color: var(--text-muted);
  margin-top: 0.15rem;
}
.qitem__status svg { width: 14px; height: 14px; flex: none; }
.qitem__status[data-state="done"] { color: var(--success); font-weight: 600; }
.qitem__status[data-state="working"], .qitem__status[data-state="loading"] { color: var(--red-deep); }
.qitem__status[data-state="error"] { color: var(--error); font-weight: 600; }
.qitem.is-npot .qitem__status[data-state="ready"] { color: #B54708; }

.qitem__bar {
  display: block; height: 4px; margin-top: 0.4rem;
  background: var(--slate-200); border-radius: var(--radius-pill); overflow: hidden;
}
.qitem__bar i { display: block; height: 100%; width: 0; background: var(--red); transition: width 120ms linear; }

.qitem__actions { display: flex; align-items: center; gap: 0.4rem; flex: none; }
.icon-btn {
  width: 38px; height: 38px; flex: none;
  display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid var(--border); background: var(--white);
  border-radius: var(--radius-sm); color: var(--slate-500);
  transition: color var(--dur) var(--ease), border-color var(--dur) var(--ease), background var(--dur) var(--ease);
}
.icon-btn:hover { color: var(--red-deep); border-color: var(--red); background: var(--red-soft); }
.icon-btn svg { width: 18px; height: 18px; }
.icon-btn--go { color: #fff; background: var(--success); border-color: var(--success); }
.icon-btn--go:hover { color: #fff; background: #0B8A5F; border-color: #0B8A5F; }

/* ---------- Footer / actions ---------- */
.converter__footer {
  padding: var(--space-5);
  border-top: 1px solid var(--border);
  background: var(--slate-100);
}
.converter__progress { margin-bottom: var(--space-4); }
.converter__progress-track {
  display: block; height: 6px;
  background: var(--slate-200); border-radius: var(--radius-pill); overflow: hidden;
}
.converter__progress-track i {
  display: block; height: 100%; width: 0;
  background: linear-gradient(90deg, var(--red), var(--red-deep));
  border-radius: inherit;
  transition: width 140ms linear;
}
.converter__progress-label {
  display: block; margin-top: 0.45rem;
  font-family: var(--font-mono); font-size: 0.74rem; color: var(--text-muted);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

.converter__summary {
  margin-bottom: var(--space-4);
  padding: 0.6rem 0.85rem;
  border-radius: var(--radius-sm);
  background: var(--rating-soft);
  border: 1px solid rgba(0, 182, 122, 0.25);
  color: #06694A;
  font-size: 0.86rem;
  max-width: none;
}
.converter__summary b { color: #05543B; }

.converter__controls { display: flex; flex-wrap: wrap; gap: var(--space-4); }
.converter__controls .btn { flex: 1 1 auto; justify-content: center; min-width: 170px; }
.converter__note {
  margin-top: var(--space-4);
  font-size: 0.78rem;
  color: var(--text-muted);
  max-width: none;
}

/* ---------- Spinner + toast ---------- */
.spinner {
  width: 14px; height: 14px; border-radius: 50%; flex: none;
  border: 2px solid var(--red-soft); border-top-color: var(--red);
  animation: spin 0.7s linear infinite;
  display: inline-block;
}
@keyframes spin { to { transform: rotate(360deg); } }

.toast {
  position: fixed; left: 50%; bottom: 1.5rem;
  transform: translateX(-50%) translateY(20px);
  background: var(--ink); color: #fff;
  padding: 0.8rem 1.25rem; border-radius: var(--radius-pill);
  font-size: 0.9rem; font-weight: 500;
  box-shadow: var(--shadow-lg);
  opacity: 0; visibility: hidden;
  max-width: min(92vw, 460px); text-align: center;
  transition: opacity var(--dur) var(--ease), transform var(--dur) var(--ease), visibility var(--dur) var(--ease);
  z-index: 200;
}
.toast.is-show { opacity: 1; visibility: visible; transform: translateX(-50%) translateY(0); }
.toast[data-kind="success"] { background: #06694A; }
.toast[data-kind="error"] { background: var(--error); }

/* ---------- Busy state ---------- */
.converter.is-busy .dropzone { pointer-events: none; opacity: 0.6; }
.converter.is-busy .converter__options { opacity: 0.6; pointer-events: none; }

/* ==========================================================================
   How-to-use steps (4 cards)
   ========================================================================== */
.usesteps {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--space-5);
  counter-reset: usestep;
}
.usestep {
  position: relative;
  display: flex;
  flex-direction: column;
  padding: var(--space-6) var(--space-5) var(--space-5);
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: transform var(--dur) var(--ease), box-shadow var(--dur) var(--ease), border-color var(--dur) var(--ease);
}
.usestep::before {
  content: "";
  position: absolute; inset: 0 0 auto 0;
  height: 4px;
  background: linear-gradient(90deg, var(--red), #FF9A70);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 380ms var(--ease);
}
.usestep:hover { transform: translateY(-6px); box-shadow: var(--shadow-lg); border-color: transparent; }
.usestep:hover::before { transform: scaleX(1); }

.usestep__num {
  position: absolute;
  top: 0.35rem; right: 0.9rem;
  font-family: var(--font-mono);
  font-size: 3.4rem;
  font-weight: 700;
  line-height: 1;
  color: var(--slate-100);
  pointer-events: none;
  transition: color 280ms var(--ease), transform 320ms var(--ease);
}
.usestep:hover .usestep__num,
.usestep:focus-within .usestep__num {
  color: var(--red);
  transform: translateY(-2px);
}

.usestep__icon {
  position: relative;
  width: 50px; height: 50px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 14px;
  color: var(--red-deep);
  background: var(--red-soft);
  margin-bottom: var(--space-4);
  transition: background 280ms var(--ease), color 280ms var(--ease), transform 320ms var(--ease);
}
.usestep__icon svg { width: 25px; height: 25px; }
.usestep:hover .usestep__icon {
  background: var(--red);
  color: #fff;
  transform: translateY(-2px);
  box-shadow: 0 10px 22px -8px rgba(255, 67, 53, 0.55);
}

.usestep__title { position: relative; font-size: var(--fs-h4); margin-bottom: 0.5rem; }
.usestep__text { color: var(--text-muted); font-size: 0.93rem; flex: 1; }
.usestep__tip {
  margin-top: var(--space-4);
  padding-top: 0.8rem;
  border-top: 1px dashed var(--slate-200);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--slate-500);
}

/* ==========================================================================
   Breakpoints — kept in this file because it loads after responsive.css
   ========================================================================== */
@media (max-width: 1024px) {
  .usesteps { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 860px) {
  .converter__workspace { grid-template-columns: 1fr; }
  .dropzone { padding: var(--space-6) var(--space-5); }
}

@media (max-width: 640px) {
  .converter__body { padding: var(--space-4); gap: var(--space-4); }
  .converter__workspace { gap: var(--space-4); }
  .converter__footer { padding: var(--space-4); }
  .converter__options { padding: var(--space-4); gap: var(--space-4); }
  .flipbtn__label small { display: none; }
  .converter__controls { gap: 0.6rem; }
  .converter__controls .btn { flex: 1 1 100%; min-width: 0; }
  .dropzone { padding: var(--space-6) var(--space-4); }
  .dropzone__icon { width: 54px; height: 54px; border-radius: 16px; }
  .dropzone__icon svg { width: 25px; height: 25px; }
  .dropzone__title { font-size: 1.05rem; }
  .qitem { grid-template-columns: 56px 1fr; padding: 0.65rem; gap: 0.75rem; }
  .qitem__thumb { width: 56px; height: 56px; }
  .qitem__actions { grid-column: 1 / -1; justify-content: flex-end; }
  .usesteps { grid-template-columns: 1fr; gap: var(--space-4); }
  .usestep { padding: var(--space-5); }
  .usestep__num { font-size: 2.8rem; }
}

@media (max-width: 420px) {
  .converter__bar-title { display: none; }
}
