/* Same look as the other Tool Newt sites. Each site keeps its own copy on purpose. */
/* One colour scheme for everyone: the dark green one. It does not follow the
   visitor's light or dark setting. */
:root {
  --paper: #141a17;
  --card: #1c2420;
  --ink: #e9efe9;
  --muted: #a3b0a8;
  --line: #34403a;
  --green: #2f7d5b;
  --green-strong: #38916a;
  --on-green: #ffffff;
  --orange: #ff8a4f;
  --error-bg: #3a1e12;
  --error-ink: #ffc7ae;
  color-scheme: dark;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--paper);
  color: var(--ink);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 1rem;
  line-height: 1.5;
}

.site-header,
main,
.site-footer {
  width: 100%;
  max-width: 42rem;
  margin: 0 auto;
  padding: 0 1rem;
}

.site-header {
  padding-top: 1rem;
  padding-bottom: 0.5rem;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--ink);
  font-weight: 700;
  font-size: 1.15rem;
  text-decoration: none;
  border-radius: 0.5rem;
}

.brand:hover span {
  text-decoration: underline;
}

main {
  flex: 1;
  padding-bottom: 2rem;
}

h1 {
  margin: 1rem 0 0.25rem;
  font-size: 2rem;
  line-height: 1.2;
}

.intro {
  margin: 0;
  font-size: 1.1rem;
}

.tagline {
  margin: 0 0 1.25rem;
  color: var(--muted);
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

/* --- The box a picture is dropped on --- */

.dropzone {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  min-height: 8rem;
  padding: 1.5rem;
  border: 2px dashed var(--green);
  border-radius: 0.9rem;
  background: var(--card);
  color: var(--ink);
  font-weight: 600;
  text-align: center;
  cursor: pointer;
  transition: background-color 0.15s, border-color 0.15s;
}

.dropzone:hover,
.dropzone.is-dragover {
  border-color: var(--orange);
  background: color-mix(in srgb, var(--orange) 10%, var(--card));
}

.dropzone.is-disabled {
  cursor: default;
  opacity: 0.6;
}

.dropzone:focus-within,
:focus-visible {
  outline: 3px solid var(--orange);
  outline-offset: 2px;
}

/* The small copy of the picture. It is drawn larger than it is shown, so it
   stays sharp on dense screens. */
.preview {
  display: block;
  max-width: 100%;
  max-height: 12rem;
  border-radius: 0.4rem;
  background: #ffffff;
}

.preview[hidden] {
  display: none;
}

/* --- Language, and reading again --- */

.controls {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 0.75rem;
  margin-top: 1.25rem;
}

.field {
  display: block;
  min-width: 0;
}

.controls .field {
  flex: 1 1 12rem;
}

.field-label {
  display: block;
  margin-bottom: 0.3rem;
  font-weight: 700;
  font-size: 0.9rem;
}

.select,
.text-box {
  display: block;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 0.6rem;
  background: var(--card);
  color: var(--ink);
  font: inherit;
}

.select {
  height: 2.75rem;
  padding: 0 0.75rem;
}

.text-box {
  min-height: 10rem;
  padding: 0.75rem;
  line-height: 1.45;
  resize: vertical;
}

/* While a picture is being read the text cannot be changed, because it is
   about to be replaced. */
.text-box:read-only {
  color: var(--muted);
}

/* --- Messages, buttons, status --- */

/* The message and status areas are live regions for screen readers. They stay
   in the layout while empty, because a region that is hidden when its text
   arrives is announced unreliably. The box styling sits on each message. */
.messages p {
  margin: 1rem 0 0;
  padding: 0.75rem 1rem;
  border-radius: 0.6rem;
  background: var(--error-bg);
  color: var(--error-ink);
  overflow-wrap: anywhere;
}

.messages p + p {
  margin-top: 0.4rem;
}

.action-button,
.plain-button {
  padding: 0.7rem 1.1rem;
  border-radius: 0.7rem;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.action-button {
  border: 0;
  background: var(--green);
  color: var(--on-green);
}

.action-button:hover:not(:disabled) {
  background: var(--green-strong);
}

.plain-button {
  border: 1px solid var(--green);
  background: transparent;
  color: var(--ink);
}

.plain-button:hover:not(:disabled) {
  background: color-mix(in srgb, var(--green) 18%, transparent);
}

.action-button:disabled,
.plain-button:disabled {
  border-color: var(--line);
  background: var(--line);
  color: var(--muted);
  cursor: default;
}

.controls .plain-button {
  height: 2.75rem;
  padding-top: 0;
  padding-bottom: 0;
}

.result-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 0.75rem;
}

.result-buttons button {
  flex: 1 1 12rem;
}

.status {
  min-height: 1.5rem;
  margin: 1rem 0 0.75rem;
  color: var(--muted);
  overflow-wrap: anywhere;
}

.site-footer {
  padding-top: 1rem;
  padding-bottom: 1.5rem;
  color: var(--muted);
  font-size: 0.875rem;
  text-align: center;
}

.site-footer a {
  color: inherit;
}

/* --- Explanatory text below the tool --- */

.about {
  margin-top: 2.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--line);
}

.about h2 {
  margin: 0 0 0.5rem;
  font-size: 1.25rem;
  line-height: 1.3;
}

.about h3 {
  margin: 1.25rem 0 0.25rem;
  font-size: 1rem;
}

.about p {
  margin: 0 0 0.75rem;
  color: var(--muted);
}

.steps {
  margin: 0;
  padding-left: 1.25rem;
  color: var(--muted);
}

.steps li + li {
  margin-top: 0.35rem;
}

.about code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.9em;
}

@media (prefers-reduced-motion: reduce) {
  * {
    transition: none !important;
  }
}
