/* ZIP → MRPACK. A visual sibling of mrpack-to-zip: same workbench, same tokens.
 *
 * Every selector is #tool-root-scoped because css/tool-theme.css loads AFTER this file and wins
 * any tie. Its generic button rules reach (1,3,1) with :hover, so the rules that must beat them go
 * through the widget's own id, (2,x,y) — see the actions. Class names avoid the substrings
 * tool-theme.css matches on: -panel, -card, -box, -section, -out, tab, chip, pill and result would
 * each pull in a generic skin.
 *
 * Two greens, measured: --grass is for fills and borders only. As TEXT it is #059669 on the light
 * theme, 3.77:1 on these surfaces — the kicker, the numerals and the success line all failed AA.
 * --grass-bright is defined per theme (#065f46 light, #34d399 dark), which is why tool-theme.css
 * already draws link text with it. */

#tool-root .z2m {
  --z2m-accent: var(--grass);
  --z2m-accent-ink: var(--grass-bright);
  --z2m-ink: var(--site-fg);
  max-width: 1040px;
  color: var(--z2m-ink);
}

#tool-root .z2m-workbench {
  display: grid;
  grid-template-columns: minmax(0, 1.62fr) minmax(250px, .78fr);
  overflow: hidden;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: var(--surface);
  box-shadow: 0 20px 54px -38px rgba(0, 0, 0, .7);
}

#tool-root .z2m-main { min-width: 0; padding: clamp(20px, 4vw, 38px); }
#tool-root .z2m-summary {
  padding: clamp(20px, 3vw, 32px);
  background:
    linear-gradient(145deg, rgba(16, 185, 129, .08), transparent 58%),
    var(--surface-2);
  border-inline-start: 1px solid var(--line);
}

#tool-root .z2m-heading { margin-bottom: 22px; }
#tool-root .z2m-kicker {
  display: inline-block;
  margin-bottom: 8px;
  color: var(--z2m-accent-ink);
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 1.6px;
}
#tool-root .z2m-heading h2 { margin: 0 0 7px; font-size: clamp(21px, 3vw, 30px); line-height: 1.2; }
#tool-root .z2m-heading p { margin: 0; color: var(--fg-muted); }

/* ---------- drop zone ---------- */
#tool-root .z2m-drop {
  position: relative;
  min-height: 210px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 25px;
  text-align: center;
  cursor: pointer;
  border: 1px dashed var(--line-strong);
  border-radius: 5px;
  background:
    linear-gradient(var(--surface-2), var(--surface-2)) padding-box,
    repeating-linear-gradient(135deg, transparent 0 9px, rgba(16, 185, 129, .04) 9px 10px);
  transition: border-color 140ms, transform 140ms, background-color 140ms;
}
#tool-root .z2m-drop:hover,
#tool-root .z2m-drop:focus-within,
#tool-root .z2m-drop.is-dragging {
  border-color: var(--z2m-accent);
  background-color: rgba(16, 185, 129, .05);
}
#tool-root .z2m-drop.is-dragging { transform: translateY(-1px); }
/* The inputs stay in the tab order (a keyboard user opens the picker with Enter), but paint nothing:
 * the two labels below are what a pointer user sees. */
#tool-root .z2m-drop input[type="file"] {
  position: absolute;
  inset-inline-start: 0;
  top: 0;
  inline-size: 1px;
  block-size: 1px;
  padding: 0;
  border: 0;
  opacity: 0;
  pointer-events: none;
}
#tool-root .z2m-drop strong { margin-top: 10px; font-size: 16px; }
#tool-root .z2m-drop > span:not(.z2m-cube):not(.z2m-pick) { color: var(--fg-muted); font-size: 13px; }
#tool-root .z2m-pick { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-top: 8px; }
#tool-root .z2m-browse {
  padding: 7px 13px;
  border: 1px solid var(--line-strong);
  border-radius: 3px;
  background: var(--surface-3);
  color: var(--z2m-ink);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}
#tool-root .z2m-browse:hover { border-color: var(--z2m-accent); }
#tool-root .z2m-drop:has(#z2m-input:focus-visible) .z2m-browse[for="z2m-input"],
#tool-root .z2m-drop:has(#z2m-folder:focus-visible) .z2m-browse[for="z2m-folder"] {
  outline: 2px solid var(--z2m-accent);
  outline-offset: 2px;
}

#tool-root .z2m-cube { position: relative; inline-size: 46px; block-size: 46px; transform: rotate(30deg) skewY(-15deg) scale(.84); }
#tool-root .z2m-cube i { position: absolute; inset: 0; display: block; border: 2px solid var(--z2m-accent); background: rgba(16, 185, 129, .1); }
#tool-root .z2m-cube i:nth-child(2) { transform: translate(23px, 13px) skewY(30deg) scaleX(.86); opacity: .65; }
#tool-root .z2m-cube i:nth-child(3) { transform: translate(-23px, 13px) skewY(30deg) scaleX(.86); opacity: .38; }

/* ---------- what was added ---------- */
#tool-root .z2m-inputs { display: grid; gap: 7px; margin: 12px 0 0; padding: 0; list-style: none; }
#tool-root .z2m-inputs[hidden] { display: none; }
#tool-root .z2m-inputs li {
  display: flex;
  align-items: center;
  gap: 11px;
  min-width: 0;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--surface-2);
}
#tool-root .z2m-input-icon {
  display: grid;
  place-items: center;
  inline-size: 34px;
  block-size: 36px;
  flex: 0 0 auto;
  border: 1px solid var(--line-strong);
  color: var(--z2m-accent-ink);
  font: 800 13px var(--font-mono);
}
#tool-root .z2m-input-copy { min-width: 0; flex: 1; display: grid; }
#tool-root .z2m-input-copy strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#tool-root .z2m-input-copy small { color: var(--fg-muted); font-size: 12px; }
#tool-root .z2m-input-copy small.is-bad { color: var(--redstone); }
/* The generic button rule already draws this one well (surface-2, hairline, 8px 13px). Left to it. */

#tool-root .z2m-progress { height: 6px; margin-top: 14px; overflow: hidden; border-radius: 99px; background: var(--surface-3); }
#tool-root .z2m-progress[hidden] { display: none; }
#tool-root .z2m-progress i { display: block; width: 0; height: 100%; background: var(--z2m-accent); transition: width 140ms linear; }
#tool-root .z2m-status { min-height: 23px; margin: 9px 0 0; color: var(--fg-muted); font-size: 13px; }
#tool-root .z2m-status.is-error { color: var(--redstone); }
#tool-root .z2m-status.is-success { color: var(--z2m-accent-ink); }
#tool-root .z2m-status a { margin-inline-start: 6px; font-weight: 700; }

/* ---------- details form ---------- */
#tool-root .z2m-details { display: grid; gap: 14px; margin-top: 16px; }
#tool-root .z2m-details[hidden] { display: none; }
#tool-root .z2m-group {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px 12px;
  margin: 0;
  padding: 14px 16px 16px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--surface-2);
}
#tool-root .z2m-group legend {
  padding: 0 6px;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .8px;
  text-transform: uppercase;
}
#tool-root .z2m-field { display: grid; gap: 5px; min-width: 0; }
#tool-root .z2m-field > span { color: var(--fg-muted); font-size: 12px; font-weight: 700; }
#tool-root .z2m-field input,
#tool-root .z2m-field select { width: 100%; min-width: 0; box-sizing: border-box; }
#tool-root .z2m-field input.is-invalid,
#tool-root .z2m-field select.is-invalid { border-color: var(--redstone); }
#tool-root .z2m-wide { grid-column: span 2; }
#tool-root .z2m-full { grid-column: 1 / -1; }
#tool-root .z2m-source { margin: 0; color: var(--fg-muted); font-size: 12px; line-height: 1.5; }
#tool-root .z2m-source:empty { display: none; }
#tool-root .z2m-hint { margin: 0; font-size: 12px; line-height: 1.5; }

/* Candidate values the mods disagree on. Scoped through the widget's own id — see the actions. */
#tool-root #z2m-app .z2m-suggest {
  margin: 4px 6px 0 0;
  padding: 3px 9px;
  font: 700 12px var(--font-mono);
  color: var(--z2m-ink);
}
[dir="rtl"] #tool-root #z2m-app .z2m-suggest { margin: 4px 0 0 6px; }

#tool-root .z2m-folders { display: flex; flex-wrap: wrap; gap: 7px; }
#tool-root .z2m-folders label {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  max-width: 100%;
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: 3px;
  background: var(--surface);
  font-size: 13px;
  cursor: pointer;
}
#tool-root .z2m-folders label:has(input:checked) { border-color: var(--z2m-accent); }
#tool-root .z2m-folders code { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#tool-root .z2m-folders small { color: var(--fg-muted); font-size: 11px; white-space: nowrap; }

/* ---------- actions ---------- */
#tool-root .z2m-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 18px; }
#tool-root #z2m-app .z2m-actions [hidden] { display: none; }
/* Through the widget's OWN id, (2,x,y). tool-theme.css loads after this file and wins ties, and its
 * button rules reach (1,3,1) once `:hover` is counted — which is how mrpack-to-zip's primary button,
 * (1,2,0), ends up painted as a generic grey button. Nothing with one id can outrank two. */
#tool-root #z2m-app .z2m-act {
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 9px 16px;
  border: 1px solid var(--line-strong);
  border-radius: 3px;
  background: var(--surface-2);
  color: var(--z2m-ink);
  text-decoration: none;
  font: 700 14px var(--font-ui);
  cursor: pointer;
}
#tool-root #z2m-app .z2m-act:hover:not(:disabled) { border-color: var(--z2m-accent); }
/* The accent, not tool-theme's "anything called primary" rule: that one paints grass-bright on
 * grass-deep, and grass-deep is only defined for the dark theme (CLAUDE.md, "Writing widget CSS"). */
#tool-root #z2m-app .z2m-act.z2m-primary,
#tool-root #z2m-app .z2m-act.z2m-download {
  color: #04120c;
  background: var(--z2m-accent);
  border-color: var(--z2m-accent);
}
#tool-root #z2m-app .z2m-act.z2m-download.is-partial {
  color: var(--z2m-ink);
  background: var(--surface-2);
  border-color: var(--redstone);
}
#tool-root #z2m-app .z2m-act:disabled { cursor: not-allowed; opacity: .45; }
#tool-root .z2m-problem { margin: 9px 0 0; color: var(--redstone); font-size: 13px; }
#tool-root .z2m-problem[hidden] { display: none; }

/* ---------- report ---------- */
#tool-root .z2m-report { display: grid; gap: 10px; margin-top: 18px; }
#tool-root .z2m-report[hidden],
#tool-root .z2m-report [hidden] { display: none; }
#tool-root .z2m-missing {
  padding: 13px 15px;
  border: 1px solid rgba(239, 68, 68, .32);
  border-radius: 4px;
  background: rgba(239, 68, 68, .06);
}
#tool-root .z2m-missing h3 { margin: 0 0 6px; font-size: 14px; }
#tool-root .z2m-missing p { margin: 0 0 8px; color: var(--fg-muted); font-size: 13px; line-height: 1.55; }
#tool-root .z2m-report details {
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--surface-2);
}
#tool-root .z2m-report summary { cursor: pointer; font-size: 14px; font-weight: 700; }
#tool-root .z2m-report ul {
  display: grid;
  gap: 5px;
  max-height: 320px;
  margin: 8px 0 0;
  padding: 0;
  list-style: none;
  overflow: auto;
  font-size: 12.5px;
}
/* One row per file, spaced by `gap`, not margin-inline-start. On the Arabic page that margin flipped
 * sides with direction: rtl while the path inside still painted LTR, and "785 B" ran straight into
 * "Modrinth does not host…"; the list bullets also sat on the far right, away from their rows. */
#tool-root .z2m-report li {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 3px 8px;
  color: var(--fg-muted);
  overflow-wrap: anywhere;
}
#tool-root .z2m-report li code { color: var(--z2m-ink); }
#tool-root .z2m-report li a { font-weight: 700; }
#tool-root .z2m-report details p { margin: 8px 0 0; color: var(--fg-muted); font-size: 13px; line-height: 1.55; }

/* ---------- summary ---------- */
#tool-root .z2m-summary-empty { min-height: 100%; display: grid; align-content: center; gap: 16px; }
#tool-root .z2m-summary-empty[hidden] { display: none; }
#tool-root .z2m-summary-empty > span { color: var(--z2m-accent-ink); font-size: 30px; }
#tool-root .z2m-summary-empty p { margin: 0; color: var(--fg-muted); font-size: 13px; line-height: 1.65; }
#tool-root .z2m-summary dl { display: grid; gap: 0; margin: 0; }
#tool-root .z2m-summary dl[hidden] { display: none; }
#tool-root .z2m-summary dl > div { padding: 13px 0; border-bottom: 1px solid var(--line); }
#tool-root .z2m-summary dt { color: var(--fg-muted); font-size: 10px; font-weight: 800; letter-spacing: 1.2px; text-transform: uppercase; }
#tool-root .z2m-summary dd { margin: 3px 0 0; overflow-wrap: anywhere; font-weight: 700; }

/* ---------- explanation ---------- */
#tool-root .z2m-explain { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin-top: 14px; }
#tool-root .z2m-explain article {
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr);
  gap: 11px;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--surface);
}
#tool-root .z2m-explain article > span { color: var(--z2m-accent-ink); font: 800 12px var(--font-mono); }
#tool-root .z2m-explain h2 { margin: 0 0 7px; font-size: 15px; }
#tool-root .z2m-explain p { margin: 0; color: var(--fg-muted); font-size: 13px; line-height: 1.6; }
#tool-root .z2m-explain .z2m-note { margin-top: 9px; color: var(--z2m-ink); font-weight: 650; }

/* ---------- right-to-left ----------
 * tool-theme.css forces every widget LTR on RTL pages, which is right for an English technical UI.
 * This one is written to be translated, so it restores RTL for its layout, as mrpack-to-zip does —
 * and lets each text block pick its own direction from its first strong character, so a sentence
 * that is still English keeps its full stop on the right while a translated one flows RTL. File
 * names, paths, versions and hashes are isolated LTR so "mods/x.jar" never paints as "x.jar/mods". */
[dir="rtl"] #tool-root .z2m { direction: rtl; }
[dir="rtl"] #tool-root .z2m :is(h2, h3, p, li, legend, summary, strong, small, dt, .z2m-field > span, .z2m-drop > span) {
  unicode-bidi: plaintext;
}
/* The loader select is here too: tool-theme.css draws every select's arrow at the RIGHT edge, and
 * right-aligned RTL text ran into it ("Forg⌄e"). Its options are Latin product names anyway. */
[dir="rtl"] #tool-root .z2m :is(code, .z2m-kicker, .z2m-ltr, dd, #z2m-version, #z2m-minecraft, #z2m-loader-version, #z2m-loader) {
  direction: ltr;
  unicode-bidi: isolate;
}
/* Label and value share an edge. An English dt under plaintext aligned LEFT while its LTR dd was
 * pushed right, so each pair split across the column. */
[dir="rtl"] #tool-root .z2m-summary :is(dt, dd) { text-align: right; }

@media (max-width: 860px) {
  #tool-root .z2m-explain { grid-template-columns: 1fr; }
}

@media (max-width: 760px) {
  #tool-root .z2m-workbench { grid-template-columns: 1fr; }
  #tool-root .z2m-summary { border-inline-start: 0; border-top: 1px solid var(--line); }
  #tool-root .z2m-summary-empty { min-height: 110px; }
  #tool-root .z2m-summary dl { grid-template-columns: 1fr 1fr; column-gap: 18px; }
  #tool-root .z2m-group { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  #tool-root .z2m-wide { grid-column: 1 / -1; }
}

@media (max-width: 470px) {
  #tool-root .z2m-main { padding: 17px; }
  #tool-root .z2m-drop { min-height: 190px; padding: 18px 12px; }
  #tool-root .z2m-group { grid-template-columns: 1fr; padding: 12px; }
  #tool-root .z2m-summary dl { grid-template-columns: 1fr; }
  #tool-root .z2m-actions > * { width: 100%; }
}
