@font-face {
  font-family: Geist;
  src: url("/geist-latin.woff2") format("woff2");
  font-weight: 100 900;
  font-display: swap;
}

:root {
  color-scheme: light;
  --page: #fafbf9;
  --ink: #26272b;
  --muted: #55565d;
  --line: #e6e7e9;
  --field: #88848f;
  --accent: #685080;
  --accent-hover: #523c69;
  --accent-tint: #f5f1fa;
  --focus: #74549f;
  --success: #286048;
  --danger: #8a2d2d;
  font: 100% / 1.5 Geist, system-ui, sans-serif;
  color: var(--ink);
  background: var(--page);
}

*, *::before, *::after { box-sizing: border-box; }
::selection { background: #ede9f6; color: #5b4474; }

main {
  width: min(100% - 2rem, 42rem);
  margin: clamp(1.5rem, 6vw, 4rem) auto;
}

h1 {
  margin: 0;
  font-size: clamp(1.75rem, 5vw, 2.375rem);
  line-height: 1.15;
  letter-spacing: -.035em;
}

header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: .5rem 1rem;
  margin-bottom: 1.5rem;
}
header p { grid-column: 1 / -1; margin: 0; color: var(--muted); }
.language-control { display: flex; align-items: center; gap: .55rem; }
#language { width: auto; }

form {
  padding: clamp(1rem, 4vw, 2rem);
  background: white;
  border: 1px solid var(--line);
  border-radius: 14px;
}

fieldset { border: 0; padding: 0; margin: 0; min-inline-size: 0; }
.fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1.125rem; }
.field { display: grid; align-content: start; gap: .35rem; min-width: 0; }
.full { grid-column: 1 / -1; }

.sample {
  display: grid;
  gap: .35rem;
  margin-bottom: 1.5rem;
  padding: .875rem 1rem 1rem;
  border: 1px solid #e4dded;
  border-radius: 8px;
  background: var(--accent-tint);
}

label { font-size: .9375rem; font-weight: 600; }
input, textarea, select, button { font: inherit; }
:is(input, select, textarea):not([type="file"]) {
  width: 100%;
  min-width: 0;
  min-height: 44px;
  padding: .5rem .7rem;
  color: var(--ink);
  background-color: white;
  border: 1px solid var(--field);
  border-radius: 8px;
}

textarea { resize: vertical; caret-color: var(--accent); }
select:not([type="file"]) {
  appearance: none;
  padding-inline-end: 2.4rem;
  background: white url("/chevron.svg") no-repeat right .8rem center / 1rem;
}

:focus-visible, .file-picker:focus-within { outline: 3px solid var(--focus); outline-offset: 3px; }
.hint { margin: 0; color: var(--muted); font-size: .875rem; }
button, .file-picker {
  min-height: 44px;
  padding: .5rem .9rem;
  border-radius: 8px;
  font-weight: 600;
}
button:disabled, fieldset:disabled .file-picker { opacity: .6; }
button:not(:disabled) { cursor: pointer; }
#send {
  margin-top: 1.25rem;
  border: 1px solid transparent;
  background: var(--accent);
  color: white;
}
#send:hover:not(:disabled) { background: var(--accent-hover); }
.file-picker {
  position: relative;
  width: fit-content;
  border: 1px solid var(--field);
  color: var(--accent);
  margin-top: .2rem;
}
.file-picker:hover, .remove:hover { background: var(--accent-tint); }
.file-picker input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
}
#file-list { list-style: none; padding: 0; margin: 0; }
#file-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .5rem;
  border-bottom: 1px solid var(--line);
  padding-block: .2rem;
}
#file-list li span { overflow-wrap: anywhere; font-size: .875rem; }
.remove {
  flex: none;
  border: 0;
  background: transparent;
  color: var(--accent);
  font-size: .875rem;
}
.result { margin: 1rem 0 0; color: var(--success); overflow-wrap: anywhere; }
.error { color: var(--danger); }
#file-error { margin: 0; font-size: .875rem; }
.result:empty, #file-error:empty, #file-list:empty { display: none; }

@media (max-width: 36rem) {
  header { grid-template-columns: minmax(0, 1fr); }
  .language-control { order: 1; justify-self: start; margin-top: .35rem; }
  .fields { grid-template-columns: minmax(0, 1fr); }
  .sample { padding-inline: .75rem; }
  #send { width: 100%; }
}
