@import url("https://fonts.bunny.net/css?family=archivo-black:400|ibm-plex-mono:400,500|public-sans:400,600");

:root {
  color-scheme: light;
  --paper: #f2f5f7;
  --ink: #14171a;
  --muted: #68727a;
  --line: #c7cfd5;
  --steel: #dfe5e9;
  --signal: #1d63ff;
  --white: #ffffff;
  font-family: "Public Sans", sans-serif;
}

* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; background: var(--paper); color: var(--ink); }
button, input { font: inherit; }
button { color: inherit; }
main { width: min(1180px, calc(100% - 40px)); margin: 0 auto; }

header {
  height: 58px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
  font-family: "IBM Plex Mono", monospace;
  font-size: 12px;
}

header p { margin: 0; color: var(--muted); }
.wordmark { color: var(--ink); text-decoration: none; font-weight: 500; }
.wordmark span { color: var(--muted); font-weight: 400; }

.workbench { padding: clamp(20px, 3vh, 32px) 0 18px; }
.intro { display: grid; grid-template-columns: 1fr 2fr; align-items: end; margin-bottom: 18px; }
.kicker, .formats { margin: 0; font-family: "IBM Plex Mono", monospace; font-size: 11px; text-transform: uppercase; letter-spacing: .06em; }
.kicker { align-self: start; color: var(--signal); }
.formats { grid-column: 1; color: var(--muted); }
h1 {
  grid-column: 2;
  grid-row: 1 / span 2;
  margin: 0;
  font-family: "Archivo Black", sans-serif;
  font-size: clamp(44px, 5.4vw, 72px);
  line-height: .82;
  letter-spacing: -.065em;
  text-transform: uppercase;
}

.machine { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(320px, .7fr); height: clamp(460px, calc(100dvh - 275px), 610px); border: 1px solid var(--ink); background: var(--white); }
.dropzone { position: relative; display: grid; place-items: center; overflow: hidden; min-height: 0; cursor: pointer; background-image: linear-gradient(var(--line) 1px, transparent 1px), linear-gradient(90deg, var(--line) 1px, transparent 1px); background-size: 24px 24px; }
.dropzone::after { content: "+"; position: absolute; right: 18px; top: 10px; font: 44px/1 "IBM Plex Mono", monospace; color: var(--signal); }
.dropzone.dragging { box-shadow: inset 0 0 0 7px var(--signal); }
.dropzone input { position: absolute; opacity: 0; pointer-events: none; }
.drop-copy { position: relative; z-index: 1; display: grid; gap: 7px; padding: 18px 22px; background: var(--white); border: 1px solid var(--ink); text-align: center; }
.drop-copy strong { font-size: 16px; }
.drop-copy small { color: var(--muted); }
.dropzone img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; background: var(--steel); }

.controls { display: flex; flex-direction: column; border-left: 1px solid var(--ink); }
fieldset { border: 0; margin: 0; padding: 16px 18px; }
legend { padding: 16px 18px 0; font: 11px "IBM Plex Mono", monospace; color: var(--muted); text-transform: uppercase; letter-spacing: .08em; }
.format-grid { display: grid; grid-template-columns: repeat(3, 1fr); border-top: 1px solid var(--line); border-left: 1px solid var(--line); }
.format-grid button { min-height: 44px; border: 0; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); background: var(--white); font: 500 12px "IBM Plex Mono", monospace; cursor: pointer; }
.format-grid button:hover, .format-grid button:focus-visible { background: var(--steel); }
.format-grid button.selected { background: var(--ink); color: var(--white); }

.size-fieldset { border-top: 1px solid var(--line); }
.size-grid { display: grid; grid-template-columns: 1fr 1fr auto; border: 1px solid var(--line); }
.size-grid label { display: flex; align-items: center; gap: 8px; min-width: 0; padding-left: 10px; border-right: 1px solid var(--line); color: var(--muted); font: 11px "IBM Plex Mono", monospace; }
.size-grid label:last-child { border-right: 0; }
.size-grid input[type="number"] { min-width: 0; width: 100%; height: 42px; padding: 0 8px 0 0; border: 0; background: transparent; color: var(--ink); font: 500 12px "IBM Plex Mono", monospace; text-align: right; }
.size-grid .lock { padding: 0 10px; cursor: pointer; }
.size-grid .lock input { accent-color: var(--signal); }

.quality-row { display: grid; gap: 12px; padding: 16px 18px; border-top: 1px solid var(--line); }
.quality-row span { display: flex; justify-content: space-between; font: 11px "IBM Plex Mono", monospace; text-transform: uppercase; letter-spacing: .06em; }
.quality-row output { color: var(--signal); }
input[type="range"] { width: 100%; accent-color: var(--signal); }
.quality-row[hidden] { display: none; }

.convert-button { display: flex; justify-content: space-between; align-items: center; margin-top: auto; min-height: 68px; padding: 0 18px; border: 0; border-top: 1px solid var(--ink); background: var(--signal); color: var(--white); font-size: 17px; font-weight: 600; cursor: pointer; }
.convert-button:hover:not(:disabled), .convert-button:focus-visible:not(:disabled) { background: #004ce0; }
.convert-button:disabled { background: var(--steel); color: var(--muted); cursor: not-allowed; }
.convert-button.busy span:last-child { animation: working 900ms steps(2, end) infinite alternate; }
.status { min-height: 44px; margin: 0; padding: 13px 18px; border-top: 1px solid var(--line); color: var(--muted); font: 11px/1.5 "IBM Plex Mono", monospace; }
.status.error { color: #b42318; }

@keyframes working { to { transform: translate(4px, 4px); } }

:focus-visible { outline: 3px solid var(--signal); outline-offset: 3px; }

@media (max-width: 760px) {
  main { width: min(100% - 24px, 640px); }
  header p { display: none; }
  .intro { display: block; }
  .kicker { margin-bottom: 28px; }
  h1 { margin-bottom: 30px; }
  .machine { grid-template-columns: 1fr; height: auto; }
  .dropzone { min-height: 330px; }
  .controls { border-left: 0; border-top: 1px solid var(--ink); }
}

@media (prefers-reduced-motion: no-preference) {
  .drop-copy, .convert-button { transition: transform 140ms ease, background 140ms ease; }
  .dropzone:hover .drop-copy { transform: translateY(-3px); }
}

@media (prefers-reduced-motion: reduce) {
  .convert-button.busy span:last-child { animation: none; }
}
