/* Same look as the other Tool Newt sites. Each site keeps its own copy on purpose. */
:root {
  --paper: #f6f4ee;
  --card: #ffffff;
  --ink: #1f2a24;
  --muted: #56635b;
  --line: #d9d5c8;
  --green: #2f7d5b;
  --green-strong: #25664a;
  --on-green: #ffffff;
  --orange: #e8622c;
  --error-bg: #fdece4;
  --error-ink: #8a2f0b;
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :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;
  }
}

*,
*::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 two file boxes --- */

.slots {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem;
}

@media (max-width: 35rem) {
  .slots {
    grid-template-columns: minmax(0, 1fr);
  }
}

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

.dropzone-title {
  font-weight: 700;
}

.dropzone-text {
  color: var(--muted);
  font-size: 0.9rem;
}

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

.slot.is-filled .dropzone {
  border-style: solid;
}

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

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

.slot-file {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0.4rem 0 0;
  min-width: 0;
}

.slot-file[hidden] {
  display: none;
}

/* A long name is cut short with an ellipsis; the page count always stays. */
.file-info {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: baseline;
  gap: 0.4rem;
}

.file-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 600;
}

.file-pages {
  flex: none;
  color: var(--muted);
  font-size: 0.875rem;
  white-space: nowrap;
}

.text-button {
  flex: none;
  padding: 0.2rem 0.6rem;
  border: 1px solid var(--line);
  border-radius: 0.5rem;
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-size: 0.875rem;
  cursor: pointer;
}

.text-button:hover:not(:disabled) {
  border-color: var(--green);
}

.text-button:disabled {
  opacity: 0.4;
  cursor: default;
}

/* --- Options --- */

.options {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem;
  margin-top: 1.25rem;
}

@media (max-width: 35rem) {
  .options {
    grid-template-columns: minmax(0, 1fr);
  }
}

.option {
  margin: 0;
  padding: 0.6rem 0.9rem 0.75rem;
  border: 1px solid var(--line);
  border-radius: 0.6rem;
  min-width: 0;
}

.option legend {
  padding: 0 0.3rem;
  font-weight: 700;
  font-size: 0.9rem;
}

.option label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.2rem 0;
  cursor: pointer;
}

.option input {
  width: 1.1rem;
  height: 1.1rem;
  margin: 0;
  accent-color: var(--green);
}

.hint {
  margin: 0.5rem 0 0;
  color: var(--muted);
  font-size: 0.875rem;
}

/* --- Messages, button, 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 {
  display: block;
  width: 100%;
  margin-top: 1.25rem;
  padding: 0.85rem 1.25rem;
  border: 0;
  border-radius: 0.7rem;
  background: var(--green);
  color: var(--on-green);
  font: inherit;
  font-size: 1.1rem;
  font-weight: 700;
  cursor: pointer;
}

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

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

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

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

/* --- 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;
  }
}
