/*
 * LeMay Originate: the interface's one stylesheet.
 *
 * Light and dark palettes follow the reader's preference, every text color
 * meets WCAG AA contrast against its ground, focus is always visible, motion
 * yields to a reduced-motion preference, and the two panes stack below 800
 * pixels. No element carries an inline style, and no font is fetched: the
 * stacks name faces the reader's system already holds.
 */

:root {
  color-scheme: light dark;
  --ground: #f7f5f0;
  --surface: #ffffff;
  --ink: #1b1d22;
  --muted: #4a4f5a;
  --line: #cfcabe;
  --accent: #1f4e79;
  --accent-hover: #173b5c;
  --accent-ink: #ffffff;
  --focus: #b45309;
  --warn: #9b1c1c;
  --shadow: 0 1px 2px rgb(27 29 34 / 8%), 0 6px 20px rgb(27 29 34 / 6%);
  --radius: 10px;
  --sans: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --ground: #12151a;
    --surface: #1a1e25;
    --ink: #eceff4;
    --muted: #b3b9c4;
    --line: #353c48;
    --accent: #8cb4e0;
    --accent-hover: #a9c8ea;
    --accent-ink: #0d1117;
    --focus: #f5b041;
    --warn: #f28b82;
    --shadow: 0 1px 2px rgb(0 0 0 / 40%), 0 6px 20px rgb(0 0 0 / 30%);
  }
}

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

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--ground);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 1rem;
  line-height: 1.5;
}

a {
  color: var(--accent);
}

a:hover {
  color: var(--accent-hover);
}

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

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

.noscript {
  max-width: 40rem;
  margin: 4rem auto;
  padding: 0 1.5rem;
  font-size: 1.125rem;
}

/* The page */

.page {
  max-width: 76rem;
  margin: 0 auto;
  padding: 2rem 1.5rem 3rem;
}

.masthead {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.25rem 1.25rem;
  padding-bottom: 1.25rem;
  margin-bottom: 1.5rem;
  border-bottom: 1px solid var(--line);
}

.wordmark {
  margin: 0;
  font-family: var(--serif);
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: 0.01em;
}

.wordmark a {
  color: inherit;
  text-decoration: none;
}

.tagline {
  margin: 0;
  color: var(--muted);
  font-size: 1.0625rem;
}

/* The parameter bar */

.parameters {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 0.375rem;
}

.field label,
.pane-head .label,
.pane-head label {
  font-size: 0.875rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--muted);
}

select {
  width: 100%;
  min-height: 2.75rem;
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
  font: inherit;
}

.note {
  margin: 0;
  min-height: 1.5em;
  color: var(--muted);
  font-size: 0.875rem;
}

/* The two panes */

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

.pane {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  min-width: 0;
}

.pane-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
}

.count {
  color: var(--muted);
  font-size: 0.875rem;
  font-variant-numeric: tabular-nums;
}

.count.over {
  color: var(--warn);
  font-weight: 600;
}

textarea,
.result {
  width: 100%;
  min-height: 22rem;
  margin: 0;
  padding: 1rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--shadow);
  font-family: var(--serif);
  font-size: 1.125rem;
  line-height: 1.6;
}

textarea {
  resize: vertical;
}

textarea::placeholder {
  color: var(--muted);
}

.result {
  display: block;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

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

/* The action row */

.actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem 1rem;
  margin-top: 1.25rem;
}

button {
  min-height: 2.75rem;
  padding: 0.5rem 1.25rem;
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--accent);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 120ms ease, color 120ms ease;
}

button.primary {
  background: var(--accent);
  color: var(--accent-ink);
}

button:hover:not(:disabled) {
  border-color: var(--accent-hover);
}

button.primary:hover:not(:disabled) {
  background: var(--accent-hover);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.status {
  flex: 1 1 18rem;
  margin: 0;
  color: var(--muted);
}

.colophon {
  margin-top: 2.5rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.9375rem;
}

.colophon p {
  max-width: 48rem;
  margin: 0;
}

/* Error pages the service renders */

.error-page {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 1.5rem;
}

.error-panel {
  max-width: 34rem;
  padding: 2rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.error-panel h1 {
  margin: 0.75rem 0 0.5rem;
  font-family: var(--serif);
  font-size: 1.75rem;
}

.error-panel .wordmark {
  font-size: 1.25rem;
}

.error-return {
  font-weight: 600;
}

/* Narrow screens: the parameters and the panes stack below 800 pixels. */

@media (max-width: 799px) {
  .page {
    padding: 1.25rem 1rem 2rem;
  }

  .parameters,
  .panes {
    grid-template-columns: minmax(0, 1fr);
  }

  textarea,
  .result {
    min-height: 14rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    transition: none !important;
    animation: none !important;
    scroll-behavior: auto !important;
  }
}
